category.vue 14 KB

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