Browse Source

说明:版本1.0.3中的优化完成,需要等待后端接口,采集用户信息。

程志平 4 years ago
parent
commit
4a2d3991bf
10 changed files with 432 additions and 331 deletions
  1. 43 19
      components/instructions.vue
  2. 78 73
      manifest.json
  3. 4 1
      pages.json
  4. 178 160
      pages/index/index.vue
  5. 36 26
      pages/jiaofei/jiaofei.css
  6. 38 32
      pages/jiaofei/jiaofei.vue
  7. 8 2
      pages/recharge/recharge.vue
  8. 41 15
      pages/reshui/reshui.vue
  9. 5 2
      static/api.js
  10. 1 1
      store/index.js

+ 43 - 19
components/instructions.vue

@@ -7,22 +7,25 @@
 				</view>
 				</view>
 				<view class="item">
 				<view class="item">
 					<view class="text">
 					<view class="text">
-						1.点击"扫码连接",扫码水表上的二维码;
+						1.点【扫码连接】,扫水表中的二维码;
 					</view>
 					</view>
 					<view class="text">
 					<view class="text">
-						2.水表连接成功后"开始使用"按钮
+						2.待进度显示“数据通讯”后,点【开启设备】可启动水表
 					</view>
 					</view>
 					<view class="text">
 					<view class="text">
-						3.使用完成后点击"停止用水"即关闭热水;
+						3.在水表上手动滑动,可启动、暂停、停止用水;手机APP也可直接停止用水。
 					</view>
 					</view>
 					<view class="text">
 					<view class="text">
-						4.或者连接水表后直接在表上进行操作,如下图
+						4.示意图如下
 					</view>
 					</view>
 					<view class="img">
 					<view class="img">
 						<image class="img_scan" src="../static/images/qr-code.png" mode=""></image>
 						<image class="img_scan" src="../static/images/qr-code.png" mode=""></image>
 					</view>
 					</view>
-					<view class="bot_text" @click="child_cancel" hover-class="bot_text_hover_color">
-						我知道了
+					<view class="bot">
+						<label class="bot_text" @tap="child_noshow" hover-class="bot_text_hover_color">
+							<checkbox class="chk" /><text>以后不再出现</text>
+						</label>
+						<text class="bot_text" @tap="child_cancel" hover-class="bot_text_hover_color">我知道了</text>
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
@@ -32,7 +35,16 @@
 
 
 <script>
 <script>
 	export default {
 	export default {
+		data() {
+			return {
+				chk: false
+			}
+		},
 		methods: {
 		methods: {
+			child_noshow(e) {
+				this.chk = !this.chk
+				this.$emit('parent_noshow', this.chk)
+			},			
 			child_cancel() {
 			child_cancel() {
 				this.$emit('parent_cancel', false)
 				this.$emit('parent_cancel', false)
 			}
 			}
@@ -40,7 +52,7 @@
 	}
 	}
 </script>
 </script>
 
 
-<style lang="scss" scoped>
+<style scoped lang="scss">
 	.content {
 	.content {
 		width: 100%;
 		width: 100%;
 		height: 100%;
 		height: 100%;
@@ -77,6 +89,7 @@
 					color: #333;
 					color: #333;
 					line-height: 40rpx;
 					line-height: 40rpx;
 					margin-bottom: 20rpx;
 					margin-bottom: 20rpx;
+					text-indent: 2em;
 				}
 				}
 
 
 				.img {
 				.img {
@@ -89,18 +102,29 @@
 					}
 					}
 				}
 				}
 
 
-				.bot_text {
-					padding: 5rpx;
-					height: 65rpx;
-					line-height: 65rpx;
-					border-radius: 10rpx;
-					color: $my-color-primary;
-					font-size: 32rpx;
-					text-align: center;
-				}
-				
-				.bot_text_hover_color {
-					background-color: $my-color-btn-background;
+				.bot {
+					display: flex;
+					flex-direction: row;
+					justify-content: space-around;
+					align-items: center;
+					
+					.bot_text {
+						width: 50%;
+						height: 70rpx;
+						line-height: 70rpx;
+						border-radius: 10rpx;
+						color: $my-color-primary;
+						font-size: 32rpx;
+						text-align: center;
+						
+						.chk {
+							transform:scale(0.7);
+						}
+					}
+					
+					.bot_text_hover_color {
+						background-color: $my-color-btn-background;
+					}
 				}
 				}
 			}
 			}
 		}
 		}

+ 78 - 73
manifest.json

