user.vue 9.6 KB

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