user.vue 9.9 KB

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