detail.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. <template>
  2. <view class="container">
  3. <view class="bg-top bg-black">
  4. <view class="top-box shadow">
  5. <!-- <view class="qh-pic cu-avatar xl" style="background-image:url(https://zhoukaiwen.com/img/kevinLogo.png)"></view> -->
  6. <view class="qh-title text-bold text-primary text-xl">
  7. <text>{{detail.name}}</text>
  8. </view>
  9. <view class="bxBox" style="border-top: 1rpx solid #eee;">
  10. <text class="bxImg cuIcon-titles text-pink"></text>
  11. <view class="title text-black">考场说明</view>
  12. </view>
  13. <view class='padding-bottom-sm padding-left-sm bg-white'>
  14. {{detail.contents}}
  15. </view>
  16. <!-- :class="[menuBorder?'sm-border':'',menuCard?'card-menu margin-top':'']" -->
  17. <view class="cu-list menu">
  18. <view class="cu-item padding-0">
  19. <view class="content margin-top" style="display: flex; justify-content: space-around;">
  20. <text class="text-black text-bold"
  21. style="min-width: 290rpx; max-width: 290rpx; text-align: left;">{{detail.start_time|format_date}}</text>
  22. <text class="cuIcon-forwardfill text-primary margin-lr-sm"></text>
  23. <text class="text-black text-bold"
  24. style="min-width: 290rpx; max-width: 290rpx; text-align: left;">{{detail.end_time|format_date}}</text>
  25. </view>
  26. </view>
  27. <view class="cu-item padding-0">
  28. <view class="content">
  29. <text class="cuIcon-filter text-green"></text>
  30. <text class="text-black">考场分类</text>
  31. </view>
  32. <view class="action">
  33. <view class="text-black text-sm">{{detail.cates ? detail.cates.name : ''}}</view>
  34. </view>
  35. </view>
  36. <view class="cu-item padding-0">
  37. <view class="content">
  38. <text class="cuIcon-list text-primary"></text>
  39. <text class="text-black">报名方式</text>
  40. </view>
  41. <view class="action">
  42. <view class="cu-tag round light" :class="[signupClass]">{{detail.signup_mode_text}}</view>
  43. </view>
  44. </view>
  45. <view class="cu-item padding-0">
  46. <view class="content">
  47. <text class="cuIcon-writefill text-pink"></text>
  48. <text class="text-black">补考方式</text>
  49. </view>
  50. <view class="cu-capsule radius" v-if="detail && detail.is_makeup">
  51. <view class='cu-tag bg-green'>
  52. <text class="cuIcon-check text-lg"></text>
  53. </view>
  54. <view class="cu-tag line-green">
  55. {{detail.is_makeup_text + detail.makeup_count}}次
  56. </view>
  57. </view>
  58. <view class="cu-capsule radius" v-else>
  59. <view class='cu-tag bg-red'>
  60. <text class="cuIcon-close text-lg"></text>
  61. </view>
  62. <view class="cu-tag line-red">
  63. 不可补考
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <!-- 试卷信息 -->
  70. <view class="center-box shadow">
  71. <view class="cu-list menu">
  72. <view class="cu-bar bg-white margin-top-xs u-border-bottom">
  73. <view class="action sub-title">
  74. <text class="text-xl text-bold text-primary text-shadow">试卷信息</text>
  75. <text class="text-ABC text-primary">Paper</text>
  76. </view>
  77. </view>
  78. <view class="cu-item padding-0">
  79. <view class="content">
  80. <text class="cuIcon-formfill text-primary"></text>
  81. <text class="text-lg">考卷</text>
  82. </view>
  83. <view class="action">
  84. <text class="text-grey text-sm">{{detail && detail.paper && detail.paper.title}}</text>
  85. </view>
  86. </view>
  87. <view class="cu-item padding-0" v-if="detail && detail.paper && detail.paper.limit_time">
  88. <view class='content'>
  89. <text class="cuIcon-timefill text-primary"></text>
  90. <text class='text-lg'>考试限时</text>
  91. </view>
  92. <view class="action">
  93. <view class="cu-tag round bg-blue light">
  94. {{detail.paper.limit_time|format_second}}
  95. </view>
  96. </view>
  97. </view>
  98. <view class="cu-item padding-0">
  99. <view class='content'>
  100. <text class="cuIcon-activityfill text-primary"></text>
  101. <text class='text-lg'>总分数</text>
  102. </view>
  103. <view class="action">
  104. <view class="cu-tag round bg-blue light">
  105. {{detail && detail.paper && detail.paper.total_score}}分
  106. </view>
  107. </view>
  108. </view>
  109. <view class="cu-item padding-0">
  110. <view class='content'>
  111. <text class="cuIcon-upstagefill text-primary"></text>
  112. <text class='text-lg'>及格分数</text>
  113. </view>
  114. <view class="action">
  115. <view class="cu-tag round bg-red light">
  116. {{detail && detail.paper && detail.paper.pass_score}}分
  117. </view>
  118. </view>
  119. </view>
  120. <view class="cu-item padding-0">
  121. <view class='content'>
  122. <text class="cuIcon-btn text-primary"></text>
  123. <text class='text-lg'>题目数量</text>
  124. </view>
  125. <view class="action">
  126. <view class="text-sm">
  127. {{detail && detail.paper && detail.paper.quantity}}题
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <!-- 报名信息 -->
  134. <view class="center-box shadow" v-if="signupLog">
  135. <view class="cu-list menu">
  136. <view class="cu-bar bg-white margin-top-xs u-border-bottom">
  137. <view class="action sub-title">
  138. <text class="text-xl text-bold text-primary text-shadow">报名信息</text>
  139. <text class="text-ABC text-primary">Signup</text>
  140. </view>
  141. </view>
  142. <view class="cu-item padding-0">
  143. <view class="content">
  144. <text class="cuIcon-myfill text-primary"></text>
  145. <text class="text-lg">姓名</text>
  146. </view>
  147. <view class="action">
  148. <text class="text-grey text-sm">{{signupLog.real_name}}</text>
  149. </view>
  150. </view>
  151. <view class="cu-item padding-0">
  152. <view class='content'>
  153. <text class="cuIcon-mobilefill text-primary"></text>
  154. <text class='text-lg'>联系方式</text>
  155. </view>
  156. <view class="action">
  157. <view class="action">
  158. <text class="text-grey text-sm">{{signupLog.phone}}</text>
  159. </view>
  160. </view>
  161. </view>
  162. <view class="cu-item padding-0">
  163. <view class='content'>
  164. <text class="cuIcon-title text-primary"></text>
  165. <text class='text-lg'>报名状态</text>
  166. </view>
  167. <view class="action">
  168. <view class="cu-tag round light" :class="[signupStatusClass]">{{signupLog.status_text}}
  169. </view>
  170. </view>
  171. </view>
  172. </view>
  173. </view>
  174. <view class="top-box shadow" v-if="signupLog && signupLog.status == 2">
  175. <view class="bxBox" style="border-top: 1rpx solid #eee;">
  176. <text class="bxImg cuIcon-wenzi text-red"></text>
  177. <view class="title text-black">驳回说明</view>
  178. </view>
  179. <view class='padding-bottom-sm padding-left-sm bg-white text-red'>
  180. {{signupLog.message || '无'}}
  181. </view>
  182. </view>
  183. <!-- 考试记录 -->
  184. <view class="center-box shadow" v-if="examLogs.length > 0">
  185. <view class="cu-list menu">
  186. <view class="cu-bar bg-white margin-top-xs u-border-bottom">
  187. <view class="action sub-title">
  188. <text class="text-xl text-bold text-primary text-shadow">考试记录</text>
  189. <text class="text-ABC text-primary">Exam</text>
  190. </view>
  191. </view>
  192. <view class="cu-item arrow padding-left-0" v-for="(examLog, index) in examLogs" :key="index">
  193. <button class="cu-btn content" @click="viewExamLogModal(examLog)">
  194. <view class="content">
  195. <text class="cuIcon-myfill text-primary"></text>
  196. <text class="text-lg">{{examLog.createtime|format_date}}</text>
  197. </view>
  198. <view class="action">
  199. <view class="cu-tag round light" :class="[examLog.is_pass ? 'bg-green' : 'bg-red']">
  200. {{examLog.score}}分</view>
  201. </view>
  202. </button>
  203. </view>
  204. </view>
  205. </view>
  206. <!-- 报名、考试按钮 -->
  207. <view class="padding-xl">
  208. <button class="cu-btn round block margin-tb-sm lg" :class="[signupBtnClass]" @tap="signup"
  209. v-if="canSignup">{{signupBtnText}}</button>
  210. <button class="cu-btn round block margin-tb-sm lg bg-green" @tap="startPaper"
  211. v-if="canStart">{{canStart == 1 ? '开始考试' : '开始补考'}}</button>
  212. </view>
  213. <view class="padding-lr" style="margin-top: 15rpx; margin-bottom: 30rpx;">
  214. <text class="text-grey text-sm">{{signupTips}}</text>
  215. </view>
  216. </view>
  217. <!-- 报名对话框 -->
  218. <view class="cu-modal" :class="showApplyModal">
  219. <view class="cu-dialog">
  220. <view class="cu-bar bg-white justify-end">
  221. <view class="content">请填写相关信息</view>
  222. <view class="action" @tap="hideModal">
  223. <text class="cuIcon-close text-red"></text>
  224. </view>
  225. </view>
  226. <view class="">
  227. <view class="cu-form-group">
  228. <view class="title">姓名</view>
  229. <input placeholder="请输入姓名" v-model="formData.real_name"></input>
  230. </view>
  231. <view class="cu-form-group">
  232. <view class="title">手机</view>
  233. <input placeholder="请输入手机号码" v-model="formData.phone"></input>
  234. </view>
  235. <view class="cu-form-group" v-if="detail.signup_mode == 'PASSWORD'">
  236. <view class="title">密码</view>
  237. <input type="password" placeholder="请输入该考场密码" v-model="formData.password"></input>
  238. </view>
  239. </view>
  240. <view class="cu-bar bg-white justify-end">
  241. <view class="action">
  242. <button class="cu-btn line-blue text-primary" @tap="hideModal">取消</button>
  243. <button class="cu-btn bg-blue margin-left" @tap="submitSignup">提交报名</button>
  244. </view>
  245. </view>
  246. </view>
  247. </view>
  248. <!-- 开始考试对话框 -->
  249. <view class="cu-modal" :class="showStartModal">
  250. <view class="cu-dialog">
  251. <view class="cu-bar bg-white justify-end">
  252. <view class="content">提示</view>
  253. <view class="action" @tap="hideModal">
  254. <text class="cuIcon-close text-red"></text>
  255. </view>
  256. </view>
  257. <view class="padding-xl">
  258. 确认进入考场开始考试吗?{{makeupText}}
  259. </view>
  260. <view class="cu-bar bg-white">
  261. <view class="action margin-0 flex-sub text-green " @tap="hideModal" v-if="false"><text
  262. class="cuIcon-moneybag"></text>微信支付</view>
  263. <view class="action margin-0 flex-sub solid-left" @tap="hideModal">取消</view>
  264. <view class="action margin-0 flex-sub text-green solid-left" @tap="goExam()">准备好了,开始吧</view>
  265. </view>
  266. </view>
  267. </view>
  268. <!-- 考试记录弹框 -->
  269. <view class="cu-modal" :class="showExamLogModal">
  270. <view class="cu-dialog">
  271. <view class="cu-bar bg-white justify-end">
  272. <view class="content">考试记录</view>
  273. <view class="action" @tap="hideModal">
  274. <text class="cuIcon-close text-red"></text>
  275. </view>
  276. </view>
  277. <view class="center-box ">
  278. <view class="cu-list menu">
  279. <view class="cu-item text-left">
  280. <view class="content">
  281. <text class="cuIcon-time text-primary"></text>
  282. <text class="text-black">考试时间</text>
  283. </view>
  284. <view class="action">
  285. <text class="text-grey text-sm">{{examLogItem.createtime|format_date}}</text>
  286. </view>
  287. </view>
  288. <view class="cu-item text-left">
  289. <view class="content">
  290. <text class="cuIcon-countdown text-primary"></text>
  291. <text class="text-black">考试用时</text>
  292. </view>
  293. <view class="action">
  294. <text class="text-grey text-sm">{{examLogItem.grade_time|format_second}}</text>
  295. </view>
  296. </view>
  297. <view class="cu-item text-left">
  298. <view class="content">
  299. <text class="cuIcon-write text-primary"></text>
  300. <text class="text-black">是否补考</text>
  301. </view>
  302. <view class="action">
  303. <view class="cu-tag round light" :class="[examLogItem.is_makeup?'bg-yellow':'bg-blue']">
  304. {{examLogItem.is_makeup?'是':'否'}}</view>
  305. </view>
  306. </view>
  307. <view class="cu-item text-left">
  308. <view class="content">
  309. <text class="cuIcon-punch text-primary"></text>
  310. <text class="text-black">考试成绩</text>
  311. </view>
  312. <view class="action">
  313. <view class="cu-tag round light" :class="[examLogItem.is_pass?'bg-green':'bg-red']">
  314. {{examLogItem.score}}分</view>
  315. <view class="cu-tag round light" :class="[examLogItem.is_pass?'bg-green':'bg-red']">
  316. {{examLogItem.is_pass?'及格':'不及格'}}</view>
  317. </view>
  318. </view>
  319. <view class="cu-item text-left">
  320. <view class="content">
  321. <text class="cuIcon-read text-primary"></text>
  322. <text class="text-black">考试情况</text>
  323. </view>
  324. <view class="action">
  325. <view class="cu-tag round light bg-green">正确{{examLogItem.right_count}}题</view>
  326. <view class="cu-tag round light bg-red">错误{{examLogItem.error_count}}题</view>
  327. </view>
  328. </view>
  329. </view>
  330. </view>
  331. <view class="cu-bar bg-white justify-end">
  332. <view class="action">
  333. <button class="cu-btn line-blue text-primary" @tap="hideModal">关闭</button>
  334. </view>
  335. </view>
  336. </view>
  337. </view>
  338. <login ref="login" v-on:succ="getDetail"></login>
  339. </view>
  340. </template>
  341. <script>
  342. // import request from '@/common/request.js';
  343. export default {
  344. data() {
  345. return {
  346. roomId: 0,
  347. detail: {},
  348. signupLog: {},
  349. examLogs: [],
  350. examLogItem: {},
  351. canSignup: true,
  352. canStart: false,
  353. signupBtnText: '立即报名',
  354. signupBtnClass: 'bg-blue',
  355. signupClass: 'bg-green',
  356. signupStatusClass: 'bg-green',
  357. signupTips: '',
  358. showApplyModal: [''],
  359. showStartModal: [''],
  360. showExamLogModal: [''],
  361. makeupText: '',
  362. formData: {
  363. real_name: '',
  364. phone: '',
  365. password: '',
  366. },
  367. // password: '',
  368. }
  369. },
  370. onLoad(e) {
  371. this.roomId = e.id
  372. if (!this.roomId) {
  373. uni.showToast({
  374. title: '缺少考场ID参数',
  375. icon: 'error'
  376. })
  377. this.utils.goback()
  378. return
  379. }
  380. this.getDetail()
  381. },
  382. onShow() {
  383. uni.$on('login_success', (data) => {
  384. console.log('login_success', data)
  385. this.getDetail()
  386. })
  387. this.getDetail()
  388. },
  389. computed: {
  390. },
  391. methods: {
  392. // 获取详情
  393. getDetail() {
  394. this.http('room/detail', {
  395. room_id: this.roomId
  396. }, 'get').then(res => {
  397. if (res.code == 0) {
  398. this.utils.toast(res.msg)
  399. setTimeout(() => {
  400. uni.navigateBack()
  401. }, 2000)
  402. return
  403. }
  404. this.detail = res.data.room
  405. if (this.detail.signup_mode == 'NORMAL') {
  406. this.signupClass = 'bg-green'
  407. this.signupTips = '当前报名方式为【直接参加】,点击按钮报名即表示参加成功'
  408. } else if (this.detail.signup_mode == 'PASSWORD') {
  409. this.signupClass = 'bg-red'
  410. this.signupTips = '当前报名方式需要输入正确密码才能参加'
  411. } else if (this.detail.signup_mode == 'AUDIT') {
  412. this.signupClass = 'bg-purple'
  413. this.signupTips = '当前报名方式提交申请后需要后台人员审核'
  414. }
  415. this.signupLog = res.data.signup_log
  416. // 已报名
  417. if (this.signupLog) {
  418. // 被拒绝情况可以修改信息重新提交报名
  419. this.canSignup = this.signupLog.status == 2
  420. this.signupBtnText = '修改信息重新提交'
  421. this.signupBtnClass = 'bg-yellow'
  422. // 符合开始考试条件
  423. this.canStart = this.signupLog.can_start
  424. // 之前的报名信息
  425. this.formData.real_name = this.signupLog.real_name
  426. this.formData.phone = this.signupLog.phone
  427. switch (parseInt(this.signupLog.status)) {
  428. case 0:
  429. this.signupStatusClass = 'bg-yellow'
  430. break
  431. case 1:
  432. this.signupStatusClass = 'bg-green'
  433. break
  434. case 2:
  435. this.signupStatusClass = 'bg-red'
  436. break
  437. }
  438. // 考试记录
  439. this.examLogs = res.data.exam_logs
  440. }
  441. })
  442. },
  443. // 报名
  444. signup() {
  445. this.showApplyModal = ['show']
  446. },
  447. // 隐藏报名对话框
  448. hideModal(e) {
  449. this.showApplyModal = ['']
  450. this.showStartModal = ['']
  451. this.showExamLogModal = ['']
  452. },
  453. // 清除输入框值
  454. clearInput() {
  455. this.formData.real_name = ''
  456. this.formData.phone = ''
  457. this.formData.password = ''
  458. },
  459. // 密码输入
  460. // inputPassword(e) {
  461. // console.log('input e', e)
  462. // this.password = e.detail.value
  463. // },
  464. // 提交报名
  465. submitSignup() {
  466. if (this.detail.signup_mode == 'PASSWORD' && !this.formData.password) {
  467. this.utils.toast('请输入考场密码')
  468. return
  469. }
  470. console.log('formData', this.formData)
  471. // return
  472. this.formData['room_id'] = this.roomId
  473. this.http('room/signup', this.formData, 'post').then(res => {
  474. // 有错误
  475. if (res.code == 0) {
  476. uni.showToast({
  477. title: res.msg,
  478. icon: 'none'
  479. })
  480. return
  481. } else {
  482. // 清除输入框
  483. this.clearInput()
  484. // 隐藏弹框
  485. this.hideModal()
  486. // 刷新
  487. this.getDetail()
  488. }
  489. this.utils.toast(res.msg, 'success')
  490. })
  491. },
  492. // 开始考试弹窗
  493. startPaper() {
  494. this.showStartModal = ['show']
  495. },
  496. // 进入考场
  497. goExam() {
  498. console.log('go', '../paper?id=' + this.detail.paper_id + '&room_id=' + this.roomId)
  499. uni.reLaunch({
  500. url: '/pages/paper/paper?id=' + this.detail.paper_id + '&room_id=' + this.roomId
  501. })
  502. // this.utils.goto('/pages/paper/paper?id=' + this.detail.paper_id + '&room_id=' + this.roomId)
  503. },
  504. // 查看考试记录
  505. viewExamLogModal(examLog) {
  506. this.examLogItem = examLog
  507. this.showExamLogModal = ['show']
  508. },
  509. }
  510. }
  511. </script>
  512. <style lang="scss" scoped>
  513. .container {
  514. width: 750rpx;
  515. color: #333333;
  516. .bg-top {
  517. margin-top: -1rpx;
  518. width: 750rpx;
  519. height: 220rpx;
  520. padding-top: 50rpx;
  521. border-radius: 0 0 20% 20%;
  522. .top-box {
  523. width: 700rpx;
  524. background-color: #FFFFFF;
  525. margin: 0 auto;
  526. border-radius: 20rpx;
  527. padding: 20rpx 30rpx 0rpx;
  528. position: relative;
  529. .qh-pic {
  530. position: absolute;
  531. right: 64rpx;
  532. top: -50rpx;
  533. border-radius: 12rpx;
  534. }
  535. .qh-title {
  536. width: 100%;
  537. height: 60rpx;
  538. line-height: 65rpx;
  539. padding-right: 190rpx;
  540. }
  541. .bxBox {
  542. position: relative;
  543. display: flex;
  544. /* padding: 0 30rpx; */
  545. min-height: 100rpx;
  546. /* background-color: #ffffff; */
  547. /* justify-content: space-between; */
  548. align-items: center;
  549. font-size: 30rpx;
  550. line-height: 1.6em;
  551. flex: 1;
  552. .bxImg {
  553. display: inline-block;
  554. margin-right: 10rpx;
  555. width: 1.6em;
  556. text-align: center;
  557. }
  558. }
  559. }
  560. }
  561. .center-box {
  562. color: #333333;
  563. width: 700rpx;
  564. background-color: #FFFFFF;
  565. margin: 0 auto;
  566. border-radius: 20rpx;
  567. padding: 0rpx 30rpx 0rpx;
  568. position: relative;
  569. margin-top: 20rpx;
  570. }
  571. .bg-black {
  572. background-color: #5677fc;
  573. }
  574. }
  575. .cu-list.menu>.cu-item.arrow {
  576. padding-right: 70rpx;
  577. }
  578. .padding-0 {
  579. padding: 0px !important;
  580. }
  581. .padding-left-0 {
  582. padding-left: 0px !important;
  583. }
  584. </style>