123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- //index.js
- //获取应用实例
- const app = getApp()
- Page({
- data: {
- userInfo: {},
- },
- onLoad: function () {
- this.initInfo();
- },
- initInfo() {
- var token = wx.getStorageSync('user').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('user').token, data = null;
- console.log(token);
- 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') || '0', user_id = wx.getStorageSync('user').user_id || '0';
- console.log(user_id);
- console.log(tel);
- if (tel != '0' || user_id != '0') {
- wx.navigateTo({
- url: "/pages/application/application"
- })
- } else {
- wx.navigateTo({
- url: "/pages/getPhone/getPhone?from=mine"
- })
- }
- },
- goFeedback: function (e) {
- var tel = wx.getStorageSync('tel') || '0', user_id = wx.getStorageSync('user').user_id || '0';
- if (tel != '0' || user_id != '0') {
- wx.navigateTo({
- url: "/pages/feedback/feedback"
- })
- } else {
- wx.navigateTo({
- url: "/pages/getPhone/getPhone?from=mineFeedback"
- })
- }
- }
- })
|