地址路径修改
This commit is contained in:
217
dist/pages/staff/employee-dashboard.js
vendored
Normal file
217
dist/pages/staff/employee-dashboard.js
vendored
Normal file
@@ -0,0 +1,217 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const userService_1 = __importDefault(require("../../services/userService"));
|
||||
Page({
|
||||
data: {
|
||||
userInfo: null,
|
||||
// Grid布局的功能菜单
|
||||
menuItems: [
|
||||
{
|
||||
id: 'orders',
|
||||
name: '我的订单',
|
||||
icon: '📦',
|
||||
color: '#3498db',
|
||||
description: '查看分配订单'
|
||||
},
|
||||
{
|
||||
id: 'location',
|
||||
name: '位置上报',
|
||||
icon: '📍',
|
||||
color: '#e74c3c',
|
||||
description: '上报当前位置'
|
||||
},
|
||||
{
|
||||
id: 'schedule',
|
||||
name: '工作安排',
|
||||
icon: '📅',
|
||||
color: '#f39c12',
|
||||
description: '查看工作计划'
|
||||
},
|
||||
{
|
||||
id: 'profile',
|
||||
name: '个人信息',
|
||||
icon: '👤',
|
||||
color: '#9b59b6',
|
||||
description: '个人资料管理'
|
||||
},
|
||||
{
|
||||
id: 'messages',
|
||||
name: '消息通知',
|
||||
icon: '📨',
|
||||
color: '#34495e',
|
||||
description: '查看系统消息'
|
||||
},
|
||||
{
|
||||
id: 'help',
|
||||
name: '帮助中心',
|
||||
icon: '❓',
|
||||
color: '#27ae60',
|
||||
description: '使用帮助文档'
|
||||
}
|
||||
],
|
||||
// 工作统计
|
||||
workStats: {
|
||||
todayOrders: 0,
|
||||
completedOrders: 0,
|
||||
pendingOrders: 0
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserInfo();
|
||||
this.loadWorkStats();
|
||||
},
|
||||
onShow() {
|
||||
this.loadWorkStats();
|
||||
},
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
getUserInfo() {
|
||||
const app = getApp();
|
||||
if (app.globalData.userInfo) {
|
||||
const userInfo = app.globalData.userInfo;
|
||||
this.setData({ userInfo });
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 加载工作统计数据
|
||||
*/
|
||||
loadWorkStats() {
|
||||
// 模拟加载工作统计数据
|
||||
this.setData({
|
||||
workStats: {
|
||||
todayOrders: 8,
|
||||
completedOrders: 5,
|
||||
pendingOrders: 3
|
||||
}
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 菜单项点击事件
|
||||
*/
|
||||
onMenuItemTap(e) {
|
||||
const itemId = e.currentTarget.dataset.id;
|
||||
switch (itemId) {
|
||||
case 'orders':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/my-orders'
|
||||
});
|
||||
break;
|
||||
case 'location':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/location-report'
|
||||
});
|
||||
break;
|
||||
case 'schedule':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/work-schedule'
|
||||
});
|
||||
break;
|
||||
case 'profile':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/profile'
|
||||
});
|
||||
break;
|
||||
case 'messages':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/messages'
|
||||
});
|
||||
break;
|
||||
case 'help':
|
||||
wx.navigateTo({
|
||||
url: '/pages/staff/help'
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 返回首页
|
||||
*/
|
||||
goBack() {
|
||||
wx.navigateBack();
|
||||
},
|
||||
/**
|
||||
* 刷新数据
|
||||
*/
|
||||
onRefresh() {
|
||||
this.loadWorkStats();
|
||||
wx.showToast({
|
||||
title: '数据已刷新',
|
||||
icon: 'success'
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 紧急联系
|
||||
*/
|
||||
onEmergencyContact() {
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: '400-123-4567'
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 解绑微信处理
|
||||
*/
|
||||
async onUnbindWechat() {
|
||||
try {
|
||||
// 确认对话框
|
||||
wx.showModal({
|
||||
title: '确认解绑',
|
||||
content: '解绑微信后,您将需要重新登录并绑定账号。确定要继续吗?',
|
||||
confirmText: '确定解绑',
|
||||
confirmColor: '#e74c3c',
|
||||
cancelText: '取消',
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
// 显示加载中
|
||||
wx.showLoading({
|
||||
title: '解绑中...',
|
||||
mask: true
|
||||
});
|
||||
try {
|
||||
// 调用解绑服务
|
||||
const result = await userService_1.default.unbindWechat();
|
||||
wx.hideLoading();
|
||||
if (result.success) {
|
||||
wx.showToast({
|
||||
title: '解绑成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
// 延迟跳转到登录页面
|
||||
setTimeout(() => {
|
||||
wx.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
else {
|
||||
wx.showToast({
|
||||
title: result.message || '解绑失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
wx.hideLoading();
|
||||
wx.showToast({
|
||||
title: '解绑失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
console.error('解绑微信错误:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
console.error('解绑微信处理错误:', error);
|
||||
wx.showToast({
|
||||
title: '操作失败,请重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user