This commit is contained in:
Zyronon
2025-12-10 02:10:09 +08:00
parent 76cb2d9a25
commit bb3c7affed
5 changed files with 22 additions and 8 deletions

View File

@@ -10,10 +10,12 @@ interface IProps {
showCheckbox?: boolean
checked?: boolean
showProgress?: boolean
isUser?: boolean
}
const props = withDefaults(defineProps<IProps>(), {
showProgress: true
showProgress: true,
isUser: false
})
defineEmits<{
@@ -49,6 +51,7 @@ const studyProgress = $computed(() => {
class="absolute left-3 bottom-3 z-2"/>
<div class="custom z-1" v-if="item.custom">自定义</div>
<div class="custom bg-red! color-white z-1" v-else-if="item.update">更新中</div>
<div class="sync bg-red! color-white z-1" v-if="!item.sync && isUser && !showCheckbox">未同步</div>
</div>
<div class="text-base mt-1" v-if="item?.cover">{{ item?.name }}</div>
</div>
@@ -69,4 +72,12 @@ const studyProgress = $computed(() => {
font-size: 11px;
transform: rotate(45deg);
}
.sync {
@extend .custom;
bottom: 4px;
left: -22px;
top: unset;
right: unset;
}
</style>

View File

@@ -307,6 +307,7 @@ let isNewHost = $ref(window.location.host === Host)
</div>
<div class="flex gap-4 flex-wrap mt-4">
<Book :is-add="false"
:is-user="true"
quantifier="篇"
:item="item"
:checked="selectIds.includes(item.id)"

View File

@@ -34,15 +34,15 @@ export const getDefaultBaseState = (): BaseState => ({
load: false,
word: {
bookList: [
getDefaultDict({id: DictId.wordCollect, name: '收藏'}),
getDefaultDict({id: DictId.wordWrong, name: '错词'}),
getDefaultDict({id: DictId.wordKnown, name: '已掌握', description: '已掌握后的单词不会出现在练习中'}),
getDefaultDict({ id: DictId.wordCollect, name: '收藏' }),
getDefaultDict({ id: DictId.wordWrong, name: '错词' }),
getDefaultDict({ id: DictId.wordKnown, name: '已掌握', description: '已掌握后的单词不会出现在练习中' }),
],
studyIndex: -1,
},
article: {
bookList: [
getDefaultDict({id: DictId.articleCollect, name: '收藏'})
getDefaultDict({ id: DictId.articleCollect, en_name: DictId.articleCollect, name: '收藏' })
],
studyIndex: -1,
},
@@ -121,7 +121,7 @@ export const useBaseStore = defineStore('base', {
data.dictListVersion = r.data
}
}
console.log('data',data)
console.log('data', data)
if (AppEnv.CAN_REQUEST) {
let res = await myDictList()
if (res.success) {
@@ -129,7 +129,7 @@ export const useBaseStore = defineStore('base', {
}
}
this.setState(data)
set(SAVE_DICT_KEY.key, JSON.stringify({val: shakeCommonDict(this.$state), version: SAVE_DICT_KEY.version}))
set(SAVE_DICT_KEY.key, JSON.stringify({ val: shakeCommonDict(this.$state), version: SAVE_DICT_KEY.version }))
} catch (e) {
console.error('读取本地dict数据失败', e)
}

View File

@@ -46,7 +46,7 @@ export function getDefaultArticle(val: Partial<Article> = {}): Article {
audioFileId: '',
lrcPosition: [],
questions: [],
nameList:[],
nameList: [],
...cloneDeep(val)
}
}
@@ -74,6 +74,7 @@ export function getDefaultDict(val: Partial<Dict> = {}): Dict {
is_default: false,
update: false,
cover: '',
sync: false,
...val,
words: shallowReactive(val.words ?? []),

View File

@@ -180,6 +180,7 @@ export interface Dict extends DictResource {
is_default?: boolean
update?: boolean
cover?: string
sync?: boolean
}
export interface ArticleItem {