trainingRegistration.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <view>
  3. <u-navbar :back-text="info.title" :share="share" 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. share:0,
  59. }
  60. },
  61. onShareTimeline(){
  62. return {
  63. title: "荆州经开区共享用工平台",
  64. }
  65. },
  66. onShareAppMessage(res) {
  67. if (res.from === 'button') { // 来自页面内分享按钮
  68. //.log(res.target)
  69. }
  70. return {
  71. title: this.info.title,
  72. path: '/pages/packages/skillTraining/trainingRegistration?shareMP=1&id=' + this.id
  73. }
  74. },
  75. onLoad(op) {
  76. if (op.shareMP) {
  77. this.share = op.shareMP
  78. }
  79. this.id = op.id
  80. this.getInfo()
  81. },
  82. methods: {
  83. getStatus(){
  84. if(this.info&&this.info.endTime){
  85. return new Date()<new Date(this.info.endTime)
  86. }
  87. return true
  88. },
  89. cancelTrainingBtn(){
  90. uni.showLoading({
  91. title: "加载中",
  92. mask: true,
  93. })
  94. API.cancelTraining({
  95. trainingId: this.id,
  96. }).then((res) => {
  97. this.isJoin = false;
  98. //this.info=res.data.recruitInformationInfo;
  99. uni.hideLoading();
  100. uni.showToast({
  101. title: "取消成功!",
  102. icon: "none"
  103. })
  104. }).catch(error => {
  105. uni.showToast({icon: 'none',
  106. title: error,
  107. icon: "none"
  108. })
  109. })
  110. },
  111. isJoinBtn() {
  112. if(!this.getStatus()){
  113. return
  114. }
  115. if (this.isJoin) {
  116. this.cancelTrainingBtn()
  117. return
  118. }
  119. var user = this.carhelp.getPersonInfo();
  120. if (!user) {
  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/tab/mine/mine'
  130. })
  131. } else if (res.cancel) {
  132. //.log('用户点击取消');
  133. }
  134. }
  135. });
  136. return
  137. }
  138. if (user.status != 1) {
  139. uni.showModal({
  140. title: '提示',
  141. content: '实名认证并创建简历后可以报名',
  142. confirmText: "实名认证",
  143. showCancel: true,
  144. success: function(res) {
  145. if (res.confirm) {
  146. uni.navigateTo({
  147. url: '/pages/packages/mine/otherServices/authentication'
  148. })
  149. } else if (res.cancel) {
  150. //.log('用户点击取消');
  151. }
  152. }
  153. });
  154. return
  155. }
  156. var jobInformationInfo = this.carhelp.getPersonInfoPlus().jobInformationInfo;
  157. if (!user) {
  158. uni.showModal({
  159. title: '提示',
  160. content: '创建简历后可以报名',
  161. confirmText: "创建简历",
  162. showCancel: true,
  163. success: function(res) {
  164. if (res.confirm) {
  165. uni.navigateTo({
  166. url: '/pages/packages/mine/myJobInformation/myJobInformation'
  167. })
  168. } else if (res.cancel) {
  169. //.log('用户点击取消');
  170. }
  171. }
  172. });
  173. return
  174. }
  175. uni.showLoading({
  176. title: "加载中",
  177. mask: true,
  178. })
  179. API.joinTraining({
  180. trainingId: this.id,
  181. }).then((res) => {
  182. this.isJoin = true;
  183. //this.info=res.data.recruitInformationInfo;
  184. uni.showModal({
  185. title: '提示',
  186. content: '报名成功',
  187. showCancel: false,
  188. success: function(res) {
  189. if (res.confirm) {
  190. //uni.navigateBack()
  191. } else if (res.cancel) {
  192. //.log('用户点击取消');
  193. }
  194. }
  195. });
  196. uni.hideLoading();
  197. }).catch(error => {
  198. uni.showToast({icon: 'none',
  199. title: error,
  200. icon: "none"
  201. })
  202. })
  203. },
  204. getInfo() {
  205. uni.showLoading({
  206. title: "加载中",
  207. mask: true,
  208. })
  209. API.trainingDetail({
  210. trainingId: this.id,
  211. }).then((res) => {
  212. uni.hideLoading();
  213. this.isJoin = res.data.isJoin;
  214. var newsDetail=res.data.trainingInfo;
  215. if(newsDetail.content){
  216. var reg=new RegExp('alt','gi');
  217. newsDetail.content=newsDetail.content.replace(reg,'width="100%" height="100%" /> <p')
  218. }
  219. this.info=newsDetail
  220. }).catch(error => {
  221. uni.showToast({icon: 'none',
  222. title: error,
  223. icon: "none"
  224. })
  225. })
  226. }
  227. }
  228. }
  229. </script>
  230. <style>
  231. page {
  232. background: #F0F0F2;
  233. padding-bottom: 120px;
  234. }
  235. </style>
  236. <style lang="scss" scoped>
  237. .background {
  238. width: 100%;
  239. height: 376rpx;
  240. img {
  241. width: 100%;
  242. height: 100%;
  243. }
  244. }
  245. // 内容
  246. .main {
  247. padding: 40rpx 32rpx;
  248. background-color: #fff;
  249. // 标题
  250. .headline {
  251. color: rgba(16, 16, 16, 1);
  252. font-size: 40rpx;
  253. font-family: 'PingFangSC-medium';
  254. }
  255. .title {
  256. color: rgba(51, 51, 51, 1);
  257. font-size: 32rpx;
  258. font-family: 'PingFangSC-medium';
  259. margin-top: 40rpx
  260. }
  261. // 图片
  262. .picture {
  263. border-radius: 4px;
  264. width: 100%;
  265. height: 256rpx;
  266. margin-top: 50rpx;
  267. img {
  268. width: 100%;
  269. height: 100%;
  270. }
  271. }
  272. // 详细信息
  273. .details {
  274. margin-top: 40rpx;
  275. line-height: 48rpx;
  276. color: rgba(51, 51, 51, 1);
  277. }
  278. }
  279. // 资料
  280. .data {
  281. background-color: #fff;
  282. margin-top: 24rpx;
  283. padding: 24rpx 32rpx;
  284. .title {
  285. color: rgba(16, 16, 16, 1);
  286. font-size: 16px;
  287. font-weight: bold;
  288. margin-bottom: 24rpx;
  289. }
  290. .class {
  291. margin-top: 40rpx;
  292. border-radius: 5px;
  293. background-color: rgba(245, 245, 245, 1);
  294. padding: 28rpx 24rpx;
  295. color: #101010;
  296. display: flex;
  297. justify-content: space-between;
  298. align-items: center;
  299. .download {
  300. display: flex;
  301. align-items: center;
  302. color: rgba(22, 119, 255, 1);
  303. img {
  304. vertical-align: middle;
  305. width: 40rpx;
  306. height: 40rpx;
  307. }
  308. }
  309. }
  310. }
  311. // 报名按钮
  312. .bottom {
  313. background-color: #fff;
  314. padding: 24rpx 32rpx;
  315. position: fixed;
  316. bottom: 0;
  317. left: 0;
  318. right: 0;
  319. .sign-up {
  320. height: 96rpx;
  321. line-height: 96rpx;
  322. border-radius: 8px;
  323. background-color: rgba(39, 149, 253, 1);
  324. color: rgba(255, 255, 255, 1);
  325. font-size: 36rpx;
  326. text-align: center;
  327. }
  328. .isJoin {
  329. background-color: #19be6d;
  330. }
  331. }
  332. </style>