user.vue 10 KB

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