PreStudyPopup.vue
4.46 KB
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
<template>
<view class="exam-submit-popup-wrapper">
<view class="content-box">
<scroll-view class="course-list" scroll-y>
<view
class="course-item"
v-for="(item, index) in displayCourseList"
:key="item.id || index"
>
<view class="course-item-title">
<view class="course-item-title-text">{{ item.title }}</view>
<view class="course-item-desc">{{ item.description }}</view>
</view>
<view
class="course-item-btn"
v-if="item.state === 0"
@click.stop="handleStartStudy(item, index)"
>开启学习</view>
<view class="course-item-btn course-item-btn--learned" v-else>
<image class="course-item-btn-icon" :src="require('@/assets/images/common/icon-study-right.png')" mode="aspectFit"></image>
<text>已学习</text>
</view>
</view>
</scroll-view>
</view>
<!-- 按钮组(始终显示) -->
<view class="button-group">
<view class="confirm-button" @click="handleConfirm">
{{ confirmText }}
</view>
</view>
</view>
</template>
<script>
const DEFAULT_COURSE_LIST = [
{
id: 1,
title: 'AITO 春醒悦享车衣套餐',
description: '包含:原厂定制隐形车衣 + 专属天窗....',
state: 1
},
{
id: 2,
title: 'AITO 春醒悦享车衣套餐',
description: '包含:原厂定制隐形车衣 + 专属天窗....',
state: 0
}
]
export default {
name: 'PreStudyPopup',
props: {
confirmText: {
type: String,
default: '跳过'
},
courseList: {
type: Array,
default: () => []
}
},
computed: {
displayCourseList() {
return this.courseList.length ? this.courseList : DEFAULT_COURSE_LIST
}
},
methods: {
handleStartStudy(item, index) {
if (item.state !== 0) return
this.$emit('start-study', item, index)
uni.navigateTo({
url: '/pages/common/prelearnBridge'
})
},
handleCancel() {
this.$emit('cancel')
},
handleConfirm() {
this.$emit('confirm')
}
}
}
</script>
<style lang="scss" scoped>
.exam-submit-popup-wrapper {
position: relative;
width: 100%;
min-height: toRpx(400);
display: flex;
flex-direction: column;
align-items: center;
padding-bottom: toRpx(48);
}
.content-box {
width: toRpx(720);
box-sizing: border-box;
}
.course-list {
width: 100%;
height: toRpx(440);
box-sizing: border-box;
}
.course-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: toRpx(16);
width: 100%;
padding: toRpx(16);
border-radius: toRpx(16);
border: toRpx(2) solid #e4e9f7;
background: #f5f7fa;
box-sizing: border-box;
margin-bottom: toRpx(48);
}
.course-item-title {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: toRpx(16);
}
.course-item-title-text {
width: 100%;
color: #333333;
font-size: toRpx(40);
font-weight: 500;
font-family: "HarmonyOSSansSC";
line-height: toRpx(60);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.course-item-desc {
width: 100%;
color: #999999;
font-size: toRpx(28);
font-weight: 400;
font-family: "HarmonyOSSansSC";
line-height: toRpx(48);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.course-item-btn {
flex-shrink: 0;
height: toRpx(56);
padding: 0 toRpx(16);
border-radius: toRpx(8);
border: toRpx(2) solid rgba(44, 102, 247, 0.1);
background: #2c66f7;
color: #ffffff;
font-size: toRpx(26);
font-weight: 400;
font-family: "HarmonyOSSansSC";
line-height: toRpx(56);
text-align: center;
white-space: nowrap;
&--learned {
display: flex;
align-items: center;
gap: toRpx(8);
border: 1px solid rgba(44, 102, 247, 0.10);
background: rgba(44, 102, 247, 0.05);
color: #2c66f7;
}
}
.course-item-btn-icon {
width: 16px;
height: 16px;
flex-shrink: 0;
}
.button-group {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
gap: toRpx(16);
margin-top: toRpx(8);
}
.confirm-button {
width: toRpx(338);
height: toRpx(80);
margin: 0 auto;
border-radius: toRpx(48);
border: toRpx(2) solid #979797;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
font-size: toRpx(28);
font-weight: 500;
font-family: "HarmonyOSSansSC";
text-align: center;
line-height: toRpx(80);
&:active {
opacity: 0.8;
}
}
</style>