diff --git a/.env.development b/.env.development index 854a06b1..d587fddf 100644 --- a/.env.development +++ b/.env.development @@ -9,7 +9,7 @@ ENV = 'development' # VITE_APP_BASE_API_Url = 'http://25.18.122.78:9786' # DEV -VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' +VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' # app入口 #VITE_APP_BASE_API_Url = 'http://25.16.122.65:7001' @@ -17,4 +17,5 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' #VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786' # h5专用地址 -VITE_APP_BASE_H5_API_Url = 'http://25.18.122.66:9786' \ No newline at end of file + +VITE_APP_BASE_H5_API_Url = 'http://25.18.122.66:9786' diff --git a/src/api/dialog.js b/src/api/dialog.js new file mode 100644 index 00000000..38de539e --- /dev/null +++ b/src/api/dialog.js @@ -0,0 +1,12 @@ +import request from '@/api/request' + + + +// 获取问题list +export const queryHotQuestionApi = (data) => { + return request({ + url: '/traask/traAskchat/queryHotQuestion', + method: 'post', + data + }); +}; \ No newline at end of file diff --git a/src/api/login.js b/src/api/login.js index fa52f126..020ae326 100644 --- a/src/api/login.js +++ b/src/api/login.js @@ -119,51 +119,111 @@ export const queryCurrentUser = (data) => request({ const base_url = get_base_url() // 预加载头像 // #ifdef APP-PLUS + // 更新用户信息中的头像路径 const updateUserAvatar = (imagePath) => { - const userInfo = getUserInfo() - setUserInfo({ - ...userInfo, - 'imagePath': imagePath - }) + const userInfo = getUserInfo() + setUserInfo({ + ...userInfo, + 'imagePath': imagePath + }) } - - try { - const pathName = res.body.imageAddr - const url = base_url + pathName - // 生成唯一文件名,避免冲突 - const filename = pathName.split('/').pop() - const localFilePath = '_downloads/' + filename - console.log('localFilePath', localFilePath, url); - // 先检查是否存在 - uni.getFileInfo({ - filePath: localFilePath, - success: () => { - console.log('头像已存在,无需下载'); - updateUserAvatar(localFilePath) - }, - fail: () => { - console.log('开始下载头像:', url); - const dtask = plus.downloader.createDownload( - url, { - method: 'GET', - filename: '_downloads/' + filename - }, - (download, status) => { - if (status === 200) { - console.log('头像下载成功:', download.filename); - updateUserAvatar(download.filename) - } - } - ) - dtask.start(); - } - }) - - - } catch (error) { - console.error('头像预加载过程发生错误:', error); + + // 确保目录存在 + const ensureDirectoryExists = (dirPath) => { + return new Promise((resolve) => { + plus.io.requestFileSystem(plus.io.PRIVATE_DOC, (fs) => { + fs.root.getDirectory(dirPath, { create: true }, resolve, resolve) + }) + }) } + + // 生成唯一文件名 + const generateUniqueFilename = (pathName) => { + if (!pathName || typeof pathName !== 'string') { + throw new Error('无效的头像路径'); + } + + // 直接使用原始文件名(带扩展名) + const filename = pathName.split('/').pop(); + + if (!filename) { + throw new Error('无法从路径中提取文件名'); + } + + // 确保文件扩展名为.png (可选,根据实际需求) + const ext = filename.split('.').pop().toLowerCase(); + if (ext === 'png' || ext === 'jpg' || ext === 'jpeg' || ext === 'webp') { + return filename; + } + + // 如果没有有效扩展名,添加.png + return `${filename}.png`; + }; + + // 下载并保存头像 + const downloadAndSaveAvatar = async (fileUrl, localFilePath) => { + try { + await ensureDirectoryExists('avatar') + + return new Promise((resolve, reject) => { + console.log('开始下载头像:', fileUrl) + const dtask = plus.downloader.createDownload(fileUrl, { + filename: localFilePath + }, (d, status) => { + if (status === 200) { + console.log("保存路径:", d.filename) + resolve(d.filename) + } else { + console.error("文件下载失败:", status) + reject(new Error(`下载失败,状态码: ${status}`)) + } + }) + + dtask.start() + }) + } catch (error) { + console.error('创建目录失败:', error) + throw error + } + } + + // 检查文件是否存在 + const checkFileExists = (filePath) => { + return new Promise((resolve) => { + uni.getFileInfo({ + filePath, + success: () => resolve(true), + fail: () => resolve(false) + }) + }) + } + + // 主逻辑 + (async () => { + try { + const pathName = res.body.imageAddr + const fileUrl = base_url + pathName + + // 生成保存路径 + 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) + } + } catch (error) { + console.error('头像预加载过程发生错误:', error) + } + })() // #endif + return res.body }) diff --git a/src/pages/course/components/touchBtn.vue b/src/pages/course/components/touchBtn.vue index 8598c44f..940336de 100644 --- a/src/pages/course/components/touchBtn.vue +++ b/src/pages/course/components/touchBtn.vue @@ -75,6 +75,10 @@ const props = defineProps({ }) const { isDisabled, onlyVoice } = toRefs(props) const isLoadingState = computed(() => props.isLoading) + +const showTalkingModel = ref(false) +const keyboardIsShow = ref(false) + watch(()=>props.isLoading,()=>{},{ deep:true,immediate:true }) @@ -84,8 +88,13 @@ watch(()=>props.canAnswer,()=>{},{ watch(()=>props.onlyVoice,()=>{},{ deep:true,immediate:true }) -const showTalkingModel = ref(false) -const keyboardIsShow = ref(false) +watch(()=>props.isDisabled,(val)=>{ + if(val){ + keyboardIsShow.value = false + } +},{ + deep:true,immediate:true +}) const answerValue = ref('') @@ -315,6 +324,7 @@ const showKeyboard = () => { } } const changeBtn = () => { + if(props.isDisabled) return keyboardIsShow.value = !keyboardIsShow.value answerValue.value = '' } diff --git a/src/pages/courseDetail/components/comment.vue b/src/pages/courseDetail/components/comment.vue index 2d062b8c..273461c0 100644 --- a/src/pages/courseDetail/components/comment.vue +++ b/src/pages/courseDetail/components/comment.vue @@ -176,6 +176,7 @@ }).then(({ body }) => { + message_list.concat(body) // console.log('body', body); Object.assign(message_list, message_list.concat(body)) diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue index 9fd514d2..9fbae236 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -27,13 +27,13 @@ {{questionList[item-1]}} + @click="sendText(questionList[item-1].hotContent)">{{questionList[item-1].hotContent}} - {{questionList[item + Math.ceil(questionList.length/2)-1]}} + @click="sendText(questionList[item + Math.ceil(questionList.length/2)-1].hotContent)"> + {{questionList[item + Math.ceil(questionList.length/2)-1].hotContent}} @@ -123,6 +123,9 @@ import { commonUploadVoiceFile } from "@/api/common.js" + import { + queryHotQuestionApi + } from "@/api/dialog.js" const socketStore = useSocketStore() const { @@ -131,16 +134,16 @@ const userInfo = computed(() => getUserInfo()) console.log('userInfoxxx', getUserInfo()); const questionList = ref([ - '对公小程序开户流程?', - '厅堂服务经理2025年管理办法?', - '厅堂服务经理2025年考核表单?', - '吉林银行重要空白凭证调微业务操作规程?', - '协助有权机关查询冻结扣划业务操作规程?', - '柜面个人账户操作规程?', - '久悬未取款账户如何办理销户?', - '境外来华人员个人账户业务开户如何办理?', - '营业机构日间管理风险防控要点有哪些?', - '现金管理平台柜面业务操作?' + // '对公小程序开户流程?', + // '厅堂服务经理2025年管理办法?', + // '厅堂服务经理2025年考核表单?', + // '吉林银行重要空白凭证调微业务操作规程?', + // '协助有权机关查询冻结扣划业务操作规程?', + // '柜面个人账户操作规程?', + // '久悬未取款账户如何办理销户?', + // '境外来华人员个人账户业务开户如何办理?', + // '营业机构日间管理风险防控要点有哪些?', + // '现金管理平台柜面业务操作?' ]) const scrollBoxRef = ref() const scrollTop = ref(99999) @@ -166,6 +169,7 @@ const talkingList = ref([]) const showModelComfirm = ref(false) + const reconcatNum = ref(1) const initsocketTask = () => { socketStore.creatSocket('/traask/asksocket/open?summary=') // unref(SocketObj).on('open', (res)=>{ @@ -182,8 +186,13 @@ // }) unref(SocketObj).on('error', () => { if ((watchFlag.value === 1) || showModelComfirm.value) return + if (reconcatNum.value === 5) { + common.msg('系统网络异常,请稍后再试!') + return + } showModelComfirm.value = true common.show('提示信息', '网络环境不稳定,请重试!', false, '', '确认').then((res) => { + reconcatNum.value += 1 common.redirectTo(`/pages/index/dialog`) }).finally(() => { showModelComfirm.value = false @@ -472,8 +481,15 @@ } return false }); - + + const getQuestionList = () => { + queryHotQuestionApi().then(res=> { + console.log(res) + questionList.value = res.body + }) + } onMounted(() => { + getQuestionList() initsocketTask() }) onHide(() => { diff --git a/src/pages/me/index.vue b/src/pages/me/index.vue index 98a4bb2e..50aa6073 100644 --- a/src/pages/me/index.vue +++ b/src/pages/me/index.vue @@ -8,9 +8,9 @@ - - + + + @@ -221,7 +221,6 @@ } } }); - const user_info = reactive({ userName: '', userId: '', @@ -249,10 +248,7 @@ }; onShow(() => { setMascot() - - const user_info_cache = getUserInfo(); - Object.assign(user_info, user_info_cache); - console.log('user_info', user_info); + Object.assign(user_info, getUserInfo()); statistics_data['get_statistics_data'](); // 获取统计数据 }); onPullDownRefresh(() => { @@ -295,11 +291,10 @@ await updateDfSysUserExtandInfoImageAddr({imageAddr : res.thumbFileId}) // 更新个人信息 const userData = await queryCurrentUser() - console.log('userData', ); + console.log('userData', userData); common.msg('修改成功') - - user_info.imageAddr = getUserInfo('imageAddr') - user_info.imagePath = getUserInfo('imagePath') + user_info.imageAddr = userData.imageAddr + user_info.imagePath = '' } catch { common.msg('修改失败') } diff --git a/src/pages/setting/index.vue b/src/pages/setting/index.vue index 0417c374..f6794230 100644 --- a/src/pages/setting/index.vue +++ b/src/pages/setting/index.vue @@ -151,8 +151,8 @@ // 更新个人信息 const userData = await queryCurrentUser() common.msg('修改成功') - userInfo.value.imageAddr = getUserInfo('imageAddr') - userInfo.value.imagePath = getUserInfo('imagePath') + userInfo.value.imageAddr = userData.imageAddr + userInfo.value.imagePath = '' } catch { common.msg('修改失败') } diff --git a/src/pages/test/index - 副本.vue b/src/pages/test/index - 副本.vue index df2af06d..b5f2b3b1 100644 --- a/src/pages/test/index - 副本.vue +++ b/src/pages/test/index - 副本.vue @@ -1,46 +1,169 @@ + + .title { + color: #000000; + font-size: 34rpx; + 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); + } + } + } + \ No newline at end of file diff --git a/src/pages/test/index.vue b/src/pages/test/index.vue index b5f2b3b1..59472610 100644 --- a/src/pages/test/index.vue +++ b/src/pages/test/index.vue @@ -1,169 +1,176 @@ - - \ No newline at end of file + + \ No newline at end of file