Merge branch 'develop' into 'sit'

Develop

See merge request K17_AITS/tra-app!49
This commit is contained in:
李泉德
2025-07-21 17:02:54 +08:00
21 changed files with 148 additions and 158 deletions
+5 -2
View File
@@ -9,9 +9,12 @@ 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'
#VITE_APP_BASE_API_Url = 'http://25.16.122.91:9786'
#VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
#VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
# h5专用地址
VITE_APP_BASE_H5_API_Url = 'https://aitstest.jlbank.com.cn:7002'
-1
View File
@@ -1,6 +1,5 @@
# SIT环境
ENV = 'sit'
# base api
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
+7 -1
View File
@@ -1,7 +1,13 @@
<script>
export default {
onLaunch: function () {
// console.log('App Launch')
uni.onTabBarMidButtonTap(() => {
uni.navigateTo({
url: '/pages/index/dialog',
animationType: 'slide-in-bottom'
});
})
console.log('App Launch')
},
onShow: function () {
// console.log('App Show')
+1
View File
@@ -61,6 +61,7 @@ export const useAccountLoginApp = (data) => request({
...userInfo,
'mascotInfo': mascotInfo
})
console.log(mascotInfo);
return {
mascotState:!mascotInfo.mascotId
}
+1 -2
View File
@@ -6,10 +6,10 @@ import common from '@/common/common.js'
const ENV = import.meta.env
export const get_base_url = url => {
if (ENV.MODE === 'development') { // 开发环境
// H5必须用非https,手机端必须用https
// #ifdef H5
return ENV.VITE_APP_BASE_H5_API_Url || ENV.VITE_APP_BASE_API_Url
const baseUrl = ENV.VITE_APP_BASE_API_Url
if (baseUrl.startsWith('https')) {
return baseUrl.replace('https', 'http')
@@ -67,7 +67,6 @@ export default function request({
headers_base['summary'] = token // 让每个请求携带令牌
}
let that = this
console.log('base_url', base_url, url);
return new Promise((resolve, reject) => {
uni.request({
url: `${baseUrl || base_url}${url}`,
+3 -2
View File
@@ -140,7 +140,7 @@ export default class WebSocketUtil {
* @param {string|Object} message - 要发送的消息,可以是字符串或对象
* @returns {WebSocketUtil} - 返回当前实例,支持链式调用
*/
send(message) {
send(message, num = 1) {
if (this.socketTask && this.getStatus() === 1) {
// 发送消息,对象会自动转换为JSON字符串
this.socketTask.send({
@@ -156,8 +156,9 @@ export default class WebSocketUtil {
} else {
console.error('WebSocket连接未打开,无法发送消息');
this.triggerEvent('error', new Error('WebSocket连接未打开'));
if(num === 10) return
setTimeout(()=>{
this.send(message)
this.send(message, num + 1)
},500)
}
return this;
+23
View File
@@ -0,0 +1,23 @@
// 设置科技鹿
import {getUserInfo} from "@/common/common.js"
import common from "@/common/common.js"
export const setMascot = () => {
const mascotState = common.getValue('mascotState') || false
console.log('设置科技鹿', mascotState);
if (!mascotState) {
const userInfo = getUserInfo()
const mascotInfo = userInfo['mascotInfo']
uni.setTabBarStyle({
midButton: {
iconPath: "/static/images/icon/fawn-" + (mascotInfo?.mascotNo || '1') + ".png",
width: "86px",
height: "86px",
iconWidth: "90px"
},
success: () => {
common.setValue('mascotState', true)
}
})
}
return mascotState
}
+1 -1
View File
@@ -190,7 +190,7 @@
"height": "70px",
"spacing": "10px",
"midButton": {
"iconPath": "/static/images/icon/fawn.png",
"iconPath": "/static/images/icon/fawn-1.png",
"width": "86px",
"height": "86px",
"iconWidth": "90px"
+6 -6
View File
@@ -281,12 +281,12 @@ import { onShow } from "@dcloudio/uni-app"
getCourseTypeListApi().then(res=>{
courseTypeList.value = res.body||[]
})
getPrdLineTypeListApi().then(res=>{
coursePrdlineList.value = res.body||[]
})
getTraTagListApi().then(res=>{
tagsTree.value = res.body||[]
})
// getPrdLineTypeListApi().then(res=>{
// coursePrdlineList.value = res.body||[]
// })
// getTraTagListApi().then(res=>{
// tagsTree.value = res.body||[]
// })
changeTab({name:'全部'})
})
onActivated(() => {
+1 -1
View File
@@ -86,7 +86,7 @@
publishCrsEvaluation(formData).then(res => {
common.msg('发表成功')
setTimeout(() => {
uni.$emit('refresh_comment_data')
uni.$emit('setMascot')
if(from.value === 'study'){
} else {
}
+42 -38
View File
@@ -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
+44 -14
View File
@@ -46,7 +46,8 @@
<view class="study_duration_and_profile_div">
<!-- 飞天兔子 -->
<view class="profile_div">
<image src="/static/images/index/fttz.png" class="profile"></image>
<image-preview :src="mascotInfo?.imgAddr ||''" alt="" class="profile"></image-preview>
<!-- <image src="/static/images/index/fttz.png" class="profile"></image> -->
</view>
<!-- 学习时长 -->
<view class="study_duration_div">
@@ -82,12 +83,13 @@
<image class="icon" src="@/static/images/index/navigation_course.png"></image>
<view class="title">课程中心</view>
</view>
<view class="item" @click="common.navigateTo('/pages/index/dialog',{ animationType: 'slide-in-bottom'})">
<view class="item"
@click="common.navigateTo('/pages/index/dialog',{ animationType: 'slide-in-bottom'})">
<image class="icon" src="@/static/images/index/navigation_question_answering.png"></image>
<view class="title">AI问答</view>
</view>
<view class="item">
<image class="icon" src="@/static/images/index/navigation_ai.png"></image>
<image class="icon" src="@/static/images/index/navigation_ai.png" @click="ai_test()"></image>
<view class="title">AI陪练</view>
</view>
<view class="item">
@@ -129,7 +131,8 @@
<uv-skeleton :loading="!item.crsNum" :rows="3" avatar avatar-shape="square" :title="false">
<view class="item" @click="goto_course_detail(item.crsNum)">
<view class="left">
<image-preview class="img-box img" :imgId="item.imgId" mode="aspectFill" :isCache="true" :width="240" :height="240"></image-preview>
<image-preview class="img-box img" :imgId="item.imgId" mode="aspectFill"
:isCache="true" :width="240" :height="240"></image-preview>
</view>
<view class="right">
<view class="title ellipsis-text">{{item.crsName}}</view>
@@ -161,8 +164,9 @@
<view class="item_div">
<uv-skeleton :loading="!item.crsNum" :rows="3" avatar avatar-shape="square" :title="false">
<view class="item" @click="goto_course_detail(item.crsNum)">
<view class="left">
<image-preview class="img-box img" :imgId="item.imgId" mode="aspectFill" :isCache="true" :width="240" :height="240"></image-preview>
<view class="left">
<image-preview class="img-box img" :imgId="item.imgId" mode="aspectFill"
:isCache="true" :width="240" :height="240"></image-preview>
</view>
<view class="right">
<view class="title ellipsis-text">{{item.crsName}}</view>
@@ -194,7 +198,8 @@
<uv-skeleton :loading="!item.crsNum" :rows="3" avatar avatar-shape="square" :title="false">
<view class="item" @click="goto_course_detail(item.crsNum)">
<view class="left">
<image-preview class="img-box img" :imgId="item.imgId" mode="aspectFill" :isCache="true" :width="240" :height="240"></image-preview>
<image-preview class="img-box img" :imgId="item.imgId" mode="aspectFill"
:isCache="true" :width="240" :height="240"></image-preview>
</view>
<view class="right">
<view class="title ellipsis-text">{{item.crsName}}</view>
@@ -215,7 +220,6 @@
<uv-divider text='我是有底线的' lineColor="#9cB0DC" :hairline="true"></uv-divider>
</view>
</view>
<tabbar-shadow></tabbar-shadow>
</view>
</template>
@@ -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, // 训练
@@ -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 () => {
})
</script>
@@ -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;
+4 -2
View File
@@ -105,10 +105,11 @@ const login_fun = (): void => {
account: account.value,
password: password.value
});
// res['mascotState']
if (false) { // 判断是否跳转到选科技鹿页面
if (res['mascotState']) { // 判断是否跳转到选科技鹿页面
common.redirectTo('/pages/mascot/mascot_select_list');
} else {
common.setValue('mascotState', false) // 清空科技鹿设置
common.msg('登录成功');
const pages = getCurrentPages();
if (pages.length >= 2) {
@@ -142,6 +143,7 @@ onMounted(() => {
password.value = loginAccountData.password;
}
back_state.value = true;
});
// 跳进了登录页,禁止返回操作
onBackPress(() => back_state.value);
+6 -77
View File
@@ -18,8 +18,7 @@
<image src="/src/static/images/mascot/btn_left.png" class="img" mode="widthFix"></image>
</view>
</view>
<swiper class="swiper" circular :current="swiperIndex" @animationfinish='animationfinish'
@transition="transition">
<swiper class="swiper" circular :current="swiperIndex" @animationfinish='animationfinish'>
<swiper-item class="" v-for="(item, index) in mascotList" :key="index">
<view class="swiper-item-div">
<!-- <image src="@/static/images/mascot/ma_1.png" class="img" mode="widthFix"></image> -->
@@ -49,10 +48,10 @@
</view>
</view>
<view class="button_div">
<image src="@/static/images/mascot/btn_1.png" class="img" mode="aspectFit"
<image v-show="swiperIndex % 2" src="@/static/images/mascot/btn_1.png" class="img" mode="aspectFit"
@click="select_it()"></image>
<image v-show="(swiperIndex+1) % 2" src="@/static/images/mascot/btn_2.png" class="img" mode="aspectFit"
@click="select_it()"></image>
<!-- <image :style="{ opacity: btn2Opacity }" src="@/static/images/mascot/btn_2.png" class="img" mode="aspectFit"
@click="select_it()"></image> -->
</view>
<view class="fl1"></view>
</view>
@@ -78,74 +77,12 @@
import {
onLoad
} from '@dcloudio/uni-app';
const mascotList = reactive([])
const windowsInfo = uni.getWindowInfo()
const nowWidth = ref(0);
let initialIndex = 0; // 总轮播项数量
const swiperCount = 4; // 总轮播项数量
const TRANSITION_RATIO = 0.3;
const aa = computed(() => Math.floor(nowWidth.value / windowsInfo.screenWidth ));
// 计算过渡起点(像素值,取整):屏幕宽度的20%位置
const TRANSITION_SUM = windowsInfo.screenWidth
const TRANSITION_START = Math.floor(windowsInfo.screenWidth * TRANSITION_RATIO)
// 计算过渡终点(像素值,取整):屏幕宽度的80%位置
const TRANSITION_END = Math.floor(windowsInfo.screenWidth * (1 - TRANSITION_RATIO))
// 第一张图透明度(0、2索引显示)
console.log(TRANSITION_SUM, TRANSITION_START, TRANSITION_END);
const btn1Opacity = computed(() => {
return 0;
if (initialIndex % 2 === 0) { // 淡入
if (nowWidth.value <= TRANSITION_START.value) {
return 0;
} else {
return Math.min(1, (nowWidth.value - TRANSITION_START.value) / TRANSITION_SUM.value);
}
} else { // 淡出
// console.log('111我淡出');
if (nowWidth.value >= TRANSITION_END) {
return 0;
} else {
return Math.max(0, 1 - (TRANSITION_END.value - nowWidth.value) / TRANSITION_SUM.value);
}
}
});
const btn2Opacity = computed(() => {
const aa = initialIndex
if (nowWidth.value === windowsInfo.screenWidth) {
initialIndex++
console.log('嘻嘻切换。initialIndex');
}
if (aa % 2 === 1) { // 淡入
// if (nowWidth.value <= TRANSITION_START) {
// console.log(1);
// return 1;
// } else {
// console.log(Math.max(0, 1 - (TRANSITION_END - nowWidth.value) / TRANSITION_SUM));
// return Math.max(0, 1 - (TRANSITION_END - nowWidth.value) / TRANSITION_SUM);
// }
} else { // 淡出
// console.log('222我淡出');
if (nowWidth.value >= TRANSITION_END) {
console.log('淡入1', nowWidth.value, TRANSITION_END);
return 1;
} else {
console.log('淡入2', nowWidth.value / TRANSITION_SUM);
console.log('淡入2', Math.min(1, nowWidth.value / TRANSITION_SUM));
return Math.min(0, nowWidth.value / TRANSITION_SUM);
}
}
});
let swiperIndex = ref(0); // 当前显示第1个(索引0
const isAnimating = ref(false); // 标记动画是否进行中
@@ -162,15 +99,6 @@
let newIndex = (swiperIndex.value + num + swiperCount) % swiperCount;
swiperIndex.value = newIndex; // 更新当前索引
};
// 当前宽度
const transition = ({
detail
}) => {
nowWidth.value = Math.abs(detail.dx)
console.log('宽度', nowWidth.value);
}
const select_it = () => {
const item = mascotList[swiperIndex.value]
common.loading()
@@ -184,6 +112,7 @@
})
common.hideLoading()
common.msg('设置成功')
common.setValue('mascotState', false)
setTimeout(() => {
const pages = getCurrentPages();
if (pages.length >= 2) {
@@ -313,7 +242,7 @@
width: 80%;
height: 120rpx;
position: relative;
.img {
position: absolute;
width: 100%;
+3 -10
View File
@@ -133,6 +133,7 @@
import {
uploadFile
} from '@/api/common'
import {setMascot} from "@/common/mascot.js"
import { queryCurrentUser} from '@/api/login.js';
const socketStore = useSocketStore()
const accmTaskCntRef = ref(null);
@@ -202,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;
// }
};
@@ -230,6 +221,8 @@
});
};
onShow(() => {
setMascot()
const user_info_cache = getUserInfo();
Object.assign(user_info, user_info_cache);
console.log('user_info', user_info);
+1 -1
View File
@@ -81,7 +81,7 @@
"height": "70px",
"spacing": "10px",
"midButton": {
"iconPath": "/static/images/icon/fawn.png",
"iconPath": "/static/images/icon/fawn-1.png",
"width": "86px",
"height": "86px",
"iconWidth": "90px"
Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB