fix: 问题修复

This commit is contained in:
huxuejian 2026-03-05 15:03:07 +08:00
parent 5c14cc7e5f
commit 238d8159ed
11 changed files with 94 additions and 65 deletions

View File

@ -58,6 +58,7 @@ const { useLoad, useShow } = useGuard();
const { account } = storeToRefs(useAccount()); const { account } = storeToRefs(useAccount());
const corpId = ref(''); const corpId = ref('');
const teamId = ref(''); const teamId = ref('');
const corpUserId = ref('')
const enableHis = ref(false); const enableHis = ref(false);
const customers = ref([]); const customers = ref([]);
@ -96,6 +97,7 @@ async function unBindArchive(customer) {
useLoad(options => { useLoad(options => {
teamId.value = options.teamId; teamId.value = options.teamId;
corpId.value = options.corpId; corpId.value = options.corpId;
corpUserId.value = options.corpUserId;
}) })
useShow(() => { useShow(() => {

View File

@ -43,6 +43,7 @@ const { account, externalUserId } = storeToRefs(useAccount());
const { getExternalUserId } = useAccount() const { getExternalUserId } = useAccount()
const corpId = ref(''); const corpId = ref('');
const corpName = ref(''); const corpName = ref('');
const corpUserId = ref('');
const customer = ref({}); const customer = ref({});
const customerId = ref(''); const customerId = ref('');
const customers = ref([]); const customers = ref([]);
@ -72,8 +73,8 @@ function change({ title, value }) {
const age = dayjs().diff(birthday, 'year'); const age = dayjs().diff(birthday, 'year');
form.value.age = Math.max(1, age); form.value.age = Math.max(1, age);
} }
} else if (title === 'birthday' && formItems.value.some(i => i.title === 'age')) { } else if (title === 'birthday' && formItems.value.some(i => i.title === 'age') && value && dayjs(value).valueOf()) {
const age = dayjs().diff(birthday, 'year'); const age = dayjs().diff(value, 'year');
form.value.age = Math.max(1, age); form.value.age = Math.max(1, age);
} }
@ -150,7 +151,6 @@ async function addArchive() {
loading.value = false; loading.value = false;
const res = await api('addCustomer', { params }); const res = await api('addCustomer', { params });
if (res && res.success) { if (res && res.success) {
set('home-invite-teamId', teamId.value);
uni.$emit('reloadTeamCustomers') uni.$emit('reloadTeamCustomers')
uni.redirectTo({ uni.redirectTo({
url: `/pages/archive/archive-result?corpId=${corpId.value}&teamId=${teamId.value}` url: `/pages/archive/archive-result?corpId=${corpId.value}&teamId=${teamId.value}`
@ -161,7 +161,7 @@ async function addArchive() {
} }
async function getResponsiblePerson() { async function getResponsiblePerson() {
const res = await api('getResponsiblePerson', { corpId: corpId.value, externalUserId: externalUserId.value, teamId: teamId.value }); const res = await api('getResponsiblePerson', { corpId: corpId.value, externalUserId: externalUserId.value, teamId: teamId.value, corpUserId: corpUserId.value });
return res && res.data ? res.data : '' return res && res.data ? res.data : ''
} }
@ -175,7 +175,6 @@ async function bindArchive(customerId) {
if (res && res.success) { if (res && res.success) {
await toast('绑定成功'); await toast('绑定成功');
uni.$emit('reloadTeamCustomers') uni.$emit('reloadTeamCustomers')
set('home-invite-teamId', teamId.value);
uni.switchTab({ uni.switchTab({
url: '/pages/home/home' url: '/pages/home/home'
}) })
@ -284,6 +283,7 @@ async function unBindArchive() {
onLoad(options => { onLoad(options => {
customerId.value = options.id || ''; customerId.value = options.id || '';
corpUserId.value = options.corpUserId || '';
uni.setNavigationBarTitle({ title: customerId.value ? '编辑档案' : '新增档案' }) uni.setNavigationBarTitle({ title: customerId.value ? '编辑档案' : '新增档案' })
}) })

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="bg-gray-100 min-h-screen"> <full-page pageClass="bg-gray-100">
<!-- Filter Tabs --> <template #header>
<scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full" <scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full"
:show-scrollbar="false"> :show-scrollbar="false">
<view v-for="(tab, index) in tabs" :key="index" <view v-for="(tab, index) in tabs" :key="index"
@ -12,7 +12,7 @@
{{ tab.name }} {{ tab.name }}
</view> </view>
</scroll-view> </scroll-view>
</template>
<!-- Article List --> <!-- Article List -->
<view v-if="loading && articles.length === 0" class="loading-container"> <view v-if="loading && articles.length === 0" class="loading-container">
<uni-icons type="spinner-cycle" size="30" color="#999" /> <uni-icons type="spinner-cycle" size="30" color="#999" />
@ -74,7 +74,7 @@
没有更多了 没有更多了
</view> </view>
</view> </view>
</view> </full-page>
</template> </template>
<script setup> <script setup>
@ -84,6 +84,8 @@ import { storeToRefs } from "pinia";
import dayjs from "dayjs"; import dayjs from "dayjs";
import api from "@/utils/api.js"; import api from "@/utils/api.js";
import useAccountStore from "@/store/account.js"; import useAccountStore from "@/store/account.js";
import fullPage from "@/components/full-page.vue";
import EmptyData from "@/components/empty-data.vue"; import EmptyData from "@/components/empty-data.vue";
const { account, openid } = storeToRefs(useAccountStore()); const { account, openid } = storeToRefs(useAccountStore());

View File

@ -173,7 +173,7 @@ async function getBadgeCount() {
loading = false loading = false
return return
} }
const res = await api('getMiniAppHomeStats', { corpId: props.corpId, teamId: props.teamId, customerIds }) const res = await api('getMiniAppHomeStats', { corpId: props.corpId, teamId: props.teamId, customerIds }, false)
const data = res?.data || {}; const data = res?.data || {};
const article = typeof data.article === 'number' ? data.article : 0; const article = typeof data.article === 'number' ? data.article : 0;
const survey = typeof data.survey === 'number' ? data.survey : 0; const survey = typeof data.survey === 'number' ? data.survey : 0;

View File

@ -82,6 +82,10 @@ const props = defineProps({
type: String, type: String,
default: "", default: "",
}, },
corpUserIds: {
type: Object,
default: () => ({}),
},
customers: { customers: {
type: Array, type: Array,
default: () => [], default: () => [],
@ -157,8 +161,9 @@ function toggle(i) {
} }
function toManagePage() { function toManagePage() {
const corpUserId = props.corpUserIds && props.corpUserIds[props.team.teamId] ? props.corpUserIds[props.team.teamId] : "";
uni.navigateTo({ uni.navigateTo({
url: `/pages/archive/archive-manage?corpId=${props.corpId}&teamId=${props.team.teamId}`, url: `/pages/archive/archive-manage?corpUserId=${corpUserId}&corpId=${props.corpId}&teamId=${props.team.teamId}`,
}); });
} }

View File

@ -5,7 +5,8 @@
<team-head :team="team" :teams="teams" @changeTeam="changeTeam" /> <team-head :team="team" :teams="teams" @changeTeam="changeTeam" />
</template> </template>
<view class="home-section home-section--first"> <view class="home-section home-section--first">
<customer-archive ref="archiveRef" :corpId="corpId" :team="team" @update:customers="handleCustomersUpdate" /> <customer-archive ref="archiveRef" :corpId="corpId" :corpUserIds="corpUserIds" :team="team"
@update:customers="handleCustomersUpdate" />
</view> </view>
<view class="home-section"> <view class="home-section">
<consult ref="consultRef" :corpId="corpId" :teamId="team.teamId" :team="team" :customers="customers" /> <consult ref="consultRef" :corpId="corpId" :teamId="team.teamId" :team="team" :customers="customers" />
@ -48,6 +49,7 @@ const loading = ref(false);
const customers = ref([]); const customers = ref([]);
const consultRef = ref(null); const consultRef = ref(null);
const archiveRef = ref(null); const archiveRef = ref(null);
const corpUserIds = ref({});
const corpId = computed(() => team.value?.corpId); const corpId = computed(() => team.value?.corpId);
@ -71,15 +73,14 @@ async function changeTeam({ teamId, corpId, corpName }) {
} }
} }
async function getTeams() { async function getTeams(inviteTeamId = '') {
loading.value = true; loading.value = true;
const res = await api('getWxappRelateTeams', { openid: account.value.openid }); const res = await api('getWxappRelateTeams', { openid: account.value.openid });
teams.value = res && Array.isArray(res.data) ? res.data : []; teams.value = res && Array.isArray(res.data) ? res.data : [];
const matchTeamId = get('home-invite-teamId') || (team.value ? team.value.teamId : ''); const matchTeamId = inviteTeamId || (team.value ? team.value.teamId : '');
const validTeam = teams.value.find(i => i.teamId && i.teamId === matchTeamId); const validTeam = teams.value.find(i => i.teamId && i.teamId === matchTeamId);
const firstTeam = teams.value[0] const firstTeam = teams.value[0]
if (validTeam || firstTeam) { if (validTeam || firstTeam) {
remove('home-invite-teamId');
changeTeam(validTeam || firstTeam); changeTeam(validTeam || firstTeam);
} else { } else {
team.value = null; team.value = null;
@ -99,8 +100,13 @@ onLoad(() => {
onShow(async () => { onShow(async () => {
if (!account.value) await login(); if (!account.value) await login();
const inviteTeam = get('home-invite-team-info');
remove('home-invite-team-info');
if (inviteTeam && inviteTeam.teamId && inviteTeam.corpUserId) {
corpUserIds.value[inviteTeam.teamId] = inviteTeam.corpUserId;
}
if (account.value && account.value.openid) { if (account.value && account.value.openid) {
getTeams(); getTeams(inviteTeam && inviteTeam.teamId ? inviteTeam.teamId : '');
} else { } else {
teams.value = []; teams.value = [];
} }

View File

@ -110,7 +110,6 @@ async function bindTeam() {
} }
const res1 = await api('getWxAppCustomerCount', { miniAppId: account.value.openid, corpId: team.value.corpId, teamId: team.value.teamId }); const res1 = await api('getWxAppCustomerCount', { miniAppId: account.value.openid, corpId: team.value.corpId, teamId: team.value.teamId });
if (res1 && res1.data > 0) { if (res1 && res1.data > 0) {
set('home-invite-teamId', team.value.teamId);
toHome(); toHome();
} else { } else {
attempToPage(redirectUrl.value) attempToPage(redirectUrl.value)
@ -143,7 +142,7 @@ async function attempToPage(url) {
onLoad((opts) => { onLoad((opts) => {
if (opts.source === "teamInvite") { if (opts.source === "teamInvite") {
team.value = get("invite-team-info"); team.value = get("invite-team-info");
redirectUrl.value = `/pages/archive/edit-archive?teamId=${team.value.teamId}&corpId=${team.value.corpId}`; redirectUrl.value = `/pages/archive/edit-archive?corpUserId=${team.value.corpUserId || ''}&teamId=${team.value.teamId}&corpId=${team.value.corpId}`;
return; return;
} }
redirectUrl.value = opts.redirectUrl || ""; redirectUrl.value = opts.redirectUrl || "";

View File

@ -1,5 +1,5 @@
<template> <template>
<view class="flex flex-col justify-center items-center h-full"> <view class="flex flex-col justify-center items-center h-full" @click="copy()">
<image class="flash-logo" src="/static/logo-plain.png" /> <image class="flash-logo" src="/static/logo-plain.png" />
</view> </view>
</template> </template>
@ -21,23 +21,28 @@ const loading = ref(false);
const team = ref(null); const team = ref(null);
const opts = ref(''); const opts = ref('');
function copy(){ function copy() {
uni.setClipboardData({ uni.setClipboardData({
data:opts.value || '暂无内容' data: opts.value || '暂无内容'
}) })
} }
async function changeTeam({ teamId, corpId }) { async function changeTeam({ teamId, corpId, corpUserId }) {
loading.value = true; loading.value = true;
const res = await api("getTeamData", { teamId, corpId, withCorpName: true }); const res = await api("getTeamData", { teamId, corpId, withCorpName: true });
loading.value = false; loading.value = false;
if (res && res.data) { if (res && res.data) {
team.value = res.data; team.value = res.data;
team.value.corpName = res.data.corpName; team.value.corpName = res.data.corpName;
set('home-invite-team-info', {
teamId: team.value.teamId,
corpUserId: corpUserId || ''
});
if (account.value) { if (account.value) {
bindTeam() bindTeam(corpUserId)
} else { } else {
set("invite-team-info", { set("invite-team-info", {
corpUserId,
corpId: team.value.corpId, corpId: team.value.corpId,
teamId: team.value.teamId, teamId: team.value.teamId,
corpName: team.value.corpName, corpName: team.value.corpName,
@ -56,21 +61,19 @@ async function changeTeam({ teamId, corpId }) {
} }
} }
async function bindTeam() { async function bindTeam(corpUserId) {
const res = await api('bindWxappWithTeam', { appid, corpId: team.value.corpId, teamId: team.value.teamId, openid: account.value.openid }); const res = await api('bindWxappWithTeam', { appid, corpId: team.value.corpId, teamId: team.value.teamId, openid: account.value.openid });
if (!res || !res.success) { if (!res || !res.success) {
return toast("关联团队失败"); return toast("关联团队失败");
} }
const res1 = await api('getWxAppCustomerCount', { miniAppId: account.value.openid, corpId: team.value.corpId, teamId: team.value.teamId }); const res1 = await api('getWxAppCustomerCount', { miniAppId: account.value.openid, corpId: team.value.corpId, teamId: team.value.teamId });
if (res1 && res1.data > 0) { if (res1 && res1.data > 0) {
set('home-invite-teamId', team.value.teamId);
uni.switchTab({ uni.switchTab({
url: "/pages/home/home", url: "/pages/home/home",
}); });
} else { } else {
set('home-invite-teamId', team.value.teamId);
uni.redirectTo({ uni.redirectTo({
url: `/pages/archive/edit-archive?teamId=${team.value.teamId}&corpId=${team.value.corpId}` url: `/pages/archive/edit-archive?corpUserId=${corpUserId || ''}&teamId=${team.value.teamId}&corpId=${team.value.corpId}`
}) })
} }
} }

View File

@ -195,9 +195,9 @@ const getArticleData = (message) => {
// //
const handleArticleClick = (message) => { const handleArticleClick = (message) => {
const { articleId } = getArticleData(message); const { articleId, sendId } = getArticleData(message);
uni.navigateTo({ uni.navigateTo({
url: `/pages/article/article-detail?id=${articleId}&corpId=${props.corpId}`, url: `/pages/article/article-detail?id=${articleId}&sendId=${sendId || ''}&corpId=${props.corpId}`,
}); });
}; };
@ -207,6 +207,7 @@ const getSurveyData = (message) => {
if (message.payload && message.payload.data) { if (message.payload && message.payload.data) {
const data = JSON.parse(message.payload.data); const data = JSON.parse(message.payload.data);
return { return {
...data,
title: data.title || "填写问卷", title: data.title || "填写问卷",
desc: data.desc || "请填写问卷", desc: data.desc || "请填写问卷",
url: data.url || "", url: data.url || "",
@ -221,18 +222,26 @@ const getSurveyData = (message) => {
desc: "请填写问卷", desc: "请填写问卷",
url: "", url: "",
imgUrl: "", imgUrl: "",
err: true
}; };
}; };
// //
const handleSurveyClick = (message) => { const handleSurveyClick = (message) => {
const surveyData = getSurveyData(message); const surveyData = getSurveyData(message);
if (surveyData.url) { if (surveyData.err) {
// return
console.log("打开问卷:", surveyData.url); }
// uni.navigateTo({ if (surveyData.isSystem) {
// url: `/pages/survey/fill?url=${encodeURIComponent(surveyData.url)}` uni.navigateTo({
// }); url: `/pages/web-view/web-view?src=${encodeURIComponent(surveyData.url)}`
})
return
}
if (surveyData.answerId) {
uni.navigateTo({
url: `/pages/survey/fill?name=${surveyData.name}&memberId=${surveyData.memberId}&surveryId=${surveyData.surveryId}&corpId=${surveyData.corpId}&answerId=${surveyData.answerId}`
})
} }
}; };
</script> </script>

View File

@ -47,7 +47,7 @@ export default function useGroupChat(groupID) {
const getUserAvatar = (userId) => { const getUserAvatar = (userId) => {
const member = chatMember.value[userId] const member = chatMember.value[userId]
if (!member) { if (!member) {
return userId === openid.value ? '/static/default-patient-avatar.png' : '/static/default-avatar.svg' return userId === openid.value ? '/static/default-patient-avatar.png' : '/static/default-avatar.png'
} }
// 如果有头像且不为空字符串,返回头像 // 如果有头像且不为空字符串,返回头像
@ -55,7 +55,7 @@ export default function useGroupChat(groupID) {
return member.avatar return member.avatar
} }
return member.isTeamMember ? '/static/default-avatar.svg' : '/static/default-patient-avatar.png' return member.isTeamMember ? '/static/default-avatar.png' : '/static/default-patient-avatar.png'
} }
// 获取群聊信息和成员头像 // 获取群聊信息和成员头像
async function getGroupInfo(id) { async function getGroupInfo(id) {

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="bg-gray-100 min-h-screen"> <full-page pageClass="bg-gray-100">
<!-- Filter Tabs --> <template #header>
<scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full" <scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full"
:show-scrollbar="false"> :show-scrollbar="false">
<view v-for="(tab, index) in tabs" :key="index" <view v-for="(tab, index) in tabs" :key="index"
@ -12,6 +12,7 @@
{{ tab.name }} {{ tab.name }}
</view> </view>
</scroll-view> </scroll-view>
</template>
<!-- Survey List --> <!-- Survey List -->
<view v-if="loading && surveys.length === 0" class="loading-container"> <view v-if="loading && surveys.length === 0" class="loading-container">
@ -73,7 +74,7 @@
没有更多了 没有更多了
</view> </view>
</view> </view>
</view> </full-page>
</template> </template>
<script setup> <script setup>
@ -83,6 +84,8 @@ import { storeToRefs } from "pinia";
import dayjs from "dayjs"; import dayjs from "dayjs";
import api from "@/utils/api.js"; import api from "@/utils/api.js";
import useAccountStore from "@/store/account.js"; import useAccountStore from "@/store/account.js";
import fullPage from "@/components/full-page.vue";
import EmptyData from "@/components/empty-data.vue"; import EmptyData from "@/components/empty-data.vue";