Commit d1c1e6c1 by 岑成威

fix: 新增轻改短课程

1 parent 45865762
<!--
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-07 17:09:53
* @LastEditors: limin
* @LastEditTime: 2026-02-05 17:52:25
* @FilePath: \gl_tape\App.vue
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<script>
const PATH = ['/pages/common/caseDetail']
const keepAlive = uni.requireNativePlugin('Ba-KeepAliveSuit')
import { mapState } from 'vuex'
import { Ws } from '@/ws/Ws.js'
import { RecordSaveService, UploadService } from '@/utils/recordManager/index.js'
export default {
computed: {
...mapState('audio', ['isEnd', 'isStart'])
},
globalData: {
userInfo: uni.getStorageSync('release_userInfo')
},
onLaunch: async function () {
this.onKeep()
// this.setAPPVersion()
setTimeout(() => {
// plus.screen.unlockOrientation() //解除锁定屏幕方向
// plus.screen.lockOrientation('landscape-primary')
}, 300)
uni.setKeepScreenOn({
keepScreenOn: true
})
new Ws().connect()
},
methods: {
onKeep() {
keepAlive &&
keepAlive.onKeep(
{
title: '接待',
content: '接待通知'
},
res => {
console.log(res)
}
)
const PATH = ['/pages/common/caseDetail']
const keepAlive = uni.requireNativePlugin('Ba-KeepAliveSuit')
import { mapState } from 'vuex'
import { Ws } from '@/ws/Ws.js'
import { RecordSaveService, UploadService } from '@/utils/recordManager/index.js'
export default {
computed: {
...mapState('audio', ['isEnd', 'isStart'])
},
setAPPVersion() {
let version = plus.runtime.version
let storageVersion = uni.$storage.get('storageVersion')
uni.$logger.local.info(`storageVersion ->${storageVersion}, version ->${version}`)
if (storageVersion != version) {
uni.$storage.rm('userInfo')
uni.$storage.rm('noSignInUuid')
}
uni.$storage.set('storageVersion', version)
}
},
onShow: async function () {
this.$store.dispatch('setBackgroundState', false)
this.$store.dispatch('setActivityWindowPopCount', 1) //冷启动重置活动弹框次数
// 触发轮询开始事件,通知上传管理重新开始轮询
// UploadService.startPolling()
RecordSaveService.startPolling()
uni.onMemoryWarning(function () {
console.log('onMemoryWarningReceive')
})
// const systemInfo = await uni.$api.systemApi.getMockData();
// if (systemInfo.isCheckedUpdate) {
// checkUpdate();
// }
// let version = plus.runtime.version;
// uni.$api.commonApi.getAPPVersion().then((res) => {
// if (res != version && !systemInfo.isCheckedUpdate)
// this.$store.dispatch("openUpdateModal");
// });
},
onHide: function () {
this.$store.dispatch('setBackgroundState', true)
},
onError: function (e) {
try {
const msg = typeof e === 'string' ? e : e.message || '捕获全局异常'
const stack = typeof e === 'object' ? e.stack || JSON.stringify(e) : ''
uni.$logger?.error({
msg: `[全局异常] ${msg}`,
extra: {
stack,
raw: e,
url: this.$route?.path || 'unknown'
}
globalData: {
userInfo: uni.getStorageSync('release_userInfo')
},
onLaunch: async function () {
this.onKeep()
this.setAPPVersion()
setTimeout(() => {
plus.screen.unlockOrientation() //解除锁定屏幕方向
plus.screen.lockOrientation('landscape-primary')
}, 300)
uni.setKeepScreenOn({
keepScreenOn: true
})
} catch (error) {
console.error('日志上报失败:', error)
}
},
onUnhandledRejection: function (res) {
try {
const reason = res.reason
const msg = reason instanceof Error ? reason.message : typeof reason === 'string' ? reason : '未处理的 Promise 拒绝'
const stack = reason instanceof Error ? reason.stack : JSON.stringify(reason)
uni.$logger?.error({
msg: `[UnhandledRejection] ${msg}`,
extra: {
stack,
reason: reason,
url: this.$route?.path || 'unknown'
new Ws().connect()
},
methods: {
onKeep() {
keepAlive &&
keepAlive.onKeep(
{
title: '接待',
content: '接待通知'
},
res => {
console.log(res)
}
)
},
setAPPVersion() {
let version = plus.runtime.version
let storageVersion = uni.$storage.get('storageVersion')
uni.$logger.local.info(`storageVersion ->${storageVersion}, version ->${version}`)
if (storageVersion != version) {
uni.$storage.rm('userInfo')
uni.$storage.rm('noSignInUuid')
}
uni.$storage.set('storageVersion', version)
}
},
onShow: async function () {
this.$store.dispatch('setBackgroundState', false)
this.$store.dispatch('setActivityWindowPopCount', 1) //冷启动重置活动弹框次数
// 触发轮询开始事件,通知上传管理重新开始轮询
// UploadService.startPolling()
RecordSaveService.startPolling()
uni.onMemoryWarning(function () {
console.log('onMemoryWarningReceive')
})
} catch (error) {
console.error('Promise 异常上报失败:', error)
// const systemInfo = await uni.$api.systemApi.getMockData();
// if (systemInfo.isCheckedUpdate) {
// checkUpdate();
// }
// let version = plus.runtime.version;
// uni.$api.commonApi.getAPPVersion().then((res) => {
// if (res != version && !systemInfo.isCheckedUpdate)
// this.$store.dispatch("openUpdateModal");
// });
},
onHide: function () {
this.$store.dispatch('setBackgroundState', true)
},
onError: function (e) {
try {
const msg = typeof e === 'string' ? e : e.message || '捕获全局异常'
const stack = typeof e === 'object' ? e.stack || JSON.stringify(e) : ''
uni.$logger?.error({
msg: `[全局异常] ${msg}`,
extra: {
stack,
raw: e,
url: this.$route?.path || 'unknown'
}
})
} catch (error) {
console.error('日志上报失败:', error)
}
},
onUnhandledRejection: function (res) {
try {
const reason = res.reason
const msg = reason instanceof Error ? reason.message : typeof reason === 'string' ? reason : '未处理的 Promise 拒绝'
const stack = reason instanceof Error ? reason.stack : JSON.stringify(reason)
uni.$logger?.error({
msg: `[UnhandledRejection] ${msg}`,
extra: {
stack,
reason: reason,
url: this.$route?.path || 'unknown'
}
})
} catch (error) {
console.error('Promise 异常上报失败:', error)
}
}
}
}
</script>
<style lang="scss">
page {
font-size: 28rpx;
height: 100%;
min-height: 100%;
}
view,
navigator,
image,
text,
scroll-view,
swiper,
swiper-item,
input,
textarea,
button {
box-sizing: border-box;
}
/* 文字避头尾法则 */
.btw {
table-layout: fixed;
word-wrap: break-word;
word-break: normal;
text-align: justify;
text-justify: inter-ideograph;
}
.bg-white {
background: #fff;
}
.font-weight {
font-weight: bold;
}
.u-flex-center {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
button {
margin: 0;
padding: 0;
line-height: 1.5;
font-size: 28rpx;
background-color: transparent;
border-radius: 0;
position: relative;
}
button::after {
border: none;
}
// 指定按钮按下去的样式类
.button-hover {
transform: translate(1rpx, 1rpx);
}
.webview-container {
position: absolute;
width: 100rpx;
height: 100rpx;
top: 0rpx;
left: 0rpx;
}
</style>
</script>
<style lang="scss">
page {
font-size: 28rpx;
height: 100%;
min-height: 100%;
}
view,
navigator,
image,
text,
scroll-view,
swiper,
swiper-item,
input,
textarea,
button {
box-sizing: border-box;
}
/* 文字避头尾法则 */
.btw {
table-layout: fixed;
word-wrap: break-word;
word-break: normal;
text-align: justify;
text-justify: inter-ideograph;
}
.bg-white {
background: #fff;
}
.font-weight {
font-weight: bold;
}
.u-flex-center {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
button {
margin: 0;
padding: 0;
line-height: 1.5;
font-size: 28rpx;
background-color: transparent;
border-radius: 0;
position: relative;
}
button::after {
border: none;
}
// 指定按钮按下去的样式类
.button-hover {
transform: translate(1rpx, 1rpx);
}
.webview-container {
position: absolute;
width: 100rpx;
height: 100rpx;
top: 0rpx;
left: 0rpx;
}
</style>
\ No newline at end of file
......@@ -451,6 +451,20 @@ module.exports = {
...data
})
},
// 学习中心-轻改短课程详情
getLightShortCourseDetail(data) {
return http.post({
method: 'dj.pad.api.staff.light.short.course.task.detail',
projectName: 'pad',
...data
})
},
// 学习中心-轻改短课程改进明细
getImprovementDetails(data) {
return http.get({
method: 'http://192.168.1.173:8422/data?recording_id=100002',
})
},
// 学习中心-长课程详情
getLongCourseDetail(data) {
return http.post({
......
const target = ['ip', 'dev', 'uat', 'prod', 'beta']
const index = 2
const index = 1
/**
*
0本地
......
......@@ -5,7 +5,8 @@ const moduleTypeEnum = {
3: '短课程学习',
4: '长课程学习',
5: '活动中心',
7: '优秀案例学习'
7: '优秀案例学习',
9: '轻改短课程学习'
}
const moduleIconEnum = {
......@@ -15,7 +16,8 @@ const moduleIconEnum = {
3: 'notice-study',
4: 'notice-study',
5: 'active-msg',
7: 'notice-recording'
7: 'notice-recording',
9: 'short-course-learn-room'
}
const moduleContentEnum = {
......
......@@ -73,6 +73,7 @@ export default {
earlyWarnList: [],
systemList: [],
shortCourseList: [],
lightShortCourseList: [],
longCourseList: [],
activityList: [],
caseList: [],
......@@ -98,7 +99,7 @@ export default {
let contentRow = ''
// 标题逻辑
if (moduleType === 3 || moduleType === 4) {
if (moduleType === 3 || moduleType === 4 || moduleType === 9) {
displayTitle = item.title
} else if (moduleType === 7) {
displayTitle = this.reminderTypeEnum[item.reminderType]
......@@ -110,7 +111,7 @@ export default {
const fmt = (t) => this.formatTime(t, 'YYYY-MM-DD HH:mm:ss')
// 任务和内容逻辑
if (moduleType === 3 || moduleType === 4) {
if (moduleType === 3 || moduleType === 4 || moduleType === 9) {
if (item.taskType == 1) {
taskNameRow = `学习任务名称:${item.taskName}`
finishTimeRow = `任务完成时间:小伙伴,请于${fmt(item.finishTime)}完成哦~`
......@@ -160,6 +161,8 @@ export default {
return this.earlyWarnList
case 3:
return this.shortCourseList
case 9:
return this.lightShortCourseList
case 4:
return this.longCourseList
case 5:
......@@ -201,7 +204,7 @@ export default {
if (moduleType === 0) {
return !item.readFlag
}
if ([1, 2, 3, 4, 5, 6, 7].includes(moduleType)) {
if ([1, 2, 3, 4, 5, 6, 7, 9].includes(moduleType)) {
return item.status == 0
}
return false
......@@ -226,6 +229,9 @@ export default {
case 3:
this.getCourseList(3)
break
case 9:
this.getCourseList(9)
break
case 4:
this.getCourseList(4)
break
......@@ -415,6 +421,13 @@ export default {
console.error('调用 getCourseList 方法时出错:', error)
}
break
case 9:
try {
this.getCourseList(9)
} catch (error) {
console.error('调用 getCourseList 方法时出错:', error)
}
break
case 4:
try {
this.getCourseList(4)
......@@ -546,7 +559,7 @@ export default {
})
break
case 9:
console.log('短课程学习跳转')
console.log('轻改短课程学习跳转')
uni.$track.add({ eventCode: 'app_short_course', businessId: item.detailId, pagePath: '/pages/common/serviceDetail/index' })
// const row = {
// ...item,
......@@ -580,9 +593,13 @@ export default {
e.time = e.actualSendTimeStr
})
if (pageNum == 1) {
moduleType == 3 ? (this.shortCourseList = res.list) : (this.longCourseList = res.list)
if (moduleType == 3) this.shortCourseList = res.list
else if (moduleType == 4) this.longCourseList = res.list
else if (moduleType == 9) this.lightShortCourseList = res.list
} else {
moduleType == 3 ? (this.shortCourseList = this.shortCourseList.concat(res.list)) : (this.longCourseList = this.longCourseList.concat(res.list))
if (moduleType == 3) this.shortCourseList = this.shortCourseList.concat(res.list)
else if (moduleType == 4) this.longCourseList = this.longCourseList.concat(res.list)
else if (moduleType == 9) this.lightShortCourseList = this.lightShortCourseList.concat(res.list)
}
uni.hideLoading()
this.total = res.total
......
<template>
<view >
<template v-if="labelColors && labelColors.length > 0">
<template v-if="hasData">
<qiun-data-charts type="radar" :opts="opts" :tooltipShow="false" :chartData="chartData" :class="['charts-box', heightClass]" />
</template>
<template v-else>
......@@ -17,7 +17,7 @@ export default {
props: {
chartData: {
type: Object,
default: () => {}
default: () => ({})
},
heightClass: {
type: String
......@@ -27,11 +27,24 @@ export default {
default: () => ['#666666', '#666666', '#666666', '#666666', '#666666', '#666666', '#666666', '#666666', '#666666']
}
},
computed: {
hasData () {
const c = this.chartData && Array.isArray(this.chartData.categories) ? this.chartData.categories : []
const s0 = this.chartData && Array.isArray(this.chartData.series) ? this.chartData.series[0] : null
const d = s0 && Array.isArray(s0.data) ? s0.data : []
return c.length > 0 && d.length > 0
}
},
watch: {
labelColors: {
handler(newVal) {
console.log(newVal, 'newVal')
this.opts.labelColors = newVal
if (Array.isArray(newVal) && newVal.length) {
this.opts.labelColors = newVal
} else {
const len = (this.chartData && Array.isArray(this.chartData.categories)) ? this.chartData.categories.length : 0
this.opts.labelColors = len ? Array.from({ length: len }, () => '#666666') : []
}
},
}
},
......@@ -68,6 +81,11 @@ export default {
},
mounted() {
console.log(this.chartData, ' 详情')
// 首次进入时父组件可能还没算出 labelColors,这里做一次兜底
if (!Array.isArray(this.opts.labelColors) || !this.opts.labelColors.length) {
const len = (this.chartData && Array.isArray(this.chartData.categories)) ? this.chartData.categories.length : 0
if (len) this.opts.labelColors = Array.from({ length: len }, () => '#666666')
}
}
}
</script>
......
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2024-09-03 13:48:51
* @LastEditors: cenchengwei@foreverht.com
* @LastEditTime: 2026-04-08 15:31:03
* @FilePath: /gl_tape/utils/logger/LogCat.js
*/
import { getTime } from './util'
import { serializeIfObject } from '../utils'
import TaskQueue from '../TaskQueue'
class LogCat {
// main = plus.android.runtimeMainActivity()
// File = plus.android.importClass('java.io.File')
// Environment = plus.android.importClass('android.os.Environment')
// BufferedWriter = plus.android.importClass('java.io.BufferedWriter')
// FileOutputStream = plus.android.importClass('java.io.FileOutputStream')
// OutputStreamWriter = plus.android.importClass('java.io.OutputStreamWriter')
// // BufferedReader = plus.android.importClass('java.io.BufferedReader')
main = plus.android.runtimeMainActivity()
File = plus.android.importClass('java.io.File')
Environment = plus.android.importClass('android.os.Environment')
BufferedWriter = plus.android.importClass('java.io.BufferedWriter')
FileOutputStream = plus.android.importClass('java.io.FileOutputStream')
OutputStreamWriter = plus.android.importClass('java.io.OutputStreamWriter')
// BufferedReader = plus.android.importClass('java.io.BufferedReader')
// FileInputStream = plus.android.importClass('java.io.FileInputStream')
// InputStreamReader = plus.android.importClass('java.io.InputStreamReader')
LogPath = ''
......@@ -33,14 +23,12 @@ class LogCat {
currentFos = null // 当前 FileOutputStream
currentLogFile = '' // 当前打开的日志文件路径
closeTimer = null // 自动关闭流的定时器
constructor(folderName = '_zyzs_log') {
try {
let file = null
if (this.Environment.MEDIA_MOUNTED || !this.Environment.isExternalStorageRemovable()) {
file = this.main.getExternalFilesDir(null)
}
if (file) {
this.LogPath = file.getPath() + folderName
} else {
......@@ -69,12 +57,10 @@ class LogCat {
})
})
}
// 真正的写入逻辑(私有方法)
_doWriteLog(tag, messages) {
// 如果路径初始化失败,直接放弃写入,避免报错
if (!this.LogPath) return
let msg = ''
try {
if (messages instanceof Error) {
......@@ -93,7 +79,6 @@ class LogCat {
if (this.lastCleanDate && date !== this.lastCleanDate) {
this.lastCleanDate = date
}
let datetime = getTime()
//文件名
let fileName = this.LogPath + '/' + date + '.txt'
......@@ -114,7 +99,6 @@ class LogCat {
if (this.logDirFile && !this.logDirFile.exists()) {
this.logDirFile.mkdirs()
}
try {
// 1. 如果当前没有流,或者文件名变了(跨天),则重新打开
if (!this.currentWriter || this.currentLogFile !== fileName) {
......@@ -131,7 +115,6 @@ class LogCat {
// 3. 刷新缓冲区,确保内容真正写入磁盘(虽然有性能损耗,但防止崩溃丢日志)
// 也可以选择积累一定量再 flush,这里为了安全选择每次 flush
this.currentWriter.flush()
// 4. 重置自动关闭定时器 (5秒后无操作自动关闭)
if (this.closeTimer) {
clearTimeout(this.closeTimer)
......@@ -139,14 +122,12 @@ class LogCat {
this.closeTimer = setTimeout(() => {
this._closeStream()
}, 5000)
} catch (e) {
console.log('日志写入失败:', e)
// 发生异常时尝试关闭流,以便下次重试
this._closeStream()
}
}
// 关闭当前流
_closeStream() {
try {
......@@ -171,7 +152,6 @@ class LogCat {
console.log('关闭日志流失败:', e)
}
}
// 自动清理旧日志
_cleanOldLogs(daysToKeep) {
// 放入队列异步执行,不影响启动速度
......@@ -203,7 +183,6 @@ class LogCat {
})
})
}
// 删除日志
removeLogFile(fileName) {
try {
......@@ -222,7 +201,6 @@ class LogCat {
if (!this.LogPath) return []
let file = new this.File(this.LogPath)
if (!file.exists()) return []
let tempList = file.listFiles()
if (!tempList || tempList.length === 0) return []
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!