1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- //index.js
- //获取应用实例
- const app = getApp()
- Page({
- data: {
- userInfo: {},
- },
- onLoad: function () {
- this.initInfo();
- },
- initInfo () {
- var token = wx.getStorageSync('token'), data = {}, that = this;
- console.log(token);
- if (token) {
- that.getInfo(token)
- }else{
- app.login(that.getInfo);
- }
- },
- getInfo (token) {
- var that = this, token = token || wx.getStorageSync('token'), data = null;
- wx.request({
- url: app.globalData.HOST + '/user/wx/personalCenter',
- method: 'POST',
- data: {token: token},
- success: function (res) {
- if (res.data.errno == '0'){
- data = res.data.rst
- that.setData({userInfo: data})
- }else if(res.data.errno == '90001'){
- }
- }
- });
- },
- goApplication () {
- var tel = wx.getStorageSync('tel');
- if (tel) {
- wx.navigateTo({
- url: "/pages/application/application"
- })
- }else{
- wx.navigateTo({
- url: "/pages/getPhone/getPhone?from=mine"
- })
- }
- }
- })
|