diff --git a/src/apis/index.ts b/src/apis/index.ts index 8e8142a1..e4e32748 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -1,4 +1,4 @@ -import http, { axiosInstance } from "@/utils/http.ts"; +import http, {axiosInstance, AxiosResponse} from "@/utils/http.ts"; import { Dict } from "@/types/types.ts"; import { cloneDeep } from "@/utils"; @@ -48,7 +48,7 @@ export function addDict(params?, data?) { return http('dict/addDict', remove(data), remove(params), 'post') } -export function uploadImportData(data, onUploadProgress) { +export function uploadImportData(data, onUploadProgress): Promise> { return axiosInstance({ url: 'dict/uploadImportData', method: 'post', diff --git a/src/apis/user.ts b/src/apis/user.ts index b6c90482..942bce3c 100644 --- a/src/apis/user.ts +++ b/src/apis/user.ts @@ -71,7 +71,7 @@ export function loginApi(params: LoginParams) { } export function registerApi(params: RegisterParams) { - return http('user/register', params, null, 'post') + return http<{ token:string }>('user/register', params, null, 'post') } export function sendCode(params: SendCodeParams) { diff --git a/src/pages/user/login.vue b/src/pages/user/login.vue index c967cd2e..4fbaabca 100644 --- a/src/pages/user/login.vue +++ b/src/pages/user/login.vue @@ -1,26 +1,26 @@ @@ -344,28 +375,28 @@ async function startSync() {
验证码登录
密码登录
@@ -373,10 +404,10 @@ async function startSync() {
+ v-if="loginType === 'code'" + ref="phoneLoginFormRef" + :rules="phoneLoginFormRules" + :model="phoneLoginForm">
+ v-else + ref="loginForm2Ref" + :rules="loginForm2Rules" + :model="loginForm2">
@@ -436,10 +467,10 @@ async function startSync() { 登录 @@ -456,27 +487,27 @@ async function startSync() {
+ ref="registerFormRef" + :rules="registerFormRules" + :model="registerForm">
@@ -508,10 +539,10 @@ async function startSync() { 注册 @@ -523,27 +554,27 @@ async function startSync() {
+ ref="forgotFormRef" + :rules="forgotFormRules" + :model="forgotForm">
重置密码 @@ -587,16 +618,16 @@ async function startSync() {
微信登录二维码
扫描成功
@@ -604,8 +635,8 @@ async function startSync() {
你已取消此次登录
@@ -614,12 +645,12 @@ async function startSync() {
+ @click="refreshQRCode" + class="cp text-4xl"/>

@@ -633,45 +664,74 @@ async function startSync() {

同步数据确认
-
-

检测到您本地存在使用记录

-

是否需要同步到账户中?

-
-
-

正在导入中

-
    -
  1. - 您的用户数据已自动下载到您的电脑中 -
  2. -
  3. - 随后将开始数据同步 -
  4. -
  5. - 如果您的数据量很大,这将是一个耗时操作 -
  6. -
  7. - 请耐心等待,请勿关闭此页面 -
  8. -
- -
- 当前进度: {{ reason }} - + + +
diff --git a/src/pages/word/Statistics.vue b/src/pages/word/Statistics.vue index 761d259b..1edc26a1 100644 --- a/src/pages/word/Statistics.vue +++ b/src/pages/word/Statistics.vue @@ -98,6 +98,39 @@ function options(emitType: string) { close() } +// 计算学习进度百分比 +const studyProgress = $computed(() => { + if (!store.sdict.length) return 0 + return Math.round((store.sdict.lastLearnIndex / store.sdict.length) * 100) +}) + +// 计算正确率 +const accuracyRate = $computed(() => { + if (statStore.total === 0) return 100 + return Math.round(((statStore.total - statStore.wrong) / statStore.total) * 100) +}) + +// 获取鼓励文案 +const encouragementText = $computed(() => { + const rate = accuracyRate + if (rate >= 95) return '🎉 太棒了!继续保持!' + if (rate >= 85) return '👍 表现很好,再接再厉!' + if (rate >= 70) return '💪 不错的成绩,继续加油!' + return '🌟 每次练习都是进步,坚持下去!' +}) + +// 格式化学习时间 +const formattedStudyTime = $computed(() => { + const time = msToHourMinute(statStore.spend) + return time.replace('小时', 'h ').replace('分钟', 'm') +}) + +// 获取星期标签 +function getDayLabel(index: number) { + const days = ['一', '二', '三', '四', '五', '六', '日'] + return days[index] +} + \ No newline at end of file + + + \ No newline at end of file diff --git a/src/utils/http.ts b/src/utils/http.ts index e6de5708..3d7bfe72 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -84,7 +84,7 @@ axiosInstance.interceptors.response.use( }, ) -type AxiosResponse = { code: number, data: T, success: boolean, msg: string } +export type AxiosResponse = { code: number, data: T, success: boolean, msg: string } async function request(url, data = {}, params = {}, method): Promise> { return axiosInstance({