Parcourir la source

宿舍号为空问题解决

soft5566 il y a 3 ans
Parent
commit
6053889f3d

+ 1 - 1
pages/recharge/recharge.vue

@@ -49,7 +49,7 @@
 			// 系统正在维护...
 			if (this.test == 'weihuzhong') {
 				uni.redirectTo({
-					url: '/pages/index/index'
+					url: '../../pages/index/index'
 				})
 
 				return;

+ 4 - 4
pages/reshui/reshui.vue

@@ -343,7 +343,7 @@
 							this.stu_number = userinfo.card_number
 						} else {
 							uni.navigateTo({
-								url: '/pages/index/index?from=' + options.from
+								url: '../../pages/index/index?from=' + options.from
 							})
 
 							uni.showToast({
@@ -440,7 +440,7 @@
 						});
 
 						uni.navigateTo({
-							url: '/pages/index/index?from=' + options.from
+							url: '../../pages/index/index?from=' + options.from
 						})
 					}
 				} else if (res.data.mess == '未查询到用户信息') {
@@ -453,11 +453,11 @@
 
 					if (options && typeof(options.from) != 'undefined' && typeof(options.from) != '') {
 						uni.navigateTo({
-							url: '/pages/index/index?from=' + options.from
+							url: '../../pages/index/index?from=' + options.from
 						})
 					} else {
 						uni.redirectTo({
-							url: '/pages/index/index?from=0'
+							url: '../../pages/index/index?from=0'
 						});
 					}
 				}

+ 1 - 1
pagesAir/accountBalance/accountBalance.vue

