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 corpId = ref('');
const teamId = ref('');
const corpUserId = ref('')
const enableHis = ref(false);
const customers = ref([]);
@ -96,6 +97,7 @@ async function unBindArchive(customer) {
useLoad(options => {
teamId.value = options.teamId;
corpId.value = options.corpId;
corpUserId.value = options.corpUserId;
})
useShow(() => {

View File

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

View File

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

View File

@ -173,7 +173,7 @@ async function getBadgeCount() {
loading = false
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 article = typeof data.article === 'number' ? data.article : 0;
const survey = typeof data.survey === 'number' ? data.survey : 0;

View File

@ -82,6 +82,10 @@ const props = defineProps({
type: String,
default: "",
},
corpUserIds: {
type: Object,
default: () => ({}),
},
customers: {
type: Array,
default: () => [],
@ -157,8 +161,9 @@ function toggle(i) {
}
function toManagePage() {
const corpUserId = props.corpUserIds && props.corpUserIds[props.team.teamId] ? props.corpUserIds[props.team.teamId] : "";
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" />
</template>
<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 class="home-section">
<consult ref="consultRef" :corpId="corpId" :teamId="team.teamId" :team="team" :customers="customers" />
@ -48,6 +49,7 @@ const loading = ref(false);
const customers = ref([]);
const consultRef = ref(null);
const archiveRef = ref(null);
const corpUserIds = ref({});
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;
const res = await api('getWxappRelateTeams', { openid: account.value.openid });
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 firstTeam = teams.value[0]
if (validTeam || firstTeam) {
remove('home-invite-teamId');
changeTeam(validTeam || firstTeam);
} else {
team.value = null;
@ -99,8 +100,13 @@ onLoad(() => {
onShow(async () => {
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) {
getTeams();
getTeams(inviteTeam && inviteTeam.teamId ? inviteTeam.teamId : '');
} else {
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 });
if (res1 && res1.data > 0) {
set('home-invite-teamId', team.value.teamId);
toHome();
} else {
attempToPage(redirectUrl.value)
@ -143,7 +142,7 @@ async function attempToPage(url) {
onLoad((opts) => {
if (opts.source === "teamInvite") {
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;
}
redirectUrl.value = opts.redirectUrl || "";

View File

@ -1,5 +1,5 @@
<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" />
</view>
</template>
@ -21,23 +21,28 @@ const loading = ref(false);
const team = ref(null);
const opts = ref('');
function copy(){
uni.setClipboardData({
data:opts.value || '暂无内容'
})
function copy() {
uni.setClipboardData({
data: opts.value || '暂无内容'
})
}
async function changeTeam({ teamId, corpId }) {
async function changeTeam({ teamId, corpId, corpUserId }) {
loading.value = true;
const res = await api("getTeamData", { teamId, corpId, withCorpName: true });
loading.value = false;
if (res && res.data) {
team.value = res.data;
team.value.corpName = res.data.corpName;
set('home-invite-team-info', {
teamId: team.value.teamId,
corpUserId: corpUserId || ''
});
if (account.value) {
bindTeam()
bindTeam(corpUserId)
} else {
set("invite-team-info", {
corpUserId,
corpId: team.value.corpId,
teamId: team.value.teamId,
corpName: team.value.corpName,
@ -56,27 +61,25 @@ 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 });
if (!res || !res.success) {
return toast("关联团队失败");
}
const res1 = await api('getWxAppCustomerCount', { miniAppId: account.value.openid, corpId: team.value.corpId, teamId: team.value.teamId });
if (res1 && res1.data > 0) {
set('home-invite-teamId', team.value.teamId);
uni.switchTab({
url: "/pages/home/home",
});
} else {
set('home-invite-teamId', team.value.teamId);
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}`
})
}
}
onLoad((options) => {
opts.value = JSON.stringify(options)
opts.value = JSON.stringify(options)
const href =
typeof options.q === "string" ? decodeURIComponent(options.q) : "";
const [, url = ""] = href.split("?");

View File

@ -195,9 +195,9 @@ const getArticleData = (message) => {
//
const handleArticleClick = (message) => {
const { articleId } = getArticleData(message);
const { articleId, sendId } = getArticleData(message);
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) {
const data = JSON.parse(message.payload.data);
return {
...data,
title: data.title || "填写问卷",
desc: data.desc || "请填写问卷",
url: data.url || "",
@ -221,18 +222,26 @@ const getSurveyData = (message) => {
desc: "请填写问卷",
url: "",
imgUrl: "",
err: true
};
};
//
const handleSurveyClick = (message) => {
const surveyData = getSurveyData(message);
if (surveyData.url) {
//
console.log("打开问卷:", surveyData.url);
// uni.navigateTo({
// url: `/pages/survey/fill?url=${encodeURIComponent(surveyData.url)}`
// });
if (surveyData.err) {
return
}
if (surveyData.isSystem) {
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>

View File

@ -47,7 +47,7 @@ export default function useGroupChat(groupID) {
const getUserAvatar = (userId) => {
const member = chatMember.value[userId]
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.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) {

View File

@ -1,17 +1,18 @@
<template>
<view class="bg-gray-100 min-h-screen">
<!-- Filter Tabs -->
<scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full"
:show-scrollbar="false">
<view v-for="(tab, index) in tabs" :key="index"
class="inline-block px-15 py-5 mr-10 text-sm rounded-full border transition-colors" :class="[
activeTab === tab.value
? 'bg-orange-100 text-orange-500 border-orange-500'
: 'bg-white text-gray-600 border-gray-200'
]" @click="selectTab(tab.value)">
{{ tab.name }}
</view>
</scroll-view>
<full-page pageClass="bg-gray-100">
<template #header>
<scroll-view scroll-x class="bg-white whitespace-nowrap px-15 py-10 sticky top-0 z-10 w-full"
:show-scrollbar="false">
<view v-for="(tab, index) in tabs" :key="index"
class="inline-block px-15 py-5 mr-10 text-sm rounded-full border transition-colors" :class="[
activeTab === tab.value
? 'bg-orange-100 text-orange-500 border-orange-500'
: 'bg-white text-gray-600 border-gray-200'
]" @click="selectTab(tab.value)">
{{ tab.name }}
</view>
</scroll-view>
</template>
<!-- Survey List -->
<view v-if="loading && surveys.length === 0" class="loading-container">
@ -73,7 +74,7 @@
没有更多了
</view>
</view>
</view>
</full-page>
</template>
<script setup>
@ -83,6 +84,8 @@ import { storeToRefs } from "pinia";
import dayjs from "dayjs";
import api from "@/utils/api.js";
import useAccountStore from "@/store/account.js";
import fullPage from "@/components/full-page.vue";
import EmptyData from "@/components/empty-data.vue";