diff --git a/src/api/login.js b/src/api/login.js index 9b7a3221..ab846495 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -11,7 +11,8 @@ import { import { setToken, setUserInfo, - getUserInfo + getUserInfo, + getToken } from "@/common/common"; import { get_base_url @@ -71,7 +72,6 @@ export const queryCurrentUser = (data) => request({ method: 'post', data }).then(res => { - // deptId: "" // deptName: null // loginName: "ADMIN" // todo id @@ -87,6 +87,7 @@ export const queryCurrentUser = (data) => request({ }) // console.log('预加载头像'); const base_url = get_base_url() + const token = getToken() // 预加载头像 // #ifdef APP-PLUS // 更新用户信息中的头像路径 @@ -175,22 +176,25 @@ export const queryCurrentUser = (data) => request({ (async () => { try { const pathName = res.body.imageAddr - const fileUrl = base_url + pathName + if (pathName) { + const fileUrl = base_url + pathName + '?tk=' + token + console.log('fileUrl', fileUrl); + // 生成保存路径 + const filename = generateUniqueFilename(pathName) + const localFilePath = '_doc/avatar/' + filename - // 生成保存路径 - const filename = generateUniqueFilename(pathName) - const localFilePath = '_doc/avatar/' + filename - - // 检查文件是否存在 - const exists = await checkFileExists(localFilePath) - - if (exists) { - // console.log('头像已存在,无需下载') - updateUserAvatar(localFilePath) - } else { - const savedPath = await downloadAndSaveAvatar(fileUrl, localFilePath) - updateUserAvatar(savedPath) + // 检查文件是否存在 + const exists = await checkFileExists(localFilePath) + + if (exists) { + // console.log('头像已存在,无需下载') + updateUserAvatar(localFilePath) + } else { + const savedPath = await downloadAndSaveAvatar(fileUrl, localFilePath) + updateUserAvatar(savedPath) + } } + } catch (error) { console.error('头像预加载过程发生错误:', error) } diff --git a/src/api/mascot.js b/src/api/mascot.js index 70989fc4..a9e763e6 100644 --- a/src/api/mascot.js +++ b/src/api/mascot.js @@ -2,7 +2,7 @@ import request from '@/api/request' import { get_base_url } from '@/api/request.js' - +import { getToken } from '@/common/common.js' const app_url = '/traapp' @@ -77,8 +77,9 @@ export const queryCurrentValidMascotInfo = (data) => { if (body.imgAddr) { console.log('body.imgAddrmascotNo'); const base_url = get_base_url() + const token = getToken() const pathName = body.imgAddr - const fileUrl = base_url + pathName + const fileUrl = base_url + pathName + '?tk=' + token const localFilePath = '_doc/mascot/' + body.mascotNo + '.png' console.log('fileUrl', fileUrl); // 将 Promise 回调函数声明为 async @@ -86,10 +87,10 @@ export const queryCurrentValidMascotInfo = (data) => { // 现在可以在这里使用 await 了 const exists = await checkFileExists(localFilePath) if (exists) { - console.log('已存在,无需下载') + // console.log('已存在,无需下载吉祥物') resolve({...body, imgAddr:localFilePath}) } else { - console.log('开始下载吉祥物:', fileUrl) + // console.log('开始下载吉祥物:', fileUrl) const dtask = plus.downloader.createDownload(fileUrl, { filename: localFilePath }, (d, status) => { diff --git a/src/components/points-and-badge/check-in.vue b/src/components/points-and-badge/check-in.vue index 1b3872d1..35963216 100644 --- a/src/components/points-and-badge/check-in.vue +++ b/src/components/points-and-badge/check-in.vue @@ -49,7 +49,7 @@ - + @@ -133,9 +133,8 @@ checkInLoading.value = false; isSigned.value = true; continuousDay.value = days; - generate() // 签到完重新计算日历样式 + generate(); // 签到完重新计算日历样式 checkInSuccessCallback(true, days, res.body.points, res.body.pointsBadges); - }, failCb: (res) => { checkInLoading.value = false; @@ -226,7 +225,7 @@ } catch (err) { console.error(err.message); } - } + }; const open = (isSignedStatus, days, onCheckInClick = () => {}, onCheckInSuccess = () => {}) => { isSigned.value = isSignedStatus; // 今日签到状态 continuousDay.value = days; // 连续签到 @@ -235,8 +234,8 @@ checkInClickCallback = onCheckInClick; checkInSuccessCallback = onCheckInSuccess; // 示例:X=10时,以"10天前"为第1天,生成35天列表 - generate() - + generate(); + popup.value.open(); }; defineExpose({ open, close }); @@ -374,8 +373,13 @@ height: 40%; border-top: 2rpx solid #bfbfbf; border-left: 2rpx solid #bfbfbf; + } + &.up { transform: rotate(45deg); } + &.down { + transform: rotate(-135deg); + } } } .calendar-div { diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index 1acfe4f0..e593fc36 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -14,7 +14,7 @@ 欢迎登录 - 登录账号即可查看更多精彩咨询 + 登录账号即可查看更多精彩内容