yanjie hace 4 años
padre
commit
cd8b97094c
Se han modificado 2 ficheros con 67 adiciones y 43 borrados
  1. 51 30
      pages/index/index.vue
  2. 16 13
      pages/login/doctorRenzheng.vue

+ 51 - 30
pages/index/index.vue

xqd xqd xqd xqd xqd xqd xqd xqd
@@ -144,8 +144,8 @@
 				</view>
 			</view>
 			<view class="padding-lr">
-				<view v-for="(item,index) in docterMessageList" :key="index" @touchstart.prevent="touchstart(index)"
-				 @touchend.prevent="touchend" @click="navt(item)" class="padding-lr-sm padding-tb-sm bg-white margin-top-sm" style="border-radius: 32rpx;">
+				<view v-for="(item,index) in docterMessageList" :key="index" @longpress="touchstart(index)" @click="navt(item)"
+				 class="padding-lr-sm padding-tb-sm bg-white margin-top-sm" style="border-radius: 32rpx;">
 					<view class="flex justify-start align-center">
 						<!-- 1为订单通知 2为系统通知 3为通知类型 -->
 						<image src="https://zhengda.oss-cn-chengdu.aliyuncs.com/baoma/static/home/ddtz.png" v-if="item.type==1||item.type==2||item.type==3"
@@ -290,7 +290,7 @@
 		},
 		methods: {
 			getDocterInfo: async function() {
-				let res = await this.$request.post("doctor/doctorInfor", {});
+				let res = await this.$request.post("doctor/doctorInfor", {}, false);
 				if (res.data.name.length > 5) {
 					this.docterInfo.name = res.data.name.substring(0, 5) + "...";
 				} else {
@@ -308,11 +308,10 @@
 				console.log('认证', this.docterInfo.is_then)
 			},
 			getDocterMessage: async function() {
-
 				let res = await this.$request.post("docterMessage/docterMessageList", {
 					curPage: this.page,
 					pageSize: 10
-				});
+				}, false);
 				if (res.data.length == 0) {
 					// uni.showToast({
 					// 	title: '没有更多数据',
@@ -333,17 +332,35 @@
 			},
 			//全部已读
 			allread: async function() {
-				let res = await this.$request.post("docterMessage/okDocterMessage", {});
+				if (this.docterMessageList.length == 0) {
+					uni.showToast({
+						title: "暂无通知",
+						icon: "none"
+					})
+					return false
+				}
+				if(this.docterMessageList.every((item)=>item.status==1? false: true)){
+					uni.showToast({
+						title: "暂无未读消息",
+						icon: "none"
+					})
+					return false
+				}
+				let res = await this.$request.post("docterMessage/okDocterMessage", {}, false);
 				console.log(res);
 				if (res.message == "success") {
-					uni.showToast({
-						title: '操作完成',
-						duration: 2000,
-						icon: 'none'
+					// uni.showToast({
+					// 	title: '操作完成',
+					// 	duration: 2000,
+					// 	icon: 'none'
+					// })
+					// this.page = 1;
+					// this.docterMessageList = [];
+					// this.getDocterMessage();
+					this.docterMessageList.forEach(item => {
+						item.status = 2
 					})
-					this.page = 1;
-					this.docterMessageList = [];
-					this.getDocterMessage();
+					this.$forceUpdate()
 				} else if (res.message == '操作失败!') {
 					uni.showToast({
 						title: '操作完成',
@@ -359,22 +376,26 @@
 			//长按删除
 			async touchstart(index) {
 				let that = this;
-				clearInterval(this.Loop); //再次清空定时器,防止重复注册定时器
-				this.Loop = setTimeout(async function() {
-					uni.showModal({
-						title: '删除',
-						content: '请问要删除本条消息吗?',
-						success: async function(res) {
-							if (res.confirm) {
-								let res = await that.$request.post("docterMessage/delDocterMessage", {
-									id: that.docterMessageList[index].id
-								});
-							} else if (res.cancel) {
-								console.log('用户点击取消');
+				//clearInterval(this.Loop); //再次清空定时器,防止重复注册定时器
+				uni.showModal({
+					title: '删除',
+					content: '请问要删除本条消息吗?',
+					success: async function(res) {
+						if (res.confirm) {
+							let res = await that.$request.post("docterMessage/delDocterMessage", {
+								id: that.docterMessageList[index].id
+							});
+							if (res.status == 0) {
+								that.docterMessageList.splice(index, 1)
 							}
+						} else if (res.cancel) {
+							console.log('用户点击取消');
 						}
-					});
-				}.bind(this), 3000);
+					}
+				});
+				// this.Loop = setTimeout(async function() {
+
+				// }.bind(this), 3000);
 			},
 			ellipsis(value) {
 				if (!value) return ''
@@ -491,7 +512,7 @@
 						confirmText: "知道了",
 						showCancel: false,
 					})
-					
+
 				} else if (e.type == 10) {
 					// 10服务开通通知
 					uni.showModal({
@@ -520,7 +541,7 @@
 						url: '/pages/Scheduling'
 					})
 				}
-					return false;
+				return false;
 				console.log(e);
 			},
 			//如果点击模块   需要判断认证
@@ -565,7 +586,7 @@
 			getStatus: async function() {
 				let res = await this.$request.post('doctor/getSettingList', {
 					'type': 1
-				});
+				}, false);
 
 				if (res.status == 0) {
 					this.mzModal = res.data.is_appoint

+ 16 - 13
pages/login/doctorRenzheng.vue

xqd xqd xqd xqd
@@ -389,7 +389,7 @@
 					hospitalText: '', //机构信息文字
 					preservation: false, //是否已经保存
 					Submit: 4, // 信息状态 
-					hospitalID:0//医院id
+					hospitalID: 0 //医院id
 				})
 				console.log(this.mechanismList)
 			},
@@ -477,11 +477,11 @@
 					 * 新需求,已经选择过的医院不再出现
 					 * 循环已经认证的机构,在里面找
 					 * */
-					for(let i=0;i<this.mechanismList.length;i++){
-						console.log('hospitalID',this.mechanismList[i].hospitalID)
-						for(let j=0;j<this.hospitallist.length;j++){
-							if(this.mechanismList[i].hospitalID == this.hospitallist[j].value){
-								this.hospitallist.splice(j,1); 
+					for (let i = 0; i < this.mechanismList.length; i++) {
+						console.log('hospitalID', this.mechanismList[i].hospitalID)
+						for (let j = 0; j < this.hospitallist.length; j++) {
+							if (this.mechanismList[i].hospitalID == this.hospitallist[j].value) {
+								this.hospitallist.splice(j, 1);
 							}
 						}
 
@@ -489,11 +489,11 @@
 						// let a = this.mechanismList[i].hospitalText.indexOf('-')
 						// console.log('a',a)
 						// if(a>0){
-							
+
 						// }
 					}
 					console.log('hospitallist', this.hospitallist)
-					console.log('mechanismList',this.mechanismList)
+					console.log('mechanismList', this.mechanismList)
 				}
 			},
 			// //科室
@@ -593,13 +593,16 @@
 				let res = await this.$request.post('doctor/addthen', this.form);
 				console.log('res...:', res);
 				if (res.status == 0) {
-					uni.switchTab({
-						url: '../index/index'
+					// uni.switchTab({
+					// 	url: '../index/index'
+					// })
+					uni.navigateBack({
+						delta: 1
 					})
-				}else{
+				} else {
 					uni.showToast({
-						icon:'none',
-						title:res.message
+						icon: 'none',
+						title: res.message
 					})
 				}