save
This commit is contained in:
@@ -6,7 +6,7 @@ import {useBaseStore} from "@/stores/base.ts";
|
||||
import {$computed, $ref} from "vue/macros";
|
||||
import {groupBy} from "lodash-es";
|
||||
import {dictionaryResources} from "@/assets/dictionary.ts";
|
||||
import {DictResource, languageCategoryOptions} from "@/types.ts";
|
||||
import {Dict, DictResource, languageCategoryOptions} from "@/types.ts";
|
||||
import {onMounted} from "vue";
|
||||
import DictGroup from "@/components/list/DictGroup.vue";
|
||||
import router from "@/router.ts";
|
||||
@@ -102,9 +102,11 @@ onMounted(() => {
|
||||
wordData = temp1
|
||||
})
|
||||
|
||||
function selectDict(val) {
|
||||
function selectDict(val: { dict: DictResource | Dict, index: number }) {
|
||||
console.log('val', val)
|
||||
router.push('/mobile/set-dict-plan')
|
||||
router.push({
|
||||
path: '/mobile/set-dict-plan', query: {id: val.dict.id}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,7 +2,39 @@
|
||||
|
||||
import DictPlan from "@/pages/mobile/components/DictPlan.vue";
|
||||
import NavBar from "@/pages/mobile/components/NavBar.vue";
|
||||
import {onMounted} from "vue";
|
||||
import {useRoute} from "vue-router";
|
||||
import {DefaultDict, Dict} from "@/types.ts";
|
||||
import {cloneDeep} from "lodash-es";
|
||||
import {nanoid} from "nanoid";
|
||||
import {dictionaryResources} from "@/assets/dictionary.ts";
|
||||
import {useBaseStore} from "@/stores/base.ts";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
|
||||
const store = useBaseStore()
|
||||
const runtimeStore = useRuntimeStore()
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
onMounted(() => {
|
||||
const route = useRoute()
|
||||
|
||||
console.log('route', route.query.id)
|
||||
|
||||
let item = dictionaryResources.find(v => v.id === route.query.id)
|
||||
let find: Dict = store.myDictList.find((v: Dict) => v.id === item.id)
|
||||
if (find) {
|
||||
runtimeStore.editDict = cloneDeep(find)
|
||||
} else {
|
||||
runtimeStore.editDict = cloneDeep({
|
||||
...cloneDeep(DefaultDict),
|
||||
...item,
|
||||
})
|
||||
runtimeStore.editDict.id = nanoid(6)
|
||||
//设置默认章节单词数
|
||||
runtimeStore.editDict.chapterWordNumber = settingStore.chapterWordNumber
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -5,8 +5,10 @@ import {Picker, showToast} from "vant";
|
||||
import 'vant/lib/index.css'
|
||||
import {onMounted} from "vue";
|
||||
import BaseButton from "@/components/BaseButton.vue";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
|
||||
const store = useBaseStore()
|
||||
const runtimeStore = useRuntimeStore()
|
||||
|
||||
let columns = $ref([])
|
||||
let columns2 = $ref([])
|
||||
@@ -36,15 +38,15 @@ onMounted(() => {
|
||||
<div class="plan">
|
||||
<div class="content">
|
||||
<div class="dict">
|
||||
<div class="name">{{ store.currentDict.name }}</div>
|
||||
<div class="chapter">每日{{ store.currentDict.chapterWordNumber }}词 剩余100天</div>
|
||||
<div class="name">{{ runtimeStore.editDict.name }}</div>
|
||||
<div class="chapter">每日{{ runtimeStore.editDict.chapterWordNumber }}词 剩余100天</div>
|
||||
<el-progress
|
||||
:show-text="false"
|
||||
:percentage="90"
|
||||
/>
|
||||
<div class="progress">
|
||||
<span>已学单词</span>
|
||||
<span>0/{{ store.currentDict.length }}</span>
|
||||
<span>0/{{ runtimeStore.editDict.length }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="notice">
|
||||
|
||||
@@ -16,7 +16,11 @@ export const routes: RouteRecordRaw[] = [
|
||||
{path: '/mobile', component: Mobile,},
|
||||
{path: '/mobile/practice', component: MobilePractice},
|
||||
{path: '/mobile/dict-detail', component: DictDetail},
|
||||
{path: '/mobile/set-dict-plan', component: SetDictPlan},
|
||||
{
|
||||
path: '/mobile/set-dict-plan',
|
||||
name: 'set-dict-plan',
|
||||
component: SetDictPlan
|
||||
},
|
||||
{path: '/test', component: Test},
|
||||
{path: '/', redirect: '/pc/practice'},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user