Merge branch 'develop' into 'sit'

Develop

See merge request K17_AITS/tra-app!47
This commit is contained in:
李泉德
2025-07-21 10:59:40 +08:00
11 changed files with 274 additions and 118 deletions
+1 -1
View File
@@ -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:7002'
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# app入口
#VITE_APP_BASE_API_Url = 'http://25.16.122.65:7001'
+62 -52
View File
@@ -24,39 +24,46 @@ export const useAccountLoginApp = (data) => request({
}) => {
if (rtnCode === '0000') {
setToken(body)
// 获取科技鹿
queryCurrentValidMascotInfo().then((res) => {
const userInfo = getUserInfo()
setUserInfo({
...userInfo,
'mascotInfo': res
})
console.log('科技', res);
if (res.imgAddr) {
setTimeout(() => {
const img = new Image(); // 创建Image对象
// 图片加载成功(缓存完成)
img.onload = () => {
console.log(`图片缓存成功: ${url}`);
resolve(img); // 返回加载完成的Image对象
};
// queryCurrentValidMascotInfo().then(({body}) => {
// const userInfo = getUserInfo()
// setUserInfo({
// ...userInfo,
// 'mascotInfo': body
// })
// const userInfo2 = getUserInfo()
// console.log('设置科技鹿', userInfo2);
// if (body.imgAddr) {
// setTimeout(() => {
// const img = new Image(); // 创建Image对象
// // 图片加载成功(缓存完成)
// img.onload = () => {
// console.log(`图片缓存成功: ${url}`);
// resolve(img); // 返回加载完成的Image对象
// };
// 图片加载失败
img.onerror = () => {
console.error(`图片缓存失败: ${url}`);
reject(new Error(`Failed to load image: ${url}`));
};
// // 图片加载失败
// img.onerror = () => {
// console.error(`图片缓存失败: ${url}`);
// reject(new Error(`Failed to load image: ${url}`));
// };
// 开始加载图片(设置src触发请求,浏览器会自动缓存)
img.src = url;
})
}
// // 开始加载图片(设置src触发请求,浏览器会自动缓存)
// img.src = url;
// })
// }
// })
// const user_data = await queryCurrentUser()
const res = await Promise.all([queryCurrentUser(), queryCurrentValidMascotInfo()])
const userInfo = getUserInfo()
const mascotInfo = res[1]
setUserInfo({
...userInfo,
'mascotInfo': mascotInfo
})
const user_data = await queryCurrentUser()
return user_data
return {
mascotState:!mascotInfo.mascotId
}
}
return Promise.reject({
rtnCode,
@@ -95,6 +102,7 @@ export const queryCurrentUser = (data) => request({
method: 'post',
data
}).then(res => {
// deptId: ""
// deptName: null
// loginName: "ADMIN" // todo id
@@ -103,7 +111,9 @@ export const queryCurrentUser = (data) => request({
// userId: "USER001"
// userName: "ADMIN" / todo name
// userStatus: "01"
setUserInfo(res.body)
console.log('预加载头像');
const base_url = get_base_url()
// 预加载头像
@@ -124,29 +134,29 @@ export const queryCurrentUser = (data) => request({
const localFilePath = '_downloads/' + filename
// 先检查是否存在
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();
}
})
// 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) {
+28 -5
View File
@@ -1,6 +1,9 @@
import request from '@/api/request'
import {
get_base_url
} from '@/api/request.js'
const base_url = '/traapp'
const app_url = '/traapp'
/**
@@ -17,7 +20,7 @@ const base_url = '/traapp'
*/
export const queryValidTraMascotInfo = (data) => {
return request({
url: base_url + '/traMascotInfo/queryValidTraMascotInfo',
url: app_url + '/traMascotInfo/queryValidTraMascotInfo',
method: 'post',
toastErrors: true,
data
@@ -31,7 +34,7 @@ export const queryValidTraMascotInfo = (data) => {
*/
export const setTraMascotInfo = (data) => {
return request({
url: base_url + '/traMascotInfo/setTraMascotInfo',
url: app_url + '/traMascotInfo/setTraMascotInfo',
method: 'post',
toastErrors: true,
data
@@ -53,9 +56,29 @@ export const setTraMascotInfo = (data) => {
*/
export const queryCurrentValidMascotInfo = (data) => {
return request({
url: base_url + '/traMascotInfo/queryCurrentValidMascotInfo',
url: app_url + '/traMascotInfo/queryCurrentValidMascotInfo',
method: 'post',
toastErrors: true,
data
});
}).then(({
body
}) => {
if (body.imgAddr) {
// setTimeout(() => {
// const base_url = get_base_url()
// const url = base_url + body.imgAddr
// const img = new Image(); // 创建Image对象
// img.onload = () => {
// console.log(`图片缓存成功: ${url}`);
// };
// // 图片加载失败
// img.onerror = () => {
// console.error(`图片缓存失败: ${url}`);
// };
// img.src = url; // 开始加载图片(设置src触发请求,浏览器会自动缓存)
// })
}
return body
})
};
+1 -1
View File
@@ -8,7 +8,7 @@ const ENV = import.meta.env
export const get_base_url = url => {
if (ENV.MODE === 'development') { // 开发环境
return ENV.VITE_APP_BASE_API_Url
return ENV.VITE_APP_BASE_API_Url
// H5必须用非https,手机端必须用https
// #ifdef H5
const baseUrl = ENV.VITE_APP_BASE_API_Url
+5 -1
View File
@@ -126,7 +126,8 @@ import {
queryCrsInfoByPopularApi,
queryCrsInfoByRecmdApi
} from "@/api/course.js"
import { onMounted, ref, computed } from 'vue'
import { onMounted, onActivated, ref, computed } from 'vue'
import { onShow } from "@dcloudio/uni-app"
const customStyle = {
backgroundColor: "#ffffff",
paddingLeft: "40rpx",
@@ -288,6 +289,9 @@ import { onMounted, ref, computed } from 'vue'
})
changeTab({name:'全部'})
})
onActivated(() => {
changeTab({name:activeTab.value || '全部'})
});
</script>
+2 -2
View File
@@ -15,7 +15,7 @@
<view class="ai-info">
<!-- <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="userInfo.mascotInfo?.imgAddr ||''" alt="" class="image-pet"></image>
<image-preview :src="userInfo.mascotInfo?.imgAddr ||''" alt="" class="image-pet"></image-preview>
<view class="ai-info-bg-box">
<view class="hello-text">Hi我是{{ userInfo.mascotInfo?.mascotName || ''}}</view>
<view class="info-text">工作学习我都能帮你</view>
@@ -121,7 +121,7 @@
const socketStore = useSocketStore()
const { SocketObj } = storeToRefs(socketStore)
const userInfo = computed(() => getUserInfo())
console.log('userInfoxxx', getUserInfo());
const questionList = ref([
'对公小程序开户流程?',
'厅堂服务经理2025年管理办法?',
+7 -7
View File
@@ -129,7 +129,7 @@
<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.imgThumbId" mode="scaleToFill"></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 +161,8 @@
<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.imgThumbId" mode="scaleToFill"></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 +194,7 @@
<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.imgThumbId" mode="scaleToFill"></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>
@@ -311,17 +311,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()
+14 -17
View File
@@ -98,30 +98,27 @@ 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(); // 返回登录的上一页
// res['mascotState']
if (false) { // 判断是否跳转到选科技鹿页面
common.redirectTo('/pages/mascot/mascot_select_list');
} else {
common.switchTab('/pages/index/index');
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) => {
+94 -25
View File
@@ -13,12 +13,13 @@
</view>
<view class="fl1"></view>
<view class="mascot_div">
<view class="doct_icon left" @click="doct_click(1)">
<view class="doct_icon left" @click="doct_click(-1)">
<view class="doct_icon_div">
<image src="/src/static/images/mascot/btn_left.png" class="img" mode="widthFix"></image>
</view>
</view>
<swiper class="swiper" circular :current="swiperIndex" @animationfinish='animationfinish'>
<swiper class="swiper" circular :current="swiperIndex" @animationfinish='animationfinish'
@transition="transition">
<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> -->
@@ -41,15 +42,17 @@
</view>
</swiper-item> -->
</swiper>
<view class="doct_icon right" @click="doct_click(-1)">
<view class="doct_icon right" @click="doct_click(1)">
<view class="doct_icon_div">
<image src="/src/static/images/mascot/btn_right.png" class="img" mode="widthFix"></image>
</view>
</view>
</view>
<view class="button_div">
<image src="@/static/images/mascot/btn_2.png" class="img" mode="aspectFit" @click="select_it()"></image>
<image src="@/static/images/mascot/btn_1.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>
@@ -60,7 +63,8 @@
onMounted,
onUnmounted,
ref,
reactive
reactive,
computed
} from 'vue';
import {
queryValidTraMascotInfo,
@@ -74,28 +78,68 @@
import {
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; // 总轮播项数量
const TRANSITION_RATIO = 0.3;
// 计算过渡起点(像素值,取整):屏幕宽度的20%位置
const TRANSITION_SUM = computed(() => Math.floor(windowsInfo.screenWidth * TRANSITION_RATIO));
const TRANSITION_START = computed(() => Math.floor(windowsInfo.screenWidth * (1 - TRANSITION_RATIO)));
// 计算过渡终点(像素值,取整):屏幕宽度的80%位置
const TRANSITION_END = computed(() => Math.floor(windowsInfo.screenWidth * TRANSITION_RATIO));
// 第一张图透明度(0、2索引显示)
const btn1Opacity = computed(() => {
if (initialIndex % 2 === 1) { // 淡入
console.log('111我淡入淡入');
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.value) {
return 1;
} else {
return Math.max(0, 1 - (TRANSITION_END.value - nowWidth.value) / TRANSITION_SUM.value);
}
}
});
const btn2Opacity = computed(() => {
return 0;
const initialIndex = swiperIndex.value;
if (initialIndex % 2 === 0) { // 淡入
console.log('222我淡入');
if (nowWidth.value <= TRANSITION_START.value) {
return 1;
} else {
return Math.max(0, 1 - (TRANSITION_END.value - nowWidth.value) / TRANSITION_SUM.value);
}
} else { // 淡出
console.log('222我淡出');
if (nowWidth.value >= TRANSITION_END.value) {
return 0;
} else {
return Math.min(1, (nowWidth.value - TRANSITION_START.value) / TRANSITION_SUM.value);
}
}
});
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;
@@ -103,7 +147,13 @@
swiperIndex.value = newIndex; // 更新当前索引
};
// 选择他
// 当前宽度
const transition = ({
detail
}) => {
nowWidth.value = Math.abs(detail.dx)
}
const select_it = () => {
const item = mascotList[swiperIndex.value]
common.loading()
@@ -118,13 +168,30 @@
common.hideLoading()
common.msg('设置成功')
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 +295,10 @@
margin-top: 20rpx;
width: 80%;
height: 120rpx;
position: relative;
.img {
position: absolute;
width: 100%;
height: 100%;
}
+60 -5
View File
@@ -1,13 +1,12 @@
<template>
<view class="main_div max_page">
<nav-bar :is_seat="false"></nav-bar>
<view class="bg_div">
<image src="/static/images/me/bg.png" class="bg_img"></image>
<view class="user_data_div">
<!-- 用户个人信息 -->
<view class="personal_information">
<view class="profile">
<view class="profile" @click="click_update_avatar()">
<!-- <image-preview v-if="user_info.imageAddr" class="img_100" :src="user_info.imageAddr"></image-preview> -->
<image v-if="user_info.imagePath" class="img_100" :src="user_info.imagePath"></image>
<image-preview v-else-if="user_info.imageAddr" class="img_100"
@@ -26,7 +25,7 @@
</image>
</view>
</view>
<view class="work_number_div">工号{{ user_info.userId }}</view>
<view class="work_number_div">工号{{ user_info.loginName }}</view>
<view class="fl1"></view>
</view>
</view>
@@ -97,6 +96,8 @@
</uv-cell-group>
</view>
<tabbar-shadow></tabbar-shadow>
<avatar-cropper v-if="avatarCropperStatus" mode="ratio" :imageUrl="avatarCropperUrl" :width="500" :height="500"
:delay="150" @cancel="onCancel" @confirm="onConfirm"></avatar-cropper>
</view>
</template>
@@ -104,7 +105,8 @@
import {
ref,
computed,
reactive
reactive,
nextTick
} from 'vue';
import {
onShow
@@ -125,8 +127,14 @@
import {
useSocketStore
} from "@/store/socket.js"
import {
updateDfSysUserExtandInfoImageAddr
} from "@/api/user.js"
import {
uploadFile
} from '@/api/common'
import { queryCurrentUser} from '@/api/login.js';
const socketStore = useSocketStore()
const accmTaskCntRef = ref(null);
const accmPointRef = ref(null);
const stdtTmLenRef = ref(null);
@@ -231,6 +239,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()
})
}
</script>
<style scoped lang="scss">
-2
View File
@@ -172,8 +172,6 @@
common.hideLoading()
})
};
onLoad((params) => {
userInfo.value = getUserInfo()
});