user.vue 10 KB

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