// pages/login/login.js
import Cache from '../../utils/Cache'
Page({
/**
* 页面的初始数据
*/
data: {
},
getPhoneNumber (e) {
console.log(e.detail.errMsg)
console.log(e.detail.iv)
console.log(e.detail.encryptedData)
console.log(e.detail)
wx.request({
url: 'http://www.tp6.com/monthly/phone',
header:{token:Cache.get('token')},
data:{iv:e.detail.iv,encryptedData:e.detail.encryptedData},
method:"POST",
success:res=>{
console.log(res);
if(res.data.error_code ==0)
{
wx.showToast({
title: res.data.msg,
detail:3000
})
wx.reLaunch({
url: '/pages/list/list',
})
}
}
})
},
tel(){
wx.reLaunch({
url: '/pages/phone/phone',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(Cache.get('token'))
{
wx.reLaunch({
url: '/pages/list/list',
})
}
},
})
{
"usingComponents": {
"l-button":"/miniprogram_npm/lin-ui/button"
}
}
<!--pages/login/login.wxml-->
<view class="box">
<view class="box1">
<l-button type="success" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">微信授权</l-button>
</view>
<view class="box2">