236 lines
5.0 KiB
JavaScript
236 lines
5.0 KiB
JavaScript
// pages/personCenter/mine/mine.js
|
|
const { baseUrl } = require("../../../request");
|
|
const { globalImgUrl } = require("../../../request")
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
items: [null,null,null],
|
|
nickName: "",
|
|
userAvatar: "",
|
|
phoneNumber: "",
|
|
userAccount: "",
|
|
invitationCode: "",
|
|
showPopup: false, // 控制弹窗显示与否
|
|
isShowOrder: true,
|
|
qrcode: "", // 设置二维码图片的路径
|
|
userRole: "",
|
|
id: 0,
|
|
},
|
|
|
|
// 跳转课程订单页面
|
|
courseOrder() {
|
|
wx.navigateTo({
|
|
url: '/pages/course/courseOrderList/courseOrderList',
|
|
})
|
|
},
|
|
|
|
// 跳转结算记录页面
|
|
gotoSettlementRecord() {
|
|
wx.navigateTo({
|
|
url: '/pages/course/courseSettlementRecord/courseSettlementRecord',
|
|
})
|
|
},
|
|
|
|
// 点击二维码时,显示弹窗
|
|
showPromoPopup() {
|
|
this.setData({
|
|
showPopup: true
|
|
});
|
|
},
|
|
testOrigin() {
|
|
console.log("testOrigin");
|
|
},
|
|
|
|
// 关闭弹窗
|
|
closePopup() {
|
|
this.setData({
|
|
showPopup: false
|
|
});
|
|
},
|
|
myteam(){
|
|
wx.navigateTo({
|
|
url: '/pages/personCenter/teamManage/teamManage',
|
|
})
|
|
},
|
|
zhijin(){
|
|
wx.navigateTo({
|
|
url: '/pages/personCenter/billingDetails/billingDetails',
|
|
})
|
|
},
|
|
mingxi(){
|
|
wx.navigateTo({
|
|
url: '/pages/personCenter/fundingDetails/fundingDetails',
|
|
})
|
|
},
|
|
xiangmu(){
|
|
wx.navigateTo({
|
|
url: '/pages/projectModule/userProject/userProject',
|
|
})
|
|
},
|
|
lxsj(){
|
|
wx.navigateTo({
|
|
url: '/pages/personCenter/contactSuper/contactSuper',
|
|
})
|
|
},
|
|
zhshezhi(){
|
|
wx.navigateTo({
|
|
url: '/pages/personCenter/accountSetting/accountSetting',
|
|
})
|
|
},
|
|
tixianzhanghu() {
|
|
wx.navigateTo({
|
|
url: '/pages/personCenter/withdrawalAccount/withdrawalAccount',
|
|
})
|
|
},
|
|
lijitixian() {
|
|
wx.navigateTo({
|
|
url: '/pages/personCenter/withdrawal/withdrawal',
|
|
})
|
|
},
|
|
szcy() {
|
|
wx.navigateTo({
|
|
url: '/pages/personCenter/commissionSetting/commissionSetting',
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
getUserMainInfo() {
|
|
const token = wx.getStorageSync('token');
|
|
|
|
// 获取用户主要信息
|
|
wx.request({
|
|
url: baseUrl + '/userInfo/get/main/jwt',
|
|
method: 'GET',
|
|
header: {
|
|
Authorization: token
|
|
},
|
|
success: res => {
|
|
if (res.data.code === 1) {
|
|
let result = res.data.data
|
|
console.log('====fdfs>', res)
|
|
this.setData({
|
|
qrcode: globalImgUrl + result.inviteQrCode
|
|
})
|
|
} else {
|
|
wx.showToast({
|
|
title: '获取个人信息失败',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
},
|
|
fail: () => {
|
|
wx.showToast({ title: '网络错误,请重试', icon: 'none' });
|
|
}
|
|
})
|
|
|
|
// 获取用户信息
|
|
wx.request({
|
|
url: baseUrl + '/userInfo/get/jwt',
|
|
method: 'GET',
|
|
header: {
|
|
Authorization: token
|
|
},
|
|
success: res => {
|
|
console.log('用户信息---->',res.data);
|
|
if (res.data.code === 1) {
|
|
let result = res.data.data
|
|
this.setData({
|
|
nickName: result.nickName,
|
|
// TODO 头像未连接
|
|
userAvatar: result.userAvatar,
|
|
phoneNumber: result.phoneNumber,
|
|
userAccount: result.userAccount,
|
|
invitationCode: result.invitationCode,
|
|
userRole: result.userRole,
|
|
id: result.id,
|
|
})
|
|
if (result.userRole !== 'user') this.setData({ isShowOrder: false });
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
onLoad() {
|
|
this.getUserMainInfo()
|
|
},
|
|
|
|
// 复制邀请码到剪贴板
|
|
copyInvitationCode() {
|
|
wx.setClipboardData({
|
|
data: this.data.invitationCode,
|
|
success() {
|
|
wx.showToast({
|
|
title: '复制成功',
|
|
icon: 'success',
|
|
duration: 1500
|
|
});
|
|
},
|
|
fail() {
|
|
wx.showToast({
|
|
title: '复制失败',
|
|
icon: 'error',
|
|
duration: 1500
|
|
});
|
|
}
|
|
});
|
|
},
|
|
|
|
// 跳转仪表盘
|
|
gotoDashboard() {
|
|
|
|
const { userRole } = this.data
|
|
wx.navigateTo({
|
|
url: `/pages/dashboardModule/overviewPerformance/overviewPerformance?role=${userRole}`,
|
|
})
|
|
},
|
|
|
|
// 跳转查看绩效
|
|
checkPerformance() {
|
|
const { userRole } = this.data;
|
|
const { id } = this.data;
|
|
|
|
if (userRole === 'manager') {
|
|
wx.navigateTo({
|
|
url: `/pages/dashboardModule/supervisorPerformance/supervisorPerformance?role=${userRole}&id=${id}`,
|
|
})
|
|
} else {
|
|
wx.navigateTo({
|
|
url: `/pages/dashboardModule/staffPerformance/staffPerformance?role=${userRole}&id=${id}`,
|
|
})
|
|
}
|
|
},
|
|
|
|
// 跳转排名
|
|
gotoRank(e) {
|
|
console.log(e);
|
|
const userRole = e.currentTarget.dataset.userrole;
|
|
wx.navigateTo({
|
|
url: `/pages/dashboardModule/performanceRanking/performanceRanking?role=${userRole}`,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
this.getUserMainInfo()
|
|
},
|
|
gotoCall() {
|
|
wx.makePhoneCall({
|
|
phoneNumber: this.data.phoneNumber
|
|
})
|
|
},
|
|
|
|
}) |