You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

165 lines
3.4 KiB

2 years ago
// pages/user/user.js
var app = getApp()
var WXAPI = require('../../utils/server.js');
2 years ago
Page({
data: {
pop: null,
list: [
{
icon: 'icon-user-bangding.png',
text: '完善资料',
url: 'bangding/bangding'
}, {
icon: 'wdsc.png',
text: '我的收藏',
url: 'collection/collection'
},
{
icon: 'zj.png',
text: '历史记录',
url: 'footprint/footprint'
},
{
icon: 'dz.png',
text: '地址管理',
url: 'address/index'
},
{
icon: 'gg.png',
text: '公告管理',
url: 'notice/notice'
},
{
icon: 'sz.png',
text: '设置',
url: 'set/set'
}
],
cont: 1,
remind: '加载中',
2 years ago
tjr: false,
user:'',
2 years ago
},
//下拉刷新
onPullDownRefresh: function () {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.requestMyData();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
copyText: function (t) {
var a = t.currentTarget.dataset.text;
wx.setClipboardData({
data: a,
success: function () {
wx.showToast({
title: "已复制"
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
2 years ago
// wx.setNavigationBarColor({
// frontColor: app.d.frontColor,
// backgroundColor: app.d.bgcolor, //页面标题为路由参数7a896c app.d.bgcolor
// animation: {
// duration: 400,
// timingFunc: 'easeIn'
// }
// });
2 years ago
var plug_ins = app.globalData.userInfo.plug_ins; // 插件
this.setData({
bgcolor: app.d.bgcolor, // 背景颜色
plug_ins: plug_ins, // 插件
});
this.requestMyData();
},
//页面加载完成函数
onReady: function () {
var that = this;
this.pop = this.selectComponent("#pop")
that.setData({
remind: ''
});
},
onShow: function () {
var cont = this.data.cont;
var that = this;
if (cont > 1) {
that.requestMyData();
} else {
that.setData({
cont: cont + 1
})
}
},
requestMyData: function () {
var that = this;
2 years ago
WXAPI.appIndex({
})
WXAPI.userIndex({
2 years ago
accessId: app.globalData.accessId,
storeId: 239,
storeType: 1,
mobile:'',
}).then(res => {
2 years ago
if (res.code == 200) {
var data = res.data;
if (data.data) {
that.setData({
2 years ago
user: data.data.user,
// article: data.data.article,
logo: data.data.logo,
company: data.data.company,
th: data.data.th,
dfh_num: data.data.dfh_num,
dfk_num: data.data.dfk_num,
dpj_num: data.data.dpj_num,
dsh_num: data.data.dsh_num,
// plug_ins: data.data.plug_ins,
// tjr: data.data.tjr,
// support: data.data.support
});
}
} else {
2 years ago
wx.showToast({
2 years ago
title: '访问失败!',
2 years ago
duration: 2000
});
}
});
2 years ago
},
go: function (e) {
console.log(e)
var url = e.currentTarget.dataset.url
wx.navigateTo({
url: url
})
},
login: function () {
2 years ago
var isLogin = wx.getStorageSync('isLogin')
if (!isLogin) {
wx.navigateTo({
url: '/pages/login/login'
})
}
2 years ago
},
jumpgo: function (event) {
2 years ago
var isLogin = wx.getStorageSync('isLogin')
if (!isLogin) {
wx.navigateTo({
url: '/pages/login/login'
})
}
2 years ago
let url = event.currentTarget.dataset.id
wx.navigateTo({
url: url
})
}
})