页面样式调整

AI语音的还未更改
This commit is contained in:
Lilixu007 2026-02-26 15:21:08 +08:00
parent e19615a89d
commit b127837423
5 changed files with 222 additions and 39 deletions

View File

@ -1,6 +1,6 @@
{
"name" : "xinlijs",
"appid" : "__UNI__75D55B4",
"appid" : "__UNI__DFFA04F",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",

View File

@ -141,7 +141,7 @@
<view class="big-panel-sub">刑期 / 罪名分析</view>
</view>
<view class="big-chart big-chart-xl">
<qiun-data-charts type="line" :opts="bigLineOpts" :chartData="bigLineData" canvasId="bigLine" />
<qiun-data-charts v-if="isMounted" :key="'bigLine-' + chartKey" type="line" :opts="bigLineOpts" :chartData="bigLineData" canvasId="bigLine" />
</view>
</view>
@ -183,7 +183,7 @@
</view>
</view>
<view class="big-ring">
<qiun-data-charts type="ring" :opts="bigRingOpts" :chartData="bigRingData" canvasId="bigRing" />
<qiun-data-charts v-if="isMounted" :key="'bigRing-' + chartKey" type="ring" :opts="bigRingOpts" :chartData="bigRingData" canvasId="bigRing" />
<view class="big-ring-center" @tap="goWarning">
</view>
</view>
@ -284,7 +284,7 @@
</view>
<view class="big-chart">
<view v-if="bigLoading" class="big-loading">加载中...</view>
<qiun-data-charts v-else type="line" :opts="bigLineOpts" :chartData="bigLineData2" canvasId="bigLine2" />
<qiun-data-charts v-else-if="isMounted" :key="'bigLine2-' + chartKey" type="line" :opts="bigLineOpts" :chartData="bigLineData2" canvasId="bigLine2" />
</view>
</view>
@ -311,7 +311,7 @@
<view class="big-panel-title">综合报告</view>
</view>
<view class="big-chart big-chart-xl">
<qiun-data-charts type="column" :opts="bigBarOpts" :chartData="bigBarData" canvasId="bigBarMid" />
<qiun-data-charts v-if="isMounted" :key="'bigBarMid-' + chartKey" type="column" :opts="bigBarOpts" :chartData="bigBarData" canvasId="bigBarMid" />
</view>
</view>
</view>
@ -328,7 +328,7 @@
import { getUnreadNoticeTop, markNoticeRead } from '../../api/app/notice'
import { getUnreadMessageList, markMessageRead } from '../../api/app/message'
import { openLink, getMessageWsUrl } from '../../utils/link'
import { request } from '../../utils/request'
import { request, setAuthFailureCallback } from '../../utils/request'
import { getBaseUrl } from '../../utils/config'
import { getReport, listReport } from '../../api/psychology/report'
import { getStudentOptions, getUserAssessmentSummary } from '../../api/psychology/assessment'
@ -342,9 +342,28 @@
UniIcons,
LoginModal
},
//
errorCaptured(err, vm, info) {
//
if (err && err.message && (
err.message.includes('firstElementChild') ||
err.message.includes('Cannot destructure') ||
err.message.includes('qiun-data-charts')
)) {
console.warn('图表渲染警告(已处理):', err.message)
// false
return false
}
//
return true
},
data() {
return {
showLoginModal: false,
hasCheckedLogin: false,
isMounted: false,
chartKey: 0,
resizeTimer: null,
socketOpen: false,
connecting: false,
voiceTipsOpen: false,
@ -544,34 +563,128 @@
}
},
onLoad() {
console.log('=== onLoad 触发 ===')
// -
setAuthFailureCallback(() => {
console.log('认证失败回调触发,显示登录弹窗')
this.showLoginModal = true
this.bigErrorMsg = ''
})
try {
const info = uni.getSystemInfoSync()
console.log('系统信息:', info)
this.isH5 = info && info.uniPlatform === 'web'
console.log('isH5:', this.isH5)
} catch (e) {
console.error('获取系统信息失败:', e)
this.isH5 = false
}
//
const token = getToken()
if (!token) {
this.showLoginModal = true
return
this.checkLoginStatus()
},
onReady() {
// DOM
setTimeout(() => {
this.$nextTick(() => {
this.isMounted = true
})
}, 300)
//
// #ifdef H5
window.addEventListener('resize', this.handleResize)
// #endif
},
onUnload() {
//
// #ifdef H5
window.removeEventListener('resize', this.handleResize)
// #endif
//
if (this.resizeTimer) {
clearTimeout(this.resizeTimer)
}
this.initApp()
},
onShow() {
console.log('=== onShow 触发 ===')
//
const token = getToken()
if (!token) {
this.showLoginModal = true
return
this.checkLoginStatus()
},
methods: {
handleResize() {
//
if (this.resizeTimer) {
clearTimeout(this.resizeTimer)
}
try {
// resize
this.isMounted = false
// 1200mskey
this.resizeTimer = setTimeout(() => {
try {
this.chartKey++
// 300msDOM
setTimeout(() => {
this.$nextTick(() => {
this.isMounted = true
})
}, 300)
} catch (e) {
console.error('图表重新渲染失败:', e)
// 使
this.isMounted = true
}
}, 1200)
} catch (e) {
console.error('处理窗口大小变化失败:', e)
//
this.isMounted = true
}
},
checkLoginStatus() {
console.log('=== checkLoginStatus 开始 ===')
const token = getToken()
console.log('当前token:', token ? '存在' : '不存在')
console.log('token值:', token)
console.log('showLoginModal当前状态:', this.showLoginModal)
if (!token) {
// token
console.log('没有token准备显示登录框')
if (!this.showLoginModal) {
console.log('设置showLoginModal = true')
this.showLoginModal = true
this.hasCheckedLogin = true
} else {
console.log('登录框已经显示,跳过')
}
return false
}
console.log('有token继续初始化')
// token
this.hasCheckedLogin = true
// onLoad
if (!this.socketOpen && !this.connecting) {
console.log('初始化应用')
this.initApp()
}
//
this.checkUnreadNoticePopup()
this.checkUnreadMessagePopup()
if (this.isH5) {
this.fetchInboxList()
}
return true
},
methods: {
initApp() {
if (this.isH5) {
this.fetchCenterVideo()
@ -585,8 +698,13 @@
}
},
onLoginSuccess() {
//
this.initApp()
console.log('=== 登录成功回调 ===')
//
this.showLoginModal = false
//
this.hasCheckedLogin = false
//
this.checkLoginStatus()
},
getBailianConfig() {
const HARDCODED_BAILIAN_API_KEY = 'sk-f991fd13fb044abebeaea81b9848c22b'
@ -1564,6 +1682,15 @@
}
},
fetchBigData() {
// tokentoken
const token = getToken()
if (!token) {
console.log('fetchBigData: 没有token跳过请求')
this.applyBigDemoData()
return
}
console.log('fetchBigData: 开始请求token存在')
if (this.bigLoading) return
this.bigLoading = true
this.bigErrorMsg = ''
@ -1573,10 +1700,20 @@
])
.then(([aRes, dRes]) => {
this.bigLoading = false
console.log('fetchBigData: analytics响应 code:', aRes.data?.code)
const aData = aRes && aRes.data ? aRes.data : null
const dData = dRes && dRes.data ? dRes.data : null
// request.js
if (!aData || aData.code !== 200) {
this.bigErrorMsg = (aData && aData.msg) ? aData.msg : '概览加载失败'
const errorMsg = (aData && aData.msg) ? aData.msg : '概览加载失败'
console.error('fetchBigData: 请求失败code:', aData ? aData.code : 'null')
// request.js
if (aData && (aData.code === 401 || aData.code === 403)) {
this.bigErrorMsg = ''
} else {
this.bigErrorMsg = errorMsg
}
this.applyBigDemoData()
return
}
@ -1593,6 +1730,7 @@
})
.catch((e) => {
this.bigLoading = false
console.error('fetchBigData: 请求异常', e)
this.bigErrorMsg = e && e.message ? e.message : '网络错误'
this.applyBigDemoData()
})
@ -1726,6 +1864,14 @@
this.voiceTipsOpen = !this.voiceTipsOpen
},
fetchInboxList() {
// tokentoken
const token = getToken()
if (!token) {
console.log('fetchInboxList: 没有token跳过请求')
this.bigInboxList = []
return
}
if (this.bigInboxLoading) return
this.bigInboxLoading = true
getUnreadMessageList(6)
@ -2160,11 +2306,12 @@
}
.page.big {
height: 100vh;
padding: 12rpx 12rpx 0;
min-height: 100vh;
padding: 12rpx 12rpx 20rpx;
box-sizing: border-box;
position: relative;
overflow: hidden;
overflow-x: hidden;
overflow-y: auto;
--neon-a: rgba(0, 240, 255, 0.95);
--neon-b: rgba(60, 140, 255, 0.95);
--neon-soft: rgba(0, 240, 255, 0.18);

View File

@ -213,10 +213,11 @@
}
.page.big .big-top {
height: 120rpx;
border-radius: 16rpx;
border: 1px solid rgba(0, 188, 255, 0.22);
background: linear-gradient(90deg, rgba(2, 8, 22, 0.86) 0%, rgba(2, 8, 22, 0.40) 50%, rgba(2, 8, 22, 0.86) 100%);
box-shadow: 0 10rpx 22rpx rgba(0, 0, 0, 0.35), 0 0 24rpx rgba(0, 166, 255, 0.14);
border-radius: 14rpx;
border: 1px solid rgba(0, 240, 255, 0.18);
background: linear-gradient(180deg, rgba(2, 10, 26, 0.88) 0%, rgba(2, 10, 26, 0.70) 100%);
box-shadow: 0 10rpx 22rpx rgba(0, 0, 0, 0.40);
backdrop-filter: blur(10px);
display: flex;
flex-direction: row;
align-items: center;
@ -230,18 +231,24 @@
left: 20rpx;
top: 50%;
transform: translateY(-50%);
width: 60rpx;
height: 60rpx;
width: 64rpx;
height: 64rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 12rpx;
background: rgba(0, 188, 255, 0.12);
border: 1px solid rgba(0, 188, 255, 0.22);
background: rgba(0, 240, 255, 0.08);
border: 1px solid rgba(0, 240, 255, 0.20);
cursor: pointer;
transition: all 0.2s ease;
}
.page.big .big-back:hover {
background: rgba(0, 240, 255, 0.15);
border-color: rgba(0, 240, 255, 0.35);
}
.page.big .big-back:active {
background: rgba(0, 188, 255, 0.20);
background: rgba(0, 240, 255, 0.22);
transform: translateY(-50%) scale(0.95);
}
.page.big .big-top-content {
display: flex;
@ -253,7 +260,10 @@
font-size: 34rpx;
font-weight: 900;
letter-spacing: 2rpx;
color: rgba(220, 250, 255, 0.95);
color: rgba(242, 252, 255, 0.98);
text-shadow:
0 2rpx 12rpx rgba(0, 0, 0, 0.65),
0 0 18rpx rgba(0, 240, 255, 0.26);
}
.page.big .big-sub {
font-size: 22rpx;

View File

@ -1,7 +1,9 @@
import { STORAGE_KEYS } from './config'
export function getToken() {
return uni.getStorageSync(STORAGE_KEYS.token) || ''
const token = uni.getStorageSync(STORAGE_KEYS.token) || ''
console.log('getToken调用 - STORAGE_KEY:', STORAGE_KEYS.token, '- token:', token ? '存在' : '不存在')
return token
}
export function setToken(token) {

View File

@ -1,5 +1,13 @@
import { getBaseUrl } from './config'
import { getToken } from './auth'
import { getToken, clearToken } from './auth'
// 用于存储认证失败的回调
let authFailureCallback = null
// 设置认证失败的回调函数
export function setAuthFailureCallback(callback) {
authFailureCallback = callback
}
export function request(options) {
const baseUrl = getBaseUrl()
@ -8,6 +16,10 @@ export function request(options) {
if (token) {
const normalized = token.startsWith('Bearer ') ? token : ('Bearer ' + token)
headers['Authorization'] = normalized
console.log('请求URL:', baseUrl + options.url)
console.log('Authorization头:', normalized.substring(0, 50) + '...')
} else {
console.warn('请求时没有token:', baseUrl + options.url)
}
return new Promise((resolve, reject) => {
@ -16,9 +28,21 @@ export function request(options) {
url: baseUrl + options.url,
header: headers,
success: (res) => {
const data = res.data
// 统一处理认证失败
if (data && (data.code === 401 || data.code === 403)) {
console.error('认证失败清除token并显示登录弹窗:', data.msg)
// 清除过期的token
clearToken()
// 调用认证失败回调(显示登录弹窗)
if (authFailureCallback) {
authFailureCallback()
}
}
resolve(res)
},
fail: (err) => {
console.error('请求失败:', err)
reject(err)
}
})