Compare commits

..

11 Commits

18 changed files with 1090 additions and 315 deletions

View File

@ -25,7 +25,7 @@ const props = defineProps({
} }
}) })
const list = computed(() => props.avatarList.map(i => i || '/static/default-avatar.png')) const list = computed(() => props.avatarList.map(i => i || '/static/default-avatar.svg'))
const size = computed(() => { const size = computed(() => {
const val = Number.isInteger(props.size) && props.size > 0 ? props.size : 144; const val = Number.isInteger(props.size) && props.size > 0 ? props.size : 144;

View File

@ -1,28 +1,28 @@
{ {
"name": "ykt-team-wxapp", "name" : "ykt-team-wxapp",
"appid": "__UNI__3EBDA15", "appid" : "__UNI__3EBDA15",
"description": "", "description" : "",
"versionName": "1.0.0", "versionName" : "1.0.0",
"versionCode": "100", "versionCode" : "100",
"transformPx": false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus": { "app-plus" : {
"usingComponents": true, "usingComponents" : true,
"nvueStyleCompiler": "uni-app", "nvueStyleCompiler" : "uni-app",
"compilerVersion": 3, "compilerVersion" : 3,
"splashscreen": { "splashscreen" : {
"alwaysShowBeforeRender": true, "alwaysShowBeforeRender" : true,
"waiting": true, "waiting" : true,
"autoclose": true, "autoclose" : true,
"delay": 0 "delay" : 0
}, },
/* */ /* */
"modules": {}, "modules" : {},
/* */ /* */
"distribute": { "distribute" : {
/* android */ /* android */
"android": { "android" : {
"permissions": [ "permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>", "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>", "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>", "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
@ -41,32 +41,32 @@
] ]
}, },
/* ios */ /* ios */
"ios": {}, "ios" : {},
/* SDK */ /* SDK */
"sdkConfigs": {} "sdkConfigs" : {}
} }
}, },
/* */ /* */
"quickapp": {}, "quickapp" : {},
/* */ /* */
"mp-weixin": { "mp-weixin" : {
"appid": "wx93af55767423938e", "appid" : "wx93af55767423938e",
"setting": { "setting" : {
"urlCheck": false "urlCheck" : false
}, },
"usingComponents": true "usingComponents" : true
}, },
"mp-alipay": { "mp-alipay" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-baidu": { "mp-baidu" : {
"usingComponents": true "usingComponents" : true
}, },
"mp-toutiao": { "mp-toutiao" : {
"usingComponents": true "usingComponents" : true
}, },
"uniStatistics": { "uniStatistics" : {
"enable": false "enable" : false
}, },
"vueVersion": "3" "vueVersion" : "3"
} }

View File