@@ -102,7 +102,7 @@
 							this.id_card = userinfo.id_card
 						} else {
 							uni.navigateTo({
-								url: '/pages/index/index?from=' + options.from
+								url: '../../pages/index/index?from=' + options.from
 							})
 
 							uni.showToast({

+ 1 - 1
pagesAir/addAir/addAir.vue

@@ -149,7 +149,7 @@
 							this.user_name = userinfo.name
 						} else {
 							uni.navigateTo({
-								url: '/pages/index/index?from=' + options.from
+								url: '../../pages/index/index?from=' + options.from
 							})
 
 							uni.showToast({

+ 1 - 1
pagesAir/rechargeRecord/rechargeRecord.vue

@@ -95,7 +95,7 @@
 							this.id_card = userinfo.id_card
 						} else {
 							uni.navigateTo({
-								url: '/pages/index/index?from=' + options.from
+								url: '../../pages/index/index?from=' + options.from
 							})
 
 							uni.showToast({

+ 3 - 3
pagesAir/shareAir/shareAir.vue

@@ -402,7 +402,7 @@
 							this.id_card = userinfo.id_card
 						} else { // 还没有需要跳转到首页进行获取
 							uni.navigateTo({
-								url: '/pages/index/index?from=' + options.from
+								url: '../../pages/index/index?from=' + options.from
 							})
 
 							uni.showToast({
@@ -495,11 +495,11 @@
 
 					if (options && typeof(options.from) != 'undefined' && typeof(options.from) != '') {
 						uni.navigateTo({
-							url: '/pages/index/index?from=' + options.from
+							url: '../../pages/index/index?from=' + options.from
 						})
 					} else {
 						uni.redirectTo({
-							url: '/pages/index/index?from=0'
+							url: '../../pages/index/index?from=0'
 						});
 					}
 				}

+ 1 - 1
pagesAir/stdBookMgr/stdBookMgr.vue

@@ -125,7 +125,7 @@
 							this.id_card = userinfo.id_card
 						} else {
 							uni.navigateTo({
-								url: '/pages/index/index?from=' + options.from
+								url: '../../pages/index/index?from=' + options.from
 							})
 
 							uni.showToast({

+ 9 - 6
pagesElectric/dfxq/dfxq.vue

@@ -77,11 +77,14 @@
 		},
 		onLoad(options) {
 			try {
-				// console.log(options);
-				this.stu_number = options.card_number;
-				this.roomSelect = options.roomSelect;
-				// this.stu_number = this.$store.state.userInfo.card_number
-				// this.roomSelect = this.$store.state.building.roomSelect
+				this.stu_number = uni.getStorageSync('stu_number');
+				this.roomSelect = uni.getStorageSync('roomSelect');
+				if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this
+						.roomSelect) == 'undefined') {
+					// console.log(options);
+					this.stu_number = options.card_number;
+					this.roomSelect = options.roomSelect;
+				}
 
 				if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this
 						.roomSelect) == 'undefined') {
@@ -98,7 +101,7 @@
 							this.roomSelect = userinfo.campus + userinfo.dorm_number
 						} else {
 							uni.redirectTo({
-								url: '/pages/index/index'
+								url: '../../pages/index/index'
 							})
 
 							uni.showToast({

+ 13 - 10
pagesElectric/jiaofei/jiaofei.vue

@@ -92,14 +92,14 @@
 		onLoad(options) {
 			// console.log(options);
 			if (typeof(options.from) != 'undefined' && options.from == 2) {
-				uni.navigateTo({
+				wx.navigateTo({
 					url: '../../pages/index/index?from=' + options.from
 				});
 				return;
 			}
 			// 系统正在维护...
 			if (this.test == 'weihuzhong') {
-				uni.redirectTo({
+				wx.redirectTo({
 					url: '../../pages/index/index'
 				});
 				return;
@@ -121,7 +121,7 @@
 				this.roomSelect = this.$store.state.building.roomSelect;
 				this.add_class = this.$store.state.building.add_class;
 				this.dorm_number = this.$store.state.building.dorm_number;
-
+				
 				this.add_class = 1;
 				if (this.roomSelect && typeof(this.roomSelect) != 'undefined') {
 					this.getDianLiang();
@@ -200,7 +200,7 @@
 
 				if (this.roomSelect == '' || typeof this.roomSelect == 'undefined') {
 					uni.showToast({
-						title: '请再次选择宿舍',
+						title: '请再次选择宿舍',
 						icon: 'success'
 					})
 				} else {
@@ -222,7 +222,7 @@
 
 				if (this.roomSelect == '' || typeof this.roomSelect == 'undefined') {
 					uni.showToast({
-						title: '请再次选择宿舍',
+						title: '请再次选择宿舍',
 						icon: 'success'
 					})
 				} else {
@@ -272,7 +272,7 @@
 				} catch (e) {
 					console.log(e);
 				}
-
+				
 				// 初始化参数
 				this.$store.state.building.add_class = 0;
 
@@ -330,7 +330,7 @@
 
 					// console.log('获得openid', res);
 					if (res.data.mess == '返回成功') {
-						if (!(this.$store.state.building.roomSelect && typeof(this.$store.state.building.roomSelect) !=
+						if (!(this.$store.state.building.roomSelect && typeof this.$store.state.building.roomSelect !=
 								'undefined')) {
 							// 栋宿舍号
 							this.dorm_number = res.data.info[0].build + res.data.info[0].dom
@@ -347,7 +347,7 @@
 							// 样式
 							this.add_class = 1
 						}
-
+						
 						// 请求选定的月份消费记录
 						this.getDianLiang()
 					} else if (res.data.mess == '未查询到用户信息') {
@@ -430,13 +430,16 @@
 			},
 			// 是否选择了宿舍号
 			haveSelectRoom() {
-				if (this.roomSelect == '请选择宿舍') {
+				if (this.roomSelect == '请选择宿舍') {
 					uni.showToast({
-						title: '请选择宿舍',
+						title: '请选择宿舍',
 						icon: 'success'
 					})
 					return true
 				}
+				
+				uni.setStorageSync('roomSelect', this.roomSelect);
+				uni.setStorageSync('stu_number', this.stu_number);
 
 				return false
 			},

+ 12 - 9
pagesElectric/sfxq/sfxq.vue

@@ -77,25 +77,28 @@
 		},
 		onLoad(options) {
 			try {
-				// console.log(options);
-				this.stu_number = options.card_number;
-				this.roomSelect = options.roomSelect;
-				// this.stu_number = this.$store.state.userInfo.card_number
-				// this.roomSelect = this.$store.state.building.roomSelect
+				this.stu_number = uni.getStorageSync('stu_number');
+				this.roomSelect = uni.getStorageSync('roomSelect');
+				if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this
+						.roomSelect) == 'undefined') {
+					// console.log(options);
+					this.stu_number = options.card_number;
+					this.roomSelect = options.roomSelect;
+				}
 
-				if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this.roomSelect) == 'undefined') {
+				if (this.stu_number == '' || this.roomSelect == '' || typeof this.stu_number == 'undefined' || typeof this.roomSelect == 'undefined') {
 					// 获取学号
 					this.stu_number = this.$store.state.userInfo.card_number
 					this.roomSelect = this.$store.state.building.roomSelect
 
-					if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this.roomSelect) == 'undefined') {
+					if (this.stu_number == '' || this.roomSelect == '' || typeof this.stu_number == 'undefined' || typeof this.roomSelect == 'undefined') {
 						const userinfo = uni.getStorageSync('userinfo_storage_key')
 						if (userinfo) {
 							this.stu_number = userinfo.card_number
 							this.roomSelect = userinfo.campus + userinfo.dorm_number
 						} else {
 							uni.redirectTo({
-								url: '/pages/index/index'
+								url: '../../pages/index/index'
 							})
 
 							uni.showToast({
@@ -259,7 +262,7 @@
 							totalMoney
 						});
 					}
-					
+
 					this.tableData = tableData.filter(function(item, index, self) {
 						return index === self.findIndex(function(t) {
 							return t.dataTime === item.dataTime && t.totalPower === item.totalPower && t.totalMoney === item.totalMoney;

+ 9 - 7
pagesElectric/show/show.vue

@@ -103,12 +103,14 @@
 		},
 		onLoad(options) {
 			try {
-				// console.log(options);
-				// 获取学号
-				this.roomSelect = options.rooSelect;
-				this.stu_number = options.card_number;
-				// this.stu_number = this.$store.state.userInfo.card_number
-				// this.roomSelect = this.$store.state.building.roomSelect
+				this.stu_number = uni.getStorageSync('stu_number');
+				this.roomSelect = uni.getStorageSync('roomSelect');
+				if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this
+						.roomSelect) == 'undefined') {
+					// console.log(options);
+					this.stu_number = options.card_number;
+					this.roomSelect = options.roomSelect;
+				}
 
 				if (this.stu_number == '' || this.roomSelect == '' || typeof this.stu_number == 'undefined' || typeof this.roomSelect == 'undefined') {
 					const userinfo = uni.getStorageSync('userinfo_storage_key')
@@ -117,7 +119,7 @@
 						this.roomSelect = userinfo.campus + userinfo.dorm_number
 					} else {
 						uni.redirectTo({
-							url: '/pages/index/index'
+							url: '../../pages/index/index'
 						})
 
 						uni.showToast({

+ 1 - 1
pagesWater/reshuiDetails/reshuiDetails.vue

@@ -58,7 +58,7 @@
 						this.roomSelect = userinfo.campus + userinfo.dorm_number
 					} else {
 						uni.redirectTo({
-							url: '/pages/index/index'
+							url: '../../pages/index/index'
 						})
 
 						uni.showToast({