123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- var util = require('../../../utils/util.js');
- var api = require('../../../config/api');
- var user = require('../../../utils/user.js');
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- userInfo: {
- nickName: '期待加入',
- avatarUrl: '/static/images/new/icon-user.png'
- },
- saveMoney: '0',
- date: '',
- saveMoneyYuan: '0',
- saveMoneyPoint: '0',
- myqr_show: false, //我的分享二维码
- myqr_blur: 100, //背景模糊值
- imgList1:[],
- imgList2:[],
- },
- showRule() {
- this.setData({
- myqr_show: true,
- myqr_blur: 25
- })
- },
- hidePoster(){
- this.setData({
- myqr_show:false,
- myqr_blur:100,
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- // let userInfo = wx.getStorageSync('userInfo');
- //console.info(userInfo);
- },
- getMemberInfo: function () {
- let that = this
- util.request(api.getMemberInfo, {
- userId: app.globalData.userInfo.id
- }, 'GET')
- .then(res => {
- console.info(res);
- if (res.errno === 0) {
- let date = null;
- if (res.data.userInfo.memberExpiration)
- date = res.data.userInfo.memberExpiration.substr(0, 10);
- let saveMoney = Number(res.data.saveMoney).toFixed(2);
- that.setData({
- userInfo: res.data.userInfo,
- date: date,
- saveMoneyYuan: saveMoney.split('.')[0],
- saveMoneyPoint: saveMoney.split('.')[1]
- });
- app.globalData.memberUserInfo=res.data.userInfo;
- if(that.data.userInfo.level==1){
- that.getMemberAd();
- }
- } else {
- util.showErrorToast(res.errmsg);
- console.info(that.data.userInfo)
- }
- });
- },
- goBuyList() {
- wx.navigateTo({
- url: '/pages/member/buyList/buyList',
- })
- },
- goBuyMember() {
- if (!app.globalData.hasLogin){
- wx.navigateTo({
- url: "/pages/auth/login/login"
- });
- return;
- }
-
- wx.navigateTo({
- url: "/pages/member/buyMember/buyMember"
- });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getMemberInfo();
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- getMemberAd(){
- util.request(api.GetMemberAd, {
-
- },'GET')
- .then(res=>{
- if (res.errno === 0) {
- this.setData({
- imgList1:res.data.firstPurchase,
- imgList2:res.data.memberActivity
- });
- }
- });
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|