category.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. <template>
  2. <view class="content">
  3. <view class="top"><image src="../../static/img/jiuzai.png" mode="widthFix" class="bgi"></image></view>
  4. <!-- <view class="top-xtitle">
  5. 红十字
  6. </view>
  7. <view class="top-title">
  8. 救护员招募
  9. </view> -->
  10. <view class="pop-box">公众参与</view>
  11. <view class="pop-list">
  12. <view class="list-box1" v-for="(item, index) in peoplelist" :key="index" v-if="index < 20">
  13. <view class="list-top"><image :src="item.avatar" mode="" class="avatar-img"></image></view>
  14. <view class="nickname">{{ item.name }}</view>
  15. </view>
  16. </view>
  17. <view class="red-box">活动报名</view>
  18. <!-- <view class="people">
  19. </view> -->
  20. <view class="list-box">
  21. <view class="list">
  22. <view class="list-left">姓名 <text>*</text></view>
  23. <input type="text" v-model="name" class="list-input" placeholder="请填写您的姓名" />
  24. </view>
  25. <view class="list">
  26. <view class="list-left">手机名 <text>*</text></view>
  27. <input type="text" v-model="phone" class="list-input" placeholder="请填写您的联系方式" />
  28. </view>
  29. <view class="list" @click="getLocation">
  30. <view class="list-left">地址 <text>*</text></view>
  31. <!-- <picker-address class="box-right" @change="onCityClick">{{ address }}</picker-address> -->
  32. <input type="text" v-model="showaddress" class="list-input" placeholder="请选择定位地址" />
  33. </view>
  34. <!-- <view class="list" @click="Toshow">
  35. <view class="list-left">机构 <text>*</text></view>
  36. <input type="text" v-model="mechanism" class="list-input" placeholder="请填写您的所在机构" disabled />
  37. </view> -->
  38. <view class="upload-box">
  39. <view class="upload-left">证件 <text>*</text></view>
  40. <view class="upload-right">
  41. <image :src="certificates" mode="" class="upload-img" @click.stop="imgsub" v-if="certificates"></image>
  42. <image src="../../static/images/upload.png" class="upload-img" mode="" v-if="!certificates" @click.stop="imgsub"></image>
  43. </view>
  44. </view>
  45. <zhilin-picker
  46. v-model="show"
  47. :title="title"
  48. :data="list"
  49. :initSelected="initSelected"
  50. :showSearch="true"
  51. @change="onChange"
  52. @searchInput="onSearchInput"
  53. @confirm="onConfirm1"
  54. />
  55. </view>
  56. <view class="sub" :class="{ action: loding }" @click="!loding ? join() : ''">提交申请</view>
  57. </view>
  58. </template>
  59. <script>
  60. import {
  61. mapState,
  62. mapMutations
  63. } from 'vuex';
  64. import {
  65. saveUrl,
  66. interceptor
  67. } from '@/utils/loginUtils.js';
  68. import { mechanism } from '@/api/ask.js';
  69. import { getNumber } from '@/api/index.js';
  70. import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
  71. import zhilinPicker from '@/components/zhilin-picker/zhilin-picker.vue';
  72. import { upload, addrescuer } from '@/api/ask.js';
  73. export default {
  74. components: {
  75. pickerAddress
  76. },
  77. data() {
  78. return {
  79. longitude: '',
  80. latitude: '',
  81. name: '',
  82. phone: '',
  83. mechanism: '',
  84. title: '选择机构',
  85. show: false,
  86. list: [],
  87. initSelected: [],
  88. searchVal: '',
  89. address: '',
  90. certificates: '',
  91. loding: false, //是否提交中
  92. showaddress: '', //显示用的地址
  93. count: 0,
  94. peoplelist: [],
  95. addressData: {
  96. name: '',
  97. mobile: '',
  98. latitude: 0, //纬度
  99. longitude: 0, //经度
  100. address: {
  101. province: '',
  102. city: '',
  103. district: '',
  104. detail: ''
  105. },
  106. area: '',
  107. default: false
  108. }
  109. };
  110. },
  111. computed: {
  112. ...mapState('user', ['hasLogin', 'userInfo']),
  113. },
  114. onShow() {
  115. this.loadData();
  116. if (this.hasLogin) {
  117. // this.loadBaseData();
  118. } else {
  119. saveUrl();
  120. uni.showModal({
  121. title: '登录',
  122. content: '您未登录,是否马上登陆?',
  123. success: e => {
  124. if (e.confirm) {
  125. interceptor();
  126. }
  127. },
  128. fail: e => {
  129. console.log(e);
  130. }
  131. });
  132. }
  133. },
  134. watch: {
  135. searchVal() {
  136. this.ListDate();
  137. }
  138. },
  139. methods: {
  140. tosearch() {
  141. console.log(123);
  142. uni.navigateTo({
  143. url: '/pages/category/search'
  144. });
  145. },
  146. async loadData() {
  147. let obj = this;
  148. getNumber({}).then(({ data }) => {
  149. // console.log(12)
  150. // console.log(data)
  151. obj.count = data.count;
  152. obj.peoplelist = data.data;
  153. });
  154. },
  155. // 选择当前位置
  156. getLocation() {
  157. console.log('选择当前位置');
  158. let obj = this;
  159. uni.chooseLocation({
  160. success: function(res) {
  161. obj.addressData.area = res.name;
  162. console.log('位置名称:' + res.name);
  163. console.log('详细地址:' + res.address);
  164. console.log('纬度:' + res.latitude);
  165. console.log('经度:' + res.longitude);
  166. obj.addressData.latitude = res.latitude;
  167. obj.addressData.longitude = res.longitude;
  168. // let dizhi = obj.addressData.latitude + ','+ obj.addressData.longitude;
  169. obj.showaddress = res.address;
  170. }
  171. });
  172. },
  173. // 机构
  174. Toshow() {
  175. console.log('点击选择机构');
  176. this.show = true;
  177. },
  178. onChange(val) {
  179. let obj = this;
  180. console.log(val, 'onChange');
  181. // let arr = val.split(',');
  182. // console.log(999,arr)
  183. // obj.hospital = arr[1];
  184. // obj.hospital_id = arr[0];
  185. // obj.city = arr[2];
  186. // obj.city_id = arr[3];
  187. // obj.district = arr[4];
  188. // obj.district_id = arr[5];
  189. // obj.province = arr[6];
  190. // obj.province_id = arr[7];
  191. // obj.addr = obj.province + obj.city + obj.district;
  192. // console.log(obj.hospital,obj.hospital_id)
  193. // console.log(obj.city,obj.city_id)
  194. // console.log(obj.district,obj.district_id)
  195. // console.log(obj.province,obj.province_id)
  196. },
  197. onSearchInput(val) {
  198. this.searchVal = val.value;
  199. },
  200. // 选择机构
  201. ListDate() {
  202. let obj = this;
  203. let data = '';
  204. console.log('obj.searchVal', obj.searchVal);
  205. if (!obj.searchVal) {
  206. console.log('!obj.searchVal');
  207. data = {
  208. keyword: '',
  209. // sort:'id desc',
  210. page: 1,
  211. limit: 1500
  212. };
  213. } else {
  214. console.log('else');
  215. console.log('当前input值', obj.searchVal);
  216. data = {
  217. keyword: obj.searchVal,
  218. // sort:'id desc',
  219. page: 1,
  220. limit: 1500
  221. };
  222. }
  223. mechanism(data).then(data => {
  224. console.log('请求成功', data);
  225. this.list = data.data.map(item => item);
  226. // this.show = true
  227. });
  228. // getHospitalList(data).then(e => {
  229. // obj.list = e.data.list;
  230. // }).catch((e) => {
  231. // console.log(e)
  232. // });
  233. },
  234. onConfirm1(e) {
  235. console.log('点击确认');
  236. // let arr = e
  237. this.mechanism = e.split(',')[1];
  238. this.list = [];
  239. },
  240. imgsub() {
  241. console.log('imgsub');
  242. upload({
  243. filename: ''
  244. }).then(data => {
  245. this.certificates = data[0].url;
  246. });
  247. },
  248. join() {
  249. let obj = this;
  250. if (obj.name == '') {
  251. obj.$api.msg('请输入您的姓名');
  252. return;
  253. }
  254. const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
  255. if (!reg.test(obj.phone)) {
  256. obj.$api.msg('请填写正确的手机号码');
  257. return;
  258. }
  259. if (obj.showaddress == '') {
  260. obj.$api.msg('请选择您的所在地区');
  261. return;
  262. }
  263. // if (obj.mechanism == '') {
  264. // obj.$api.msg('请输入机构关键字');
  265. // return;
  266. // }
  267. if (obj.certificates == '') {
  268. obj.$api.msg('请上传救护员证书或身份证');
  269. return;
  270. }
  271. obj.loding = true;
  272. addrescuer({
  273. name: obj.name,
  274. phone: obj.phone,
  275. address: obj.showaddress,
  276. latitude: obj.addressData.latitude,
  277. longitude: obj.addressData.longitude,
  278. mechanism: obj.mechanism,
  279. certificates: obj.certificates
  280. })
  281. .then(data => {
  282. obj.loding = false;
  283. if (data.status == 200) {
  284. (obj.name = ''),
  285. (obj.phone = ''),
  286. (obj.showaddress = ''),
  287. (obj.certificates = ''),
  288. (obj.mechanism = ''),
  289. (obj.addressData.latitude = ''),
  290. (obj.addressData.longitude = ''),
  291. uni.removeStorage({
  292. key: 'institution',
  293. success: function(res) {
  294. console.log('success');
  295. }
  296. });
  297. uni.navigateTo({
  298. url: '../joinSuc/joinNow'
  299. });
  300. } else if (data.status == 400) {
  301. obj.$api.msg(data.msg);
  302. }
  303. })
  304. .catch(err => {
  305. console.log(err);
  306. });
  307. }
  308. }
  309. };
  310. </script>
  311. <style lang="scss">
  312. page {
  313. // background-color: #FD3B34;
  314. background-image: url();
  315. }
  316. .content {
  317. line-height: 1;
  318. // background-color: #FD3B34;
  319. .top {
  320. width: 750rpx;
  321. .bgi {
  322. display: block;
  323. width: 564rpx;
  324. height: 678rpx;
  325. margin: 53rpx auto;
  326. // position: relative;
  327. // top: -20rpx;
  328. }
  329. }
  330. .top-xtitle {
  331. font-size: 65rpx;
  332. font-family: Microsoft YaHei;
  333. font-weight: bold;
  334. color: #FFFFFF;
  335. line-height: 110rpx;
  336. text-shadow: 0px 5px 8px rgba(96, 1, 0, 0.61);
  337. text-align: center;
  338. }
  339. .top-title {
  340. font-size: 85rpx;
  341. font-family: PingFang SC;
  342. font-weight: bold;
  343. color: #FD424B;
  344. font-family: Microsoft YaHei;
  345. font-weight: bold;
  346. color: #FFFFFF;
  347. line-height: 110rpx;
  348. text-shadow: 0px 5px 8px rgba(96, 1, 0, 0.61);
  349. text-align: center;
  350. padding-bottom: 69rpx;
  351. }
  352. .pop-box {
  353. padding-top: 31rpx;
  354. margin: 0 auto;
  355. position: relative;
  356. z-index: 99;
  357. width: 156rpx;
  358. height: 36rpx;
  359. font-size: 38rpx;
  360. font-family: PingFang SC;
  361. font-weight: bold;
  362. color: #FA7E67;
  363. &::after {
  364. content: '';
  365. width: 220rpx;
  366. height: 17rpx;
  367. background: #FDCBC2;
  368. opacity: 0.26;
  369. position: absolute;
  370. bottom: -35rpx;
  371. left: -40rpx;
  372. }
  373. }
  374. .red-box {
  375. padding-top: 31rpx;
  376. margin: 0 auto ;
  377. position: relative;
  378. z-index: 99;
  379. width: 156rpx;
  380. height: 36rpx;
  381. font-size: 38rpx;
  382. font-family: PingFang SC;
  383. font-weight: bold;
  384. color: #FA7E67;
  385. &::after {
  386. content: '';
  387. width: 220rpx;
  388. height: 17rpx;
  389. background: #FDCBC2;
  390. opacity: 0.26;
  391. position: absolute;
  392. bottom: -35rpx;
  393. left: -40rpx;
  394. }
  395. }
  396. .red-box2 {
  397. position: relative;
  398. width: 405rpx;
  399. line-height: 66rpx;
  400. text-align: center;
  401. background: linear-gradient(0deg, #c90f1b, #f14d33);
  402. border-radius: 10rpx;
  403. font-size: 30rpx;
  404. font-weight: 500;
  405. color: #ffffff;
  406. margin: -80rpx auto 0;
  407. position: relative;
  408. z-index: 1;
  409. }
  410. .pop-list {
  411. width: 686rpx;
  412. background: #ffffff;
  413. border-radius: 29rpx;
  414. position: relative;
  415. margin: -33rpx auto 78rpx;
  416. padding: 150rpx 0rpx 30rpx 30rpx;
  417. display: flex;
  418. flex-wrap: wrap;
  419. box-shadow: 0px 10rpx 20rpx 0px rgba(254, 0, 8, 0.28);
  420. .list-box1 {
  421. text-align: center;
  422. margin-right: 30rpx;
  423. margin-bottom: 30rpx;
  424. .list-top {
  425. width: 100rpx;
  426. height: 100rpx;
  427. .avatar-img {
  428. width: 100rpx;
  429. height: 100rpx;
  430. border-radius: 50%;
  431. }
  432. }
  433. .nickname {
  434. margin-top: 12rpx;
  435. }
  436. }
  437. }
  438. .list-box {
  439. width: 686rpx;
  440. background: #ffffff;
  441. border-radius: 29rpx;
  442. position: relative;
  443. margin: -33rpx auto 0;
  444. padding: 100rpx 30rpx 0rpx 30rpx;
  445. display: flex;
  446. flex-wrap: wrap;
  447. box-shadow: 0px 10rpx 20rpx 0px rgba(254, 0, 8, 0.28);
  448. .upload-box {
  449. width: 100%;
  450. height: 290rpx;
  451. background: #ffffff;
  452. // border: 1px solid #E63931;
  453. border-radius: 15rpx;
  454. display: flex;
  455. flex-direction: column;
  456. padding-top: 24rpx;
  457. margin: 0 auto 50rpx;
  458. .upload-left {
  459. font-weight: 400;
  460. color: #000;
  461. text {
  462. color: #FD424B;
  463. font-size: 30rpx;
  464. }
  465. }
  466. .upload-right {
  467. margin-top: 16rpx;
  468. width: 100%;
  469. height: 100%;
  470. border: 1px solid #888888;
  471. border-radius: 15rpx;
  472. flex: 1;
  473. display: flex;
  474. align-items: center;
  475. justify-content: center;
  476. .upload-img {
  477. width: 102rpx;
  478. height: 102rpx;
  479. // border: 1px solid #888888;
  480. // border-radius: 3rpx;
  481. // width: 133rpx;
  482. // height: 133rpx;
  483. // margin-top: 44rpx;
  484. }
  485. }
  486. }
  487. .list {
  488. display: flex;
  489. flex-direction: column;
  490. align-items: center;
  491. width: 100%;
  492. margin-top: 32rpx;
  493. // height: 133rpx;
  494. .list-left {
  495. width: 100%;
  496. text-align: left;
  497. color: #000;
  498. text {
  499. color: #FD424B;
  500. font-size: 30rpx;
  501. }
  502. }
  503. input {
  504. height: 66rpx;
  505. // line-height: 66rpx;
  506. margin-top: 32rpx;
  507. // height: 88rpx;
  508. }
  509. .list-input {
  510. padding-left: 24rpx;
  511. // margin: 12rpx 0 ;
  512. line-height: 66rpx;
  513. display: flex;
  514. align-items: center;
  515. width: 100%;
  516. font-size: 26rpx;
  517. flex: 1;
  518. color: #000;
  519. border: 1rpx solid #929292;
  520. border-radius: 15rpx;
  521. text-align: left;
  522. .input-placeholder {
  523. height: 70rpx;
  524. color: #929292;
  525. font-size: 26rpx;
  526. }
  527. }
  528. .box-right {
  529. display: flex;
  530. align-items: center;
  531. padding-left: 24rpx;
  532. height: 66rpx;
  533. line-height: 66rpx;
  534. border: 1rpx solid #f3afad;
  535. border-radius: 22rpx;
  536. margin: 32rpx 36rpx 0 36rpx;
  537. width: 96%;
  538. font-size: 36rpx;
  539. color: #ff9797;
  540. text-align: left;
  541. line-height: 1;
  542. }
  543. }
  544. }
  545. .sub {
  546. width: 690rpx;
  547. height: 83rpx;
  548. background: #FF5056;
  549. border-radius: 42rpx;
  550. font-size: 32rpx;
  551. font-family: PingFang SC;
  552. font-weight: 500;
  553. color: #FFFFFF;
  554. line-height: 83rpx;
  555. text-align: center;
  556. margin: 53rpx auto 60rpx;
  557. &.action {
  558. background: #999999;
  559. }
  560. }
  561. }
  562. </style>