From 48be9bf1667a3b4c3901f3bd8539fdd4c12f48cc Mon Sep 17 00:00:00 2001 From: xiayt Date: Fri, 22 Oct 2021 17:02:25 +0800 Subject: [PATCH] feat: 接口处理 --- src/views/Service/CardCourseList.vue | 73 +++++++++++++++++++++++++++++-------------------------------------------- 1 file changed, 29 insertions(+), 44 deletions(-) diff --git a/src/views/Service/CardCourseList.vue b/src/views/Service/CardCourseList.vue index 786be45..acf4ab2 100644 --- a/src/views/Service/CardCourseList.vue +++ b/src/views/Service/CardCourseList.vue @@ -67,52 +67,37 @@ export default { duration: 0, forbidClick: true, }); - // this.mgop({ - // api: 'mgop.sz.hswsy.CourseListByIdList', // 必须 - // host: 'https://mapi.zjzwfw.gov.cn/', - // dataType: 'JSON', - // type: 'POST', - // appKey: 'fuxgnukl+2001895516+edccpx', // 必须 - // headers: { - // // 'isTestUrl': '1' - // }, - // data: {idList:["1502","1524","1551","1570","1572"]}, - // onSuccess: res => { - // this.$toast.clear(); - // let proList = res.data.data; - // for (let i in proList) { - // proList[i].course_labels = proList[i].course_labels?.split(','); - // proList[i].coverUrl = proList[i]?.coverList[0]?.cover_url - // if (proList[i].startDate) { - // proList[i].week = this.formatWeek(this.Moment(proList[i].startDate).format('d')); - // proList[i].startDate = this.Moment(proList[i].startDate).format('YYYY.M.D'); - // proList[i].endDate = this.Moment(proList[i].endDate).format('YYYY.M.D'); - // } - // } - // console.log(proList) - // this.proList = proList - // }, - // onFail: err => { - // console.log('err', err) - // } - // }); - this.yxAxios.post(`https://yanxue.myjxt.com/api/StudiesWap/CourseList/ByIdList`, { - idList:this.proId - }).then((res) => { - this.$toast.clear(); - let proList = res.data.data; - for (let i in proList) { - proList[i].course_labels = proList[i].course_labels?.split(','); - proList[i].coverUrl = proList[i]?.coverList[0]?.cover_url - if (proList[i].startDate) { - proList[i].week = this.formatWeek(this.Moment(proList[i].startDate).format('d')); - proList[i].startDate = this.Moment(proList[i].startDate).format('YYYY.M.D'); - proList[i].endDate = this.Moment(proList[i].endDate).format('YYYY.M.D'); + this.mgop({ + api: 'mgop.sz.hswsy.CourseListByIdList', // 必须 + host: 'https://mapi.zjzwfw.gov.cn/', + dataType: 'JSON', + type: 'POST', + appKey: 'fuxgnukl+2001895516+edccpx', // 必须 + headers: { + // 'isTestUrl': '1' + }, + data: { + idList: this.proId.split(',') + }, + onSuccess: res => { + this.$toast.clear(); + let proList = res.data.data; + for (let i in proList) { + proList[i].course_labels = proList[i].course_labels?.split(','); + proList[i].coverUrl = proList[i]?.coverList[0]?.cover_url + if (proList[i].startDate) { + proList[i].week = this.formatWeek(this.Moment(proList[i].startDate).format('d')); + proList[i].startDate = this.Moment(proList[i].startDate).format('YYYY.M.D'); + proList[i].endDate = this.Moment(proList[i].endDate).format('YYYY.M.D'); + } } + console.log(proList) + this.proList = proList + }, + onFail: err => { + console.log('err', err) } - console.log(proList) - this.proList = proList - }) + }); }, formatWeek (week) { return week == 1 ? '周一' : week == 2 ? '周二' : week == 3 ? '周三' : week == 4 ? '周四' : week == 5 ? '周五' : week == 6 ? '周六' : week == 0 ? '周日' : ''; -- libgit2 0.21.0