diff --git a/.env.development b/.env.development index d8e7453..c00ccb1 100644 --- a/.env.development +++ b/.env.development @@ -4,3 +4,4 @@ MP_CACHE_PREFIX=development MP_WX_APP_ID=wx93af55767423938e MP_CORP_ID=wwe3fb2faa52cf9dfb MP_TIM_SDK_APP_ID=1600123876 +MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate diff --git a/.env.ip b/.env.ip new file mode 100644 index 0000000..943dbe3 --- /dev/null +++ b/.env.ip @@ -0,0 +1,8 @@ +MP_API_BASE_URL=http://192.168.60.2:8080 +MP_IMAGE_URL=https://patient.youcan365.com +MP_CACHE_PREFIX=development +MP_WX_APP_ID=wx93af55767423938e +MP_CORP_ID=wwe3fb2faa52cf9dfb +MP_TIM_SDK_APP_ID=1600123876 +MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate + diff --git a/.env.localhost b/.env.localhost index dd49388..c00ccb1 100644 --- a/.env.localhost +++ b/.env.localhost @@ -1,5 +1,7 @@ MP_API_BASE_URL=http://localhost:8080 +MP_IMAGE_URL=https://patient.youcan365.com MP_CACHE_PREFIX=development MP_WX_APP_ID=wx93af55767423938e MP_CORP_ID=wwe3fb2faa52cf9dfb -MP_TIM_SDK_APP_ID=1600072268 +MP_TIM_SDK_APP_ID=1600123876 +MP_INVITE_TEAMMATE_QRCODE=https://patient.youcan365.com/invite-teammate diff --git a/App.vue b/App.vue index 0ea7c2d..973d67f 100644 --- a/App.vue +++ b/App.vue @@ -5,9 +5,20 @@ import { globalTimChatManager } from "@/utils/tim-chat.js"; export default { onLaunch: function () { // 需在 pinia 安装后再获取 store,避免 getActivePinia 报错 - const { login } = useAccountStore(); - login(); - console.log("App Launch: "); + const { account, login, initIMAfterLogin } = useAccountStore(); + + // 如果已有缓存的账户信息,尝试初始化 IM,否则重新登录 + if (account && account.openid) { + console.log("App Launch: 已有登录信息,初始化 IM"); + initIMAfterLogin().catch(err => { + console.error('IM初始化失败:', err); + }); + } else { + console.log("App Launch: 无登录信息,开始登录"); + login().catch(err => { + console.error('自动登录失败:', err); + }); + } }, onShow: function () { console.log("App Show"); @@ -29,13 +40,36 @@ export default { \ No newline at end of file diff --git a/hooks/useGuard.js b/hooks/useGuard.js index 4dffd6f..3460047 100644 --- a/hooks/useGuard.js +++ b/hooks/useGuard.js @@ -25,6 +25,7 @@ export default function useGuard() { const onShowOptions = ref({}) function toLoginPage(options, path) { + const params = Object.keys(options).map(key => `${key}=${options[key]}`).join('&'); const redirectUrl = encodeURIComponent(`${path}?${params}`); uni.redirectTo({ diff --git a/hooks/useInfoCheck.js b/hooks/useInfoCheck.js new file mode 100644 index 0000000..d741127 --- /dev/null +++ b/hooks/useInfoCheck.js @@ -0,0 +1,19 @@ +import { storeToRefs } from 'pinia'; +import useAccountStore from "@/store/account.js"; +import { confirm } from '@/utils/widget'; + +export default function useInfoCheck() { + + const { doctorInfo } = storeToRefs(useAccountStore()); + + function withInfo(fn) { + return async (...args) => { + if (!doctorInfo.value || !doctorInfo.value.anotherName) { + await confirm('请先完善您的个人信息,方可使用该功能!', { cancelText: '再等等', confirmText: '去完善' }) + return uni.navigateTo({ url: '/pages/work/profile' }); + } + return fn(...args); + } + } + return { withInfo } +} \ No newline at end of file diff --git a/package.json b/package.json index d40d825..c1c3bdf 100644 --- a/package.json +++ b/package.json @@ -1,34 +1,40 @@ { - "name": "ykt-wxapp", - "version": "1.0.0", - "description": "", - "main": "main.js", - "scripts": { - "prebuild": "node scripts/pre-build.js", - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "dayjs": "^1.11.10", - "tim-upload-plugin": "^1.4.2", - "tim-wx-sdk": "^2.27.6" - }, - "uni-app": { - "scripts": { - "dev": { - "title": "测试", - "env": { - "UNI_PLATFORM": "mp-weixin" - } - }, + "name": "ykt-wxapp", + "version": "1.0.0", + "description": "", + "main": "main.js", + "scripts": { + "prebuild": "node scripts/pre-build.js", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "dependencies": { + "dayjs": "^1.11.10", + "tim-upload-plugin": "^1.4.2", + "tim-wx-sdk": "^2.27.6" + }, + "uni-app": { + "scripts": { + "dev": { + "title": "测试", + "env": { + "UNI_PLATFORM": "mp-weixin" + } + }, "localhost": { - "title": "本地", - "env": { - "UNI_PLATFORM": "mp-weixin" - } - } - } - }, - "devDependencies": {} -} + "title": "本地", + "env": { + "UNI_PLATFORM": "mp-weixin" + } + }, + "ip": { + "title": "本机ip", + "env": { + "UNI_PLATFORM": "mp-weixin" + } + } + } + }, + "devDependencies": {} +} \ No newline at end of file diff --git a/pages.json b/pages.json index 85c2926..a665207 100644 --- a/pages.json +++ b/pages.json @@ -1,9 +1,9 @@ { "pages": [ { - "path": "pages/login/login", + "path": "pages/message/message", "style": { - "navigationBarTitleText": "登录" + "navigationBarTitleText": "消息" } }, { @@ -12,20 +12,6 @@ "navigationBarTitleText": "登录" } }, - { - "path": "pages/message/message", - "style": { - "navigationBarTitleText": "消息", - "navigationStyle": "custom" - } - }, - { - "path": "pages/message/index", - "style": { - "navigationBarTitleText": "聊天", - "enablePullDownRefresh": false - } - }, { "path": "pages/message/common-phrases", "style": { @@ -38,12 +24,31 @@ "navigationBarTitleText": "宣教文章" } }, + { + "path": "pages/message/article-detail", + "style": { + "navigationBarTitleText": "宣教文章" + } + }, { "path": "pages/message/survey-list", "style": { "navigationBarTitleText": "问卷列表" } }, + { + "path": "pages/webview/webview", + "style": { + "navigationBarTitleText": "预览" + } + }, + { + "path": "pages/message/index", + "style": { + "navigationBarTitleText": "聊天", + "enablePullDownRefresh": false + } + }, { "path": "pages/case/search", "style": { @@ -205,6 +210,48 @@ "style": { "navigationBarTitleText": "上传证照" } + }, + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "授权登录" + } + }, + { + "path": "pages/work/team/invite/invite-patient", + "style": { + "navigationBarTitleText": "邀请患者" + } + }, + { + "path": "pages/work/team/invite/invite-teammate", + "style": { + "navigationBarTitleText": "邀请成员" + } + }, + { + "path": "pages/work/team/list/team-list", + "style": { + "navigationBarTitleText": "我的团队" + } + }, + { + "path": "pages/work/team/edit/team-edit", + "style": { + "navigationBarTitleText": "修改团队信息" + } + }, + { + "path": "pages/work/team/detail/team-detail", + "style": { + "navigationBarTitleText": "团队信息" + } + }, + { + "path": "pages/work/service/contact-service", + "style": { + "navigationBarTitleText": "联系企微客服" + } } ], "globalStyle": { diff --git a/pages/login/login.vue b/pages/login/login.vue index 73fb316..d339408 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -5,12 +5,12 @@ 生命全周期健康管理伙伴 - - @@ -69,8 +69,9 @@ function toHome() { async function getPhoneNumber(e) { const phoneCode = e && e.detail && e.detail.code; - if (e && !phoneCode) return; + // if (e && !phoneCode) return; const res = await login(phoneCode); + if (res && redirectUrl.value) { await attempToPage(redirectUrl.value); } else if (res && !(doctorInfo.value && doctorInfo.value.anotherName)) { diff --git a/pages/login/redirect-page.vue b/pages/login/redirect-page.vue index 14fb39f..37359bb 100644 --- a/pages/login/redirect-page.vue +++ b/pages/login/redirect-page.vue @@ -4,43 +4,66 @@ diff --git a/pages/message/article-list.vue b/pages/message/article-list.vue index 83f488d..97e66ac 100644 --- a/pages/message/article-list.vue +++ b/pages/message/article-list.vue @@ -19,10 +19,10 @@ v-for="cate in categoryList" :key="cate._id || 'all'" class="category-item" - :class="{ active: currentCateId === (cate._id || 'all') }" + :class="{ active: currentCateId === cate._id }" @click="selectCategory(cate)" > - {{ cate.name }} + {{ cate.label }} @@ -54,17 +54,17 @@ > {{ article.title }} - 创建时间:{{ article.date }} - - - + + + + @@ -94,7 +94,9 @@ - + + + @@ -106,22 +108,29 @@ + + diff --git a/pages/work/profile.vue b/pages/work/profile.vue index 3011bd8..06bd33a 100644 --- a/pages/work/profile.vue +++ b/pages/work/profile.vue @@ -72,7 +72,9 @@ const { getDoctorInfo } = useAccountStore(); const job = { assistant: '医生助理', doctor: '医生' }; const form = ref({}); +const inviteTeamId = ref('') const type = ref(''); + const formData = computed(() => ({ ...(doctorInfo.value || {}), ...form.value, mobile: account.value?.mobile })); const cancelText = computed(() => doctorInfo.value ? '取消' : '暂不填写'); const confirmText = computed(() => type.value === 'cert' ? '下一步' : '保存'); @@ -189,6 +191,9 @@ async function save() { if (doctorInfo.value) { data.id = doctorInfo.value._id; } + if (inviteTeamId.value) { + data.inviteTeamId = inviteTeamId.value; + } const res = await api(apiName, data); if (res && res.success) { await getDoctorInfo() @@ -206,6 +211,9 @@ async function save() { useLoad(opts => { type.value = opts?.type; + if (type.value === 'joinTeam' && opts.teamId) { + inviteTeamId.value = opts.teamId + } }) useShow(() => { diff --git a/pages/work/service/contact-service.vue b/pages/work/service/contact-service.vue new file mode 100644 index 0000000..58af50d --- /dev/null +++ b/pages/work/service/contact-service.vue @@ -0,0 +1,25 @@ + + + \ No newline at end of file diff --git a/pages/work/team/detail/team-detail.vue b/pages/work/team/detail/team-detail.vue new file mode 100644 index 0000000..e0bd03b --- /dev/null +++ b/pages/work/team/detail/team-detail.vue @@ -0,0 +1,207 @@ + + + \ No newline at end of file diff --git a/pages/work/team/edit/team-edit.vue b/pages/work/team/edit/team-edit.vue new file mode 100644 index 0000000..93e5cd7 --- /dev/null +++ b/pages/work/team/edit/team-edit.vue @@ -0,0 +1,106 @@ +