cshenfu
2024-06-27 58aa6e282bb343503be3cb198948328ea3ed7b79
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<template>
    <view class="page_bg">
        <!-- #ifdef APP-PLUS -->
        <view class="status_bar">
            <view class="top_view"></view>
        </view>
        <!-- #endif -->
        <view class="top_nav">
            <image src="/static/local/3546451940011a031009b939a8b26314.png" class="image_1" @click="pageBack" />
            <view class="cate">会员专享</view>
        </view>
        <view class="flex-col group_1">
            <view class="flex-row section_1" @tap="popShow = true">
                <image src="/static/local/3aa07251028c2ee9d409337d259cb3f9.png" class="image_2" />
                <view class="text_1">{{nowCourseName || '未选择'}}</view>
            </view>
            <view class="flex-col group_2">
                <view class="grid">
                    <view class="grid-item flex-row" @tap="JumpToChapters">
                        <view class="flex-col group_3">
                            <text class="text_2">章节练习</text>
                            <text class="text_4">针对训练,重点掌握</text>
                        </view>
                        <image src="/static/local/16403089502724267483.png" class="image_3" />
                    </view>
                    <view class="grid-item flex-row" @tap="JumpToCenter('核心知识点')">
                        <view class="flex-col group_4">
                            <text class="text_2">核心知识点</text>
                            <text class="text_4">专业解析,知识难点</text>
                        </view>
                        <image src="/static/local/16403089502735192479.png" class="image_4 image_5" />
                    </view>
                    <view class="grid-item justify-between" @tap="JumpToCenter('考前分析')">
                        <view class="flex-col">
                            <text class="text_2">考前分析</text>
                            <text class="text_4">考前开放</text>
                        </view>
                        <image src="/static/local/16403089502736923482.png" class="image_4 image_6" />
                    </view>
                </view>
                <u-modal v-model="show" :show-title="false" content="购买相应课程后可获得此题库权限~"></u-modal>
            </view>
        </view>
        <u-popup v-model="popShow" mode="bottom" height="70%" :closeable="true">
            <view class="pop_bg">
                <view class="title">选择课程</view>
                <scroll-view scroll-y class="main">
                    <view class="course_item" v-for="item in courseList" :key="item._id"
                        @tap="selectCourse(item.courseInfo)">
                        <u-image :src="item.courseInfo.thumb" :lazy-load="true" class="image_12" mode="aspectFill">
                        </u-image>
                        <view class="item_title">{{item.courseInfo.title}}</view>
                    </view>
                </scroll-view>
            </view>
        </u-popup>
    </view>
</template>
 
<script>
    var that; // 当前页面对象
    var vk; // vk依赖
    export default {
        data() {
            // 页面数据变量
            return {
                // 分类id
                cid: '',
                // 已购课程列表
                courseList: [],
                // 当前选中课程
                nowCourseId: '',
                nowCourseName: '',
 
                popShow: false,
                show: false
            }
        },
        // 监听 - 页面每次【加载时】执行(如:前进)
        onLoad(options = {}) {
            that = this;
            vk = that.vk;
            that.init(options)
        },
        // 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
        onReady() {},
        // 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
        onShow() {},
        // 监听 - 页面每次【隐藏时】执行(如:返回)
        onHide() {},
        // 函数
        methods: {
            // 页面数据初始化函数
            init(options) {
                this.cid = options.cateId
                this.getMyCourse()
            },
            pageBack() {
                uni.navigateBack({
                    delta: 1
                })
            },
            // 获取所有已购课程
            getMyCourse() {
                vk.callFunction({
                    url: 'client/quest-bank/kh/vip/getMyCourseList',
                    title: '获取课程中...',
                    data: { need_user_info: true },
                    success(data) {
                        that.courseList = data.rows
                        // 默认显示分类所选课程
                        data.rows.map(v => {
                            if (v.courseInfo.category_id == that.cid) {
                                that.nowCourseId = v.courseInfo._id
                                that.nowCourseName = v.courseInfo.title
                            }
                        })
                    }
                });
            },
            // 选择完成
            selectCourse(info) {
                this.popShow = false
                this.$nextTick(() => {
                    this.nowCourseId = info._id
                    this.nowCourseName = info.title
                })
            },
            // 所有权检测
            canJump() {
                this.show = true
                return true
            },
            // 跳转章节
            JumpToChapters() {
                uni.navigateTo({
                    url: `/pages/question-bank/vip-chapter-page?cid=${that.nowCourseId}`
                })
            },
            // 跳转核心知识点或考前分析
            JumpToCenter(title) {
                uni.navigateTo({
                    url: `/pages/question-bank/vip-rich-page?title=${title}&cid=${that.nowCourseId}`
                })
            }
        },
    }
