From e70ca852d8a5616cb27ba12f00f07deab0717201 Mon Sep 17 00:00:00 2001 From: anonymous Date: Thu, 9 Jan 2025 10:45:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E6=8E=A5=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc-auto-import.json | 3 +- env/.env | 4 +- src/hooks/useCaptcha.ts | 11 +++++ src/hooks/useListPageRequest.ts | 3 ++ src/hooks/useUpload.ts | 7 ++- src/pages-sub/hot-news/index.vue | 5 +- src/pages-sub/news-detail/index.vue | 2 +- src/pages-sub/realname/index.vue | 43 +++++++++++++++++- src/pages/index/index.vue | 13 ++++-- src/pages/invite/index.vue | 34 ++++++++------ src/pages/login/index.vue | 41 ++++++++++++----- src/pages/my/index.vue | 8 ++-- src/pages/register/index.vue | 35 +++++++------- src/service/index.ts | 16 +++++++ .../page-sub/realname/realname-card.png | Bin 0 -> 1992 bytes .../images/page-sub/realname/upload-icon.png | Bin 0 -> 2707 bytes src/types/auto-import.d.ts | 2 + 17 files changed, 165 insertions(+), 62 deletions(-) create mode 100644 src/hooks/useCaptcha.ts create mode 100644 src/static/images/page-sub/realname/realname-card.png create mode 100644 src/static/images/page-sub/realname/upload-icon.png diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index 3024d13..11be512 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -97,6 +97,7 @@ "useId": true, "useModel": true, "useTemplateRef": true, - "useListPageRequest": true + "useListPageRequest": true, + "useCaptcha": true } } diff --git a/env/.env b/env/.env index 598fc0a..9cbe363 100644 --- a/env/.env +++ b/env/.env @@ -7,8 +7,8 @@ VITE_WX_APPID = 'wxa2abb91f64032a2b' # h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base VITE_APP_PUBLIC_BASE=/ -VITE_SERVER_BASEURL = 'https://mapi.foxmail555.cc' -VITE_UPLOAD_BASEURL = 'https://ukw0y1.laf.run/upload' +VITE_SERVER_BASEURL = 'https://sapi.foxmail555.cc' +VITE_UPLOAD_BASEURL = 'https://sapi.foxmail555.cc/api/common/upload' # h5是否需要配置代理 VITE_APP_PROXY=false diff --git a/src/hooks/useCaptcha.ts b/src/hooks/useCaptcha.ts new file mode 100644 index 0000000..bde4915 --- /dev/null +++ b/src/hooks/useCaptcha.ts @@ -0,0 +1,11 @@ +export const useCaptcha = () => { + const codeUrl = ref('') + const refreshCode = () => { + const baseUrl = import.meta.env.VITE_SERVER_BASEURL + codeUrl.value = baseUrl + '/captcha.html?t=' + Date.now() + } + onMounted(() => { + refreshCode() + }) + return { codeUrl, refreshCode } +} diff --git a/src/hooks/useListPageRequest.ts b/src/hooks/useListPageRequest.ts index 3f51a1d..40566fc 100644 --- a/src/hooks/useListPageRequest.ts +++ b/src/hooks/useListPageRequest.ts @@ -52,6 +52,9 @@ function useListPageRequest( }) console.log(data) data.forEach((item: any) => { + if (String(item.createtime).length < 11) { + item.createtime = item.createtime * 1000 + } item.createtime = formatTime(item.createtime) item.image = getImageUrl(item.image) }) diff --git a/src/hooks/useUpload.ts b/src/hooks/useUpload.ts index adc083d..8323ce8 100644 --- a/src/hooks/useUpload.ts +++ b/src/hooks/useUpload.ts @@ -56,7 +56,12 @@ function uploadFile({ tempFilePath, formData, data, error, loading }) { name: 'file', formData, success: (uploadFileRes) => { - data.value = uploadFileRes.data as T + try { + data.value = JSON.parse(uploadFileRes.data).data.fullurl as T + } catch (e) { + console.log(e) + data.value = uploadFileRes.data as T + } }, fail: (err) => { console.error('uni.uploadFile err->', err) diff --git a/src/pages-sub/hot-news/index.vue b/src/pages-sub/hot-news/index.vue index 7c4d86a..d343cf2 100644 --- a/src/pages-sub/hot-news/index.vue +++ b/src/pages-sub/hot-news/index.vue @@ -6,7 +6,7 @@ }