category.vue 12 KB

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