save
This commit is contained in:
@@ -103,7 +103,7 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
function selectDict(val: { dict: DictResource | Dict, index: number }) {
|
||||
console.log('val', val)
|
||||
// console.log('val', val)
|
||||
router.push({
|
||||
path: '/mobile/set-dict-plan', query: {id: val.dict.id}
|
||||
})
|
||||
|
||||
@@ -11,16 +11,16 @@ import {dictionaryResources} from "@/assets/dictionary.ts";
|
||||
import {useBaseStore} from "@/stores/base.ts";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
import {$ref} from "vue/macros";
|
||||
|
||||
const store = useBaseStore()
|
||||
const runtimeStore = useRuntimeStore()
|
||||
const settingStore = useSettingStore()
|
||||
const route = useRoute()
|
||||
let load = $ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
const route = useRoute()
|
||||
|
||||
console.log('route', route.query.id)
|
||||
|
||||
// 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) {
|
||||
@@ -34,13 +34,14 @@ onMounted(() => {
|
||||
//设置默认章节单词数
|
||||
runtimeStore.editDict.chapterWordNumber = settingStore.chapterWordNumber
|
||||
}
|
||||
load = true
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mobile-page">
|
||||
<NavBar title="设置任务量"/>
|
||||
<DictPlan/>
|
||||
<DictPlan v-if="load"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -6,28 +6,73 @@ import 'vant/lib/index.css'
|
||||
import {onMounted} from "vue";
|
||||
import BaseButton from "@/components/BaseButton.vue";
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
import {useSettingStore} from "@/stores/setting.ts";
|
||||
|
||||
const store = useBaseStore()
|
||||
const runtimeStore = useRuntimeStore()
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
let columns = $ref([])
|
||||
let columns2 = $ref([])
|
||||
let chapterWordNumber = $ref([runtimeStore.editDict.chapterWordNumber])
|
||||
let length = $ref(runtimeStore.editDict.length)
|
||||
let days = $ref([Math.ceil(length / chapterWordNumber)])
|
||||
|
||||
const onChange = ({selectedValues}) => {
|
||||
showToast(`当前值: ${selectedValues.join(',')}`);
|
||||
chapterWordNumber = selectedValues
|
||||
days = [Math.ceil(length / chapterWordNumber[0])]
|
||||
console.log('days', days, chapterWordNumber)
|
||||
};
|
||||
|
||||
const onChange2 = ({selectedValues}) => {
|
||||
days = selectedValues
|
||||
chapterWordNumber = [Math.ceil(length / days[0])]
|
||||
console.log('days', days, chapterWordNumber)
|
||||
|
||||
};
|
||||
|
||||
|
||||
onMounted(() => {
|
||||
columns = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100, 125, 150, 175, 200].map(value => {
|
||||
console.log('runtimeStore.editDict.length',runtimeStore.editDict.length)
|
||||
let list = []
|
||||
if (length > 50) {
|
||||
list = Array.from({length: 10}).map((v, i) => (i + 1) * 5)
|
||||
}
|
||||
if (length > 100) {
|
||||
list = list.concat(Array.from({length: 5}).map((v, i) => 50 + (i + 1) * 10))
|
||||
}
|
||||
if (length > 200) {
|
||||
list = list.concat(Array.from({length: 4}).map((v, i) => 100 + (i + 1) * 25))
|
||||
}
|
||||
if (length > 500) {
|
||||
list = list.concat(Array.from({length: 6}).map((v, i) => 200 + (i + 1) * 50))
|
||||
}
|
||||
let d = Math.floor((length - 500) / 100)
|
||||
console.log('d', d)
|
||||
if (d) {
|
||||
list = list.concat(Array.from({length: d}).map((v, i) => 500 + (i + 1) * 100))
|
||||
}
|
||||
|
||||
list.push(length)
|
||||
// if (runtimeStore.editDict.length < 50) {
|
||||
// } else if (runtimeStore.editDict.length < 100) {
|
||||
// list = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100, 125, 150, 175, 200]
|
||||
// }
|
||||
|
||||
console.log('list', length, list)
|
||||
columns = list.map(value => {
|
||||
return {
|
||||
text: value,
|
||||
value,
|
||||
}
|
||||
})
|
||||
columns2 = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100, 125, 150, 175, 200].map(value => {
|
||||
|
||||
columns2 = columns.map(v => {
|
||||
let value = Math.ceil(length / v.value)
|
||||
// console.log('v', v.value, value)
|
||||
return {
|
||||
text: value,
|
||||
value,
|
||||
value
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -39,7 +84,7 @@ onMounted(() => {
|
||||
<div class="content">
|
||||
<div class="dict">
|
||||
<div class="name">{{ runtimeStore.editDict.name }}</div>
|
||||
<div class="chapter">每日{{ runtimeStore.editDict.chapterWordNumber }}词 剩余100天</div>
|
||||
<div class="chapter">每日{{ chapterWordNumber[0] }}词 剩余{{ days[0] }}天</div>
|
||||
<el-progress
|
||||
:show-text="false"
|
||||
:percentage="90"
|
||||
@@ -62,13 +107,15 @@ onMounted(() => {
|
||||
<div class="picker-wrapper">
|
||||
<Picker
|
||||
:show-toolbar="false"
|
||||
:model-value="chapterWordNumber"
|
||||
:columns="columns"
|
||||
@change="onChange"
|
||||
/>
|
||||
<Picker
|
||||
:show-toolbar="false"
|
||||
:model-value="days"
|
||||
:columns="columns2"
|
||||
@change="onChange"
|
||||
@change="onChange2"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -5,9 +5,17 @@ import SlideItem from "@/components/slide/SlideItem.vue";
|
||||
import Home from "@/pages/mobile/Home.vue";
|
||||
import DictListManage from "@/pages/mobile/DictListManage.vue";
|
||||
import Setting from "@/pages/mobile/Setting.vue";
|
||||
import {onMounted} from "vue";
|
||||
|
||||
defineOptions({
|
||||
name: 'Practice'
|
||||
})
|
||||
|
||||
let index = $ref(1)
|
||||
|
||||
onMounted(() => {
|
||||
console.log('onMounted')
|
||||
})
|
||||
</script>
|
||||
<template>
|
||||
<div class="mobile-page mobile">
|
||||
|
||||
@@ -13,6 +13,11 @@ import {ShortcutKey} from "@/types.ts";
|
||||
import {useStartKeyboardEventListener} from "@/hooks/event.ts";
|
||||
import useTheme from "@/hooks/theme.ts";
|
||||
|
||||
|
||||
defineOptions({
|
||||
name: 'PracticeWord'
|
||||
})
|
||||
|
||||
const practiceStore = usePracticeStore()
|
||||
const store = useBaseStore()
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
Reference in New Issue
Block a user