程志平 3 gadi atpakaļ
vecāks
revīzija
a2dfe0ec11

+ 2 - 2
pages/reshui/reshui.vue

@@ -971,7 +971,7 @@
 				//连接蓝牙
 				uni.createBLEConnection({
 					deviceId: this.deviceId,
-					timeout: 5000,
+					timeout: 6000,
 					success: (res) => {
 						// console.log(res)
 						this.connect_BLE()
@@ -983,7 +983,7 @@
 							this.connect_BLE()
 						} else {
 							uni.showToast({
-								title: '未知错误,请重新进入。',
+								title: '错误:' + err.errMsg,
 								icon: 'none',
 								duration: 3000,
 								success: (res1) => {

+ 37 - 23
pagesElectric/dfxq/dfxq.vue

@@ -78,28 +78,42 @@
 		},
 		onLoad() {
 			try {
-				// 获取学号
-				this.stu_number = this.$store.state.userInfo.card_number
-				this.roomSelect = this.$store.state.building.roomSelect
+				const eventChannel = this.getOpenerEventChannel();
+				// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
+				let _this = this;
+				eventChannel.on('params', function(data) {
+					// console.log(data)
+					// 获取学号
+					_this.stu_number = data.data.card_number
+					_this.roomSelect = data.data.roomSelect
+				})
 
 				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: '../index/index'
-						})
-
-						uni.showToast({
-							icon: 'none',
-							title: '学号或宿舍号为空,请授权',
-							duration: 1500
-						})
-
-						return
+					// 获取学号
+					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') {
+						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: '../index/index'
+							})
+
+							uni.showToast({
+								icon: 'none',
+								title: '学号或宿舍号为空,请授权',
+								duration: 1500
+							})
+
+							return
+						}
 					}
 				}
 				// console.log(this.stu_number);
@@ -158,11 +172,11 @@
 				})
 
 				// console.log(res.data)
