|
@@ -2,10 +2,14 @@
|
|
|
<view class="page-content experts">
|
|
|
<view class="page-header experts-header">
|
|
|
<view class="experts-header-field">
|
|
|
- <picker @change="bindPickerChange" :value="expertsFieldIndex" :range="expertsFieldList">
|
|
|
+ <picker @change="bindPickerChange"
|
|
|
+ :value="expertsFieldIndex"
|
|
|
+ :range="expertsFieldList">
|
|
|
<view class="field-content">
|
|
|
<view class="field-img">
|
|
|
- <u-icon name="list" size="54" class="field-icon"></u-icon>
|
|
|
+ <u-icon name="list"
|
|
|
+ size="54"
|
|
|
+ class="field-icon"></u-icon>
|
|
|
</view>
|
|
|
<view class="field-text">{{ expertsFieldList[expertsFieldIndex] }}</view>
|
|
|
</view>
|
|
@@ -14,7 +18,9 @@
|
|
|
</view>
|
|
|
<view class="page-main experts-content">
|
|
|
<view class="experts-content-main">
|
|
|
- <scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="handleScrolltolower">
|
|
|
+ <scroll-view scroll-y="true"
|
|
|
+ class="scroll-Y"
|
|
|
+ @scrolltolower="handleScrolltolower">
|
|
|
<view class="experts-content-main-listbody">
|
|
|
<template v-if="expertsMainObj.list_empty">
|
|
|
<view class="experts-content-main-nodata">
|
|
@@ -22,14 +28,15 @@
|
|
|
</view>
|
|
|
</template>
|
|
|
<template>
|
|
|
- <u-row gutter="16" class="listbody-row">
|
|
|
- <u-col
|
|
|
- span="12"
|
|
|
+ <u-row gutter="16"
|
|
|
+ class="listbody-row">
|
|
|
+ <u-col span="12"
|
|
|
class="listbody-col"
|
|
|
v-for="expertsModalItem in expertsMainObj.expertsModalList"
|
|
|
- :key="expertsModalItem.id"
|
|
|
- >
|
|
|
- <view class="listbody-item">
|
|
|
+ :key="expertsModalItem.id">
|
|
|
+ <view class="listbody-item"
|
|
|
+ @click="handleExpertsModalItemClick(expertsModalItem)"
|
|
|
+ :class="expertsModalItem.isCheckedItem?'listbody-checkeditem':''">
|
|
|
<view class="item-content">
|
|
|
<view class="item-content-sub item-content-left">
|
|
|
<text class="item-content-text">姓名:{{ expertsModalItem.professorName }}</text>
|
|
@@ -63,13 +70,15 @@
|
|
|
</u-col>
|
|
|
</u-row>
|
|
|
</template>
|
|
|
- <uni-load-more :status="expertsMainObj.loadStatus" v-if="!expertsMainObj.list_empty"></uni-load-more>
|
|
|
+ <uni-load-more :status="expertsMainObj.loadStatus"
|
|
|
+ v-if="!expertsMainObj.list_empty"></uni-load-more>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
</view>
|
|
|
<view class="experts-content-btn">
|
|
|
<view class="experts-consultbtn">
|
|
|
- <view class="consultbtn-text" @click="handleConsultExpertsClick">咨询专家</view>
|
|
|
+ <view class="consultbtn-text"
|
|
|
+ @click="handleConsultExpertsClick">咨询专家</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -77,269 +86,286 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import {
|
|
|
- expertsMainListData,
|
|
|
- expertsMainFieldListData
|
|
|
-} from '@/agrcloud-api/expertsmodal';
|
|
|
-import uniLoadMore from "@/agrcloud-components/uni-load-more/uni-load-more"
|
|
|
-
|
|
|
-export default {
|
|
|
- name: 'experts',
|
|
|
- components: {
|
|
|
- uniLoadMore
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- expertsFieldIndex: 0,
|
|
|
- expertsFieldList: ["全部"],
|
|
|
- currExpertsFieldValue: '',
|
|
|
- expertsMainObj: {
|
|
|
- loadStatus: 'more',
|
|
|
- list_empty: false,
|
|
|
- pageTotal: 0,
|
|
|
- pageCount: 0,
|
|
|
- pagination: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10
|
|
|
- },
|
|
|
- listData: []
|
|
|
- }
|
|
|
- };
|
|
|
- },
|
|
|
- onLoad() {
|
|
|
- this.initData();
|
|
|
- },
|
|
|
- methods: {
|
|
|
- initData() {
|
|
|
- this.getExpertsMainFieldListData();
|
|
|
+ import {
|
|
|
+ expertsMainListData,
|
|
|
+ expertsMainFieldListData
|
|
|
+ } from '@/agrcloud-api/expertsmodal';
|
|
|
+ import uniLoadMore from "@/agrcloud-components/uni-load-more/uni-load-more"
|
|
|
+
|
|
|
+ export default {
|
|
|
+ name: 'experts',
|
|
|
+ components: {
|
|
|
+ uniLoadMore
|
|
|
},
|
|
|
- getExpertsMainFieldListData() {
|
|
|
- expertsMainFieldListData().then((res) => {
|
|
|
- this.expertsFieldList = [...this.expertsFieldList, ...res.data || []];
|
|
|
- this.getExpertsMainListData();
|
|
|
- });
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ expertsFieldIndex: 0,
|
|
|
+ expertsFieldList: ["全部"],
|
|
|
+ currExpertsFieldValue: '',
|
|
|
+ expertsMainObj: {
|
|
|
+ loadStatus: 'more',
|
|
|
+ list_empty: false,
|
|
|
+ pageTotal: 0,
|
|
|
+ pageCount: 0,
|
|
|
+ pagination: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10
|
|
|
+ },
|
|
|
+ listData: []
|
|
|
+ }
|
|
|
+ };
|
|
|
},
|
|
|
- bindPickerChange: function (e) {
|
|
|
- this.expertsFieldIndex = e.target.value;
|
|
|
- const currPickerChangeField = this.expertsFieldList[e.target.value];
|
|
|
- this.currExpertsFieldValue = (currPickerChangeField != '全部') ? currPickerChangeField : '';
|
|
|
- this.expertsMainObj.pagination.pageNum = 1;
|
|
|
- this.getExpertsMainListData();
|
|
|
+ onLoad() {
|
|
|
+ this.initData();
|
|
|
},
|
|
|
- getExpertsMainListData() {
|
|
|
- this.expertsMainObj = {
|
|
|
- ...this.expertsMainObj,
|
|
|
- list_empty: false,
|
|
|
- loadStatus: 'loading',
|
|
|
- pageTotal: 0
|
|
|
- };
|
|
|
-
|
|
|
- // 请求获取列表数据
|
|
|
- expertsMainListData({
|
|
|
- ...this.expertsMainObj.pagination,
|
|
|
- professorField: this.currExpertsFieldValue
|
|
|
- }).then(res => {
|
|
|
- // 数据总条数
|
|
|
- this.expertsMainObj.pageTotal = res.total || 0;
|
|
|
-
|
|
|
- // 如果列表为第一页,返回列表数据清空
|
|
|
- if (this.expertsMainObj.pagination.pageNum == 1) {
|
|
|
- this.expertsMainObj.expertsModalList = [];
|
|
|
+ methods: {
|
|
|
+ initData() {
|
|
|
+ this.getExpertsMainFieldListData();
|
|
|
+ },
|
|
|
+ getExpertsMainFieldListData() {
|
|
|
+ expertsMainFieldListData().then((res) => {
|
|
|
+ this.expertsFieldList = [...this.expertsFieldList, ...res.data || []];
|
|
|
+ this.getExpertsMainListData();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ bindPickerChange: function(e) {
|
|
|
+ this.expertsFieldIndex = e.target.value;
|
|
|
+ const currPickerChangeField = this.expertsFieldList[e.target.value];
|
|
|
+ this.currExpertsFieldValue = (currPickerChangeField != '全部') ? currPickerChangeField : '';
|
|
|
+ this.expertsMainObj.pagination.pageNum = 1;
|
|
|
+ this.getExpertsMainListData();
|
|
|
+ },
|
|
|
+ getExpertsMainListData() {
|
|
|
+ this.expertsMainObj = {
|
|
|
+ ...this.expertsMainObj,
|
|
|
+ list_empty: false,
|
|
|
+ loadStatus: 'loading',
|
|
|
+ pageTotal: 0
|
|
|
};
|
|
|
|
|
|
- // 处理返回结果
|
|
|
- if ((res.rows || []).length <= 0) { // 返回结果没有数据
|
|
|
- if ((this.expertsMainObj.expertsModalList || []).length <= 0) {
|
|
|
- this.expertsMainObj.loadStatus = 'noMores';
|
|
|
- this.expertsMainObj.list_empty = true;
|
|
|
- } else {
|
|
|
- this.expertsMainObj.loadStatus = 'noMores';
|
|
|
- }
|
|
|
- } else { //返回结果有数据
|
|
|
- //返回历史咨询列表存在
|
|
|
- this.expertsMainObj.list_empty = false;
|
|
|
+ // 请求获取列表数据
|
|
|
+ expertsMainListData({
|
|
|
+ ...this.expertsMainObj.pagination,
|
|
|
+ professorField: this.currExpertsFieldValue
|
|
|
+ }).then(res => {
|
|
|
+ // 数据总条数
|
|
|
+ this.expertsMainObj.pageTotal = res.total || 0;
|
|
|
+
|
|
|
+ // 如果列表为第一页,返回列表数据清空
|
|
|
+ if (this.expertsMainObj.pagination.pageNum == 1) {
|
|
|
+ this.expertsMainObj.expertsModalList = [];
|
|
|
+ };
|
|
|
|
|
|
- // 获取列表数据分页数量
|
|
|
- this.expertsMainObj.pageCount = Math.ceil((res.total || 0) / this.expertsMainObj.pagination.pageSize);
|
|
|
- if ((res.total || 0) % this.expertsMainObj.pagination.pageSize == 0) {
|
|
|
+ // 处理返回结果
|
|
|
+ if ((res.rows || []).length <= 0) { // 返回结果没有数据
|
|
|
+ if ((this.expertsMainObj.expertsModalList || []).length <= 0) {
|
|
|
+ this.expertsMainObj.loadStatus = 'noMores';
|
|
|
+ this.expertsMainObj.list_empty = true;
|
|
|
+ } else {
|
|
|
+ this.expertsMainObj.loadStatus = 'noMores';
|
|
|
+ }
|
|
|
+ } else { //返回结果有数据
|
|
|
+ //返回历史咨询列表存在
|
|
|
+ this.expertsMainObj.list_empty = false;
|
|
|
+
|
|
|
+ // 获取列表数据分页数量
|
|
|
this.expertsMainObj.pageCount = Math.ceil((res.total || 0) / this.expertsMainObj.pagination.pageSize);
|
|
|
- if (this.expertsMainObj.pageCount == 1) {
|
|
|
+ if ((res.total || 0) % this.expertsMainObj.pagination.pageSize == 0) {
|
|
|
+ this.expertsMainObj.pageCount = Math.ceil((res.total || 0) / this.expertsMainObj.pagination.pageSize);
|
|
|
+ if (this.expertsMainObj.pageCount == 1) {
|
|
|
+ this.expertsMainObj.pageCount--;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
this.expertsMainObj.pageCount--;
|
|
|
+ };
|
|
|
+
|
|
|
+ // 处理页面状态
|
|
|
+ if (this.expertsMainObj.pageCount === 0) {
|
|
|
+ this.expertsMainObj.loadStatus = 'noMores'
|
|
|
+ } else {
|
|
|
+ this.expertsMainObj.loadStatus = 'more'
|
|
|
}
|
|
|
- } else {
|
|
|
- this.expertsMainObj.pageCount--;
|
|
|
- };
|
|
|
|
|
|
- // 处理页面状态
|
|
|
- if (this.expertsMainObj.pageCount === 0) {
|
|
|
- this.expertsMainObj.loadStatus = 'noMores'
|
|
|
- } else {
|
|
|
- this.expertsMainObj.loadStatus = 'more'
|
|
|
- }
|
|
|
+ // 组装返回数据
|
|
|
+ this.expertsMainObj.expertsModalList.push.apply(this.expertsMainObj.expertsModalList, res.rows || []);
|
|
|
|
|
|
- // 组装返回数据
|
|
|
- this.expertsMainObj.expertsModalList.push.apply(this.expertsMainObj.expertsModalList, res.rows || []);
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ }
|
|
|
|
|
|
- uni.stopPullDownRefresh();
|
|
|
+ }).catch(err => {
|
|
|
+ this.expertsMainObj.loadStatus = 'noMores';
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleScrolltolower() {
|
|
|
+ this.expertsMainObj.loadStatus = 'loading'
|
|
|
+ if (this.expertsMainObj.pagination.pageNum - 1 >= this.expertsMainObj.pageCount) {
|
|
|
+ this.expertsMainObj.loadStatus = 'noMores';
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ this.expertsMainObj.pagination.pageNum++;
|
|
|
+ this.getExpertsMainListData();
|
|
|
}
|
|
|
-
|
|
|
- }).catch(err => {
|
|
|
- this.expertsMainObj.loadStatus = 'noMores';
|
|
|
- });
|
|
|
- },
|
|
|
- handleScrolltolower() {
|
|
|
- this.expertsMainObj.loadStatus = 'loading'
|
|
|
- if (this.expertsMainObj.pagination.pageNum - 1 >= this.expertsMainObj.pageCount) {
|
|
|
- this.expertsMainObj.loadStatus = 'noMores';
|
|
|
- return
|
|
|
- } else {
|
|
|
- this.expertsMainObj.pagination.pageNum++;
|
|
|
- this.getExpertsMainListData();
|
|
|
+ },
|
|
|
+ handleConsultExpertsClick() {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/experts/modal/index'
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleExpertsModalItemClick(itemParam) {
|
|
|
+ debugger
|
|
|
+ for (let itemIndex = 0; itemIndex < (this.expertsMainObj.expertsModalList || []).length; itemIndex++) {
|
|
|
+ if (itemParam.id == this.expertsMainObj.expertsModalList[itemIndex].id) {
|
|
|
+ this.expertsMainObj.expertsModalList[itemIndex].isCheckedItem = true;
|
|
|
+ } else {
|
|
|
+ this.expertsMainObj.expertsModalList[itemIndex].isCheckedItem = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.expertsMainObj = {
|
|
|
+ ...this.expertsMainObj,
|
|
|
+ expertsModalList: this.expertsMainObj.expertsModalList
|
|
|
+ };
|
|
|
}
|
|
|
- },
|
|
|
- handleConsultExpertsClick() {
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/experts/modal/index'
|
|
|
- });
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss"
|
|
|
scoped>
|
|
|
-.experts {
|
|
|
- padding: 0;
|
|
|
+ .experts {
|
|
|
+ padding: 0;
|
|
|
|
|
|
- &-header {
|
|
|
- width: 100%;
|
|
|
- background: #ffffff;
|
|
|
-
|
|
|
- &-field {
|
|
|
- margin: 24rpx;
|
|
|
+ &-header {
|
|
|
width: 100%;
|
|
|
- height: 56rpx;
|
|
|
- line-height: 56rpx;
|
|
|
+ background: #ffffff;
|
|
|
|
|
|
- .field-content {
|
|
|
- display: flex;
|
|
|
+ &-field {
|
|
|
+ margin: 24rpx;
|
|
|
+ width: 100%;
|
|
|
+ height: 56rpx;
|
|
|
+ line-height: 56rpx;
|
|
|
|
|
|
- .field-img {
|
|
|
- flex: 1;
|
|
|
- margin-top: 4rpx;
|
|
|
- }
|
|
|
+ .field-content {
|
|
|
+ display: flex;
|
|
|
|
|
|
- .field-text {
|
|
|
- flex: 10;
|
|
|
- height: 56rpx;
|
|
|
- font-size: 34rpx;
|
|
|
- font-family: PingFangSC-Medium, PingFang SC;
|
|
|
- font-weight: 500;
|
|
|
- color: #333333;
|
|
|
- line-height: 56rpx;
|
|
|
+ .field-img {
|
|
|
+ flex: 1;
|
|
|
+ margin-top: 4rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .field-text {
|
|
|
+ flex: 10;
|
|
|
+ height: 56rpx;
|
|
|
+ font-size: 34rpx;
|
|
|
+ font-family: PingFangSC-Medium, PingFang SC;
|
|
|
+ font-weight: 500;
|
|
|
+ color: #333333;
|
|
|
+ line-height: 56rpx;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- &-content {
|
|
|
- width: 100%;
|
|
|
-
|
|
|
- .experts-content-main {
|
|
|
- .scroll-Y {
|
|
|
- height: calc(
|
|
|
- 100vh - 88rpx - 236rpx - env(safe-area-inset-bottom) -
|
|
|
- var(--status-bar-height)
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
- .experts-content-main-listbody {
|
|
|
- .experts-content-main-nodata {
|
|
|
- text-align: center;
|
|
|
- margin-top: 20rpx;
|
|
|
+ &-content {
|
|
|
+ width: 100%;
|
|
|
|
|
|
- .expertsmain-nodata {
|
|
|
- font-size: 30rpx;
|
|
|
- color: #777777;
|
|
|
- }
|
|
|
+ .experts-content-main {
|
|
|
+ .scroll-Y {
|
|
|
+ height: calc(100vh - 88rpx - 236rpx - env(safe-area-inset-bottom) - var(--status-bar-height));
|
|
|
}
|
|
|
|
|
|
- .listbody-row {
|
|
|
- .listbody-col {
|
|
|
- padding: 24rpx 0 0 0 !important;
|
|
|
-
|
|
|
- .listbody-item {
|
|
|
- background: #ffffff;
|
|
|
- min-height: 288rpx;
|
|
|
- width: 100%;
|
|
|
- padding-bottom: 24rpx;
|
|
|
+ .experts-content-main-listbody {
|
|
|
+ .experts-content-main-nodata {
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 20rpx;
|
|
|
|
|
|
- .item-content {
|
|
|
- display: flex;
|
|
|
- padding-top: 24rpx;
|
|
|
+ .expertsmain-nodata {
|
|
|
+ font-size: 30rpx;
|
|
|
+ color: #777777;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- &-sub {
|
|
|
- flex: 1;
|
|
|
- }
|
|
|
+ .listbody-row {
|
|
|
|
|
|
- &-left {
|
|
|
- padding-left: 24rpx;
|
|
|
- }
|
|
|
+ .listbody-col {
|
|
|
+ padding: 24rpx 0 0 0 !important;
|
|
|
|
|
|
- &-right {
|
|
|
- padding-right: 24rpx;
|
|
|
- }
|
|
|
-
|
|
|
- &-field {
|
|
|
- padding: 0rpx 24rpx 0rpx 24rpx;
|
|
|
- }
|
|
|
-
|
|
|
- &-institution {
|
|
|
- padding: 0rpx 24rpx 0rpx 24rpx;
|
|
|
- }
|
|
|
+ .listbody-checkeditem {
|
|
|
+ border-top: 2rpx solid #bae5fa;
|
|
|
+ border-bottom: 2rpx solid #bae5fa;
|
|
|
+ }
|
|
|
|
|
|
- &-text {
|
|
|
- height: 42rpx;
|
|
|
- font-size: 30rpx;
|
|
|
- font-family: PingFangSC-Regular, PingFang SC;
|
|
|
- font-weight: 400;
|
|
|
- color: #666666;
|
|
|
- line-height: 42rpx;
|
|
|
+ .listbody-item {
|
|
|
+ background: #ffffff;
|
|
|
+ min-height: 288rpx;
|
|
|
+ width: 100%;
|
|
|
+ padding-bottom: 24rpx;
|
|
|
+
|
|
|
+ .item-content {
|
|
|
+ display: flex;
|
|
|
+ padding-top: 24rpx;
|
|
|
+
|
|
|
+ &-sub {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-left {
|
|
|
+ padding-left: 24rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-right {
|
|
|
+ padding-right: 24rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-field {
|
|
|
+ padding: 0rpx 24rpx 0rpx 24rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-institution {
|
|
|
+ padding: 0rpx 24rpx 0rpx 24rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ &-text {
|
|
|
+ height: 42rpx;
|
|
|
+ font-size: 30rpx;
|
|
|
+ font-family: PingFangSC-Regular, PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #666666;
|
|
|
+ line-height: 42rpx;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- &-btn {
|
|
|
- width: 100%;
|
|
|
- position: fixed;
|
|
|
- bottom: 40rpx;
|
|
|
- padding: 16rpx 32rpx;
|
|
|
-
|
|
|
- .experts-consultbtn {
|
|
|
- width: 686rpx;
|
|
|
- height: 88rpx;
|
|
|
- background: #53a0fd;
|
|
|
- border-radius: 4rpx;
|
|
|
+ &-btn {
|
|
|
width: 100%;
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
-
|
|
|
- .consultbtn-text {
|
|
|
- height: 50rpx;
|
|
|
- font-size: 36rpx;
|
|
|
- font-family: PingFangSC-Regular, PingFang SC;
|
|
|
- font-weight: 400;
|
|
|
- color: #ffffff;
|
|
|
- line-height: 50rpx;
|
|
|
+ position: fixed;
|
|
|
+ bottom: 40rpx;
|
|
|
+ padding: 16rpx 32rpx;
|
|
|
+
|
|
|
+ .experts-consultbtn {
|
|
|
+ width: 686rpx;
|
|
|
+ height: 88rpx;
|
|
|
+ background: #53a0fd;
|
|
|
+ border-radius: 4rpx;
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+
|
|
|
+ .consultbtn-text {
|
|
|
+ height: 50rpx;
|
|
|
+ font-size: 36rpx;
|
|
|
+ font-family: PingFangSC-Regular, PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #ffffff;
|
|
|
+ line-height: 50rpx;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
</style>
|