|
- // pages/users/users.js
- const imgurl = require("../../utils/imgurl");
- const Http = require("../../utils/HttpBasics");
- var config = require("../../config/config.js");
- const bgColor = require("../../utils/bgColor.js")
- let app = getApp();
- Page({
-
- /**
- * 页面的初始数据
- */
- data: {
- aboutUs: imgurl.aboutUs.url,
- banneColor: "linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%)",
- levelName: "",
- levelBg: bgColor.colorFirst.user.levelBg,
- score: '0',
- curPhone: '',
- },
- //授权手机号
- gotoPhoneInfo() {
- // let that = this;
- // Http.get({
- // url: config.api.checkPhoneStatus,
- // data: {}
- // }).then(res => {
- // return
- // }).catch(err => {
- // wx.redirectTo({
- // url: `/pages/getphoneInfo/getphoneInfo`
- // });
- // })
- wx.redirectTo({
- url: `/pages/getphoneInfo/getphoneInfo`
- });
-
- },
-
- /* 判断是否授权*/
- checkUserStatus() {
- Http.get({
- url: config.api.checkUserStatus,
- data: {
- token: app.globalData.token
- }
- }).then(res => {
- this.getUserInfo()
- }).catch(err => {
- wx.navigateTo({
- url: `/pages/getuserinfo/index`,
- })
- })
- // wx.navigateTo({
- // url: '/pages/getuserinfo/index',
- // })
- },
-
- //获取当前登录用户信息
- getUserInfo: function () {
- let that = this;
- // 获取用户信息
- Http.get({
- url: config.api.getScore,
- })
- .then(res => {
- const { code, data } = res
- if (code == 200) {
- that.setData({
- levelName: data.levelName,
- getScore: data.getScore,
-
- })
- }
- })
- },
-
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
-
-
-
- },
-
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.checkUserStatus()
- this.setData({
- curPhone: wx.getStorageSync('phone')
- })
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- }
- })
|