出入码小程序刷新请求完成;优化调试输出;添加出入码接口mock;配置业务域名SSL证书
This commit is contained in:
@@ -1,11 +1,30 @@
|
||||
.time-text {
|
||||
#codeView {
|
||||
text-align: center;
|
||||
margin-top: 100px;
|
||||
}
|
||||
|
||||
#user-text {
|
||||
font-size: 35px;
|
||||
}
|
||||
|
||||
#time-text {
|
||||
font-weight: bold;
|
||||
font-size: 40px;
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
#myQrcode {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
|
||||
margin-top: 50px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
#show-text {
|
||||
font-weight: bold;
|
||||
font-size: 45px;
|
||||
}
|
||||
|
||||
#small-text {
|
||||
margin-top: 80px;
|
||||
color: grey;
|
||||
font-size: small;
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
<template>
|
||||
<view>
|
||||
<view style="text-align: center; margin-top: 100px;">
|
||||
<view><text>{{ id }} | {{ name }}</text></view>
|
||||
<canvas type="2d" style="width: 70vw; height: 70vw;" id="myQrcode"></canvas>
|
||||
<view><text class="time-text">{{ time }}</text></view>
|
||||
</view>
|
||||
<view id="codeView" :style="{ display: isShow }">
|
||||
<view id="user-text"><text>{{ userText }}</text></view>
|
||||
<view id="time-text"><text>{{ time }}</text></view>
|
||||
<canvas type="2d" style="width: 70vw; height: 70vw;" id="myQrcode"></canvas>
|
||||
<view id="show-text"><text :style="{ color: showTextColor }">{{ showText }}</text></view>
|
||||
<view id="small-text"><text>下拉可刷新</text></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -21,13 +21,14 @@ export default {
|
||||
...Taro.getApp().globalData,
|
||||
userInfo: null,
|
||||
timeInterval: null,
|
||||
id: '',
|
||||
name: '',
|
||||
isShow: 'none',
|
||||
userText: '',
|
||||
showText: '',
|
||||
showTextColor: '',
|
||||
time: '',
|
||||
}
|
||||
},
|
||||
|
||||
// 对应 onShow
|
||||
onShow() {
|
||||
console.log('onShow')
|
||||
setTimeout(() => {
|
||||
@@ -35,31 +36,65 @@ export default {
|
||||
}, 100)
|
||||
},
|
||||
|
||||
// 对应 onHide
|
||||
onHide() {
|
||||
console.log('onHide')
|
||||
clearInterval(this.timeInterval);
|
||||
this.isShow = 'none'
|
||||
},
|
||||
|
||||
// 对应 onPullDownRefresh
|
||||
onPullDownRefresh() {
|
||||
console.log('onPullDownRefresh')
|
||||
Taro.showNavigationBarLoading();
|
||||
clearInterval(this.timeInterval);
|
||||
this.id = ''
|
||||
this.name = ''
|
||||
this.time = ''
|
||||
this.isShow = 'none'
|
||||
this.userInfo = Taro.getStorageSync("userInfo");
|
||||
if (!this.userInfo) {
|
||||
Taro.redirectTo({
|
||||
url: '/pages/index/login'
|
||||
})
|
||||
}
|
||||
this.id = this.userInfo.id
|
||||
this.name = this.userInfo.realname
|
||||
this.drawCode()
|
||||
Taro.stopPullDownRefresh();
|
||||
Taro.hideNavigationBarLoading();
|
||||
Taro.showLoading({ title: '加载中' })
|
||||
var that = this;
|
||||
Taro.request({
|
||||
url: `${this.baseUrl}/access/getCodeInfo`,
|
||||
method: "POST",
|
||||
header: {
|
||||
"Content-Type": "application/x-www-form-urlencoded" //用于post
|
||||
},
|
||||
data: {
|
||||
id: this.userInfo.id,
|
||||
},
|
||||
success: function (d) {
|
||||
Taro.hideLoading()
|
||||
let result = d.data;
|
||||
if (result.success) {
|
||||
console.log(result.data);
|
||||
that.userText = `${that.userInfo.id} | ${that.userInfo.realname}`
|
||||
that.showText = result.data.infoText
|
||||
that.showTextColor = result.data.infoTextColor
|
||||
that.drawCode(`https://epp.cxyxiaomo.com/access/validCode?id=${result.data.id}&t=${Date.now()}`, result.data.qrcodeColor)
|
||||
} else {
|
||||
Taro.showToast({
|
||||
title: result.msg,
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
that.isShow = ''
|
||||
},
|
||||
fail: function () {
|
||||
Taro.hideLoading()
|
||||
Taro.showToast({
|
||||
title: "请求失败",
|
||||
icon: 'error',
|
||||
duration: 2000
|
||||
})
|
||||
},
|
||||
complete: function () {
|
||||
Taro.stopPullDownRefresh();
|
||||
Taro.hideNavigationBarLoading();
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
drawCode(text = 'https://www.baidu.com/', foreground = 'red') {
|
||||
|
Reference in New Issue
Block a user