@@ -1,75 +1,80 @@
 {
 {
-    "name" : "智慧校园水电",
-    "appid" : "__UNI__D7AE6E0",
-    "description" : "",
-    "versionName" : "1.0.0",
-    "versionCode" : "100",
-    "transformPx" : false,
-    /* 5+App特有相关 */
-    "app-plus" : {
-        "usingComponents" : true,
-        "nvueStyleCompiler" : "uni-app",
-        "compilerVersion" : 3,
-        "splashscreen" : {
-            "alwaysShowBeforeRender" : true,
-            "waiting" : true,
-            "autoclose" : true,
-            "delay" : 0
-        },
-        /* 模块配置 */
-        "modules" : {},
-        /* 应用发布信息 */
-        "distribute" : {
-            /* android打包配置 */
-            "android" : {
-                "permissions" : [
-                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
-                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
-                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
-                    "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.CAMERA\"/>",
-                    "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
-                    "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
-                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
-                    "<uses-feature android:name=\"android.hardware.camera\"/>",
-                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
-                ]
-            },
-            /* ios打包配置 */
-            "ios" : {},
-            /* SDK配置 */
-            "sdkConfigs" : {
-                "payment" : {}
-            }
-        }
-    },
-    /* 快应用特有相关 */
-    "quickapp" : {},
-    /* 小程序特有相关 */
-    "mp-weixin" : {
-        "appid" : "wx2fc3f45732fae5d3",
-        "setting" : {
-            "urlCheck" : false
-        },
-        "usingComponents" : true,
-        "plugins" : {},
-        "permission" : {}
-    },
-    "mp-alipay" : {
-        "usingComponents" : true
-    },
-    "mp-baidu" : {
-        "usingComponents" : true
-    },
-    "mp-toutiao" : {
-        "usingComponents" : true
-    },
-    "uniStatistics" : {
-        "enable" : false
-    }
+	"name": "智慧校园水电",
+	"appid": "__UNI__D7AE6E0",
+	"description": "",
+	"versionName": "1.0.0",
+	"versionCode": "100",
+	"transformPx": false,
+	/* 5+App特有相关 */
+	"app-plus": {
+		"usingComponents": true,
+		"nvueStyleCompiler": "uni-app",
+		"compilerVersion": 3,
+		"splashscreen": {
+			"alwaysShowBeforeRender": true,
+			"waiting": true,
+			"autoclose": true,
+			"delay": 0
+		},
+		/* 模块配置 */
+		"modules": {},
+		/* 应用发布信息 */
+		"distribute": {
+			/* android打包配置 */
+			"android": {
+				"permissions": [
+					"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
+					"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
+					"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
+					"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
+					"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+					"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
+					"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
+					"<uses-permission android:name=\"android.permission.CAMERA\"/>",
+					"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
+					"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
+					"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+					"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
+					"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
+					"<uses-feature android:name=\"android.hardware.camera\"/>",
+					"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
+				]
+			},
+			/* ios打包配置 */
+			"ios": {},
+			/* SDK配置 */
+			"sdkConfigs": {
+				"payment": {}
+			}
+		}
+	},
+	/* 快应用特有相关 */
+	"quickapp": {},
+	/* 小程序特有相关 */
+	"mp-weixin": {
+		"appid": "wx2fc3f45732fae5d3",
+		"setting": {
+			"urlCheck": false
+		},
+		"usingComponents": true,
+		"plugins": {
+			"myPlugin": {
+				"provider": "wx1549b963bbae9931",
+				"version": "4.0.0"
+			}
+		},
+		"permission": {}
+	},
+	"mp-alipay": {
+		"usingComponents": true
+	},
+	"mp-baidu": {
+		"usingComponents": true
+	},
+	"mp-toutiao": {
+		"usingComponents": true
+	},
+	"uniStatistics": {
+		"enable": false
+	}
 }
 }

+ 4 - 1
pages.json

@@ -48,6 +48,9 @@
 		"navigationBarTextStyle": "black",
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "uni-app",
 		"navigationBarTitleText": "uni-app",
 		"navigationBarBackgroundColor": "#fff",
 		"navigationBarBackgroundColor": "#fff",
-		"backgroundColor": "#fff"
+		"backgroundColor": "#fff",
+		"usingComponents": {
+			"login": "plugin://myPlugin/login"
+		}
 	}
 	}
 }
 }

+ 178 - 160
pages/index/index.vue

@@ -4,7 +4,7 @@
 			<image src="../../static/images/banner2x.png" mode=""></image>
 			<image src="../../static/images/banner2x.png" mode=""></image>
 		</view>
 		</view>
 		<view class="nav">
 		<view class="nav">
-			<view class="menu">
+			<view class="menu" v-show="my_display">
 				<navigator :url="'/pages/reshui/reshui'" open-type="redirect" class="menu_item">
 				<navigator :url="'/pages/reshui/reshui'" open-type="redirect" class="menu_item">
 					<image src="../../static/images/shower2x.png" mode=""></image>
 					<image src="../../static/images/shower2x.png" mode=""></image>
 					<text>洗 浴</text>
 					<text>洗 浴</text>
@@ -14,24 +14,17 @@
 					<text>电费充值</text>
 					<text>电费充值</text>
 				</navigator>
 				</navigator>
 			</view>
 			</view>
-		</view>
-		<!--弹窗-->
-		<view class="banding-bg" v-if="showPop">
-			<view class="banding-model">
-				<view class="title-model">绑定</view>
-				<view class="lineGroup-model">
-					<text class="iconfont icon-shengchengmingpianicon label-icon-model"></text>
-					<input type='number' class="input-model" maxlength="14" placeholder="请输入学号" v-model="stu_number" />
-				</view>
-				<view class="lineGroup-model">
-					<text class="iconfont icon-cardid label-icon-model"></text>
-					<input type='text' class="input-model" maxlength="18" placeholder="请输入身份证号码" v-model="id_card" />
-				</view>
-				<view class="btn-model">
-					<button class="btn" @tap="confirmPop">绑定</button>
-				</view>
+			<view class="reset">
+				<navigator url="" open-type="redirect" @click="reauthorization()" class="menu_item">
+					<text class="iconfont icon-zhongzhi"></text>
+					<text>重新授权</text>
+				</navigator>
 			</view>
 			</view>
 		</view>
 		</view>
+		<view v-if="showLogin">
+			<login :ocode="ocode" :appkey="appkey" scope="snsapi_userinfo" :visible="visible" @success="callback()"
+				@cancel="callback()" @fail="callback()" />
+		</view>
 	</view>
 	</view>
 </template>
 </template>
 
 
@@ -39,17 +32,26 @@
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
-				code: '',
-				showPop: false, //弹窗
-				stu_number: '',
-				id_card: '',
 				ceshi: 'code',
 				ceshi: 'code',
