123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <!-- 学院列表 -->
- <template>
- <view class="school">
- <z-paging ref="paging" v-model="schoolList" @query="queryList">
- <!-- 搜索 -->
- <view class="school-search" slot="top">
- <u-search class="school-search-input" placeholder="请输入关键词" v-model="keyword" shape="square"
- input-align="center" :show-action="false" bg-color="#ffffff" height="70" @search="keywordChange"/>
- </view>
- <view class="school-list">
- <view class="school-list-item" v-for="(item, index) in schoolList" :key="index" @click="recordBrowseTotal(item)">
- <view class="school-list-item-left">
- <view class="image">
- <u-image :src="item.schoolLogoUrl" width="112" height="112" border-radius="10" mode="aspectFill">
- <view slot="error">
- <u-image src="../../static/img/default-company.jpg" width="122" height="112" border-radius="10" mode="aspectFill"/>
- </view>
- </u-image>
- </view>
- <view class="title">
- <view class="name">{{ item.schoolName }}</view>
- <view class="grade">
- <!-- <view class="icon">
- <u-icon class="icon-img" name="star-fill" color="#EF651F" /> {{item.count}}
- </view> -->
- <view>{{ `${item.count}个专业 · ${getSchoolTypeName(item.schoolNature) || '-'} ` }}</view>
- </view>
- </view>
- </view>
- <view class="school-list-item-right">
- <u-icon name="arrow-right" color="#d2d3d5"/>
- </view>
- </view>
- </view>
- </z-paging>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- export default {
- name: 'Schools',
- data() {
- return {
- // 搜索关键词
- keyword: '',
- // 学校列表
- schoolList: [],
- // 学校性质列表
- schoolTypeList: [],
- // 分页
- page: {
- pageNum: 1,
- pageSize: 10
- }
- }
- },
- onShow() {
- this.getSchoolTypeList()
- },
- methods: {
- /**
- * 获取列表
- * @param { Number } pageNum 当前页数
- * @param { Number } pageSize 分页大小
- * @param { String } schoolName 搜索关键词
- */
- getList(pageNum, pageSize, schoolName) {
- this.$u.api.school.getSchoolList({
- pageNum: pageNum,
- pageSize: pageSize,
- schoolName: schoolName
- }).then(res => {
- if (res.code === 200) {
- this.$refs.paging.complete(res.rows)
- } else {
- this.$refs.uToast.show({
- title: res.msg,
- type: 'error'
- })
- this.$refs.paging.complete([])
- }
- }).catch(() => {
- this.$refs.uToast.show({
- title: '系统异常!',
- type: 'error'
- })
- this.$refs.paging.complete([])
- })
- },
- /**
- * 获取学校性质字典
- */
- getSchoolTypeList() {
- this.$u.api.getDictdataUrl({
- key: 'school_nature'
- }).then(res => {
- if (res.code === 200) {
- this.schoolTypeList = res.data
- }
- })
- },
- /**
- * 通过字典值去获取名称
- * @param { String } val 字典text值
- */
- getSchoolTypeName(val) {
- let name
- this.schoolTypeList.forEach(item => {
- if (Number(item.text) === Number(val)) {
- name = item.label
- }
- })
- return name
- },
- /**
- * @param { Number } pageNo
- * @param { Number } pageSize
- */
- queryList(pageNo, pageSize) {
- this.getList(pageNo, pageSize, this.keyword)
- },
- /**
- * 关键词搜索回车触发
- */
- keywordChange() {
- this.getList(1, 10, this.keyword)
- },
- /**
- * 跳转到指定页面
- * @param { String } url 指定页面的路径
- * @param { Object } params 跳转携带参数
- */
- jumpPage(url, params) {
- this.$u.route({
- url: url,
- params: params
- })
- },
- /**
- * 学校关注度统计
- * @param {Object} item
- */
- recordBrowseTotal(item) {
- const query = {
- platform: '1', // 平台:1-H5 2-APP 3-小程序 4-PC端
- pages: location.href,//页面路径
- btnName: '查看学院详情',//按钮名称
- btnEvent: '1',//按钮事件: 1-点击 2-长按 3-滑动
- ipAddress: '',//IP地址
- typeName: '学校关注度',//类型名称 例:学校关注度 、适应性考试等
- typeCode: 'XXGZD',// 类型编码 例:类型名称首字母缩写(XXGZD)
- categoryName: item.schoolName,//类别名称 例:XX学校,SS考试
- }
- this.$u.api.postAnalysis(query).then(res => {
- this.jumpPage('/pages/schoolDetails/schoolDetails', { schoolId: item.id })
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import './schools.scss';
- </style>
|