我的鲜花

This commit is contained in:
haomingming 2026-03-06 10:45:44 +08:00
commit 7fb1200528
6 changed files with 94 additions and 61 deletions

View File

@ -2,8 +2,8 @@
"name" : "肝胆相照专家版",
"appid" : "__UNI__89F511F",
"description" : "",
"versionName" : "4.2.4",
"versionCode" : 424,
"versionName" : "4.2.5",
"versionCode" : 425,
"transformPx" : false,
"app-plus" : {
/* 5+App */

View File

@ -1686,7 +1686,7 @@
"list": [
{
"name": "",
"path": "/pages_app/myFlower/myFlower",
"path": "pages_app/patientMsg/patientMsg",
"query": ""
}
]

View File

@ -99,7 +99,7 @@
</template>
<script setup>
import { ref, computed, onMounted } from 'vue';
import { ref, computed, onMounted,nextTick } from 'vue';
import { onShow,onBackPress,onLoad } from "@dcloudio/uni-app";
import upImg from "@/static/triangle_green_theme.png"
import downImg from "@/static/triangle_normal.png"
@ -166,8 +166,9 @@ const fetchGroupList = async () => {
openGroups.value = {};
groupRenderCount.value = {};
groups.value.forEach((_, idx) => openGroups.value[idx] = false);
nextTick(() => {
uni.hideLoading();
});
}
};

View File

@ -100,7 +100,7 @@
<view class="listbox">
<!-- 使用 up-index-list 索引组件数据动态渲染 -->
<up-index-list :index-list="indexList" v-if="loadFinish" >
<up-index-list :index-list="indexList" v-show="loadFinish" >
<!-- 特殊操作项 -->
<template #header>
@ -140,7 +140,7 @@
</view>
</template>
<template v-else>
<image class="patient-avatar" :src="docUrl+item.photo" mode="aspectFill" @click="goPatientDetail(item.uuid)"></image>
<image class="patient-avatar" :src="item.avatarUrl" mode="aspectFill" @click="goPatientDetail(item.uuid)"></image>
</template>
<view class="patient-info" @click="goPatientDetail(item.uuid)">
<text class="patient-name">{{ item.realName }}</text>
@ -150,7 +150,7 @@
</view>
<view class="patient-status">
<uni-icons type="compose" size="20" color="#8B2316" @click.stop="editPatient(item.uuid)"></uni-icons>
<text class="follow-date">随访于{{ formatYMD(item.join_date) }}</text>
<text class="follow-date">随访于{{ item.joinDateYMD }}</text>
</view>
</view>
</view>
@ -248,7 +248,7 @@
<script setup>
import { ref, getCurrentInstance, computed } from 'vue';
import { ref, getCurrentInstance, computed, nextTick, shallowRef } from 'vue';
import { onShow,onLoad,onBackPress} from "@dcloudio/uni-app";
import dayImg from "@/static/visit_data11.png"
import planImg from "@/static/visitplan.png"
@ -256,6 +256,9 @@
import navTo from '@/utils/navTo.js';
import docUrl from '@/utils/docUrl.js';
const patientList = ref([]);
const patientDataLoaded = ref(false);
const patientDataLoading = ref(false);
const firstLetterCache = new Map();
const navHeight = ref(40);
onBackPress(() => {
plus.runtime.quit();
@ -348,7 +351,7 @@
};
//
const patientGroups = ref([]);
const patientGroups = shallowRef([]);
// A-Z
const rebuildIndexList = () => {
@ -359,36 +362,48 @@
//
//
const generateMockDate = () => '';
const getFirstLetter = (chineseName) => {
//
const firstChar = chineseName.charAt(0); //
const pinyinArray = pinyin(firstChar, { style: pinyin.STYLE_NORMAL }); //
return pinyinArray[0][0].charAt(0); //
const getFirstLetter = (name = '') => {
const firstChar = String(name).trim().charAt(0);
if (!firstChar) return '#';
if (/^[A-Za-z]$/.test(firstChar)) return firstChar.toUpperCase();
if (firstLetterCache.has(firstChar)) {
return firstLetterCache.get(firstChar);
}
try {
const pinyinArray = pinyin(firstChar, { style: pinyin.STYLE_NORMAL });
const py = pinyinArray?.[0]?.[0] || '';
const letter = py ? py.charAt(0).toUpperCase() : '#';
firstLetterCache.set(firstChar, letter);
return letter;
} catch (error) {
return '#';
}
}
// patientList
const buildGroupsFromPatients = () => {
const map = new Map();
patientList.value.forEach((p) => {
const name = p.realName;
const first = name?getFirstLetter(name).toUpperCase():'#';
const source = patientList.value || [];
for (let i = 0; i < source.length; i++) {
const p = source[i] || {};
const normalized = {
...p,
avatarUrl: p.photo ? `${docUrl}${p.photo}` : '',
joinDateYMD: formatYMD(p.join_date)
};
const first = getFirstLetter(normalized.realName || '');
const letter = /^[A-Z]$/.test(first) ? first : '#';
if (!map.has(letter)) map.set(letter, []);
map.get(letter).push(p);
});
map.get(letter).push(normalized);
}
const letters = Array.from(map.keys()).sort((a,b) => a.localeCompare(b));
patientGroups.value = letters.map(l => ({ letter: l, items: map.get(l) }));
rebuildIndexList();
if(patientList.value.length > 4000){
loadFinish.value = true;
nextTick(() => {
setTimeout(() => {
uni.hideLoading();
}, 10000);
}else{
uni.hideLoading();
loadFinish.value = true;
}
},1000);
});
};
@ -469,14 +484,21 @@
}
};
const patientListByGBK = async () => {
if (patientDataLoading.value) return;
patientDataLoading.value = true;
try {
const res = await api.patientListByGBK();
if(res.code == 1){
patientList.value = res.data;
buildGroupsFromPatients()
loadFinish.value = true;
patientList.value = res.data || [];
buildGroupsFromPatients();
patientDataLoaded.value = true;
} else {
uni.hideLoading();
}
} finally {
patientDataLoading.value = false;
}
};
const page=ref(1)
const followUpList = ref([]);
@ -594,12 +616,16 @@
// title.value = '';
break;
case 'list':
title.value = '患者列表';
if (patientDataLoaded.value) {
loadFinish.value = true;
break;
}
uni.showLoading({
title: '加载中...',
mask: true
});
patientListByGBK();
title.value = '患者列表';
//
break;
case 'plan':

