user.vue 9.8 KB

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