Commit 704327c6 by 李伟康

commit 提交

1 parent 567eb23c
...@@ -2,7 +2,7 @@ import { ...@@ -2,7 +2,7 @@ import {
preReleaseAppId preReleaseAppId
} from '~/config' } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease'] const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 1 let index = 3
/** /**
* *
......
...@@ -36,10 +36,18 @@ Page({ ...@@ -36,10 +36,18 @@ Page({
wx.p.wxApi.hideLoading() wx.p.wxApi.hideLoading()
if (code == 0) { if (code == 0) {
wx.p.storage.set('userInfo', data) wx.p.storage.set('userInfo', data)
this.setData({ if (data.beiSenToken) this.setData({
indexUrl: `${data.beiSenToken}&return_url=${returnUrl}` indexUrl: `${data.beiSenToken}&return_url=${returnUrl}`
}) })
} else throw message else wx.p.router.go('/pages/noAccess/noAccess', data)
} else {
setTimeout(() => {
wx.p.router.reLaunch('/pages/noAccess/noAccess', {
phone: userInfo.phone
})
}, 1e3)
throw message
}
} catch (error) { } catch (error) {
wx.p.wxApi.hideLoading() wx.p.wxApi.hideLoading()
if (error) wx.p.wxApi.showToast(String(error)) if (error) wx.p.wxApi.showToast(String(error))
......
// pages/login/login.js // pages/login/login.js
Page({
Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
...@@ -38,7 +38,7 @@ Page({ ...@@ -38,7 +38,7 @@ Page({
if (data.beiSenToken) wx.p.router.reLaunch('/packageIndex/pages/index/index', data) if (data.beiSenToken) wx.p.router.reLaunch('/packageIndex/pages/index/index', data)
else wx.p.router.go('/pages/noAccess/noAccess', data) else wx.p.router.go('/pages/noAccess/noAccess', data)
} else { } else {
this.onLoad() this.getWxCode(true)
throw message throw message
} }
} catch (error) { } catch (error) {
...@@ -73,7 +73,7 @@ Page({ ...@@ -73,7 +73,7 @@ Page({
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
async onShow() { onShow() {
let { let {
options options
} = this } = this
...@@ -81,14 +81,19 @@ Page({ ...@@ -81,14 +81,19 @@ Page({
this.wxCode = wxCode this.wxCode = wxCode
return return
} }
this.getWxCode()
},
async getWxCode(flag = false) {
let {timeOut} = this
if (!flag && timeOut && Date.now() - timeOut < 1 * 60e3) return
wx.p.wxApi.showLoading() wx.p.wxApi.showLoading()
const { const {
data data
} = await wx.p.api.userApi.wxCodeLogin() } = await wx.p.api.userApi.wxCodeLogin()
this.timeOut = Date.now()
if (data) this.wxCode = data if (data) this.wxCode = data
wx.hideLoading() wx.hideLoading()
}, },
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
...@@ -115,12 +120,5 @@ Page({ ...@@ -115,12 +120,5 @@ Page({
*/ */
onReachBottom() { onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -117,7 +117,7 @@ page { ...@@ -117,7 +117,7 @@ page {
line-height: 52rpx; line-height: 52rpx;
color: #222222; color: #222222;
text-align: center; text-align: center;
margin-bottom: 16rpx; margin-bottom: 36rpx;
} }
.modal-text { .modal-text {
......
...@@ -12,7 +12,8 @@ Page({ ...@@ -12,7 +12,8 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
if(options.phone) options.phone = options.phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') console.log(options)
if(options.phone) options.phone = String(options.phone).replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
this.setData({ this.setData({
options options
}) })
...@@ -60,12 +61,5 @@ Page({ ...@@ -60,12 +61,5 @@ Page({
*/ */
onReachBottom() { onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
} }
}) })
\ No newline at end of file \ No newline at end of file
...@@ -7,12 +7,12 @@ const noScroll = () => {} ...@@ -7,12 +7,12 @@ const noScroll = () => {}
/**设置粘贴板内容 */ /**设置粘贴板内容 */
const setCopyData = (data, callBack) => { const setCopyData = (data, callBack) => {
wx.setClipboardData({ // wx.setClipboardData({
data: data, // data: data,
success(res) { // success(res) {
if (callBack && typeof callBack === 'function') callBack(res) // if (callBack && typeof callBack === 'function') callBack(res)
} // }
}) // })
} }
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!