Просмотр исходного кода

修改排班,注册登陆接口

liuyuanhang 4 лет назад
Родитель
Сommit
e50492eddc
2 измененных файлов с 112 добавлено и 28 удалено
  1. 66 1
      pages/login/reg.vue
  2. 46 27
      pages/scheduling/month_Scheduling.vue

+ 66 - 1
pages/login/reg.vue

xqd xqd xqd xqd
@@ -72,7 +72,24 @@
 	var _this;
 	import wInput from '../../components/watch-input.vue' //input
 	import wButton from '../../components/watch-button.vue' //button
+	import request from '../../common/request.js'
+	var user = require('../../common/user.js');
+	import {
+		mapState,
+		mapMutations,
+		mapGetters,
+		mapActions
+	} from 'vuex';
+	import store from '@/store'
+	import auth from '../../common/authorize.js'
+	import IMService from "../../common/goeasyimutil.js"
 	export default {
+		computed: {
+			...mapGetters({
+				hasLogin: 'verifyJwt'
+			}),
+			...mapState(['user'])
+		},
 		data() {
 			return {
 				//logo图片 base64
@@ -139,7 +156,7 @@
 					});
 				}
 			},
-			startReg() {
+			startReg:async function() {
 				//注册
 				if (this.isRotate) {
 					//判断是否加载中,避免重复点击请求
@@ -153,6 +170,14 @@
 					});
 					return false;
 				}
+				if(this.verCode.length==0){
+					uni.showToast({
+						icon: 'none',
+						position: 'bottom',
+						title: '请输入验证码'
+					});
+					return false;
+				}
 				if (this.verCode != this.sourceVerCode) {
 					uni.showToast({
 						icon: 'none',
@@ -177,8 +202,48 @@
 					})
 					return false
 				}
+				
 				_this.isRotate = true//开始加载动画
 				
+				let res = await this.$request.post('common/phoneRegister',{'phone':this.phoneData,'password':this.password});
+				if (res.status == 0) {
+					uni.showToast({
+						icon: 'none',
+						position: 'bottom',
+						title: '登陆成功'
+					});
+					store.commit('setJwt', res.data.token);
+					store.commit('setUser', res.data);
+					store.commit('login');
+				
+					uni.removeStorage('verfiyCode')				
+					getApp().globalData.imService = new IMService();
+					let loginResult = getApp().globalData.imService.login({
+						uuid: res.data.data.flag,
+						name: res.data.data.name,
+						avatar: res.data.data.avatar
+					});
+					if (loginResult) {
+						//连接IM
+						getApp().globalData.imService.connectIM();
+					}
+					// 写一个跳转到首页
+					setTimeout(function() {
+						uni.navigateBack({
+							delta: 2
+						})
+					}, 2000)
+					return false;
+				} else {
+					uni.showToast({
+						icon: 'none',
+						position: 'bottom',
+						title: res.message
+					});
+					return false;
+				}
+				
+				
 				// setTimeout(function() {//三秒后关闭加载动画
 				// 	_this.isRotate = false
 				// }, 3000)

+ 46 - 27
pages/scheduling/month_Scheduling.vue

xqd xqd xqd xqd xqd xqd
@@ -142,7 +142,8 @@
 				hospitalListShow: false, //控制医院选择器
 				hospitalTimes: 0,
 				// 医院列表
-				hospitalList: [],
+				hospitalList: [],
+				saveDayType:{mon:0,aft:0,nig:0},
 				// 一个月的排班数据 从一号开始
 				//下标0为一号,值为医院ID
 				// 没有排班记录为0
