Browse Source

合并两个分支

xiaoxin 2 years ago
parent
commit
59f3bfb460

+ 59 - 0
components/Popup.vue

@@ -0,0 +1,59 @@
+<template>
+	<view v-if="showPopup" class="popup-mask">
+		<view class="popup-content">
+			<view class="close-button" @click="closePopup">×</view>
+			<slot></slot>
+		</view>
+	</view>
+</template>
+<script>
+	export default {
+		props: {
+			showPopup: {
+				type: Boolean,
+				default: false
+			}
+		},
+		methods: {
+			closePopup() {
+				this.$emit('close');
+			}
+		}
+	};
+</script>
+<style>
+	.popup-mask {
+		position: fixed;
+		top: 0;
+		left: 0;
+		width: 100%;
+		height: 100%;
+		background-color: rgba(0, 0, 0, 0.5);
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.popup-content {
+		/* Styling for the popup content */
+		background-color: rgba(255, 255, 255, 0.9);
+		width: 100%;
+		height: 68%;
+		padding: 30rpx;
+	}
+
+	.close-button {
+		position: absolute;
+		top: 60rpx;
+		right: 30rpx;
+		font-size: 38rpx;
+		color: #fff;
+		cursor: pointer;
+		width: 46rpx;
+		height: 46rpx;
+		line-height: 46rpx;
+		text-align: center;
+		border-radius: 50%;
+		background-color: rgba(255, 255, 255, 0.5);
+	}
+</style>

+ 0 - 5
node_modules/.package-lock.json

@@ -3,11 +3,6 @@
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
-    "node_modules/@qiun/vue-ucharts": {
-      "version": "2.5.0-20230101",
-      "resolved": "https://registry.npmmirror.com/@qiun/vue-ucharts/-/vue-ucharts-2.5.0-20230101.tgz",
-      "integrity": "sha512-HZ4q6CBjzheAmocr//jY2nV3wO2Xu+2CX6NjwUD+uM1Jo/ewlnNIL2TiRRqtwMBhyaIoJh4nCzmnoeT7kUvlxA=="
-    },
     "node_modules/crypto-js": {
       "version": "4.1.1",
       "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz",

+ 57 - 60
pages/index/index.vue

@@ -1,6 +1,8 @@
 <template>
 	<view class="container">
-		<view class="banner"><image src="../../static/images/banner2x.png" mode=""></image></view>
+		<view class="banner">
+			<image src="../../static/images/banner2x.png" mode=""></image>
+		</view>
 		<view class="nav">
 			<view class="menu">
 				<navigator :url="'/pages/reshui/reshui'" open-type="navigate" class="menu_item">
@@ -33,23 +35,32 @@
 				</navigator> -->
 			</view>
 		</view>
-		<view class="qr_code" v-if="showQR_code"><image :src="qr_code_url" mode="aspectFit"></image></view>
 		<view v-if="showLogin">
 			<login
 				:ocode="ocode"
 				:appkey="appkey"
 				scope="snsapi_userinfo"
 				:visible="visible"
-				@success="login_success_callback()"
-				@cancel="login_cancel_callback()"
-				@fail="login_fail_callback()"
+				@success="login_success_callback"
+				@cancel="login_cancel_callback"
+				@fail="login_fail_callback"
 			/>
 		</view>
+		<Popup :showPopup="showPopup" @close="showPopup = false">
+			<view class="pupup-content">
+				<text class="pupup-title">请截屏,再识别二维码领取校园卡</text>
+				<image src="../../static/images/qr.jpg" mode="aspectFill" class="pupup-img"></image>
+			</view>
+		</Popup>
 	</view>
 </template>
 
 <script>
+import Popup from '@/components/Popup.vue'
 export default {
+	components: {
+		Popup
+	},
 	data() {
 		return {
 			ceshi: 'code',
@@ -66,7 +77,7 @@ export default {
 			validation_times: 0, // 授权次数
 			from: 0, // 跳转参数
 			execed_onload: false,
-			qr_code_url: this.$code_base_url + '/HotWaters/image/1.jpg'
+			showPopup: false
 		}
 	},
 	onLoad(options) {
@@ -75,10 +86,10 @@ export default {
 		if (typeof options.from != 'undefined') {
 			this.from = options.from
 		}
-		// 是否是测试环境,查询数据接口中参数的值决定,方便以后测试
-		this.isTestEnvironment()
 		// 检查是否存在用户信息
 		this.has_user_info()
+		// 是否是测试环境,查询数据接口中参数的值决定,方便以后测试
+		this.isTestEnvironment()
 
 		this.execed_onload = true
 	},
@@ -172,7 +183,7 @@ export default {
 				this.login_fail_callback()
 			} else {
 				try {
-					uni.removeStorageSync('userinfo_storage_key')
+					// uni.removeStorageSync('userinfo_storage_key')
 					setTimeout(() => {
 						this.showLogin = false
 						this.userinfo = {}
@@ -191,12 +202,10 @@ export default {
 		 * 授权登陆取消回调
 		 */
 		login_fail_callback() {
-			this.userinfo = {}
-			// setTimeout(() => {
-			// 	this.validation_failed = true
-			// }, 3000);
-			if (!this.validation_failed) {
-				this.validation_failed = false
+			var _this = this
+			_this.userinfo = {}
+			if (!_this.validation_failed) {
+				_this.validation_failed = false
 				uni.showModal({
 					title: '提示',
 					content: '授权:请先领取校园卡、并激活!',
@@ -204,34 +213,8 @@ export default {
 					confirmText: '领取',
 					success: (res1) => {
 						if (res1.confirm) {
-							uni.navigateTo({
-								url: '../qr_code/qr_code'
-							})
-							// 出现二维码,用户扫描二维码添加校园卡、激活
-							// uni.downloadFile({
-							// 	url: 'https://chtech.ncjti.edu.cn/shuidian/HotWaters/image/1.jpg',
-							// 	success: (res2) => {
-							// 		// console.log(res2);
-							// 		if (res2.statusCode == 200) {
-							// 			uni.saveImageToPhotosAlbum({
-							// 				filePath: res2
-							// 					.tempFilePath,
-							// 				success: function() {
-							// 					uni.showToast({
-							// 						title: "保存成功!请用微信扫码添加校园卡!",
-							// 						icon: "none"
-							// 					});
-							// 				},
-							// 				fail: function() {
-							// 					uni.showToast({
-							// 						title: "保存失败,请手动截图保存,再用微信扫二维码!",
-							// 						icon: "none"
-							// 					});
-							// 				}
-							// 			});
-							// 		}
-							// 	}
-							// })
+							// 截屏,用户利用微信识别二维码添加校园卡、激活
+							_this.showPopup = true
 						} else if (res1.cancel) {
 							// console.log('用户点击取消');
 							// uni.showToast({
@@ -264,10 +247,6 @@ export default {
 				mask: true
 			})
 
-			setTimeout(() => {
-				uni.hideLoading()
-			}, 1000)
-
 			// 通过wxcode换取access_token
 			this.get_access_token(wxcode)
 		},
@@ -292,6 +271,7 @@ export default {
 			})
 
 			if (res.data.refresh_token == '' || typeof res.data.refresh_token == 'undefined') {
+				uni.hideLoading()
 				uni.showToast({
 					title: '未获得token'
 				})
@@ -320,14 +300,16 @@ export default {
 			if (res.data.errcode == 0 && res.data.errmsg == 'OK') {
 				try {
 					this.userinfo = res.data
-					this.$store.state.userInfo = this.userinfo
+					this.$store.state.userInfo = res.data
 
 					// 获取code,然后去检查是否存在数据库中
 					this.getCode()
 				} catch (e) {
+					uni.hideLoading()
 					console.log(e)
 				}
 			} else {
+				uni.hideLoading()
 				uni.showToast({
 					title: '未获得用户信息,请领取校园卡并激活',
 					duration: 3000
@@ -338,18 +320,23 @@ export default {
 		 * 获得code
 		 */
 		getCode() {
+			var _this = this
 			uni.login({
 				success: (res) => {
 					// console.log('reshui', res);
 					if (res.code) {
 						// 检查用户是否存在第三方库
-						this.chk_user_is_in_db(res.code)
+						_this.chk_user_is_in_db(res.code)
 					} else {
+						uni.hideLoading()
 						uni.showToast({
 							title: res.errMsg,
 							icon: 'none'
 						})
 					}
+				},
+				fail() {
+					uni.hideLoading()
 				}
 			})
 		},
@@ -357,16 +344,17 @@ export default {
 		 * 检查数据库中是否有该用户信息
 		 */
 		async chk_user_is_in_db(param_code) {
-			const res = await this.$myRequest({
+			var _this = this
+			const res = await _this.$myRequest({
 				// host: 'local',
-				host: this.ceshi,
+				host: _this.ceshi,
 				url: '/HotWaters/wpopenid.action',
 				method: 'POST',
 				header: {
 					'content-type': 'application/x-www-form-urlencoded'
 				},
 				data: {
-					userinfo: JSON.stringify(this.userinfo),
+					userinfo: JSON.stringify(_this.userinfo),
 					code: param_code
 				}
 			})
@@ -374,14 +362,18 @@ export default {
 			// console.log(res);
 			if (res.data.code == 0 || res.data.code == 100) {
 				// 存储用户信息
-				uni.setStorageSync('userinfo_storage_key', this.userinfo)
+				uni.setStorageSync('userinfo_storage_key', _this.userinfo)
+				uni.hideLoading()
 				// 提示授权成功
 				uni.showToast({
 					icon: 'success',
 					title: '授权成功',
 					duration: 800,
 					success: (res) => {
-						if (this.from != 0 || this.from != '0') {
+						if (_this.from != 0 || _this.from != '0') {
+							// 页面跳转回去
+							uni.setStorageSync('navigateBack', 1)
+
 							uni.navigateBack({
 								delta: 1
 							})
@@ -389,6 +381,7 @@ export default {
 					}
 				})
 			} else {
+				uni.hideLoading()
 				uni.showToast({
 					icon: 'none',
 					title: '授权失败:' + res.data.msg,
@@ -473,16 +466,20 @@ export default {
 		}
 	}
 
-	.qr_code {
+	.pupup-content {
 		display: flex;
+		flex-direction: column;
 		justify-content: center;
 		align-items: center;
-		width: 750rpx;
 		height: 100%;
-		position: fixed;
-		left: 0;
-		top: 0;
-		background-color: #ffffff;
+
+		.pupup-title {
+			padding-bottom: 20rpx;
+		}
+
+		.pupup-img {
+			height: 90%;
+		}
 	}
 }
 </style>

+ 8 - 2
pages/recharge/recharge.vue

@@ -36,6 +36,7 @@
 	export default {
 		data() {
 			return {
+				card_number: '',
 				amount: '', // 金额
 				phone_number: '13645689854', // 客户热线电话
 				IP: '',
@@ -67,13 +68,14 @@
 			 * 获得code
 			 */
 			getCode(param_ip) {
+				let _this = this;
 				uni.login({
 					success: (res) => {
 						// console.log('recharge', res);
 						if (res.code) {
 							// 组合地址,发起支付
 							// this.jsapi(param_ip, res.code)
-							this.jsapi(res.code)
+							_this.jsapi(res.code)
 						} else {
 							uni.showToast({
 								title: res.errMsg,
@@ -131,6 +133,7 @@
 					data: {
 						// ip: param_ip,
 						code: param_code,
+						card_number: this.card_number,
 						num: this.amount
 					}
 				})
@@ -238,6 +241,8 @@
 			has_user_info() {
 				try {
 					const value = uni.getStorageSync('userinfo_storage_key');
+					if (value)
+						this.card_number = value.card_number;
 					// console.log(value.campus);
 					if (value.campus != '墨轩湖校区') {
 						this.isXiaoqu = false;
@@ -360,8 +365,9 @@
 			 * 拨打电话
 			 */
 			callPhone() {
+				var _this = this;
 				uni.makePhoneCall({
-					phoneNumber: this.phone_number
+					phoneNumber: _this.phone_number
 				});
 			}
 		}

+ 205 - 25
pages/reshui/reshui.vue

@@ -77,18 +77,36 @@
 			</view>
 		</view>
 		<instructions v-if="flag" @parent_cancel="cancel" @parent_noshow='noshow'></instructions>
+		<view class="operation-manual">
+			<button class="default-btn floating-button-manual" @tap="showPopup = true"></button>
+		</view>
+		<view class="call">
+			<button class="default-btn floating-button-call" @tap="makeCall"></button>
+		</view>
+		<Popup :showPopup="showPopup" @close="showPopup = false">
+			<scroll-view class="article" scroll-y>
+				<view class="desc-title">{{ article.title }}</view>
+				<view v-for="(section, index) in article.sections" :key="index" class="section">
+					<view v-if="section.red == true" class="section-title-red">{{ section.title }}</view>
+					<view v-else class="section-title">{{ section.title }}</view>
+					<view class="section-content">{{ section.content }}</view>
+				</view>
+				<view class="desc-footer"></view>
+			</scroll-view>
+		</Popup>
 	</view>
 </template>
 
 <script>
 	import instructions from '../../components/instructions.vue'
-
+	import Popup from '@/components/Popup.vue';
 	export default {
 		/**
 		 * 声明组件
 		 */
 		components: {
-			instructions
+			instructions,
+			Popup
 		},
 		data() {
 			return {
@@ -138,7 +156,79 @@
 				changeDate: false, // 是否是手动选择日期
 				get_Bluetooth_Bevice: false, // 自动获取蓝牙设备,并列表
 				timer: -1,
-				test: this.$store.state.test
+				test: this.$store.state.test,
+				showPopup: false,
+				article: {
+					title: "蓝牙卡控操作说明",
+					sections: [{
+							title: "蓝牙卡控使用方式为:",
+							content: "  用微信【扫一扫】功能,扫描热水表上的二维码。",
+							red: false
+						},
+						{
+							title: "如遇连接热水表问题,请先检查:",
+							content: "  1.蓝牙本身无故障,且手机蓝牙和GPS定位要开启,并要授权。\n" +
+								"  2.手机系统要求出厂自带的,系统版本低于安卓4.3或刷过机的,可能搜索不到热水表。\n" +
+								"  3.之前已经连接过热水表需正常退出,否则再次连接可能搜索不到热水表,需关闭蓝牙5秒钟后再尝试。\n" +
+								"  4.热水表有人在使用,热水表肯定连接不了。\n" +
+								"  5.用微信分身,连接热水表会存在意想不到的问题。\n" +
+								"  6.在连接热水表前,请断开如蓝牙耳机、蓝牙音像等其他蓝牙设备。",
+							red: false
+						},
+						{
+							title: "如以上检查没问题,部分手机请检查以下权限是否打开(以下路径不能保证绝对正确,不同手机品牌和版本号会有区别,可自行百度或联系客服):",
+							content: "",
+							red: true
+						},
+						{
+							title: "华为手机:",
+							content: "  设置→安全和隐私→定位服务→打开“访问我的位置信息”。\n" +
+								"  设置→应用和通知→权限管理→微信→打开“您的位置”。",
+							red: false
+						},
+						{
+							title: "小米手机:",
+							content: "  设置→更多设置→系统安全→位置信息→开启“位置服务”。\n" +
+								"  设置→授权管理→应用授权管理→微信→开启“定位”。",
+							red: false
+						},
+						{
+							title: "苹果手机:",
+							content: "  设置→隐私→打开“定位服务”。\n" +
+								"  设置→微信→位置→使用应用期间。",
+							red: false
+						},
+						{
+							title: "OPPO手机:",
+							content: "  设置→GPS定位→开启“允许访问我的位置信息。\n" +
+								"  设置→权限隐私→按应用管理权限→微信→授权。",
+							red: false
+						},
+						{
+							title: "VIVO手机:",
+							content: "  设置→定位服务→开启。\n" +
+								"  设置→更多设置→权限管理→微信→定位手机选择“允许”。",
+							red: false
+						},
+						{
+							title: "三星手机:",
+							content: "  设置→连接→打开定位服务。\n" +
+								"  设置→应用程序→微信→权限→开启位置信息。",
+							red: false
+						},
+						{
+							title: "魅族手机:",
+							content: "  设置→定位服务→开启:\n" +
+								"  设置→应用管理→选择已安装→微信→权限管理→获取定位(允许)。",
+							red: false
+						},
+						{
+							title: "多卡号(一个人有2个以上微信身份卡号)扣款问题:",
+							content: "  遇到多卡,扣款会从第1次绑定的卡中扣款,如想从指定的卡中扣款,请先删除微信小程序(微信界面下拉,长按本小程序并拖动删除),再用指定的卡进入即可。",
+							red: true
+						}
+					]
+				}
 			}
 		},
 		onLoad(options) {
@@ -158,12 +248,6 @@
 					uni.getLocation({
 						success: (loc) => {
 							// console.log(loc);
-							// uni.showToast({
-							// 	icon: 'none',
-							// 	title: '纬度:' + loc.latitude + '\n' + '经度:' + loc
-							// 		.longitude,
-							// 	duration: 2000
-							// })
 							uni.showToast({
 								icon: 'success',
 								title: '已获定位信息'
@@ -208,6 +292,10 @@
 			uni.$once('update_reshui_amount', (data) => {
 				this.get_base_info('options', 'onShow');
 			});
+			
+			let back = uni.getStorageSync('navigateBack');
+			if (back == 1)
+				this.get_base_info('options', 'navigateBack');
 
 			if (this.timer > -1) {
 				clearInterval(this.timer)
@@ -260,6 +348,14 @@
 		},
 		methods: {
 			/**
+			 * 拨号
+			 */
+			makeCall() {
+				uni.makePhoneCall({
+					phoneNumber: '18312075670' // 替换为您想要拨打的电话号码
+				});
+			},
+			/**
 			 * 单击连接热水表
 			 */
 			clickRoom(e) {
@@ -337,7 +433,7 @@
 					// 获取学号
 					this.stu_number = this.$store.state.userInfo.card_number
 
-					if (this.stu_number == '' || typeof(this.stu_number) == 'undefined') {
+					if (this.stu_number == '' || typeof this.stu_number == 'undefined') {
 						const userinfo = uni.getStorageSync('userinfo_storage_key')
 						if (userinfo) {
 							this.stu_number = userinfo.card_number
@@ -398,15 +494,17 @@
 			 * 请求服务器,获得openid
 			 */
 			async getOpenId(options, param_code, param) {
+				var _this = this;
 				const res = await this.$myRequest({
-					host: this.ceshi,
+					host: _this.ceshi,
 					url: '/HotWaters/wpget_stu.action',
 					method: 'POST',
 					header: {
 						'content-type': 'application/x-www-form-urlencoded'
 					},
 					data: {
-						code: param_code
+						code: param_code,
+						card_number: _this.stu_number
 					}
 				})
 
@@ -414,25 +512,25 @@
 				if (res.data.mess == '返回成功') {
 					// stu_number是否存在
 					let cardNumber = res.data.info[0].card_number
-					if (typeof(cardNumber) != 'undefined' && cardNumber != '' && JSON.stringify(cardNumber) != '{}') {
+					if (typeof cardNumber != 'undefined' && cardNumber != '' && JSON.stringify(cardNumber) != '{}') {
 						// 学号 和 姓名
-						this.stu_number = res.data.info[0].stu_number
-						this.user_name = res.data.info[0].user_name
+						_this.stu_number = res.data.info[0].stu_number
+						_this.user_name = res.data.info[0].user_name
 						// 剩余金额
-						this.amount = res.data.info[0].balance.toFixed(2)
-						// if (this.amount > 0)
-						this.$store.state.reshui_amount = this.amount
+						_this.amount = res.data.info[0].balance.toFixed(2)
+						// if (_this.amount > 0)
+						_this.$store.state.reshui_amount = _this.amount
 						// 组合楼栋宿舍号
-						this.dorm_number = res.data.info[0].build + res.data.info[0].dom
+						_this.dorm_number = res.data.info[0].build + res.data.info[0].dom
 						// 校区
-						// this.compus = res.data.info[0].campus
+						// _this.compus = res.data.info[0].campus
 
-						if (param == 'onLoad' && typeof(options.from) != 'undefined' && options.from != 0) {
+						if (param == 'onLoad' && typeof options.from != 'undefined' && options.from != 0) {
 							// 初始化蓝牙
-							this.openBluetoothAdapter()
+							_this.openBluetoothAdapter()
 						}
 						// 请求选定的月份消费记录
-						this.request_consumption_records()
+						_this.request_consumption_records()
 					} else {
 						uni.showToast({
 							title: '未获取到学号!',
@@ -445,13 +543,13 @@
 					}
 				} else if (res.data.mess == '未查询到用户信息') {
 					// 数据库中 未查询到用户信息,就清除本地存储
-					uni.removeStorageSync('userinfo_storage_key');
+					// uni.removeStorageSync('userinfo_storage_key');
 
 					uni.showToast({
 						title: '获取用户信息失败!'
 					})
 
-					if (options && typeof(options.from) != 'undefined' && typeof(options.from) != '') {
+					if (options && typeof options.from != 'undefined' && typeof options.from != '') {
 						uni.navigateTo({
 							url: '../../pages/index/index?from=' + options.from
 						})
@@ -1790,5 +1888,87 @@
 				}
 			}
 		}
+
+		.call {
+			position: fixed;
+			right: 40rpx;
+			bottom: 180rpx;
+		}
+
+		.default-btn {
+			background-color: transparent;
+			border: none;
+			outline: none;
+		}
+
+		.floating-button-call {
+			position: relative;
+			font-size: 28rpx;
+			width: 90rpx;
+			height: 90rpx;
+			border: 1px solid #ccc;
+			border-radius: 50%;
+			opacity: 0.5;
+			background: url('../../static/images/kefu.png') center center no-repeat;
+			background-size: 68rpx auto;
+		}
+
+		.operation-manual {
+			position: fixed;
+			right: 40rpx;
+			bottom: 300rpx;
+		}
+
+		.floating-button-manual {
+			position: relative;
+			font-size: 28rpx;
+			width: 90rpx;
+			height: 90rpx;
+			border: 1px solid #ccc;
+			border-radius: 50%;
+			opacity: 0.5;
+			background: url('../../static/images/yhsc.png') center center no-repeat;
+			background-size: 68rpx auto;
+		}
+
+		.article {
+			padding: 20rpx;
+			height: 100%;
+		}
+
+		.desc-title {
+			height: 50rpx;
+			line-height: 50rpx;
+			font-size: 36rpx;
+			font-weight: bold;
+			margin-bottom: 50rpx;
+			text-align: center;
+		}
+
+		.section {
+			margin-bottom: 40rpx;
+		}
+
+		.section-title-red,
+		.section-title {
+			font-size: 30rpx;
+			font-weight: bold;
+			margin-bottom: 10rpx;
+		}
+
+		.section-title-red {
+			color: #ca0000;
+		}
+
+		.section-content {
+			font-size: 28rpx;
+			line-height: 1.5;
+			white-space: pre-wrap;
+		}
+
+		.desc-footer {
+			height: 50rpx;
+			line-height: 50rpx;
+		}
 	}
 </style>

+ 12 - 13
pagesAir/addAir/addAir.vue

@@ -411,11 +411,8 @@
 												let obj4 = obj3[p].children
 												for (var u = 0; u < obj4.length; u++) {
 													if (obj4[u].isChecked) {
-														airs_selected_ids += obj0[i].label + '-' + obj1[j].label + '-' +
-															obj2[k]
-															.label + '-' + obj3[p].label + '|' + obj4[u].label + '|' +
-															obj4[u]
-															.id + ','
+														airs_selected_ids += obj0[i].label + '-' + obj1[j].label + '-' +obj2[k]
+															.label + '-' + obj3[p].label + '|' + obj4[u].label + '|' +obj4[u].id + ','
 													}
 												}
 											}
@@ -426,7 +423,7 @@
 						}
 					}
 				}
-				this.return_selected_airs = airs_selected_ids.substring(0, airs_selected_ids.length - 1)
+				this.return_selected_airs = airs_selected_ids.substring(0, airs_selected_ids.length - 1);
 			},
 			/**
 			 * 更新airs_selected中的数据
@@ -579,13 +576,15 @@
 
 					uni.$emit('selectAirs', {
 						sel_airs: this.return_selected_airs
-					})
+					});
 				}
 
-				// 返回空调列表页面
-				uni.navigateBack({
-					delta: -1
-				})
+				setTimeout(()=>{
+					// 返回空调列表页面
+					uni.navigateTo({
+						url: '/pagesAir/shareAir/shareAir'
+					});
+				}, 1000);
 			},
 			/**
 			 * 绑定空调
@@ -611,13 +610,13 @@
 					uni.showToast({
 						icon: 'none',
 						title: res.data.message,
-						duration: 1500
+						duration: 3000
 					})
 				} else {
 					uni.showToast({
 						icon: 'none',
 						title: res.data.message,
-						duration: 1500
+						duration: 3000
 					})
 				}
 			},

+ 25 - 0
pagesAir/figure/figure.vue

@@ -0,0 +1,25 @@
+<template>
+	<view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		onLoad(options) {
+			console.log(options.airip);
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 76 - 108
pagesAir/shareAir/shareAir.vue

@@ -34,7 +34,7 @@
 		<view class="add-air" v-if="isList === false" :style="{height: screenHeight}">
 			<view class="add-content">
 				<view class="add-left">
-					<navigator url="../addAir/addAir" class="add-btn">
+					<navigator open-type="redirect" url="../addAir/addAir" class="add-btn">
 						<uni-icons type="plus" color="white" size="30"></uni-icons>
 						<view>添加</view>
 					</navigator>
@@ -52,8 +52,7 @@
 		<view class="list-air" v-else>
 			<scroll-view scroll-y="true" :style="{height: screenHeight}">
 				<view class="list-items" v-for="(item, index) in airs" :key="index">
-					<view v-if="item.on === true" class="item-air"
-						@longpress="itemLongPress($event, item.time, item.air_ip)">
+					<view v-if="item.on === true" class="item-air" @tap="tapHandler(item.air_ip)" @longpress="itemLongPress($event, item.time, item.air_ip)">
 						<view class="item-left">
 							<view class="item-icon">
 								<view class="circle1"></view>
@@ -66,8 +65,7 @@
 								<text>{{item.status}}</text><text>{{item.time}}</text>
 							</view>
 						</view>
-						<view class="item-right"
-							@tap="btn_click(index, item.air_ip, item.name, item.info, item.order_num, item.time)">
+						<view class="item-right" @tap="btn_click(index, item.air_ip, item.name, item.info, item.order_num, item.time)">
 							<view class="item-btn">
 								<image src="../static/images/power-off.png" mode="aspectFit"></image>
 								<view class="item-txt-off">
@@ -76,8 +74,7 @@
 							</view>
 						</view>
 					</view>
-					<view v-else class="item-air" @longpress="itemLongPress($event, item.time, item.air_ip)"
-						:ref="index">
+					<view v-else class="item-air" @tap="tapHandler(item.air_ip)" @longpress="itemLongPress($event, item.time, item.air_ip)" :ref="index">
 						<view class="item-left">
 							<view class="item-icon">
 								<view class="circle1"></view>
@@ -87,14 +84,12 @@
 							<view class="item-title">{{item.name_show}}</view>
 							<view class="item-info">
 								<text class="item-info-left">{{item.info}}</text>
-								<!-- <image src="../static/images/power-off.png" mode="" class="item-info-icon"></image> -->
 								<text>{{item.status}}</text>
 								<text v-if="item.time !== ''">{{item.time}}</text>
 								<text v-else>未启动</text>
 							</view>
 						</view>
-						<view class="item-right" v-if="item.abnormal == 1"
-							@tap="btn_click(index, item.air_ip, item.name, item.info, item.order_num, item.time)"
+						<view class="item-right" v-if="item.abnormal == 1" @tap="btn_click(index, item.air_ip, item.name, item.info, item.order_num, item.time)"
 							:ref="index">
 							<view class="item-btn">
 								<image src="../static/images/power-on.png" mode="aspectFit"></image>
@@ -113,7 +108,7 @@
 						</view>
 					</view>
 				</view>
-				<navigator url="../addAir/addAir" class="add-air-bottom">
+				<navigator open-type="redirect" url="../addAir/addAir" class="add-air-bottom">
 					<uni-icons type="plus" size="30" color="#4B8DFB"></uni-icons>
 					<view class="add-btn-bottom">添加</view>
 				</navigator>
@@ -154,9 +149,8 @@
 			};
 		},
 		onLoad(options) {
-			var _this = this;
 			// 系统正在维护...
-			if (_this.test == 'weihuzhong') {
+			if (this.test == 'weihuzhong') {
 				uni.redirectTo({
 					url: '../../pages/index/index'
 				})
@@ -164,27 +158,25 @@
 				return;
 			}
 
-			_this.options = options
+			this.options = options
 			try {
 				// 选择绑定了的空调
 				let airs_selected = uni.getStorageSync('airs_selected')
 				if (airs_selected.length > 0) {
 					// 使用存储的列表
-					_this.selectAirs = airs_selected
+					this.selectAirs = airs_selected
 				}
 			} catch (e) {
 				console.log('读取空调相关信息:' + e.message);
 			}
-
-			// _this._freshing = false;
-			// setTimeout(() => {
-			// 	_this.triggered = true;
-			// }, 500);
 		},
 		onShow() {
-			var _this = this;
-			// 从新计算高度
-			_this.calc_screen_height();
+			uni.showLoading({
+				title: '加载中...',
+				mask: true
+			});
+
+			// var _this = this;
 			// 监听全局的自定义事件,事件由 uni.$emit 触发,但仅触发一次,在第一次触发之后移除该监听器。
 			// 绑定空调
 			uni.$once('selectAirs', data => {
@@ -196,14 +188,14 @@
 					let tmpAirs = arrAirs[i].split('|');
 					let t = tmpAirs[1].split('-');
 					tf = true;
-					for (var j = 0; j < _this.selectAirs.length; j++) {
-						if (_this.selectAirs[j].air_ip == tmpAirs[2]) {
+					for (var j = 0; j < this.selectAirs.length; j++) {
+						if (this.selectAirs[j].air_ip == tmpAirs[2]) {
 							tf = false;
 						}
 					}
 					// 存在则不添加到数组和缓存
 					if (true === tf) {
-						_this.selectAirs.push({
+						this.selectAirs.push({
 							air_ip: tmpAirs[2],
 							name: tmpAirs[0] + ' ' + t[0],
 							info: t[1],
@@ -215,45 +207,48 @@
 					}
 				}
 				// 如果选的空调不为空,则显示添加的空调列表
-				if (_this.selectAirs.length > 0) {
+				if (this.selectAirs.length > 0) {
 					// 去重
-					var newArr = [...new Set(_this.selectAirs.map(e => JSON.stringify(e)))].map(e => JSON.parse(
-						e));
+					const newArr = Array.from(new Set(this.selectAirs.map(JSON.stringify))).map(JSON.parse);
 
-					_this.selectAirs = newArr;
+					this.selectAirs = newArr;
 				}
 				// 存储空调列表
-				uni.setStorageSync('airs_selected', _this.selectAirs);
+				uni.setStorageSync('airs_selected', this.selectAirs);
 				// 移除全局自定义事件监听器。
-				// uni.$off('selectAirs')
+				uni.$off('selectAirs');
 			});
 
 			// 获取基本信息
-			_this.get_base_info(_this.options, 'onShow');
-
-			setTimeout(() => {
-				uni.hideLoading();
-			}, 3000);
+			this.get_base_info('onShow');
+			
+			// 从新计算高度
+			this.calc_screen_height();
+			// setTimeout(() => {
+			// 	uni.hideLoading();
+			// }, 3000);
 		},
 		// 下拉刷新
 		onPullDownRefresh() {
-			var _this = this;
 			// 获取基本信息
-			_this.get_base_info(_this.options, 'onShow');
+			this.get_base_info(this.options, 'onShow');
 			// 查询绑定的空调(更新列表)
-			_this.select_banding_airs();
+			this.select_banding_airs();
 			// 停止刷新
 			uni.stopPullDownRefresh();
 		},
 		methods: {
+			// 跳转到电流、电压、功率页面
+			tapHandler(air_ip) {
+				// console.log(air_ip);
+				uni.navigateTo({
+					url: '/pagesAir/figure/figure?airip=' + air_ip
+				});
+			},
 			/**
 			 * 查询绑定的空调
 			 */
 			async select_banding_airs() {
-				uni.showLoading({
-					title: '加载绑定的空调'
-				});
-
 				var _this = this;
 				const res = await this.$myRequest({
 					host: _this.ceshi,
@@ -265,32 +260,25 @@
 					data: {
 						sfzh: _this.id_card
 					}
-				})
+				});
 
 				// console.log(res.data);
 				if (res.data.code == 200) {
-					let data = res.data.data
+					let data = res.data.data;
 					if (data.length > 0) {
-						_this.airs = []
-						let tmpAirs = []
+						_this.airs = [];
+						let tmpAirs = [];
 						for (var i = 0; i < data.length; i++) {
 							tmpAirs.push({
 								air_ip: data[i].air_ip,
-								name: data[i].school + '-' + data[i].build + '-' + data[i].floors + '-' + data[
-									i].dom + '-' + data[i].air_name,
+								name: data[i].school + '-' + data[i].build + '-' + data[i].floors + '-' + data[i].dom + '-' + data[i].air_name,
 								name_show: data[i].school + '-' + data[i].dom + '-' + data[i].air_name,
 								info: data[i].air_config,
 								time: '',
 								abnormal: data[i].is_normal,
 								on: data[i].is_on, // true开启了,false关闭了
 								order_num: '' // 订单号
-							})
-							// for (var j = 0; j < _this.selectAirs.length; j++) {
-							// 	if (_this.selectAirs[j].air_ip == data[i].air_ip) {
-							// 		tmpAirs.push(_this.selectAirs[j])
-							// 		break
-							// 	}
-							// }
+							});
 						}
 						// 不为空
 						if (tmpAirs.length > 0) {
@@ -300,32 +288,32 @@
 								(function(t, tmpAirs) { // 注意这里是形参
 									setTimeout(function() {
 										_this.readAirsStatus(tmpAirs, t);
-									}, 100 * t); // 还是0.1秒执行一次,不是累加的
-								})(i, tmpAirs) // 注意这里是实参,这里把要用的参数传进去
+									}, 10 * t); // 还是0.01秒执行一次,不是累加的
+								})(i, tmpAirs); // 注意这里是实参,这里把要用的参数传进去
 							}
 
 							setTimeout(() => {
 								if (_this.airs.length > 0) {
 									// 显示添加的空调列表
 									_this.isList = true;
-									uni.hideLoading();
+									// uni.hideLoading();
 								}
-							}, 500);
+							}, 300);
 						}
 					} else {
 						// 隐藏添加的空调列表
-						_this.isList = false
+						_this.isList = false;
 					}
 				} else if (res.data.code == 205) {
 					// 隐藏添加的空调列表
-					_this.isList = false
+					_this.isList = false;
 				} else {
 					// 隐藏添加的空调列表
-					_this.isList = false
+					_this.isList = false;
 					// 提示返回信息
 					uni.showToast({
 						title: res.data.message
-					})
+					});
 				}
 				// 隐藏加载
 				uni.hideLoading();
@@ -348,7 +336,7 @@
 						air_ip: tmpAirs[index].air_ip,
 						sfzh: _this.id_card
 					}
-				})
+				});
 
 				// console.log(res.data, tmpAirs[index].air_ip);
 				if (res.data.code == 200) {
@@ -383,27 +371,23 @@
 			/**
 			 * 获取基本信息
 			 */
-			get_base_info(options, param) {
+			get_base_info(param) {
 				// console.log(options);
-				uni.showLoading({
-					title: '加载中',
-					mask: true
-				})
-
+				var _this = this;
 				// 获取学号
-				this.stu_number = this.$store.state.userInfo.card_number
+				_this.stu_number = _this.$store.state.userInfo.card_number;
 
 				try {
-					if (this.stu_number == '' || typeof(this.stu_number) == 'undefined') { // 学号不存在,可以从存储中拿用户信息
+					if (_this.stu_number == '' || typeof(_this.stu_number) == 'undefined') { // 学号不存在,可以从存储中拿用户信息
 						const userinfo = uni.getStorageSync('userinfo_storage_key')
 						if (userinfo) { // 拿学号
-							this.userinfo = userinfo
-							this.stu_number = userinfo.card_number
-							this.id_card = userinfo.id_card
+							_this.userinfo = userinfo;
+							_this.stu_number = userinfo.card_number;
+							_this.id_card = userinfo.id_card;
 						} else { // 还没有需要跳转到首页进行获取
 							uni.navigateTo({
-								url: '../../pages/index/index?from=' + options.from
-							})
+								url: '../../pages/index/index?from=' + _this.options.from
+							});
 
 							uni.showToast({
 								icon: 'none',
@@ -411,36 +395,31 @@
 								duration: 3000
 							});
 
-							return
+							return;
 						}
 					} else { // 学号已经存在,可以从存储中拿用户信息
-						this.userinfo = JSON.stringify(uni.getStorageSync('userinfo_storage_key'))
+						_this.userinfo = JSON.stringify(uni.getStorageSync('userinfo_storage_key'));
 					}
 				} catch (e) {
 					console.log('获取基本信息:' + e.message);
 				}
 				// 获取code
-				this.getCode(options, param)
-
-				// if (this.id_card !== '') {
-				// 	// 查询绑定的空调
-				// 	this.select_banding_airs()
-				// }
+				_this.getCode(param);
 			},
 			/**
 			 * 获得code
 			 */
-			getCode(options, param) {
+			getCode(param) {
 				var _this = this;
 				uni.login({
 					success: (res) => {
 						// console.log('getCode', res);
 						if (res.code) {
 							if (param == 'get_user_info') {
-								_this.getUserInfo(res.code)
+								_this.getUserInfo(res.code);
 							} else {
 								// 请求服务器,获得openid
-								_this.getOpenId(options, res.code)
+								_this.getOpenId(res.code);
 							}
 						} else {
 							uni.showToast({
@@ -449,12 +428,12 @@
 							});
 						}
 					}
-				})
+				});
 			},
 			/**
 			 * 请求服务器,获得openid
 			 */
-			async getOpenId(options, param_code) {
+			async getOpenId(param_code) {
 				var _this = this;
 				if (typeof _this.userinfo === 'object') {
 					_this.userinfo = JSON.stringify(_this.userinfo)
@@ -475,27 +454,19 @@
 				// console.log(res.data);
 				if (res.data.code == 200) {
 					// 查询用户基本信息
-					_this.getCode(options, 'get_user_info')
-					// 绑定成功,提示返回信息,但没必要提示
-					// uni.showToast({
-					// 	title: res.data.message
-					// })
+					_this.getCode('get_user_info')
 				} else if (res.data.code == 205) {
 					// 查询用户基本信息
-					_this.getCode(options, 'get_user_info')
-					// 用户已经存在,但没必要提示
-					// uni.showToast({
-					// title: res.data.message
-					// })
+					_this.getCode('get_user_info')
 				} else {
 					// 提示返回信息
 					uni.showToast({
 						title: res.data.message
 					})
 
-					if (options && typeof(options.from) != 'undefined' && typeof(options.from) != '') {
+					if (_this.options && typeof _this.options.from != 'undefined' && typeof _this.options.from != '') {
 						uni.navigateTo({
-							url: '../../pages/index/index?from=' + options.from
+							url: '../../pages/index/index?from=' + _this.options.from
 						})
 					} else {
 						uni.redirectTo({
@@ -865,9 +836,6 @@
 					}
 				}
 			},
-			onRestore() {
-				this.triggered = true; // 需要重置
-			},
 			/**
 			 * 轮播图发生改变
 			 * @param {Object} e
@@ -1165,4 +1133,4 @@
 			}
 		}
 	}
-</style>
+</style>

+ 1 - 0
pagesElectric/dfxq/dfxq.vue

@@ -264,6 +264,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;

+ 25 - 1
pagesElectric/jiaofei/jiaofei.css

@@ -214,5 +214,29 @@ page {
 	background: url(../../static/images/gou.png) 0upx 0upx no-repeat;
 	background-size: 20%;
 	background-position: right bottom;
-	background-color: rgba(18,150,219,0.1);
+	background-color: rgba(18, 150, 219, 0.1);
 }
+
+.call {
+	position: fixed;
+	right: 40rpx;
+	bottom: 180rpx;
+}
+
+.default-btn {
+	background-color: transparent;
+	border: none;
+	outline: none;
+}
+
+.floating-button-call {
+	position: relative;
+	font-size: 28rpx;
+	width: 90rpx;
+	height: 90rpx;
+	border: 1px solid #ccc;
+	border-radius: 50%;
+	opacity: 0.5;
+	background: url('../../static/images/kefu.png') center center no-repeat;
+	background-size: 68rpx auto;
+}

File diff suppressed because it is too large
+ 537 - 540
pagesElectric/jiaofei/jiaofei.vue


+ 4 - 0
pagesElectric/select/select.css

@@ -90,4 +90,8 @@ page {
 
 .font-txt{
 	color: #333333;
+}
+
+.font-txt-red {
+	color: #ff0000;
 }

+ 140 - 116
pagesElectric/select/select.vue

@@ -1,52 +1,48 @@
 <template>
 	<view class="container">
-		<picker class="picker-item1" @tap="clickSelect1" @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>
 				</view>
 				<view class="picker-item-label">校区</view>
-				<view class="picker-item-content" :class="{'font-txt':add_class1==1}">{{arr1[index1]}}</view>
+				<view class="picker-item-content" :class="{'font-txt':add_class1==1, 'font-txt-red': add_class1!=1}">{{arr1[index1]}}</view>
 				<view class="picker-item-logor">
 					<image class="picker-item-logo-right" src="../static/images/right.png"></image>
 				</view>
 			</view>
 		</picker>
-		<picker class="picker-item2" @tap="clickSelect2" @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>
 				</view>
 				<view class="picker-item-label">楼栋</view>
-				<view class="picker-item-content" :class="{'font-txt':add_class2==1}">{{arr2[index2]}}</view>
+				<view class="picker-item-content" :class="{'font-txt':add_class2==1, 'font-txt-red': add_class2!=1}">{{arr2[index2]}}</view>
 				<view class="picker-item-logor">
 					<image class="picker-item-logo-right" src="../static/images/right.png"></image>
 				</view>
 			</view>
 		</picker>
-		<picker class="picker-item2" @tap="clickSelect3" @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>
 				</view>
 				<view class="picker-item-label">楼层</view>
-				<view class="picker-item-content" :class="{'font-txt':add_class3==1}">{{arr3[index3]}}</view>
+				<view class="picker-item-content" :class="{'font-txt':add_class3==1, 'font-txt-red': add_class3!=1}">{{arr3[index3]}}</view>
 				<view class="picker-item-logor">
 					<image class="picker-item-logo-right" src="../static/images/right.png"></image>
 				</view>
 			</view>
 		</picker>
-		<picker class="picker-item2" @tap="clickSelect4" @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>
 				</view>
 				<view class="picker-item-label">房间</view>
-				<view class="picker-item-content" :class="{'font-txt':add_class4==1}">{{arr4[index4]}}</view>
+				<view class="picker-item-content" :class="{'font-txt':add_class4==1, 'font-txt-red': add_class4!=1}">{{arr4[index4]}}</view>
 				<view class="picker-item-logor">
 					<image class="picker-item-logo-right" src="../static/images/right.png"></image>
 				</view>
@@ -59,7 +55,6 @@
 </template>
 
 <script>
-	// import sortdata from '../../static/test.js'
 	export default {
 		data() {
 			return {
@@ -80,15 +75,14 @@
 				array3: [],
 				array4: [],
 				room: '', //存储选择器选择的所有值
-				add_class1: '', //选择器class属性
-				add_class2: '',
-				add_class3: '',
-				add_class4: '',
+				add_class1: 0, //选择器class属性
+				add_class2: 0,
+				add_class3: 0,
+				add_class4: 0,
 				dis_num1: 1, //选择器disable属性,是否禁用
 				dis_num2: 1,
 				dis_num3: 1,
 				dis_num4: 1,
-				// dis_num5: 1,
 				allData: [], //所有数据
 				storage: {}, //存放选择数据
 				ceshi: 'code',
@@ -100,13 +94,13 @@
 			if (this.test == 'weihuzhong') {
 				uni.redirectTo({
 					url: '../../pages/index/index'
-				})
-				
+				});
+
 				return;
 			}
-			
+
 			// 获取校区
-			this.getCampus()
+			this.getCampus();
 		},
 		methods: {
 			/**
@@ -120,27 +114,27 @@
 					header: {
 						'content-type': 'application/json'
 					}
-				})
+				});
 				// console.log(res.data);
 				if (res.data.code === 200) {
 					let tmpData = res.data.data;
-					this.nschool = tmpData.length
-					this.array1 = []
+					this.nschool = tmpData.length;
+					this.array1 = [];
 
 					for (var i = 0; i < this.nschool; i++) {
-						this.array1.push(tmpData[i].school)
+						this.array1.push(tmpData[i].school);
 					}
 
-					this.dis_num1 = 0
+					this.dis_num1 = 0;
 				} else {
 					uni.showToast({
 						title: '未获得校区',
 						icon: 'none'
-					})
+					});
 				}
 
 				if (this.$store.state.building.roomSelect != '') {
-					this.fillData()
+					this.fillData();
 				}
 			},
 			/**
@@ -170,26 +164,23 @@
 				// 自动填充
 				if (arr.length > 0) {
 					if (arr[1] != null && arr[1].length > 0) {
-						this.arr1 = [arr[1]]
+						this.arr1 = [arr[1]];
 					}
 					let len = arr[2].length
 					if (arr[2] != null && len > 0) {
-						let a = arr[2].split('-')
-						this.arr2 = [a[0] + '栋']
-						this.arr3 = [a[1].substring(0, a[1].length - 2) + '层']
-						this.arr4 = [arr[2]]
+						let a = arr[2].split('-');
+						this.arr2 = [a[0] + '栋'];
+						this.arr3 = [a[1].substring(0, a[1].length - 2) + '层'];
+						this.arr4 = [arr[2]];
 					}
 
 					this.sel1(this.arr1, true);
 
-					this.add_class1 = 1
-					this.add_class2 = 1
-					this.add_class3 = 1
-					this.add_class4 = 1
+					this.checkNull();
 
-					this.dis_num2 = 0
-					this.dis_num3 = 0
-					this.dis_num4 = 0
+					this.dis_num2 = 0;
+					this.dis_num3 = 0;
+					this.dis_num4 = 0;
 				}
 			},
 			clickSelect1() {
@@ -197,17 +188,18 @@
 					uni.showToast({
 						title: '未获得校区,可能网络异常',
 						icon: 'none'
-					})
+					});
 				}
 			},
 			/**
 			 * 选择校区
 			 */
 			changeSelect1(e) {
-				this.array2 = []
-				this.array3 = []
-				this.array4 = []
-				this.sel1(e.detail.value, false)
+				// console.log(e);
+				this.array2 = [];
+				this.array3 = [];
+				this.array4 = [];
+				this.sel1(e.detail.value, false);
 			},
 			// 根据参数的值选中
 			sel1(index, theRoomIsExist) {
@@ -215,34 +207,55 @@
 				// console.log(typeof(index))
 				this.arr1 = this.array1;
 				//获取选择器1的值
-				if (typeof(index) == 'string') {
+				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
+							this.index1 = i;
 						}
 					}
 				}
 
 				//获取选择器二中的值
-				this.getBuilds(this.array1[this.index1], theRoomIsExist)
+				this.getBuilds(this.array1[this.index1], theRoomIsExist);
 
-				if (typeof(index) == 'string') {
-					this.arr2 = ['请选择楼栋']
-					this.arr3 = ['请选择楼层']
-					this.arr4 = ['请选择房间']
-					this.index2 = 0
-					this.index3 = 0
-					this.index4 = 0
+				if (typeof index == 'string') {
+					this.arr2 = ['请选择楼栋'];
+					this.arr3 = ['请选择楼层'];
+					this.arr4 = ['请选择房间'];
+					this.index2 = 0;
+					this.index3 = 0;
+					this.index4 = 0;
 
-					this.room = ''
+					this.room = '';
 				}
 
 				this.add_class1 = 1;
 				this.dis_num2 = 0;
-
-				this.chgDisable()
+			},
+			// 检测对应的下拉列表是否为空,空为红色,非空黑色
+			checkNull() {
+				if (this.array1.length == 0) {
+					this.add_class1 = 0;
+				} else {
+					this.add_class1 = 1;
+				}
+				if (this.array2.length == 0) {
+					this.add_class2 = 0;
+				} else {
+					this.add_class2 = 1;
+				}
+				if (this.array3.length == 0) {
+					this.add_class3 = 0;
+				} else {
+					this.add_class3 = 1;
+				}
+				if (this.array4.length == 0) {
+					this.add_class4 = 0;
+				} else {
+					this.add_class4 = 1;
+				}
 			},
 			/**
 			 * 获取楼栋
@@ -259,73 +272,76 @@
 					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 = []
+					this.nbuilds = tmpData.length;
+					this.array2 = [];
 					//将数据加入选择器二中
 					for (var j = 0; j < this.nbuilds; j++) {
-						this.array2.push(tmpData[j].build)
+						this.array2.push(tmpData[j].build);
 					}
 
 					if (theRoomIsExist == true) {
-						this.sel2(this.arr2, true)
+						this.sel2(this.arr2, true);
 					}
 				} else {
 					this.array2 = []
 					uni.showToast({
 						title: '未获得楼栋',
 						icon: 'none'
-					})
+					});
 				}
+
+				this.checkNull();
+
+				this.chgDisable();
 			},
 			clickSelect2() {
 				if (this.array2.length == 0) {
 					uni.showToast({
 						title: '未获得楼栋,该校区没有楼栋',
 						icon: 'none'
-					})
+					});
 				}
 			},
 			changeSelect2(e) {
-				this.array3 = []
-				this.array4 = []
-				this.sel2(e.detail.value, false)
+				// console.log(e);
+				this.array3 = [];
+				this.array4 = [];
+				this.sel2(e.detail.value, false);
 			},
 			sel2(index, theRoomIsExist) {
 				// console.log(index);
 				// console.log(typeof index);
 				this.arr2 = this.array2;
 
-				if (typeof(index) == 'string') {
+				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
+							this.index2 = i;
 						}
 					}
 				}
 
-				this.getFloors(this.array1[this.index1], this.array2[this.index2], theRoomIsExist)
+				this.getFloors(this.array1[this.index1], this.array2[this.index2], theRoomIsExist);
 
-				if (typeof(index) == 'string') {
-					this.arr3 = ['请选择楼层']
-					this.arr4 = ['请选择房间']
-					this.index3 = 0
-					this.index4 = 0
+				if (typeof index == 'string') {
+					this.arr3 = ['请选择楼层'];
+					this.arr4 = ['请选择房间'];
+					this.index3 = 0;
+					this.index4 = 0;
 
-					this.room = ''
+					this.room = '';
 				}
 
 				this.add_class2 = 1;
 				this.dis_num3 = 0;
-
-				this.chgDisable()
 			},
 			/**
 			 * 获取楼层
@@ -345,36 +361,41 @@
 						school: campus,
 						build: build
 					}
-				})
+				});
 				// console.log('楼层:', res.data);
 				if (res.data.code === 200) {
 					let tmpData = res.data.data;
-					this.floors = tmpData.length
-					this.array3 = []
+					this.floors = tmpData.length;
+					this.array3 = [];
 
 					for (var j = 0; j < this.floors; j++) {
-						this.array3.push(tmpData[j].floors)
+						this.array3.push(tmpData[j].floors);
 					}
 
 					if (theRoomIsExist == true) {
-						this.sel3(this.arr3, true)
+						this.sel3(this.arr3, true);
 					}
 				} else {
 					uni.showToast({
 						title: '未获得楼层',
 						icon: 'none'
-					})
+					});
 				}
+
+				this.checkNull();
+				
+				this.chgDisable();
 			},
 			clickSelect3() {
 				if (this.array3.length == 0) {
 					uni.showToast({
 						title: '未获得楼层,请选择楼栋',
 						icon: 'none'
-					})
+					});
 				}
 			},
 			changeSelect3(e) {
+				// console.log(e);
 				this.array4 = []
 				this.sel3(e.detail.value, false)
 			},
@@ -382,29 +403,27 @@
 				// console.log(index)
 				this.arr3 = this.array3;
 
-				if (typeof(index) == 'string') {
+				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
+							this.index3 = i;
 						}
 					}
 				}
 
-				this.getDoms(this.array1[this.index1], this.array2[this.index2], this.array3[this.index3], theRoomIsExit)
+				this.getDoms(this.array1[this.index1], this.array2[this.index2], this.array3[this.index3], theRoomIsExit);
 
-				if (typeof(index) == 'string') {
-					this.arr4 = ['请选择房间']
-					this.index4 = 0
+				if (typeof index == 'string') {
+					this.arr4 = ['请选择房间'];
+					this.index4 = 0;
 
-					this.room = ''
+					this.room = '';
 				}
 
 				this.add_class3 = 1;
 				this.dis_num4 = 0;
-
-				this.chgDisable()
 			},
 			/**
 			 * 获取房间
@@ -426,35 +445,40 @@
 						build: build,
 						floors: floors
 					}
-				})
+				});
 				// console.log('房间:', res.data);
 				if (res.data.code === 200) {
 					let tmpData = res.data.data;
-					this.rooms = tmpData.length
-					this.array4 = []
+					this.rooms = tmpData.length;
+					this.array4 = [];
 					for (var j = 0; j < this.rooms; j++) {
-						this.array4.push(tmpData[j].dom)
+						this.array4.push(tmpData[j].dom);
 					}
 
 					if (theRoomIsExist == true) {
-						this.sel4(this.arr4, true)
+						this.sel4(this.arr4, true);
 					}
 				} else {
 					uni.showToast({
 						title: '未获得房间',
 						icon: 'none'
-					})
+					});
 				}
+				
+				this.checkNull();
+
+				this.chgDisable();
 			},
 			clickSelect4() {
 				if (this.array4.length == 0) {
 					uni.showToast({
 						title: '未获得房间,请选择楼层',
 						icon: 'none'
-					})
+					});
 				}
 			},
 			changeSelect4(e) {
+				// console.log(e);
 				this.sel4(e.detail.value, false)
 			},
 			sel4(index, theRoomIsExist) {
@@ -464,16 +488,16 @@
 				this.add_class4 = 1;
 
 				if (this.room) {
-					this.room = ''
+					this.room = '';
 				}
 
 
-				if (typeof(index) == 'string') {
+				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.index4 = i;
 						}
 					}
 				}
@@ -486,18 +510,18 @@
 			chgDisable() {
 				setTimeout(() => {
 					if (this.array1.length == 0) {
-						this.dis_num1 = 1
+						this.dis_num1 = 1;
 					}
 					if (this.array2.length == 0) {
-						this.dis_num2 = 1
+						this.dis_num2 = 1;
 					}
 					if (this.array3.length == 0) {
-						this.dis_num3 = 1
+						this.dis_num3 = 1;
 					}
 					if (this.array4.length == 0) {
-						this.dis_num4 = 1
+						this.dis_num4 = 1;
 					}
-				}, 300)
+				}, 300);
 			},
 			/**
 			 * 跳转缴费页面
@@ -512,21 +536,21 @@
 					this.$store.state.building.roomSelect = this.storage.roomSelect;
 					this.$store.state.building.add_class = 1;
 					this.$store.state.building.dorm_number = this.storage.dom;
+
 					uni.navigateBack({
 						delta: 1
-					})
+					});
 				} else {
 					uni.showToast({
 						icon: 'success',
 						title: '宿舍号不完整'
-					})
+					});
 				}
-			},
-
+			}
 		}
 	}
 </script>
 
 <style>
 	@import url("select.css");
-</style>
+</style>

+ 1 - 1
pagesElectric/sfxq/sfxq.vue

@@ -262,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;

+ 22 - 13
pagesElectric/show/show.vue

@@ -165,37 +165,38 @@
 			 */
 			async get_jiaofeijilu() {
 				// console.log(this.stu_number);
-				if (this.stu_number != '') {
-					const res = await this.$myRequest({
-						host: this.ceshi,
+				var _this = this;
+				if (_this.stu_number != '') {
+					const res = await _this.$myRequest({
+						host: _this.ceshi,
 						url: '/HotWaters/elqueyRecordEle.action',
 						method: 'POST',
 						header: {
 							'content-type': 'application/x-www-form-urlencoded'
 						},
 						data: {
-							'stu_number': this.stu_number,
-							're_time': this.date
+							'stu_number': _this.stu_number,
+							're_time': _this.date
 						}
 					})
 
 					// console.log(res);
 					if (res.data.mess == '未查到记录') {
-						if (this.changeDate) {
+						if (_this.changeDate) {
 							uni.showToast({
 								title: '该月无缴费记录',
 								icon: 'success',
 								success: (res) => {
-									this.changeDate = false
+									_this.changeDate = false
 								}
 							});
 
-							this.list = []
+							_this.list = []
 						}
 					} else {
 						// 充值绑定显示到界面
 						for (var i = 0; i < res.data.data.length; i++) {
-							this.list.push(res.data.data[i])
+							_this.list.push(res.data.data[i])
 						}
 					}
 				} else {
@@ -234,7 +235,7 @@
 						})
 
 						// console.log(res.data.rows);
-						// console.log(res.data);
+						// console.log(res.data);						
 						if (res.data.rows.length == 0) {
 							return
 						}
@@ -246,6 +247,14 @@
 							})
 							return
 						}
+						
+						var rows = res.data.rows;
+						// 过滤掉重复数据
+						rows = rows.filter(function(item, index, self) {
+							return index === self.findIndex(function(t) {
+								return t.dataTime === item.dataTime;
+							});
+						});
 
 						let chrt_data = {
 							categories: [],
@@ -255,11 +264,11 @@
 						let dt = ''
 						let temp = 0
 						let data = []
-						for (var i = 0; i < res.data.rows.length; i++) {
-							dt = res.data.rows[i].dataTime
+						for (var i = 0; i < rows.length; i++) {
+							dt = rows[i].dataTime
 							// chrt_data.categories.push(dt.substr(dt.indexOf('-') + 1, dt.length) + '月')
 							chrt_data.categories.push(parseInt(dt.substr(dt.indexOf('-') + 1, dt.length)) + '月')
-							temp = (res.data.rows[i].totalMoney).toFixed(2)
+							temp = (rows[i].totalMoney).toFixed(2)
 							// temp = temp
 							data.push(temp)
 							if (parseFloat(temp) > parseFloat(elc_max)) {

+ 27 - 28
pagesRepairs/index/index.vue

@@ -13,7 +13,7 @@ export default {
 			// 获取用户信息
 			ocode: '1015730314',
 			// 商户appkey
-			appkey: '9D6ACFE8CF9AFD07',
+			appkey: 'EE28EE2C93296F4E',
 			// 是否授权可见
 			visible: false,
 			// 是否启动授权
@@ -77,13 +77,13 @@ export default {
 				})
 			} else {
 				console.log('重新授权')
-				uni.setStorageSync('repairsUserInfo', this.userListInfo)
-				uni.reLaunch({
-					url: '/pagesRepairs/box/box'
-				})
+				// uni.setStorageSync('repairsUserInfo', this.userListInfo)
+				// uni.reLaunch({
+				// 	url: '/pagesRepairs/box/box'
+				// })
 
-				// this.showLogin = true
-				// this.visible = true
+				this.showLogin = true
+				this.visible = true
 			}
 		},
 		// 授权成功回调
@@ -92,7 +92,7 @@ export default {
 			let wxcode = res.detail.wxcode
 			console.log(wxcode)
 			// 获取wxcode后请求登录
-			// this.login(wxcode)
+			this.login(wxcode)
 		},
 		// 授权失败回调
 		loginFail() {
@@ -138,30 +138,29 @@ export default {
 		// 用户登陆获取个人信息和token
 		async login(wxcode) {
 			const res = await this.$myRequest_repairs({
-				url: '/attendance/api/system/user/login/app',
-				method: 'post',
-				header: {
-					'content-type': 'application/json',
-					platform: 2,
-					'Accept-Language': 'zh-CN,zh;q=0.9'
-				},
+				url: '/repair/api/login/Openid',
+				// header: {
+				// 	'content-type': 'application/json',
+				// 	platform: 2,
+				// 	'Accept-Language': 'zh-CN,zh;q=0.9'
+				// },
 				data: {
-					redirect_uri: `mnp://${this.appid}`,
+					// redirect_uri: `mnp://${this.appid}`,
 					wxcode
 				}
 			})
-			// console.log(res);
-			if (res.code == 200) {
-				uni.setStorageSync('token', res.data.token)
-				uni.reLaunch({
-					url: '/pagesRepairs/box/box'
-				})
-			} else {
-				uni.showToast({
-					title: res.message,
-					icon: 'none'
-				})
-			}
+			console.log(res)
+			// if (res.code == 200) {
+			// 	uni.setStorageSync('token', res.data.token)
+			// 	uni.reLaunch({
+			// 		url: '/pagesRepairs/box/box'
+			// 	})
+			// } else {
+			// 	uni.showToast({
+			// 		title: res.message,
+			// 		icon: 'none'
+			// 	})
+			// }
 		}
 	}
 }

+ 1 - 1
pagesRepairs/util/api.js

@@ -1,4 +1,4 @@
-const BASE_URL = "https://jiangxih3cpartner.com/reporting"
+const BASE_URL = "http://192.168.161.220:8080"
 export const myRequest_repairs = (options) => {
 	uni.showLoading({
 		title: "加载中",

+ 1 - 0
static/api.js

@@ -1,6 +1,7 @@
 const WEXIN_BASE_URL = 'https://api.mch.weixin.qq.com' // wexin
 const WECARD_BASE_URL = 'https://open.wecard.qq.com' // wecard
 const CODE_BASE_URL = 'https://chtech.ncjti.edu.cn/shuidian' // code
+// const CODE_BASE_URL = 'https://jtishfw.ncjti.edu.cn/jxch-smartmp/HotWaters' // code
 const AIR_BASE_URL = 'https://chtech.ncjti.edu.cn/air-conditioner-control' // air
 const IP_BASE_URL = 'https://pv.sohu.com/cityjson' // ip
 

BIN
static/images/kefu.png


BIN
static/images/qr.jpg


BIN
static/images/yhsc.png