Commit b67b562e5210f063f20dfeb6407d80c52e64f5a3

Authored by 夏洋涛
1 parent 6a7e9871
Exists in master

feat:课程接口修改

src/main.js
... ... @@ -22,6 +22,7 @@ Vue.prototype.baseUrl = 'https://proxy.shunzhi.net';
22 22 // Vue.prototype.yanxueUrl = 'https://www.zlyanxue.cn';
23 23 // Vue.prototype.yanxueUrl = 'https://zlyx.shunzhi.net';
24 24 Vue.prototype.yanxueUrl = 'https://ocp.sxsedu.net/sxyx/api';
  25 +Vue.prototype.yanxueUrlNew = 'https://ocp.sxsedu.net/szsh/yx';
25 26 Vue.prototype.kqUrl = 'https://proxy.shunzhi.net/achieve'
26 27  
27 28 Vue.prototype.TestUnionId = 'oJPmPuLaAx2x2DaRGfCFeYuLWzLU' //夏
... ...
src/views/Service/CourseBaseList/SelectionCourse.vue
... ... @@ -2,17 +2,14 @@
2 2 <template>
3 3 <div id="SelectionCourse">
4 4 <van-search v-model="searchValue" placeholder="请输入课程关键词" @search="reloadData" />
5   - <van-tabs v-model="active" @click="tabChange">
  5 + <!-- <van-tabs v-model="active" @click="tabChange">
6 6 <van-tab :title="item.text" v-for="(item, index) in typeOption" :key="index"></van-tab>
  7 + </van-tabs> -->
  8 + <van-tabs v-model="provinceActive" :ellipsis="false" ref="tabs" color="#4092FF" @change="provinceTabChange">
  9 + <van-tab :title="item.label" v-for="(item, index) in provinceTabList" :key="index"> </van-tab>
7 10 </van-tabs>
8   - <van-list
9   - v-if="CourseData.length > 0"
10   - v-model="loading"
11   - :finished="finished"
12   - finished-text="没有更多了"
13   - :immediate-check="false"
14   - @load="getCourseData"
15   - >
  11 + <van-list v-if="CourseData.length > 0" v-model="loading" :finished="finished" finished-text="没有更多了"
  12 + :immediate-check="false" @load="getCourseData">
