吉祥物缓存,替换安卓弹窗

This commit is contained in:
田岩
2025-07-23 22:28:26 +08:00
parent b08176f569
commit 212bfaf420
42 changed files with 430 additions and 424 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ ENV = 'development'
# VITE_APP_BASE_API_Url = 'http://25.18.122.78:9786' # VITE_APP_BASE_API_Url = 'http://25.18.122.78:9786'
# DEV # DEV
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# app入口 # app入口
#VITE_APP_BASE_API_Url = 'http://25.16.122.65:7001' #VITE_APP_BASE_API_Url = 'http://25.16.122.65:7001'
@@ -18,4 +18,4 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
# h5专用地址 # h5专用地址
VITE_APP_BASE_H5_API_Url = 'http://25.18.122.66:9786' VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7001'
+1 -1
View File
@@ -2,4 +2,4 @@
ENV = 'uat' ENV = 'uat'
# base api # base api
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7003' VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7003'
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
.uv-overlay[data-v-c913fd43]{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7)}.overlay-box[data-v-de693c21]{position:relative;height:100%}.overlay-box .detail-img[data-v-de693c21]{position:absolute;left:50%;top:50%;width:100vw;max-height:100%;transform:translate(-50%,-50%)}.title_div[data-v-751a74a5]{width:60vw;text-shadow:.3125rem 0 .9375rem #3c3c3c}.title_div .img[data-v-751a74a5]{width:100%}.tip_div[data-v-751a74a5]{text-shadow:0 0 .625rem #ceceea}.tip_div .tip_msg[data-v-751a74a5]{font-family:PingFangSC;font-weight:400;font-size:.9375rem;color:#fff;line-height:1.25rem;text-align:center;font-style:normal}.mascot_div[data-v-751a74a5]{width:100%;height:100%;display:flex;align-items:center;position:relative}.mascot_div .swiper[data-v-751a74a5]{white-space:nowrap;height:120vw;flex:1}.mascot_div .swiper-item-div[data-v-751a74a5]{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;height:120vw}.mascot_div .swiper-item-div .img[data-v-751a74a5]{width:80vw;height:100%}.mascot_div .doct_icon[data-v-751a74a5]{padding:0%;position:absolute;width:3.125rem;display:flex;align-items:center;flex-direction:column}.mascot_div .doct_icon .doct_icon_div[data-v-751a74a5]{width:100%;display:flex;align-items:center;justify-content:center;padding:1.25rem 0}.mascot_div .doct_icon.left[data-v-751a74a5]{top:40%;left:2%;z-index:10}.mascot_div .doct_icon.right[data-v-751a74a5]{top:40%;right:2%}.mascot_div .doct_icon .img[data-v-751a74a5]{width:40%}.button_div[data-v-751a74a5]{margin-top:.625rem;width:80%;height:3.75rem;position:relative}.button_div .img[data-v-751a74a5]{position:absolute;width:100%;height:100%}.bg_img[data-v-751a74a5]{position:absolute;top:-2%;left:-1%;width:102%;height:104%;z-index:-1}.bg_img .img[data-v-751a74a5]{width:100%;height:100%}.main_div[data-v-751a74a5]{display:flex;flex-direction:column;position:relative;max-width:100vh;align-items:center;overflow:hidden} .uv-overlay[data-v-c913fd43]{position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.7)}.overlay-box[data-v-de693c21]{position:relative;height:100%}.overlay-box .detail-img[data-v-de693c21]{position:absolute;left:50%;top:50%;width:100vw;max-height:100%;transform:translate(-50%,-50%)}.title_div[data-v-d0634458]{width:60vw;text-shadow:.3125rem 0 .9375rem #3c3c3c}.title_div .img[data-v-d0634458]{width:100%}.tip_div[data-v-d0634458]{text-shadow:0 0 .625rem #ceceea}.tip_div .tip_msg[data-v-d0634458]{font-family:PingFangSC;font-weight:400;font-size:.9375rem;color:#fff;line-height:1.25rem;text-align:center;font-style:normal}.mascot_div[data-v-d0634458]{width:100%;height:100%;display:flex;align-items:center;position:relative}.mascot_div .swiper[data-v-d0634458]{white-space:nowrap;height:120vw;flex:1}.mascot_div .swiper-item-div[data-v-d0634458]{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;height:120vw}.mascot_div .swiper-item-div .img[data-v-d0634458]{width:80vw;height:100%}.mascot_div .doct_icon[data-v-d0634458]{padding:0%;position:absolute;width:3.125rem;display:flex;align-items:center;flex-direction:column}.mascot_div .doct_icon .doct_icon_div[data-v-d0634458]{width:100%;display:flex;align-items:center;justify-content:center;padding:1.25rem 0}.mascot_div .doct_icon.left[data-v-d0634458]{top:40%;left:2%;z-index:10}.mascot_div .doct_icon.right[data-v-d0634458]{top:40%;right:2%}.mascot_div .doct_icon .img[data-v-d0634458]{width:40%}.button_div[data-v-d0634458]{margin-top:.625rem;width:80%;height:3.75rem;position:relative}.button_div .img[data-v-d0634458]{position:absolute;width:100%;height:100%}.bg_img[data-v-d0634458]{position:absolute;top:-2%;left:-1%;width:102%;height:104%;z-index:-1}.bg_img .img[data-v-d0634458]{width:100%;height:100%}.main_div[data-v-d0634458]{display:flex;flex-direction:column;position:relative;max-width:100vh;align-items:center;overflow:hidden}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
.nav-bar[data-v-e7a2d2df]{width:100%;height:var(--status-bar-height);position:fixed}.nav-bar-seat[data-v-e7a2d2df]{width:100%;height:var(--status-bar-height)}.nav-bar-div[data-v-e7a2d2df]{z-index:1900;width:100%;position:relative}uni-view[data-v-843a5998],uni-scroll-view[data-v-843a5998],uni-swiper-item[data-v-843a5998]{display:flex;flex-direction:column;flex-shrink:0;flex-grow:0;flex-basis:auto;align-items:stretch;align-content:flex-start}@font-face{font-family:uvicon-iconfont;src:url(../../assets/uvicons.04d281cc.ttf) format("truetype")}.uv-icon[data-v-843a5998]{display:flex;align-items:center}.uv-icon--left[data-v-843a5998]{flex-direction:row-reverse;align-items:center}.uv-icon--right[data-v-843a5998]{flex-direction:row;align-items:center}.uv-icon--top[data-v-843a5998]{flex-direction:column-reverse;justify-content:center}.uv-icon--bottom[data-v-843a5998]{flex-direction:column;justify-content:center}.uv-icon__icon[data-v-843a5998]{font-family:uvicon-iconfont;position:relative;display:flex;flex-direction:row;align-items:center}.uv-icon__icon--primary[data-v-843a5998]{color:#06f}.uv-icon__icon--success[data-v-843a5998]{color:#5ac725}.uv-icon__icon--error[data-v-843a5998]{color:#f56c6c}.uv-icon__icon--warning[data-v-843a5998]{color:#f9ae3d}.uv-icon__icon--info[data-v-843a5998]{color:#909399}.uv-icon__img[data-v-843a5998]{height:auto;will-change:transform}.uv-icon__label[data-v-843a5998]{line-height:1}.uv-line[data-v-37b2eb6f]{vertical-align:middle}uni-view[data-v-97e65963],uni-scroll-view[data-v-97e65963],uni-swiper-item[data-v-97e65963]{display:flex;flex-direction:column;flex-shrink:0;flex-grow:0;flex-basis:auto;align-items:stretch;align-content:flex-start}.uv-cell__body[data-v-97e65963]{display:flex;flex-direction:row;box-sizing:border-box;padding:10px 15px;font-size:15px;color:#303133}.uv-cell__body__content[data-v-97e65963]{display:flex;flex-direction:row;align-items:center;flex:1}.uv-cell__body--large[data-v-97e65963]{padding-top:13px;padding-bottom:13px}.uv-cell__left-icon-wrap[data-v-97e65963],.uv-cell__right-icon-wrap[data-v-97e65963]{display:flex;flex-direction:row;align-items:center;font-size:16px}.uv-cell__left-icon-wrap[data-v-97e65963]{margin-right:4px}.uv-cell__right-icon-wrap[data-v-97e65963]{margin-left:4px;transition:transform .3s}.uv-cell__right-icon-wrap--up[data-v-97e65963]{transform:rotate(-90deg)}.uv-cell__right-icon-wrap--down[data-v-97e65963]{transform:rotate(90deg)}.uv-cell__title[data-v-97e65963]{flex:1}.uv-cell__title-text[data-v-97e65963]{font-size:15px;line-height:22px;color:#303133}.uv-cell__title-text--large[data-v-97e65963]{font-size:16px}.uv-cell__label[data-v-97e65963]{margin-top:5px;font-size:12px;color:#909193;line-height:18px}.uv-cell__label--large[data-v-97e65963]{font-size:14px}.uv-cell__value[data-v-97e65963]{text-align:right;font-size:14px;line-height:24px;color:#606266}.uv-cell__value--large[data-v-97e65963]{font-size:15px}.uv-cell--clickable[data-v-97e65963]{background-color:#f3f4f6}.uv-cell--disabled[data-v-97e65963]{color:#c8c9cc;cursor:not-allowed}.uv-cell--center[data-v-97e65963]{align-items:center}uni-view[data-v-c010df49],uni-scroll-view[data-v-c010df49],uni-swiper-item[data-v-c010df49]{display:flex;flex-direction:column;flex-shrink:0;flex-grow:0;flex-basis:auto;align-items:stretch;align-content:flex-start}.uv-cell-group[data-v-c010df49]{flex:1}.uv-cell-group__title[data-v-c010df49]{padding:16px 16px 8px}.uv-cell-group__title__text[data-v-c010df49]{font-size:15px;line-height:16px;color:#303133}.uv-cell-group__wrapper[data-v-c010df49]{position:relative}.detail-body[data-v-0925a3e8]{margin:.9375rem 1.5625rem 0;background:#fff;border-radius:.46875rem;z-index:101;overflow:hidden}.detail-body[data-v-0925a3e8] .uv-line{width:calc(100% - 1.5rem)!important;margin:0 .75rem!important}.detail-body[data-v-0925a3e8] .uv-cell__body{padding:12px 15px}.detail-body[data-v-0925a3e8] .uv-cell__title{flex:none!important}.detail-main[data-v-0925a3e8]{background-color:#f6f8ff}.title[data-v-0925a3e8]{color:#000;font-size:1.0625rem;height:1.0625rem;font-weight:600;line-height:1.0625rem}.fixed_search_div[data-v-0925a3e8]{padding:calc(.3125rem + var(--status-bar-height)) .46875rem .75rem .9375rem;display:flex;align-items:center;background-color:#f6f7f8}.fixed_search_div .back_div[data-v-0925a3e8]{margin-right:.3125rem}.fixed_search_div .back_div .back-icon[data-v-0925a3e8]{position:relative;width:1.25rem;height:1.25rem;cursor:pointer;display:flex;align-items:center}.fixed_search_div .back_div .back-icon[data-v-0925a3e8]:before,.fixed_search_div .back_div .back-icon[data-v-0925a3e8]:after{content:"";position:absolute;transition:all .3s ease}.fixed_search_div .back_div .back-icon[data-v-0925a3e8]:after{top:25%;left:25%;width:40%;height:40%;border-top:.125rem solid #2b2c2e;border-left:.125rem solid #2b2c2e;transform:rotate(-45deg)} .container{padding:20px;display:flex;flex-direction:column;align-items:center}.download-btn{padding:10px 20px;background-color:#007aff;color:#fff;border-radius:5px;margin-bottom:20px}.image-container{width:100%;height:300px;background-color:#f5f5f5;border-radius:5px;margin-bottom:20px;display:flex;justify-content:center;align-items:center}.preview-image{max-width:100%;max-height:100%}.status-text{color:#666;font-size:14px}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 143 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

+1 -1
View File
@@ -140,7 +140,7 @@ export const queryCurrentUser = (data) => request({
// 生成唯一文件名 // 生成唯一文件名
const generateUniqueFilename = (pathName) => { const generateUniqueFilename = (pathName) => {
if (!pathName || typeof pathName !== 'string') { if (!pathName || typeof pathName !== 'string') {
throw new Error('无效的头像路径'); throw new Error('无效的路径');
} }
// 直接使用原始文件名(带扩展名) // 直接使用原始文件名(带扩展名)
+41 -14
View File
@@ -42,6 +42,17 @@ export const setTraMascotInfo = (data) => {
}; };
// 查询当前已经选择的吉祥物 // 查询当前已经选择的吉祥物
// 检查文件是否存在
const checkFileExists = (filePath) => {
return new Promise((resolve) => {
uni.getFileInfo({
filePath,
success: () => resolve(true),
fail: () => resolve(false)
})
})
}
/** /**
* 查询当前已经选择的吉祥物 * 查询当前已经选择的吉祥物
* 出参: * 出参:
@@ -64,21 +75,37 @@ export const queryCurrentValidMascotInfo = (data) => {
body body
}) => { }) => {
if (body.imgAddr) { if (body.imgAddr) {
// setTimeout(() => { console.log('body.imgAddrmascotNo');
// const base_url = get_base_url() const base_url = get_base_url()
// const url = base_url + body.imgAddr const pathName = body.imgAddr
// const img = new Image(); // 创建Image对象 const fileUrl = base_url + pathName
// img.onload = () => { const localFilePath = '_doc/mascot/' + body.mascotNo + '.png'
// console.log(`图片缓存成功: ${url}`); console.log('fileUrl', fileUrl);
// }; // 将 Promise 回调函数声明为 async
// // 图片加载失败 return new Promise(async (resolve, reject) => {
// img.onerror = () => { // 现在可以在这里使用 await 了
// console.error(`图片缓存失败: ${url}`); const exists = await checkFileExists(localFilePath)
// }; if (exists) {
// img.src = url; // 开始加载图片(设置src触发请求,浏览器会自动缓存) console.log('已存在,无需下载')
// }) resolve({...body, imgAddr:localFilePath})
} else {
console.log('开始下载吉祥物:', fileUrl)
const dtask = plus.downloader.createDownload(fileUrl, {
filename: localFilePath
}, (d, status) => {
if (status === 200) {
console.log("保存路径:", d.filename)
resolve({...body, imgAddr:d.filename})
} else {
console.error("文件下载失败:", status)
reject(new Error(`下载失败,状态码: ${status}`))
}
})
dtask.start()
}
})
} }
return body return body
}) })
}; };
+34 -15
View File
@@ -1,3 +1,4 @@
import showDialog from '@/common/dialogMessage'
function msg(title, duration = 1000) { function msg(title, duration = 1000) {
uni.showToast({ uni.showToast({
@@ -9,21 +10,39 @@ function msg(title, duration = 1000) {
} }
function show(title, msg, showCancel = true, cancelText = '取消', confirmText = '确定') { function show(title, msg, showCancel = true, cancelText = '取消', confirmText = '确定') {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.showModal({ // 创建通用参数对象
title: title, const dialogOptions = {
content: msg, title,
showCancel: showCancel, content: msg,
cancelText: cancelText, showCancel,
confirmText: confirmText, cancelText,
success: function(res) { confirmText,
resolve(res.confirm) success: (res) => {
}, // 统一处理成功回调,解析为布尔值
fail: function(res) { resolve(!!res.confirm);
reject(res) }
}, };
});
}) if (getPhoneEnvBool('AND')) {
// 安卓环境使用showDialog,补充cancel回调
showDialog({
...dialogOptions,
cancel: () => {
console.log('用户点击取消');
resolve(false); // 取消时也返回Promise结果
}
});
} else {
// 其他环境使用uni.showModal,补充fail回调
uni.showModal({
...dialogOptions,
fail: (res) => {
reject(res);
}
});
}
});
} }
const loading = (title = '加载中', mask = true) => uni.showLoading({ const loading = (title = '加载中', mask = true) => uni.showLoading({
+112 -100
View File
@@ -1,87 +1,78 @@
<template> <template>
<view class="comment_div"> <view class="comment_div">
<uv-load-more :status="status" loadmore-text="轻轻上拉加载" ></uv-load-more> <view class="message_div" v-for="(item,index) in message_list">
<!-- <view class="empty_message_div" v-if="message_list.length == 0"> <view class="head_div">
<image class="img" src="@/static/images/courseDetail/empty_message.png"></image> <image-preview v-if="item.userIconImgId" class="img-box img" :src="item.userIconImgId"></image-preview>
</view> --> <image v-else src="/static/images/me/default_user_avatar.png" class="img"></image>
<!-- message_list --> </view>
<!-- <scroll-view :scroll-y="true" class="comment_scroll"> --> <view class="msg_content">
<view class="message_div" v-for="(item,index) in message_list"> <view class="title_div">
<view class="head_div"> <view class="name">{{item.userName}}</view>
<image-preview v-if="item.userIconImgId" class="img-box img" <view class="title_tip">{{item.bbsTagDesc}}</view>
:src="item.userIconImgId"></image-preview>
<image v-else src="/static/images/me/default_user_avatar.png" class="img"></image>
</view> </view>
<view class="msg_content"> <view class="title">
<view class="title_div"> {{item.bbsContent}}
<view class="name">{{item.userName}}</view> </view>
<view class="title_tip">{{item.bbsTagDesc}}</view> <view class="img_div pic-cell">
</view> <image-preview v-for="img in item.imgIdList" @click="showPicture(item.imgIdList, img)" :src="img"
<view class="title"> class="pic-item" mode="scaleToFill"></image-preview>
{{item.bbsContent}} </view>
</view> <view class="time_and_reply">
<view class="img_div pic-cell"> <view class="time">{{item.bbsTm.substr(0,16)}}</view>
<image-preview v-for="img in item.imgIdList" @click="showPicture(item.imgIdList, img)" <view class="reply" @click="click_reply(item, item.bbsId, index)">回复</view>
:src="img" class="pic-item" mode="scaleToFill"></image-preview> </view>
</view> <view class="show_close_div" v-if="item.children?.length" @click="item.show = !item.show">
<view class="time_and_reply"> <template v-if="item.show">
<view class="time">{{item.bbsTm.substr(0,16)}}</view> <view>收起</view>
<view class="reply" @click="click_reply(item, item.bbsId, index)">回复</view> <view class="back_div">
</view> <view class="back-icon"></view>
<view class="show_close_div" v-if="item.children?.length" @click="item.show = !item.show"> </view>
<template v-if="item.show"> </template>
<view>收起</view> <template v-else>
<view class="back_div"> <view>展开{{item.children?.length}}条回复</view>
<view class="back-icon"></view> <view class="back_div">
</view> <view class="back-icon"></view>
</template> </view>
<template v-else> </template>
<view>展开{{item.children?.length}}条回复</view> </view>
<view class="back_div"> <view class="children" v-if="item.show">
<view class="back-icon"></view> <view class="message_div" v-for="childrenItem in item.children">
</view> <view class="head_div">
</template> <image-preview v-if="childrenItem.userIconImgId" class="img-box img"
</view> :src="childrenItem.userIconImgId"></image-preview>
<view class="children" v-if="item.show"> <image v-else src="/static/images/me/default_user_avatar.png" class="img"></image>
<view class="message_div" v-for="childrenItem in item.children"> </view>
<view class="head_div"> <view class="msg_content">
<image-preview v-if="childrenItem.userIconImgId" class="img-box img" <view class="title_div">
:src="childrenItem.userIconImgId"></image-preview> <view class="name">{{childrenItem.userName}}</view>
<image v-else src="/static/images/me/default_user_avatar.png" class="img"></image> <view class="arrow"></view>
</view> <view class="name">{{childrenItem.rtnUName}}</view>
<view class="msg_content">
<view class="title_div">
<view class="name">{{childrenItem.userName}}</view>
<view class="arrow"></view>
<view class="name">{{childrenItem.rtnUName}}</view>
</view> </view>
<view class="title"> <view class="title">
{{childrenItem.bbsContent}} {{childrenItem.bbsContent}}
</view> </view>
<view class="img_div"> <view class="img_div">
</view> </view>
<view class="time_and_reply"> <view class="time_and_reply">
<view class="time">{{childrenItem.bbsTm.substr(0,16)}}</view> <view class="time">{{childrenItem.bbsTm.substr(0,16)}}</view>
<view class="reply" <view class="reply" @click="click_reply(childrenItem, childrenItem.parentId, index)">回复
@click="click_reply(childrenItem, childrenItem.parentId, index)">回复
</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<!-- </scroll-view> --> </view>
<!-- <view class="send_evaluate_div"> <view class="empty_message_div" v-if="status=='nomore' && total == 0">
<uv-button type="primary" class="send_evaluate" <image class="img" src="@/static/images/courseDetail/empty_message.png"></image>
@click="common.navigateTo('/pages/courseDetail/submit?crsNum='+props.crsNum+'&imgId='+props.imgId)">发布评价</uv-button> </view>
</view> --> <uv-load-more :status="status" loadmore-text="轻轻上拉加载"></uv-load-more>
<uni-popup ref="popup"> <uni-popup ref="popup" class="popup">
<view class="bottom_reply_input_div"> <view class="bottom_reply_input_div" :style="{marginBottom:popup_input_bottom}">
<uv-input v-model="reply_data.bbsContent" placeholderStyle='color:#999999;font-size:26rpx' <uv-input v-model="reply_data.bbsContent" :adjustPosition="false"
:placeholder="reply_data.placeholder" :focus="true" :maxlength="100"> placeholderStyle='color:#999999;font-size:26rpx' :placeholder="reply_data.placeholder" :focus="true"
:maxlength="100">
</uv-input> </uv-input>
<view class="" style="display: flex;flex-direction: column; margin:10rpx 20rpx;"> <view class="" style="display: flex;flex-direction: column; margin:10rpx 20rpx;">
<view class="fl1"></view> <view class="fl1"></view>
@@ -90,7 +81,6 @@
<view class="fl1"></view> <view class="fl1"></view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
</template> </template>
@@ -99,7 +89,8 @@
import { import {
ref, ref,
reactive, reactive,
onMounted onMounted,
nextTick
} from 'vue' } from 'vue'
import { import {
queryTraCrsBbsInfoByCrsId, queryTraCrsBbsInfoByCrsId,
@@ -112,11 +103,14 @@
} from '@/api/request.js' } from '@/api/request.js'
const popup = ref(null) const popup = ref(null)
const popup_input_bottom = ref('0px')
const inputValue = ref('') const inputValue = ref('')
const placeholder = ref('') const placeholder = ref('')
const message_list = reactive([]) const message_list = reactive([])
const status = ref('loading') // loadmore - 加载前,loading - 加载中,nomore - 没有数据 const status = ref('') // loadmore - 加载前,loading - 加载中,nomore - 没有数据
const limit = 20 const limit = 15
const total = ref(-1)
const page = ref(0) const page = ref(0)
const reply_data_init = { const reply_data_init = {
"index": null, "index": null,
@@ -134,17 +128,23 @@
crsNum: String, crsNum: String,
imgId: String imgId: String
}) })
const click_reply = ({ const click_reply = (item, parentBbsId, index) => {
userName, popup.value.open('bottom');
bbsId reply_data.placeholder = '回复 ' + item.userName + ""
}, parentBbsId, index) => {
popup.value.open('bottom')
reply_data.placeholder = '回复 ' + userName + ""
reply_data.parentBbsId = parentBbsId reply_data.parentBbsId = parentBbsId
reply_data.bbsId = bbsId reply_data.bbsId = item.bbsId
reply_data.index = index reply_data.index = index
nextTick(() => {
uni.onKeyboardHeightChange(res => {
popup_input_bottom.value = `${res.height}px`;
console.log(res);
});
})
} }
const reply_send = async () => { const reply_send = async () => {
if (reply_data.bbsContent === '') {
return common.msg('回复内容不能为空')
}
try { try {
popup.value.close() popup.value.close()
common.loading('发送中...') common.loading('发送中...')
@@ -166,20 +166,24 @@
common.hideLoading() common.hideLoading()
} }
} }
const getData = () => { const getData = () => {
if (status.value !== 'loadmore' && status.value !== '') return
status.value = 'loading' status.value = 'loading'
page.value ++ page.value++
queryTraCrsBbsInfoByCrsId({ queryTraCrsBbsInfoByCrsId({
crsId: props.crsId, crsId: props.crsId,
page:page.value, page: page.value,
limit:20 limit: limit
}).then(({ }).then(res => {
body total.value = res.total
}) => { message_list.push(...res.body)
}).finally(() => {
message_list.concat(body) if (message_list.length >= total.value) {
// console.log('body', body); status.value = 'nomore'
Object.assign(message_list, message_list.concat(body)) } else {
status.value = 'loadmore'
}
}) })
} }
@@ -187,6 +191,9 @@
const showPicture = (urls, item) => { const showPicture = (urls, item) => {
const base_url = get_base_url() const base_url = get_base_url()
const current = urls.findIndex(res => item === res) const current = urls.findIndex(res => item === res)
if (current === -1) {
return false
}
const urlsList = urls.map(res => base_url + res) const urlsList = urls.map(res => base_url + res)
console.log(urlsList, current); console.log(urlsList, current);
uni.previewImage({ uni.previewImage({
@@ -198,9 +205,7 @@
success: function(data) { success: function(data) {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: urlsList[data.index], filePath: urlsList[data.index],
success: function() { success: function() {}
// that.$common.msg('下载成功')
}
}); });
}, },
fail: function(err) {} fail: function(err) {}
@@ -216,6 +221,10 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.popup {
z-index: 1200;
}
.empty_message_div { .empty_message_div {
display: flex; display: flex;
justify-content: center; justify-content: center;
@@ -274,6 +283,7 @@
height: 100%; height: 100%;
background-color: #FFFFFF; background-color: #FFFFFF;
display: flex; display: flex;
bottom: 40vh;
align-items: center; align-items: center;
padding: 10rpx 10rpx; padding: 10rpx 10rpx;
@@ -447,11 +457,13 @@
} }
} }
} }
.comment_scroll{
.comment_scroll {
height: calc(100vh - 92rpx - 22rpx - 187rpx); height: calc(100vh - 92rpx - 22rpx - 187rpx);
} }
.comment_div { .comment_div {
padding: 20rpx 0 200rpx 0; padding: 20rpx 0 20rpx 0;
background-color: #ffffff; background-color: #ffffff;
border-radius: 24rpx; border-radius: 24rpx;
position: relative; position: relative;
@@ -17,67 +17,12 @@
<view class="fz-30 font_pf text ellipsis-text">{{ item.pgrphContent }}</view> <view class="fz-30 font_pf text ellipsis-text">{{ item.pgrphContent }}</view>
</view> </view>
</view> </view>
<view class="point-item mb-30" v-for="(item, index) in modelValue?.pgrphData || []" :key="item.index"
@click="toDetail(item)" :class="item.pgrphStdyStateName == '已学习' ? 'learn' : 'unlearn'">
<view class="top mb-30">
<view class="blue-ball">
<view class="ball"></view>
</view>
<view class="fz-30 font_pf title">知识点{{ item.pgrphNm }}</view>
<view class="fl1">
</view>
<view class="font_pf fz-24 study-status" >
{{ item.pgrphStdyStateName }}
</view>
</view>
<view class="bottom">
<view class="fz-30 font_pf text ellipsis-text">{{ item.pgrphContent }}</view>
</view>
</view>
<view class="point-item mb-30" v-for="(item, index) in modelValue?.pgrphData || []" :key="item.index"
@click="toDetail(item)" :class="item.pgrphStdyStateName == '已学习' ? 'learn' : 'unlearn'">
<view class="top mb-30">
<view class="blue-ball">
<view class="ball"></view>
</view>
<view class="fz-30 font_pf title">知识点{{ item.pgrphNm }}</view>
<view class="fl1">
</view>
<view class="font_pf fz-24 study-status" >
{{ item.pgrphStdyStateName }}
</view>
</view>
<view class="bottom">
<view class="fz-30 font_pf text ellipsis-text">{{ item.pgrphContent }}</view>
</view>
</view>
<view class="point-item mb-30" v-for="(item, index) in modelValue?.pgrphData || []" :key="item.index"
@click="toDetail(item)" :class="item.pgrphStdyStateName == '已学习' ? 'learn' : 'unlearn'">
<view class="top mb-30">
<view class="blue-ball">
<view class="ball"></view>
</view>
<view class="fz-30 font_pf title">知识点{{ item.pgrphNm }}</view>
<view class="fl1">
</view>
<view class="font_pf fz-24 study-status" >
{{ item.pgrphStdyStateName }}
</view>
</view>
<view class="bottom">
<view class="fz-30 font_pf text ellipsis-text">{{ item.pgrphContent }}</view>
</view>
</view>
</template> </template>
<script setup> <script setup>
import {computed} from "vue" import {computed} from "vue"
import common from '@/common/common'; import common from '@/common/common';
const emit = defineEmits(['toStudyPrgh']) const emit = defineEmits(['toStudyPrgh'])
const props = defineProps({ const props = defineProps({
modelValue: Object modelValue: Object
}) })
+35 -38
View File
@@ -11,7 +11,7 @@
<view class="detail-body"> <view class="detail-body">
<view class="head-title font_pf"> <view class="head-title font_pf">
<view class="title-text"> <view class="title-text">
{{ '自行车支持下支自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩自行车支持下支持下在踩踩踩踩踩踩踩踩踩持下在踩踩踩踩踩踩踩踩踩' }} {{ form.crsName || '' }}
</view> </view>
<view class="title-num"> <view class="title-num">
<view class="num-item"> <view class="num-item">
@@ -29,7 +29,7 @@
</view> </view>
</view> </view>
<view class="body-box"> <view class="body-box">
<uv-sticky :customNavHeight="statusBarHeight" id='tabsDiv'> <uv-sticky :customNavHeight="statusBarHeight" id='tabsDiv' class="sticky">
<view class="body-tab"> <view class="body-tab">
<uv-tabs class="font_pf" :current="tabAct" :list="tabList" @change="tabSwitch" <uv-tabs class="font_pf" :current="tabAct" :list="tabList" @change="tabSwitch"
:scrollable="false" line-color="#0066FF" :scrollable="false" line-color="#0066FF"
@@ -52,7 +52,8 @@
<!-- </swiper-item> <!-- </swiper-item>
<swiper-item> --> <swiper-item> -->
<view class="evaluate" v-if="tabAct == 2 && form"> <view class="evaluate" v-if="tabAct == 2 && form">
<comment ref="commentRef" :crsNum="form.crsNum" :crsId="form.crsId" :imgId="form.imgId"></comment> <comment ref="commentRef" :crsNum="form.crsNum" :crsId="form.crsId" :imgId="form.imgId">
</comment>
</view> </view>
<!-- </swiper-item> <!-- </swiper-item>
</swiper> --> </swiper> -->
@@ -61,18 +62,17 @@
</view> </view>
</scroll-view> </scroll-view>
<view class="btn-box btn-box-height font_pf" v-if="[0,1,2].includes(tabAct)"> <view class="btn-box btn-box-height font_pf">
<template v-if="[0,1].includes(tabAct)">
<uv-button type="primary" <uv-button type="primary"
@click="common.navigateTo('/pages/course/study?crsNum='+crsNum+'&crsId='+form.crsId + '&imgId=' + form.imgId)">去学习</uv-button> @click="common.navigateTo('/pages/course/study?crsNum='+crsNum+'&crsId='+form.crsId + '&imgId=' + form.imgId)">去学习</uv-button>
<uv-button type="primary">去练习</uv-button> <uv-button type="primary">去练习</uv-button>
<uv-button type="primary">去考试</uv-button> <uv-button type="primary">去考试</uv-button>
</template>
<!-- <template v-if="tabAct == 2"> <template v-if="tabAct == 2">
<uv-button type="primary" class="send_evaluate" <uv-button type="primary" class="send_evaluate"
@click="common.navigateTo('/pages/courseDetail/submit?crsNum='+crsNum)">发布评价</uv-button> @click="common.navigateTo('/pages/courseDetail/submit?crsNum='+crsNum+'&imgId='+form.imgId)">发布评价</uv-button>
</template> --> </template>
</view> </view>
</view> </view>
@@ -148,26 +148,26 @@
const childScrollStatus = ref(false) const childScrollStatus = ref(false)
const scroll_fun = (e) => { const scroll_fun = (e) => {
scrollTop.value = e.detail.scrollTop scrollTop.value = e.detail.scrollTop
getElementPosition().then(res => { // getElementPosition().then(res => {
childScrollStatus.value = statusBarHeight === res.top // childScrollStatus.value = statusBarHeight === res.top
}) // })
} }
const swiper_change = (res) => { const swiper_change = (res) => {
tabAct.value = res.detail.current tabAct.value = res.detail.current
} }
const getElementPosition = () => { // const getElementPosition = () => {
return new Promise((resolve) => { // return new Promise((resolve) => {
uni.createSelectorQuery() // uni.createSelectorQuery()
.select('#tabsDiv') // .select('#tabsDiv')
.boundingClientRect(rect => { // .boundingClientRect(rect => {
if (rect) { // if (rect) {
resolve(rect) // 距离视口顶部的距离 // resolve(rect) // 距离视口顶部的距离
} // }
}).exec() // }).exec()
}) // })
} // }
onMounted(async () => { onMounted(async () => {
uni.$on('refresh_comment_data', () => { uni.$on('refresh_comment_data', () => {
@@ -299,6 +299,7 @@
padding-right: 16rpx; padding-right: 16rpx;
padding-top: 20rpx; padding-top: 20rpx;
padding-bottom: 245rpx; padding-bottom: 245rpx;
} }
.body-tab { .body-tab {
@@ -308,16 +309,13 @@
padding-bottom: 22rpx; padding-bottom: 22rpx;
margin-bottom: 24rpx; margin-bottom: 24rpx;
} }
.course-info,.point { .course-info,
.point,
.evaluate {
min-height: calc(100vh - 92rpx - 22rpx - 245rpx - var(--status-bar-height)); min-height: calc(100vh - 92rpx - 22rpx - 245rpx - var(--status-bar-height));
} }
// .body-swiper {
// // min-height: 100vh;
// height: calc(100vh - 92rpx - 22rpx - 187rpx - 20rpx - var(--status-bar-height));
// }
.btn-box-height { .btn-box-height {
height: 187rpx; height: 187rpx;
} }
@@ -330,7 +328,6 @@
padding-top: 37rpx; padding-top: 37rpx;
justify-content: space-around; justify-content: space-around;
background-color: #ffffff; background-color: #ffffff;
// background-color: red;
border: 2rpx solid #E5E5E5; border: 2rpx solid #E5E5E5;
z-index: 1000; z-index: 1000;
@@ -361,7 +358,7 @@
color: #666666; color: #666666;
} }
.learn { .learn {
color: #1dd17a; color: #1dd17a;
+4 -4
View File
@@ -16,7 +16,7 @@
<view class="ai-info"> <view class="ai-info">
<!-- <image src="@/static/images/dialog/pet-3.png" alt="" class="image-pet-bg"></image> --> <!-- <image src="@/static/images/dialog/pet-3.png" alt="" class="image-pet-bg"></image> -->
<image src="@/static/images/dialog/pet-bg-base.png" alt="" class="image-pet-bg"></image> <image src="@/static/images/dialog/pet-bg-base.png" alt="" class="image-pet-bg"></image>
<image-preview :src="userInfo.mascotInfo?.imgAddr ||''" alt="" class="image-pet"></image-preview> <image :src="userInfo.mascotInfo?.imgAddr ||''" alt="" class="image-pet" mode="widthFix"></image>
<view class="ai-info-bg-box"> <view class="ai-info-bg-box">
<view class="hello-text">Hi我是{{ userInfo.mascotInfo?.mascotName || ''}}</view> <view class="hello-text">Hi我是{{ userInfo.mascotInfo?.mascotName || ''}}</view>
<view class="info-text">工作学习我都能帮你</view> <view class="info-text">工作学习我都能帮你</view>
@@ -611,13 +611,13 @@
.image-pet { .image-pet {
width: 230rpx; width: 230rpx;
height: 235rpx; // height: 235rpx;
position: absolute; position: absolute;
right: 24rpx; right: 24rpx;
top: 15rpx; top: -20rpx;
z-index: 2; z-index: 2;
} }
.image-pet-bg { .image-pet-bg {
position: absolute; position: absolute;
padding: 0 24rpx; padding: 0 24rpx;
+24 -13
View File
@@ -46,7 +46,7 @@
<view class="study_duration_and_profile_div"> <view class="study_duration_and_profile_div">
<!-- 飞天兔子 --> <!-- 飞天兔子 -->
<view class="profile_div"> <view class="profile_div">
<image-preview :src="mascotInfo?.imgAddr ||''" alt="" class="profile"></image-preview> <image :src="mascotInfo?.imgAddr ||''" alt="" class="profile"></image>
<!-- <image src="/static/images/index/fttz.png" class="profile"></image> --> <!-- <image src="/static/images/index/fttz.png" class="profile"></image> -->
</view> </view>
<!-- 学习时长 --> <!-- 学习时长 -->
@@ -225,9 +225,9 @@
</template> </template>
<script setup> <script setup>
import { import {
computed, computed,
nextTick,
onBeforeMount, onBeforeMount,
onMounted, onMounted,
reactive, reactive,
@@ -236,7 +236,8 @@
import { import {
onShow, onShow,
onPageScroll, onPageScroll,
onLoad onLoad,
onHide
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import { import {
customStyles, customStyles,
@@ -249,15 +250,18 @@
} from '@/common/common'; } from '@/common/common';
import common from '@/common/common' import common from '@/common/common'
import {setMascot} from "@/common/mascot.js" import {
setMascot
} from "@/common/mascot.js"
import { import {
getStatisticsData, getStatisticsData,
queryCrsInfoByLastnew, queryCrsInfoByLastnew,
queryCrsInfoByPopular, queryCrsInfoByPopular,
queryCrsInfoByRecmd, queryCrsInfoByRecmd,
} from '@/api/index.js' } from '@/api/index.js'
const scrollTop = ref(0); const scrollTop = ref(0);
const mascotShow = ref(false);
const stdtTmLenRef = ref(null); const stdtTmLenRef = ref(null);
const accmPracticeCntRef = ref(null); const accmPracticeCntRef = ref(null);
const accmExamCntRef = ref(null); const accmExamCntRef = ref(null);
@@ -272,14 +276,14 @@
const bgOpacity = computed(() => { const bgOpacity = computed(() => {
return `rgba(246,248,255,${opacity.value})`; return `rgba(246,248,255,${opacity.value})`;
}); });
// 首页滑动事件监听 // 首页滑动事件监听
onPageScroll((e) => { onPageScroll((e) => {
scrollTop.value = e.scrollTop scrollTop.value = e.scrollTop
}) })
// 滚动消息 // 滚动消息
const notice_text = ref(['绿色金融政策解析与商业银行绿色水水水水水水水水水水水水水', '绿色金融政策解析与商业银行红色']) const notice_text = ref(['绿色金融政策解析与商业银行绿色水水水水水水水水水水水水水', '绿色金融政策解析与商业银行红色'])
const init_class_data = [{ const init_class_data = [{
@@ -386,10 +390,10 @@
common.navigateTo('/pages/login/login') common.navigateTo('/pages/login/login')
return return
} }
setMascot() setMascot()
const userInfo = getUserInfo() const userInfo = getUserInfo()
if(userInfo) { if (userInfo) {
mascotInfo.value = userInfo?.mascotInfo mascotInfo.value = userInfo?.mascotInfo
} }
statistics_data['get_statistics_data']() // 获取统计数据 statistics_data['get_statistics_data']() // 获取统计数据
@@ -403,6 +407,9 @@
recommend_class_list.value = res.body recommend_class_list.value = res.body
}) })
}) })
onHide(() => {
})
</script> </script>
@@ -603,6 +610,7 @@
color: #ffffff; color: #ffffff;
} }
.message_num_font { .message_num_font {
width: 22rpx; width: 22rpx;
height: 22rpx; height: 22rpx;
@@ -661,6 +669,7 @@
color: #ffffff; color: #ffffff;
} }
.message_num_font { .message_num_font {
width: 22rpx; width: 22rpx;
height: 22rpx; height: 22rpx;
@@ -729,18 +738,20 @@
.study_duration_div { .study_duration_div {
height: 162rpx; height: 162rpx;
background: linear-gradient(180deg, rgba(238, 246, 255, 0.65) 0%, #C5DFFD 4%, #FFFFFF 100%); background: linear-gradient(180deg, rgba(238, 246, 255, 0.65) 0%, #C5DFFD 4%, #FFFFFF 100%);
border-radius: 23rpx; border-radius: 23rpx;
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
z-index: 20; z-index: 20;
opacity: .9; opacity: .9;
.item { .item {
flex: 1; flex: 1;
// background-color: red; // background-color: red;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
.top { .top {
font-family: PingFangSC, PingFang SC; font-family: PingFangSC, PingFang SC;
font-weight: 400; font-weight: 400;
@@ -877,4 +888,4 @@
flex-direction: column; flex-direction: column;
background-color: #F6F8FF; background-color: #F6F8FF;
} }
</style> </style>
+5 -2
View File
@@ -67,8 +67,10 @@
} from 'vue'; } from 'vue';
import { import {
queryValidTraMascotInfo, queryValidTraMascotInfo,
queryCurrentValidMascotInfo,
setTraMascotInfo setTraMascotInfo
} from "@/api/mascot.js" } from "@/api/mascot.js"
import common from '@/common/common.js' import common from '@/common/common.js'
import { import {
setUserInfo, setUserInfo,
@@ -105,11 +107,12 @@
common.loading() common.loading()
setTraMascotInfo({ setTraMascotInfo({
mascotId: item.mascotId mascotId: item.mascotId
}).then(res => { }).then(async(res) => {
const mascotInfo = await queryCurrentValidMascotInfo()
const userInfo = getUserInfo() const userInfo = getUserInfo()
setUserInfo({ setUserInfo({
...userInfo, ...userInfo,
'mascotInfo': item 'mascotInfo': mascotInfo
}) })
common.hideLoading() common.hideLoading()
common.msg('设置成功') common.msg('设置成功')
+158 -166
View File
@@ -1,176 +1,168 @@
<template> <template>
<view class="container"> <view class="max_page detail-main">
<button class="download-btn" @click="saveImage2">下载图片</button> <nav-bar :is_seat="false"></nav-bar>
<view class="image-container" v-if="localImagePath"> <view class="fixed_search_div">
<image :src="localImagePath" mode="aspectFit" class="preview-image"></image> <view class="back_div" @click="common.navigateBack()">
</view> <view class="back-icon"></view>
<view class="status-text">{{statusText}}</view> </view>
</view> <view class="title font_pf">系统参数</view>
</view>
<view class="detail-body">
<uv-cell-group :border="false">
<uv-cell title="根域名" :value="url"></uv-cell>
<uv-cell title="当前环境:" :value="ENV.MODE"></uv-cell>
<uv-cell title="版本名称" :value="appBaseInfo.appVersion"></uv-cell>
<uv-cell title="版本号" :value="appBaseInfo.appVersionCode"></uv-cell>
<uv-cell title="点击1:" @click="aaaa"></uv-cell>
<uv-cell title="点击2:" :border="false" @click="bbbb"></uv-cell>
</uv-cell-group>
</view>
</view>
</template> </template>
<script> <script setup>
import common from '@/common/common';
import {
get_base_url
} from '../../api/request';
const url = get_base_url();
const ENV = import.meta.env
const appBaseInfo = uni.getAppBaseInfo()
console.log('appBaseInfo', appBaseInfo);
import showDialog from '@/common/dialogMessage'
export default { const bbbb = () => {
data() { // showDialog({
return { // title: '提示信息',
remoteImageUrl: 'https://aitstest.jlbank.com.cn:7002/traoss/tras3/show/S3T0250181221032025072317561000000449416', // 替换为实际图片URL // content: '检测到您已离开,即将退出学习页面。',
localImagePath: '', // confirmText: '确认',
statusText: '点击下载图片' // showCancel: false,
} // cancelText: '再想想',
}, // success: (res) => {
methods: { // if (res.confirm) {
downloadImage() { // console.log('用户点击确定');
// const filePath = '_doc/uniapp_save/17532626796030.jpeg'; // }
// },
// // 使用uni.getFileInfo替代access方法 // cancel: () => {
// uni.getFileInfo({ // console.log('用户点击取消');
// filePath: filePath, // 注意这里参数名是filePath而非path // }
// success: (res) => { // });
// console.log('本地图片存在,文件大小:', res.size);
// this.localImagePath = filePath;
// },
// fail: (err) => {
// console.log('本地图片不存在或获取失败:', err.errMsg);
// this.localImagePath = '';
// }
// });
showDialog({
this.statusText = '正在下载图片...' title: '提示',
uni.downloadFile({ content: '检测到您已存在学习记录,要继续学习吗?',
url: this.remoteImageUrl, confirmText: '重新学习',
success: (downloadResult) => { showCancel: true,
if (downloadResult.statusCode === 200) { cancelText: '继续学习',
this.saveImage(downloadResult.tempFilePath) success: (res) => {
} else { if (res.confirm) {
this.statusText = `下载失败,状态码: ${downloadResult.statusCode}` console.log('用户点击确定');
}
},
fail: (err) => {
this.statusText = `下载失败: ${err.errMsg}`
}
})
},
saveImage(tempFilePath) {
const savedFilePath = ''
this.statusText = '正在保存图片...'
uni.saveFile({
tempFilePath: tempFilePath,
filePath: savedFilePath,
success: (res) => {
this.localImagePath = res.savedFilePath
this.statusText = '图片保存成功'
this.showImage()
},
fail: (err) => {
if (err.errMsg.includes('permission denied')) {
this.statusText = '需要相册权限才能保存图片'
uni.showModal({
title: '权限申请',
content: '需要相册权限来保存图片到本地',
success: (modalRes) => {
if (modalRes.confirm) {
uni.openSetting()
}
}
})
} else {
this.statusText = `保存失败: ${err.errMsg}`
}
}
})
},
saveFileWithCN(fileUrl, customFileName) { // 文件下载地址, 自定义文件名
// const defaultPathPrefix = "_doc/uniapp_save";
// const fullPath = `${defaultPathPrefix}/${customFileName}`;
const fullPath = customFileName;
const dtask = plus.downloader.createDownload(fileUrl, {
filename: fullPath
}, (d, status) => {
if (status === 200) {
console.log("保存路径:", d.filename);
this.localImagePath = d.filename
} else {
console.error("文件下载失败:", status);
} }
});
dtask.start();
},
saveImage2() {
const base_url = 'https://aitstest.jlbank.com.cn:7002'
const pathName = '/traoss/tras3/show/S3T0250181221032025072318450600000455860'
const fileUrl = base_url + pathName
// 生成唯一文件名,避免冲突
const filename = pathName.split('/').pop()
const localFilePath = '_doc/jax/' + filename+'.png'
console.log('localFilePath', localFilePath, fileUrl);
// 先检查是否存在
uni.getFileInfo({
filePath: localFilePath,
success: () => {
console.log('头像已存在,无需下载');
this.localImagePath = localFilePath
}, },
fail: () => { cancel: () => {
console.log('头像不存在'); console.log('用户点击取消');
console.log('开始下载头像:', fileUrl);
const dtask = plus.downloader.createDownload(fileUrl, {
filename: localFilePath
}, (d, status) => {
if (status === 200) {
console.log("保存路径:", d.filename);
this.localImagePath = d.filename
} else {
console.error("文件下载失败:", status);
}
});
dtask.start();
} }
}) });
}, }
const aaaa = () => {
showImage() { common.show('提示','检测到您已存在学习记录,要继续学习吗?','继续学习', '重新学习').then(res => {
// 使用saveFile保存后的本地路径直接加载
console.log('本地图片路径:', this.localImagePath) })
}
}
} // function show(title, msg, showCancel = true, cancelText = '取消', confirmText = '确定') {
// showDialog({
// title: '提示',
// content: '检测到您已存在学习记录,要继续学习吗?',
// confirmText: '重新学习',
// showCancel: true,
// cancelText: '继续学习',
// success: (res) => {
// if (res.confirm) {
// console.log('用户点击确定');
// }
// },
// cancel: () => {
// console.log('用户点击取消');
// }
// });
}
</script> </script>
<style> <style lang="scss" scoped>
.container { $bg-margin-left: 50rpx;
padding: 20px;
display: flex; .detail-body {
flex-direction: column; margin: 30rpx $bg-margin-left 0 $bg-margin-left;
align-items: center; background: #ffffff;
} border-radius: 15rpx;
.download-btn { z-index: 101;
padding: 10px 20px; overflow: hidden;
background-color: #007AFF;
color: white; // 为了让线缩进来24单位
border-radius: 5px; :deep(.uv-line) {
margin-bottom: 20px; width: calc(100% - 48rpx) !important;
} margin: 0 24rpx !important;
.image-container { }
width: 100%;
height: 300px; :deep(.uv-cell__body) {
background-color: #f5f5f5; padding: 12px 15px;
border-radius: 5px; }
margin-bottom: 20px;
display: flex; :deep(.uv-cell__title) {
justify-content: center; flex: none !important;
align-items: center; }
} }
.preview-image {
max-width: 100%; .detail-main {
max-height: 100%; background-color: #F6F8FF;
} }
.status-text {
color: #666; .title {
font-size: 14px; color: #000000;
} font-size: 34rpx;
</style> height: 34rpx;
font-weight: 600;
// margin-bottom: 30rpx;
line-height: 34rpx;
}
.fixed_search_div {
padding: calc(10rpx + var(--status-bar-height)) 15rpx 24rpx 30rpx;
display: flex;
align-items: center;
background-color: #f6f7f8;
.back_div {
margin-right: 10rpx;
.back-icon {
position: relative;
width: 40rpx;
height: 40rpx;
cursor: pointer;
display: flex;
align-items: center;
}
.back-icon::before,
.back-icon::after {
content: '';
position: absolute;
transition: all 0.3s ease;
}
.back-icon::after {
top: 25%;
left: 25%;
width: 40%;
height: 40%;
border-top: 4rpx solid #2b2c2e;
border-left: 4rpx solid #2b2c2e;
transform: rotate(-45deg);
}
}
}
</style>