12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- // pages/logs_to/logs_to.js
- var app = getApp();
- Page({
- data: {
- from: '',
- preid: ''
- },
- onLoad: function (options) {
- // console.log(options.from);
- var that = this;
- if (options.preid) {
- that.setData({from: options.from, preid: options.preid});
- }else{
- that.setData({from: options.from});
- }
- // console.log(that.data.from, options.preid);
- },
- 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})
- if (that.data.from === 'mine') {
- wx.redirectTo({
- url: '/pages/application/application?tel=' + tel
- })
- }else if(that.data.from === 'mineFeedback'){
- wx.redirectTo({
- url: '/pages/feedback/feedback?tel=' + tel
- })
- }else{
- // if(that.data.from === 'card' && that.data.preid)
- wx.redirectTo({
- url: '/pages/getIt/getIt?from='+that.data.from+'&preid='+ that.data.preid +'&tel=' + tel
- })
- }
- }else{
- // app.noticeModal(data.err);
- }
- }
- });
- },
- onReady: function () {
- },
- onShow: function () {
- },
- onHide: function () {
- },
- onUnload: function () {
- }
- })
|