category.vue 14 KB

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