-				huanjing: '部署环境' // 部署环境是key,用来获取环境
+				huanjing: '部署环境' ,// 部署环境是key,用来获取环境
+				visible: false,
+				showLogin: true,
+				appkey: '5AA49F3E4CACA380',
+				sub_appid: '1015730314_1941301045',
+				appid: 'wx2fc3f45732fae5d3', // 获取用户信息
+				ocode: '1015730314', // 获取用户信息
+				app_secret: '58D34C81D82B35179ED896C4362B0FC0', // 获取用户信息
+				my_display: false,
+				userinfo: {},
+				wxcode: '',
+				access_token: ''
 			}
 			}
 		},
 		},
 		onLoad() {
 		onLoad() {
 			// 是否是测试环境,查询数据接口中参数的值决定,方便以后测试
 			// 是否是测试环境,查询数据接口中参数的值决定,方便以后测试
 			this.isTestEnvironment()
 			this.isTestEnvironment()
+			
+			this.has_user_info()
 		},
 		},
 		methods: {
 		methods: {
 			/**
 			/**
@@ -82,110 +84,180 @@
 						icon: 'success'
 						icon: 'success'
 					});
 					});
 				}
 				}
-
-				// 获取code
-				this.getCode()
 			},
 			},
 			/**
 			/**
-			 * 弹窗
+			 * 是否有用户信息
 			 */
 			 */
-			confirmPop() { // 确认
-				if (this.stu_number.length == 14 && this.id_card.length == 18) {
-					// 获得code
-					this.getCode('confirm')
-				} else {
+			has_user_info() {
+				try {
+					this.userinfo = this.$store.state.userinfo
+					const value = uni.getStorageSync('userinfo_storage_key');
+					if (value == '') {
+						if (typeof(this.userinfo) == 'undefined' || JSON.stringify(this.userinfo) == '{}') {
+							this.showLogin = true
+							this.visible = true
+						} else {
+							this.showLogin = false
+							this.my_display = true
+						}
+					} else {
+						this.showLogin = false
+						this.userinfo = value
+						this.my_display = true
+					}
+				} catch (e) {
+					// console.log(e)
 					uni.showToast({
 					uni.showToast({
-						title: '学号长度错误 或 身份证号 长度错误!',
-						icon: 'none'
-					});
+						title: '异常:' + e,
+						duration: 3000
+					})
 				}
 				}
 			},
 			},
 			/**
 			/**
-			 * param获得code
+			 * 重新授权
 			 */
 			 */
-			getCode(param) {
-				uni.login({
-					success: (res) => {
-						// console.log('index', res);
-						if (res.code) {
-							if (param == 'confirm')
-								// 请求服务器,获得openid
-								this.getOpenId(res.code)
-							else
-								this.selectUser(res.code)
-						} else {
-							uni.showToast({
-								title: res.errMsg,
-								icon: 'none'
-							});
-							
-							this.showPop = true
-						}
-					}
-				})
+			reauthorization() {
+				try {
+					uni.removeStorageSync('userinfo_storage_key');
+					setTimeout(() => {
+						this.showLogin = false
+						this.userinfo = {}
+						this.my_display = false
+					}, 30)
+			
+					setTimeout(() => {
+						this.showLogin = true
+						this.visible = true
+					}, 30)
+				} catch (e) {
+					console.log(e)
+				}
 			},
 			},
+			
 			/**
 			/**
-			 * 请求服务器,获得openid
+			 * 授权回调
 			 */
 			 */
-			async getOpenId(code) {
-				if (this.stu_number == '' || this.id_card == '') {
+			callback: function({
+				detail
+			}) {
+				// console.log(detail)
+				// {wxcode: "7f7Qi9rN8zQ1nifQiysTZ3WIeIWlgcGk"}
+				if (detail === undefined) {
+					this.userinfo = {};
 					uni.showToast({
 					uni.showToast({
-						title: '学号或身份证号为空'
+						icon: 'success',
+						title: '需要先授权'
 					});
 					});
-					return
+				} else {
+					const {
+						wxcode = ""
+					} = detail
+					
+					if (wxcode.length == 0) {
+						uni.showToast({
+							title: '未获得wxcode',
+							duration: 500
+						})
+					} else {
+						// 获取wxcode
+						this.wxcode = wxcode
+			
+						// 通过wxcode换取access_token
+						this.get_access_token()
+					}
 				}
 				}
+			},
+			/**
+			 * 通过wxcode换取access_token
+			 */
+			async get_access_token() {
 				const res = await this.$myRequest({
 				const res = await this.$myRequest({
-					host: this.ceshi,
-					url: '/HotWaters/wpopenid.action',
+					host: 'wecard',
+					url: '/connect/oauth2/token',
 					method: 'POST',
 					method: 'POST',
 					header: {
 					header: {
-						'content-type': 'application/x-www-form-urlencoded'
+						'content-type': 'application/json'
 					},
 					},
 					data: {
 					data: {
-						code: code,
-						stu_number: this.stu_number,
-						id_card: this.id_card
+						'wxcode': this.wxcode,
+						'app_key': this.appkey,
+						'app_secret': this.app_secret,
+						'grant_type': 'authorization_code',
+						'redirect_uri': 'mnp://wx2fc3f45732fae5d3'
 					}
 					}
 				})
 				})
-
-				// console.log(res.data.mess);
-				if (res.data.mess == '绑定成功') {
+			
+				if (res.data.refresh_token == '' || typeof(res.data.refresh_token) == 'undefined') {
 					uni.showToast({
 					uni.showToast({
-						title: '用户绑定成功!',
-						icon: 'success'
+						title: '未获得token'
 					});
 					});
-					
-					this.showPop = false
+				} else {
+					this.access_token = res.data.access_token;
+			
+					// 通过access_token换取用户信息
+					this.get_user_info();
+				}
+			},
+			/**
+			 * 通过access_token换取用户信息
+			 */
+			async get_user_info() {
+				const res = await this.$myRequest({
+					host: 'wecard',
+					url: '/connect/oauth/get-user-info',
+					method: 'POST',
+					header: {
+						'content-type': 'application/json'
+					},
+					data: {
+						"access_token": this.access_token
+					}
+				});
+			
+				if (res.data.errcode == 0 && res.data.errmsg == 'OK') {
+					try {
+						this.userinfo = res.data
+						this.$store.state.userinfo = this.userinfo
+						// 存储用户信息
+						uni.setStorageSync('userinfo_storage_key', this.userinfo)
+						// 提示授权成功
+						uni.showToast({
+							icon: 'success',
+							title: '授权成功',
+							duration: 800,
+							success: (res) => {
+								this.my_display = true
+							}
+						})
+					} catch (e) {
+						console.log(e)
+					}
 				} else {
 				} else {
 					uni.showToast({
 					uni.showToast({
-						title: res.data.mess,
-						icon: 'success'
+						title: '未获得用户信息,请领取校园卡并激活',
+						duration: 3000
 					});
 					});
-					
-					this.showPop = true
 				}
 				}
 			},
 			},
 			/**
 			/**
-			 * 查询用户
+			 * 检查数据库中是否有该用户信息
 			 */
 			 */
-			async selectUser(code) {
+			async chk_user_is_in_db() {
 				const res = await this.$myRequest({
 				const res = await this.$myRequest({
 					host: this.ceshi,
 					host: this.ceshi,
-					url: '/HotWaters/wpget_stu.action',
+					url: '/',
 					method: 'POST',
 					method: 'POST',
 					header: {
 					header: {
-						'content-type': 'application/x-www-form-urlencoded'
+						'content-type': 'application/json'
 					},
 					},
 					data: {
 					data: {
-						code: code
+						"access_token": this.access_token
 					}
 					}
-				})
-
-				// console.log(res);
-				if (res.data.mess == '未查询到用户信息') {
-					this.showPop = true
-				} else {
-					this.showPop = false
+				});
+				
+				if (res) {
+					console.log(res);
+					
 				}
 				}
 			}
 			}
 		}
 		}
