category.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  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. longitude4: '',
  80. latitude4: '',
  81. longitude: '',
  82. latitude: '',
  83. name: '',
  84. phone: '',
  85. mechanism: '',
  86. title: '选择机构',
  87. show: false,
  88. list: [],
  89. initSelected: [],
  90. searchVal: '',
  91. address: '',
  92. certificates: '',
  93. loding: false, //是否提交中
  94. showaddress: '', //显示用的地址
  95. count: 0,
  96. peoplelist: [],
  97. addressData: {
  98. name: '',
  99. mobile: '',
  100. latitude: 0, //纬度
  101. longitude: 0, //经度
  102. address: {
  103. province: '',
  104. city: '',
  105. district: '',
  106. detail: ''
  107. },
  108. area: '',
  109. default: false
  110. }
  111. };
  112. },
  113. onLoad() {
  114. let obj = this;
  115. console.log('开始加载事件');
  116. // obj.loadBaseData();
  117. // obj.loadData();
  118. try {
  119. let locationAddress
  120. // #ifdef H5
  121. let wxOjb = require('jweixin-module');
  122. locationAddress = wxOjb.getLocation;
  123. // #endif
  124. // #ifdef MP
  125. locationAddress = uni.getLocation;
  126. // #endif
  127. wxOjb.ready(() => {
  128. console.log('加载完毕注册事件');
  129. locationAddress({
  130. type: 'gcj02',
  131. success: function(res) {
  132. console.log('获取经纬度', res);
  133. obj.longitude = res.longitude
  134. obj.latitude = res.latitude
  135. obj.marker = [{
  136. latitude: obj.latitude,
  137. longitude: obj.longitude,
  138. iconPath: '/static/img/img19.png',
  139. width: '45',
  140. height: '45',
  141. }, ]
  142. obj.loadData();
  143. },
  144. fail(e) {
  145. console.log('失败', e);
  146. window.location.reload();
  147. }
  148. });
  149. })
  150. } catch (e) {
  151. console.log(e);
  152. let locationAddress
  153. // #ifdef H5
  154. let wxOjb = require('jweixin-module');
  155. locationAddress = wxOjb.getLocation;
  156. // #endif
  157. // #ifdef MP
  158. locationAddress = uni.getLocation;
  159. // #endif
  160. wxOjb.ready(() => {
  161. console.log('加载完毕注册事件');
  162. locationAddress({
  163. type: 'gcj02',
  164. success: function(res) {
  165. console.log('获取经纬度1', res);
  166. obj.longitude4 = res.longitude
  167. obj.latitude4 = res.latitude
  168. obj.loadData();
  169. },
  170. fail(e) {
  171. console.log('失败', e);
  172. }
  173. });
  174. })
  175. }
  176. },
  177. computed: {
  178. ...mapState('user', ['hasLogin', 'userInfo']),
  179. },
  180. onShow() {
  181. this.loadData();
  182. if (this.hasLogin) {
  183. // this.loadBaseData();
  184. } else {
  185. saveUrl();
  186. uni.showModal({
  187. title: '登录',
  188. content: '您未登录,是否马上登陆?',
  189. success: e => {
  190. if (e.confirm) {
  191. interceptor();
  192. }
  193. },
  194. fail: e => {
  195. console.log(e);
  196. }
  197. });
  198. }
  199. },
  200. watch: {
  201. searchVal() {
  202. this.ListDate();
  203. }
  204. },
  205. methods: {
  206. tosearch() {
  207. console.log(123);
  208. uni.navigateTo({
  209. url: '/pages/category/search'
  210. });
  211. },
  212. async loadData() {
  213. let obj = this;
  214. getNumber({}).then(({ data }) => {
  215. // console.log(12)
  216. // console.log(data)
  217. obj.count = data.count;
  218. obj.peoplelist = data.data;
  219. });
  220. },
  221. // 选择当前位置
  222. getLocation() {
  223. console.log('选择当前位置');
  224. let obj = this;
  225. uni.chooseLocation({
  226. latitude: obj.latitude4,
  227. longitude: obj.longitude4,
  228. success: function(res) {
  229. obj.addressData.area = res.name;
  230. console.log('位置名称:' + res.name);
  231. console.log('详细地址:' + res.address);
  232. console.log('纬度:' + res.latitude);
  233. console.log('经度:' + res.longitude);
  234. obj.addressData.latitude = res.latitude;
  235. obj.addressData.longitude = res.longitude;
  236. // let dizhi = obj.addressData.latitude + ','+ obj.addressData.longitude;
  237. obj.showaddress = res.address;
  238. }
  239. });
  240. },
  241. // 机构
  242. Toshow() {
  243. console.log('点击选择机构');
  244. this.show = true;
  245. },
  246. onChange(val) {
  247. let obj = this;
  248. console.log(val, 'onChange');
  249. // let arr = val.split(',');
  250. // console.log(999,arr)
  251. // obj.hospital = arr[1];
  252. // obj.hospital_id = arr[0];
  253. // obj.city = arr[2];
  254. // obj.city_id = arr[3];
  255. // obj.district = arr[4];
  256. // obj.district_id = arr[5];
  257. // obj.province = arr[6];
  258. // obj.province_id = arr[7];
  259. // obj.addr = obj.province + obj.city + obj.district;
  260. // console.log(obj.hospital,obj.hospital_id)
  261. // console.log(obj.city,obj.city_id)
  262. // console.log(obj.district,obj.district_id)
  263. // console.log(obj.province,obj.province_id)
  264. },
  265. onSearchInput(val) {
  266. this.searchVal = val.value;
  267. },
  268. // 选择机构
  269. ListDate() {
  270. let obj = this;
  271. let data = '';
  272. console.log('obj.searchVal', obj.searchVal);
  273. if (!obj.searchVal) {
  274. console.log('!obj.searchVal');
  275. data = {
  276. keyword: '',
  277. // sort:'id desc',
  278. page: 1,
  279. limit: 1500
  280. };
  281. } else {
  282. console.log('else');
  283. console.log('当前input值', obj.searchVal);
  284. data = {
  285. keyword: obj.searchVal,
  286. // sort:'id desc',
  287. page: 1,
  288. limit: 1500
  289. };
  290. }
  291. mechanism(data).then(data => {
  292. console.log('请求成功', data);
  293. this.list = data.data.map(item => item);
  294. // this.show = true
  295. });
  296. // getHospitalList(data).then(e => {
  297. // obj.list = e.data.list;
  298. // }).catch((e) => {
  299. // console.log(e)
  300. // });
  301. },
  302. onConfirm1(e) {
  303. console.log('点击确认');
  304. // let arr = e
  305. this.mechanism = e.split(',')[1];
  306. this.list = [];
  307. },
  308. imgsub() {
  309. console.log('imgsub');
  310. upload({
  311. filename: ''
  312. }).then(data => {
  313. this.certificates = data[0].url;
  314. });
  315. },
  316. join() {
  317. let obj = this;
  318. if (obj.name == '') {
  319. obj.$api.msg('请输入您的姓名');
  320. return;
  321. }
  322. const reg = /^(\+?0?86-?)?1[\d]\d{9}$/;
  323. if (!reg.test(obj.phone)) {
  324. obj.$api.msg('请填写正确的手机号码');
  325. return;
  326. }
  327. if (obj.showaddress == '') {
  328. obj.$api.msg('请选择您的所在地区');
  329. return;
  330. }
  331. // if (obj.mechanism == '') {
  332. // obj.$api.msg('请输入机构关键字');
  333. // return;
  334. // }
  335. if (obj.certificates == '') {
  336. obj.$api.msg('请上传救护员证书或身份证');
  337. return;
  338. }
  339. obj.loding = true;
  340. addrescuer({
  341. name: obj.name,
  342. phone: obj.phone,
  343. address: obj.showaddress,
  344. latitude: obj.addressData.latitude,
  345. longitude: obj.addressData.longitude,
  346. mechanism: obj.mechanism,
  347. certificates: obj.certificates
  348. })
  349. .then(data => {
  350. obj.loding = false;
  351. if (data.status == 200) {
  352. (obj.name = ''),
  353. (obj.phone = ''),
  354. (obj.showaddress = ''),
  355. (obj.certificates = ''),
  356. (obj.mechanism = ''),
  357. (obj.addressData.latitude = ''),
  358. (obj.addressData.longitude = ''),
  359. uni.removeStorage({
  360. key: 'institution',
  361. success: function(res) {
  362. console.log('success');
  363. }
  364. });
  365. uni.navigateTo({
  366. url: '../joinSuc/joinNow'
  367. });
  368. } else if (data.status == 400) {
  369. obj.$api.msg(data.msg);
  370. }
  371. })
  372. .catch(err => {
  373. console.log(err);
  374. });
  375. }
  376. }
  377. };
  378. </script>
  379. <style lang="scss">
  380. page {
  381. // background-color: #FD3B34;
  382. background-image: url();
  383. }
  384. .content {
  385. line-height: 1;
  386. // background-color: #FD3B34;
  387. .top {
  388. width: 750rpx;
  389. .bgi {
  390. display: block;
  391. width: 564rpx;
  392. height: 678rpx;
  393. margin: 53rpx auto;
  394. // position: relative;
  395. // top: -20rpx;
  396. }
  397. }
  398. .top-xtitle {
  399. font-size: 65rpx;
  400. font-family: Microsoft YaHei;
  401. font-weight: bold;
  402. color: #FFFFFF;
  403. line-height: 110rpx;
  404. text-shadow: 0px 5px 8px rgba(96, 1, 0, 0.61);
  405. text-align: center;
  406. }
  407. .top-title {
  408. font-size: 85rpx;
  409. font-family: PingFang SC;
  410. font-weight: bold;
  411. color: #FD424B;
  412. font-family: Microsoft YaHei;
  413. font-weight: bold;
  414. color: #FFFFFF;
  415. line-height: 110rpx;
  416. text-shadow: 0px 5px 8px rgba(96, 1, 0, 0.61);
  417. text-align: center;
  418. padding-bottom: 69rpx;
  419. }
  420. .pop-box {
  421. padding-top: 31rpx;
  422. margin: 0 auto;
  423. position: relative;
  424. z-index: 99;
  425. width: 156rpx;
  426. height: 36rpx;
  427. font-size: 38rpx;
  428. font-family: PingFang SC;
  429. font-weight: bold;
  430. color: #000;
  431. &::before {
  432. content: '';
  433. width: 220rpx;
  434. height: 17rpx;
  435. background: rgba(254, 166, 78, 1);
  436. opacity: 0.26;
  437. position: absolute;
  438. bottom: -35rpx;
  439. left: -40rpx;
  440. }
  441. }
  442. .red-box {
  443. padding-top: 31rpx;
  444. margin: 0 auto ;
  445. position: relative;
  446. z-index: 99;
  447. width: 156rpx;
  448. height: 36rpx;
  449. font-size: 38rpx;
  450. font-family: PingFang SC;
  451. font-weight: bold;
  452. color: #000;
  453. &::after {
  454. content: '';
  455. width: 220rpx;
  456. height: 17rpx;
  457. background:rgba(254, 166, 78, 1);
  458. opacity: 0.26;
  459. position: absolute;
  460. bottom: -35rpx;
  461. left: -40rpx;
  462. }
  463. }
  464. .red-box2 {
  465. position: relative;
  466. width: 405rpx;
  467. line-height: 66rpx;
  468. text-align: center;
  469. background: linear-gradient(0deg, #c90f1b, #f14d33);
  470. border-radius: 10rpx;
  471. font-size: 30rpx;
  472. font-weight: 500;
  473. color: #ffffff;
  474. margin: -80rpx auto 0;
  475. position: relative;
  476. z-index: 1;
  477. }
  478. .pop-list {
  479. width: 686rpx;
  480. background: #ffffff;
  481. border-radius: 29rpx;
  482. position: relative;
  483. margin: -33rpx auto 78rpx;
  484. padding: 150rpx 0rpx 30rpx 30rpx;
  485. display: flex;
  486. flex-wrap: wrap;
  487. box-shadow: 0px 10rpx 20rpx 0px rgba(254, 0, 8, 0.28);
  488. .list-box1 {
  489. text-align: center;
  490. margin-right: 30rpx;
  491. margin-bottom: 30rpx;
  492. .list-top {
  493. width: 100rpx;
  494. height: 100rpx;
  495. .avatar-img {
  496. width: 100rpx;
  497. height: 100rpx;
  498. border-radius: 50%;
  499. }
  500. }
  501. .nickname {
  502. margin-top: 12rpx;
  503. }
  504. }
  505. }
  506. .list-box {
  507. width: 686rpx;
  508. background: #ffffff;
  509. border-radius: 29rpx;
  510. position: relative;
  511. margin: -33rpx auto 0;
  512. padding: 100rpx 30rpx 0rpx 30rpx;
  513. display: flex;
  514. flex-wrap: wrap;
  515. box-shadow: 0px 10rpx 20rpx 0px rgba(254, 0, 8, 0.28);
  516. .upload-box {
  517. width: 100%;
  518. height: 290rpx;
  519. background: #ffffff;
  520. // border: 1px solid #E63931;
  521. border-radius: 15rpx;
  522. display: flex;
  523. flex-direction: column;
  524. padding-top: 24rpx;
  525. margin: 0 auto 50rpx;
  526. .upload-left {
  527. font-weight: 400;
  528. color: #000;
  529. text {
  530. color: #FD424B;
  531. font-size: 30rpx;
  532. }
  533. }
  534. .upload-right {
  535. margin-top: 16rpx;
  536. width: 100%;
  537. height: 100%;
  538. border: 1px solid #888888;
  539. border-radius: 15rpx;
  540. flex: 1;
  541. display: flex;
  542. align-items: center;
  543. justify-content: center;
  544. .upload-img {
  545. width: 102rpx;
  546. height: 102rpx;
  547. // border: 1px solid #888888;
  548. // border-radius: 3rpx;
  549. // width: 133rpx;
  550. // height: 133rpx;
  551. // margin-top: 44rpx;
  552. }
  553. }
  554. }
  555. .list {
  556. display: flex;
  557. flex-direction: column;
  558. align-items: center;
  559. width: 100%;
  560. margin-top: 32rpx;
  561. // height: 133rpx;
  562. .list-left {
  563. width: 100%;
  564. text-align: left;
  565. color: #000;
  566. text {
  567. color: #FD424B;
  568. font-size: 30rpx;
  569. }
  570. }
  571. input {
  572. height: 66rpx;
  573. // line-height: 66rpx;
  574. margin-top: 32rpx;
  575. // height: 88rpx;
  576. }
  577. .list-input {
  578. padding-left: 24rpx;
  579. // margin: 12rpx 0 ;
  580. line-height: 66rpx;
  581. display: flex;
  582. align-items: center;
  583. width: 100%;
  584. font-size: 26rpx;
  585. flex: 1;
  586. color: #000;
  587. border: 1rpx solid #929292;
  588. border-radius: 15rpx;
  589. text-align: left;
  590. .input-placeholder {
  591. height: 70rpx;
  592. color: #929292;
  593. font-size: 26rpx;
  594. }
  595. }
  596. .box-right {
  597. display: flex;
  598. align-items: center;
  599. padding-left: 24rpx;
  600. height: 66rpx;
  601. line-height: 66rpx;
  602. border: 1rpx solid #f3afad;
  603. border-radius: 22rpx;
  604. margin: 32rpx 36rpx 0 36rpx;
  605. width: 96%;
  606. font-size: 36rpx;
  607. color: #ff9797;
  608. text-align: left;
  609. line-height: 1;
  610. }
  611. }
  612. }
  613. .sub {
  614. width: 690rpx;
  615. height: 83rpx;
  616. background: #f95349;
  617. border-radius: 42rpx;
  618. font-size: 32rpx;
  619. font-family: PingFang SC;
  620. font-weight: 500;
  621. color: #FFFFFF;
  622. line-height: 83rpx;
  623. text-align: center;
  624. margin: 53rpx auto 60rpx;
  625. &.action {
  626. background: #999999;
  627. }
  628. }
  629. }
  630. </style>