@ -13,6 +13,12 @@
"navigationBarTitleText": "我的宣教" "navigationBarTitleText": "我的宣教"
} }
}, },
{
"path": "pages/article/article-cate-list",
"style": {
"navigationBarTitleText": "健康宣教"
}
},
{ {
"path": "pages/survey/survey-list", "path": "pages/survey/survey-list",
"style": { "style": {

View File

@ -0,0 +1,410 @@
<template>
<view class="bg-gray-100 min-h-screen">
<!-- Category 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="[
activeCateId === tab.value
? 'bg-orange-100 text-orange-500 border-orange-500'
: 'bg-white text-gray-600 border-gray-200',
]"
@click="selectCate(tab.value)"
>
{{ tab.name }}
</view>
</scroll-view>
<!-- List -->
<view v-if="loading && list.length === 0" class="loading-container">
<uni-icons type="spinner-cycle" size="30" color="#999" />
<text class="loading-text">加载中...</text>
</view>
<view v-else-if="!loading && list.length === 0" class="empty-container">
<empty-data text="暂无文章" />
</view>
<view v-else class="p-15">
<view
v-for="(item, index) in list"
:key="item._id"
class="article-card flex"
:class="{ 'mb-15': index < list.length - 1 }"
@click="goToDetail(item)"
>
<image
class="flex-shrink-0 cover"
:src="item.cover || '/static/home/health-education.png'"
mode="aspectFill"
/>
<view class="w-0 flex-grow">
<view class="article-title truncate mb-10">
{{ item.title || "宣教文章" }}
</view>
<view v-if="item.summary" class="article-summary line-clamp-2">
{{ item.summary }}
</view>
</view>
</view>
<view v-if="loading && list.length > 0" class="loading-more">
<uni-icons type="spinner-cycle" size="20" color="#999" />
<text>加载中...</text>
</view>
<view v-if="!loading && list.length >= total" class="no-more">
没有更多了
</view>
</view>
</view>
</template>
<script setup>
import { ref } from "vue";
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
import dayjs from "dayjs";
import api from "@/utils/api.js";
import EmptyData from "@/components/empty-data.vue";
const env = __VITE_ENV__;
const defaultCorpId = env.MP_CORP_ID;
const corpId = ref("");
const tabs = ref([{ name: "全部", value: "" }]);
const activeCateId = ref("");
const list = ref([]);
const total = ref(0);
const page = ref(1);
const pageSize = 20;
const loading = ref(false);
const loadCates = async () => {
if (!corpId.value) return;
try {
const res = await api("getArticleCateList", { corpId: corpId.value });
const cates = res && Array.isArray(res.list) ? res.list : [];
tabs.value = [
{ name: "全部", value: "" },
...cates.map((i) => ({ name: i.label || i.name || "未命名", value: i._id })),
];
} catch (err) {
console.error("loadCates failed:", err);
}
};
const loadList = async (reset = false) => {
if (!corpId.value || loading.value) return;
if (reset) {
page.value = 1;
list.value = [];
total.value = 0;
}
loading.value = true;
try {
const params = {
corpId: corpId.value,
page: page.value,
pageSize,
enable: true,
};
if (activeCateId.value) params.cateIds = [activeCateId.value];
const res = await api("getArticleList", params);
const rows = res && Array.isArray(res.list) ? res.list : [];
total.value = Number(res?.total) || 0;
const mapped = rows.map((r) => ({
...r,
time: r?.createTime ? dayjs(r.createTime).format("YYYY-MM-DD") : "",
}));
if (page.value === 1) list.value = mapped;
else list.value = [...list.value, ...mapped];
} catch (err) {
console.error("loadList failed:", err);
} finally {
loading.value = false;
}
};
const selectCate = async (cateId) => {
if (activeCateId.value === cateId) return;
activeCateId.value = cateId;
await loadList(true);
};
function goToDetail(item) {
if (!item?._id) return;
uni.navigateTo({ url: `/pages/article/article-detail?id=${item._id}` });
}
onLoad(async (options) => {
corpId.value = options?.corpId || defaultCorpId || "";
await loadCates();
await loadList(true);
});
onReachBottom(() => {
if (loading.value) return;
if (list.value.length >= total.value) return;
page.value += 1;
loadList(false);
});
</script>
<style scoped>
.min-h-screen {
min-height: 100vh;
}
.bg-gray-100 {
background-color: #f7f8fa;
}
.bg-white {
background-color: #ffffff;
}
.p-15 {
padding: 30rpx;
}
.px-15 {
padding-left: 30rpx;
padding-right: 30rpx;
}
.py-10 {
padding-top: 20rpx;
padding-bottom: 20rpx;
}
.py-5 {
padding-top: 10rpx;
padding-bottom: 10rpx;
}
.px-5 {
padding-left: 10rpx;
padding-right: 10rpx;
}
.mr-10 {
margin-right: 20rpx;
}
.mr-5 {
margin-right: 10rpx;
}
.ml-2 {
margin-left: 10rpx;
}
.mr-2 {
margin-right: 10rpx;
}
.mb-15 {
margin-bottom: 20rpx;
}
.mb-10 {
margin-bottom: 20rpx;
}
.mt-1 {
margin-top: 6rpx;
}
.flex {
display: flex;
}
.items-start {
align-items: flex-start;
}
.items-center {
align-items: center;
}
.justify-between {
justify-content: space-between;
}
.flex-1 {
flex: 1;
}
.flex-grow {
flex-grow: 1;
}
.flex-shrink-0 {
flex-shrink: 0;
}
.w-0 {
width: 0;
}
.relative {
position: relative;
}
.border {
border-width: 1px;
border-style: solid;
}
.rounded-full {
border-radius: 9999px;
}
.rounded {
border-radius: 8rpx;
}
.rounded-lg {
border-radius: 12rpx;
}
.shadow-sm {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.text-xs {
font-size: 22rpx;
}
.text-sm {
font-size: 28rpx;
}
.text-base {
font-size: 32rpx;
}
.font-bold {
font-weight: 600;
}
.leading-normal {
line-height: 1.4;
}
.text-orange-500 {
color: #f29e38;
}
.bg-orange-100 {
background-color: #fff8eb;
}
.border-orange-500 {
border-color: #f29e38;
}
.text-gray-600 {
color: #333333;
}
.text-gray-400 {
color: #999999;
}
.text-gray-800 {
color: #1a1a1a;
}
.border-gray-200 {
border-color: #e5e5e5;
}
.text-green-600 {
color: #4b8d5f;
}
.border-green-600 {
border-color: #4b8d5f;
}
.sticky {
position: sticky;
}
.top-0 {
top: 0;
}
.z-10 {
z-index: 10;
}
.w-full {
width: 100%;
}
.whitespace-nowrap {
white-space: nowrap;
}
.inline-block {
display: inline-block;
}
.tag-box {
border-radius: 4rpx;
line-height: 1.2;
}
.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.article-card {
background: white;
border-radius: 16rpx;
box-shadow: 0 8rpx 10rpx 0 rgba(60, 169, 145, 0.06);
transition: all 0.3s;
min-height: 188rpx;
padding: 20rpx;
align-items: flex-start;
width: 100%;
box-sizing: border-box;
}
.article-card:active {
transform: translateY(-2rpx);
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
}
.cover {
width: 272rpx;
height: 151rpx;
border-radius: 12rpx;
margin-right: 20rpx;
object-fit: cover;
}
.article-title {
color: #333333;
font-size: 32rpx;
font-weight: 500;
line-height: normal;
}
.article-summary {
max-width: 402rpx;
color: #666666;
text-align: justify;
font-size: 28rpx;
font-weight: 400;
line-height: normal;
}
.line-clamp-2 {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
overflow: hidden;
line-height: 1.5;
}
.loading-container,
.empty-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 0;
}
.loading-text {
margin-top: 20rpx;
font-size: 28rpx;
color: #999;
}
.loading-more,
.no-more {
display: flex;
align-items: center;
justify-content: center;
padding: 30rpx 0;
font-size: 24rpx;
color: #999;
gap: 10rpx;
}
</style>

View File

@ -28,8 +28,11 @@
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import api from "@/utils/api.js"; import api from "@/utils/api.js";
import { ref } from "vue"; import { ref } from "vue";
import { storeToRefs } from "pinia";
import useAccountStore from "@/store/account.js";
const env = __VITE_ENV__; const env = __VITE_ENV__;
const corpId = env.MP_CORP_ID; const corpId = env.MP_CORP_ID;
const { account } = storeToRefs(useAccountStore());
const loading = ref(true); const loading = ref(true);
const error = ref(""); const error = ref("");
const articleData = ref({ const articleData = ref({
@ -40,6 +43,16 @@ const articleData = ref({
let articleId = ""; let articleId = "";
const markArticleRead = async () => {
const unionid = account.value?.unionid;
if (!unionid || !articleId) return;
try {
await api("addArticleReadRecord", { corpId, articleId, unionid }, false);
} catch (err) {
console.warn("markArticleRead failed:", err?.message || err);
}
};
// 使 // 使
const processRichTextContent = (html) => { const processRichTextContent = (html) => {
if (!html) return ""; if (!html) return "";
@ -107,6 +120,7 @@ const loadArticle = async () => {
onLoad((options) => { onLoad((options) => {
if (options.id) { if (options.id) {
articleId = options.id; articleId = options.id;
markArticleRead();
loadArticle(); loadArticle();
} else { } else {
error.value = "文章信息不完整"; error.value = "文章信息不完整";

View File

@ -11,16 +11,25 @@
? 'bg-orange-100 text-orange-500 border-orange-500' ? 'bg-orange-100 text-orange-500 border-orange-500'
: 'bg-white text-gray-600 border-gray-200' : 'bg-white text-gray-600 border-gray-200'
]" ]"
@click="activeTab = tab.value" @click="selectTab(tab.value)"
> >
{{ tab.name }} {{ tab.name }}
</view> </view>
</scroll-view> </scroll-view>
<!-- Article List --> <!-- Article List -->
<view class="p-15"> <view v-if="loading && articles.length === 0" class="loading-container">
<uni-icons type="spinner-cycle" size="30" color="#999" />
<text class="loading-text">加载中...</text>
</view>
<view v-else-if="!loading && articles.length === 0" class="empty-container">
<empty-data text="暂无文章" />
</view>
<view v-else class="p-15">
<view <view
v-for="item in filteredArticles" v-for="item in articles"
:key="item._id" :key="item._id"
class="bg-white rounded-lg p-15 mb-15 shadow-sm" class="bg-white rounded-lg p-15 mb-15 shadow-sm"
@click="goToDetail(item)" @click="goToDetail(item)"
@ -30,7 +39,7 @@
<view class="flex items-start flex-1 mr-10 relative"> <view class="flex items-start flex-1 mr-10 relative">
<!-- Tag --> <!-- Tag -->
<view class="text-xs text-green-600 border border-green-600 px-5 rounded mr-5 flex-shrink-0 mt-1 tag-box"> <view class="text-xs text-green-600 border border-green-600 px-5 rounded mr-5 flex-shrink-0 mt-1 tag-box">
{{ item.type }} 宣教文章
</view> </view>
<!-- Title --> <!-- Title -->
<view class="text-base font-bold text-gray-800 leading-normal line-clamp-2"> <view class="text-base font-bold text-gray-800 leading-normal line-clamp-2">
@ -44,86 +53,168 @@
class="text-sm mr-2" class="text-sm mr-2"
:class="item.status === 'UNREAD' ? 'text-red-500' : 'text-gray-400'" :class="item.status === 'UNREAD' ? 'text-red-500' : 'text-gray-400'"
> >
{{ item.status === 'UNREAD' ? '未阅读' : '查看' }} {{ item.status === 'UNREAD' ? '未阅读' : '已阅读' }}
</text> </text>
<uni-icons type="right" size="14" :color="item.status === 'UNREAD' ? '#ef4444' : '#9ca3af'"></uni-icons> <uni-icons type="right" size="14" :color="item.status === 'UNREAD' ? '#ef4444' : '#9ca3af'"></uni-icons>
</view> </view>
</view> </view>
<!-- Content --> <!-- Content -->
<!-- Person --> <view class="text-sm text-gray-600 mb-5 flex items-start">
<view class="text-sm text-gray-600 mb-5 flex items-center"> <text class="text-gray-400 mr-2 field-label">人员:</text>
<text class="text-gray-400 mr-2">人员:</text> <text>{{ item.person || '-' }}</text>
<text>{{ item.person }}</text>
</view> </view>
<!-- Team -->
<view class="text-sm text-gray-600 mb-10 pb-10 border-b border-gray-100 flex items-center"> <view class="text-sm text-gray-600 mb-10 pb-10 border-b border-gray-100 flex items-start">
<text class="text-gray-400 mr-2">团队:</text> <text class="text-gray-400 mr-2 field-label">团队:</text>
<text>{{ item.team }}</text> <text>{{ item.team || '-' }}</text>
</view> </view>
<!-- Footer --> <!-- Footer -->
<view class="text-sm text-gray-400"> <view class="text-sm text-gray-400">
发送时间: {{ item.time }} 发送时间: {{ item.time || '-' }}
</view> </view>
</view> </view>
<view v-if="loading && articles.length > 0" class="loading-more">
<uni-icons type="spinner-cycle" size="20" color="#999" />
<text>加载中...</text>
</view>
<view v-if="!loading && articles.length >= total" class="no-more">
没有更多了
</view>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref } from "vue";
import { onShow, onReachBottom } from "@dcloudio/uni-app";
import { storeToRefs } from "pinia";
import dayjs from "dayjs";
import api from "@/utils/api.js";
import useAccountStore from "@/store/account.js";
import EmptyData from "@/components/empty-data.vue";
// Mock Data const env = __VITE_ENV__;
const tabs = [ const corpId = env.MP_CORP_ID;
{ name: '全部', value: 'ALL' }, const { account, openid } = storeToRefs(useAccountStore());
{ name: '李珊珊 女 37岁', value: '1' },
{ name: '罗小小 女 17岁', value: '2' },
];
const activeTab = ref('ALL'); const tabs = ref([{ name: "全部", value: "" }]);
const activeTab = ref("");
const articles = ref([ const articles = ref([]);
{ const total = ref(0);
_id: 1, const page = ref(1);
type: '宣教文章', const pageSize = 20;
title: '妊糖管理期注意事项!', const loading = ref(false);
status: 'UNREAD', const inited = ref(false);
person: '李珊珊 女 36岁',
team: '妊糖管理服务团队', const selectTab = async (customerId) => {
time: '2026-01-09 15:23', if (activeTab.value === customerId) return;
ownerId: '1' activeTab.value = customerId;
}, await loadArticleList(true);
{ };
_id: 2,
type: '宣教文章', const loadCustomers = async () => {
title: '妊糖管理期注意事项!妊糖管理期注意事项!妊糖管理期注意事项......', const miniAppId = openid.value || uni.getStorageSync("openid");
status: 'READ', if (!miniAppId) return;
person: '李珊珊 女 36岁', try {
team: '妊糖管理服务团队', const res = await api("getMiniAppCustomers", { miniAppId, corpId });
time: '2026-01-09 15:23', if (res && res.success) {
ownerId: '1' const list = Array.isArray(res.data) ? res.data : [];
}, tabs.value = [
{ { name: "全部", value: "" },
_id: 3, ...list.map((c) => ({ name: c.name || "未命名", value: c._id })),
type: '宣教文章', ];
title: '妊糖管理期注意事项!', } else {
status: 'READ', uni.showToast({ title: res?.message || "获取档案失败", icon: "none" });
person: '罗小小 女 16岁',
team: '妊糖管理服务团队',
time: '2026-01-09 15:23',
ownerId: '2'
} }
]); } catch (err) {
console.error("loadCustomers failed:", err);
uni.showToast({ title: "获取档案失败", icon: "none" });
}
};
const filteredArticles = computed(() => { const mapRowToView = (row) => {
if (activeTab.value === 'ALL') return articles.value; const sendTime = row?.sendTime ? dayjs(row.sendTime).format("YYYY-MM-DD HH:mm") : "";
return articles.value.filter(item => item.ownerId === activeTab.value); return {
}); _id: row?._id,
articleId: row?.articleId,
title: row?.articleInfo?.title || "宣教文章",
status: row?.status || "UNREAD",
person: row?.customer?.name || "",
team: row?.team?.name || "-",
time: sendTime,
};
};
const loadArticleList = async (reset = false) => {
if (loading.value) return;
const unionid = account.value?.unionid;
const miniAppId = openid.value || uni.getStorageSync("openid");
if (!unionid && !miniAppId) {
uni.showToast({ title: "未获取到用户信息,请重新登录", icon: "none" });
return;
}
if (reset) {
page.value = 1;
articles.value = [];
total.value = 0;
}
loading.value = true;
try {
const params = {
corpId,
unionid,
miniAppId,
page: page.value,
pageSize,
};
if (activeTab.value) params.customerId = activeTab.value;
const res = await api("getMiniAppReceivedArticleList", params);
if (res && res.success) {
const list = Array.isArray(res.list) ? res.list : [];
total.value = Number(res.total) || 0;
const mapped = list.map(mapRowToView);
if (page.value === 1) articles.value = mapped;
else articles.value = [...articles.value, ...mapped];
} else {
uni.showToast({ title: res?.message || "获取文章失败", icon: "none" });
}
} catch (err) {
console.error("loadArticleList failed:", err);
uni.showToast({ title: "加载失败,请重试", icon: "none" });
} finally {
loading.value = false;
}
};
function goToDetail(item) { function goToDetail(item) {
console.log('Navigate to detail', item); if (!item?.articleId) return;
uni.navigateTo({ url: `/pages/article/article-detail?id=${item.articleId}` });
} }
onShow(async () => {
if (!inited.value) {
await loadCustomers();
await loadArticleList(true);
inited.value = true;
return;
}
await loadArticleList(true);
});
onReachBottom(() => {
if (loading.value) return;
if (articles.value.length >= total.value) return;
page.value += 1;
loadArticleList(false);
});
</script> </script>
<style scoped> <style scoped>
@ -206,4 +297,35 @@ function goToDetail(item) {
line-clamp: 2; line-clamp: 2;
word-break: break-all; word-break: break-all;
} }
.field-label {
flex-shrink: 0;
white-space: nowrap;
}
.loading-container,
.empty-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 0;
}
.loading-text {
margin-top: 20rpx;
font-size: 28rpx;
color: #999;
}
.loading-more,
.no-more {
display: flex;
align-items: center;
justify-content: center;
padding: 30rpx 0;
font-size: 24rpx;
color: #999;
gap: 10rpx;
}
</style> </style>

View File

@ -2,16 +2,25 @@
<view v-if="articles.length" class="article-container"> <view v-if="articles.length" class="article-container">
<view class="flex items-center justify-between"> <view class="flex items-center justify-between">
<view class="module-title">健康宣教</view> <view class="module-title">健康宣教</view>
<view class="flex items-center" @click="toList()"> <view v-if="total > 3" class="flex items-center" @click="toMorePage()">
<view class="mr-5 text-base text-gray">更多</view> <view class="mr-5 text-base text-gray">更多</view>
<image class="arrow-icon" src="/static/home/arrow-right-gray.png" mode="aspectFit"></image> <image class="arrow-icon" src="/static/home/arrow-right-gray.png" mode="aspectFit"></image>
</view> </view>
</view> </view>
<view class="mt-10"> <view class="mt-10">
<view v-for="(article, index) in articles" :key="article._id" <view
v-for="(article, index) in articles"
:key="article._id"
class="article-card flex" class="article-card flex"
:class="{'mb-15': index < articles.length - 1}"> :class="{ 'mb-15': index < articles.length - 1 }"
<image class="flex-shrink-0 cover" :src="article.cover || '/static/home/health-education.png'" mode="aspectFill" /> @click="goToDetail(article)"
>
<image
class="flex-shrink-0 cover"
:src="article.cover || '/static/home/health-education.png'"
mode="aspectFill"
/>
<view class="w-0 flex-grow"> <view class="w-0 flex-grow">
<view class="article-title truncate mb-10"> <view class="article-title truncate mb-10">
{{ article.title }} {{ article.title }}
@ -25,7 +34,7 @@
</view> </view>
</template> </template>
<script setup> <script setup>
import { computed, ref, watch } from 'vue'; import { ref, watch } from "vue";
import api from '@/utils/api'; import api from '@/utils/api';
const props = defineProps({ const props = defineProps({
@ -34,40 +43,75 @@ const props = defineProps({
default: () => ({}) default: () => ({})
} }
}) })
const articles = ref([])
const qrcode = computed(() => { const articles = ref([]);
const qrcodes = props.team && Array.isArray(props.team.qrcodes) ? props.team.qrcodes : []; const total = ref(0);
return qrcodes[0] || {} const page = ref(1);
}) const pageSize = ref(3);
const articleIds = computed(() => { const loading = ref(false);
const articles = qrcode.value && Array.isArray(qrcode.value.articles) ? qrcode.value.articles : [];
const ids = articles.map(item => item._id).filter(i => typeof i === 'string' && i.trim());
return qrcode.value.enableAnnounce === 'YES' ? ids : [];
})
function toList() { function goToDetail(article) {
uni.navigateTo({ url: `/pages/article/article-list?corpId=${props.team.corpId}&ids=${articleIds.value.join()}` }) if (!article?._id) return;
uni.navigateTo({ url: `/pages/article/article-detail?id=${article._id}` });
} }
async function getArticles() { const loadArticles = async (reset = false) => {
const res = await api('getArticleByIds', { corpId: props.team.corpId, ids: articleIds.value.join() }); const corpId = props.team?.corpId || "";
articles.value = res && Array.isArray(res.list) ? res.list : []; if (!corpId || loading.value) return;
} if (reset) {
page.value = 1;
watch(articleIds, n => { articles.value = [];
if (n.length) { total.value = 0;
getArticles()
} else {
articles.value = []
} }
}, { immediate: true }) loading.value = true;
try {
const params = {
corpId,
page: page.value,
pageSize: pageSize.value,
enable: true,
};
const res = await api("getArticleList", params, false);
const list = res && Array.isArray(res.list) ? res.list : [];
total.value = Number(res?.total) || 0;
if (page.value === 1) articles.value = list;
else articles.value = [...articles.value, ...list];
} catch (err) {
console.error("loadArticles failed:", err);
} finally {
loading.value = false;
}
};
function toMorePage() {
const corpId = props.team?.corpId || "";
if (!corpId) return;
uni.navigateTo({ url: `/pages/article/article-cate-list?corpId=${corpId}` });
}
watch(
() => props.team?.corpId,
async (corpId) => {
if (!corpId) {
articles.value = [];
total.value = 0;
page.value = 1;
pageSize.value = 3;
return;
}
pageSize.value = 3;
await loadArticles(true);
},
{ immediate: true }
);
</script> </script>
<style scoped> <style scoped>
.article-container { .article-container {
margin: 0 30rpx; margin: 0 30rpx;
margin-top: 24rpx; margin-top: 24rpx;
padding-bottom: 40rpx; padding-bottom: 40rpx;
width: calc(100% - 60rpx);
box-sizing: border-box;
} }
.arrow-icon { .arrow-icon {
@ -91,6 +135,8 @@ watch(articleIds, n => {
min-height: 188rpx; min-height: 188rpx;
padding: 20rpx; padding: 20rpx;
align-items: flex-start; align-items: flex-start;
width: 100%;
box-sizing: border-box;
} }
.article-card:active { .article-card:active {

View File

@ -1,53 +1,75 @@
<template> <template>
<view class="archive-container"> <view class="archive-container">
<view class="mb-10 flex items-center justify-between"> <view class="mb-10 flex items-center justify-between">
<view class="module-title flex-shrink-0 truncate"> <view class="module-title flex-shrink-0 truncate"> 成员档案 </view>
成员档案 <view
</view> class="flex items-center px-10 leading-normal rounded-sm"
<view class="flex items-center px-10 leading-normal rounded-sm" @click="toManagePage()"> @click="toManagePage()"
<image class="manage-icon mr-5" src="/static/home/archive-manage.png" mode="aspectFit"></image> >
<view style="font-size: 28rpx; color: #065BD6;">档案管理</view> <image
class="manage-icon mr-5"
src="/static/home/archive-manage.png"
mode="aspectFit"
></image>
<view style="font-size: 28rpx; color: #065bd6">档案管理</view>
</view> </view>
</view> </view>
<view v-if="customers.length === 0" class="flex items-center justify-center h-80 border-dashed text-dark rounded"> <view
v-if="customers.length === 0"
class="flex items-center justify-center h-80 border-dashed text-dark rounded"
>
<uni-icons type="plusempty" size="16" color="#999"></uni-icons> <uni-icons type="plusempty" size="16" color="#999"></uni-icons>
<view class="text-base text-dark">新建档案</view> <view class="text-base text-dark">新建档案</view>
</view> </view>
<scroll-view scroll-x="true"> <scroll-view scroll-x="true">
<view class="flex flex-nowrap pb-5 "> <view class="flex flex-nowrap pb-5">
<view v-for="i in customers" :key="i._id" class="customer-card flex-shrink-0 mr-15 relative" <view
:class="current && i._id === current._id ? 'current-customer' : ''" @click="toggle(i)"> v-for="i in customers"
:key="i._id"
class="customer-card flex-shrink-0 mr-15 relative"
:class="current && i._id === current._id ? 'current-customer' : ''"
@click="toggle(i)"
>
<!-- 关系标签 --> <!-- 关系标签 -->
<view v-if="i.relationship" class="relationship-tag" <view
:class="i.relationship === '本人' ? 'tag-blue' : 'tag-green'"> v-if="i.relationship"
class="relationship-tag"
:class="i.relationship === '本人' ? 'tag-blue' : 'tag-green'"
>
{{ i.relationship }} {{ i.relationship }}
</view> </view>
<view class="flex flex-col items-center"> <view class="flex flex-col items-center">
<view class="customer-name text-lg leading-normal font-semibold whitespace-nowrap mb-8" <view
:class="current && i._id === current._id ? 'text-primary' : 'text-dark'"> class="customer-name text-lg leading-normal font-semibold whitespace-nowrap"
:class="
current && i._id === current._id ? 'text-primary' : 'text-dark'
"
>
{{ i.name }} {{ i.name }}
</view> </view>
<view class="flex items-center mb-5">
<image v-if="i.sex" class="sex-icon mr-5"
:src="i.sex === '男' ? '/static/home/male.svg' : '/static/home/female.svg'" />
<view class="customer-age text-base leading-normal text-gray">
{{ i.age > 0 ? i.age + '岁' : '' }}
</view>
</view>
</view> </view>
<!-- 选中状态底部条和三角 --> <!-- 选中状态底部条和三角 -->
<view v-if="current && i._id === current._id" class="active-indicator"> <view
v-if="current && i._id === current._id"
class="active-indicator"
>
<view class="active-bar"></view> <view class="active-bar"></view>
<view class="active-triangle"></view> <view class="active-triangle"></view>
</view> </view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view v-if="canAuth" class="px-10 py-5 mt-5 flex items-center bg-danger rounded-sm"> <view
v-if="canAuth"
class="px-10 py-5 mt-5 flex items-center bg-danger rounded-sm"
>
<view class="mr-5 w-0 flex-grow text-base text-white"> <view class="mr-5 w-0 flex-grow text-base text-white">
点击右侧授权按钮, 我们将更精准的为您服务 点击右侧授权按钮, 我们将更精准的为您服务
</view> </view>
<view class="px-12 py-5 text-base rounded-sm text-dark bg-white" @click="auth()"> <view
class="px-12 py-5 text-base rounded-sm text-dark bg-white"
@click="auth()"
>
授权 授权
</view> </view>
</view> </view>
@ -57,18 +79,32 @@
<view class="info-content"> <view class="info-content">
<view class="flex items-center justify-between mb-8"> <view class="flex items-center justify-between mb-8">
<view class="info-title">个人基本信息</view> <view class="info-title">个人基本信息</view>
<image class="arrow-icon-small" src="/static/home/arrow-right-blue.png" mode="aspectFit"></image> <image
class="arrow-icon-small"
src="/static/home/arrow-right-blue.png"
mode="aspectFit"
></image>
</view> </view>
<view v-if="baseInfoError" class="text-sm text-danger">请完善您的个人信息</view> <view v-if="baseInfoError" class="text-sm text-danger"
>请完善您的个人信息</view
>
<view v-else class="info-subtitle">完善个人信息</view> <view v-else class="info-subtitle">完善个人信息</view>
</view> </view>
</view> </view>
<view v-if="hasHealthTemp" class="ml-10 info-card-new flex-grow" @click="toHealthList()"> <view
v-if="hasHealthTemp"
class="ml-10 info-card-new flex-grow"
@click="toHealthList()"
>
<view class="info-bg info-bg-health"></view> <view class="info-bg info-bg-health"></view>
<view class="info-content"> <view class="info-content">
<view class="flex items-center justify-between mb-8"> <view class="flex items-center justify-between mb-8">
<view class="info-title">健康信息</view> <view class="info-title">健康信息</view>
<image class="arrow-icon-small" src="/static/home/arrow-right-blue.png" mode="aspectFit"></image> <image
class="arrow-icon-small"
src="/static/home/arrow-right-blue.png"
mode="aspectFit"
></image>
</view> </view>
<view class="info-subtitle">上传健康档案</view> <view class="info-subtitle">上传健康档案</view>
</view> </view>
@ -77,28 +113,28 @@
</view> </view>
</template> </template>
<script setup> <script setup>
import { computed, onMounted, ref, watch } from 'vue'; import { computed, onMounted, ref, watch } from "vue";
import { storeToRefs } from 'pinia' import { storeToRefs } from "pinia";
import useAccount from '@/store/account'; import useAccount from "@/store/account";
import api from '@/utils/api'; import api from "@/utils/api";
import { toast, confirm } from '@/utils/widget'; import { toast, confirm } from "@/utils/widget";
const props = defineProps({ const props = defineProps({
corpId: { corpId: {
type: String, type: String,
default: '' default: "",
}, },
customers: { customers: {
type: Array, type: Array,
default: () => [] default: () => [],
}, },
team: { team: {
type: Object, type: Object,
default: () => ({}) default: () => ({}),
} },
}) });
const emit = defineEmits(['update:customers']); const emit = defineEmits(["update:customers"]);
const { account } = storeToRefs(useAccount()); const { account } = storeToRefs(useAccount());
const current = ref(null); const current = ref(null);
@ -106,41 +142,61 @@ const customers = ref([]);
const canAuth = computed(() => { const canAuth = computed(() => {
if (current.value && props.team && props.team.teamId) { if (current.value && props.team && props.team.teamId) {
const teamIds = Array.isArray(current.value.teamId) ? current.value.teamId : []; const teamIds = Array.isArray(current.value.teamId)
? current.value.teamId
: [];
return !teamIds.includes(props.team.teamId); return !teamIds.includes(props.team.teamId);
} }
return false return false;
}) });
const qrcode = computed(() => { const qrcode = computed(() => {
const qrcodes = props.team && Array.isArray(props.team.qrcodes) ? props.team.qrcodes : []; const qrcodes =
return qrcodes[0] || '' props.team && Array.isArray(props.team.qrcodes) ? props.team.qrcodes : [];
}) return qrcodes[0] || "";
});
const hasHealthTemp = computed(() => qrcode.value && Array.isArray(qrcode.value.healthTempList) && qrcode.value.healthTempList.length > 0) const hasHealthTemp = computed(
const baseInfo = computed(() => qrcode.value && qrcode.value.teamFileds && Array.isArray(qrcode.value.teamFileds.baseInfo) ? qrcode.value.teamFileds.baseInfo : []) () =>
qrcode.value &&
Array.isArray(qrcode.value.healthTempList) &&
qrcode.value.healthTempList.length > 0
);
const baseInfo = computed(() =>
qrcode.value &&
qrcode.value.teamFileds &&
Array.isArray(qrcode.value.teamFileds.baseInfo)
? qrcode.value.teamFileds.baseInfo
: []
);
const baseInfoError = computed(() => { const baseInfoError = computed(() => {
const requiredTitles = baseInfo.value.filter(i => i.required).map(i => i.title); const requiredTitles = baseInfo.value
return current.value && requiredTitles.some(i => !current.value[i]); .filter((i) => i.required)
}) .map((i) => i.title);
return current.value && requiredTitles.some((i) => !current.value[i]);
});
function fillBaseInfo() { function fillBaseInfo() {
if (canAuth.value) { if (canAuth.value) {
toast('请先授权本服务团队') toast("请先授权本服务团队");
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: `/pages/archive/edit-archive?teamId=${props.team.teamId}&corpId=${props.corpId}&id=${current.value._id}` url: `/pages/archive/edit-archive?teamId=${props.team.teamId}&corpId=${props.corpId}&id=${current.value._id}`,
}) });
} }
} }
function toHealthList() { function toHealthList() {
if (canAuth.value) { if (canAuth.value) {
toast('请先授权本服务团队') toast("请先授权本服务团队");
} else { } else {
const name = `${current.value.name} ${current.value.relationship ? `(${current.value.relationship})` : ''}` const name = `${current.value.name} ${
current.value.relationship ? `(${current.value.relationship})` : ""
}`;
uni.navigateTo({ uni.navigateTo({
url: `/pages/health/list?teamId=${props.team.teamId}&corpId=${props.corpId}&id=${current.value._id}&name=${encodeURIComponent(name)}` url: `/pages/health/list?teamId=${props.team.teamId}&corpId=${
}) props.corpId
}&id=${current.value._id}&name=${encodeURIComponent(name)}`,
});
} }
} }
@ -149,54 +205,67 @@ function toggle(i) {
} }
function toManagePage() { function toManagePage() {
uni.navigateTo({ url: `/pages/archive/archive-manage?corpId=${props.corpId}&teamId=${props.team.teamId}` }) uni.navigateTo({
url: `/pages/archive/archive-manage?corpId=${props.corpId}&teamId=${props.team.teamId}`,
});
} }
async function auth() { async function auth() {
await confirm(`是否授权${props.team.name}提供服务`); await confirm(`是否授权${props.team.name}提供服务`);
const res = await api('authCustomerToTeam', { corpId: props.corpId, teamId: props.team.teamId, id: current.value._id }); const res = await api("authCustomerToTeam", {
corpId: props.corpId,
teamId: props.team.teamId,
id: current.value._id,
});
if (res && res.success) { if (res && res.success) {
await toast('授权成功'); await toast("授权成功");
getCustomers() getCustomers();
} else { } else {
toast(res?.message || '授权失败'); toast(res?.message || "授权失败");
} }
} }
async function getCustomers() { async function getCustomers() {
const res = await api('getMiniAppCustomers', { miniAppId: account.value.openid, corpId: props.corpId }); const res = await api("getMiniAppCustomers", {
miniAppId: account.value.openid,
corpId: props.corpId,
});
if (res && res.success) { if (res && res.success) {
customers.value = res && Array.isArray(res.data) ? res.data : []; customers.value = res && Array.isArray(res.data) ? res.data : [];
const customer = customers.value.find(i => current.value && i._id === current.value._id); const customer = customers.value.find(
(i) => current.value && i._id === current.value._id
);
current.value = customer || customers.value[0] || null; current.value = customer || customers.value[0] || null;
// customers // customers
emit('update:customers', customers.value); emit("update:customers", customers.value);
} else { } else {
toast(res.message || '获取档案失败'); toast(res.message || "获取档案失败");
} }
} }
onMounted(() => { onMounted(() => {
uni.$on('reloadTeamCustomers', getCustomers) uni.$on("reloadTeamCustomers", getCustomers);
}) });
watch(() => props.corpId, n => { watch(
() => props.corpId,
(n) => {
if (n) { if (n) {
getCustomers() getCustomers();
} else { } else {
customers.value = []; customers.value = [];
} }
}, { immediate: true }); },
{ immediate: true }
);
</script> </script>
<style scoped> <style scoped>
.archive-container { .archive-container {
padding: 24rpx 30rpx; padding: 24rpx 30rpx;
margin: 0 30rpx; margin: 0 30rpx;
background: linear-gradient(181deg, #C2DCFF 1.01%, #FFFFFF 43.31%); background: linear-gradient(181deg, #c2dcff 1.01%, #ffffff 43.31%);
border-radius: 16rpx; border-radius: 16rpx;
box-shadow: box-shadow: inset 0 2rpx 0 0 rgba(255, 255, 255, 0.82),
inset 0 2rpx 0 0 rgba(255, 255, 255, 0.82),
0 8rpx 10rpx 0 rgba(60, 169, 145, 0.06); 0 8rpx 10rpx 0 rgba(60, 169, 145, 0.06);
} }
@ -214,24 +283,20 @@ watch(() => props.corpId, n => {
.customer-card { .customer-card {
width: 160rpx; width: 160rpx;
height: 160rpx; height: 110rpx;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: linear-gradient(180deg, #FFFFFF 0%, #E6EFFB 100%); background: linear-gradient(180deg, #ffffff 0%, #e6effb 100%);
border-radius: 12rpx; border-radius: 12rpx;
border: 2rpx solid #AECAF2; border: 2rpx solid #aecaf2;
transition: all 0.2s; transition: all 0.2s;
position: relative; position: relative;
} }
.current-customer { .current-customer {
background: #FFFFFF; background: #ffffff;
border: 2rpx solid #065BD6; border: 2rpx solid #065bd6;
}
.customer-name {
margin-top: 12rpx;
} }
.relationship-tag { .relationship-tag {
@ -248,7 +313,7 @@ watch(() => props.corpId, n => {
} }
.relationship-tag::after { .relationship-tag::after {
content: ''; content: "";
position: absolute; position: absolute;
right: 0; right: 0;
bottom: -8rpx; bottom: -8rpx;
@ -258,19 +323,19 @@ watch(() => props.corpId, n => {
} }
.tag-blue { .tag-blue {
background: #065BD6; background: #065bd6;
} }
.tag-blue::after { .tag-blue::after {
border-top: 8rpx solid #003F96; border-top: 8rpx solid #003f96;
} }
.tag-green { .tag-green {
background: #1DBF98; background: #1dbf98;
} }
.tag-green::after { .tag-green::after {
border-top: 8rpx solid #0F8C6D; border-top: 8rpx solid #0f8c6d;
} }
.active-indicator { .active-indicator {
@ -298,14 +363,10 @@ watch(() => props.corpId, n => {
transform: translateX(-50%) rotate(45deg); transform: translateX(-50%) rotate(45deg);
width: 12rpx; width: 12rpx;
height: 12rpx; height: 12rpx;
background: #065BD6; background: #065bd6;
margin-top: -8rpx; margin-top: -8rpx;
} }
.customer-age {
color: #999999;
}
.mr-15 { .mr-15 {
margin-right: 20rpx; margin-right: 20rpx;
} }
@ -318,16 +379,11 @@ watch(() => props.corpId, n => {
margin-bottom: 12rpx; margin-bottom: 12rpx;
} }
.sex-icon {
width: 32rpx;
height: 32rpx;
}
.info-card-new { .info-card-new {
position: relative; position: relative;
padding: 24rpx; padding: 24rpx;
border-radius: 16rpx; border-radius: 16rpx;
background: linear-gradient(115deg, #F4F9FF 14.74%, #DBEAFF 66.11%); background: linear-gradient(115deg, #f4f9ff 14.74%, #dbeaff 66.11%);
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06); box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
overflow: hidden; overflow: hidden;
width: 310rpx; width: 310rpx;
@ -354,22 +410,21 @@ watch(() => props.corpId, n => {
} }
.info-bg-base { .info-bg-base {
background-image: url('/static/home/basic-info-bg.svg'); background-image: url("/static/home/basic-info-bg.svg");
} }
.info-bg-health { .info-bg-health {
background-image: url('/static/home/health-info-bg.svg'); background-image: url("/static/home/health-info-bg.svg");
} }
.info-title { .info-title {
color: #213E80; color: #213e80;
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
} }
.info-subtitle { .info-subtitle {
color: #78808F; color: #78808f;
font-size: 24rpx; font-size: 24rpx;
} }

View File

@ -13,7 +13,7 @@
<view v-for="i in teamates" :key="i.userid" <view v-for="i in teamates" :key="i.userid"
class="member-card flex flex-shrink-0 min-w-120 mr-15 p-15" class="member-card flex flex-shrink-0 min-w-120 mr-15 p-15"
@click="toHomePage(i)"> @click="toHomePage(i)">
<image class="flex-shrink-0 avatar mr-10" :src="i.avatar || '/static/default-avatar.png'" /> <image class="flex-shrink-0 avatar mr-10" :src="i.avatar || '/static/default-avatar.svg'" />
<view class="flex-grow flex flex-col justify-between"> <view class="flex-grow flex flex-col justify-between">
<view> <view>
<view class="member-name leading-normal h-24 text-base font-semibold text-dark whitespace-nowrap"> <view class="member-name leading-normal h-24 text-base font-semibold text-dark whitespace-nowrap">

View File

@ -9,7 +9,7 @@ import useTeamStore from '@/store/team.js'
export default function useGroupAvatars() { export default function useGroupAvatars() {
const groupAvatarMap = ref({}) // { groupID: [avatarUrl1, avatarUrl2, ...] } const groupAvatarMap = ref({}) // { groupID: [avatarUrl1, avatarUrl2, ...] }
const teamStore = useTeamStore() const teamStore = useTeamStore()
const patientDefaultAvatar = '/static/default-avatar.png' const patientDefaultAvatar = '/static/default-avatar.svg'
/** /**
* 获取单个群聊的头像列表 * 获取单个群聊的头像列表

View File

@ -45,8 +45,8 @@ export default function useGroupChat(groupID) {
const member = chatMember.value[userId] const member = chatMember.value[userId]
if (!member) { if (!member) {
// 如果找不到成员信息,根据是否为团队成员返回默认头像 // 如果找不到成员信息,根据是否为团队成员返回默认头像
// 团队成员和患者都使用 default-avatar.png // 团队成员和患者都使用 default-avatar.svg
return '/static/default-avatar.png' return '/static/default-avatar.svg'
} }
// 如果有头像且不为空字符串,返回头像 // 如果有头像且不为空字符串,返回头像
@ -55,7 +55,7 @@ export default function useGroupChat(groupID) {
} }
// 否则使用默认头像 // 否则使用默认头像
return '/static/default-avatar.png' return '/static/default-avatar.svg'
} }
// 获取群聊信息和成员头像 // 获取群聊信息和成员头像

View File

@ -11,16 +11,25 @@
? 'bg-orange-100 text-orange-500 border-orange-500' ? 'bg-orange-100 text-orange-500 border-orange-500'
: 'bg-white text-gray-600 border-gray-200' : 'bg-white text-gray-600 border-gray-200'
]" ]"
@click="activeTab = tab.value" @click="selectTab(tab.value)"
> >
{{ tab.name }} {{ tab.name }}
</view> </view>
</scroll-view> </scroll-view>
<!-- Survey List --> <!-- Survey List -->
<view class="p-15"> <view v-if="loading && surveys.length === 0" class="loading-container">
<uni-icons type="spinner-cycle" size="30" color="#999" />
<text class="loading-text">加载中...</text>
</view>
<view v-else-if="!loading && surveys.length === 0" class="empty-container">
<empty-data text="暂无问卷" />
</view>
<view v-else class="p-15">
<view <view
v-for="item in filteredSurveys" v-for="item in surveys"
:key="item._id" :key="item._id"
class="bg-white rounded-lg p-15 mb-15 shadow-sm" class="bg-white rounded-lg p-15 mb-15 shadow-sm"
@click="goToDetail(item)" @click="goToDetail(item)"
@ -30,7 +39,7 @@
<view class="flex items-start flex-1 mr-10 relative"> <view class="flex items-start flex-1 mr-10 relative">
<!-- Tag --> <!-- Tag -->
<view class="text-xs text-green-600 border border-green-600 px-5 rounded mr-5 flex-shrink-0 mt-1 tag-box"> <view class="text-xs text-green-600 border border-green-600 px-5 rounded mr-5 flex-shrink-0 mt-1 tag-box">
{{ item.type }} 问卷调查
</view> </view>
<!-- Title --> <!-- Title -->
<view class="text-base font-bold text-gray-800 leading-normal line-clamp-2"> <view class="text-base font-bold text-gray-800 leading-normal line-clamp-2">
@ -38,93 +47,166 @@
</view> </view>
</view> </view>
<!-- Status --> <!-- Status (暂不展示未填写/已填写) -->
<view class="flex items-center flex-shrink-0 ml-2"> <view class="flex items-center flex-shrink-0 ml-2">
<text <text class="text-sm mr-2 text-gray-400">查看</text>
class="text-sm mr-2" <uni-icons type="right" size="14" color="#9ca3af"></uni-icons>
:class="item.status === 'UNFILLED' ? 'text-red-500' : 'text-gray-400'"
>
{{ item.status === 'UNFILLED' ? '未填写' : '查看' }}
</text>
<uni-icons type="right" size="14" :color="item.status === 'UNFILLED' ? '#ef4444' : '#9ca3af'"></uni-icons>
</view> </view>
</view> </view>
<!-- Content --> <!-- Content -->
<!-- Person --> <view class="text-sm text-gray-600 mb-5 flex items-start">
<view class="text-sm text-gray-600 mb-5 flex items-center"> <text class="text-gray-400 mr-2 field-label">人员:</text>
<text class="text-gray-400 mr-2">人员:</text> <text>{{ item.person || '-' }}</text>
<text>{{ item.person }}</text>
</view> </view>
<!-- Team -->
<view class="text-sm text-gray-600 mb-10 pb-10 border-b border-gray-100 flex items-center"> <view class="text-sm text-gray-600 mb-10 pb-10 border-b border-gray-100 flex items-start">
<text class="text-gray-400 mr-2">团队:</text> <text class="text-gray-400 mr-2 field-label">团队:</text>
<text>{{ item.team }}</text> <text>{{ item.team || '-' }}</text>
</view> </view>
<!-- Footer --> <!-- Footer -->
<view class="text-sm text-gray-400"> <view class="text-sm text-gray-400">
发送时间: {{ item.time }} 发送时间: {{ item.time || '-' }}
</view> </view>
</view> </view>
<view v-if="loading && surveys.length > 0" class="loading-more">
<uni-icons type="spinner-cycle" size="20" color="#999" />
<text>加载中...</text>
</view>
<view v-if="!loading && surveys.length >= total" class="no-more">
没有更多了
</view>
</view> </view>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref, computed } from 'vue'; import { ref } from "vue";
import { onShow, onReachBottom } from "@dcloudio/uni-app";
import { storeToRefs } from "pinia";
import dayjs from "dayjs";
import api from "@/utils/api.js";
import useAccountStore from "@/store/account.js";
import EmptyData from "@/components/empty-data.vue";
// Mock Data const env = __VITE_ENV__;
const tabs = [ const corpId = env.MP_CORP_ID;
{ name: '全部', value: 'ALL' }, const { openid } = storeToRefs(useAccountStore());
{ name: '李珊珊 女 37岁', value: '1' },
{ name: '罗小小 女 17岁', value: '2' },
];
const activeTab = ref('ALL'); const tabs = ref([{ name: "全部", value: "" }]);
const activeTab = ref("");
const surveys = ref([ const surveys = ref([]);
{ const total = ref(0);
_id: 1, const page = ref(1);
type: '问卷调查', const pageSize = 20;
title: '门诊满意度调查问卷', const loading = ref(false);
status: 'UNFILLED', const inited = ref(false);
person: '李珊珊 女 36岁',
team: '妊糖管理服务团队', const selectTab = async (memberId) => {
time: '2026-01-09 15:23', if (activeTab.value === memberId) return;
ownerId: '1' activeTab.value = memberId;
}, await loadSurveyList(true);
{ };
_id: 2,
type: '问卷调查', const loadCustomers = async () => {
title: 'xxxx术后1周随访调查问卷', const miniAppId = openid.value || uni.getStorageSync("openid");
status: 'FILLED', if (!miniAppId) return;
person: '李珊珊 女 36岁', try {
team: '妊糖管理服务团队', const res = await api("getMiniAppCustomers", { miniAppId, corpId });
time: '2026-01-09 15:23', if (res && res.success) {
ownerId: '1' const list = Array.isArray(res.data) ? res.data : [];
}, tabs.value = [
{ { name: "全部", value: "" },
_id: 3, ...list.map((c) => ({ name: c.name || "未命名", value: c._id })),
type: '问卷调查', ];
title: 'xxxxx术后2周随访调查问卷', } else {
status: 'FILLED', uni.showToast({ title: res?.message || "获取档案失败", icon: "none" });
person: '罗小小 女 16岁',
team: '妊糖管理服务团队',
time: '2026-01-09 15:23',
ownerId: '2'
} }
]); } catch (err) {
console.error("loadCustomers failed:", err);
uni.showToast({ title: "获取档案失败", icon: "none" });
}
};
const filteredSurveys = computed(() => { const mapRowToView = (row) => {
if (activeTab.value === 'ALL') return surveys.value; const sendTime = row?.createTime ? dayjs(row.createTime).format("YYYY-MM-DD HH:mm") : "";
return surveys.value.filter(item => item.ownerId === activeTab.value); return {
_id: row?._id,
surveryId: row?.surveryId,
title: row?.name || "问卷调查",
person: row?.customer?.name || "",
team: row?.team?.name || "-",
time: sendTime,
status: row?.status || "",
};
};
const loadSurveyList = async (reset = false) => {
if (loading.value) return;
const miniAppId = openid.value || uni.getStorageSync("openid");
if (!miniAppId) {
uni.showToast({ title: "未获取到用户信息,请重新登录", icon: "none" });
return;
}
if (reset) {
page.value = 1;
surveys.value = [];
total.value = 0;
}
loading.value = true;
try {
const params = {
corpId,
miniAppId,
page: page.value,
pageSize,
};
if (activeTab.value) params.memberId = activeTab.value;
const res = await api("getMiniAppReceivedSurveryList", params);
if (res && res.success) {
const list = Array.isArray(res.list) ? res.list : [];
total.value = Number(res.total) || 0;
const mapped = list.map(mapRowToView);
if (page.value === 1) surveys.value = mapped;
else surveys.value = [...surveys.value, ...mapped];
} else {
uni.showToast({ title: res?.message || "获取问卷失败", icon: "none" });
}
} catch (err) {
console.error("loadSurveyList failed:", err);
uni.showToast({ title: "加载失败,请重试", icon: "none" });
} finally {
loading.value = false;
}
};
function goToDetail() {
uni.showToast({ title: "详情暂未接入", icon: "none" });
}
onShow(async () => {
if (!inited.value) {
await loadCustomers();
await loadSurveyList(true);
inited.value = true;
return;
}
await loadSurveyList(true);
}); });
function goToDetail(item) { onReachBottom(() => {
console.log('Navigate to detail', item); if (loading.value) return;
// Add actual navigation logic here later if (surveys.value.length >= total.value) return;
} page.value += 1;
loadSurveyList(false);
});
</script> </script>
<style scoped> <style scoped>
@ -207,4 +289,35 @@ function goToDetail(item) {
line-clamp: 2; line-clamp: 2;
word-break: break-all; word-break: break-all;
} }
.field-label {
flex-shrink: 0;
white-space: nowrap;
}
.loading-container,
.empty-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 0;
}
.loading-text {
margin-top: 20rpx;
font-size: 28rpx;
color: #999;
}
.loading-more,
.no-more {
display: flex;
align-items: center;
justify-content: center;
padding: 30rpx 0;
font-size: 24rpx;
color: #999;
gap: 10rpx;
}
</style> </style>

View File

@ -2,7 +2,7 @@
<view v-if="member" class="flex flex-col h-full items-center justify-center"> <view v-if="member" class="flex flex-col h-full items-center justify-center">
<view class="business-card"> <view class="business-card">
<view class="flex"> <view class="flex">
<image class="mr-10 avatar" :src="member.avatar || '/static/default-avatar.png'"></image> <image class="mr-10 avatar" :src="member.avatar || '/static/default-avatar.svg'"></image>
<view class="w-0 flex-grow leading-normal"> <view class="w-0 flex-grow leading-normal">
<view class="flex items-center"> <view class="flex items-center">
<view class="mr-5 text-lg font-semibold text-dark">{{ member.anotherName }}</view> <view class="mr-5 text-lg font-semibold text-dark">{{ member.anotherName }}</view>

View File

@ -20,7 +20,7 @@
</view> </view>
<view v-for="i in teammate.leaders" :key="i._id" class="mt-12 flex p-10 border-primary rounded-sm" <view v-for="i in teammate.leaders" :key="i._id" class="mt-12 flex p-10 border-primary rounded-sm"
@click="toHomePage(i.userid)"> @click="toHomePage(i.userid)">
<image class="flex-shrink-0 mr-10 avatar" :src="i.avatar || '/static/default-avatar.png'"></image> <image class="flex-shrink-0 mr-10 avatar" :src="i.avatar || '/static/default-avatar.svg'"></image>
<view class="w-0 flex-grow leading-normal"> <view class="w-0 flex-grow leading-normal">
<view class="flex items-center justify-between"> <view class="flex items-center justify-between">
<view class="flex-shrink-0 mr-5 view-lg text-dark font-semibold">{{ i.anotherName }}</view> <view class="flex-shrink-0 mr-5 view-lg text-dark font-semibold">{{ i.anotherName }}</view>
@ -45,7 +45,7 @@
</view> </view>
<view v-for="i in teammate.members" :key="i._id" class="mt-12 flex p-10 border-primary rounded-sm" <view v-for="i in teammate.members" :key="i._id" class="mt-12 flex p-10 border-primary rounded-sm"
@click="toHomePage(i.userid)"> @click="toHomePage(i.userid)">
<image class="flex-shrink-0 mr-10 avatar" :src="i.avatar || '/static/default-avatar.png'"></image> <image class="flex-shrink-0 mr-10 avatar" :src="i.avatar || '/static/default-avatar.svg'"></image>
<view class="w-0 flex-grow leading-normal"> <view class="w-0 flex-grow leading-normal">
<view class="flex items-center justify-between"> <view class="flex items-center justify-between">
<view class="flex-shrink-0 mr-5 view-lg text-dark font-semibold">{{ i.anotherName }}</view> <view class="flex-shrink-0 mr-5 view-lg text-dark font-semibold">{{ i.anotherName }}</view>
@ -83,7 +83,7 @@ const { memberJob, memberList: list } = useJob();
const memberList = computed(() => team.value && Array.isArray(team.value.memberList) ? team.value.memberList : []) const memberList = computed(() => team.value && Array.isArray(team.value.memberList) ? team.value.memberList : [])
const avatarList = computed(() => memberList.value.map(i => i.avatar || '/static/default-avatar.png').filter(Boolean)) const avatarList = computed(() => memberList.value.map(i => i.avatar || '/static/default-avatar.svg').filter(Boolean))
const teammate = computed(() => { const teammate = computed(() => {
const memberLeaderList = team.value && Array.isArray(team.value.memberLeaderList) ? team.value.memberLeaderList : []; const memberLeaderList = team.value && Array.isArray(team.value.memberLeaderList) ? team.value.memberLeaderList : [];

View File

@ -28,6 +28,10 @@ export default [
path: 'pages/article/article-list', path: 'pages/article/article-list',
meta: { title: '健康宣教', login: true } meta: { title: '健康宣教', login: true }
}, },
{
path: 'pages/article/article-cate-list',
meta: { title: '健康宣教', login: true }
},
{ {
path: 'pages/health/list', path: 'pages/health/list',
meta: { title: '健康信息', login: true } meta: { title: '健康信息', login: true }

View File

@ -33,7 +33,9 @@ const urlsConfig = {
getArticleCateList: 'getArticleCateList', getArticleCateList: 'getArticleCateList',
getArticleList: 'getArticleList', getArticleList: 'getArticleList',
getArticle: 'getArticle', getArticle: 'getArticle',
addArticleSendRecord: 'addArticleSendRecord' addArticleSendRecord: 'addArticleSendRecord',
addArticleReadRecord: 'addArticleReadRecord',
getMiniAppReceivedArticleList: 'getMiniAppReceivedArticleList'
}, },
member: { member: {
addCustomer: 'add', addCustomer: 'add',
@ -65,6 +67,9 @@ const urlsConfig = {
createConsultGroup: "createConsultGroup", createConsultGroup: "createConsultGroup",
cancelConsultApplication: "cancelConsultApplication", cancelConsultApplication: "cancelConsultApplication",
getGroupList: "getGroupList" getGroupList: "getGroupList"
},
survery: {
getMiniAppReceivedSurveryList: 'getMiniAppReceivedSurveryList'
} }
} }
const urls = Object.keys(urlsConfig).reduce((acc, path) => { const urls = Object.keys(urlsConfig).reduce((acc, path) => {

View File

@ -144,7 +144,7 @@ function mergeConversationData(conversation, groupDetailsMap) {
name: formatConversationName(groupDetail), name: formatConversationName(groupDetail),
// 更新头像(优先使用已有头像,避免闪动) // 更新头像(优先使用已有头像,避免闪动)
avatar: conversation.avatar || groupDetail.patient?.avatar || '/static/default-avatar.png' avatar: conversation.avatar || groupDetail.patient?.avatar || '/static/default-avatar.svg'
} }
} }

View File

@ -2625,7 +2625,7 @@ class TimChatManager {
conversationID, conversationID,
groupID, groupID,
name: patientName ? `${patientName}的问诊` : groupName || '问诊群聊', name: patientName ? `${patientName}的问诊` : groupName || '问诊群聊',
avatar: '/static/default-avatar.png', avatar: '/static/default-avatar.svg',
lastMessage, lastMessage,
lastMessageTime, lastMessageTime,
unreadCount: conversation.unreadCount || 0, unreadCount: conversation.unreadCount || 0,
@ -2638,7 +2638,7 @@ class TimChatManager {
conversationID: conversation.conversationID, conversationID: conversation.conversationID,
groupID: conversation.conversationID?.replace('GROUP', '') || '', groupID: conversation.conversationID?.replace('GROUP', '') || '',
name: '问诊群聊', name: '问诊群聊',
avatar: '/static/default-avatar.png', avatar: '/static/default-avatar.svg',
lastMessage: '暂无消息', lastMessage: '暂无消息',
lastMessageTime: Date.now(), lastMessageTime: Date.now(),
unreadCount: 0, unreadCount: 0,