Commit 38c1d8f6 by 李伟康

refactor(shortCourse): 优化课程详情页加载逻辑

- 将 onLoad 中的课程详情请求抽离到 refreshStudyList 方法中
- 在 onLoad 中添加 options 参数保存逻辑
- 修改 uni.$on('refreshStudyList') 回调,使用新的 refreshStudyList 方法
- 优化 disabled 按钮样式,移除颜色值的大小写不一致
1 parent db52846d
...@@ -268,33 +268,29 @@ export default { ...@@ -268,33 +268,29 @@ export default {
popupDetail: {}, popupDetail: {},
aiAgentData: {}, aiAgentData: {},
completeStatus: null, completeStatus: null,
studyId: '' studyId: '',
options: {}
} }
}, },
onLoad (options) { onLoad (options) {
console.log(options, 'options') console.log(options, 'options')
this.options = options
const { row } = options const { row } = options
const rowData = JSON.parse(decodeURIComponent(row)) const rowData = JSON.parse(decodeURIComponent(row))
console.log(rowData, 'rowData') console.log(rowData, 'rowData')
this.rowData = rowData this.rowData = rowData
this.completeStatus = options.completeStatus this.completeStatus = options.completeStatus
if (!this.rowData.taskDeadline) this.rowData.taskDeadline = rowData.finishTime if (!this.rowData.taskDeadline) this.rowData.taskDeadline = rowData.finishTime
if (options.from === 'service') { this.refreshStudyList()
this.studyId = rowData.detailId
this.getShortCourseDetail(rowData.detailId, rowData.id)
} else {
this.studyId = rowData.id
this.getShortCourseDetail(rowData.id)
}
if (this.completeStatus == 0) { if (this.completeStatus == 0) {
this.initCountdown() this.initCountdown()
} }
this.getAiAgentList() this.getAiAgentList()
uni.$on('refreshStudyList', () => { uni.$on('refreshStudyList', () => {
this.getShortCourseDetail() this.refreshStudyList()
}) })
}, },
onUnload () { onUnload () {
// 清除定时器 // 清除定时器
if (this.timer) { if (this.timer) {
...@@ -325,6 +321,16 @@ export default { ...@@ -325,6 +321,16 @@ export default {
return false return false
}, },
methods: { methods: {
refreshStudyList () {
const { options, rowData } = this
if (options.from === 'service') {
this.studyId = rowData.detailId
this.getShortCourseDetail(rowData.detailId, rowData.id)
} else {
this.studyId = rowData.id
this.getShortCourseDetail(rowData.id)
}
},
desensitizePhone (phone) { desensitizePhone (phone) {
if (!phone || typeof phone !== 'string') return phone; if (!phone || typeof phone !== 'string') return phone;
// 只处理11位手机号 // 只处理11位手机号
...@@ -875,7 +881,7 @@ export default { ...@@ -875,7 +881,7 @@ export default {
border-radius: toRpx(40); border-radius: toRpx(40);
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%); background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
&.disabled { &.disabled {
background: #D3DAE6; background: #d3dae6;
width: toRpx(140); width: toRpx(140);
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!