Merge branch 'sit' into 'uat'

Sit

See merge request K17_AITS/tra-app!50
This commit is contained in:
李泉德
2025-07-21 17:09:40 +08:00
24 changed files with 354 additions and 191 deletions
+4 -1
View File
@@ -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'
#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')
+63 -52
View File
@@ -24,39 +24,47 @@ 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
console.log(mascotInfo);
return {
mascotState:!mascotInfo.mascotId
}
}
return Promise.reject({
rtnCode,
@@ -95,6 +103,7 @@ export const queryCurrentUser = (data) => request({
method: 'post',
data
}).then(res => {
// deptId: ""
// deptName: null
// loginName: "ADMIN" // todo id
@@ -103,7 +112,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 +135,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 -3
View File
@@ -6,11 +6,10 @@ import common from '@/common/common.js'
const ENV = import.meta.env
export const get_base_url = url => {
if (ENV.MODE === 'development') { // 开发环境
return ENV.VITE_APP_BASE_API_Url
// 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')
@@ -68,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"
+1
View File
@@ -115,6 +115,7 @@ const initRecord = () => {
let _recordPerm = uni.getAppAuthorizeSetting()
let _state = _recordPerm.microphoneAuthorized
if(_state === 'authorized'){
console.log('大大大大大');
showTalkingModel.value = true
}
})
+11 -7
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",
@@ -280,14 +281,17 @@ import { onMounted, ref, computed } from 'vue'
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(() => {
changeTab({name:activeTab.value || '全部'})
});
</script>
+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 {
}
+44 -40
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年管理办法?',
@@ -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
+46 -16
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.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>
@@ -162,7 +165,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.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>
@@ -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.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>
@@ -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, // 训练
@@ -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 () => {
})
</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;
+16 -17
View File
@@ -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);
+41 -26
View File
@@ -13,7 +13,7 @@
</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>
@@ -41,15 +41,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 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>
</view>
<view class="fl1"></view>
</view>
@@ -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%;
}
+63 -15
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,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()
})
}
</script>
<style scoped lang="scss">
-2
View File
@@ -172,8 +172,6 @@
common.hideLoading()
})
};
onLoad((params) => {
userInfo.value = getUserInfo()
});
+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