- 后端后台管理:在师傅管理模块新增 resetpwd 功能,支持重置登录密码、支付密码或全部重置,并联动清理锁定状态与在线令牌 - 视图与脚本:新增 resetpwd.html 弹窗视图并在 master.js 与 index.html 中注册操作按钮与表单联动逻辑 - 师傅端接口:MasterAuth::setPaymentPassword 简化流程,依托已有登录态直接设置6位数字支付密码,并在修改登录密码时自动重置锁定状态 - 师傅端小程序:security.vue 全面升级账号安全中心界面视觉与交互,展示账号信息、认证状态并提供标准弹窗;清理 wxlogin.js 中冗余代码
149 行
6.6 KiB
JavaScript
149 行
6.6 KiB
JavaScript
/**
|
|
* 师傅端接口清单(仅保留师傅端与公共字典/协议/上传接口)
|
|
*/
|
|
import { get, post, uploadFile } from './request';
|
|
import config from '@/config/config.js';
|
|
|
|
export default {
|
|
/* ---------- 公共 / 上传 / 字典 ---------- */
|
|
upload: (filePath, category = 'other') => uploadFile(filePath, category),
|
|
areas: (data = {}) => get('/common/areas', data, { silent: true }),
|
|
expressCompanies: () => get('/common/expressCompanies', {}, { silent: true }),
|
|
commonDicts: () => get('/common/dicts', {}, { silent: true }),
|
|
cats: () => get('/home/cats'),
|
|
agreement: (type, opt) => get('/home/agreement', { type: type, side: 'master' }, opt || { silent: true }),
|
|
agreementRead: (data, opt) => post('/home/agreementRead', Object.assign({ side: 'master' }, data || {}), Object.assign({ silent: true, allowConcurrent: true }, opt || {})),
|
|
|
|
/* ---------- 师傅端独立鉴权与安全 ---------- */
|
|
login: (data) => post('/master_auth/login', data, { silent: true }),
|
|
wxPhoneLogin: (data) => post('/master_auth/wxPhoneLogin', data, { silent: true }),
|
|
logout: () => post('/master_auth/logout', {}, { silent: true }),
|
|
profile: () => get('/master_auth/profile'),
|
|
securityStatus: () => get('/master_auth/securityStatus'),
|
|
changeLoginPassword: (data) => post('/master_auth/changeLoginPassword', data),
|
|
setPaymentPassword: (data) => post('/master_auth/setPaymentPassword', data),
|
|
changePaymentPassword: (data) => post('/master_auth/changePaymentPassword', data),
|
|
|
|
/* ---------- 师傅业务 ---------- */
|
|
masterApply: (data) => post('/master/apply', data),
|
|
masterOcrIdCard: (data) => post('/master/ocrIdCard', data),
|
|
masterInfo: () => get('/master/info'),
|
|
masterSaveProfile: (data) => post('/master/saveProfile', data),
|
|
masterHall: (data) => get('/master/hall', data),
|
|
masterOrderDetail: (id, params) => get('/master/orderDetail', { id: id, ...(params || {}) }),
|
|
masterGrab: (data) => post('/master/grab', data),
|
|
masterOrders: (data) => get('/master/orders', data),
|
|
masterContact: (data) => post('/master/contact', data),
|
|
masterSchedule: (data) => post('/master/schedule', data),
|
|
masterArrive: (data) => post('/master/arrive', data),
|
|
masterStart: (data) => post('/master/startJob', data),
|
|
masterFinish: (data) => post('/master/finish', data),
|
|
masterVerifyCode: (data) => post('/master/verifyCode', data),
|
|
masterRequestDiff: (data) => post('/master/requestDiff', data),
|
|
masterIncome: () => get('/master/income'),
|
|
masterToggle: (data) => post('/master/toggleWork', data),
|
|
masterUpdateLocation: (data) => post('/master/updateLocation', data),
|
|
masterResolveLocation: (data) => get('/master/resolveLocation', data, { silent: true }),
|
|
masterSearchLocation: (data) => get('/master/searchLocation', data, { silent: true }),
|
|
masterLocationContext: (data) => get('/master/locationContext', data, { silent: true }),
|
|
masterLocationStats: (data) => get('/master/locationOrderStats', data, { silent: true }),
|
|
masterLocateCity: (data) => get('/master/locateCity', data),
|
|
masterCredit: () => get('/master/credit'),
|
|
masterAppeals: () => get('/master/appeals'),
|
|
masterAppeal: (data) => post('/master/appeal', data),
|
|
masterQuotes: () => get('/master/quotes'),
|
|
masterQuote: (data) => post('/master/quote', data),
|
|
masterWithdraw: (data) => post('/master/withdraw', data),
|
|
masterTransferPackage: (data) => post('/master/transferPackage', data),
|
|
masterSyncWithdraw: (data) => post('/master/syncWithdraw', data, { silent: true, allowConcurrent: true }),
|
|
masterSkillDict: () => get('/master/skillDict'),
|
|
masterSaveSkills: (data) => post('/master/saveSkills', data),
|
|
masterCerts: () => get('/master/certs'),
|
|
masterCertDetail: (params) => get('/master/certDetail', params),
|
|
masterSaveCert: (data) => post('/master/saveCert', data),
|
|
masterDeleteCert: (data) => post('/master/deleteCert', data),
|
|
reviewList: () => get('/master/reviews'),
|
|
|
|
/* ---------- 师傅端独立消息中心 ---------- */
|
|
messageList: (data) => get('/master_message/index', data),
|
|
messageRead: (data) => post('/master_message/read', data),
|
|
messageReadAll: (data) => post('/master_message/readAll', data),
|
|
messageUnread: (data) => get('/master_message/unread', data, { silent: true }),
|
|
|
|
/* ---------- 客服配置与跨小程序跳转 ---------- */
|
|
getCachedServiceConfig: function () {
|
|
try {
|
|
const cached = uni.getStorageSync('yjyf_master_service_config');
|
|
if (cached && typeof cached === 'object') {
|
|
return {
|
|
service_phone: String(cached.service_phone || '').trim(),
|
|
service_work_time: String(cached.service_work_time || '').trim(),
|
|
service_corp_id: String(cached.service_corp_id || '').trim(),
|
|
service_kf_url: String(cached.service_kf_url || '').trim(),
|
|
user_appid: String(cached.user_appid || '').trim(),
|
|
};
|
|
}
|
|
} catch (e) {}
|
|
return {
|
|
service_phone: String(uni.getStorageSync('yjyf_service_phone') || '').trim(),
|
|
service_work_time: '',
|
|
service_corp_id: '',
|
|
service_kf_url: '',
|
|
user_appid: '',
|
|
};
|
|
},
|
|
getServiceConfig: async function (force = false) {
|
|
const cached = this.getCachedServiceConfig();
|
|
if (!force && (cached.service_phone || cached.service_corp_id || cached.service_kf_url) && cached.user_appid) {
|
|
return cached;
|
|
}
|
|
try {
|
|
const res = await get('/home/serviceConfig', {}, { silent: true });
|
|
if (res && typeof res === 'object') {
|
|
const cfg = {
|
|
service_phone: String(res.service_phone || '').trim(),
|
|
service_work_time: String(res.service_work_time || '').trim(),
|
|
service_corp_id: String(res.service_corp_id || '').trim(),
|
|
service_kf_url: String(res.service_kf_url || '').trim(),
|
|
user_appid: String(res.user_appid || '').trim(),
|
|
};
|
|
uni.setStorageSync('yjyf_master_service_config', cfg);
|
|
if (cfg.service_phone) {
|
|
uni.setStorageSync('yjyf_service_phone', cfg.service_phone);
|
|
}
|
|
return cfg;
|
|
}
|
|
} catch (e) {}
|
|
return cached;
|
|
},
|
|
openUserMiniProgram: async function (path = 'pages/index/index') {
|
|
let cfg = await this.getServiceConfig();
|
|
if (!cfg.user_appid) {
|
|
cfg = await this.getServiceConfig(true);
|
|
}
|
|
const targetAppId = cfg.user_appid;
|
|
// #ifdef MP-WEIXIN
|
|
if (!targetAppId) {
|
|
uni.showToast({ title: '后台暂未配置用户端小程序 AppID', icon: 'none' });
|
|
return;
|
|
}
|
|
uni.navigateToMiniProgram({
|
|
appId: targetAppId,
|
|
path: path,
|
|
fail: (err) => {
|
|
if (err && err.errMsg && err.errMsg.indexOf('cancel') !== -1) return;
|
|
uni.showToast({ title: '打开用户端小程序失败,请稍后重试', icon: 'none' });
|
|
}
|
|
});
|
|
// #endif
|
|
// #ifndef MP-WEIXIN
|
|
uni.showModal({
|
|
title: '前往优匠优服用户端',
|
|
content: '请在微信中搜索「优匠优服」小程序发布安装维修需求。',
|
|
showCancel: false,
|
|
confirmText: '知道了'
|
|
});
|
|
// #endif
|
|
}
|
|
};
|