@@ -193,17 +194,18 @@
 			close: async function() {
 				this.popupShow = false;
 				let SaveLists = [];
-				let SaveDate = this.saveDay;
-				console.log(1111)
+				let SaveDate = JSON.parse(JSON.stringify(this.saveDay));
+				console.log('修改数据:',this.saveDayType);
+		
 				if (this.saveDay != 0) {
 					if (this.hospitalID != 0) {
-						if (SaveDate.mon == this.hospitalID) {
+						if (this.saveDayType.mon == this.hospitalID) {
 							SaveLists.push(1)
 						}
-						if (SaveDate.aft == this.hospitalID) {
+						if (this.saveDayType.aft == this.hospitalID) {
 							SaveLists.push(2)
 						}
-						if (SaveDate.nig == this.hospitalID) {
+						if (this.saveDayType.nig == this.hospitalID) {
 							SaveLists.push(3)
 						}
 						if (SaveLists.length != 0) {
@@ -225,8 +227,8 @@
 									title: "修改成功!",
 								})
 								SaveLists = [];
-								this.saveDay = 0;
-
+								this.saveDay = 0;SaveDate=0;
+							
 							}
 
 						}
@@ -428,17 +430,18 @@
 
 				this.getListTime(e[0].value)
 				this.hospital = e[0].label
-				this.hospitalID = e[0].value + ""
+				this.hospitalID = e[0].value + ""
+				console.log('月份:',this.monthList);
 				for (let x = 0; x < this.monthList.length - this.empty; x++) {
 					this.monthList[x + this.empty].mon = this.schedulingList[x].mon == "0" ? 0 : this.schedulingList[x].mon == this
 						.hospitalID ?
-						1 : 2
+						1 :3
 					this.monthList[x + this.empty].aft = this.schedulingList[x].aft == "0" ? 0 : this.schedulingList[x].aft == this
 						.hospitalID ?
-						1 : 2
+						1 : 3
 					this.monthList[x + this.empty].nig = this.schedulingList[x].nig == "0" ? 0 : this.schedulingList[x].nig == this
 						.hospitalID ?
-						1 : 2
+						1 : 3
 				}
 			},
 			/**
@@ -464,7 +467,10 @@
 				if (index >= this.empty) {
 					this.monthList.map(val => {
 						val.select = false
-					})
+					})
+					this.saveDayType.mon= this.schedulingList[index-2].mon;
+					this.saveDayType.aft= this.schedulingList[index-2].aft;
+					this.saveDayType.nig= this.schedulingList[index-2].nig;
 					this.monthList[index].select = true
 					this.day = text
 					this.popupShow = true
@@ -500,45 +506,58 @@
 			 * */
 			modify(id) {
 				if (id == 0) {
-					this.monthList[this.day + this.empty - 1].mon = 1 //
+					this.monthList[this.day + this.empty - 1].mon = this.hospitalID //
 					this.schedulingList[this.day - 1].mon = this.hospitalID
 
-					this.monthList[this.day + this.empty - 1].aft = 1 //
+					this.monthList[this.day + this.empty - 1].aft = this.hospitalID //
 					this.schedulingList[this.day - 1].aft = this.hospitalID
 
-					this.monthList[this.day + this.empty - 1].nig = 1 //
+					this.monthList[this.day + this.empty - 1].nig = this.hospitalID //
 					this.schedulingList[this.day - 1].nig = this.hospitalID
 				} else {
-					this.saveDay = this.monthList[this.day + this.empty - 1];
+				
 					switch (id) {
 						case 1:
 							if (this.monthList[this.day + this.empty - 1].mon == 1) { //当这个按钮状态为1 选择了医院且是当前医院
 								this.monthList[this.day + this.empty - 1].mon = 0 //就取消选择
-								this.schedulingList[this.day - 1].mon = 0
+								this.schedulingList[this.day - 1].mon = 0
+								this.saveDayType.mon =0;
 							} else if (this.monthList[this.day + this.empty - 1].mon == 0) {
-								this.monthList[this.day + this.empty - 1].mon = 1 //
-								this.schedulingList[this.day - 1].mon = this.hospitalID
+								this.monthList[this.day + this.empty - 1].mon = this.hospitalID //
+								this.schedulingList[this.day - 1].mon = this.hospitalID
+								console.log('选择了早上的医院:',this.hospitalID);
+								this.saveDayType.mon = this.hospitalID;
 							}
 							break;
 						case 2:
 							if (this.monthList[this.day + this.empty - 1].aft == 1) { //当这个按钮状态为1 选择了医院且是当前医院
 								this.monthList[this.day + this.empty - 1].aft = 0 //就取消选择
-								this.schedulingList[this.day - 1].aft = 0
+								this.schedulingList[this.day - 1].aft = 0
+								this.saveDayType.aft =0;
 							} else if (this.monthList[this.day + this.empty - 1].aft == 0) {
-								this.monthList[this.day + this.empty - 1].aft = 1 //
-								this.schedulingList[this.day - 1].aft = this.hospitalID
+								this.monthList[this.day + this.empty - 1].aft = this.hospitalID //
+								this.schedulingList[this.day - 1].aft = this.hospitalID
+								console.log('选择了下午的医院:',this.hospitalID);
+								this.saveDayType.aft = this.hospitalID;
 							}
 							break;
 						case 3:
 							if (this.monthList[this.day + this.empty - 1].nig == 1) { //当这个按钮状态为1 选择了医院且是当前医院
 								this.monthList[this.day + this.empty - 1].nig = 0 //就取消选择
-								this.schedulingList[this.day - 1].nig = 0
+								this.schedulingList[this.day - 1].nig = 0
+								this.saveDayType.nig = 0;
 							} else if (this.monthList[this.day + this.empty - 1].nig == 0) {
-								this.monthList[this.day + this.empty - 1].nig = 1 //
-								this.schedulingList[this.day - 1].nig = this.hospitalID
+								this.monthList[this.day + this.empty - 1].nig = this.hospitalID //
+								this.schedulingList[this.day - 1].nig = this.hospitalID
+								 
+								console.log('选择了晚上的医院:',this.hospitalID);
+								this.saveDayType.nig = this.hospitalID;
 							}
 							break;
-					}
+					}
+					this.saveDay = this.monthList[this.day + this.empty - 1];
+					console.log('选择的日期:',this.monthList[this.day + this.empty - 1]);
+					console.log('ID:',id);
 					// this.$forceUpdate();
 				} 
 			},