修复BUG,1.当用户设置吉祥物页面强制退出,也能重新回到吉祥物设置也。2.改AI问答页为起始页,详细优化了从登录页到AI问答页的逻辑,详细的优化了从首页到AI问答页的逻辑。3。改了wensocket的全局弹出框跳转到登录页的逻辑
This commit is contained in:
@@ -7,6 +7,7 @@ export default {
|
||||
animationType: 'slide-in-bottom'
|
||||
});
|
||||
})
|
||||
// console.log('预加载');
|
||||
},
|
||||
onShow: function () {
|
||||
// console.log('App Show')
|
||||
|
||||
+20
-7
@@ -17,7 +17,7 @@ export const get_base_url = url => {
|
||||
return baseUrl
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
// #endif
|
||||
} else { // 其他环境,包括生产环境,sit环境,uat环境
|
||||
return ENV.VITE_APP_BASE_API_Url
|
||||
@@ -32,15 +32,28 @@ export const REQUES_ERROR_CODES = {
|
||||
// 去登录弹窗状态
|
||||
let no_login_show_modal_state = false
|
||||
// 去登录方法
|
||||
export const goto_login_fun = () => {
|
||||
export const goto_login_fun = (from = 'http') => {
|
||||
if (no_login_show_modal_state) return;
|
||||
no_login_show_modal_state = true
|
||||
let page_route = ''
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length >= 1) {
|
||||
const page = pages[pages.length - 1];
|
||||
page_route = page.route
|
||||
}
|
||||
if (page_route === 'pages/login/login') return;
|
||||
common.hideLoading()
|
||||
common.show('未登录', '现在去登录').then(() => {
|
||||
common.show('未登录', '现在去登录', false).then(() => {
|
||||
common.navigateTo('/pages/login/login')
|
||||
if (from === 'socket' && page_route !== '') {
|
||||
common.redirectTo('/pages/login/login?path=' + page_route)
|
||||
} else {
|
||||
common.navigateTo('/pages/login/login')
|
||||
}
|
||||
|
||||
}).finally(() => {
|
||||
no_login_show_modal_state = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export default function request({
|
||||
@@ -73,7 +86,7 @@ export default function request({
|
||||
data: data,
|
||||
method: method,
|
||||
header: headers_base,
|
||||
timeout:timeout,
|
||||
timeout: timeout,
|
||||
success: (response) => {
|
||||
if (isStream) { // 流式传输,直接返回
|
||||
return resolve(response);
|
||||
@@ -83,8 +96,8 @@ export default function request({
|
||||
const res = response.data
|
||||
if (res?.rtnCode === '0000') {
|
||||
return resolve(res)
|
||||
}else{
|
||||
if(toastErrors){
|
||||
} else {
|
||||
if (toastErrors) {
|
||||
common.msg(res?.message)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -69,13 +69,13 @@ export default class WebSocketUtil {
|
||||
clearInterval(this.reconnectTimer);
|
||||
this.reconnectTimer = null
|
||||
this.close()
|
||||
goto_login_fun();
|
||||
goto_login_fun('socket');
|
||||
return
|
||||
}
|
||||
}else{
|
||||
clearInterval(this.reconnectTimer); // 清除重连计时器
|
||||
this.reconnectTimer = null
|
||||
goto_login_fun();
|
||||
goto_login_fun('socket');
|
||||
return
|
||||
}
|
||||
this.triggerEvent('message', res); // 触发消息接收事件
|
||||
@@ -224,7 +224,7 @@ export default class WebSocketUtil {
|
||||
this.triggerEvent('error', new Error('达到最大重连次数'));
|
||||
this.reconnectTimer = null
|
||||
this.close()
|
||||
goto_login_fun()
|
||||
goto_login_fun('socket')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+31
-5
@@ -62,11 +62,36 @@ const loading = (title = '加载中', mask = true) => uni.showLoading({
|
||||
})
|
||||
const hideLoading = () => uni.hideLoading()
|
||||
|
||||
|
||||
// 防抖工具函数
|
||||
function debounce(fn, wait = 300) {
|
||||
let isLocked = false; // 锁定状态标记
|
||||
return function(...args) {
|
||||
// 如果处于锁定状态,直接返回不执行
|
||||
if (isLocked) {
|
||||
return;
|
||||
}
|
||||
// 执行函数
|
||||
fn.apply(this, args);
|
||||
|
||||
// 锁定,防止再次执行
|
||||
isLocked = true;
|
||||
|
||||
// 等待指定时间后解锁
|
||||
setTimeout(() => {
|
||||
isLocked = false;
|
||||
}, wait);
|
||||
};
|
||||
}
|
||||
|
||||
// 保留当前页面,跳转到应用内的某个页面,使用uni.navigateBack可以返回到原页面。
|
||||
const navigateTo = (url, data = {}) => uni.navigateTo({
|
||||
url: url,
|
||||
...data
|
||||
});
|
||||
const navigateTo = debounce(function(url, data = {}) {
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
...data
|
||||
});
|
||||
})
|
||||
|
||||
// 关闭所有页面,打开到应用内的某个页面。
|
||||
const reLaunch = url => {
|
||||
uni.reLaunch({
|
||||
@@ -80,9 +105,10 @@ const switchTab = url => {
|
||||
});
|
||||
}
|
||||
// 关闭当前页面,返回上一页面或多级页面。可通过 getCurrentPages() 获取当前的页面栈,决定需要返回几层。
|
||||
const navigateBack = (delta = 1, fun = () => {}) => {
|
||||
const navigateBack = (delta = 1, fun = () => {}, data = {}) => {
|
||||
uni.navigateBack({
|
||||
delta: delta,
|
||||
...data,
|
||||
success() {
|
||||
fun()
|
||||
}
|
||||
|
||||
+18
-20
@@ -1,30 +1,28 @@
|
||||
// 设置科技鹿
|
||||
import {getUserInfo} from "@/common/common.js"
|
||||
import {
|
||||
getUserInfo
|
||||
} from "@/common/common.js"
|
||||
import common from "@/common/common.js"
|
||||
export const setMascot = () => {
|
||||
// const mascotState = common.getValue('mascotState') || false
|
||||
const mascotState = false
|
||||
// console.log('设置科技鹿', mascotState);
|
||||
if (!mascotState) {
|
||||
|
||||
try{
|
||||
try {
|
||||
const userInfo = getUserInfo()
|
||||
const mascotInfo = userInfo?.mascotInfo
|
||||
console.log('设置科技鹿', mascotInfo);
|
||||
uni.setTabBarStyle({
|
||||
midButton: {
|
||||
iconPath: "/static/images/icon/fawn-" + (mascotInfo?.mascotNo || '1') + ".png",
|
||||
width: "86px",
|
||||
height: "86px",
|
||||
iconWidth: "90px"
|
||||
},
|
||||
success: () => {
|
||||
common.setValue('mascotState', true)
|
||||
}
|
||||
})
|
||||
} catch(e){
|
||||
|
||||
}
|
||||
if (mascotInfo) {
|
||||
uni.setTabBarStyle({
|
||||
midButton: {
|
||||
iconPath: "/static/images/icon/fawn-" + (mascotInfo?.mascotNo || '1') + ".png",
|
||||
width: "86px",
|
||||
height: "86px",
|
||||
iconWidth: "90px"
|
||||
},
|
||||
success: () => {
|
||||
common.setValue('mascotState', true)
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
return mascotState
|
||||
}
|
||||
+2
-1
@@ -5,7 +5,8 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "AI问答",
|
||||
"app-plus": {
|
||||
"titleNView": false
|
||||
"titleNView": false,
|
||||
"animationType": "fade-in"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
这里什么都没有
|
||||
</view>
|
||||
</view>
|
||||
<uv-load-more :status="status" loadmore-text="轻轻上拉加载"></uv-load-more>
|
||||
<uv-load-more v-if="total != 0" :status="status" loadmore-text="轻轻上拉加载"></uv-load-more>
|
||||
<uni-popup ref="popup" class="popup">
|
||||
<view class="bottom_reply_input_div" :style="{marginBottom:popup_input_bottom}">
|
||||
<uv-input v-model="reply_data.bbsContent" :adjustPosition="false"
|
||||
|
||||
+63
-35
@@ -5,7 +5,7 @@
|
||||
<view class="bot-bg"></view>
|
||||
<scroll-view class="index-dialog-body" :scroll-y="true" upper-threshold="0" refresher-enabled="true"
|
||||
refresher-default-style="none" @refresherrefresh="scrolltolower">
|
||||
|
||||
|
||||
<view class="body-title">
|
||||
<!-- <uv-icon class="arrow-icon" name="arrow-left" @click="common.navigateBack()"/> -->
|
||||
AI问答
|
||||
@@ -28,7 +28,8 @@
|
||||
<scroll-view :scroll-x="true" :show-scrollbar="false">
|
||||
<view class="question-row">
|
||||
<view class="question-item" v-for="item in Math.ceil(questionList.length/2)"
|
||||
@click="sendText(questionList[item-1].hotContent)">{{questionList[item-1].hotContent}}</view>
|
||||
@click="sendText(questionList[item-1].hotContent)">{{questionList[item-1].hotContent}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="question-row">
|
||||
<view class="question-item"
|
||||
@@ -128,18 +129,18 @@
|
||||
import {
|
||||
queryHotQuestionApi
|
||||
} from "@/api/dialog.js"
|
||||
const {
|
||||
statusBarHeight
|
||||
} = uni.getWindowInfo()
|
||||
const {
|
||||
statusBarHeight
|
||||
} = uni.getWindowInfo()
|
||||
|
||||
const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
|
||||
const socketStore = useSocketStore()
|
||||
const {
|
||||
SocketObj
|
||||
} = storeToRefs(socketStore)
|
||||
const userInfo = computed(() => getUserInfo())
|
||||
console.log('userInfoxxx', getUserInfo());
|
||||
|
||||
const userInfo = ref(getUserInfo())
|
||||
const questionList = ref([
|
||||
// '对公小程序开户流程?',
|
||||
// '厅堂服务经理2025年管理办法?',
|
||||
@@ -169,7 +170,7 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
const reqBatch = ref('')
|
||||
const seqNo = ref('')
|
||||
const mascotId = computed(() => {
|
||||
return unref(userInfo).mascotInfo?.mascotId || 'Tst00001'
|
||||
return unref(userInfo)?.mascotInfo?.mascotId || 'Tst00001'
|
||||
})
|
||||
const answerText = ref('')
|
||||
const answerIsOver = ref(true)
|
||||
@@ -261,7 +262,7 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
talkingList.value.push({
|
||||
type: 'answer',
|
||||
isLoading: true,
|
||||
id: _id+'loading'
|
||||
id: _id + 'loading'
|
||||
})
|
||||
scrollToBottomNow()
|
||||
return
|
||||
@@ -396,7 +397,24 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
}
|
||||
}
|
||||
const scrolltolower = () => {
|
||||
common.switchTab('/pages/index/index')
|
||||
const pages = getCurrentPages();
|
||||
const pageCount = pages?.length || 0;
|
||||
// 处理页面数量不足的情况,此为调试时候异常情况
|
||||
if (pageCount <= 1) {
|
||||
common.switchTab('/pages/index/index');
|
||||
return;
|
||||
}
|
||||
const prevPage = pages[pageCount - 2]; // 获取上一页实例并验证
|
||||
// 根据上一页路由决定跳转方式
|
||||
if (prevPage.route === 'pages/login/login') {
|
||||
// 登录页特殊处理,如果刚好等于2说明书刚启动,里面只有登录页和当前页,这样直接返回老首页
|
||||
pageCount === 2 ?
|
||||
common.switchTab('/pages/index/index') :
|
||||
common.navigateBack(2);
|
||||
} else {
|
||||
// 普通页面返回上一页
|
||||
common.navigateBack();
|
||||
}
|
||||
}
|
||||
const touchBtnCallBack = ref(null)
|
||||
const askData = ref({})
|
||||
@@ -416,7 +434,6 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
isLoading: true
|
||||
})
|
||||
scrollToBottomNow()
|
||||
console.log(voicePath, 111111111)
|
||||
commonUploadVoiceFile(voicePath, '/traask/traAskchat/voiceTrans', {}).then(res => {
|
||||
let _res = JSON.parse(res.data)
|
||||
if (_res.rtnCode === '0000') {
|
||||
@@ -482,7 +499,7 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
const pages = getCurrentPages();
|
||||
if (pages && pages.length > 1) {
|
||||
const page = pages[pages.length - 2];
|
||||
if (page.route === 'pages/login/login') {ß
|
||||
if (page.route === 'pages/login/login') {
|
||||
if (pages.length == 2) {
|
||||
common.switchTab('/pages/index/index');
|
||||
} else {
|
||||
@@ -494,40 +511,49 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
}
|
||||
return false
|
||||
});
|
||||
|
||||
|
||||
const getQuestionList = () => {
|
||||
queryHotQuestionApi().then(res=> {
|
||||
queryHotQuestionApi().then(res => {
|
||||
console.log(res)
|
||||
questionList.value = res.body
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
console.log('onMounted');
|
||||
const loadData = async () => {
|
||||
userInfo.value = getUserInfo();
|
||||
getQuestionList()
|
||||
initsocketTask()
|
||||
};
|
||||
onLoad(() => {
|
||||
if (!common.isLogin()) {
|
||||
common.navigateTo('/pages/login/login')
|
||||
return
|
||||
}
|
||||
// 判断下如果没有设置吉祥物就跳转到吉祥物页面
|
||||
if(userInfo.value?.mascotInfo.mascotId === null) { //说明这人在上次选吉祥物的时候退出了,没有选到吉祥物
|
||||
common.redirectTo('/pages/mascot/mascot_select_list');
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
|
||||
const refreshData = () => {
|
||||
loadData();
|
||||
};
|
||||
onHide(() => {
|
||||
// if(watchFlag.value === 1) return
|
||||
// // 停止获取
|
||||
// sendMessage({
|
||||
// "commond" : 'ASK-STOP',
|
||||
// "body" : {
|
||||
// reqBatch: reqBatch.value,
|
||||
// seqNo: seqNo.value,
|
||||
// }
|
||||
// })
|
||||
// socketStore?.closeSocket()
|
||||
|
||||
})
|
||||
onShow(() => {
|
||||
if (watchFlag.value === 1) return
|
||||
// initsocketTask()
|
||||
|
||||
|
||||
})
|
||||
onUnload(() => {
|
||||
watchFlag.value = 1
|
||||
socketStore?.closeSocket()
|
||||
})
|
||||
defineExpose({
|
||||
refreshData
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -564,14 +590,14 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
padding-top: v-bind(pageTopPadding);
|
||||
// display: flex;
|
||||
// flex-direction: column;
|
||||
|
||||
|
||||
|
||||
|
||||
.body-title {
|
||||
height: 90rpx;
|
||||
text-align: center;
|
||||
font-size: 33rpx;
|
||||
padding-top: 20rpx;
|
||||
|
||||
|
||||
line-height: 46rpx;
|
||||
box-sizing: border-box;
|
||||
font-weight: 500;
|
||||
@@ -635,7 +661,7 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
top: -20rpx;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
|
||||
.image-pet-bg {
|
||||
position: absolute;
|
||||
padding: 0 24rpx;
|
||||
@@ -716,6 +742,7 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.router-list {
|
||||
height: 84rpx;
|
||||
padding: 20rpx 30rpx 0;
|
||||
@@ -767,6 +794,7 @@ const pageTopPadding = computed(() => statusBarHeight + 'px')
|
||||
height: calc(100% - 832rpx);
|
||||
padding: 12rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
.talking-scroll-list {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
+14
-12
@@ -281,9 +281,6 @@
|
||||
onPageScroll((e) => {
|
||||
scrollTop.value = e.scrollTop
|
||||
})
|
||||
|
||||
|
||||
|
||||
// 滚动消息
|
||||
const notice_text = ref(['绿色金融政策解析与商业银行绿色水水水水水水水水水水水水水', '绿色金融政策解析与商业银行红色'])
|
||||
const init_class_data = [{
|
||||
@@ -336,16 +333,16 @@
|
||||
accmPracticeCnt: res.body.accmPracticeCnt || 0,
|
||||
accmExamCnt: res.body.accmExamCnt || 0
|
||||
};
|
||||
|
||||
|
||||
common.setValue('statistics_data', statistics_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 解构赋值获取最新值
|
||||
const {
|
||||
accmExamCnt = 0, accmPracticeCnt = 0, stdtTmLen = 0
|
||||
} = statistics_data;
|
||||
|
||||
|
||||
// 更新数据并触发动画
|
||||
if (stdtTmLen !== this.stdtTmLen) {
|
||||
this.startStdtTmLen = this.stdtTmLen
|
||||
@@ -362,14 +359,14 @@
|
||||
this.accmExamCnt = accmExamCnt
|
||||
accmExamCntRef.value.start()
|
||||
}
|
||||
|
||||
|
||||
} catch (error) {
|
||||
console.error('获取统计数据失败:', error);
|
||||
// 可以在这里添加更多的错误处理逻辑,比如显示错误提示
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const index = ref(0)
|
||||
const ai_test = () => {
|
||||
index.value++
|
||||
@@ -385,7 +382,7 @@
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 进入搜索页
|
||||
const goto_search_page = () => {
|
||||
common.navigateTo('/pages/search/search')
|
||||
@@ -402,19 +399,23 @@
|
||||
onLoad(() => {
|
||||
statistics_data['init'](); // 初始化数据
|
||||
// 检测如果没设置吉祥物,跳转到吉祥物界面
|
||||
|
||||
// 判断下如果没有设置吉祥物就跳转到吉祥物页面
|
||||
const userInfo = getUserInfo()
|
||||
if (userInfo?.mascotInfo.mascotId === null) { //说明这人在上次选吉祥物的时候退出了,没有选到吉祥物
|
||||
common.redirectTo('/pages/mascot/mascot_select_list');
|
||||
return
|
||||
}
|
||||
})
|
||||
onShow(() => {
|
||||
if (!common.isLogin()) {
|
||||
common.navigateTo('/pages/login/login')
|
||||
return
|
||||
}
|
||||
|
||||
setMascot()
|
||||
const userInfo = getUserInfo()
|
||||
if (userInfo) {
|
||||
mascotInfo.value = userInfo?.mascotInfo
|
||||
}
|
||||
setMascot()
|
||||
statistics_data['get_statistics_data']() // 获取统计数据
|
||||
queryCrsInfoByLastnew().then(res => {
|
||||
new_class_list.value = res.body
|
||||
@@ -567,6 +568,7 @@
|
||||
display: flex;
|
||||
margin-top: 106rpx;
|
||||
margin-left: $bg-margin-left;
|
||||
|
||||
.log_img {
|
||||
margin-left: 10rpx;
|
||||
// width: 300rpx;
|
||||
|
||||
+245
-225
@@ -6,7 +6,8 @@
|
||||
<image src="/static/images/login/profile.png" class="profile"></image>
|
||||
</view>
|
||||
<view class="title_logo">
|
||||
<image src="/static/images/login/logo_text.png" mode="heightFix" class="log_img" @click="goTest"></image>
|
||||
<image src="/static/images/login/logo_text.png" mode="heightFix" class="log_img" @click="goTest">
|
||||
</image>
|
||||
<view class="fl1"></view>
|
||||
</view>
|
||||
<view class="title_text_div">
|
||||
@@ -17,9 +18,11 @@
|
||||
</view>
|
||||
<view class="account_password_div">
|
||||
<view class="title1 font_pf">账号</view>
|
||||
<uv-input class="account_input" v-model="account" :adjustPosition="false" :maxlength="30" placeholder="请输入账号"></uv-input>
|
||||
<uv-input class="account_input" v-model="account" :adjustPosition="false" :maxlength="30"
|
||||
placeholder="请输入账号"></uv-input>
|
||||
<view class="title2 font_pf">密码</view>
|
||||
<uv-input class="account_input" v-model="password" :adjustPosition="false" :maxlength="20" placeholder="请输入密码" :type="show_password ? 'text' : 'password'" :password-icon="true">
|
||||
<uv-input class="account_input" v-model="password" :adjustPosition="false" :maxlength="20"
|
||||
placeholder="请输入密码" :type="show_password ? 'text' : 'password'" :password-icon="true">
|
||||
<template v-slot:suffix>
|
||||
<view class="show_password" @click="show_password = !show_password">
|
||||
<image v-if="show_password" class="img_100" src="@/static/images/login/show.png"></image>
|
||||
@@ -31,7 +34,8 @@
|
||||
<view class="fl1"></view>
|
||||
<view class="bottom_login_div">
|
||||
<view class="" @click="login_fun">
|
||||
<uv-button class="bottom_login_button" type="primary" :throttleTime="500" :disabled="login_button_status">登录</uv-button>
|
||||
<uv-button class="bottom_login_button" type="primary" :throttleTime="500"
|
||||
:disabled="login_button_status">登录</uv-button>
|
||||
</view>
|
||||
<view class="ysxy_div">
|
||||
<uv-checkbox-group v-model="read_text_state">
|
||||
@@ -51,254 +55,270 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// import { v4 as uuid4 } from 'uuid'
|
||||
import { onBackPress } from '@dcloudio/uni-app';
|
||||
import { ref, computed, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue';
|
||||
import common from '@/common/common';
|
||||
import { useAccountLoginApp, queryCurrentUser } from '@/api/login.js';
|
||||
import { encryptByAES } from '@/api/encryptAndDecryptData.js';
|
||||
// import { v4 as uuid4 } from 'uuid'
|
||||
import { onBackPress, onLoad } from '@dcloudio/uni-app';
|
||||
import { ref, computed, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue';
|
||||
import common from '@/common/common';
|
||||
import { useAccountLoginApp, queryCurrentUser } from '@/api/login.js';
|
||||
import { encryptByAES } from '@/api/encryptAndDecryptData.js';
|
||||
|
||||
import { useSocketStore } from '@/store/socket.js';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import {getPhoneEnvBool} from '@/common/common.js'
|
||||
const socketStore = useSocketStore();
|
||||
const { taskSocket } = storeToRefs(socketStore);
|
||||
import { useSocketStore } from '@/store/socket.js';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { getPhoneEnvBool } from '@/common/common.js'
|
||||
// interface PageVueInstance {
|
||||
// refreshData?: () => Promise<void> | void;
|
||||
// }
|
||||
// // 定义完整的页面实例类型(包含原生属性和$vm)
|
||||
// interface CustomPageInstance {
|
||||
// route: string; // 页面路由路径
|
||||
// options: Record<string, any>;// 页面参数
|
||||
// $vm: PageVueInstance; // 页面对应的Vue组件实例
|
||||
// }
|
||||
// 定义页面实例的类型(基于UniApp实际情况)
|
||||
|
||||
const show_password = ref<Boolean>(false);
|
||||
const account = ref<string>('');
|
||||
const password = ref<string>('');
|
||||
const read_text_state = ref<Array<unknown>>([]);
|
||||
const back_state = ref(true);
|
||||
// 登录按钮状态
|
||||
const login_button_status = computed<boolean>(() => !read_text_state.value.length);
|
||||
const clickCount = ref(0);
|
||||
const lastClickTime = ref(0);
|
||||
const goTest = () => {
|
||||
const now = Date.now();
|
||||
if (now - lastClickTime.value > 500) {
|
||||
clickCount.value = 0;
|
||||
}
|
||||
clickCount.value++;
|
||||
lastClickTime.value = now;
|
||||
if (clickCount.value == 6) {
|
||||
if (!account.value && password.value == '20010307' && !show_password.value) {
|
||||
common.navigateTo('/pages/test/index');
|
||||
const socketStore = useSocketStore();
|
||||
const { taskSocket } = storeToRefs(socketStore);
|
||||
const show_password = ref<Boolean>(false);
|
||||
const account = ref<string>('');
|
||||
const password = ref<string>('');
|
||||
const read_text_state = ref<Array<unknown>>([]);
|
||||
const back_state = ref(true);
|
||||
// 登录按钮状态
|
||||
const login_button_status = computed<boolean>(() => !read_text_state.value.length);
|
||||
const clickCount = ref<number>(0);
|
||||
const lastClickTime = ref<number>(0);
|
||||
const fromPagePath = ref<string>('');
|
||||
const goTest = () => {
|
||||
const now = Date.now();
|
||||
if (now - lastClickTime.value > 500) {
|
||||
clickCount.value = 0;
|
||||
}
|
||||
clickCount.value = 0;
|
||||
}
|
||||
};
|
||||
// 登录方法
|
||||
const login_fun = (): void => {
|
||||
// 验证
|
||||
if (login_button_status.value) return common.msg('请阅读并同意《隐私政策》');
|
||||
if (account.value === '') return common.msg('账号不能为空');
|
||||
if (password.value === '') return common.msg('密码不能为空');
|
||||
try {
|
||||
common.loading('登录中');
|
||||
const secretKey = 'EtBzqj+ln5tSTof1SDhpTg==';
|
||||
const cipherText = encryptByAES(password.value, secretKey);
|
||||
useAccountLoginApp({ loginName: account.value, password: cipherText })
|
||||
.then(async (res) => {
|
||||
common.hideLoading();
|
||||
// 登陆成功,缓存账号密码
|
||||
common.setValue('loginAccountData', {
|
||||
account: account.value,
|
||||
password: password.value
|
||||
});
|
||||
// res['mascotState']
|
||||
if (res['mascotState']) { // 判断是否跳转到选科技鹿页面
|
||||
common.redirectTo('/pages/mascot/mascot_select_list');
|
||||
} else {
|
||||
common.setValue('mascotState', false) // 清空科技鹿设置
|
||||
common.msg('登录成功');
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length >= 2) {
|
||||
// 页面栈只有一页,没有返回页,那就返回首页
|
||||
console.log('返回登录的上一页');
|
||||
back_state.value = false;
|
||||
//如果上一页是首页,就返回弹出页
|
||||
const page = pages[pages.length - 2];
|
||||
console.log('page.route', page.route);
|
||||
if (page.route === 'pages/index/index') {
|
||||
common.navigateTo('/pages/index/dialog', {animationType: 'slide-in-bottom'});
|
||||
} else {
|
||||
common.navigateBack(); // 返回登录的上一页
|
||||
}
|
||||
|
||||
clickCount.value++;
|
||||
lastClickTime.value = now;
|
||||
if (clickCount.value == 6) {
|
||||
if (!account.value && password.value == '20010307' && !show_password.value) {
|
||||
common.navigateTo('/pages/test/index');
|
||||
}
|
||||
clickCount.value = 0;
|
||||
}
|
||||
};
|
||||
// 登录方法
|
||||
const login_fun = () : void => {
|
||||
// 验证
|
||||
if (login_button_status.value) return common.msg('请阅读并同意《隐私政策》');
|
||||
if (account.value === '') return common.msg('账号不能为空');
|
||||
if (password.value === '') return common.msg('密码不能为空');
|
||||
try {
|
||||
common.loading('登录中');
|
||||
const secretKey = 'EtBzqj+ln5tSTof1SDhpTg==';
|
||||
const cipherText = encryptByAES(password.value, secretKey);
|
||||
useAccountLoginApp({ loginName: account.value, password: cipherText })
|
||||
.then(async (res) => {
|
||||
common.hideLoading();
|
||||
// 登陆成功,缓存账号密码
|
||||
common.setValue('loginAccountData', {
|
||||
account: account.value,
|
||||
password: password.value
|
||||
});
|
||||
if (res['mascotState']) { // 判断是否跳转到选科技鹿页面
|
||||
common.redirectTo('/pages/mascot/mascot_select_list');
|
||||
} else if (fromPagePath.value !== '') {
|
||||
common.redirectTo('/' + fromPagePath.value);
|
||||
} else {
|
||||
// common.switchTab('/pages/index/index');
|
||||
|
||||
common.navigateTo('/pages/index/dialog', {animationType: 'slide-in-bottom'});
|
||||
// common.redirectTo('/pages/index/dialog', {animationType: 'slide-in-bottom'});
|
||||
common.setValue('mascotState', false) // 清空科技鹿设置
|
||||
common.msg('登录成功');
|
||||
back_state.value = false;
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length <= 1) { // 页面栈小于等于1,里面还有本身的login,说明就只有login页
|
||||
common.navigateTo('/pages/index/dialog', { animationType: 'slide-in-bottom' });
|
||||
return;
|
||||
}
|
||||
const prevPage = pages[pages.length - 2];
|
||||
if (prevPage.route === 'pages/index/dialog') { // 弹出页面特殊处理
|
||||
common.navigateBack(1, () => {
|
||||
if (prevPage.$vm && typeof prevPage.$vm.$?.exposed?.refreshData === 'function') {
|
||||
prevPage.$vm.$?.exposed?.refreshData();
|
||||
}
|
||||
}, { animationType: 'slide-in-bottom' });
|
||||
} else {
|
||||
common.navigateBack(1, () => {
|
||||
if (prevPage.$vm && typeof prevPage.$vm.$?.exposed?.refreshData === 'function') {
|
||||
prevPage.$vm.$?.exposed?.refreshData();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}).catch((res) => {
|
||||
console.log(res);
|
||||
common.hideLoading();
|
||||
if (res.rtnCode === '0002') {
|
||||
common.msg('账号或密码错误,如忘记密码,请去统一身份认证平台修改。');
|
||||
} else if (res.rtnCode !== '0005') {
|
||||
common.msg('登录出错,请稍后再试');
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
common.hideLoading();
|
||||
}
|
||||
};
|
||||
}).catch((res) => {
|
||||
console.log(res);
|
||||
common.hideLoading();
|
||||
if (res.rtnCode === '0002') {
|
||||
common.msg('账号或密码错误,如忘记密码,请去统一身份认证平台修改。');
|
||||
} else if (res.rtnCode !== '0005') {
|
||||
common.msg('登录出错,请稍后再试');
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
common.hideLoading();
|
||||
}
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
let loginAccountData = common.getValue('loginAccountData');
|
||||
if (loginAccountData) {
|
||||
account.value = loginAccountData.account;
|
||||
password.value = loginAccountData.password;
|
||||
}
|
||||
back_state.value = true;
|
||||
|
||||
});
|
||||
// 跳进了登录页,禁止返回操作
|
||||
onBackPress(() => back_state.value);
|
||||
onLoad(() => {
|
||||
// fromPagePath.value = e?.path || ''
|
||||
})
|
||||
onMounted(() => {
|
||||
let loginAccountData = common.getValue('loginAccountData');
|
||||
if (loginAccountData) {
|
||||
account.value = loginAccountData.account;
|
||||
password.value = loginAccountData.password;
|
||||
}
|
||||
back_state.value = true;
|
||||
|
||||
});
|
||||
// 跳进了登录页,禁止返回操作
|
||||
onBackPress(() => back_state.value);
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bottom_login_div {
|
||||
padding: 0 58rpx;
|
||||
margin-bottom: 93rpx;
|
||||
.bottom_login_div {
|
||||
padding: 0 58rpx;
|
||||
margin-bottom: 93rpx;
|
||||
|
||||
.ysxy_div {
|
||||
margin-top: 27rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.ysxy_div {
|
||||
margin-top: 27rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.ysxy_tip {
|
||||
font-size: 23rpx;
|
||||
color: #999999;
|
||||
.ysxy_tip {
|
||||
font-size: 23rpx;
|
||||
color: #999999;
|
||||
|
||||
.ysxy_term {
|
||||
color: #0066ff;
|
||||
.ysxy_term {
|
||||
color: #0066ff;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.uv-checkbox-group) {
|
||||
flex: 0;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.uv-checkbox-group) {
|
||||
flex: 0;
|
||||
.bottom_login_button {
|
||||
border: none;
|
||||
border-radius: 16rpx;
|
||||
background-color: #0066ff;
|
||||
color: #ffffff;
|
||||
overflow: hidden;
|
||||
|
||||
:deep(.uv-button) {
|
||||
height: 100rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottom_login_button {
|
||||
border: none;
|
||||
border-radius: 16rpx;
|
||||
background-color: #0066ff;
|
||||
color: #ffffff;
|
||||
overflow: hidden;
|
||||
:deep(.uv-button) {
|
||||
height: 100rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.account_password_div {
|
||||
padding: 0 58rpx;
|
||||
z-index: 50;
|
||||
|
||||
.account_password_div {
|
||||
padding: 0 58rpx;
|
||||
z-index: 50;
|
||||
|
||||
.title1 {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
height: 40rpx;
|
||||
margin-top: 8rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
height: 40rpx;
|
||||
margin-top: 54rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.account_input {
|
||||
height: 100rpx;
|
||||
background-color: #f4f8ff;
|
||||
border: none;
|
||||
border-radius: 16rpx;
|
||||
|
||||
::v-deep .u-input__content__field-wrapper__field {
|
||||
font-size: 26rpx !important;
|
||||
}
|
||||
|
||||
.show_password {
|
||||
margin-right: 6rpx;
|
||||
width: 40rpx;
|
||||
.title1 {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
height: 40rpx;
|
||||
margin-top: 8rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.title2 {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
height: 40rpx;
|
||||
margin-top: 54rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.account_input {
|
||||
height: 100rpx;
|
||||
background-color: #f4f8ff;
|
||||
border: none;
|
||||
border-radius: 16rpx;
|
||||
|
||||
::v-deep .u-input__content__field-wrapper__field {
|
||||
font-size: 26rpx !important;
|
||||
}
|
||||
|
||||
.show_password {
|
||||
margin-right: 6rpx;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bg_div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
padding: 0 50rpx;
|
||||
height: 496rpx;
|
||||
// border: 1px solid red;
|
||||
|
||||
.bg_img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.profile_div {
|
||||
position: absolute;
|
||||
bottom: -96rpx;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
.bg_div {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
z-index: 10;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
padding: 0 50rpx;
|
||||
height: 496rpx;
|
||||
// border: 1px solid red;
|
||||
|
||||
.profile {
|
||||
width: 328rpx;
|
||||
height: 424rpx;
|
||||
.bg_img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.profile_div {
|
||||
position: absolute;
|
||||
bottom: -96rpx;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
z-index: 10;
|
||||
|
||||
.profile {
|
||||
width: 328rpx;
|
||||
height: 424rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title_logo {
|
||||
display: flex;
|
||||
margin-top: 120rpx;
|
||||
|
||||
.log_img {
|
||||
// width: 380rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title_text_div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 84rpx;
|
||||
|
||||
.title_text {
|
||||
font-weight: 700;
|
||||
font-size: 46rpx;
|
||||
}
|
||||
|
||||
.title_text_img {
|
||||
width: 48rpx;
|
||||
height: 62rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title_text_tip {
|
||||
margin-top: 10rpx;
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.title_logo {
|
||||
.main_div {
|
||||
display: flex;
|
||||
margin-top: 120rpx;
|
||||
|
||||
.log_img {
|
||||
// width: 380rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.title_text_div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 84rpx;
|
||||
|
||||
.title_text {
|
||||
font-weight: 700;
|
||||
font-size: 46rpx;
|
||||
}
|
||||
|
||||
.title_text_img {
|
||||
width: 48rpx;
|
||||
height: 62rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title_text_tip {
|
||||
margin-top: 10rpx;
|
||||
font-size: 26rpx;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
|
||||
.main_div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -29,14 +29,15 @@
|
||||
<view class="fl1"></view>
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 显示当前选中的徽章 -->
|
||||
<view class="dan" @click="changeBadge">
|
||||
<!-- <view class="dan" @click="changeBadge">
|
||||
<view class="dan_img">
|
||||
<image class="img_100" :src="`/static/images/me/${badgeList[currentIndex].png}`"
|
||||
mode="heightFix" alt="当前徽章"></image>
|
||||
</view>
|
||||
<view class="dan_text">{{ badgeList[currentIndex].name }}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- 用户学习时间信息 -->
|
||||
<view class="study_information">
|
||||
|
||||
@@ -44,13 +44,14 @@
|
||||
</view>
|
||||
<image class="bg_img" style="width: 718rpx;height: 1126rpx;" src="@/static/images/test/search_img.png">
|
||||
</image>
|
||||
</view>
|
||||
<!-- 隐藏的计算容器 -->
|
||||
<view class="measure-container">
|
||||
<view v-for="(item, index) in hiddenHistorySearchList" :key="index" class="history_item">
|
||||
{{ item }}
|
||||
<!-- 隐藏的计算容器 -->
|
||||
<view class="measure-container">
|
||||
<view v-for="(item, index) in hiddenHistorySearchList" :key="index" class="history_item">
|
||||
{{ item }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@@ -179,6 +180,8 @@
|
||||
|
||||
.measure-container {
|
||||
display: flex;
|
||||
position: fixed;
|
||||
top:-500rpx; // 藏起来,让他看不到
|
||||
}
|
||||
|
||||
.history_item {
|
||||
@@ -339,5 +342,6 @@
|
||||
.main_div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
}
|
||||
</style>
|
||||
+2
-1
@@ -5,7 +5,8 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "AI问答",
|
||||
"app-plus": {
|
||||
"titleNView": false
|
||||
"titleNView": false,
|
||||
"animationType": "fade-in"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user