@@ -243,81 +315,27 @@
 					color: #333333;
 					color: #333333;
 				}
 				}
 			}
 			}
-		}
-
-		.banding-bg {
-			display: flex;
-			justify-content: center;
-			align-items: center;
-			position: fixed;
-			width: 750rpx;
-			height: 1500rpx;
-			background: rgba(0, 0, 0, 0.5);
-
-			.banding-model {
+			
+			.reset {
+				position: fixed;
 				display: flex;
 				display: flex;
 				flex-direction: column;
 				flex-direction: column;
-				justify-content: flex-start;
-				background-color: #FFFFFF;
-				position: fixed;
-				left: 25rpx;
-				top: 300rpx;
-				width: 650rpx;
-				border-radius: 15rpx;
-				padding: 30rpx;
-
-				.title-model {
-					font-size: 46rpx;
-					font-weight: bold;
-					padding: 20rpx 0 20rpx 30rpx;
-				}
-
-				.lineGroup-model {
-					display: flex;
-					flex-direction: row;
-					box-shadow: none;
-					border-bottom: 1px solid #c2c2c2;
-					font-size: 38rpx;
-					white-space: nowrap;
-
-					.label-icon-model {
-						display: flex;
-						flex-direction: row;
-						align-items: center;
-						font-size: 58rpx;
-						width: 88rpx;
-						height: 108rpx;
-						line-height: 108rpx;
-						color: $my-color-primary;
-						margin: 22rpx 0 0 50rpx;
-					}
-
-					.input-model {
-						margin-top: 20rpx;
-						color: #00c200;
-						height: 108rpx;
-						line-height: 108rpx;
-					}
-				}
-
-				.btn-model {
-					display: flex;
-					justify-content: center;
-					align-items: center;
-					padding: 50rpx;
-
-					.btn {
-						width: 280rpx;
-						height: 110rpx;
-						line-height: 110rpx;
-						background-color: $my-color-primary;
-						border-radius: 15rpx;
-						font-size: 38rpx;
-						text-align: center;
-						color: #FFFFFF;
-					}
+				align-items: flex-end;
+				right: 55rpx;
+				bottom: 55rpx;
+				font-family: Microsoft YaHei-3970(82674968);
+				color: #333333;
+			
+				.icon-zhongzhi {
+					margin: 0 auto;
+					padding-top: 20rpx;
+					color: $my-color-primary;
+					width: 90rpx;
+					height: 70rpx;
+					font-size: 80rpx;
 				}
 				}
 			}
 			}
 		}
 		}
+
 	}
 	}
 </style>
 </style>

+ 36 - 26
pages/jiaofei/jiaofei.css

