diff --git a/.env.development b/.env.development index 42c1ece7..2228066c 100644 --- a/.env.development +++ b/.env.development @@ -14,4 +14,7 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' # app入口 #VITE_APP_BASE_API_Url = 'http://25.16.122.65:7001' #VITE_APP_BASE_API_Url = 'http://25.16.122.91:9786' -#VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786' \ No newline at end of file +#VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786' + +# h5专用地址 +VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7002' \ No newline at end of file diff --git a/.env.sit b/.env.sit index 9623af29..8e8ed9e9 100644 --- a/.env.sit +++ b/.env.sit @@ -1,6 +1,5 @@ # SIT环境 ENV = 'sit' - # base api VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002' diff --git a/src/App.vue b/src/App.vue index 694860bc..c1d7d7ef 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,7 +1,13 @@ diff --git a/src/pages/courseDetail/submit.vue b/src/pages/courseDetail/submit.vue index 1b341fc5..74acac21 100644 --- a/src/pages/courseDetail/submit.vue +++ b/src/pages/courseDetail/submit.vue @@ -86,7 +86,7 @@ publishCrsEvaluation(formData).then(res => { common.msg('发表成功') setTimeout(() => { - uni.$emit('refresh_comment_data') + uni.$emit('setMascot') if(from.value === 'study'){ } else { } diff --git a/src/pages/index/dialog.vue b/src/pages/index/dialog.vue index 89bc4911..d5f27998 100644 --- a/src/pages/index/dialog.vue +++ b/src/pages/index/dialog.vue @@ -15,7 +15,7 @@ - + Hi,我是{{ userInfo.mascotInfo?.mascotName || ''}} 工作学习,我都能帮你! @@ -121,7 +121,7 @@ const socketStore = useSocketStore() const { SocketObj } = storeToRefs(socketStore) const userInfo = computed(() => getUserInfo()) - + console.log('userInfoxxx', getUserInfo()); const questionList = ref([ '对公小程序开户流程?', '厅堂服务经理2025年管理办法?', @@ -157,6 +157,7 @@ const answerIsOver = ref(true) const talkingList = ref([]) + const showModelComfirm = ref(false) const initsocketTask = () => { socketStore.creatSocket('/traask/asksocket/open?summary=') // unref(SocketObj).on('open', (res)=>{ @@ -171,19 +172,40 @@ // }) // } // }) + unref(SocketObj).on('error', () => { + if((watchFlag.value === 1) || showModelComfirm.value) return + showModelComfirm.value = true + common.show('提示信息', '网络环境不稳定,请重试!',false, '','确认').then((res) => { + common.redirectTo(`/pages/index/dialog`) + }).finally(() => { + showModelComfirm.value = false + }) + }) unref(SocketObj).on('message', (res)=>{ const { rtnCode, body, commond } = JSON.parse(res.data) let _id = new Date().getTime() + 'id' if(rtnCode === '0000'){ if(commond === 'ASK-OPEN'){ - // console.log('链接成功!') - sendMessage({ - "commond" : 'ASK-START', - "body" : { - mascotId: mascotId.value, - deviceImei: '' - } - }) + if(!answerIsOver.value){ + // 问题没完成, 重新尝试回答 + sendMessage({ + "commond" : 'ASK-RE-START', + "body" : { + reqBatch: reqBatch.value, + seqNo: seqNo.value, + answerContent: answerText.value + } + }) + }else{ + // 新连接 + sendMessage({ + "commond" : 'ASK-START', + "body" : { + mascotId: mascotId.value, + deviceImei: '' + } + }) + } return } if(commond === 'ASK-START'){ @@ -254,7 +276,6 @@ if(commond === 'ASK-ERR'){ console.log('提问失败,系统异常!') - console.log('body') return } }else{ @@ -421,38 +442,21 @@ initsocketTask() }) onHide(()=>{ - if(watchFlag.value === 1) return - // 停止获取 - sendMessage({ - "commond" : 'ASK-STOP', - "body" : { - reqBatch: reqBatch.value, - seqNo: seqNo.value, - } - }) - socketStore?.closeSocket() + // if(watchFlag.value === 1) return + // // 停止获取 + // sendMessage({ + // "commond" : 'ASK-STOP', + // "body" : { + // reqBatch: reqBatch.value, + // seqNo: seqNo.value, + // } + // }) + // socketStore?.closeSocket() }) onShow(()=>{ if(watchFlag.value === 1) return - socketStore?.createSocket() - if(!answerIsOver.value){ - sendMessage({ - "commond" : 'ASK-RE-START', - "body" : { - reqBatch: reqBatch.value, - seqNo: seqNo.value, - answerContent: answerText.value - } - }) - }else{ - sendMessage({ - "commond" : 'ASK-START', - "body" : { - mascotId: mascotId.value, - deviceImei: '' - } - }) - } + // initsocketTask() + }) onUnload(()=>{ watchFlag.value = 1 diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index d80504da..d7395538 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -46,7 +46,8 @@ - + + @@ -82,12 +83,13 @@ 课程中心 - + AI问答 - + AI陪练 @@ -129,7 +131,8 @@ - + {{item.crsName}} @@ -162,7 +165,8 @@ - + {{item.crsName}} @@ -194,7 +198,8 @@ - + {{item.crsName}} @@ -215,7 +220,6 @@ - @@ -239,7 +243,12 @@ placeholderStyle, suffixIconStyle } from './index.js' + import { + getUserInfo + } from '@/common/common'; + import common from '@/common/common' + import {setMascot} from "@/common/mascot.js" import { getStatisticsData, queryCrsInfoByLastnew, @@ -257,9 +266,11 @@ if (scrollTop.value <= 130) return 0; return Math.min(3, (scrollTop.value - 130) / 30); }); + const bgOpacity = computed(() => { return `rgba(246,248,255,${opacity.value})`; }); + // 首页滑动事件监听 onPageScroll((e) => { scrollTop.value = e.scrollTop @@ -283,7 +294,7 @@ const hot_class_list = ref([...init_class_data]) const new_class_list = ref([...init_class_data]) const recommend_class_list = ref([...init_class_data]) - + const mascotInfo = ref({}) const statistics_data = reactive({ 'stdtTmLen': 0, // 学习 'accmPracticeCnt': 0, // 训练 @@ -311,17 +322,17 @@ const stdtTmLen = res.body.stdtTmLen const accmPracticeCnt = res.body.accmPracticeCnt const accmExamCnt = res.body.accmExamCnt - if (stdtTmLen != this.stdtTmLen) { // 不相等就执行 + if (stdtTmLen != this.stdtTmLen) { this.startStdtTmLen = this.stdtTmLen this.stdtTmLen = stdtTmLen stdtTmLenRef.value.start() } - if (accmPracticeCnt != this.accmPracticeCnt) { // 不相等就执行 + if (accmPracticeCnt != this.accmPracticeCnt) { this.startAccmPracticeCnt = this.accmPracticeCnt this.accmPracticeCnt = accmPracticeCnt accmPracticeCntRef.value.start() } - if (accmExamCnt != this.accmExamCnt) { // 不相等就执行 + if (accmExamCnt != this.accmExamCnt) { this.startAccmExamCnt = this.accmExamCnt this.accmExamCnt = accmExamCnt accmExamCntRef.value.start() @@ -337,6 +348,21 @@ } }); + const index = ref(0) + const ai_test = () => { + index.value++ + if (index.value == 4) { + index.value = 1 + } + uni.setTabBarStyle({ + midButton: { + iconPath: "/static/images/icon/fawn-" + index.value + ".png", + width: "86px", + height: "86px", + iconWidth: "90px" + }, + }) + } // 进入搜索页 const goto_search_page = () => { common.navigateTo('/pages/search/search') @@ -345,8 +371,14 @@ const goto_course_detail = (crsNum) => { common.navigateTo('/pages/courseDetail/index?crsNum=' + crsNum) } + const scrolltolower = () => { + common.navigateTo('/pages/index/dialog', { + animationType: 'slide-in-bottom' + }) + } onShow(() => { - console.log('onShow'); + setMascot() + mascotInfo.value = getUserInfo('mascotInfo') if (!common.isLogin()) { common.navigateTo('/pages/login/login') return @@ -363,9 +395,6 @@ recommend_class_list.value = res.body }) }) - onLoad(async () => { - - }) @@ -381,7 +410,7 @@ width: 146rpx !important; border-radius: 16rpx; } - + // 底线样式 .bottom_line { margin: 0 auto; @@ -488,6 +517,7 @@ position: relative; z-index: 0; overflow-x: hidden; + // 背景图 .bg_img { position: absolute; diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue index 6c0ded28..19e25ca3 100644 --- a/src/pages/login/login.vue +++ b/src/pages/login/login.vue @@ -98,30 +98,28 @@ const login_fun = (): void => { const secretKey = 'EtBzqj+ln5tSTof1SDhpTg=='; const cipherText = encryptByAES(password.value, secretKey); useAccountLoginApp({ loginName: account.value, password: cipherText }) - .then(async () => { + .then(async (res) => { common.hideLoading(); - common.msg('登录成功'); // 登陆成功,缓存账号密码 common.setValue('loginAccountData', { account: account.value, password: password.value }); - // setTimeout(() => { - // this.$common.reLaunch('/pages/homepage/index'); - // }, this.GLOBAL_TIMER_SUBMIT_DELAY_TIME); - - // 不再在登录时创建ws链接 - // socketStore.creatSocket(); - - const pages = getCurrentPages(); - - if (pages.length >= 2) { - // 页面栈只有一页,没有返回页,那就返回首页 - console.log('返回登录的上一页'); - back_state.value = false; - common.navigateBack(); // 返回登录的上一页 + + if (res['mascotState']) { // 判断是否跳转到选科技鹿页面 + common.redirectTo('/pages/mascot/mascot_select_list'); } else { - common.switchTab('/pages/index/index'); + common.setValue('mascotState', false) // 清空科技鹿设置 + common.msg('登录成功'); + const pages = getCurrentPages(); + if (pages.length >= 2) { + // 页面栈只有一页,没有返回页,那就返回首页 + console.log('返回登录的上一页'); + back_state.value = false; + common.navigateBack(); // 返回登录的上一页 + } else { + common.switchTab('/pages/index/index'); + } } }) .catch((res) => { @@ -145,6 +143,7 @@ onMounted(() => { password.value = loginAccountData.password; } back_state.value = true; + }); // 跳进了登录页,禁止返回操作 onBackPress(() => back_state.value); diff --git a/src/pages/mascot/mascot_select_list.vue b/src/pages/mascot/mascot_select_list.vue index ab3a9a2d..021abd2e 100644 --- a/src/pages/mascot/mascot_select_list.vue +++ b/src/pages/mascot/mascot_select_list.vue @@ -13,7 +13,7 @@ - + @@ -41,15 +41,17 @@ --> - + - - + + @@ -60,7 +62,8 @@ onMounted, onUnmounted, ref, - reactive + reactive, + computed } from 'vue'; import { queryValidTraMascotInfo, @@ -75,35 +78,27 @@ onLoad } from '@dcloudio/uni-app'; const mascotList = reactive([]) - onLoad(() => { - common.loading() - queryValidTraMascotInfo().then(({ - body - }) => { - Object.assign(mascotList, { - ...body - }) - console.log(mascotList); - common.hideLoading() - }) - }) - const swiperCount = 4; // 总共有4个轮播项 + const windowsInfo = uni.getWindowInfo() + const nowWidth = ref(0); + + const swiperCount = 4; // 总轮播项数量 + let swiperIndex = ref(0); // 当前显示第1个(索引0) const isAnimating = ref(false); // 标记动画是否进行中 - const animationfinish = () => { - console.log("动画结束,允许下次点击"); + const animationfinish = ({ + detail + }) => { + swiperIndex.value = detail.current isAnimating.value = false; // 动画结束后重置状态 }; - + // 点击左右切换按钮 const doct_click = (num) => { if (isAnimating.value) return; // 1. 如果动画正在进行,直接忽略点击 isAnimating.value = true; let newIndex = (swiperIndex.value + num + swiperCount) % swiperCount; swiperIndex.value = newIndex; // 更新当前索引 }; - - // 选择他 const select_it = () => { const item = mascotList[swiperIndex.value] common.loading() @@ -117,14 +112,32 @@ }) common.hideLoading() common.msg('设置成功') + common.setValue('mascotState', false) setTimeout(() => { - common.navigateBack() + const pages = getCurrentPages(); + if (pages.length >= 2) { + // 页面栈只有一页,没有返回页,那就返回首页 + common.navigateBack(); // 返回登录的上一页 + } else { + common.switchTab('/pages/index/index'); + } }, 400) }).catch(() => { common.hideLoading() }) } - + onLoad(() => { + common.loading() + queryValidTraMascotInfo().then(({ + body + }) => { + Object.assign(mascotList, { + ...body + }) + console.log(mascotList); + common.hideLoading() + }) + }) onMounted(() => { }) @@ -228,8 +241,10 @@ margin-top: 20rpx; width: 80%; height: 120rpx; - + position: relative; + .img { + position: absolute; width: 100%; height: 100%; } diff --git a/src/pages/me/index.vue b/src/pages/me/index.vue index 9269b5c7..44f9d3d1 100644 --- a/src/pages/me/index.vue +++ b/src/pages/me/index.vue @@ -1,13 +1,12 @@ @@ -104,7 +105,8 @@ import { ref, computed, - reactive + reactive, + nextTick } from 'vue'; import { onShow @@ -125,8 +127,15 @@ import { useSocketStore } from "@/store/socket.js" + import { + updateDfSysUserExtandInfoImageAddr + } from "@/api/user.js" + import { + uploadFile + } from '@/api/common' + import {setMascot} from "@/common/mascot.js" + import { queryCurrentUser} from '@/api/login.js'; const socketStore = useSocketStore() - const accmTaskCntRef = ref(null); const accmPointRef = ref(null); const stdtTmLenRef = ref(null); @@ -194,16 +203,6 @@ const goTest = () => { console.log('goTest'); common.navigateTo('/pages/test/index'); - // const now = Date.now(); - // if (now - lastClickTime.value > 500) { - // clickCount.value = 0; - // } - // clickCount.value++; - // lastClickTime.value = now; - // if (clickCount.value == 6) { - // common.navigateTo('/pages/test/index'); - // clickCount.value = 0; - // } }; @@ -222,6 +221,8 @@ }); }; onShow(() => { + setMascot() + const user_info_cache = getUserInfo(); Object.assign(user_info, user_info_cache); console.log('user_info', user_info); @@ -231,6 +232,53 @@ console.log('下拉刷新'); uni.stopPullDownRefresh(); }); + + // 头像 + const avatarCropperStatus = ref(true) + const avatarCropperUrl = ref(''); + // 点击修改头像 + const click_update_avatar = (value) => { + uni.chooseImage({ + count: 1, + sizeType: ["compressed"], + success: (res) => { + avatarCropperUrl.value = res.tempFilePaths[0]; + avatarCropperStatus.value = true + }, + }); + }; + // 选择头像取消 + const onCancel = (value) => { + avatarCropperStatus.value = false + } + // 选择头像确定 + const onConfirm = (file) => { + avatarCropperStatus.value = false + nextTick(async() => { + common.loading('更新头像中') + try{ + const data = { + bizScen: 'S3007', + thumbnailFlag: true, + thumbImgSize:100 + } + // 上传图片 + const res = await uploadFile(file.tempFilePath, data) + // 更新个人信息 + await updateDfSysUserExtandInfoImageAddr({imageAddr : res.thumbFileId}) + // 更新个人信息 + const userData = await queryCurrentUser() + console.log('userData', ); + common.msg('修改成功') + + user_info.imageAddr = getUserInfo('imageAddr') + user_info.imagePath = getUserInfo('imagePath') + } catch { + common.msg('修改失败') + } + common.hideLoading() + }) + }