category.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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="item.avatar" 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="mechanism" 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. page {
  287. // background-color: #FD3B34;
  288. background-image: url();
  289. }
  290. .content {
  291. line-height: 1;
  292. // background-color: #FD3B34;
  293. .top {
  294. width: 750rpx;
  295. .bgi {
  296. display: block;
  297. width: 564rpx;
  298. height: 678rpx;
  299. margin: 53rpx auto;
  300. // position: relative;
  301. // top: -20rpx;
  302. }
  303. }
  304. .top-xtitle {
  305. font-size: 65rpx;
  306. font-family: Microsoft YaHei;
  307. font-weight: bold;
  308. color: #FFFFFF;
  309. line-height: 110rpx;
  310. text-shadow: 0px 5px 8px rgba(96, 1, 0, 0.61);
  311. text-align: center;
  312. }
  313. .top-title {
  314. font-size: 85rpx;
  315. font-family: PingFang SC;
  316. font-weight: bold;
  317. color: #FD424B;
  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. padding-bottom: 69rpx;
  325. }
  326. .pop-box {
  327. padding-top: 31rpx;
  328. margin: 0 auto;
  329. position: relative;
  330. z-index: 99;
  331. width: 156rpx;
  332. height: 36rpx;
  333. font-size: 38rpx;
  334. font-family: PingFang SC;
  335. font-weight: bold;
  336. color: #FA7E67;
  337. &::after {
  338. content: '';
  339. width: 220rpx;
  340. height: 17rpx;
  341. background: #FDCBC2;
  342. opacity: 0.26;
  343. position: absolute;
  344. bottom: -35rpx;
  345. left: -40rpx;
  346. }
  347. }
  348. .red-box {
  349. padding-top: 31rpx;
  350. margin: 0 auto ;
  351. position: relative;
  352. z-index: 99;
  353. width: 156rpx;
  354. height: 36rpx;
  355. font-size: 38rpx;
  356. font-family: PingFang SC;
  357. font-weight: bold;
  358. color: #FA7E67;
  359. &::after {
  360. content: '';
  361. width: 220rpx;
  362. height: 17rpx;
  363. background: #FDCBC2;
  364. opacity: 0.26;
  365. position: absolute;
  366. bottom: -35rpx;
  367. left: -40rpx;
  368. }
  369. }
  370. .red-box2 {
  371. position: relative;
  372. width: 405rpx;
  373. line-height: 66rpx;
  374. text-align: center;
  375. background: linear-gradient(0deg, #c90f1b, #f14d33);
  376. border-radius: 10rpx;
  377. font-size: 30rpx;
  378. font-weight: 500;
  379. color: #ffffff;
  380. margin: -80rpx auto 0;
  381. position: relative;
  382. z-index: 1;
  383. }
  384. .pop-list {
  385. width: 686rpx;
  386. background: #ffffff;
  387. border-radius: 29rpx;
  388. position: relative;
  389. margin: -33rpx auto 78rpx;
  390. padding: 150rpx 0rpx 30rpx 30rpx;
  391. display: flex;
  392. flex-wrap: wrap;
  393. box-shadow: 0px 10rpx 20rpx 0px rgba(254, 0, 8, 0.28);
  394. .list-box1 {
  395. text-align: center;
  396. margin-right: 30rpx;
  397. margin-bottom: 30rpx;
  398. .list-top {
  399. width: 100rpx;
  400. height: 100rpx;
  401. .avatar-img {
  402. width: 100rpx;
  403. height: 100rpx;
  404. border-radius: 50%;
  405. }
  406. }
  407. .nickname {
  408. margin-top: 12rpx;
  409. }
  410. }
  411. }
  412. .list-box {
  413. width: 686rpx;
  414. background: #ffffff;
  415. border-radius: 29rpx;
  416. position: relative;
  417. margin: -33rpx auto 0;
  418. padding: 100rpx 30rpx 0rpx 30rpx;
  419. display: flex;
  420. flex-wrap: wrap;
  421. box-shadow: 0px 10rpx 20rpx 0px rgba(254, 0, 8, 0.28);
  422. .upload-box {
  423. width: 100%;
  424. height: 290rpx;
  425. background: #ffffff;
  426. // border: 1px solid #E63931;
  427. border-radius: 15rpx;
  428. display: flex;
  429. flex-direction: column;
  430. padding-top: 24rpx;
  431. margin: 0 auto 50rpx;
  432. .upload-left {
  433. font-weight: 400;
  434. color: #000;
  435. text {
  436. color: #FD424B;
  437. font-size: 30rpx;
  438. }
  439. }
  440. .upload-right {
  441. margin-top: 16rpx;
  442. width: 100%;
  443. height: 100%;
  444. border: 1px solid #888888;
  445. border-radius: 15rpx;
  446. flex: 1;
  447. display: flex;
  448. align-items: center;
  449. justify-content: center;
  450. .upload-img {
  451. width: 102rpx;
  452. height: 102rpx;
  453. // border: 1px solid #888888;
  454. // border-radius: 3rpx;
  455. // width: 133rpx;
  456. // height: 133rpx;
  457. // margin-top: 44rpx;
  458. }
  459. }
  460. }
  461. .list {
  462. display: flex;
  463. flex-direction: column;
  464. align-items: center;
  465. width: 100%;
  466. margin-top: 32rpx;
  467. // height: 133rpx;
  468. .list-left {
  469. width: 100%;
  470. text-align: left;
  471. color: #000;
  472. text {
  473. color: #FD424B;
  474. font-size: 30rpx;
  475. }
  476. }
  477. input {
  478. height: 66rpx;
  479. // line-height: 66rpx;
  480. margin-top: 32rpx;
  481. // height: 88rpx;
  482. }
  483. .list-input {
  484. padding-left: 24rpx;
  485. // margin: 12rpx 0 ;
  486. line-height: 66rpx;
  487. display: flex;
  488. align-items: center;
  489. width: 100%;
  490. font-size: 26rpx;
  491. flex: 1;
  492. color: #000;
  493. border: 1rpx solid #929292;
  494. border-radius: 15rpx;
  495. text-align: left;
  496. .input-placeholder {
  497. height: 70rpx;
  498. color: #929292;
  499. font-size: 26rpx;
  500. }
  501. }
  502. .box-right {
  503. display: flex;
  504. align-items: center;
  505. padding-left: 24rpx;
  506. height: 66rpx;
  507. line-height: 66rpx;
  508. border: 1rpx solid #f3afad;
  509. border-radius: 22rpx;
  510. margin: 32rpx 36rpx 0 36rpx;
  511. width: 96%;
  512. font-size: 36rpx;
  513. color: #ff9797;
  514. text-align: left;
  515. line-height: 1;
  516. }
  517. }
  518. }
  519. .sub {
  520. width: 690rpx;
  521. height: 83rpx;
  522. background: #FF5056;
  523. border-radius: 42rpx;
  524. font-size: 32rpx;
  525. font-family: PingFang SC;
  526. font-weight: 500;
  527. color: #FFFFFF;
  528. line-height: 83rpx;
  529. text-align: center;
  530. margin: 53rpx auto 60rpx;
  531. &.action {
  532. background: #999999;
  533. }
  534. }
  535. }
  536. </style>