@@ -12,20 +12,20 @@ page {
 .select-item {
 .select-item {
 	margin: 19upx 0 10upx 0;
 	margin: 19upx 0 10upx 0;
 	display: flex;
 	display: flex;
-	flex-direction:row;
+	flex-direction: row;
 	background-color: #ffffff;
 	background-color: #ffffff;
 	height: 139upx;
 	height: 139upx;
 }
 }
 
 
-.show-item{
+.show-item {
 	margin: 20upx 0;
 	margin: 20upx 0;
 	display: flex;
 	display: flex;
-	flex-direction:row;
+	flex-direction: row;
 	background-color: #ffffff;
 	background-color: #ffffff;
 	height: 139upx;
 	height: 139upx;
 }
 }
 
 
-.picker-item-logol{
+.picker-item-logol {
 	width: 88upx;
 	width: 88upx;
 	display: flex;
 	display: flex;
 	justify-content: flex-end;
 	justify-content: flex-end;
@@ -36,7 +36,8 @@ page {
 	height: 58upx;
 	height: 58upx;
 	margin: 41upx 0upx 40upx 0upx;
 	margin: 41upx 0upx 40upx 0upx;
 }
 }
-.picker-item-label{
+
+.picker-item-label {
 	font-size: 30upx;
 	font-size: 30upx;
 	width: 161upx;
 	width: 161upx;
 	height: 30upx;
 	height: 30upx;
@@ -45,18 +46,19 @@ page {
 	display: flex;
 	display: flex;
 	justify-content: center;
 	justify-content: center;
 }
 }
+
 .picker-item-content {
 .picker-item-content {
 	width: 360upx;
 	width: 360upx;
 	height: 30upx;
 	height: 30upx;
 	line-height: 30upx;
 	line-height: 30upx;
 	font-size: 36upx;
 	font-size: 36upx;
-	margin: 46upx 0upx 46upx 60upx;
+	margin: 52upx 0upx 46upx 60upx;
 	display: flex;
 	display: flex;
 	justify-content: flex-start;
 	justify-content: flex-start;
 	color: #999999;
 	color: #999999;
 }
 }
 
 
-.picker-item-logor{
+.picker-item-logor {
 	width: 91upx;
 	width: 91upx;
 	/* justify-content: flex-end; */
 	/* justify-content: flex-end; */
 	display: flex;
 	display: flex;
@@ -64,54 +66,53 @@ page {
 	margin: 57upx 0upx 51upx 0upx;
 	margin: 57upx 0upx 51upx 0upx;
 }
 }
 
 
-.picker-item-logo-right{
+.picker-item-logo-right {
 	width: 20upx;
 	width: 20upx;
 	height: 31upx;
 	height: 31upx;
 	/* display: flex; */
 	/* display: flex; */
 	/* justify-content: flex-end; */
 	/* justify-content: flex-end; */
 }
 }
 
 
-.font-txt{
+.font-txt {
 	color: #333333;
 	color: #333333;
 }
 }
 
 
-.add-money-show{
+.add-money-show {
 	/* margin: 20upx 0; */
 	/* margin: 20upx 0; */
 	display: flex;
 	display: flex;
-	flex-direction:row;
+	flex-direction: row;
 	background-color: #ffffff;
 	background-color: #ffffff;
 	height: 120upx;
 	height: 120upx;
 	justify-content: flex-start;
 	justify-content: flex-start;
 	/* padding-top: 31upx; */
 	/* padding-top: 31upx; */
 	/* align-content: flex-start; */
 	/* align-content: flex-start; */
-	
 }
 }
 
 
-.add-money{
+.add-money {
 	height: 365upx;
 	height: 365upx;
 	display: flex;
 	display: flex;
 	flex-direction: column;
 	flex-direction: column;
 }
 }
 
 
-.money-show{
+.money-show {
 	width: 300upx;
 	width: 300upx;
 	justify-content: flex-start;
 	justify-content: flex-start;
 	margin-left: 20upx;
 	margin-left: 20upx;
 	margin-top: 48upx;
 	margin-top: 48upx;
 }
 }
 
 
-.money-logo{
+.money-logo {
 	/* margin-top: 31upx; */
 	/* margin-top: 31upx; */
 }
 }
 
 
-.add-money-list{
+.add-money-list {
 	display: flex;
 	display: flex;
 	flex-direction: row;
 	flex-direction: row;
 	flex-wrap: wrap;
 	flex-wrap: wrap;
 	margin-left: 15upx;
 	margin-left: 15upx;
 }
 }
 
 
-.add-money-button{
+.add-money-button {
 	margin: 4upx 15upx 14.5upx 15upx;
 	margin: 4upx 15upx 14.5upx 15upx;
 	width: 210upx;
 	width: 210upx;
 	height: 90upx;
 	height: 90upx;
@@ -121,15 +122,15 @@ page {
 	/* background-color: #ffffff; */
 	/* background-color: #ffffff; */
 }
 }
 
 
-.select-submit{
-	border: solid #1296DB 1upx; 
+.select-submit {
+	border: solid #1296DB 1upx;
 	border-radius: 10upx;
 	border-radius: 10upx;
 	color: #1296DB;
 	color: #1296DB;
 	font-size: 32upx;
 	font-size: 32upx;
 	background-color: #ffffff;
 	background-color: #ffffff;
 }
 }
 
 
-.input-money{
+.input-money {
 	height: 139upx;
 	height: 139upx;
 	font-size: 38upx;
 	font-size: 38upx;
 	font-weight: bold;
 	font-weight: bold;
@@ -141,14 +142,14 @@ page {
 	color: #b2b2b2;
 	color: #b2b2b2;
 }
 }
 
 
-.submit-item{
+.submit-item {
 	margin: 54upx 30upx 0upx 30upx;
 	margin: 54upx 30upx 0upx 30upx;
 	width: 690upx;
 	width: 690upx;
 	height: 96upx;
 	height: 96upx;
-	
+
 }
 }
 
 
-.submit{
+.submit {
 	font-size: 38upx;
 	font-size: 38upx;
 	color: #ffffff;
 	color: #ffffff;
 	border: solid #1296DB 1upx;
 	border: solid #1296DB 1upx;
@@ -157,14 +158,23 @@ page {
 	white-space: nowrap;
 	white-space: nowrap;
 }
 }
 
 
-.change-show{
+.change-show {
 	width: 120upx;
 	width: 120upx;
 	font-size: 30upx;
 	font-size: 30upx;
 	margin: 47upx 316upx;
 	margin: 47upx 316upx;
 	color: #1296DB;
 	color: #1296DB;
 }
 }
 
 
-.bg-color{
+.bg-color {
 	background-color: #1296DB;
 	background-color: #1296DB;
 	color: #ffffff;
 	color: #ffffff;
-}
+}
+
+.selStyle {
+	/* border: 0rpx; */
+	width: 206upx;
+	height: 82upx;
+	background: url(../../static/images/gou.png) 0upx 0upx no-repeat;
+	background-size: 20%;
+	background-position: right bottom;
+}

+ 38 - 32
pages/jiaofei/jiaofei.vue

@@ -27,27 +27,33 @@
 			<view class="add-money-list">
 			<view class="add-money-list">
 				<view class="add-money-button">
 				<view class="add-money-button">
 					<button class="select-submit" :data-item="10" @tap="add_money"
 					<button class="select-submit" :data-item="10" @tap="add_money"
-						:class="{'bg-color':add_class1==1}">10元</button>
+						:class="{selStyle:amount == 10}">10元</button>
 				</view>
 				</view>
 				<view class="add-money-button">
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="20" @tap="add_money">20元</button>
+					<button class="select-submit" :data-item="20" @tap="add_money"
+						:class="{selStyle:amount == 20}">20元</button>
 				</view>
 				</view>
 				<view class="add-money-button">
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="30" @tap="add_money">30元</button>
+					<button class="select-submit" :data-item="30" @tap="add_money"
+						:class="{selStyle:amount == 30}">30元</button>
 				</view>
 				</view>
 				<view class="add-money-button">
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="50" @tap="add_money">50元</button>
+					<button class="select-submit" :data-item="50" @tap="add_money"
+						:class="{selStyle:amount == 50}">50元</button>
 				</view>
 				</view>
 				<view class="add-money-button">
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="100" @tap="add_money">100元</button>
+					<button class="select-submit" :data-item="100" @tap="add_money"
+						:class="{selStyle:amount == 100}">100元</button>
 				</view>
 				</view>
 				<view class="add-money-button">
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="200" @tap="add_money">200元</button>
+					<button class="select-submit" :data-item="200" @tap="add_money"
+						:class="{selStyle:amount == 200}">200元</button>
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
 		<view class="show-item">
 		<view class="show-item">
-			<input type="number" class="input-money" maxlength="4" placeholder="请输入金额(1-200)" placeholder-class="input-ph-color" v-model:value="inputMoney" @input="onInput" @blur="onBlur" />
+			<input type="number" class="input-money" maxlength="4" placeholder="请输入金额(1-200)"
+				placeholder-class="input-ph-color" v-model:value="amount" @input="onInput" @blur="onBlur" />
 		</view>
 		</view>
 		<view class="submit-item">
 		<view class="submit-item">
 			<button class="submit" :data-rooms='room' @tap="input_money">充值</button>
 			<button class="submit" :data-rooms='room' @tap="input_money">充值</button>
@@ -62,13 +68,12 @@
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
-				index: 0,
+				// index: 0,
 				roomSelect: '', //校区宿舍号
 				roomSelect: '', //校区宿舍号
 				remainElec: 0.00.toFixed(2), //剩余电量
 				remainElec: 0.00.toFixed(2), //剩余电量
 				add_class: '', //增加class属性
 				add_class: '', //增加class属性
-				add_class1: '',
-				inputMoney: '', //手动输入增加金额
-				addMoney: 0, //选择充值金额
+				// add_class1: '',
+				amount: '',
 				sub_appid: '', //商户号
 				sub_appid: '', //商户号
 				code: '',
 				code: '',
 				IP: '',
 				IP: '',
@@ -240,16 +245,14 @@
 				});
 				});
 			},
 			},
 
 
-			//增加固定金额
+			/**
+			 * 增加固定金额
+			 */
 			add_money(e) {
 			add_money(e) {
-				this.add_class1 = 0
-				this.addMoney = e.currentTarget.dataset.item
-
-				this.confirm_room('add_money')
+				this.amount = e.currentTarget.dataset.item
 			},
 			},
 			/**
 			/**
 			 * 确认宿舍号
 			 * 确认宿舍号
-			 * @param {Object} op
 			 */
 			 */
 			confirm_room(op) {
 			confirm_room(op) {
 				// 检查房间号
 				// 检查房间号
@@ -263,7 +266,7 @@
 				// 输入金额进行充值
 				// 输入金额进行充值
 				if (op == 'input_money') {
 				if (op == 'input_money') {
 					//判断输入是否为空或不是数字
 					//判断输入是否为空或不是数字
-					if (this.inputMoney == '' || this.inputMoney == null) {
+					if (this.amount == '' || this.amount == null || this.amount == 0) {
 						uni.showToast({
 						uni.showToast({
 							title: '请输入充值金额',
 							title: '请输入充值金额',
 							duration: 2000
 							duration: 2000
@@ -271,7 +274,7 @@
 						return
 						return
 					}
 					}
 
 
-					if (isNaN(this.inputMoney)) {
+					if (isNaN(this.amount)) {
 						uni.showToast({
 						uni.showToast({
 							title: '请输入正确金额',
 							title: '请输入正确金额',
 							duration: 2000
 							duration: 2000
@@ -280,7 +283,7 @@
 					}
 					}
 
 
 					if (!this.test) { // 非测试环境
 					if (!this.test) { // 非测试环境
-						if (this.inputMoney > 200 || this.inputMoney < 10) {
+						if (this.amount > 200 || this.amount < 10) {
 							uni.showToast({
 							uni.showToast({
 								title: '限额10~200元',
 								title: '限额10~200元',
 								duration: 2000
 								duration: 2000
@@ -288,18 +291,17 @@
 							return
 							return
 						}
 						}
 					}
 					}
-
-					this.addMoney = this.inputMoney
 				}
 				}
 				// 确认充值对话框
 				// 确认充值对话框
 				this.confirm_dialog()
 				this.confirm_dialog()
 			},
 			},
-
-			// 确认充值对话框
+			/**
+			 * 确认充值对话框
+			 */
 			confirm_dialog() {
 			confirm_dialog() {
 				uni.showModal({
 				uni.showModal({
-					// title: '确定充值'+this.inputMoney+'元',
-					title: '确定充值' + this.addMoney + '元',
+					// title: '确定充值'+this.amount+'元',
+					title: '确定充值' + this.amount + '元',
 					success: (res) => {
 					success: (res) => {
 						if (res.confirm) {
 						if (res.confirm) {
 							// 获取code
 							// 获取code
@@ -319,7 +321,7 @@
 			 * 请求服务器,获取支付参数,并支付
 			 * 请求服务器,获取支付参数,并支付
 			 */
 			 */
 			async jsapi() {
 			async jsapi() {
-				if (this.code == '' || this.addMoney == '' || this.IP == '') {
+				if (this.code == '' || this.amount == '' || this.IP == '') {
 					uni.showToast({
 					uni.showToast({
 						title: 'code、充值金额或IP为空'
 						title: 'code、充值金额或IP为空'
 					});
 					});
@@ -334,7 +336,7 @@
 					},
 					},
 					data: {
 					data: {
 						code: this.code,
 						code: this.code,
-						num: this.addMoney,
+						num: this.amount,
 						ip: this.IP
 						ip: this.IP
 					}
 					}
 				})
 				})
@@ -389,7 +391,7 @@
 				}
 				}
 
 
 				const v = e.detail.value
 				const v = e.detail.value
-				this.inputMoney = 10
+				this.amount = 10
 
 
 				const zero = /^(0{1,})|[^0-9]/g
 				const zero = /^(0{1,})|[^0-9]/g
 				let final = 0
 				let final = 0
@@ -409,7 +411,11 @@
 					}
 					}
 				}
 				}
 				this.$nextTick(() => {
 				this.$nextTick(() => {
-					this.inputMoney = final.toString() || '0'
+					if (final.toString() == '0') {
+						this.amount = ''
+					} else {
+						this.amount = final.toString() || '0'
+					}
 				})
 				})
 			},
 			},
 			/**
 			/**
@@ -420,8 +426,8 @@
 					return
 					return
 				}
 				}
 
 
-				if (this.inputMoney < 10) {
-					this.inputMoney = 10
+				if (this.amount < 10) {
+					this.amount = 10
 				}
 				}
 			}
 			}
 		},
 		},

+ 8 - 2
pages/recharge/recharge.vue

@@ -9,7 +9,7 @@
 			<view class="amount_inp">
 			<view class="amount_inp">
 				<text></text>
 				<text></text>
 				<input type="number" maxlength="4" v-model="amount" @input="onInput" @blur="onBlur"
 				<input type="number" maxlength="4" v-model="amount" @input="onInput" @blur="onBlur"
-					placeholder="请输入大于10,小于100元" placeholder-class="ph_class" />
+					placeholder="请输入大于10小于100元" placeholder-class="ph_class" />
 			</view>
 			</view>
 			<text>最多可输入金额100元</text>
 			<text>最多可输入金额100元</text>
 		</view>
 		</view>
@@ -46,6 +46,8 @@
 		onLoad() {
 		onLoad() {
 			if (this.test) {
 			if (this.test) {
 				this.amount = 0.01
 				this.amount = 0.01
+			} else {
+				this.amount = ''
 			}
 			}
 		},
 		},
 		methods: {
 		methods: {
@@ -180,7 +182,11 @@
 					}
 					}
 				}
 				}
 				this.$nextTick(() => {
 				this.$nextTick(() => {
-					this.amount = final.toString() || '0'
+					if (final.toString() == '0') {
+						this.amount = ''
+					} else {
+						this.amount = final.toString() || '0'
+					}
 				})
 				})
 			},
 			},
 			/**
 			/**

+ 41 - 15
pages/reshui/reshui.vue

@@ -9,7 +9,6 @@
 				<view class="qinshihao">
 				<view class="qinshihao">
 					<text class="iconfont icon-zhuye"></text>
 					<text class="iconfont icon-zhuye"></text>
 					<text class="dormtxt">{{dorm_number || '宿舍未知'}}</text>
 					<text class="dormtxt">{{dorm_number || '宿舍未知'}}</text>
-					<text class="compustxt">{{compus}}</text>
 				</view>
 				</view>
 			</view>
 			</view>
 			<view class="start_text">
 			<view class="start_text">
@@ -60,7 +59,7 @@
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
-		<instructions v-if="flag" @parent_cancel="cancel"></instructions>
+		<instructions v-if="flag" @parent_cancel="cancel" @parent_noshow='noshow'></instructions>
 	</view>
 	</view>
 </template>
 </template>
 
 
@@ -113,12 +112,21 @@
 				use_amount: 0.0.toFixed(2), // 结算金额
 				use_amount: 0.0.toFixed(2), // 结算金额
 				amount: 0.0.toFixed(2), // 余额
 				amount: 0.0.toFixed(2), // 余额
 				dorm_number: '', // 宿舍号
 				dorm_number: '', // 宿舍号
-				compus: '', // 校区
+				// compus: '', // 校区
 				code: '',
 				code: '',
-				ceshi: 'code'
+				ceshi: 'code',
+				changeDate: false
 			}
 			}
 		},
 		},
 		onLoad() {
 		onLoad() {
+			try {
+				const value = uni.getStorageSync('instruction_noshow');
+				if (value) {
+					this.flag = false
+				}
+			} catch (e) {
+				console.log(e);
+			}
 			// 获得code
 			// 获得code
 			this.getCode()
 			this.getCode()
 		},
 		},
@@ -191,10 +199,10 @@
 						this.$store.state.reshui_amount = res.data.info[0].balance
 						this.$store.state.reshui_amount = res.data.info[0].balance
 					// 剩余金额
 					// 剩余金额
 					this.amount = this.$store.state.reshui_amount
 					this.amount = this.$store.state.reshui_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
 
 
 					// 请求选定的月份消费记录
 					// 请求选定的月份消费记录
 					this.request_consumption_records()
 					this.request_consumption_records()
@@ -210,18 +218,31 @@
 			 */
 			 */
 			bindDateChange(e) {
 			bindDateChange(e) {
 				this.date = e.detail.value
 				this.date = e.detail.value
-
+				this.changeDate = true
 				// 请求选定的月份消费记录
 				// 请求选定的月份消费记录
 				this.request_consumption_records()
 				this.request_consumption_records()
 			},
 			},
 
 
 			/**
 			/**
-			 * 导航页面取消
+			 * 使用说明组件取消
 			 */
 			 */
 			cancel(param) {
 			cancel(param) {
 				this.flag = param
 				this.flag = param
 			},
 			},
-
+			/**
+			 * 使用说明组件不再出现
+			 */
+			noshow(param) {
+				try {
+					if (param) {
+						uni.setStorageSync("instruction_noshow", true)
+					} else {
+						uni.removeStorageSync("instruction_noshow")
+					}
+				} catch (e) {
+					console.log(e);
+				}
+			},
 			/**
 			/**
 			 * 请求选定的月份消费记录
 			 * 请求选定的月份消费记录
 			 */
 			 */
@@ -241,7 +262,7 @@
 						}
 						}
 					});
 					});
 
 
-					// console.log(res, 'request_consumption_records');
+					// console.log(res);
 					if (res.data.mess == '返回成功') {
 					if (res.data.mess == '返回成功') {
 						// 消费记录
 						// 消费记录
 						let items = res.data.data
 						let items = res.data.data
@@ -249,10 +270,15 @@
 							this.xiaofei_items.push(items[i])
 							this.xiaofei_items.push(items[i])
 						}
 						}
 					} else {
 					} else {
-						uni.showToast({
-							icon: 'success',
-							title: res.data.mess
-						})
+						if (this.changeDate) {
+							uni.showToast({
+								icon: 'success',
+								title: res.data.mess,
+								success: () => {
+									this.changeDate = false
+								}
+							})
+						}
 					}
 					}
 				} else {
 				} else {
 					uni.showToast({
 					uni.showToast({
@@ -1121,7 +1147,7 @@
 					align-items: center;
 					align-items: center;
 					position: fixed;
 					position: fixed;
 					top: 20rpx;
 					top: 20rpx;
-					right: 10rpx;
+					right: 30rpx;
 					font-size: 28rpx;
 					font-size: 28rpx;
 
 
 					.icon-zhuye {
 					.icon-zhuye {

+ 5 - 2
static/api.js

@@ -1,4 +1,5 @@
 const WEXIN_BASE_URL = 'https://api.mch.weixin.qq.com' // wexin
 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://jtishfw.ncjti.edu.cn/jxch-smartmp' // code
 const CODE_BASE_URL = 'https://jtishfw.ncjti.edu.cn/jxch-smartmp' // code
 const IP_BASE_URL = 'https://pv.sohu.com/cityjson' // ip
 const IP_BASE_URL = 'https://pv.sohu.com/cityjson' // ip
 
 
@@ -12,8 +13,10 @@ const myRequest = (options) => {
 		let BASE_URL = '';
 		let BASE_URL = '';
 
 
 		if (options.host == 'wexin') {
 		if (options.host == 'wexin') {
-			BASE_URL = WEXIN_BASE_URL;} 
-		else if (options.host == 'code') {
+			BASE_URL = WEXIN_BASE_URL;
+		} else if (options.host == 'wecard') {
+			BASE_URL = WECARD_BASE_URL;
+		} else if (options.host == 'code') {
 			BASE_URL = CODE_BASE_URL;
 			BASE_URL = CODE_BASE_URL;
 		} else if (options.host == 'ip') {
 		} else if (options.host == 'ip') {
 			BASE_URL = IP_BASE_URL;
 			BASE_URL = IP_BASE_URL;

+ 1 - 1
store/index.js

@@ -5,6 +5,7 @@ Vue.use(Vuex)
 const store = new Vuex.Store({
 const store = new Vuex.Store({
 	state: {
 	state: {
 		test: true,  // 控制是否是测试环境
 		test: true,  // 控制是否是测试环境
+		userInfo: {},
 		payInfo: {
 		payInfo: {
 			from: '',
 			from: '',
 			resultMsg: ''
 			resultMsg: ''
@@ -14,7 +15,6 @@ const store = new Vuex.Store({
 			add_class: 0,
 			add_class: 0,
 			dorm_number: ''
 			dorm_number: ''
 		},
 		},
-		stu_number: '',
 		reshui_amount: 0.00.toFixed(2)
 		reshui_amount: 0.00.toFixed(2)
 	},
 	},
 	mutations: {},
 	mutations: {},