|
|
@@ -4,7 +4,7 @@
|
|
|
<image src="../../static/images/banner2x.png" mode=""></image>
|
|
|
</view>
|
|
|
<view class="nav">
|
|
|
- <view class="menu" v-show="my_display">
|
|
|
+ <view class="menu">
|
|
|
<navigator :url="'/pages/reshui/reshui'" open-type="redirect" class="menu_item">
|
|
|
<image src="../../static/images/shower2x.png" mode=""></image>
|
|
|
<text>洗 浴</text>
|
|
|
@@ -14,12 +14,6 @@
|
|
|
<text>电费充值</text>
|
|
|
</navigator>
|
|
|
</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 class="qr_code" v-if="showQR_code">
|
|
|
<image src="https://jtishfw.ncjti.edu.cn/jxch-smartmp/HotWaters/image/1.jpg" mode="aspectFit"></image>
|
|
|
@@ -37,17 +31,17 @@
|
|
|
return {
|
|
|
ceshi: 'code',
|
|
|
huanjing: '部署环境', // 部署环境是key,用来获取环境
|
|
|
- visible: false,
|
|
|
- showLogin: true,
|
|
|
- appkey: '5AA49F3E4CACA380',
|
|
|
+ visible: false, // 是否授权可见
|
|
|
+ showLogin: true, // 是否启动授权
|
|
|
+ appkey: '5AA49F3E4CACA380', // 商户appkey
|
|
|
appid: 'wx2fc3f45732fae5d3', // 获取用户信息
|
|
|
ocode: '1015730314', // 获取用户信息
|
|
|
app_secret: '58D34C81D82B35179ED896C4362B0FC0', // 获取用户信息
|
|
|
- my_display: false,
|
|
|
- userinfo: '',
|
|
|
- // showQR_code: false,
|
|
|
- validation_failed: false,
|
|
|
- from: 0
|
|
|
+ userinfo: '', // 用户信息
|
|
|
+ showQR_code: false, // 显示校园卡二维码
|
|
|
+ validation_failed: false, // 验证失败
|
|
|
+ validation_times: 0, // 授权次数
|
|
|
+ from: 0, // 跳转参数
|
|
|
}
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
@@ -105,13 +99,11 @@
|
|
|
this.visible = true
|
|
|
} else {
|
|
|
this.showLogin = false
|
|
|
- this.my_display = true
|
|
|
}
|
|
|
} else {
|
|
|
this.showLogin = false
|
|
|
this.userinfo = value
|
|
|
this.$store.state.userInfo = this.userinfo
|
|
|
- this.my_display = true
|
|
|
}
|
|
|
} catch (e) {
|
|
|
// console.log(e)
|
|
|
@@ -122,48 +114,49 @@
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
- * 重新授权
|
|
|
+ * 授权登陆取消回调
|
|
|
*/
|
|
|
- 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)
|
|
|
- }
|
|
|
+ login_cancel_callback() {
|
|
|
+ this.reauthorization()
|
|
|
},
|
|
|
/**
|
|
|
- * 授权登陆q取消回调
|
|
|
+ * 重新授权
|
|
|
*/
|
|
|
- login_cancel_callback() {
|
|
|
- this.userinfo = {};
|
|
|
- uni.showToast({
|
|
|
- icon: 'none',
|
|
|
- title: '请先授权,点击右下角【重新授权】按钮'
|
|
|
- });
|
|
|
+ reauthorization() {
|
|
|
+ this.validation_times = this.validation_times + 1
|
|
|
+
|
|
|
+ if (this.validation_times >= 2) {
|
|
|
+ this.login_fail_callback()
|
|
|
+ } else {
|
|
|
+ try {
|
|
|
+ uni.removeStorageSync('userinfo_storage_key');
|
|
|
+ setTimeout(() => {
|
|
|
+ this.showLogin = false
|
|
|
+ this.userinfo = {}
|
|
|
+ }, 30)
|
|
|
+
|
|
|
+ setTimeout(() => {
|
|
|
+ this.showLogin = true
|
|
|
+ this.visible = true
|
|
|
+ }, 30)
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
- * 授权登陆q取消回调
|
|
|
+ * 授权登陆取消回调
|
|
|
*/
|
|
|
login_fail_callback() {
|
|
|
this.userinfo = {};
|
|
|
- setTimeout(() => {
|
|
|
- this.validation_failed = true
|
|
|
- }, 2000);
|
|
|
- if (this.validation_failed) {
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.validation_failed = true
|
|
|
+ // }, 3000);
|
|
|
+ if (!this.validation_failed) {
|
|
|
this.validation_failed = false
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
- content: '授权失败,请先领取校园卡激活!',
|
|
|
+ content: '授权还可以领取校园卡、激活!',
|
|
|
// cancelText: '取消',
|
|
|
confirmText: '领取',
|
|
|
success: (res1) => {
|
|
|
@@ -337,8 +330,6 @@
|
|
|
title: '授权成功',
|
|
|
duration: 800,
|
|
|
success: (res) => {
|
|
|
- this.my_display = true
|
|
|
-
|
|
|
if (this.from != 0 || this.from != '0') {
|
|
|
uni.navigateBack({
|
|
|
delta: 1
|
|
|
@@ -351,7 +342,6 @@
|
|
|
icon: 'success',
|
|
|
title: '授权失败:' + res.data.mess,
|
|
|
success: (res) => {
|
|
|
- this.my_display = false
|
|
|
}
|
|
|
})
|
|
|
}
|