SignUp.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="SignUp">
  3. <!-- <m-header /> -->
  4. <div v-show="show" class="container" :style="backgroundImg">
  5. <h2>{{ baseInfo.posterTitle }}</h2>
  6. <div class="section" v-if="baseInfo.transStatus === 'APPLIED' || baseInfo.transStatus === 'EXAM_ING' || baseInfo.transStatus === 'EXAM_END' || baseInfo.transStatus === 'RESULT_CONFIRM' || baseInfo.transStatus === 'CLOSE'" key="status">
  7. <div class="sectionStatus">
  8. <img src="../../assets/images/level/sign_over.png" alt="">
  9. <h3>您来迟啦,报名已结束~</h3>
  10. </div>
  11. </div>
  12. <div class="section" v-else-if="baseInfo.transStatus === 'NOT_START'" key="status">
  13. <div class="sectionStatus">
  14. <img src="../../assets/images/level/sign_not_start.png" alt="">
  15. <h3>您来早啦,报名还未开始~</h3>
  16. <p>报名时间:{{ baseInfo.enrollTime2 }}</p>
  17. </div>
  18. </div>
  19. <div class="section" v-else key="status">
  20. <div class="title" style="margin-top: 0">考试类型</div>
  21. <div class="content">{{ baseInfo.examMode === "OFFLINE" ? "线下" : "线上" }}</div>
  22. <div class="title">考试地址</div>
  23. <div class="content" v-if="baseInfo.examMode === 'OFFLINE'">
  24. <template v-if="baseInfo.examLocations">
  25. <p v-for="(item, index) in baseInfo.examLocations" :key="index">
  26. {{ item.address }}
  27. </p>
  28. </template>
  29. </div>
  30. <div class="content" v-else>线上网络教室</div>
  31. <div class="title">考试简介</div>
  32. <div class="content" v-html="baseInfo.posterProfile"></div>
  33. <div class="title">报名时间</div>
  34. <div class="content">{{ baseInfo.enrollTime }}</div>
  35. <div class="title">预计考试日期</div>
  36. <div class="content">{{ baseInfo.expectExamTime }}</div>
  37. </div>
  38. <van-button type="primary" :color="buttonColor" v-if="baseInfo.status" @click="onSubmit" round block>我要报名</van-button>
  39. <!-- <a class="protocol" @click="onProtocol" v-if="baseInfo.status">协议</a> -->
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. // import MHeader from '@/components/MHeader'
  45. // import MButton from '@/components/MButton'
  46. import dayjs from 'dayjs'
  47. // import _ from 'lodash'
  48. import setLoading from '@/utils/loading'
  49. import { examinationBasicInfo } from './SignUpApi'
  50. // ETTING("SETTING", "设置中"),
  51. // NOT_START("NOT_START", "未开始"),
  52. // APPLYING("APPLYING","报名中"),
  53. // APPLIED("APPLIED", "报名结束"),
  54. // EXAM_ING("EXAM_ING", "考试中"),
  55. // EXAM_END("EXAM_END", "考试结束"),
  56. // RESULT_CONFIRM("RESULT_CONFIRM", "确认考试结果"),
  57. // CLOSE("CLOSE", "关闭")
  58. export default {
  59. name: 'SignUp',
  60. data () {
  61. localStorage.removeItem('examId')
  62. localStorage.removeItem('organId')
  63. let query = this.$route.query
  64. return {
  65. examId: query.examId,
  66. organId: query.organId,
  67. show: false,
  68. baseInfo: {}, // 基本信息
  69. backgroundImg: null,
  70. buttonColor: null,
  71. }
  72. },
  73. mounted() {
  74. localStorage.removeItem("Authorization")
  75. this.__init()
  76. },
  77. methods: {
  78. async __init() {
  79. setLoading(true)
  80. try {
  81. localStorage.setItem('examId', this.examId)
  82. localStorage.setItem('organId', this.organId)
  83. let res = await examinationBasicInfo({ examId: this.examId })
  84. if(res.data.code == 200) {
  85. let tempData = res.data.data
  86. let tempStatus = false
  87. if(tempData.status == "APPLYING") {
  88. tempStatus = true
  89. }
  90. localStorage.setItem("examStartTime", dayjs(tempData.expectExamStartTime).format("YYYY-MM-DD"))
  91. this.baseInfo = {
  92. posterTitle: tempData.posterTitle,
  93. examMode: tempData.examMode,
  94. enrollTime: dayjs(tempData.enrollStartTime).format("YYYY-MM-DD") + "~" + dayjs(tempData.enrollEndTime).format("YYYY-MM-DD"),
  95. enrollTime2: dayjs(tempData.enrollStartTime).format("YYYY-MM-DD"),
  96. examLocationIdList: tempData.examLocationIdList,
  97. expectExamTime: dayjs(tempData.expectExamStartTime).format("YYYY-MM-DD") + "~" + dayjs(tempData.expectExamEndTime).format("YYYY-MM-DD"),
  98. status: tempStatus,
  99. examLocations: tempData.examLocations, // 地址
  100. posterProfile: tempData.posterProfile ? tempData.posterProfile.replace(/\n/ig,'<br/>') : null,
  101. transStatus: tempData.status
  102. }
  103. let poster = tempData.posterBackgroundImg ? JSON.parse(tempData.posterBackgroundImg) : ""
  104. if(poster) {
  105. // 设置背景图
  106. this.backgroundImg = {
  107. backgroundImage: `url(${poster.url}) !important`
  108. }
  109. this.buttonColor = poster.color
  110. }
  111. }
  112. } catch(err) {
  113. //
  114. }
  115. this.show = true
  116. setLoading(false)
  117. },
  118. onSubmit() {
  119. // console.log(show)
  120. this.$router.push({
  121. path: '/signUpAccount',
  122. query: {
  123. examId: this.examId,
  124. organId: this.organId
  125. }
  126. })
  127. },
  128. onProtocol() {
  129. this.$router.push('/smallProtocol')
  130. }
  131. }
  132. }
  133. </script>
  134. <style lang="less" scoped>
  135. @import url("../../assets/commonLess/variable");
  136. .SignUp {
  137. max-width: 700px;
  138. position: relative;
  139. overflow-y: auto;
  140. overflow-x: hidden;
  141. background-color: #fff;
  142. margin: 0 auto;
  143. }
  144. .container {
  145. min-height: 100vh;
  146. background: url('../../assets/images/level/signUpBg.png') no-repeat center top #F3F4F8;
  147. background-size: contain;
  148. overflow: hidden;
  149. h2 {
  150. position: absolute;
  151. padding-top: .4rem;
  152. color: #ffffff;
  153. font-size: .26rem;
  154. font-weight: bold;
  155. width: 2.1rem;
  156. text-align: left;
  157. margin-left: .16rem;
  158. }
  159. .section {
  160. background: #ffffff;
  161. margin: 1.87rem .16rem .15rem;
  162. border-radius: .1rem;
  163. padding: .22rem;
  164. .title {
  165. margin-top: .28rem;
  166. font-size: .18rem;
  167. color: #1A1A1A;
  168. font-weight: 500;
  169. }
  170. .content {
  171. padding-top: .05rem;
  172. color: #808080;
  173. font-size: .16rem;
  174. word-break: break-all;
  175. }
  176. }
  177. .sectionStatus {
  178. text-align: center;
  179. padding: 1rem 0 .5rem;
  180. img {
  181. width: 1.2rem;
  182. }
  183. h3 {
  184. padding-top: .3rem;
  185. font-size: .18rem;
  186. color: #1A1A1A;
  187. }
  188. p {
  189. padding-top: .05rem;
  190. font-size: .14rem;
  191. color: #999999;
  192. }
  193. }
  194. .protocol {
  195. font-size: .14rem;
  196. margin-bottom: .3rem;
  197. text-align: center;
  198. display: block;
  199. color: #0091FF;
  200. }
  201. .van-button--primary {
  202. margin: .36rem 0 .18rem;
  203. background-color: @--main-color;
  204. border: 1px solid @--main-color;
  205. color: #FFFFFF;
  206. font-size: .18rem;
  207. height: .5rem;
  208. line-height: .52rem;
  209. width: 90%;
  210. margin-left: 5%;
  211. }
  212. }
  213. </style>