Commit 38c1d8f6 by 李伟康

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

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