Commit 48be9bf1667a3b4c3901f3bd8539fdd4c12f48cc

Authored by 夏洋涛
1 parent 68da6ea2
Exists in master

feat: 接口处理

Showing 1 changed file with 29 additions and 44 deletions   Show diff stats
src/views/Service/CardCourseList.vue
@@ -67,52 +67,37 @@ export default { @@ -67,52 +67,37 @@ export default {
67 duration: 0, 67 duration: 0,
68 forbidClick: true, 68 forbidClick: true,
69 }); 69 });
70 - // this.mgop({  
71 - // api: 'mgop.sz.hswsy.CourseListByIdList', // 必须  
72 - // host: 'https://mapi.zjzwfw.gov.cn/',  
73 - // dataType: 'JSON',  
74 - // type: 'POST',  
75 - // appKey: 'fuxgnukl+2001895516+edccpx', // 必须  
76 - // headers: {  
77 - // // 'isTestUrl': '1'  
78 - // },  
79 - // data: {idList:["1502","1524","1551","1570","1572"]},  
80 - // onSuccess: res => {  
81 - // this.$toast.clear();  
82 - // let proList = res.data.data;  
83 - // for (let i in proList) {  
84 - // proList[i].course_labels = proList[i].course_labels?.split(',');  
85 - // proList[i].coverUrl = proList[i]?.coverList[0]?.cover_url  
86 - // if (proList[i].startDate) {  
87 - // proList[i].week = this.formatWeek(this.Moment(proList[i].startDate).format('d'));  
88 - // proList[i].startDate = this.Moment(proList[i].startDate).format('YYYY.M.D');  
89 - // proList[i].endDate = this.Moment(proList[i].endDate).format('YYYY.M.D');  
90 - // }  
91 - // }  
92 - // console.log(proList)  
93 - // this.proList = proList  
94 - // },  
95 - // onFail: err => {  
96 - // console.log('err', err)  
97 - // }  
98 - // });  
99 - this.yxAxios.post(`https://yanxue.myjxt.com/api/StudiesWap/CourseList/ByIdList`, {  
100 - idList:this.proId  
101 - }).then((res) => {  
102 - this.$toast.clear();  
103 - let proList = res.data.data;  
104 - for (let i in proList) {  
105 - proList[i].course_labels = proList[i].course_labels?.split(',');  
106 - proList[i].coverUrl = proList[i]?.coverList[0]?.cover_url  
107 - if (proList[i].startDate) {  
108 - proList[i].week = this.formatWeek(this.Moment(proList[i].startDate).format('d'));  
109 - proList[i].startDate = this.Moment(proList[i].startDate).format('YYYY.M.D');  
110 - proList[i].endDate = this.Moment(proList[i].endDate).format('YYYY.M.D'); 70 + this.mgop({
  71 + api: 'mgop.sz.hswsy.CourseListByIdList', // 必须
  72 + host: 'https://mapi.zjzwfw.gov.cn/',
  73 + dataType: 'JSON',
  74 + type: 'POST',
  75 + appKey: 'fuxgnukl+2001895516+edccpx', // 必须
  76 + headers: {
  77 + // 'isTestUrl': '1'
  78 + },
  79 + data: {
  80 + idList: this.proId.split(',')
  81 + },
  82 + onSuccess: res => {
  83 + this.$toast.clear();
  84 + let proList = res.data.data;
  85 + for (let i in proList) {
  86 + proList[i].course_labels = proList[i].course_labels?.split(',');
  87 + proList[i].coverUrl = proList[i]?.coverList[0]?.cover_url
  88 + if (proList[i].startDate) {
  89 + proList[i].week = this.formatWeek(this.Moment(proList[i].startDate).format('d'));
  90 + proList[i].startDate = this.Moment(proList[i].startDate).format('YYYY.M.D');
  91 + proList[i].endDate = this.Moment(proList[i].endDate).format('YYYY.M.D');
  92 + }
111 } 93 }
  94 + console.log(proList)
  95 + this.proList = proList
  96 + },
  97 + onFail: err => {
  98 + console.log('err', err)
112 } 99 }
113 - console.log(proList)  
114 - this.proList = proList  
115 - }) 100 + });
116 }, 101 },
117 formatWeek (week) { 102 formatWeek (week) {
118 return week == 1 ? '周一' : week == 2 ? '周二' : week == 3 ? '周三' : week == 4 ? '周四' : week == 5 ? '周五' : week == 6 ? '周六' : week == 0 ? '周日' : ''; 103 return week == 1 ? '周一' : week == 2 ? '周二' : week == 3 ? '周三' : week == 4 ? '周四' : week == 5 ? '周五' : week == 6 ? '周六' : week == 0 ? '周日' : '';