Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
center-psp-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
center-psp-show-h5
Commits
a3de7e87
提交
a3de7e87
authored
8月 28, 2024
作者:
lhh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
587f5246
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
74 行增加
和
178 行删除
+74
-178
Chapter.vue
src/modules/course/views/Chapter.vue
+15
-5
Detail.vue
src/modules/course/views/Detail.vue
+35
-10
index.ts
src/modules/exam/index.ts
+1
-2
Index.vue
src/modules/exam/views/Index.vue
+23
-7
View.vue
src/modules/exam/views/View.vue
+0
-154
没有找到文件。
src/modules/course/views/Chapter.vue
浏览文件 @
a3de7e87
...
...
@@ -4,6 +4,7 @@ import { getCourseDetail } from '../api'
import
CourseCatalog
from
'../components/CourseCatalog.vue'
const
route
=
useRoute
()
const
router
=
useRouter
()
let
data
:
any
=
reactive
({
course
:
{}
...
...
@@ -22,6 +23,10 @@ getCourseDetail({ id: route.query?.id as string }).then((res: any) => {
}
data
.
course
=
d
})
const
goExam
=
function
()
{
router
.
push
(
`/exam?type=course&id=
${
route
.
query
?.
id
}
&
eId
=
$
{
data
.
course
?.
exams
[
0
].
examination_id
}
`)
}
</
script
>
<
template
>
...
...
@@ -34,11 +39,16 @@ getCourseDetail({ id: route.query?.id as string }).then((res: any) => {
:data=
"data.course.chapters"
:isFree=
"data.course.is_free_name"
></CourseCatalog>
<div
class=
"all-btn"
>
<!-- 已考试 -->
<!--
<div
class=
"btn-s2"
>
查看课程成绩
</div>
-->
</div>
</div>
<van-button
v-if=
"data.course?.exams && data.course?.exams.length"
@
click=
"goExam"
type=
"primary"
size=
"large"
color=
"#aa1941"
style=
"margin-bottom: 1rem"
>
课程考试
</van-button
>
</
template
>
<
style
lang=
"scss"
scoped
>
...
...
@@ -52,7 +62,7 @@ getCourseDetail({ id: route.query?.id as string }).then((res: any) => {
margin-top
:
0
.54rem
;
padding
:
0
0
.2rem
;
box-sizing
:
border-box
;
margin-bottom
:
1
.7rem
;
margin-bottom
:
0
.7rem
;
h2
{
font-weight
:
bold
;
font-size
:
0
.28rem
;
...
...
src/modules/course/views/Detail.vue
浏览文件 @
a3de7e87
...
...
@@ -3,6 +3,7 @@ import AppContainer from '@/components/base/AppContainer.vue'
import
{
getCourseDetail
}
from
'../api'
import
CourseCatalog
from
'../components/CourseCatalog.vue'
import
{
useUserStore
}
from
'@/stores/user'
import
{
Dialog
}
from
'vant'
const
userStore
=
useUserStore
()
...
...
@@ -44,6 +45,26 @@ const handleStudy = function () {
router.push(`
/
course
/
player
?
id
=
$
{
route
.
query
?.
id
}
&
chapterId
=
$
{
query
.
cId
}
&
rId
=
$
{
query
.
rId
}
&&
zId
=
$
{
query
.
zId
}
`)
}
}
const isExam = function () {
if (data.course?.exams && data.course?.exams.length) {
if (data.course?.exams[0].status !== 0) {
return true
}
} else {
return false
}
return false
}
const viewResult = function () {
Dialog.alert({
title: data.course.category_name,
message: `
您的考试成绩:
$
{
data
.
course
?.
exams
[
0
].
score
}
`
}).then(() => {
// on close
})
}
</
script
>
<
template
>
...
...
@@ -72,17 +93,21 @@ const handleStudy = function () {
></CourseCatalog>
<div
class=
"all-btn"
>
<!-- 没购买 -->
<div
class=
"btn-s1"
v-if=
"data.course?.is_free_name === '收费'"
>
<div
class=
"price"
>
课程价格
<span>
¥
</span>
<p>
1999.00
</p>
<template
v-if=
"isExam()"
>
<!-- 已考试 -->
<div
class=
"btn-s2"
@
click=
"viewResult"
>
查看课程成绩
</div>
</
template
>
<
template
v-else
>
<div
class=
"btn-s1"
v-if=
"data.course?.is_free_name === '收费'"
>
<div
class=
"price"
>
课程价格
<span>
¥
</span>
<p>
1999.00
</p>
</div>
<div
class=
"btn"
>
立即购买
</div>
</div>
<div
class=
"btn"
>
立即购买
</div>
</div>
<!-- 已购买没考试 -->
<div
class=
"btn-s2"
v-else
@
click=
"handleStudy"
>
立即学习
</div>
<!-- 已考试 -->
<!--
<div
class=
"btn-s2"
>
查看课程成绩
</div>
-->
<!-- 已购买没考试 -->
<div
class=
"btn-s2"
v-else
@
click=
"handleStudy"
>
立即学习
</div>
</
template
>
</div>
</div>
</template>
...
...
src/modules/exam/index.ts
浏览文件 @
a3de7e87
...
...
@@ -7,8 +7,7 @@ export const routes: Array<RouteRecordRaw> = [
component
:
AppLayout
,
meta
:
{
requireLogin
:
true
},
children
:
[
{
path
:
''
,
component
:
()
=>
import
(
'./views/Index.vue'
)
},
{
path
:
':id'
,
component
:
()
=>
import
(
'./views/View.vue'
),
props
:
true
}
{
path
:
''
,
component
:
()
=>
import
(
'./views/Index.vue'
)
}
]
}
]
src/modules/exam/views/Index.vue
浏览文件 @
a3de7e87
...
...
@@ -11,10 +11,21 @@ let currentIndex = $ref(0)
let
data
:
any
=
$ref
()
// 题目数据
let
questions
:
any
=
$ref
()
getExam
({
type
:
'chapter'
,
course_id
:
route
.
query
?.
id
,
chapter_id
:
route
.
query
?.
cId
}).
then
((
res
:
any
)
=>
{
const
initParams
:
any
=
{
type
:
'chapter'
,
course_id
:
route
.
query
?.
id
}
if
(
route
.
query
.
type
)
{
initParams
.
type
=
'course'
initParams
.
examination_id
=
route
.
query
?.
eId
}
else
{
initParams
.
chapter_id
=
route
.
query
?.
cId
}
getExam
(
initParams
).
then
((
res
:
any
)
=>
{
data
=
res
.
data
if
(
res
.
data
?.
questions
||
res
.
data
?.
questions
!==
''
)
{
questions
=
changeData
(
JSON
.
parse
(
res
.
data
.
questions
).
question_items
)
console
.
log
(
questions
,
'questions'
)
}
})
...
...
@@ -105,13 +116,18 @@ const submit = function () {
}
})
})
submitQuestion
({
id
:
data
.
id
,
type
:
'chapter'
,
answers
:
JSON
.
stringify
(
params
),
status
:
'1'
}).
then
(
res
=>
{
submitQuestion
({
id
:
data
.
id
,
type
:
route
.
query
.
type
?
'course'
:
'chapter'
,
answers
:
JSON
.
stringify
(
params
),
status
:
'1'
}).
then
(
res
=>
{
router
.
go
(
-
1
)
})
}
</
script
>
<
template
>
<AppContainer
title=
"考试系统"
headerAlign=
"center"
@
back=
"handleBack"
type=
"1"
>
<AppContainer
title=
"考试系统"
headerAlign=
"center"
@
back=
"handleBack"
type=
"1"
style=
"padding-bottom: 1rem"
>
<div
class=
"exam-t"
>
<van-count-down
@
finish=
"finish"
:time=
"data?.end_time * 1000"
/>
<div
class=
"count"
>
{{
currentIndex
+
1
}}
/
{{
questions
?.
length
}}
</div>
...
...
@@ -145,10 +161,10 @@ const submit = function () {
</van-cell>
</van-cell-group>
</van-checkbox-group>
<div
class=
"btn-box"
>
<van-button
type=
"primary"
@
click=
"changeQ('prev')"
>
上一题
</van-button
>
<van-button
type=
"primary"
style=
"margin-left: 0.1rem"
@
click=
"changeQ('next')"
>
下
一题
</van-button>
<
/div
>
</div
>
<div
class=
"btn-box"
>
<van-button
type=
"primary"
@
click=
"changeQ('prev')"
>
上
一题
</van-button>
<
van-button
type=
"primary"
style=
"margin-left: 0.1rem"
@
click=
"changeQ('next')"
>
下一题
</van-button
>
</div>
</AppContainer>
<van-button
type=
"primary"
class=
"submit"
@
click=
"submit"
>
交卷
</van-button>
...
...
src/modules/exam/views/View.vue
deleted
100644 → 0
浏览文件 @
587f5246
<
script
setup
lang=
"ts"
>
import
dayjs
from
'dayjs'
import
{
getExamList
}
from
'../api'
import
type
{
ExamType
}
from
'../types'
import
{
useUserStore
}
from
'@/stores/user'
const
userStore
=
useUserStore
()
interface
Info
{
address
:
string
can_choose
:
boolean
id_number
:
string
list
:
ExamType
[]
}
const
props
=
defineProps
<
{
id
:
string
}
>
()
const
dataset
=
reactive
<
Info
>
({
address
:
''
,
can_choose
:
true
,
id_number
:
''
,
list
:
[]
})
// 日期转换
function
formatDate
(
time
:
string
)
{
return
dayjs
(
time
).
format
(
'YYYY年MM月DD日 HH:mm:ss'
)
}
// 获取列表
const
fetchList
=
()
=>
{
getExamList
().
then
(
res
=>
{
Object
.
assign
(
dataset
,
res
.
data
)
})
}
onMounted
(()
=>
{
fetchList
()
})
const
data
=
$computed
(():
ExamType
|
Record
<
string
,
any
>
=>
{
return
dataset
.
list
.
find
(
item
=>
item
.
exam_id
===
props
.
id
)
||
{}
})
const
hasScore
=
computed
<
boolean
>
(()
=>
{
return
parseInt
(
data
.
score
)
>=
0
})
const
examUrl
=
computed
<
string
>
(()
=>
{
return
`https://x-exam.ezijing.com/login/
${
props
.
id
}
`
})
</
script
>
<
template
>
<AppContainer
title=
"成绩查看"
v-if=
"hasScore"
>
<div
class=
"box"
>
<h2
class=
"t0"
>
{{
userStore
.
user
?.
name
}}
</h2>
<p
class=
"t1"
>
你的成绩
</p>
<p
class=
"t2"
>
<span>
{{
data
.
score
}}
</span>
<em>
分
</em>
</p>
<dl>
<dt>
考试名称
</dt>
<dd>
{{
data
.
name
}}
</dd>
</dl>
<dl>
<dt>
准考证号
</dt>
<dd>
{{
data
.
examinee_number
}}
</dd>
</dl>
<dl>
<dt>
考试时间
</dt>
<dd>
{{
formatDate
(
data
.
start_time
)
}}
</dd>
</dl>
</div>
</AppContainer>
<AppContainer
title=
"考场信息"
v-else
>
<div
class=
"box"
>
<dl>
<dt>
姓名
</dt>
<dd>
{{
userStore
.
user
?.
name
}}
</dd>
</dl>
<dl>
<dt>
准考证号
</dt>
<dd>
{{
data
.
examinee_number
}}
</dd>
</dl>
<dl>
<dt>
考试时间
</dt>
<dd>
{{
formatDate
(
data
.
start_time
)
}}
</dd>
</dl>
<dl>
<dt>
考试地址
</dt>
<dd>
{{
examUrl
}}
</dd>
</dl>
</div>
<p
class=
"tips"
>
提示:
<br
/>
可提前30分钟进入考试系统,
<br
/>
考试时间到了,仍未出现试题,请退出重新登录。
<br
/>
建议考试设备为电脑,保持网络稳定。
</p>
<a
:href=
"examUrl"
target=
"_blank"
>
<van-button
block
round
native-type=
"submit"
class=
"my-button"
>
点击开考
</van-button>
</a>
</AppContainer>
</
template
>
<
style
lang=
"scss"
scoped
>
.box
{
padding
:
0
.5rem
;
background-color
:
#fff
;
border-radius
:
0
.3rem
;
dl
{
display
:
flex
;
}
dl
+
dl
{
margin-top
:
0
.42rem
;
}
dt
{
width
:
4em
;
margin-right
:
0
.4rem
;
font-size
:
0
.28rem
;
font-weight
:
400
;
line-height
:
0
.4rem
;
color
:
#666666
;
white-space
:
nowrap
;
}
dd
{
flex
:
1
;
font-size
:
0
.3rem
;
font-weight
:
400
;
line-height
:
0
.4rem
;
color
:
#333
;
word-break
:
break-all
;
}
}
.tips
{
margin
:
0
.54rem
0
;
font-size
:
0
.26rem
;
line-height
:
0
.46rem
;
color
:
#033974
;
}
.t0
{
font-size
:
0
.46rem
;
font-weight
:
500
;
color
:
#033974
;
text-align
:
center
;
}
.t1
{
margin-top
:
0
.52rem
;
font-size
:
0
.32rem
;
font-weight
:
400
;
color
:
#333333
;
text-align
:
center
;
}
.t2
{
padding
:
0
.5rem
0
;
font-size
:
0
.4rem
;
color
:
#e6a74d
;
text-align
:
center
;
span
{
font-size
:
1rem
;
}
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论