View File

@ -42,7 +42,7 @@
</template>
<script setup>
import { ref, computed } from 'vue'
import { ref, computed,nextTick} from 'vue'
import docUrl from '@/utils/docUrl.js'
import { onShow,onLoad} from "@dcloudio/uni-app";
import api from '@/api/api.js'
@ -63,13 +63,16 @@
if(res.code == 1){
patientList.value = res.data;
availablePatientList.value = res.data;
if(res.data.length > 1000){
setTimeout(() => {
nextTick(() => {
uni.hideLoading();
}, 5000);
}else{
uni.hideLoading();
}
});
// if(res.data.length > 1000){
// setTimeout(() => {
// uni.hideLoading();
// }, 5000);
// }else{
// uni.hideLoading();
// }
}
};

View File

@ -42,7 +42,7 @@
</template>
<script setup>
import { ref, computed } from 'vue'
import { ref, computed,nextTick } from 'vue'
import docUrl from '@/utils/docUrl.js'
import { onShow,onLoad} from "@dcloudio/uni-app";
import api from '@/api/api.js'
@ -62,13 +62,16 @@
if(res.code == 1){
patientList.value = res.data;
availablePatientList.value = res.data;
if(res.data.length > 1000){
setTimeout(() => {
nextTick(() => {
uni.hideLoading();
}, 5000);
}else{
uni.hideLoading();
}
});
// if(res.data.length > 1000){
// setTimeout(() => {
// uni.hideLoading();
// }, 5000);
// }else{
// uni.hideLoading();
// }
}
};