category.vue 13 KB

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