category1.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <image src="../../static/images/bgi1.png" mode="widthFix" class="bgi"></image>
  5. </view>
  6. <view class="pop-box">
  7. 参与人数({{count}}人)
  8. </view>
  9. <view class="pop-list">
  10. <view class="list-box1" v-for="(item,index) in list" :key='index' v-if="index<20">
  11. <view class="list-top">
  12. <image src="../../static/images/touxiang.jpg" mode="" class="avatar-img"></image>
  13. </view>
  14. <view class="nickname">
  15. 韩大力
  16. </view>
  17. </view>
  18. </view>
  19. <view class="red-box">
  20. 报名参与
  21. </view>
  22. <!-- <view class="people">
  23. </view> -->
  24. <view class="list-box">
  25. <view class="list">
  26. <view class="list-left">
  27. 姓名:
  28. </view>
  29. <input type="text" v-model="name" class="list-input" placeholder="请输入您的姓名"/>
  30. </view>
  31. <view class="list">
  32. <view class="list-left">
  33. 手机:
  34. </view>
  35. <input type="text" v-model="phone" class="list-input" placeholder='请填写您的联系方式'/>
  36. </view>
  37. <view class="list" @click="getLocation">
  38. <view class="list-left">
  39. 地址:
  40. </view>
  41. <!-- <picker-address class="box-right" @change="onCityClick">{{ address }}</picker-address> -->
  42. <input type="text" v-model="showaddress" class="list-input" placeholder='请选择定位地址'/>
  43. </view>
  44. <view class="list">
  45. <view class="list-left">
  46. 机构:
  47. </view>
  48. <input type="text" v-model="mechanism" @click="tosearch" class="list-input" placeholder='请输入机构关键字'/>
  49. </view>
  50. <view class="upload-box">
  51. <view class="upload-left">
  52. 请上传救护员证书或身份证:
  53. </view>
  54. <view class="upload-right">
  55. <image :src="certificates" mode="" class="upload-img" @click.stop="imgsub" v-if="certificates"></image>
  56. <image src="../../static/images/upload.png" class="upload-img" mode="" v-if="!certificates" @click.stop="imgsub"></image>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="sub" :class="{ action: loding }" @click="!loding?join():''">
  61. 马上报名
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import {
  67. getNumber
  68. } from '@/api/index.js';
  69. import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
  70. import {
  71. upload,
  72. addrescuer
  73. } from '@/api/ask.js';
  74. export default {
  75. components: {
  76. pickerAddress,
  77. },
  78. computed: {
  79. // startDate() {
  80. // return this.getDate('start');
  81. // },
  82. // endDate() {
  83. // return this.getDate('end');
  84. // }
  85. },
  86. data() {
  87. // const currentDate = this.getDate({
  88. // format: true
  89. // })
  90. return {
  91. longitude: '',
  92. latitude: '',
  93. name: '',
  94. phone: '',
  95. mechanism: '',
  96. address: '',
  97. certificates: '',
  98. loding: false, //是否提交中
  99. showaddress: '', //显示用的地址
  100. count: 0,
  101. list: [1, 2, 3, 4, 5, 6, 7, 8,1,1,1,1,1,1,1,1,1,1,,1,1,1,,1,1,1,1,1,1],
  102. addressData: {
  103. name: '',
  104. mobile: '',
  105. latitude: 0, //纬度
  106. longitude: 0, //经度
  107. address: {
  108. province: '',
  109. city: '',
  110. district: '',
  111. detail: '',
  112. },
  113. area: '',
  114. default: false
  115. },
  116. }
  117. },
  118. onLoad() {
  119. this.loadData();
  120. const institution = uni.getStorageSync('institution')
  121. console.log(3,3,institution)
  122. this.mechanism = institution
  123. },
  124. methods: {
  125. tosearch(){
  126. uni.navigateTo({
  127. url:'/pages/category/search'
  128. })
  129. },
  130. async loadData() {
  131. let obj = this;
  132. getNumber({}).then(({
  133. data
  134. }) => {
  135. console.log(12)
  136. console.log(data)
  137. obj.count = data.count;
  138. obj.list = data.data;
  139. })
  140. },
  141. // 选择当前位置
  142. getLocation() {
  143. console.log('选择当前位置');
  144. let obj = this;
  145. uni.chooseLocation({
  146. success: function(res) {
  147. obj.addressData.area = res.name;
  148. console.log('位置名称:' + res.name);
  149. console.log('详细地址:' + res.address);
  150. console.log('纬度:' + res.latitude);
  151. console.log('经度:' + res.longitude);
  152. obj.addressData.latitude = res.latitude;
  153. obj.addressData.longitude = res.longitude;
  154. // let dizhi = obj.addressData.latitude + ','+ obj.addressData.longitude;
  155. obj.showaddress = res.address;
  156. // // #ifdef H5
  157. // uni.request({
  158. // url:"/ws/geocoder/v1",
  159. // method: 'GET',
  160. // data:{
  161. // location:dizhi,
  162. // key:'CNIBZ-6JQWU-P2BVH-2GAAC-GG7Z5-RSBOP'
  163. // },
  164. // success: (res) => {
  165. // // console.log(res.data,"apis.map.qq.com");
  166. // let address = res.data.result.ad_info;
  167. // obj.addressData.address.province = address.province;
  168. // obj.addressData.address.city = address.city;
  169. // obj.addressData.address.district = address.district;
  170. // obj.content = obj.addressData.address.province + obj.addressData.address.city + obj.addressData.address.district;
  171. // }
  172. // });
  173. // // #endif
  174. // // #ifdef MP
  175. // uni.request({
  176. // url:"https://apis.map.qq.com/ws/geocoder/v1",
  177. // data:{
  178. // location:dizhi,
  179. // key:'CNIBZ-6JQWU-P2BVH-2GAAC-GG7Z5-RSBOP'
  180. // },
  181. // success: (res) => {
  182. // console.log(res.data,"apis.map.qq.com");
  183. // let address = res.data.result.ad_info;
  184. // obj.addressData.address.province = address.province;
  185. // obj.addressData.address.city = address.city;
  186. // obj.addressData.address.district = address.district;
  187. // obj.content = obj.addressData.address.province + obj.addressData.address.city + obj.addressData.address.district;
  188. // }
  189. // });
  190. // // #endif
  191. }
  192. });
  193. },
  194. imgsub() {
  195. console.log('imgsub')
  196. upload({
  197. filename: ''
  198. }).then(data => {
  199. this.certificates = data[0].url;
  200. })
  201. },
  202. join() {
  203. let obj = this;
  204. if (obj.name == '') {
  205. obj.$api.msg('请输入您的姓名');
  206. return
  207. }
  208. const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
  209. if (!reg.test(obj.phone)) {
  210. obj.$api.msg('请填写正确的手机号码');
  211. return;
  212. }
  213. if (obj.showaddress == '') {
  214. obj.$api.msg('请选择您的所在地区');
  215. return
  216. }
  217. // if (obj.mechanism == '') {
  218. // obj.$api.msg('请输入机构关键字');
  219. // return
  220. // }
  221. if (obj.certificates == '') {
  222. obj.$api.msg('请上传救护员证书或身份证');
  223. return
  224. }
  225. obj.loding = true;
  226. addrescuer({
  227. name: obj.name,
  228. phone: obj.phone,
  229. address: obj.showaddress,
  230. latitude:obj.addressData.latitude,
  231. longitude:obj.addressData.longitude,
  232. mechanism:obj.mechanism,
  233. certificates: obj.certificates
  234. }).then(data => {
  235. obj.loding = false;
  236. if (data.status == 200) {
  237. obj.name = '',
  238. obj.phone = '',
  239. obj.showaddress = '',
  240. obj.certificates = '',
  241. obj.mechanism = '',
  242. obj.addressData.latitude = '',
  243. obj.addressData.longitude = '',
  244. uni.navigateTo({
  245. url: '../joinSuc/joinNow'
  246. });
  247. } else if (data.status == 400) {
  248. obj.$api.msg(data.msg);
  249. }
  250. }).catch(err => {
  251. console.log(err);
  252. });
  253. }
  254. }
  255. }
  256. </script>
  257. <style lang="scss">
  258. .content {
  259. line-height: 1;
  260. background-color: #FFABAB;
  261. padding-bottom: 20rpx;
  262. .sub {
  263. width: 660rpx;
  264. line-height: 100rpx;
  265. background: linear-gradient(0deg, #C90F1B, #F14D33);
  266. border-radius: 50rpx;
  267. font-size: 36rpx;
  268. font-weight: 400;
  269. color: #FFFFFF;
  270. text-align: center;
  271. margin: 60rpx auto 0;
  272. &.action {
  273. background: #999999;
  274. }
  275. }
  276. .top {
  277. width: 750rpx;
  278. .bgi {
  279. width: 750rpx;
  280. }
  281. }
  282. .pop-box {
  283. width: 405rpx;
  284. line-height: 66rpx;
  285. text-align: center;
  286. background: linear-gradient(0deg, #C90F1B, #F14D33);
  287. border-radius: 10rpx;
  288. font-size: 30rpx;
  289. font-weight: 500;
  290. color: #FFFFFF;
  291. margin: -110rpx auto 0;
  292. position: relative;
  293. z-index: 1;
  294. }
  295. .red-box {
  296. width: 405rpx;
  297. line-height: 66rpx;
  298. text-align: center;
  299. background: linear-gradient(0deg, #C90F1B, #F14D33);
  300. border-radius: 10rpx;
  301. font-size: 30rpx;
  302. font-weight: 500;
  303. color: #FFFFFF;
  304. margin: 0rpx auto 0;
  305. position: relative;
  306. z-index: 1;
  307. }
  308. .red-box2 {
  309. position: relative;
  310. width: 405rpx;
  311. line-height: 66rpx;
  312. text-align: center;
  313. background: linear-gradient(0deg, #C90F1B, #F14D33);
  314. border-radius: 10rpx;
  315. font-size: 30rpx;
  316. font-weight: 500;
  317. color: #FFFFFF;
  318. margin: -80rpx auto 0;
  319. position: relative;
  320. z-index: 1;
  321. }
  322. .pop-list {
  323. width: 686rpx;
  324. background: #FFFFFF;
  325. border-radius: 29rpx;
  326. position: relative;
  327. margin: -33rpx auto 78rpx;
  328. padding: 80rpx 0rpx 30rpx 30rpx;
  329. display: flex;
  330. flex-wrap: wrap;
  331. .list-box1 {
  332. text-align: center;
  333. margin-right: 30rpx;
  334. margin-bottom: 30rpx;
  335. .list-top {
  336. width: 100rpx;
  337. height: 100rpx;
  338. .avatar-img {
  339. width: 100rpx;
  340. height: 100rpx;
  341. border-radius: 50%;
  342. }
  343. }
  344. }
  345. }
  346. .list-box {
  347. width: 686rpx;
  348. background: #FFFFFF;
  349. border-radius: 29rpx;
  350. position: relative;
  351. margin: -33rpx auto;
  352. padding: 100rpx 30rpx 0rpx 30rpx;
  353. display: flex;
  354. flex-wrap: wrap;
  355. .upload-box {
  356. width: 100%;
  357. height: 247rpx;
  358. background: #FFFFFF;
  359. // border: 1px solid #E63931;
  360. border-radius: 27rpx;
  361. display: flex;
  362. flex-direction: column;
  363. padding: 30rpx 40rpx 30rpx 0;
  364. margin: 0 auto 30rpx;
  365. .upload-left {
  366. font-weight: 400;
  367. color: #E63931;
  368. }
  369. .upload-right {
  370. flex: 1;
  371. display: flex;
  372. align-items: center;
  373. justify-content: center;
  374. .upload-img {
  375. width: 133rpx;
  376. height: 133rpx;
  377. margin-top: 44rpx;
  378. }
  379. }
  380. }
  381. .list {
  382. display: flex;
  383. flex-direction: column;
  384. align-items: center;
  385. width: 100%;
  386. margin-top: 32rpx;
  387. // height: 133rpx;
  388. .list-left {
  389. width: 100%;
  390. text-align: left;
  391. color: #E63931;
  392. }
  393. input {
  394. height: 66rpx;
  395. line-height: 66rpx;
  396. margin-top: 32rpx;
  397. // height: 88rpx;
  398. }
  399. .list-input {
  400. padding-left: 24rpx;
  401. // margin: 12rpx 0 ;
  402. // line-height: 66rpx;
  403. display: flex;
  404. align-items: center;
  405. width: 100%;
  406. font-size: 36rpx;
  407. flex: 1;
  408. color: #FF9797;
  409. border: 1rpx solid #f3afad;
  410. border-radius: 22rpx;
  411. text-align: left;
  412. padding-right: 24rpx;
  413. .input-placeholder {
  414. height: 70rpx;
  415. color: #FF9797;
  416. }
  417. }
  418. .box-right {
  419. display: flex;
  420. align-items: center;
  421. padding-left: 24rpx;
  422. height: 66rpx;
  423. line-height: 66rpx;
  424. border: 1rpx solid #f3afad;
  425. border-radius: 22rpx;
  426. margin: 32rpx 36rpx 0 36rpx;
  427. width: 96%;
  428. font-size: 36rpx;
  429. color: #FF9797;
  430. text-align: left;
  431. // line-height: 1;
  432. }
  433. }
  434. }
  435. }
  436. </style>