日期选择样式优化

This commit is contained in:
2025-11-28 18:17:22 +08:00
parent b53d8196b4
commit 78661c12af

View File

@@ -26,6 +26,7 @@
<view <view
class="item button-click" class="item button-click"
:class="{ :class="{
optional:hasZphInData(item),
noOptional: !item.isThisMonth, noOptional: !item.isThisMonth,
active: current.date === item.date && item.isThisMonth, active: current.date === item.date && item.isThisMonth,
}" }"
@@ -59,7 +60,10 @@ const pages = reactive({
month: 0, month: 0,
}); });
const hasZphDateArray = ref([])
onLoad((options) => { onLoad((options) => {
updateDateArray()
if (options.date) { if (options.date) {
current.value = { current.value = {
date: options?.date || null, date: options?.date || null,
@@ -79,6 +83,20 @@ onLoad((options) => {
} }
}); });
function hasZphInData(item) {
return hasZphDateArray.value.some(date=>date == item.date)
}
async function updateDateArray() {
if(localStorage.getItem('hasZphDateArray')) hasZphDateArray.value = localStorage.getItem('hasZphDateArray')
let res = await $api.createRequest('/app/internal/getDateList', {}, 'get')
if(res.data){
hasZphDateArray.value = res.data
localStorage.setItem('hasZphDateArray',res.data)
}
}
function backParams() { function backParams() {
if (isValidDateString(current.value.date)) { if (isValidDateString(current.value.date)) {
navBack({ navBack({