sign.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view class="content">
  3. <view class="team">
  4. <image class="top-image" :src="baseURL + list.image"></image>
  5. <!-- <view class="box">
  6. <jyf-parser :html="description" ref="article"></jyf-parser>
  7. </view> -->
  8. <view class="top-title canten">免费报名</view>
  9. <view class="sign-tip">完成信息填写,即可参加红十字会救护员培训</view>
  10. <view class="form-box">
  11. <view class="label">
  12. 姓名/企业姓名
  13. <text>*</text>
  14. </view>
  15. <input type="text" v-model="name" placeholder="请填写姓名" />
  16. <view class="label">
  17. 联系方式
  18. <text>*</text>
  19. </view>
  20. <input type="number" v-model="phone" placeholder="请输入联系方式" />
  21. <view class="label">
  22. 参加培训人数
  23. <text>*</text>
  24. </view>
  25. <input type="number" v-model="num" placeholder="请输入参加培训人数" />
  26. </view>
  27. <view class="top-title">免费报名</view>
  28. <view class="text-box" v-html="description">
  29. <view class="text">请参训学员在培训当天携带身份证复印件1张,一寸证件照2张。</view>
  30. <view class="text">报名咨询电话:0716-4163849</view>
  31. </view>
  32. <view class="submit" @click="submit">立即报名</view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import { get_training, sign_training, detail_training } from '@/api/train.js';
  38. import jyfParser from '@/components/jyf-parser/jyf-parser';
  39. import { weixindata, weixinlocation } from '@/utils/wxAuthorized.js';
  40. import { userinfo } from '@/api/user.js';
  41. import { mapState, mapMutations } from 'vuex';
  42. export default {
  43. components: {
  44. jyfParser
  45. },
  46. data() {
  47. return {
  48. id: '',
  49. description: '',
  50. list: '',
  51. //个人
  52. name: '',
  53. phone: '',
  54. //团队
  55. num: '',
  56. size: 180
  57. };
  58. },
  59. onLoad(option) {
  60. this.type = option.type;
  61. this.id = option.id;
  62. if (option.uid) {
  63. this.uid = option.uid;
  64. } else {
  65. this.uid = this.userInfo.uid;
  66. }
  67. this.loadData();
  68. },
  69. onBackPress(e){
  70. uni.switchTab({
  71. url: '/pages/index/index'
  72. });
  73. return true;
  74. },
  75. onReady() {},
  76. computed: {
  77. ...mapState('user', ['hasLogin', 'userInfo']),
  78. ...mapState(['baseURL'])
  79. },
  80. methods: {
  81. ...mapMutations('user', ['setUserInfo']),
  82. // 分享
  83. async loadData() {
  84. let obj = this;
  85. get_training({
  86. id: obj.id
  87. // uid:uid
  88. }).then(({ data }) => {
  89. obj.list = data;
  90. console.log(9988, obj.list);
  91. if (obj.list.content != null) {
  92. obj.description = obj.list.content.replace(/<img/g, "<img style='max-width:100%;height:auto;'");
  93. }
  94. });
  95. },
  96. submit() {
  97. let obj = this;
  98. let data = {};
  99. if (!obj.name) {
  100. obj.$api.msg('请填写姓名/企业名!');
  101. return;
  102. }
  103. if (!obj.phone) {
  104. obj.$api.msg('请输入联系方式!');
  105. return;
  106. }
  107. if (!obj.num) {
  108. obj.$api.msg('请输入培训人数!');
  109. return;
  110. }
  111. data = {
  112. training_id:obj.id,
  113. name: obj.name,
  114. Phone: obj.phone,
  115. num:obj.num
  116. };
  117. sign_training(data)
  118. .then(function(e) {
  119. console.log(data.type);
  120. let type = data.type;
  121. uni.setStorageSync('type', type);
  122. obj.$api.msg('提交成功,请等待审核',2000);
  123. setTimeout(function() {
  124. uni.navigateTo({
  125. url: '/pages/train/index'
  126. });
  127. }, 2000);
  128. })
  129. .catch(e => {
  130. obj.$api.msg(e.message);
  131. setTimeout(function() {
  132. uni.navigateTo({
  133. url: '/pages/train/index'
  134. });
  135. }, 2000);
  136. });
  137. },
  138. getRecTime(timestamp, fmt) {
  139. let d = new Date(timestamp * 1000),
  140. // f = fmt || 'yyyy/MM/dd',
  141. f = fmt || 'yyyy.MM.dd hh:mm:ss',
  142. o = {
  143. 'M+': d.getMonth() + 1, //月份
  144. 'd+': d.getDate(), //日
  145. 'h+': d.getHours(), //小时
  146. 'm+': d.getMinutes(), //分
  147. 's+': d.getSeconds(), //秒
  148. 'q+': Math.floor((d.getMonth() + 3) / 3), //季度
  149. S: d.getMilliseconds() //毫秒
  150. };
  151. if (/(y+)/.test(f)) {
  152. f = f.replace(RegExp.$1, (d.getFullYear() + '').substr(4 - RegExp.$1.length));
  153. }
  154. for (let k in o) {
  155. if (new RegExp('(' + k + ')').test(f)) {
  156. f = f.replace(RegExp.$1, RegExp.$1.length === 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length));
  157. }
  158. }
  159. return f;
  160. console.log(f);
  161. }
  162. }
  163. };
  164. </script>
  165. <style lang="scss">
  166. page {
  167. background: #ffffff;
  168. width: 100%;
  169. height: 100%;
  170. .content {
  171. height: 100%;
  172. }
  173. }
  174. .box {
  175. padding: 0rpx 25rpx;
  176. width: 100%;
  177. }
  178. .top-image {
  179. width: 100%;
  180. height: 300rpx;
  181. }
  182. .top-title {
  183. width: 100%;
  184. text-align: center;
  185. padding: 25rpx 0rpx;
  186. font-size: 34rpx;
  187. border-bottom: 1rpx dashed #b5b5b5;
  188. }
  189. .canten {
  190. text-align: center !important;
  191. }
  192. .addr {
  193. color: #222222;
  194. font-size: 28rpx;
  195. padding: 25rpx 35rpx;
  196. }
  197. .text-box {
  198. padding: 25rpx 25rpx;
  199. padding-bottom: 0rpx !important;
  200. }
  201. .text {
  202. color: #222222;
  203. font-size: 28rpx;
  204. padding-bottom: 15rpx;
  205. }
  206. .weixin-icon {
  207. width: 100%;
  208. text-align: center;
  209. padding-top: 45rpx;
  210. image {
  211. width: 248rpx;
  212. height: 248rpx;
  213. }
  214. }
  215. .tip {
  216. color: #222222;
  217. font-size: 28rpx;
  218. width: 100%;
  219. text-align: center;
  220. padding-bottom: 50rpx;
  221. }
  222. .sign-tip {
  223. padding: 25rpx 0rpx;
  224. text-align: center;
  225. color: #222222;
  226. font-size: 28rpx;
  227. }
  228. .form-box {
  229. padding: 0rpx 35rpx;
  230. .label {
  231. font-size: 34rpx;
  232. padding: 25rpx 0rpx;
  233. text {
  234. color: #e62129;
  235. padding-left: 5rpx;
  236. }
  237. }
  238. input {
  239. font-size: 28rpx;
  240. color: #222222;
  241. border: 2rpx solid #979797;
  242. padding: 0rpx 15rpx;
  243. border-radius: 15rpx;
  244. height: 80rpx;
  245. }
  246. }
  247. .submit {
  248. width: 70%;
  249. margin: 0rpx auto;
  250. margin-top: 80rpx;
  251. margin-bottom: 80rpx;
  252. padding: 25rpx 0;
  253. text-align: center;
  254. background-color: #e62129;
  255. color: #ffffff;
  256. font-size: 32rpx;
  257. border-radius: 10rpx;
  258. }
  259. .grey {
  260. background-color: #9b9b9b !important;
  261. }
  262. .certificates {
  263. // padding: 24rpx;
  264. width: 100%;
  265. height: 100vh;
  266. }
  267. .tki-qrcode-canvas {
  268. // width: 700rpx;
  269. // height: 1245rpx;
  270. width: 750rpx;
  271. // padding: 32rpx;
  272. height: 1350rpx;
  273. margin: 0 auto;
  274. }
  275. .bgimg {
  276. width: 100%;
  277. height: 100%;
  278. image {
  279. width: 100%;
  280. height: 100%;
  281. }
  282. }
  283. .box-mian {
  284. width: 100%;
  285. height: 100%;
  286. position: absolute;
  287. padding: 380rpx 94rpx 200rpx 94rpx;
  288. color: #333;
  289. left: 0;
  290. top: 0;
  291. display: flex;
  292. flex-direction: column;
  293. justify-content: center;
  294. // align-items: center;
  295. .name {
  296. display: flex;
  297. font-size: 32rpx;
  298. .name-left {
  299. text-align: center;
  300. // padding: 0 24rpx;
  301. width: 150rpx;
  302. border-bottom: 2rpx solid #333;
  303. }
  304. }
  305. .info {
  306. margin-top: 68rpx;
  307. text-indent: 64rpx;
  308. line-height: 58rpx;
  309. }
  310. .signName {
  311. margin-top: 32rpx;
  312. display: flex;
  313. .signName-left {
  314. line-height: 34rpx;
  315. .signName-1 {
  316. }
  317. .signName-2 {
  318. font-size: 28rpx;
  319. }
  320. }
  321. .signName-right {
  322. text-align: left;
  323. // width: 100%;
  324. padding: 0 12rpx;
  325. margin-left: 12rpx;
  326. // width: 288rpx;
  327. border-bottom: 2rpx solid #333;
  328. // margin-bottom: 12rpx;
  329. .list-input {
  330. width: 100%;
  331. padding: 0 12rpx;
  332. height: 70rpx;
  333. font-size: 32rpx;
  334. text-align: left;
  335. }
  336. .signDate {
  337. display: flex;
  338. align-items: center;
  339. }
  340. }
  341. }
  342. .signDate {
  343. margin-top: 22rpx;
  344. display: flex;
  345. .signName-left {
  346. line-height: 34rpx;
  347. .signName-1 {
  348. }
  349. .signName-2 {
  350. font-size: 28rpx;
  351. }
  352. }
  353. .signName-right {
  354. text-align: left;
  355. padding-left: 12rpx;
  356. margin-left: 12rpx;
  357. width: 288rpx;
  358. border-bottom: 2rpx solid #333;
  359. .list-input {
  360. height: 70rpx;
  361. font-size: 32rpx;
  362. text-align: left;
  363. }
  364. // margin-bottom: 12rpx;
  365. }
  366. }
  367. // background-color: pink;
  368. }
  369. .imgbox {
  370. height: 1350rpx;
  371. width: 750rpx;
  372. }
  373. </style>