From c9df1e63415c96b1b4558a9c95cba0d1439beb09 Mon Sep 17 00:00:00 2001 From: wangdongbo <949818794@qq.com> Date: Tue, 20 Jan 2026 16:30:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 1 + api/corp/dept.js | 13 ++ pages.json | 18 ++ pages/login/login.vue | 9 +- pages/work/department-select.vue | 340 +++++++++++++++++++++++++++ pages/work/profile.vue | 379 +++++++++++++++++++++++++++++++ pages/work/work.vue | 210 ++++++++++++++++- routes/index.js | 14 +- store/account.js | 10 +- utils/api.js | 1 + utils/http.js | 4 + 11 files changed, 991 insertions(+), 8 deletions(-) create mode 100644 api/corp/dept.js create mode 100644 pages/work/department-select.vue create mode 100644 pages/work/profile.vue diff --git a/.env.development b/.env.development index 9928b9d..c35990f 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,4 @@ MP_API_BASE_URL=http://localhost:8080 MP_CACHE_PREFIX=development MP_WX_APP_ID=wx93af55767423938e +MP_CORP_ID=wwe3fb2faa52cf9dfb diff --git a/api/corp/dept.js b/api/corp/dept.js new file mode 100644 index 0000000..10caf9c --- /dev/null +++ b/api/corp/dept.js @@ -0,0 +1,13 @@ +import api from "../../utils/http.js"; + +const BASE_PATH = "/corp"; + +/** + * 获取科室列表(按 corpId) + * @param {Object} params + * @param {string} params.corpId + */ +export function getDeptList(params = {}) { + return api.post(`${BASE_PATH}`, { type: "getDeptList", ...params }); +} + diff --git a/pages.json b/pages.json index 09244f9..86ee365 100644 --- a/pages.json +++ b/pages.json @@ -17,6 +17,24 @@ "style": { "navigationBarTitleText": "工作台" } + }, + { + "path": "pages/work/profile", + "style": { + "navigationBarTitleText": "完善个人信息" + } + }, + { + "path": "pages/work/department-select", + "style": { + "navigationBarTitleText": "选择科室" + } + }, + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "登录" + } } ], "globalStyle": { diff --git a/pages/login/login.vue b/pages/login/login.vue index 1bd6e10..dada67b 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -82,7 +82,7 @@ function remind() { function toHome() { uni.navigateTo({ - url: "/pages/home/home", + url: "/pages/message/message", }); } @@ -112,7 +112,12 @@ onLoad((opts) => { console.log("redirectUrl", redirectUrl.value); return; } - redirectUrl.value = opts.redirectUrl || ""; + // 支持 redirect 参数(来自 useGuard)或 redirectUrl 参数 + if (opts.redirect) { + redirectUrl.value = decodeURIComponent(opts.redirect); + } else { + redirectUrl.value = opts.redirectUrl || ""; + } }); + diff --git a/pages/work/profile.vue b/pages/work/profile.vue new file mode 100644 index 0000000..034411a --- /dev/null +++ b/pages/work/profile.vue @@ -0,0 +1,379 @@ + + + + + + diff --git a/pages/work/work.vue b/pages/work/work.vue index 85ca984..0b2dce0 100644 --- a/pages/work/work.vue +++ b/pages/work/work.vue @@ -1,9 +1,213 @@ - - \ No newline at end of file diff --git a/routes/index.js b/routes/index.js index 4fba4e3..dfc8e0b 100644 --- a/routes/index.js +++ b/routes/index.js @@ -1,8 +1,20 @@ export default [ { - path: 'pages/home/home', + path: 'pages/message/message', meta: { title: '首页', login: true }, style: { navigationStyle: 'custom' } + }, + { + path: 'pages/work/work', + meta: { title: '工作台', login: true } + }, + { + path: 'pages/work/profile', + meta: { title: '完善个人信息', login: true } + }, + { + path: 'pages/work/department-select', + meta: { title: '选择科室', login: true } } ] diff --git a/store/account.js b/store/account.js index 99f71c6..d262673 100644 --- a/store/account.js +++ b/store/account.js @@ -13,6 +13,8 @@ export default defineStore("accountStore", () => { // IM 相关 const openid = ref(""); const isIMInitialized = ref(false); + // 手机号(从授权登录获取) + const mobile = ref(uni.getStorageSync('user_mobile') || ''); async function login(phoneCode = '') { if (loading.value) return; @@ -34,10 +36,14 @@ export default defineStore("accountStore", () => { console.log(res) if (res.success && res.data && res.data.mobile) { account.value = res.data; - // 兼容不同字段名 openid.value = res.data.openid || res.data.openId || res.data.userId || ""; isIMInitialized.value = false; clearInitIMPromise(); + // 存储手机号 + if (res.data.mobile) { + mobile.value = res.data.mobile; + uni.setStorageSync('user_mobile', res.data.mobile); + } return res.data } } @@ -68,5 +74,5 @@ export default defineStore("accountStore", () => { } } - return { account, openid, isIMInitialized, login, initIMAfterLogin } + return { account, openid, isIMInitialized, mobile, login, initIMAfterLogin } }) \ No newline at end of file diff --git a/utils/api.js b/utils/api.js index 505caaf..87b6446 100644 --- a/utils/api.js +++ b/utils/api.js @@ -7,6 +7,7 @@ const urlsConfig = { getTeamData: 'getTeamData', queryWxJoinedTeams: 'queryWxJoinedTeams', wxAppLogin: 'wxAppLogin', + getDeptList:'getHlwDeptList', }, knowledgeBase: { diff --git a/utils/http.js b/utils/http.js index 4f7acc8..e29328e 100644 --- a/utils/http.js +++ b/utils/http.js @@ -97,6 +97,10 @@ async function refreshAccessToken() { const request = async (options = {}, showLoading = true) => { // 合并用户传入的配置和默认配置 if (!options.data) options.data = {}; + if(!options.data.corpId) { + options.data.corpId = env.MP_CORP_ID; + } + const config = { ...defaultOptions,