user.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="avater">
  5. <image :src="userInfo.avatar" class="avater-img" mode="" v-if="userInfo.avatar"></image>
  6. <image src="../../static/img/002.png" mode="" v-else class="avater-img"></image>
  7. </view>
  8. <view class="name-box">
  9. <view class="name-top">
  10. {{userInfo.nickname}}
  11. </view>
  12. <view class="name-phone">
  13. {{getPhone}}
  14. </view>
  15. </view>
  16. </view>
  17. <view class="nav-wrapper">
  18. <view class="nav-item flex" @click="tohelp">
  19. <view class="item-left flex">
  20. <image src="../../static/icon/i6.png" mode="" class="img1"></image>
  21. <view class="title">求救记录</view>
  22. </view>
  23. <view class="item-right">
  24. <image src="../../static/index/right.png" mode=""></image>
  25. </view>
  26. </view>
  27. <view class="nav-item flex" @click="torreco">
  28. <view class="item-left flex">
  29. <image src="../../static/icon/u-help.png" mode="" class="img2"></image>
  30. <view class="title">救援记录</view>
  31. </view>
  32. <view class="item-right">
  33. <image src="../../static/index/right.png" mode=""></image>
  34. </view>
  35. </view>
  36. <view class="nav-item flex" @click="getAdress">
  37. <view class="item-left flex">
  38. <image src="../../static/index/user13.png" mode="" class="img2"></image>
  39. <view class="title">常用地址</view>
  40. </view>
  41. <view class="item-right">
  42. <image src="../../static/index/right.png" mode=""></image>
  43. </view>
  44. </view>
  45. <!-- <view class="nav-item flex" @click="navTo('/pages/user/myaid')">
  46. <view class="item-left flex">
  47. <image src="../../static/icon/u-jz.png" mode="" class="img1"></image>
  48. <view class="title">捐赠记录</view>
  49. </view>
  50. <view class="item-right">
  51. >
  52. </view>
  53. </view> -->
  54. <!-- <view class="nav-item flex" @click="tojkjl">
  55. <view class="item-left flex">
  56. <image src="../../static/icon/u-jk.png" mode="" class="img1"></image>
  57. <view class="title">捐款记录</view>
  58. </view>
  59. <view class="item-right">
  60. >
  61. </view>
  62. </view> -->
  63. <view class="nav-item flex" @click="tocertificates">
  64. <view class="item-left flex">
  65. <image src="../../static/icon/i9.png" mode="" class="img4"></image>
  66. <view class="title">我的证书</view>
  67. </view>
  68. <view class="item-right">
  69. <image src="../../static/index/right.png" mode=""></image>
  70. </view>
  71. </view>
  72. <!-- <view class="nav-item flex" @click="navTo('/pages/applyHelp/cation')" >
  73. <view class="item-left flex">
  74. <image src="../../static/icon/i7.png" mode="" class="img4"></image>
  75. <view class="title">申请帮扶</view>
  76. </view>
  77. <view class="item-right">
  78. >
  79. </view>
  80. </view> -->
  81. <!-- <view class="nav-item flex" @click="navTo('/pages/user/myFu')" >
  82. <view class="item-left flex">
  83. <image src="../../static/icon/u-m-f.png" mode="" class="img4"></image>
  84. <view class="title">我的帮扶</view>
  85. </view>
  86. <view class="item-right">
  87. >
  88. </view>
  89. </view> -->
  90. <!-- @click="loginout" -->
  91. <!-- <view class="nav-item flex" @click="navTo('/pages/user/userSet')" >
  92. <view class="item-left flex">
  93. <image src="../../static/icon/u-set.png" mode="" class="img4"></image>
  94. <view class="title">退出</view>
  95. </view>
  96. <view class="item-right">
  97. >
  98. </view>
  99. </view> -->
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import {
  105. mapState,
  106. mapMutations
  107. } from 'vuex';
  108. import {
  109. saveUrl,
  110. interceptor
  111. } from '@/utils/loginUtils.js';
  112. import {
  113. detail_training
  114. } from '@/api/train.js';
  115. import {
  116. userinfo,
  117. logout
  118. } from '@/api/user.js';
  119. // #ifdef H5
  120. import {
  121. weixindata
  122. } from '@/utils/wxAuthorized';
  123. // #endif
  124. export default {
  125. data() {
  126. return {
  127. common_address: '',
  128. name: '',
  129. signDate: '',
  130. id: 0,
  131. is_over: 0,
  132. }
  133. },
  134. onShow() {
  135. console.log(this);
  136. // 判断是否已经登录
  137. if (this.hasLogin) {
  138. this.loadBaseData();
  139. } else {
  140. saveUrl();
  141. uni.showModal({
  142. title: '登录',
  143. content: '您未登录,是否马上登陆?',
  144. success: e => {
  145. if (e.confirm) {
  146. interceptor();
  147. }
  148. },
  149. fail: e => {
  150. console.log(e);
  151. }
  152. });
  153. }
  154. this.type = this.userInfo.type;
  155. this.common_address = this.userInfo.common_address
  156. console.log(this.userInfo, 'wuwu')
  157. console.log('点前保存的地址', this.common_address)
  158. // 保存当前页面
  159. },
  160. onReady() {
  161. console.log(99999)
  162. // detail_training({
  163. // id:this.id,
  164. // }).then(({data}) => {
  165. // console.log(999,data)
  166. // this.name = data.name
  167. // this.signDate = data.add_time
  168. // this.is_over = data.is_over
  169. // })
  170. },
  171. computed: {
  172. ...mapState('user', ['hasLogin', 'userInfo']),
  173. getPhone() {
  174. return this.userInfo.mobile.substring(0, 3) + '****' + this.userInfo.mobile.substring(7)
  175. }
  176. },
  177. methods: {
  178. ...mapMutations('user', ['setUserInfo', 'logout']),
  179. loginout() {
  180. let obj = this;
  181. uni.showModal({
  182. content: '确定要退出登录么',
  183. success: e => {
  184. if (e.confirm) {
  185. logout({}).then(e => {
  186. obj.logout();
  187. uni.switchTab({
  188. url: '/pages/index/index'
  189. })
  190. })
  191. .catch(e => {
  192. console.log(e);
  193. });
  194. }
  195. }
  196. });
  197. },
  198. tojkjl() {
  199. uni.navigateTo({
  200. url: '/pages/user/jkjl'
  201. })
  202. },
  203. loadBaseData() {
  204. userinfo({}).then(({
  205. data
  206. }) => {
  207. this.setUserInfo(data);
  208. });
  209. // #ifdef H5
  210. weixindata();
  211. // #endif
  212. // detail_training({
  213. // id:this.id,
  214. // }).then(({data}) => {
  215. // console.log(9,data)
  216. // this.name = data.name
  217. // this.signDate = data.add_time
  218. // this.is_over = data.is_over
  219. // })
  220. },
  221. toMyfu() {
  222. uni.navigateTo({
  223. url: '/pages/user/myFu'
  224. })
  225. },
  226. getAdress(){
  227. uni.navigateTo({
  228. url:'/pages/applic/chooseAddress'
  229. })
  230. },
  231. torreco() {
  232. uni.navigateTo({
  233. url: '/pages/applic/rescuerecords'
  234. })
  235. },
  236. tohelp() {
  237. uni.navigateTo({
  238. url: '/pages/applic/helprecords'
  239. })
  240. },
  241. commonaddress() {
  242. uni.navigateTo({
  243. url: '/pages/applic/commonaddress?add=' + this.common_address
  244. })
  245. },
  246. tocertificates() {
  247. uni.navigateTo({
  248. // pages/form/certificatesList
  249. // url: '/pages/form/certificates?name=' + this.name + '&signDate=' + this.signDate
  250. url: '/pages/form/certificatesList'
  251. })
  252. },
  253. navTo(url) {
  254. console.log(url)
  255. uni.navigateTo({
  256. url: url
  257. })
  258. }
  259. }
  260. }
  261. </script>
  262. <style lang="scss">
  263. page {
  264. min-height: 100%;
  265. height: auto;
  266. background: #fff;
  267. }
  268. .content {
  269. line-height: 1.5;
  270. background-color: #fff;
  271. height: 100%;
  272. .top {
  273. width: 750rpx;
  274. height: 312rpx;
  275. // background-color: #fa7e67;
  276. display: flex;
  277. flex-direction: column;
  278. align-items: center;
  279. // padding-left: 55rpx;
  280. align-items: center;
  281. justify-content: center;
  282. background-image: url(../../static/img/userbg.png);
  283. background-size: 100% 100%;
  284. .avater {
  285. width: 150rpx;
  286. height: 150rpx;
  287. // margin-right: 28rpx;
  288. .avater-img {
  289. width: 100%;
  290. height: 100%;
  291. border-radius: 50%;
  292. }
  293. }
  294. .name-box {
  295. // flex: 1;
  296. padding-top: 25rpx;
  297. display: flex;
  298. flex-direction: column;
  299. align-items: center;
  300. justify-content: center;
  301. .name-top {
  302. font-size: 32rpx;
  303. font-family: PingFang SC;
  304. font-weight: 500;
  305. color: #FFFFFF;
  306. }
  307. .name-phone {
  308. font-size: 26rpx;
  309. font-family: PingFang SC;
  310. font-weight: 500;
  311. color: #FFFFFF;
  312. }
  313. .name-bottom {
  314. margin-top: 16rpx;
  315. display: flex;
  316. align-items: center;
  317. // justify-content: center;
  318. .nameInfo {
  319. color: #FFFFFF;
  320. padding: 6rpx 16rpx;
  321. border: 1rpx solid #FFFFFF;
  322. border-radius: 12rpx;
  323. // background-color: pink;
  324. }
  325. }
  326. .name-footbox {
  327. .name-foot {
  328. text-align: center;
  329. font-size: 22rpx;
  330. font-weight: 400;
  331. color: #FFFFFF;
  332. background: rgba(255, 255, 255, 0.2);
  333. border: 1px solid #FFFFFF;
  334. border-radius: 20rpx;
  335. padding: 3rpx 13rpx;
  336. }
  337. }
  338. }
  339. }
  340. .center-box {
  341. width: 687rpx;
  342. // height: 235px;
  343. background: #FFE8E8;
  344. border-radius: 16rpx;
  345. margin: -90rpx auto 0;
  346. .center-top {
  347. width: 687rpx;
  348. height: 80rpx;
  349. background: #FFFFFF;
  350. border-radius: 16rpx 16rpx 0 0;
  351. display: flex;
  352. align-items: center;
  353. padding-left: 30rpx;
  354. .top-left {
  355. width: 126rpx;
  356. line-height: 32rpx;
  357. text-align: center;
  358. background: linear-gradient(0deg, #C90F1B, #F14D33);
  359. font-size: 22rpx;
  360. font-weight: 400;
  361. color: #FFFFFF;
  362. border-radius: 20rpx;
  363. margin-right: 10rpx;
  364. }
  365. .top-right {
  366. font-size: 22rpx;
  367. font-weight: 400;
  368. color: #CB151D;
  369. }
  370. }
  371. .center-foot {
  372. height: 155rpx;
  373. display: flex;
  374. .foot-list {
  375. flex: 1;
  376. text-align: center;
  377. padding-top: 20rpx;
  378. .list-top {
  379. font-size: 39rpx;
  380. font-weight: 400;
  381. color: #CB141D;
  382. line-height: 58rpx;
  383. }
  384. .list-foot {
  385. font-size: 39rpx;
  386. font-weight: 400;
  387. color: #666666;
  388. line-height: 58rpx;
  389. }
  390. }
  391. }
  392. }
  393. .tt {
  394. display: flex;
  395. flex-wrap: wrap;
  396. padding-left: 32rpx;
  397. .tt-box {
  398. width: 206rpx;
  399. height: 206rpx;
  400. border-radius: 10rpx;
  401. display: flex;
  402. flex-direction: column;
  403. align-items: center;
  404. justify-content: center;
  405. margin-right: 35rpx;
  406. margin-bottom: 30rpx;
  407. image {
  408. width: 64rpx;
  409. height: 64rpx;
  410. }
  411. .tt-txt {
  412. font-size: 24rpx;
  413. font-family: PingFang SC;
  414. font-weight: bold;
  415. color: #5A5A74;
  416. padding-top: 35rpx;
  417. }
  418. }
  419. }
  420. }
  421. .nav-wrapper {
  422. width: 678rpx;
  423. // height: 560rpx;
  424. background: #FFFFFF;
  425. box-shadow: 0px 2rpx 24rpx 0rpx rgba(0, 0, 0, 0.06);
  426. border-radius: 20rpx;
  427. margin: 32rpx auto 0;
  428. color: #555555;
  429. .nav-item {
  430. height: 115rpx;
  431. border-bottom: 1rpx #F6F6F6 solid;
  432. &:last-of-type {
  433. border-bottom: none;
  434. }
  435. justify-content: space-between;
  436. align-items: center;
  437. padding: 0 36rpx 0 40rpx;
  438. .item-left {
  439. align-items: center;
  440. image {
  441. // background-color: red;
  442. }
  443. .img1 {
  444. width: 34rpx;
  445. height: 34rpx;
  446. margin-right: 21rpx;
  447. }
  448. .img2 {
  449. width: 36rpx;
  450. height: 32rpx;
  451. margin-right: 19rpx;
  452. }
  453. .img3 {
  454. width: 28rpx;
  455. height: 36rpx;
  456. margin-right: 25rpx;
  457. }
  458. .img4 {
  459. width: 36rpx;
  460. height: 28rpx;
  461. margin-right: 19rpx;
  462. }
  463. .title {
  464. font-size: 32rpx;
  465. font-family: PingFang SC;
  466. font-weight: 500;
  467. color: #555555;
  468. }
  469. }
  470. .item-right {
  471. width: 16rpx;
  472. height: 30rpx;
  473. image{
  474. width: 100%;
  475. height: 100%;
  476. }
  477. }
  478. }
  479. }
  480. </style>