16 13 <ServiceListSecond :list="CourseData" :courseTypeLableId="typeOption[active].id"></ServiceListSecond>
17 14 </van-list>
18 15 <van-empty v-if="finished && CourseData.length == 0" :image="require('@/assets/empty.png')" description="暂无活动" />
... ... @@ -23,7 +20,7 @@
23 20 <script>
24 21 import ServiceListSecond from '@/views/Service/component/ServiceListSecond.vue'
25 22 export default {
26   - data() {
  23 + data () {
27 24 return {
28 25 pageLoading: true,
29 26 pageSize: 10,
... ... @@ -35,9 +32,19 @@ export default {
35 32 CourseData: [],
36 33 typeOption: [],
37 34 active: 0,
  35 + provinceTabList: [
  36 + { label: '推荐', text: '', value: 0, id: '' },
  37 + { label: '越城', text: '越城区', value: 2, id: '' },
  38 + { label: '柯桥', text: '柯桥区', value: 1, id: '' },
  39 + { label: '上虞', text: '上虞区', value: 4, id: '' },
  40 + { label: '诸暨', text: '诸暨市', value: 3, id: '' },
  41 + { label: '嵊州', text: '嵊州市', value: 5, id: '' },
  42 + { label: '新昌', text: '新昌县', value: 5, id: '' },
  43 + ],
  44 + provinceActive: 0,
38 45 }
39 46 },
40   - mounted() {
  47 + mounted () {
41 48 let userInfo = localStorage.getItem('userInfo')
42 49 if (userInfo) {
43 50 userInfo = JSON.parse(userInfo)
... ... @@ -49,18 +56,18 @@ export default {
49 56 },
50 57 methods: {
51 58 // 下拉刷新
52   - onRefresh() {
  59 + onRefresh () {
53 60 this.pageNum = 1
54 61 this.reloadData()
55 62 },
56   - reloadData() {
  63 + reloadData () {
57 64 console.log('reloadData')
58 65 this.pageNum = 1
59 66 this.CourseData = []
60 67 this.getCourseData()
61 68 },
62 69 // 精选活动
63   - getCourseData() {
  70 + getCourseData () {
64 71 if (this.pageNum == 1) {
65 72 this.$toast.loading({
66 73 message: '加载中...',
... ... @@ -77,35 +84,41 @@ export default {
77 84 let startPrice = '-1',
78 85 endPrice = '-1'
79 86 this.yxAxios
80   - .post(`${this.yanxueUrl}/api/SchoolManage/SchoolCourseListV2`, {
81   - labelIdList: labelIdList,
82   - ageType: 0, //适应对象
83   - days: 0, //线路天数
84   - isSelfSupport: null, //是否支持定制
85   - // "provinceName":provinceName,//省份
86   - // "cityName":cityName,//城市
87   - areaName: areaName, //区
88   - startPrice: startPrice,
89   - endPrice: endPrice,
90   - courseName: this.searchValue,
91   - stype:1,
92   - pageIndex: this.pageNum,
  87 + .post(`${this.yanxueUrlNew}/course/getCourseByArea`, {
  88 + page: this.pageNum,
93 89 pageSize: this.pageSize,
  90 + provinceName: '浙江省',
  91 + cityName: '绍兴市',
  92 + areaName: this.provinceTabList[this.provinceActive].text,
94 93 })
  94 + // .post(`${this.yanxueUrl}/api/SchoolManage/SchoolCourseListV2`, {
  95 + // labelIdList: labelIdList,
  96 + // ageType: 0, //适应对象
  97 + // days: 0, //线路天数
  98 + // isSelfSupport: null, //是否支持定制
  99 + // // "provinceName":provinceName,//省份
  100 + // // "cityName":cityName,//城市
  101 + // areaName: areaName, //区
  102 + // startPrice: startPrice,
  103 + // endPrice: endPrice,
  104 + // courseName: this.searchValue,
  105 + // stype:1,
  106 + // pageIndex: this.pageNum,
  107 + // pageSize: this.pageSize,
  108 + // })
95 109 .then((res) => {
96 110 this.$toast.clear()
97   - if (res.data.status == 1) {
98   - let data = res.data.data
  111 + if (res.data.code == 200) {
99 112 this.loading = false
100   - let CourseData = data.data
  113 + let CourseData = res.data.rows || []
101 114 console.log('活动数据:', CourseData)
102   - if (this.pageSize * this.pageNum >= data.count) {
  115 + if (this.pageSize * this.pageNum >= res.data.total) {
103 116 this.finished = true
104 117 } else {
105 118 this.pageNum++
106 119 }
107 120 for (let i in CourseData) {
108   - CourseData[i].course_labels = CourseData[i].course_labels?.split(',')
  121 + CourseData[i].courseLabels = CourseData[i].courseLabels?.split(',')
109 122 if (CourseData[i].startDate) {
110 123 CourseData[i].week = this.formatWeek(this.Moment(CourseData[i].startDate).format('d'))
111 124 CourseData[i].startDate = this.Moment(CourseData[i].startDate).format('YYYY.M.D')
... ... @@ -115,12 +128,12 @@ export default {
115 128 this.CourseData = this.CourseData.concat(CourseData)
116 129 } else {
117 130 this.finished = true
118   - this.$toast(res.data.message || res.data.result)
  131 + this.$toast(res.data.msg)
119 132 }
120 133 })
121 134 },
122 135 // 获取研学类型
123   - getType() {
  136 + getType () {
124 137 // this.yxAxios.post(`http://121.40.30.78:9000/StudyLabelDetail/List`, {
125 138 this.yxAxios
126 139 .post(`${this.yanxueUrl}/StudyLabelDetail/List`, {
... ... @@ -152,28 +165,33 @@ export default {
152 165 },
153 166  
154 167 // 返回顶部
155   - backTop() {
  168 + backTop () {
156 169 document.getElementById('SelectionCourse').scrollIntoView()
157 170 },
158 171 // 格式化星期
159   - formatWeek(week) {
  172 + formatWeek (week) {
160 173 return week == 1
161 174 ? '周一'
162 175 : week == 2
163   - ? '周二'
164   - : week == 3
165   - ? '周三'
166   - : week == 4
167   - ? '周四'
168   - : week == 5
169   - ? '周五'
170   - : week == 6
171   - ? '周六'
172   - : week == 0
173   - ? '周日'
174   - : ''
  176 + ? '周二'
  177 + : week == 3
  178 + ? '周三'
  179 + : week == 4
  180 + ? '周四'
  181 + : week == 5
  182 + ? '周五'
  183 + : week == 6
  184 + ? '周六'
  185 + : week == 0
  186 + ? '周日'
  187 + : ''
  188 + },
  189 + // 改变地区
  190 + provinceTabChange () {
  191 + this.CourseData = []
  192 + this.getCourseData()
175 193 },
176   - tabChange() {
  194 + tabChange () {
177 195 this.pageNum = 1
178 196 this.CourseData = []
179 197 this.getCourseData()
... ... @@ -190,24 +208,29 @@ export default {
190 208 min-height: 100%;
191 209 background: #fff;
192 210 padding-bottom: 40px;
  211 +
193 212 .drop_down_box {
194 213 display: flex;
195 214 justify-content: space-between;
196 215 align-items: center;
  216 +
197 217 .filter {
198 218 flex-shrink: 0;
199 219 font-size: 28px;
200 220 padding: 0 30px;
201 221 }
202 222 }
  223 +
203 224 .characteristic_label {
204 225 white-space: nowrap;
205 226 overflow-x: auto;
206 227 padding: 0 30px;
207 228 padding-top: 20px;
  229 +
208 230 &::-webkit-scrollbar {
209 231 display: none;
210 232 }
  233 +
211 234 span {
212 235 display: inline-block;
213 236 padding: 10px;
... ... @@ -216,6 +239,7 @@ export default {
216 239 border-radius: 8px;
217 240 border: 1px solid #f5f6fa;
218 241 margin-right: 12px;
  242 +
219 243 &.active {
220 244 background: #ebf4ff;
221 245 color: #1373ea;
... ... @@ -223,11 +247,13 @@ export default {
223 247 }
224 248 }
225 249 }
  250 +
226 251 .page_loading {
227 252 font-size: 24px;
228 253 text-align: center;
229 254 padding-top: 40px;
230 255 }
  256 +
231 257 .backtop {
232 258 position: fixed;
233 259 bottom: 100px;
... ... @@ -237,6 +263,7 @@ export default {
237 263 border-radius: 10px;
238 264 padding: 10px;
239 265 }
  266 +
240 267 // .van-tab {
241 268 // font-size: 32px;
242 269 // }
... ...
src/views/Service/component/ServiceListSecond.vue
... ... @@ -6,8 +6,8 @@
6 6 <!-- <div class="uni_item_mini" :key="index" @click="handleUniDetail(item)" v-if="index<=3"> -->
7 7 <div class="uni_item_mini" :key="index" @click="handleUniDetail(item)">
8 8 <div class="img_box" :style="{ backgroundImage: 'url(' + item.coverUrl + ')' }">
9   - <div class="bottom" v-if="item.cityAddress || item.areaAddress">
10   - <span class="count">{{ item.read_count }} 人查看</span>
  9 + <div class="bottom">
  10 + <span class="count" v-if="item.readCount">{{ item.readCount }} 人查看</span>
11 11 </div>
12 12 </div>
13 13 <div class="content">
... ... @@ -16,7 +16,7 @@
16 16 <van-icon name="location" /> {{ item.cityAddress }}{{ item.cityAddress && item.areaAddress ? '·' : '' }}{{ item.areaAddress }}
17 17 </p>
18 18 <!-- <div class="tag_box">
19   - <template v-for="(tag, index2) in item.course_labels">
  19 + <template v-for="(tag, index2) in item.courseLabels">
20 20 <span class="tag" v-if="tag" :key="index2">{{ tag }}</span>
21 21 </template>
22 22 </div> -->
... ...