12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- // pages/logs_to/logs_to.js
- var app = getApp();
- Page({
- data: {
- from: '',
- preid: ''
- },
- onLoad: function (options) {
- },
- getPhoneNumber: function(e) {
- var that = this;
- if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
- console.log(e.detail.errMsg === 'getPhoneNumber:fail user deny');
- app.noticeModal('不绑定手机号的话就不能申请了哦');
- }else{
- let token = wx.getStorageSync('user').token;
- that.telHost(token, e.detail.iv, e.detail.encryptedData)
- }
- },
- goSignup () {
- var that = this;
- var id = that.data.preid;
- wx.redirectTo({
- url: '/pages/signup/signup?from='+that.data.from+'&preid='+ that.data.preid
- })
- },
- telHost (token, iv, encryptedData) {
- var that = this;
- wx.request({
- url: app.globalData.HOST + '/user/wx/getUserPhone',
- method: 'POST',
- data: {token: token, iv: iv, encryptedData: encryptedData},
- success: function (res) {
- var data = res.data
- // console.log(data);
- if (data.errno == '0'){
- var tel = data.rst.phone_number;
- wx.setStorage({key:"tel", data: tel})
- wx.switchTab({
- url: '/pages/index/index'
- })
- }else{
- // app.noticeModal(data.err);
- }
- }
- });
- },
- onReady: function () {
- },
- onShow: function () {
- },
- onHide: function () {
- },
- onUnload: function () {
- }
- })
|