trainingRegistration.vue 9.0 KB

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