修改了经理端部分代码

This commit is contained in:
2025-08-07 11:45:28 +08:00
parent 3996895c0d
commit d1b4fa8ca3
11 changed files with 61 additions and 66 deletions

View File

@ -5,7 +5,7 @@ Page({
// 用于存储输入框数据 // 用于存储输入框数据
nickName: '', nickName: '',
phoneNumber: '', phoneNumber: '',
selectedSortField: '待选择', // 默认选择"待选择" selectedSortField: '员工数量', // 默认选择"待选择"
selectedSortOrder: '升序', // 默认选择升序 selectedSortOrder: '升序', // 默认选择升序
sortFieldsByManager: ['员工数量', '推广人数', '下单数量', '总订单金额', '净成交金额'], sortFieldsByManager: ['员工数量', '推广人数', '下单数量', '总订单金额', '净成交金额'],
sortFieldsBySupervisor: ['推广人数', '下单数量', '总订单金额', '净成交金额'], sortFieldsBySupervisor: ['推广人数', '下单数量', '总订单金额', '净成交金额'],
@ -58,35 +58,35 @@ Page({
// 搜索按钮点击 // 搜索按钮点击
onSearch() { onSearch() {
const { role } = this.data; const { role } = this.data;
// —— 新增:校验主管名称 —— // // —— 新增:校验主管名称 ——
const nameRegex = /^[\u4e00-\u9fa5]+$/; // const nameRegex = /^[\u4e00-\u9fa5]+$/;
if (!this.data.nickName) { // if (!this.data.nickName) {
wx.showToast({ title: '主管名称不能为空', icon: 'none' }); // wx.showToast({ title: '主管名称不能为空', icon: 'none' });
return; // return;
} // }
if (!nameRegex.test(this.data.nickName)) { // if (!nameRegex.test(this.data.nickName)) {
wx.showToast({ title: '主管名称只能为汉字', icon: 'none' }); // wx.showToast({ title: '主管名称只能为汉字', icon: 'none' });
return; // return;
} // }
// —— 新增:校验手机号 —— // // —— 新增:校验手机号 ——
if (!this.data.phoneNumber) { // if (!this.data.phoneNumber) {
wx.showToast({ title: '手机号不能为空', icon: 'none' }); // wx.showToast({ title: '手机号不能为空', icon: 'none' });
return; // return;
} // }
if (this.data.phoneNumber.length < 11) { // if (this.data.phoneNumber.length < 11) {
wx.showToast({ title: '手机号不够11位', icon: 'none' }); // wx.showToast({ title: '手机号不够11位', icon: 'none' });
return; // return;
} // }
// 原排序条件校验,保持不变 // 原排序条件校验,保持不变
if (this.data.selectedSortField === '待选择') { // if (this.data.selectedSortField === '待选择') {
wx.showToast({ // wx.showToast({
title: '排序条件不能为空', // title: '排序条件不能为空',
icon: 'none' // icon: 'none'
}); // });
return; // return;
} // }
// 显示加载中 // 显示加载中
wx.showLoading({ wx.showLoading({
@ -187,5 +187,6 @@ if (this.data.selectedSortField === '待选择') {
break; break;
} }
this.setData({ showRole }); this.setData({ showRole });
this.onSearch()
} }
}); });

View File

@ -22,15 +22,6 @@ Page({
const phoneNumber = this.data.phoneNumber.trim(); const phoneNumber = this.data.phoneNumber.trim();
const { supervisorUserId } = this.data; const { supervisorUserId } = this.data;
if (!nickName) {
wx.showToast({ title: '请输入主管名称', icon: 'none' });
return;
}
if (!/^1[3-9]\d{9}$/.test(phoneNumber)) {
wx.showToast({ title: '请输入正确的手机号', icon: 'none' });
return;
}
wx.request({ wx.request({
url: baseUrl + '/perform/query/staff', url: baseUrl + '/perform/query/staff',
method: 'POST', method: 'POST',
@ -107,9 +98,8 @@ Page({
}, },
onLoad(options) { onLoad(options) {
console.log('--->',options);
this.setData({ this.setData({
supervisorUserId: options.id, supervisorUserId: options.supId,
}) })
this.onSearchSupId(); this.onSearchSupId();
}, },

View File

@ -57,7 +57,7 @@
<!-- 基本信息 --> <!-- 基本信息 -->
<view class="flex-row justify-between self-stretch group"> <view class="flex-row justify-between self-stretch group">
<view class="flex-col items-start self-center"> <view class="flex-col items-start self-center">
<text class="font_2">编号:{{item.id}}</text> <text class="font_2">编号:{{index + 1}}</text>
<text class="font text_8 mt-13">员工:{{item.nickName}}</text> <text class="font text_8 mt-13">员工:{{item.nickName}}</text>
</view> </view>
<view class="flex-col justify-start self-start text-wrapper_4" bind:tap="gotoUser" data-id="{{ item.userId }}"> <view class="flex-col justify-start self-start text-wrapper_4" bind:tap="gotoUser" data-id="{{ item.userId }}">

View File

@ -21,16 +21,6 @@ Page({
onSearch() { onSearch() {
const nickName = this.data.nickName.trim(); const nickName = this.data.nickName.trim();
const phoneNumber = this.data.phoneNumber.trim(); const phoneNumber = this.data.phoneNumber.trim();
const { id } = this.data
if (!nickName) {
wx.showToast({ title: '请输入主管名称', icon: 'none' });
return;
}
if (!/^1[3-9]\d{9}$/.test(phoneNumber)) {
wx.showToast({ title: '请输入正确的手机号', icon: 'none' });
return;
}
wx.request({ wx.request({
url: baseUrl + '/perform/query/supervisor', url: baseUrl + '/perform/query/supervisor',
@ -89,12 +79,13 @@ Page({
break; break;
} }
this.setData({ showRole }); this.setData({ showRole });
this.onSearch()
}, },
changeStaff(e) { changeStaff(e) {
const { id } = e.currentTarget.dataset; const { id } = e.currentTarget.dataset;
console.log(id)
wx.navigateTo({ wx.navigateTo({
url: `/pages/dashboardModule/staffPerformance/staffPerformance?supId=${id}`, url: `/pages/dashboardModule/staffPerformance/staffPerformance?supId=${id}`,
}) })

View File

@ -57,7 +57,7 @@
<!-- 基本信息 --> <!-- 基本信息 -->
<view class="flex-row justify-between self-stretch group"> <view class="flex-row justify-between self-stretch group">
<view class="flex-col items-start self-center"> <view class="flex-col items-start self-center">
<text class="font_2">编号:{{item.id}}</text> <text class="font_2">编号:{{index + 1}}</text>
<text class="font text_8 mt-13">主管:{{item.nickName}}</text> <text class="font text_8 mt-13">主管:{{item.nickName}}</text>
</view> </view>
<view class="flex-col justify-start self-start text-wrapper_4" bind:tap="changeStaff" data-id="{{ item.userId }}"> <view class="flex-col justify-start self-start text-wrapper_4" bind:tap="changeStaff" data-id="{{ item.userId }}">

View File

@ -21,12 +21,14 @@ Page({
passwordType: true, passwordType: true,
role: '', // 登录角色 role: '', // 登录角色
showRole: '', showRole: '',
isShowRegister: true
}, },
onLoad(options) { onLoad(options) {
const role = options.role || '' const role = options.role || ''
const showRole = roleMap.get(role) || '' const showRole = roleMap.get(role) || ''
this.setData({ role, showRole }) this.setData({ role, showRole })
if (role === 'manager') this.setData({isShowRegister: false})
}, },
// 切换到“密码登录”,只清空表单字段 // 切换到“密码登录”,只清空表单字段

View File

@ -92,7 +92,7 @@
</view> </view>
<!-- 去注册 --> <!-- 去注册 -->
<view class="self-center group_5"> <view class="self-center group_5" wx:if="{{isShowRegister}}">
<text class="font_4 text_11">没有账号?</text> <text class="font_4 text_11">没有账号?</text>
<text class="font_5 text_12" bindtap="gotoRegister">去注册→</text> <text class="font_5 text_12" bindtap="gotoRegister">去注册→</text>
</view> </view>

View File

@ -31,6 +31,7 @@ Page({
title: '退出成功', title: '退出成功',
icon: 'success' icon: 'success'
}) })
wx.removeStorageSync('token')
setTimeout(() => { setTimeout(() => {
wx.reLaunch({ wx.reLaunch({
url: '/pages/welcome/homePage/homePage', url: '/pages/welcome/homePage/homePage',

View File

@ -15,7 +15,8 @@ Page({
userAccount: "", userAccount: "",
invitationCode: "", invitationCode: "",
showPopup: false, // 控制弹窗显示与否 showPopup: false, // 控制弹窗显示与否
qrcode: "https://img.picui.cn/free/2025/05/29/6837c53582068.gif", // 设置二维码图片的路径 isShowOrder: true,
qrcode: "", // 设置二维码图片的路径
userRole: "", userRole: "",
id: 0, id: 0,
}, },
@ -111,8 +112,9 @@ Page({
success: res => { success: res => {
if (res.data.code === 1) { if (res.data.code === 1) {
let result = res.data.data let result = res.data.data
console.log('====fdfs>', res)
this.setData({ this.setData({
// qrcode: globalImgUrl + result.inviteQrCode qrcode: globalImgUrl + result.inviteQrCode
}) })
} else { } else {
wx.showToast({ wx.showToast({
@ -136,22 +138,24 @@ Page({
success: res => { success: res => {
console.log('用户信息---->',res.data); console.log('用户信息---->',res.data);
if (res.data.code === 1) { if (res.data.code === 1) {
let result = res.data.data
this.setData({ this.setData({
nickName: res.data.data.nickName, nickName: result.nickName,
// TODO 头像未连接 // TODO 头像未连接
userAvatar: res.data.data.userAvatar, userAvatar: result.userAvatar,
phoneNumber: res.data.data.phoneNumber, phoneNumber: result.phoneNumber,
userAccount: res.data.data.userAccount, userAccount: result.userAccount,
invitationCode: res.data.data.invitationCode, invitationCode: result.invitationCode,
userRole: res.data.data.userRole, userRole: result.userRole,
id: res.data.data.id, id: result.id,
}) })
if (result.userRole !== 'user') this.setData({ isShowOrder: false });
} }
} }
}) })
}, },
onLoad(options) { onLoad() {
this.getUserMainInfo() this.getUserMainInfo()
}, },

View File

@ -271,7 +271,7 @@
</view> </view>
</view> </view>
<view class="flex-col list"> <view class="flex-col list">
<view class="flex-row justify-between items-center section_4"> <view class="flex-row justify-between items-center section_4" wx:if="{{isShowOrder}}">
<view class="flex-row items-center" bind:tap="courseOrder"> <view class="flex-row items-center" bind:tap="courseOrder">
<image <image
class="shrink-0 image_6" class="shrink-0 image_6"

View File

@ -1,3 +1,4 @@
const { baseUrl } = require('../../../request');
// pages/welcome/homePage/homePage.js // pages/welcome/homePage/homePage.js
Page({ Page({
@ -20,7 +21,12 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
let token = wx.getStorageSync('token')
if (token) {
wx.switchTab({
url: '/pages/course/homepage/homepage'
})
}
}, },
/** /**