-				if (res.data.data.length == 0) {
-					return
-				}
-
 				if (res.data.mess === '返回成功') {
+					if (res.data.data.length == 0) {
+						return
+					}
+					
 					let zongEnd = res.data.data[0].zongEnd
 					let zongMoney = res.data.data[0].zongMoney
 					let zongPower = res.data.data[0].zongPower

+ 58 - 22
pagesElectric/jiaofei/jiaofei.vue

@@ -72,7 +72,7 @@
 			台账管理
 		</view>
 		<view v-if="img_url !== ''" class="ad">
-			<image :src="img_url" mode="aspectFill" class="ad_img" @tap="ad_redirect"></image>
+			<image :src="img_url" mode="aspectFill" class="ad_img" @tap="ad_redirect" @error="loadImgError"></image>
 		</view>
 	</view>
 </template>
@@ -109,9 +109,37 @@
 		},
 		onShow() {
 			// 获取基本信息
-			this.get_base_info('options', 'onShow')
+			// this.get_base_info('options', 'onShow')
+			// 获取电量
+			if (this.$store.state.building.roomSelect != '') {
+				// 如果是选择宿舍号返回
+				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()
+				}
+
+				// 初始化参数
+				this.$store.state.building.add_class = 0;
+
+				// 获取code
+				this.getCode('options', 'onShow')
+			}
 		},
 		methods: {
+			/**
+			 * 获取广告缩略图出错
+			 */
+			loadImgError(e) {
+				// console.log(e);
+				this.img_url = ''
+			},
+			/**
+			 * 获取广告缩略图
+			 */
 			async get_img() {
 				let res = await this.$myRequest({
 					host: this.ceshi,
@@ -139,7 +167,7 @@
 							tf = true;
 						}
 					}
-					
+
 					if (tf == false) {
 						uni.showToast({
 							icon: 'none',
@@ -163,9 +191,19 @@
 				if (this.haveSelectRoom()) {
 					return
 				}
-
+				
+				let _this = this;
+				
 				uni.navigateTo({
-					url: '../dfxq/dfxq'
+					url: '../dfxq/dfxq',
+					success: function(res) {
+						res.eventChannel.emit('params', {
+							data: {
+								roomSelect: _this.roomSelect,
+								card_number: _this.stu_number
+							}
+						})
+					}
 				})
 			},
 			/**
@@ -176,8 +214,18 @@
 					return
 				}
 
+				let _this = this;
+
 				uni.navigateTo({
-					url: '../sfxq/sfxq'
+					url: '../sfxq/sfxq',
+					success: function(res) {
+						res.eventChannel.emit('params', {
+							data: {
+								roomSelect: _this.roomSelect,
+								card_number: _this.stu_number
+							}
+						})
+					}
 				})
 			},
 			/**
@@ -193,8 +241,10 @@
 			 */
 			get_base_info(options, param) {
 				try {
-					// 获取学号
-					this.stu_number = this.$store.state.userInfo.card_number
+					if (this.stu_number == '' || typeof(this.stu_number) == 'undefined') {
+						// 获取学号
+						this.stu_number = this.$store.state.userInfo.card_number
+					}
 
 					if (this.stu_number == '' || typeof(this.stu_number) == 'undefined') {
 						const userinfo = uni.getStorageSync('userinfo_storage_key')
@@ -218,20 +268,6 @@
 					console.log(e);
 				}
 
-				if (param == 'onShow') {
-					// 获取电量
-					if (this.$store.state.building.roomSelect != '') {
-						// 如果是选择宿舍号返回
-						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()
-						}
-					}
-				}
 				// 初始化参数
 				this.$store.state.building.add_class = 0;
 

+ 278 - 129
pagesElectric/select/select.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="container">
-		<picker class="picker-item1" @change="changeSelect1" :range="array1" :value="index1" :disabled="dis_num1">
+		<picker class="picker-item1" @tap="clickSelect1" @change="changeSelect1" :range="array1" :value="index1"
+			:disabled="dis_num1">
 			<view class="select-item">
 				<view class="picker-item-logol">
 					<image class="picker-item-logo-left" src="../static/images/school.png"></image>
@@ -12,7 +13,8 @@
 				</view>
 			</view>
 		</picker>
-		<picker class="picker-item2" @change="changeSelect2" :range="array2" :value="index2" :disabled="dis_num2">
+		<picker class="picker-item2" @tap="clickSelect2" @change="changeSelect2" :range="array2" :value="index2"
+			:disabled="dis_num2">
 			<view class="select-item">
 				<view class="picker-item-logol">
 					<image class="picker-item-logo-left" src="../static/images/building.png"></image>
@@ -24,7 +26,8 @@
 				</view>
 			</view>
 		</picker>
-		<picker class="picker-item2" @change="changeSelect3" :range="array3" :value="index3" :disabled="dis_num3">
+		<picker class="picker-item2" @tap="clickSelect3" @change="changeSelect3" :range="array3" :value="index3"
+			:disabled="dis_num3">
 			<view class="select-item">
 				<view class="picker-item-logol">
 					<image class="picker-item-logo-left" src="../static/images/floor.png"></image>
@@ -36,7 +39,8 @@
 				</view>
 			</view>
 		</picker>
-		<picker class="picker-item2" @change="changeSelect4" :range="array4" :value="index4" :disabled="dis_num4">
+		<picker class="picker-item2" @tap="clickSelect4" @change="changeSelect4" :range="array4" :value="index4"
+			:disabled="dis_num4">
 			<view class="select-item">
 				<view class="picker-item-logol">
 					<image class="picker-item-logo-left" src="../static/images/room.png"></image>
@@ -92,41 +96,38 @@
 			}
 		},
 		onLoad() {
-			// 请求校区、楼栋、层好、宿舍号等数据
-			this.requestAllData()
+			// 获取校区
+			this.getCampus()
 		},
-
 		methods: {
 			/**
-			 * 请求楼栋、楼层、宿舍等信息
+			 * 获取校区
 			 */
-			async requestAllData() {
-				uni.showLoading({
-					title: '数据加载中……',
-					mask: true
-				});
+			async getCampus() {
 				const res = await this.$myRequest({
 					host: this.ceshi,
-					url: '/HotWaters/buildelec.action',
+					url: '/HotWaters/buildschools.action',
 					method: 'POST',
 					header: {
 						'content-type': 'application/json'
 					}
 				})
-				// console.log(res.data.data);
-				let rooms = JSON.parse('[{"data":' + res.data.data + '}]')[0]
-				// console.log(rooms);
-				if (typeof(rooms) != 'undefined') {
-					this.allData = rooms
-					this.nschool = rooms.data.length
+				// console.log(res.data);
+				if (res.data.code === 200) {
+					let tmpData = res.data.data;
+					this.nschool = tmpData.length
 					this.array1 = []
 
 					for (var i = 0; i < this.nschool; i++) {
-						this.array1.push(rooms.data[i].school)
+						this.array1.push(tmpData[i].school)
 					}
 
 					this.dis_num1 = 0
-					uni.hideLoading()
+				} else {
+					uni.showToast({
+						title: '未获得校区',
+						icon: 'none'
+					})
 				}
 
 				if (this.$store.state.building.roomSelect != '') {
@@ -170,10 +171,7 @@
 						this.arr4 = [arr[2]]
 					}
 
-					this.sel1(this.arr1)
-					this.sel2(this.arr2)
-					this.sel3(this.arr3)
-					this.sel4(this.arr4)
+					this.sel1(this.arr1, true);
 
 					this.add_class1 = 1
 					this.add_class2 = 1
@@ -185,148 +183,272 @@
 					this.dis_num4 = 0
 				}
 			},
+			clickSelect1() {
+				if (this.array1.length == 0) {
+					uni.showToast({
+						title: '未获得校区,可能网络异常',
+						icon: 'none'
+					})
+				}
+			},
 			/**
 			 * 选择校区
 			 */
 			changeSelect1(e) {
-				this.sel1(e.detail.value)
+				this.array2 = []
+				this.array3 = []
+				this.array4 = []
+				this.sel1(e.detail.value, false)
 			},
 			// 根据参数的值选中
-			sel1(index) {
+			sel1(index, theRoomIsExist) {
 				// console.log(index)
 				// console.log(typeof(index))
 				this.arr1 = this.array1;
 				//获取选择器1的值
-				for (var i = 0; i < this.nschool; i++) {
-					// this.array1.push(this.allData.data[i].school)
-					// console.log(this.allData.data[i].school)
-					if (typeof(index) == 'string') {
-						this.index1 = index;
-					} else if (this.allData.data[i].school == index[0]) {
-						this.index1 = i
-					}
-					//判断是否为空,不为空则继续
-					if (!this.allData.data[i].builds) {
-						continue
-					}
-
-					//获取选择器二中的值
-					if (i == this.index1) {
-						//得到选择器二中值的个数
-						this.nbuilds = this.allData.data[i].builds.length
-						this.array2 = []
-						//将数据加入选择器二中
-						for (var j = 0; j < this.nbuilds; j++) {
-							this.array2.push(this.allData.data[i].builds[j].building)
+				if (typeof(index) == 'string') {
+					this.index1 = index;
+				} else {
+					for (var i = 0; i < this.nschool; i++) {
+						if (index[0] == this.array1[i]) {
+							this.index1 = i
 						}
 					}
+				}
 
-					if (typeof(index) == 'string') {
-						this.arr2 = ['请选择楼栋']
-						this.arr3 = ['请选择楼层']
-						this.arr4 = ['请选择房间']
-						this.index2 = 0
-						this.index3 = 0
-						this.index4 = 0
+				//获取选择器二中的值
+				this.getBuilds(this.array1[this.index1], theRoomIsExist)
 
-						this.room = ''
-					}
+				if (typeof(index) == 'string') {
+					this.arr2 = ['请选择楼栋']
+					this.arr3 = ['请选择楼层']
+					this.arr4 = ['请选择房间']
+					this.index2 = 0
+					this.index3 = 0
+					this.index4 = 0
+
+					this.room = ''
 				}
-				// this.room = this.room.concat(this.array1[this.index1]);
+
 				this.add_class1 = 1;
 				this.dis_num2 = 0;
-				// console.log(this.array2)
-				// console.log(this.room)
+
+				this.chgDisable()
+			},
+			/**
+			 * 获取楼栋
+			 * @param {Object} campus
+			 */
+			async getBuilds(campus, theRoomIsExist) {
+				const res = await this.$myRequest({
+					host: this.ceshi,
+					url: '/HotWaters/buildbuilds.action',
+					method: 'POST',
+					header: {
+						'content-type': 'application/x-www-form-urlencoded'
+					},
+					data: {
+						school: campus
+					}
+				})
+				// console.log('楼栋:', res.data);
+				if (res.data.code === 200) {
+					let tmpData = res.data.data;
+					// this.allData = rooms
+					//得到选择器二中值的个数
+					this.nbuilds = tmpData.length
+					this.array2 = []
+					//将数据加入选择器二中
+					for (var j = 0; j < this.nbuilds; j++) {
+						this.array2.push(tmpData[j].build)
+					}
+
+					if (theRoomIsExist == true) {
+						this.sel2(this.arr2, true)
+					}
+				} else {
+					this.array2 = []
+					uni.showToast({
+						title: '未获得楼栋',
+						icon: 'none'
+					})
+				}
+			},
+			clickSelect2() {
+				if (this.array2.length == 0) {
+					uni.showToast({
+						title: '未获得楼栋,该校区没有楼栋',
+						icon: 'none'
+					})
+				}
 			},
 			changeSelect2(e) {
-				this.sel2(e.detail.value)
+				this.array3 = []
+				this.array4 = []
+				this.sel2(e.detail.value, false)
 			},
-			sel2(index) {
+			sel2(index, theRoomIsExist) {
 				// console.log(index);
+				// console.log(typeof index);
 				this.arr2 = this.array2;
 
-				for (var i = 0; i < this.nbuilds; i++) {
-					// this.array1.push(this.allData.data[i].school)
-					// console.log(this.allData.data[i].school)
-					if (typeof(index) == 'string') {
-						this.index2 = index;
-					} else if (this.allData.data[this.index1].builds[i].building == index[0]) {
-						this.index2 = i
-					}
-
-					if (!this.allData.data[this.index1].builds[i].floors) {
-						continue
-					}
-
-					if (i == this.index2) {
-						this.floors = this.allData.data[this.index1].builds[i].floors.length
-						this.array3 = []
-						// console.log(this.floors)
-						for (var j = 0; j < this.floors; j++) {
-							this.array3.push(this.allData.data[this.index1].builds[i].floors[j].floor)
+				if (typeof(index) == 'string') {
+					this.index2 = index;
+				} else {
+					for (var i = 0; i < this.nbuilds; i++) {
+						if (index[0] == this.array2[i]) {
+							this.index2 = i
 						}
 					}
+				}
 
-					if (typeof(index) == 'string') {
-						this.arr3 = ['请选择楼层']
-						this.arr4 = ['请选择房间']
-						this.index3 = 0
-						this.index4 = 0
+				this.getFloors(this.array1[this.index1], this.array2[this.index2], theRoomIsExist)
 
-						this.room = ''
-					}
+				if (typeof(index) == 'string') {
+					this.arr3 = ['请选择楼层']
+					this.arr4 = ['请选择房间']
+					this.index3 = 0
+					this.index4 = 0
+
+					this.room = ''
 				}
 
-				// this.room = this.room.concat(this.array2[this.index2]);
 				this.add_class2 = 1;
 				this.dis_num3 = 0;
-				// console.log(this.room)
-			},
-			changeSelect3(e) {
-				this.sel3(e.detail.value)
+
+				this.chgDisable()
 			},
-			sel3(index) {
-				// console.log(index)
-				this.arr3 = this.array3;
+			/**
+			 * 获取楼层
+			 * @param {Object} campus
+			 * @param {Object} build
+			 */
+			async getFloors(campus, build, theRoomIsExist) {
+				// console.log(campus, build);
+				const res = await this.$myRequest({
+					host: this.ceshi,
+					url: '/HotWaters/buildFloors.action',
+					method: 'POST',
+					header: {
+						'content-type': 'application/x-www-form-urlencoded'
+					},
+					data: {
+						school: campus,
+						build: build
+					}
+				})
+				// console.log('楼层:', res.data);
+				if (res.data.code === 200) {
+					let tmpData = res.data.data;
+					this.floors = tmpData.length
+					this.array3 = []
 
-				for (var i = 0; i < this.floors; i++) {
-					// this.array1.push(this.allData.data[i].school)
-					// console.log(this.allData.data[i].school)
-					if (typeof(index) == 'string') {
-						this.index3 = index;
-					} else if (this.allData.data[this.index1].builds[this.index2].floors[i].floor == index[0]) {
-						this.index3 = i
+					for (var j = 0; j < this.floors; j++) {
+						this.array3.push(tmpData[j].floors)
 					}
 
-					if (!this.allData.data[this.index1].builds[this.index2].floors[i].rooms) {
-						continue
+					if (theRoomIsExist == true) {
+						this.sel3(this.arr3, true)
 					}
+				} else {
+					uni.showToast({
+						title: '未获得楼层',
+						icon: 'none'
+					})
+				}
+			},
+			clickSelect3() {
+				if (this.array3.length == 0) {
+					uni.showToast({
+						title: '未获得楼层,请选择楼栋',
+						icon: 'none'
+					})
+				}
+			},
+			changeSelect3(e) {
+				this.array4 = []
+				this.sel3(e.detail.value, false)
+			},
+			sel3(index, theRoomIsExit) {
+				// console.log(index)
+				this.arr3 = this.array3;
 
-					if (i == this.index3) {
-						this.rooms = this.allData.data[this.index1].builds[this.index2].floors[i].rooms.length
-						this.array4 = []
-						// console.log(this.rooms)
-						for (var j = 0; j < this.rooms; j++) {
-							this.array4.push(this.allData.data[this.index1].builds[this.index2].floors[i].rooms[j])
+				if (typeof(index) == 'string') {
+					this.index3 = index;
+				} else {
+					for (var i = 0; i < this.floors; i++) {
+						if (index[0] == this.array3[i]) {
+							this.index3 = i
 						}
 					}
+				}
 
-					if (typeof(index) == 'string') {
-						this.arr4 = ['请选择房间']
-						this.index4 = 0
+				this.getDoms(this.array1[this.index1], this.array2[this.index2], this.array3[this.index3], theRoomIsExit)
 
-						this.room = ''
-					}
+				if (typeof(index) == 'string') {
+					this.arr4 = ['请选择房间']
+					this.index4 = 0
+
+					this.room = ''
 				}
-				// this.room = this.room.concat(this.array3[this.index3]);
+
 				this.add_class3 = 1;
 				this.dis_num4 = 0;
-				// console.log(this.room)
+
+				this.chgDisable()
+			},
+			/**
+			 * 获取房间
+			 * @param {Object} campus
+			 * @param {Object} build
+			 * @param {Object} floors
+			 */
+			async getDoms(campus, build, floors, theRoomIsExist) {
+				// console.log(campus, build, floors);
+				const res = await this.$myRequest({
+					host: this.ceshi,
+					url: '/HotWaters/builddoms.action',
+					method: 'POST',
+					header: {
+						'content-type': 'application/x-www-form-urlencoded'
+					},
+					data: {
+						school: campus,
+						build: build,
+						floors: floors
+					}
+				})
+				// console.log('房间:', res.data);
+				if (res.data.code === 200) {
+					let tmpData = res.data.data;
+					this.rooms = tmpData.length
+					this.array4 = []
+					for (var j = 0; j < this.rooms; j++) {
+						this.array4.push(tmpData[j].dom)
+					}
+
+					if (theRoomIsExist == true) {
+						this.sel4(this.arr4, true)
+					}
+				} else {
+					uni.showToast({
+						title: '未获得房间',
+						icon: 'none'
+					})
+				}
+			},
+			clickSelect4() {
+				if (this.array4.length == 0) {
+					uni.showToast({
+						title: '未获得房间,请选择楼层',
+						icon: 'none'
+					})
+				}
 			},
 			changeSelect4(e) {
-				this.sel4(e.detail.value)
+				this.sel4(e.detail.value, false)
 			},
-			sel4(index) {
+			sel4(index, theRoomIsExist) {
 				// console.log(index)
 				this.arr4 = this.array4;
 
@@ -335,16 +457,43 @@
 				if (this.room) {
 					this.room = ''
 				}
-				for (var i = 0; i < this.rooms; i++) {
-					if (typeof(index) == 'string')
-						this.index4 = index;
-					else if (this.allData.data[this.index1].builds[this.index2].floors[this.index3].rooms[i] == index[0]) {
-						this.index4 = i
+
+
+				if (typeof(index) == 'string') {
+					this.index4 = index;
+				} else {
+					for (var i = 0; i < this.rooms; i++) {
+						if (this.array4[i] == index[0]) {
+							this.index4 = i
+						}
 					}
 				}
-				this.room = this.room.concat(this.array1[this.index1], this.array4[this.index4]);
+
+				this.room = this.array1[this.index1] + this.array4[this.index4];
+			},
+			/**
+			 * 下拉框变量数组为空,就禁用
+			 */
+			chgDisable() {
+				setTimeout(() => {
+					if (this.array1.length == 0) {
+						this.dis_num1 = 1
+					}
+					if (this.array2.length == 0) {
+						this.dis_num2 = 1
+					}
+					if (this.array3.length == 0) {
+						this.dis_num3 = 1
+					}
+					if (this.array4.length == 0) {
+						this.dis_num4 = 1
+					}
+				}, 300)
 			},
-			//跳转缴费页面
+			/**
+			 * 跳转缴费页面
+			 * @param {Object} e
+			 */
 			navigateToIndex(e) {
 				// console.log(e)
 				var roomSelect = e.currentTarget.dataset.room;
@@ -353,7 +502,7 @@
 				if (this.room != '') {
 					this.$store.state.building.roomSelect = this.storage.roomSelect;
 					this.$store.state.building.add_class = 1;
-					this.$store.state.building.dom = this.storage.dom;
+					this.$store.state.building.dorm_number = this.storage.dom;
 					uni.navigateBack({
 						delta: 1
 					})

+ 39 - 32
pagesElectric/sfxq/sfxq.vue

@@ -78,28 +78,42 @@
 		},
 		onLoad() {
 			try {
-				// 获取学号
-				this.stu_number = this.$store.state.userInfo.card_number
-				this.roomSelect = this.$store.state.building.roomSelect
+				const eventChannel = this.getOpenerEventChannel();
+				// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
+				let _this = this;
+				eventChannel.on('params', function(data) {
+					// console.log(data)
+					// 获取学号
+					_this.stu_number = data.data.card_number
+					_this.roomSelect = data.data.roomSelect
+				})
 
 				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: '../index/index'
-						})
-
-						uni.showToast({
-							icon: 'none',
-							title: '学号或宿舍号为空,请授权',
-							duration: 1500
-						})
-
-						return
+					// 获取学号
+					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') {
+						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: '../index/index'
+							})
+
+							uni.showToast({
+								icon: 'none',
+								title: '学号或宿舍号为空,请授权',
+								duration: 1500
+							})
+
+							return
+						}
 					}
 				}
 				// console.log(this.stu_number);
@@ -126,7 +140,7 @@
 						this.get_sameMonthDetails()
 					} catch (e) {
 						uni.showToast({
-							title: '当月详情'
+							title: '当月详情异常'
 						})
 					}
 					// 每月账单
@@ -137,6 +151,7 @@
 							title: '每月账单异常'
 						})
 					}
+					return false
 				} else {
 					return true
 				}
@@ -158,11 +173,11 @@
 				})
 
 				// console.log(res.data)
-				if (res.data.data.length == 0) {
-					return
-				}
-
 				if (res.data.mess === '返回成功') {
+					if (res.data.data.length == 0) {
+						return
+					}
+					
 					let zongEnd = res.data.data[0].zongEnd
 					let totalMoney = res.data.data[0].totalMoney
 					let totalPower = res.data.data[0].totalPower
@@ -189,14 +204,6 @@
 			 * 每月账单
 			 */
 			async get_history() {
-				uni.showToast({
-					icon: 'none',
-					title: '每月账单开发中...',
-					mask: true,
-					duration: 3000
-				})
-				return
-
 				var reg = /[\u4e00-\u9fa5]/g;
 				var str = this.roomSelect;
 				this.dom = str.replace(reg, "");