category.vue 13 KB

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