trainingRegistration.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view>
  3. <u-navbar :back-text="info.title" back-icon-size="28" back-icon-color="#ffffff"
  4. :background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <!-- 内容 -->
  6. <view class="main">
  7. <view class="headline">
  8. {{info.title}}
  9. </view>
  10. <view class="title">
  11. 培训详情
  12. </view>
  13. <view class="picture" v-if="info.thumbnailImage">
  14. <img :src="info.thumbnailImage" alt="">
  15. </view>
  16. <!-- 详细信息 -->
  17. <view class="details" v-html="info.content">
  18. </view>
  19. </view>
  20. <!-- 资料 -->
  21. <!-- <view class="data">
  22. <view class="title">
  23. 培训资料
  24. </view>
  25. <u-line color="#e6e6e6" />
  26. <view class="class">
  27. <view class="text">
  28. 育婴师资格证(高级)培训课程表
  29. </view>
  30. <view class="download">
  31. <view class="icon">
  32. <img src="@/assets/img/md-file_download@1x.png" alt="">
  33. </view>
  34. <view class="download-text">
  35. 下载
  36. </view>
  37. </view>
  38. </view>
  39. </view> -->
  40. <!-- 报名按钮 -->
  41. <view class="bottom">
  42. <button class="sign-up" v-if="getStatus()" :class="{
  43. isJoin:isJoin
  44. }" @click="isJoinBtn" >{{isJoin?'取消报名':'我要报名'}}</button>
  45. <button class="sign-up isEnd" v-else style="background: #999999;">已结束</button>
  46. </view>
  47. </view>
  48. </template>
  49. <script>
  50. import * as API from '@/apis/pagejs/packages.js'
  51. export default {
  52. data() {
  53. return {
  54. id: "",
  55. isJoin: false,
  56. info: {
  57. },
  58. }
  59. },
  60. onLoad(op) {
  61. this.id = op.id
  62. this.getInfo()
  63. },
  64. methods: {
  65. getStatus(){
  66. if(this.info&&this.info.endTime){
  67. return new Date()<new Date(this.info.endTime)
  68. }
  69. return true
  70. },
  71. cancelTrainingBtn(){
  72. uni.showLoading({
  73. title: "加载中",
  74. mask: true,
  75. })
  76. API.cancelTraining({
  77. trainingId: this.id,
  78. }).then((res) => {
  79. this.isJoin = false;
  80. //this.info=res.data.recruitInformationInfo;
  81. uni.hideLoading();
  82. uni.showToast({
  83. title: "取消成功!",
  84. icon: "none"
  85. })
  86. }).catch(error => {
  87. uni.showToast({icon: 'none',
  88. title: error,
  89. icon: "none"
  90. })
  91. })
  92. },
  93. isJoinBtn() {
  94. if(this.getStatus()){
  95. return
  96. }
  97. if (this.isJoin) {
  98. this.cancelTrainingBtn()
  99. return
  100. }
  101. var user = this.carhelp.getPersonInfo();
  102. if (!user) {
  103. uni.showModal({
  104. title: '提示',
  105. content: '登录并实名认证创建简历后可以报名',
  106. confirmText: "前往登录",
  107. showCancel: true,
  108. success: function(res) {
  109. if (res.confirm) {
  110. uni.navigateTo({
  111. url: '/pages/tab/mine/mine'
  112. })
  113. } else if (res.cancel) {
  114. //.log('用户点击取消');
  115. }
  116. }
  117. });
  118. return
  119. }
  120. if (user.status != 1) {
  121. uni.showModal({
  122. title: '提示',
  123. content: '实名认证并创建简历后可以报名',
  124. confirmText: "实名认证",
  125. showCancel: true,
  126. success: function(res) {
  127. if (res.confirm) {
  128. uni.navigateTo({
  129. url: '/pages/packages/mine/otherServices/authentication'
  130. })
  131. } else if (res.cancel) {
  132. //.log('用户点击取消');
  133. }
  134. }
  135. });
  136. return
  137. }
  138. var jobInformationInfo = this.carhelp.getPersonInfoPlus().jobInformationInfo;
  139. if (!user) {
  140. uni.showModal({
  141. title: '提示',
  142. content: '创建简历后可以报名',
  143. confirmText: "创建简历",
  144. showCancel: true,
  145. success: function(res) {
  146. if (res.confirm) {
  147. uni.navigateTo({
  148. url: '/pages/packages/mine/myJobInformation/myJobInformation'
  149. })
  150. } else if (res.cancel) {
  151. //.log('用户点击取消');
  152. }
  153. }
  154. });
  155. return
  156. }
  157. uni.showLoading({
  158. title: "加载中",
  159. mask: true,
  160. })
  161. API.joinTraining({
  162. trainingId: this.id,
  163. }).then((res) => {
  164. this.isJoin = true;
  165. //this.info=res.data.recruitInformationInfo;
  166. uni.showModal({
  167. title: '提示',
  168. content: '报名成功',
  169. showCancel: false,
  170. success: function(res) {
  171. if (res.confirm) {
  172. //uni.navigateBack()
  173. } else if (res.cancel) {
  174. //.log('用户点击取消');
  175. }
  176. }
  177. });
  178. uni.hideLoading();
  179. }).catch(error => {
  180. uni.showToast({icon: 'none',
  181. title: error,
  182. icon: "none"
  183. })
  184. })
  185. },
  186. getInfo() {
  187. uni.showLoading({
  188. title: "加载中",
  189. mask: true,
  190. })
  191. API.trainingDetail({
  192. trainingId: this.id,
  193. }).then((res) => {
  194. uni.hideLoading();
  195. this.isJoin = res.data.isJoin;
  196. var newsDetail=res.data.trainingInfo;
  197. if(newsDetail.content){
  198. newsDetail.content=newsDetail.content.replaceAll('alt','width="100%" height="100%" /> <p')
  199. }
  200. this.info=newsDetail
  201. }).catch(error => {
  202. uni.showToast({icon: 'none',
  203. title: error,
  204. icon: "none"
  205. })
  206. })
  207. }
  208. }
  209. }
  210. </script>
  211. <style>
  212. page {
  213. background: #F0F0F2;
  214. padding-bottom: 120px;
  215. }
  216. </style>
  217. <style lang="scss" scoped>
  218. .background {
  219. width: 100%;
  220. height: 376rpx;
  221. img {
  222. width: 100%;
  223. height: 100%;
  224. }
  225. }
  226. // 内容
  227. .main {
  228. padding: 40rpx 32rpx;
  229. background-color: #fff;
  230. // 标题
  231. .headline {
  232. color: rgba(16, 16, 16, 1);
  233. font-size: 40rpx;
  234. font-family: 'PingFangSC-medium';
  235. }
  236. .title {
  237. color: rgba(51, 51, 51, 1);
  238. font-size: 32rpx;
  239. font-family: 'PingFangSC-medium';
  240. margin-top: 40rpx
  241. }
  242. // 图片
  243. .picture {
  244. border-radius: 4px;
  245. width: 100%;
  246. height: 256rpx;
  247. margin-top: 50rpx;
  248. img {
  249. width: 100%;
  250. height: 100%;
  251. }
  252. }
  253. // 详细信息
  254. .details {
  255. margin-top: 40rpx;
  256. line-height: 48rpx;
  257. color: rgba(51, 51, 51, 1);
  258. }
  259. }
  260. // 资料
  261. .data {
  262. background-color: #fff;
  263. margin-top: 24rpx;
  264. padding: 24rpx 32rpx;
  265. .title {
  266. color: rgba(16, 16, 16, 1);
  267. font-size: 16px;
  268. font-weight: bold;
  269. margin-bottom: 24rpx;
  270. }
  271. .class {
  272. margin-top: 40rpx;
  273. border-radius: 5px;
  274. background-color: rgba(245, 245, 245, 1);
  275. padding: 28rpx 24rpx;
  276. color: #101010;
  277. display: flex;
  278. justify-content: space-between;
  279. align-items: center;
  280. .download {
  281. display: flex;
  282. align-items: center;
  283. color: rgba(22, 119, 255, 1);
  284. img {
  285. vertical-align: middle;
  286. width: 40rpx;
  287. height: 40rpx;
  288. }
  289. }
  290. }
  291. }
  292. // 报名按钮
  293. .bottom {
  294. background-color: #fff;
  295. padding: 24rpx 32rpx;
  296. position: fixed;
  297. bottom: 0;
  298. left: 0;
  299. right: 0;
  300. .sign-up {
  301. height: 96rpx;
  302. line-height: 96rpx;
  303. border-radius: 8px;
  304. background-color: rgba(39, 149, 253, 1);
  305. color: rgba(255, 255, 255, 1);
  306. font-size: 36rpx;
  307. text-align: center;
  308. }
  309. .isJoin {
  310. background-color: #19be6d;
  311. }
  312. }
  313. </style>