diff --git a/README.md b/README.md index 3efda9c1..09f03c51 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ ### 单词练习 -- 三种输入模式:跟打 / 复习 / 默写 +- 四种输入模式:跟打 / 辨认 / 复习 / 默写 - 智能模式:记忆曲线自动计算学习单词,并通过默写加深记忆 - 自由模式:不受限制,自行规划 - 提供音标、发音(美音、英音)、例句、短语、近义词、同根词、词源、错误统计等功能 diff --git a/index.html b/index.html index 6fdae1fe..a0fa74b9 100644 --- a/index.html +++ b/index.html @@ -62,18 +62,6 @@ s.parentNode.insertBefore(hm, s); })(); - (function () { - var umami = document.createElement("script"); - umami.src = 'https://typewords.cc/s.js' - if (location.href.includes('vercel') || location.href.includes('tw')) { - umami.setAttribute("data-website-id", "f630eefc-8b91-4e20-b890-106e6c7bcc10"); - } else { - umami.setAttribute("data-website-id", "160308c9-7900-4b1d-a0b1-c3b25a9530f6"); - } - var s = document.getElementsByTagName("script")[0]; - s.parentNode.insertBefore(umami, s); - })(); - (function () { var umami2 = document.createElement("script"); umami2.src = 'https://stat.typewords.cc/script.js' diff --git a/public/list/word.json b/public/list/word.json index d7fef4dd..d77fe020 100644 --- a/public/list/word.json +++ b/public/list/word.json @@ -1896,9 +1896,6 @@ "tags": [ "通用" ], - "words": [ - "private","fuck","add","remove" - ], "url": "GaoKaoZhenTiHeXinGaoPin.json", "length": 799, "language": "en", diff --git a/public/migrate.html b/public/migrate.html index 6da68ad4..72bc2c29 100644 --- a/public/migrate.html +++ b/public/migrate.html @@ -2,62 +2,85 @@ - Migrate Data + TypeWords 数据迁移(旧域名) - diff --git a/public/s.js b/public/s.js deleted file mode 100644 index 5f207329..00000000 --- a/public/s.js +++ /dev/null @@ -1 +0,0 @@ -!function(){"use strict";(t=>{const{screen:{width:e,height:a},navigator:{language:n,doNotTrack:i,msDoNotTrack:r},location:o,document:s,history:c,top:u,doNotTrack:d}=t,{currentScript:l,referrer:h}=s;if(!l)return;const{hostname:f,href:m,origin:p}=o,y=m.startsWith("data:")?void 0:t.localStorage,g="data-",b="true",v=l.getAttribute.bind(l),w=v(g+"website-id"),S=v(g+"host-url"),k=v(g+"before-send"),N=v(g+"tag")||void 0,T="false"!==v(g+"auto-track"),A=v(g+"do-not-track")===b,j=v(g+"exclude-search")===b,x=v(g+"exclude-hash")===b,$=v(g+"domains")||"",E=$.split(",").map(t=>t.trim()),K=`${(S||"https://api-gateway.umami.dev"||l.src.split("/").slice(0,-1).join("/")).replace(/\/$/,"")}/api/send`,L=`${e}x${a}`,O=/data-umami-event-([\w-_]+)/,_=g+"umami-event",D=300,U=()=>({website:w,screen:L,language:n,title:s.title,hostname:f,url:z,referrer:F,tag:N,id:q||void 0}),W=(t,e,a)=>{a&&(F=z,z=new URL(a,o.href),j&&(z.search=""),x&&(z.hash=""),z=z.toString(),z!==F&&setTimeout(J,D))},B=()=>H||!w||y&&y.getItem("umami.disabled")||$&&!E.includes(f)||A&&(()=>{const t=d||i||r;return 1===t||"1"===t||"yes"===t})(),C=async(e,a="event")=>{if(B())return;const n=t[k];if("function"==typeof n&&(e=n(a,e)),e)try{const t=await fetch(K,{keepalive:!0,method:"POST",body:JSON.stringify({type:a,payload:e}),headers:{"Content-Type":"application/json",...void 0!==R&&{"x-umami-cache":R}},credentials:"omit"}),n=await t.json();n&&(H=!!n.disabled,R=n.cache)}catch(t){}},I=()=>{G||(G=!0,J(),(()=>{const t=(t,e,a)=>{const n=t[e];return(...e)=>(a.apply(null,e),n.apply(t,e))};c.pushState=t(c,"pushState",W),c.replaceState=t(c,"replaceState",W)})(),(()=>{const t=async t=>{const e=t.getAttribute(_);if(e){const a={};return t.getAttributeNames().forEach(e=>{const n=e.match(O);n&&(a[n[1]]=t.getAttribute(e))}),J(e,a)}};s.addEventListener("click",async e=>{const a=e.target,n=a.closest("a,button");if(!n)return t(a);const{href:i,target:r}=n;if(n.getAttribute(_)){if("BUTTON"===n.tagName)return t(n);if("A"===n.tagName&&i){const a="_blank"===r||e.ctrlKey||e.shiftKey||e.metaKey||e.button&&1===e.button;return a||e.preventDefault(),t(n).then(()=>{a||(("_top"===r?u.location:o).href=i)})}}},!0)})())},J=(t,e)=>C("string"==typeof t?{...U(),name:t,data:e}:"object"==typeof t?{...t}:"function"==typeof t?t(U()):U()),P=(t,e)=>("string"==typeof t&&(q=t),R="",C({...U(),data:"object"==typeof t?t:e},"identify"));t.umami||(t.umami={track:J,identify:P});let R,q,z=m,F=h.startsWith(p)?"":h,G=!1,H=!1;T&&!B()&&("complete"===s.readyState?I():s.addEventListener("readystatechange",I,!0))})(window)}(); diff --git a/public/static-home.html b/public/static-home.html index 22e0a823..096c5a1b 100644 --- a/public/static-home.html +++ b/public/static-home.html @@ -324,66 +324,6 @@ toggleEl('#qqDialog', true) } - -
diff --git a/src/App.vue b/src/App.vue index c6325637..8a93dde9 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,28 +1,29 @@ @@ -109,4 +121,8 @@ onMounted(init) + \ No newline at end of file diff --git a/src/components/list/ArticleList.vue b/src/components/list/ArticleList.vue index a4491444..8591efa9 100644 --- a/src/components/list/ArticleList.vue +++ b/src/components/list/ArticleList.vue @@ -7,13 +7,11 @@ import BaseInput from "@/components/base/BaseInput.vue"; interface IProps { list: Article[]; showTranslate?: boolean; - activeId: string | number; } const props = withDefaults(defineProps(), { list: () => [] as Article[], showTranslate: true, - activeId: "" }) const emit = defineEmits<{ @@ -79,7 +77,10 @@ defineExpose({ scrollToBottom, scrollToItem })
- + diff --git a/src/components/list/BaseList.vue b/src/components/list/BaseList.vue index 85c6e2de..b3b86186 100644 --- a/src/components/list/BaseList.vue +++ b/src/components/list/BaseList.vue @@ -5,13 +5,13 @@ import { nextTick, watch } from 'vue' const props = withDefaults(defineProps<{ list?: any[], activeIndex?: number, - activeId?: number, + activeId?: number | string, isActive?: boolean static?: boolean }>(), { list: [], activeIndex: -1, - activeId: null, + activeId: '', isActive: false, static: true }) @@ -94,7 +94,7 @@ function scrollToItem(index: number) { function itemIsActive(item: any, index: number) { return props.activeId ? - props.activeId === item.id + props.activeId == item.id : props.activeIndex === index } diff --git a/src/pages/MigrateDialog.vue b/src/pages/MigrateDialog.vue new file mode 100644 index 00000000..683ce4f9 --- /dev/null +++ b/src/pages/MigrateDialog.vue @@ -0,0 +1,115 @@ + + + + + \ No newline at end of file diff --git a/src/pages/article/PracticeArticles.vue b/src/pages/article/PracticeArticles.vue index 7de7e146..1b062627 100644 --- a/src/pages/article/PracticeArticles.vue +++ b/src/pages/article/PracticeArticles.vue @@ -42,7 +42,7 @@ const store = useBaseStore() const runtimeStore = useRuntimeStore() const settingStore = useSettingStore() const statStore = usePracticeStore() -const { toggleTheme } = useTheme() +const {toggleTheme} = useTheme() let articleData = $ref({ list: [], @@ -132,6 +132,7 @@ async function init() { router.push('/articles') } } + const initAudio = () => { _nextTick(() => { audioRef.volume = settingStore.articleSoundVolume / 100 @@ -154,11 +155,11 @@ const handleSpeedUpdate = (speed: number) => { watch(() => store.load, (n) => { if (n && loading) init() -}, { immediate: true }) +}, {immediate: true}) watch(() => settingStore.$state, (n) => { initAudio() -}, { immediate: true, deep: true }) +}, {immediate: true, deep: true}) onMounted(() => { if (store.sbook?.articles?.length) { @@ -190,9 +191,9 @@ function savePracticeData(init = true, regenerate = true) { let data = obj.val //如果全是0,说明未进行练习,直接重置 if ( - data.practiceData.sectionIndex === 0 && - data.practiceData.sentenceIndex === 0 && - data.practiceData.wordIndex === 0 + data.practiceData.sectionIndex === 0 && + data.practiceData.sentenceIndex === 0 && + data.practiceData.wordIndex === 0 ) { throw new Error() } @@ -262,6 +263,10 @@ function setArticle(val: Article) { }) } +watch(() => articleData.article.id, n => { + console.log('articleData.article.id', n) +}) + async function complete() { clearInterval(timer) setTimeout(() => { @@ -279,7 +284,7 @@ async function complete() { } if (AppEnv.CAN_REQUEST) { - let res = await addStat({ ...data, type: 'article' }) + let res = await addStat({...data, type: 'article'}) if (!res.success) { Toast.error(res.msg) } @@ -438,7 +443,8 @@ onUnmounted(() => { timer && clearInterval(timer) }) -const { playSentenceAudio } = usePlaySentenceAudio() +const {playSentenceAudio} = usePlaySentenceAudio() + function play2(e) { _nextTick(() => { if (settingStore.articleSound || e.handle) { @@ -485,7 +491,7 @@ provide('currentPractice', currentPractice) :static="false" :show-translate="settingStore.translate" @click="changeArticle" - :active-id="articleData.article.id" + :active-id="articleData.article.id??''" :list="articleData.list ">