</script>
 
<style lang="scss" scoped>
    .page_bg {
        background-color: #F5F5F5;
        width: 100%;
        height: 100vh;
        overflow-y: auto;
 
        .status_bar,
        .top_view {
            background-color: #FDD303;
        }
 
        .top_nav {
            padding-bottom: 24rpx;
            color: rgb(51, 51, 51);
            font-size: 34rpx;
            line-height: 41rpx;
            white-space: nowrap;
            background: linear-gradient(179deg, #FDD303 0%, #FFAC05 100%);
            height: 90rpx;
            position: relative;
 
            .image_1 {
                left: 21rpx;
                top: 27rpx;
                width: 19rpx;
                height: 35rpx;
                position: absolute;
            }
 
            .cate {
                width: 100%;
                padding: 20rpx 0;
                color: rgb(51, 51, 51);
                font-size: 34rpx;
                font-weight: 500;
                line-height: 41rpx;
                white-space: nowrap;
                text-align: center;
            }
        }
 
        .group_1 {
            flex: 1 1 auto;
            overflow-y: auto;
 
            .section_1 {
                padding: 36rpx 20rpx;
                color: rgb(51, 51, 51);
                font-size: 32rpx;
                line-height: 41rpx;
                white-space: nowrap;
                background-color: rgb(255, 255, 255);
 
                .image_2 {
                    margin: 10rpx 0;
                    width: 20rpx;
                    height: 20rpx;
                }
 
                .text_1 {
                    margin-left: 14rpx;
                    flex: 1;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }
            }
 
            .group_2 {
                margin-top: 20rpx;
                padding: 0 20rpx;
 
                .grid {
                    height: 344rpx;
                    display: grid;
                    grid-template-columns: repeat(2, 1fr);
                    grid-row-gap: 22rpx;
                    grid-column-gap: 24rpx;
 
                    .grid-item {
                        padding: 40rpx 20rpx 38rpx;
                        background-color: rgb(255, 255, 255);
                        border-radius: 12rpx;
 
                        .group_3 {
                            flex: 1 1 auto;
                        }
 
                        .image_3 {
                            margin: 8rpx 0 10rpx 17rpx;
                            width: 64rpx;
                            height: 66rpx;
                        }
 
                        .group_4 {
                            flex: 1 1 auto;
                        }
 
                        .image_4 {
                            align-self: center;
                            width: 61rpx;
                            height: 63rpx;
                        }
 
                        .image_5 {
                            margin-left: 19rpx;
                            margin-right: 3rpx;
                        }
 
                        .image_6 {
                            margin-right: 3rpx;
                        }
 
                        .text_2 {
                            color: rgb(51, 51, 51);
                            font-size: 30rpx;
                            line-height: 36rpx;
                            white-space: nowrap;
                        }
 
                        .text_4 {
                            margin-top: 20rpx;
                            color: rgb(153, 153, 153);
                            font-size: 24rpx;
                            line-height: 29rpx;
                            white-space: nowrap;
                        }
                    }
                }
            }
        }
    }
 
    .pop_bg {
        padding: 30rpx;
        box-sizing: border-box;
        height: 100%;
 
        .title {
            text-align: center;
            font-size: 30rpx;
            font-weight: bold;
        }
 
        .main {
            height: calc(100% - 50rpx);
            margin-top: 10rpx;
 
            .course_item {
                padding: 40rpx 0;
                border-bottom: 2rpx solid #F0F0F0;
                display: flex;
 
                .image_12 {
                    width: 230rpx !important;
                    height: 120rpx !important;
                    border-radius: 8rpx !important;
                    overflow: hidden !important;
                    margin-right: 20rpx;
                }
 
                .item_title {
                    flex: 1;
                    word-break: break-all;
                    text-overflow: ellipsis;
                    overflow: hidden;
                    display: -webkit-box;
                    -webkit-line-clamp: 3;
                    -webkit-box-orient: vertical;
                }
            }
        }
    }
</style>