This commit is contained in:
Zyronon
2025-12-03 01:37:04 +08:00
parent 1603bbeca4
commit 9779c7402e
275 changed files with 3271 additions and 1446 deletions

View File

@@ -33,13 +33,11 @@ const studyProgress = $computed(() => {
</script>
<template>
<div class="book relative overflow-hidden" :id="item?.id ?? 'no-book'">
<template v-if="!isAdd">
<div>
<div class="text-base">{{ item?.name }}</div>
<div class="text-sm line-clamp-3" v-opacity="item.name !== item.description">{{ item?.description }}</div>
</div>
<div class="absolute bottom-4 right-3">
<div :id="item?.id" v-if="!isAdd">
<div class="book overflow-hidden relative">
<img class="absolute top-0 left-0 w-full object-cover" v-if="item?.cover" :src='item.cover' alt=""/>
<div class="text-base mt-1" v-else>{{ item?.name }}</div>
<div class="absolute bottom-4 right-3 z-1" :class="item?.cover && 'color-white'">
<div>{{ studyProgress }}{{ item?.length }}{{ quantifier }}</div>
</div>
<div class="absolute bottom-2 left-3 right-3">
@@ -51,10 +49,13 @@ const studyProgress = $computed(() => {
:model-value="checked"
@change="$emit('check')"
class="absolute left-3 bottom-3"/>
<div class="custom" v-if="item.custom">自定义</div>
<div class="custom bg-red! color-white" v-if="item.update">更新中</div>
</template>
<div v-else class="center h-full text-2xl">
<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>
<div class="text-base mt-1" v-if="item?.cover">{{ item?.name }}</div>
</div>
<div v-else class="book" id="no-book">
<div class="h-full center text-2xl">
<IconFluentAdd16Regular/>
</div>
</div>

View File

@@ -2,7 +2,7 @@ import { Article, DictId, PracticeArticleWordType, Sentence } from "@/types/type
import { _nextTick, cloneDeep } from "@/utils"
import { usePlayWordAudio } from "@/hooks/sound.ts"
import { getSentenceAllText, getSentenceAllTranslateText } from "@/hooks/translate.ts"
import { getDefaultArticleWord } from "@/types/func.ts"
import { getDefaultArticleWord, getDefaultDict } from "@/types/func.ts"
import { useSettingStore } from "@/stores/setting.ts"
import { useBaseStore } from "@/stores/base.ts"
import { useRuntimeStore } from "@/stores/runtime.ts"
@@ -363,17 +363,20 @@ export function syncBookInMyStudyList(study = false) {
_nextTick(() => {
const base = useBaseStore()
const runtimeStore = useRuntimeStore()
let rIndex = base.article.bookList.findIndex((v) => v.id === runtimeStore.editDict.id)
let temp = cloneDeep(runtimeStore.editDict)
let temp = runtimeStore.editDict
let rIndex = base.article.bookList.findIndex((v) => v.id === temp.id)
if (!temp.custom && temp.id !== DictId.articleCollect) {
temp.custom = true
if (!temp.id.includes('_custom')) {
temp.id += '_custom'
}
}
temp.length = temp.articles.length
if (rIndex > -1) {
base.article.bookList[rIndex] = temp
base.article.bookList[rIndex] = getDefaultDict(temp)
if (study) base.article.studyIndex = rIndex
} else {
base.article.bookList.push(temp)
base.article.bookList.push(getDefaultDict(temp))
if (study) base.article.studyIndex = base.article.bookList.length - 1
}
}, 100)

View File

@@ -252,7 +252,7 @@ let isNewHost = $ref(window.location.host === Host)
</div>
</div>
</div>
<div class="flex flex-col sm:flex-row gap-4 items-center mt-3 gap-space w-full">
<div class="flex flex-col sm:flex-row gap-3 items-center mt-3 gap-space w-full">
<div
class="w-full sm:flex-1 rounded-xl p-4 box-border relative bg-[var(--bg-history)] border border-gray-200">
<div class="text-[#409eff] text-xl font-bold">{{ todayTotalSpend }}</div>
@@ -319,7 +319,6 @@ let isNewHost = $ref(window.location.host === Host)
</div>
</div>
<div class="card flex flex-col min-h-50" v-loading="isFetching">
<div class="flex justify-between">
<div class="title">推荐</div>

View File

@@ -192,7 +192,13 @@ function next() {
<BaseButton :loading="studyLoading||loading" @click="addMyStudyList">学习</BaseButton>
</div>
</div>
<div class="text-lg ">介绍{{ runtimeStore.editDict.description }}</div>
<div class="flex gap-4 mt-2">
<img :src="runtimeStore.editDict?.cover"
class="w-30 rounded-md"
v-if="runtimeStore.editDict?.cover"
alt="">
<div class="text-lg">介绍{{ runtimeStore.editDict.description }}</div>
</div>
<div class="text-base " v-if="totalSpend">总学习时长{{ totalSpend }}</div>
<div class="line my-3"></div>

View File

@@ -360,6 +360,9 @@ function saveArticle(val: Article) {
}
setArticle(val)
store.sbook.custom = true
if (!store.sbook.id.includes('_custom')) {
store.sbook.id += '_custom'
}
}
function edit(val: Article = articleData.article) {

View File

@@ -78,7 +78,9 @@ async function onSubmit() {
//任意修改,都将其变为自定义词典
if (!data.custom && ![DictId.wordKnown, DictId.wordWrong, DictId.wordCollect, DictId.articleCollect].includes(data.en_name || data.id)) {
data.custom = true
data.id += '_custom'
if (!data.id.includes('_custom')) {
data.id += '_custom'
}
}
runtimeStore.editDict = data
if (rIndex > -1) {

View File

@@ -49,10 +49,10 @@ function goHome() {
<IconFluentCommentEdit20Regular/>
<span v-if="settingStore.sideExpand">反馈</span>
</div>
<div class="row" @click="router.push('/user')">
<IconFluentPerson20Regular/>
<span v-if="settingStore.sideExpand">用户</span>
</div>
<!-- <div class="row" @click="router.push('/user')">-->
<!-- <IconFluentPerson20Regular/>-->
<!-- <span v-if="settingStore.sideExpand">用户</span>-->
<!-- </div>-->
</div>
<div class="bottom flex justify-evenly ">
<BaseIcon

View File

@@ -615,6 +615,14 @@ function transferOk() {
<!-- 日志-->
<div v-if="tabIndex === 5">
<div class="log-item">
<div class="mb-2">
<div>
<div>日期2025/12/3</div>
<div>内容录入新概念部分音频优化文章相关功能</div>
</div>
</div>
</div>
<div class="log-item">
<div class="mb-2">
<div>

View File

@@ -77,7 +77,9 @@ function syncDictInMyStudyList(study = false) {
let temp = runtimeStore.editDict;
if (!temp.custom && ![DictId.wordKnown, DictId.wordWrong, DictId.wordCollect].includes(temp.id)) {
temp.custom = true
temp.id += '_custom'
if (!temp.id.includes('_custom')) {
temp.id += '_custom'
}
}
temp.length = temp.words.length
if (rIndex > -1) {
@@ -456,7 +458,7 @@ defineRender(() => {
<BaseButton loading={studyLoading || loading} onClick={startTest}>测试</BaseButton>
</div>
</div>
<div class="text-lg ">介绍{runtimeStore.editDict.description}</div>
<div class="text-lg mt-2">介绍{runtimeStore.editDict.description}</div>
<div class="line my-3"></div>
{/* 移动端标签页导航 */}

View File

@@ -131,6 +131,7 @@ export const useBaseStore = defineStore('base', {
data.dictListVersion = r.data
}
}
console.log('data',data)
if (AppEnv.CAN_REQUEST) {
let res = await myDictList()
if (res.success) {
@@ -190,7 +191,11 @@ export const useBaseStore = defineStore('base', {
let rIndex = this.article.bookList.findIndex((v: Dict) => v.id === val.id)
if (rIndex > -1) {
this.article.studyIndex = rIndex
this.article.bookList[this.article.studyIndex].articles = shallowReactive(val.articles)
this.article.bookList[this.article.studyIndex] = getDefaultDict(val)
// this.article.bookList[this.article.studyIndex].articles = shallowReactive(val.articles)
// this.article.bookList[this.article.studyIndex].cover = val.cover
// this.article.bookList[this.article.studyIndex].name = val.name
// this.article.bookList[this.article.studyIndex].description = val.description
} else {
this.article.bookList.push(getDefaultDict(val))
this.article.studyIndex = this.article.bookList.length - 1

View File

@@ -72,6 +72,8 @@ export function getDefaultDict(val: Partial<Dict> = {}): Dict {
en_name: '',
category_id: null,
is_default: false,
update: false,
cover: '',
...val,
words: shallowReactive(val.words ?? []),

View File

@@ -178,6 +178,8 @@ export interface Dict extends DictResource {
createdBy?: string
category_id?: number
is_default?: boolean
update?: boolean
cover?: string
}
export interface ArticleItem {