Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
transport-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
transport-show-h5
Commits
bd09fba2
提交
bd09fba2
authored
8月 06, 2020
作者:
lihuihui
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://gitlab.ezijing.com/ezijing/transport-weapp-h5
上级
929efe75
d399563d
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
149 行增加
和
30 行删除
+149
-30
account.js
src/api/account.js
+4
-0
update.vue
src/pages/my/alarm/components/update.vue
+29
-16
buyCourseList.vue
src/pages/my/learn/components/buyCourseList.vue
+13
-3
freeCourseList.vue
src/pages/my/learn/components/freeCourseList.vue
+13
-3
index.vue
src/pages/my/learn/index.vue
+37
-1
index.js
src/store/index.js
+18
-4
style.scss
src/style.scss
+35
-3
没有找到文件。
src/api/account.js
浏览文件 @
bd09fba2
...
...
@@ -39,3 +39,7 @@ export function bindVisitor(data) {
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
})
}
// 获取是否VIP
export
function
getIsVip
()
{
return
httpRequest
.
get
(
'/zy/user/is-vip'
)
}
src/pages/my/alarm/components/update.vue
浏览文件 @
bd09fba2
...
...
@@ -23,7 +23,7 @@
</van-checkbox-group>
</div>
</div>
<van-button
type=
"primary"
@
click=
"onSubmit"
>
确定
</van-button>
<van-button
type=
"primary"
:loading=
"submitLoading"
@
click=
"onSubmit"
>
确定
</van-button>
</div>
</div>
</
template
>
...
...
@@ -50,7 +50,8 @@ export default {
status
:
1
},
weeks
:
[
'周一'
,
'周二'
,
'周三'
,
'周四'
,
'周五'
,
'周六'
,
'周日'
],
defaultIndex
:
13
defaultIndex
:
13
,
submitLoading
:
false
}
},
watch
:
{
...
...
@@ -116,26 +117,38 @@ export default {
const
params
=
Object
.
assign
({},
this
.
ruleForm
)
params
.
type
=
this
.
selectedResultType
params
.
week_json
=
JSON
.
stringify
(
this
.
ruleForm
.
week_json
.
sort
())
api
.
addAlarm
(
params
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
handleSuccess
(
response
)
}
else
{
this
.
$toast
(
JSON
.
stringify
(
response
.
errors
))
}
})
this
.
submitLoading
=
true
api
.
addAlarm
(
params
)
.
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
handleSuccess
(
response
)
}
else
{
this
.
$toast
(
JSON
.
stringify
(
response
.
errors
))
}
})
.
finally
(()
=>
{
this
.
submitLoading
=
false
})
},
// 更新
handleUpdate
()
{
const
params
=
Object
.
assign
({},
this
.
ruleForm
)
params
.
type
=
this
.
selectedResultType
params
.
week_json
=
JSON
.
stringify
(
this
.
ruleForm
.
week_json
.
sort
())
api
.
updateAlaram
(
params
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
handleSuccess
(
response
)
}
else
{
this
.
$toast
(
JSON
.
stringify
(
response
.
errors
))
}
})
this
.
submitLoading
=
true
api
.
updateAlaram
(
params
)
.
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
handleSuccess
(
response
)
}
else
{
this
.
$toast
(
JSON
.
stringify
(
response
.
errors
))
}
})
.
finally
(()
=>
{
this
.
submitLoading
=
false
})
},
handleSuccess
(
response
)
{
this
.
$emit
(
'success'
,
response
)
...
...
src/pages/my/learn/components/buyCourseList.vue
浏览文件 @
bd09fba2
<
template
>
<div
class=
"main-list"
v-show=
"loaded"
>
<ul
v-if=
"list.length"
>
<ul
v-if=
"list.length
&& hasLearned
"
>
<li
v-for=
"item in list"
:key=
"item.course_id"
@
click=
"onClick(item)"
>
<div
class=
"name"
>
{{
item
.
course_name
}}
</div>
<div
class=
"progress"
>
{{
item
.
video_progress
|
progressText
}}
</div>
</li>
</ul>
<van-empty
description=
"
暂无内容
"
v-else
/>
<van-empty
description=
"
您还没有学习课程,快快开始学习吧!
"
v-else
/>
</div>
</
template
>
<
script
>
...
...
@@ -22,12 +22,22 @@ export default {
computed
:
{
isWeapp
()
{
return
this
.
$store
.
state
.
isWeapp
},
// 是否学习过
hasLearned
()
{
return
!!
this
.
list
.
find
(
item
=>
item
.
video_progress
)
}
},
filters
:
{
progressText
(
value
)
{
value
=
parseInt
(
value
)
return
value
===
100
?
'已学完'
:
`
${
value
}
%`
if
(
value
===
0
)
{
return
'未开始'
}
if
(
value
===
100
)
{
return
'已学完'
}
return
`已学
${
value
}
%`
}
},
methods
:
{
...
...
src/pages/my/learn/components/freeCourseList.vue
浏览文件 @
bd09fba2
<
template
>
<div
class=
"main-list"
v-show=
"loaded"
>
<ul
v-if=
"list.length"
>
<ul
v-if=
"list.length
&& hasLearned
"
>
<li
v-for=
"item in list"
:key=
"item.course_id"
@
click=
"onClick(item)"
>
<div
class=
"pic"
v-if=
"item.picture"
>
<img
:src=
"item.picture"
/>
...
...
@@ -9,7 +9,7 @@
<div
class=
"progress"
>
{{
item
.
video_progress
|
progressText
}}
</div>
</li>
</ul>
<van-empty
description=
"
暂无内容
"
v-else
/>
<van-empty
description=
"
您还没有学习课程,快快开始学习吧!
"
v-else
/>
</div>
</
template
>
<
script
>
...
...
@@ -25,12 +25,22 @@ export default {
computed
:
{
isWeapp
()
{
return
this
.
$store
.
state
.
isWeapp
},
// 是否学习过
hasLearned
()
{
return
!!
this
.
list
.
find
(
item
=>
item
.
video_progress
)
}
},
filters
:
{
progressText
(
value
)
{
value
=
parseInt
(
value
)
return
value
===
100
?
'已学完'
:
`
${
value
}
%`
if
(
value
===
0
)
{
return
'未开始'
}
if
(
value
===
100
)
{
return
'已学完'
}
return
`已学
${
value
}
%`
}
},
methods
:
{
...
...
src/pages/my/learn/index.vue
浏览文件 @
bd09fba2
...
...
@@ -3,7 +3,23 @@
<div
class=
"learn-choose"
>
<van-cell
title=
"选择已学课程:"
:value=
"selectedItem.name"
is-link
@
click=
"popupVisible = true"
/>
</div>
<buy-course-list
v-if=
"selectedItem.type === 1"
/>
<!-- 已学课程 -->
<template
v-if=
"selectedItem.type === 1"
>
<buy-course-list
v-if=
"isVip"
/>
<template
v-else
>
<van-empty
image=
"https://zws-imgs-pub.ezijing.com/transport/weapp/empty.png"
description=
"快去开启课程学习,一起加油考证吧!"
class=
"custom-empty"
/>
<div
class=
"fixed-box"
>
<div
class=
"fixed-inner"
>
<div
class=
"fixed-button"
@
click=
"toCourse"
>
学更多课程
</div>
</div>
</div>
</
template
>
</template>
<!-- 试题课程 -->
<free-course-list
v-else
/>
<van-popup
v-model=
"popupVisible"
...
...
@@ -44,6 +60,14 @@ export default {
selectedItem
:
{
type
:
1
,
name
:
'课程学习'
}
}
},
computed
:
{
isWeapp
()
{
return
this
.
$store
.
state
.
isWeapp
},
isVip
()
{
return
this
.
$store
.
state
.
isVip
}
},
methods
:
{
popupOpen
()
{
this
.
changeSelected
(
this
.
selectedItem
)
...
...
@@ -59,7 +83,19 @@ export default {
const
found
=
this
.
chooseList
.
find
(
item
=>
item
.
selected
)
this
.
selectedItem
=
found
this
.
popupVisible
=
false
},
toCourse
(
data
)
{
if
(
this
.
isWeapp
)
{
const
url
=
`/pages/web/index?src=
${
window
.
location
.
origin
}
/course/learn`
wx
.
miniProgram
.
navigateTo
({
url
})
}
else
{
this
.
$router
.
push
({
name
:
'courseLearn'
})
}
}
},
beforeMount
()
{
// 检测是否是付费用户
this
.
$store
.
dispatch
(
'checkIsVip'
)
}
}
</
script
>
...
...
src/store/index.js
浏览文件 @
bd09fba2
...
...
@@ -2,14 +2,15 @@ import Vue from 'vue'
import
Vuex
from
'vuex'
import
Cookies
from
'js-cookie'
import
{
getUser
,
logout
}
from
'@/api/account'
import
{
getUser
,
logout
,
getIsVip
}
from
'@/api/account'
Vue
.
use
(
Vuex
)
export
default
new
Vuex
.
Store
({
state
:
{
isWeapp
:
/miniProgram/
.
test
(
navigator
.
userAgent
),
isLogin
:
false
,
user
:
{},
token
:
''
,
user
:
{}
isVip
:
false
,
isLogin
:
false
,
isWeapp
:
/miniProgram/
.
test
(
navigator
.
userAgent
)
},
mutations
:
{
setToken
(
state
,
token
)
{
...
...
@@ -23,6 +24,9 @@ export default new Vuex.Store({
},
setIsLogin
(
state
,
isLogin
)
{
state
.
isLogin
=
isLogin
},
setIsVip
(
state
,
isVip
)
{
state
.
isVip
=
isVip
}
},
actions
:
{
...
...
@@ -57,6 +61,16 @@ export default new Vuex.Store({
commit
(
'setIsLogin'
,
false
)
return
response
})
},
async
checkIsVip
({
commit
,
state
})
{
if
(
state
.
isVip
)
{
return
state
.
isVip
}
const
isVip
=
await
getIsVip
()
.
then
(
response
=>
response
.
is_vip
)
.
catch
(()
=>
false
)
commit
(
'setIsVip'
,
isVip
)
return
isVip
}
}
})
src/style.scss
浏览文件 @
bd09fba2
...
...
@@ -85,9 +85,8 @@ body {
font-size
:
14px
;
line-height
:
1
.4
;
color
:
#222
;
font-family
:
'PingFang SC'
,
'Source Han Sans CN'
,
-
apple-system
,
'Microsoft YaHei'
,
'Helvetica'
,
'Arial'
,
Verdana
,
'Hiragino Sans GB'
,
'Wenquanyi Micro Hei'
,
sans-serif
;
font-family
:
'PingFang SC'
,
'Source Han Sans CN'
,
-
apple-system
,
'Microsoft YaHei'
,
'Helvetica'
,
'Arial'
,
Verdana
,
'Hiragino Sans GB'
,
'Wenquanyi Micro Hei'
,
sans-serif
;
background-color
:
#f7f7f7
;
}
.main-container
{
...
...
@@ -138,3 +137,36 @@ body {
.van-swipe
.van-swipe__indicators
{
bottom
:
5px
;
}
.fixed-box
{
height
:
55px
;
box-sizing
:
content-box
;
padding-bottom
:
env
(
safe-area-inset-bottom
);
}
.fixed-inner
{
position
:
fixed
;
left
:
0
;
right
:
0
;
bottom
:
0
;
max-width
:
750px
;
margin
:
0
auto
;
padding-bottom
:
env
(
safe-area-inset-bottom
);
}
.fixed-button
{
margin
:
10px
20px
;
height
:
35px
;
font-size
:
15px
;
line-height
:
35px
;
text-align
:
center
;
color
:
#fff
;
background
:
#c62245
;
border-radius
:
6px
;
}
.custom-empty
.van-empty__image
{
width
:
250px
;
height
:
205px
;
}
.van-empty__description
{
padding
:
0
20px
!
important
;
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论