trainingRegistration.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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 v-if="info.codeImage" class="codeImage">
  20. <image mode="aspectFit"
  21. v-if="info.codeImage" :src="info.codeImage" :show-menu-by-longpress="true" ></image>
  22. <view class="codeImageView" ><u-icon name="arrow-upward"></u-icon><u-icon name="arrow-upward"></u-icon><u-icon name="arrow-upward"></u-icon> 长按图片<u-icon name="arrow-upward"></u-icon><u-icon name="arrow-upward"></u-icon><u-icon name="arrow-upward"></u-icon></view>
  23. </view>
  24. </view>
  25. <!-- 资料 -->
  26. <!-- <view class="data">
  27. <view class="title">
  28. 培训资料
  29. </view>
  30. <u-line color="#e6e6e6" />
  31. <view class="class">
  32. <view class="text">
  33. 育婴师资格证(高级)培训课程表
  34. </view>
  35. <view class="download">
  36. <view class="icon">
  37. <img src="@/assets/img/md-file_download@1x.png" alt="">
  38. </view>
  39. <view class="download-text">
  40. 下载
  41. </view>
  42. </view>
  43. </view>
  44. </view> -->
  45. <!-- 报名按钮 -->
  46. <view class="bottom">
  47. <button class="sign-up" v-if="getStatus()" :class="{
  48. isJoin:isJoin
  49. }" @click="isJoinBtn" >{{isJoin?'取消报名':'我要报名'}}</button>
  50. <button class="sign-up isEnd" v-else style="background: #999999;">已结束</button>
  51. <button class="btncontact" @click="showPhone=true" >
  52. <view class="icon">
  53. <img src="@/assets/img/riLine-customer-service-line@1x.png" alt="">
  54. </view>
  55. <view class="grid-text">咨询</view>
  56. </button>
  57. <u-modal v-model="showPhone" @confirm="confirmPhone" confirm-text="拨打电话" confirm-color="#606266"
  58. :show-cancel-button="true" ref="uModal" :asyncClose="true" title="咨询电话" :content="content"
  59. :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import * as API from '@/apis/pagejs/packages.js'
  65. export default {
  66. data() {
  67. return {
  68. id: "",
  69. isJoin: false,
  70. content: "",
  71. showPhone: false,
  72. info: {
  73. },
  74. share:0,
  75. }
  76. },
  77. onShareTimeline(){
  78. return {
  79. title: "荆州经开区共享用工平台",
  80. }
  81. },
  82. onShareAppMessage(res) {
  83. if (res.from === 'button') { // 来自页面内分享按钮
  84. //.log(res.target)
  85. }
  86. return {
  87. title: this.info.title,
  88. path: '/pages/packages/skillTraining/trainingRegistration?shareMP=1&id=' + this.id
  89. }
  90. },
  91. onLoad(op) {
  92. if (op.shareMP) {
  93. this.share = op.shareMP
  94. }
  95. this.id = op.id
  96. this.getInfo()
  97. },
  98. methods: {
  99. confirmPhone() {
  100. this.showPhone = false;
  101. uni.makePhoneCall({
  102. phoneNumber: this.content //仅为示例
  103. });
  104. },
  105. getStatus(){
  106. if(this.info&&this.info.endTime){
  107. return new Date()<new Date(this.info.endTime)
  108. }
  109. return true
  110. },
  111. cancelTrainingBtn(){
  112. uni.showLoading({
  113. title: "加载中",
  114. mask: true,
  115. })
  116. API.cancelTraining({
  117. trainingId: this.id,
  118. }).then((res) => {
  119. this.isJoin = false;
  120. //this.info=res.data.recruitInformationInfo;
  121. uni.hideLoading();
  122. uni.showToast({
  123. title: "取消成功!",
  124. icon: "none"
  125. })
  126. }).catch(error => {
  127. uni.showToast({icon: 'none',
  128. title: error,
  129. icon: "none"
  130. })
  131. })
  132. },
  133. isJoinBtn() {
  134. if(!this.getStatus()){
  135. return
  136. }
  137. if (this.isJoin) {
  138. this.cancelTrainingBtn()
  139. return
  140. }
  141. var user = this.carhelp.getPersonInfo();
  142. if (!user) {
  143. uni.showModal({
  144. title: '提示',
  145. content: '登录并实名认证创建简历后可以报名',
  146. confirmText: "前往登录",
  147. showCancel: true,
  148. success: function(res) {
  149. if (res.confirm) {
  150. uni.navigateTo({
  151. url: '/pages/tab/mine/mine'
  152. })
  153. } else if (res.cancel) {
  154. //.log('用户点击取消');
  155. }
  156. }
  157. });
  158. return
  159. }
  160. if (user.status != 1) {
  161. uni.showModal({
  162. title: '提示',
  163. content: '实名认证并创建简历后可以报名',
  164. confirmText: "实名认证",
  165. showCancel: true,
  166. success: function(res) {
  167. if (res.confirm) {
  168. uni.navigateTo({
  169. url: '/pages/packages/mine/otherServices/authentication'
  170. })
  171. } else if (res.cancel) {
  172. //.log('用户点击取消');
  173. }
  174. }
  175. });
  176. return
  177. }
  178. var jobInformationInfo = this.carhelp.getPersonInfoPlus().jobInformationInfo;
  179. if (!user) {
  180. uni.showModal({
  181. title: '提示',
  182. content: '创建简历后可以报名',
  183. confirmText: "创建简历",
  184. showCancel: true,
  185. success: function(res) {
  186. if (res.confirm) {
  187. uni.navigateTo({
  188. url: '/pages/packages/mine/myJobInformation/myJobInformation'
  189. })
  190. } else if (res.cancel) {
  191. //.log('用户点击取消');
  192. }
  193. }
  194. });
  195. return
  196. }
  197. uni.showLoading({
  198. title: "加载中",
  199. mask: true,
  200. })
  201. API.joinTraining({
  202. trainingId: this.id,
  203. }).then((res) => {
  204. this.isJoin = true;
  205. //this.info=res.data.recruitInformationInfo;
  206. uni.showModal({
  207. title: '提示',
  208. content: '报名成功',
  209. showCancel: false,
  210. success: function(res) {
  211. if (res.confirm) {
  212. //uni.navigateBack()
  213. } else if (res.cancel) {
  214. //.log('用户点击取消');
  215. }
  216. }
  217. });
  218. uni.hideLoading();
  219. }).catch(error => {
  220. uni.showToast({icon: 'none',
  221. title: error,
  222. icon: "none"
  223. })
  224. })
  225. },
  226. getInfo() {
  227. uni.showLoading({
  228. title: "加载中",
  229. mask: true,
  230. })
  231. API.trainingDetail({
  232. trainingId: this.id,
  233. }).then((res) => {
  234. uni.hideLoading();
  235. this.isJoin = res.data.isJoin;
  236. var newsDetail=res.data.trainingInfo;
  237. if(newsDetail.content){
  238. var reg=new RegExp('alt','gi');
  239. newsDetail.content=newsDetail.content.replace(reg,'width="100%" height="100%" /> <p')
  240. }
  241. this.info=newsDetail
  242. this.content=this.info.phone
  243. }).catch(error => {
  244. uni.showToast({icon: 'none',
  245. title: error,
  246. icon: "none"
  247. })
  248. })
  249. }
  250. }
  251. }
  252. </script>
  253. <style>
  254. page {
  255. background: #F0F0F2;
  256. padding-bottom: 120px;
  257. }
  258. </style>
  259. <style lang="scss" scoped>
  260. .codeImage{
  261. background-color: #fff;
  262. text-align: center;
  263. .codeImageView{
  264. padding: 20rpx 0px 40rpx;
  265. font-size: 32rpx;
  266. }
  267. image{
  268. border: 1px dashed;
  269. width: 700rpx;
  270. }
  271. }
  272. .background {
  273. width: 100%;
  274. height: 376rpx;
  275. img {
  276. width: 100%;
  277. height: 100%;
  278. }
  279. }
  280. // 内容
  281. .main {
  282. padding: 40rpx 32rpx;
  283. background-color: #fff;
  284. // 标题
  285. .headline {
  286. color: rgba(16, 16, 16, 1);
  287. font-size: 40rpx;
  288. font-family: 'PingFangSC-medium';
  289. }
  290. .title {
  291. color: rgba(51, 51, 51, 1);
  292. font-size: 32rpx;
  293. font-family: 'PingFangSC-medium';
  294. margin-top: 40rpx
  295. }
  296. // 图片
  297. .picture {
  298. border-radius: 4px;
  299. width: 100%;
  300. height: 256rpx;
  301. margin-top: 50rpx;
  302. img {
  303. width: 100%;
  304. height: 100%;
  305. }
  306. }
  307. // 详细信息
  308. .details {
  309. margin-top: 40rpx;
  310. line-height: 48rpx;
  311. color: rgba(51, 51, 51, 1);
  312. }
  313. }
  314. // 资料
  315. .data {
  316. background-color: #fff;
  317. margin-top: 24rpx;
  318. padding: 24rpx 32rpx;
  319. .title {
  320. color: rgba(16, 16, 16, 1);
  321. font-size: 16px;
  322. font-weight: bold;
  323. margin-bottom: 24rpx;
  324. }
  325. .class {
  326. margin-top: 40rpx;
  327. border-radius: 5px;
  328. background-color: rgba(245, 245, 245, 1);
  329. padding: 28rpx 24rpx;
  330. color: #101010;
  331. display: flex;
  332. justify-content: space-between;
  333. align-items: center;
  334. .download {
  335. display: flex;
  336. align-items: center;
  337. color: rgba(22, 119, 255, 1);
  338. img {
  339. vertical-align: middle;
  340. width: 40rpx;
  341. height: 40rpx;
  342. }
  343. }
  344. }
  345. }
  346. // 报名按钮
  347. .bottom {
  348. background-color: #fff;
  349. padding: 24rpx 32rpx;
  350. position: fixed;
  351. bottom: 0;
  352. left: 0;
  353. right: 0;
  354. display: flex;
  355. .btncontact{
  356. width: 19%;
  357. font-size: 36rpx;
  358. height: 96rpx;
  359. //line-height: 96rpx;
  360. padding: 0px;
  361. border-radius: 8px;
  362. display: flex;
  363. flex-wrap: wrap;
  364. justify-content: center;
  365. .grid-text {
  366. color: rgba(51, 51, 51, 1);
  367. margin-top: 8rpx;
  368. line-height: 10px;
  369. width: 100%;
  370. }
  371. .icon {
  372. width: 56rpx;
  373. height: 56rpx;
  374. img {
  375. width: 100%;
  376. height: 100%;
  377. }
  378. }
  379. }
  380. .sign-up {
  381. width: 79%;
  382. height: 96rpx;
  383. line-height: 96rpx;
  384. border-radius: 8px;
  385. background-color: rgba(39, 149, 253, 1);
  386. color: rgba(255, 255, 255, 1);
  387. font-size: 36rpx;
  388. text-align: center;
  389. }
  390. .isJoin {
  391. background-color: #19be6d;
  392. }
  393. }
  394. </style>