category.vue 13 KB

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