user.vue 9.5 KB

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