user.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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></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">
  21. <view class="item-left flex">
  22. <image src="" 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="" 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="" 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="" 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="" 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. }
  205. }
  206. </script>
  207. <style lang="scss">
  208. page {
  209. height: 100%;
  210. background: #fff;
  211. }
  212. .content {
  213. line-height: 1;
  214. background-color: #fff;
  215. .top {
  216. width: 750rpx;
  217. height: 312rpx;
  218. background-color: #fa7e67;
  219. display: flex;
  220. flex-direction: column;
  221. align-items: center;
  222. padding-left: 55rpx;
  223. align-items: center;
  224. justify-content: center;
  225. .avater {
  226. width: 150rpx;
  227. height: 150rpx;
  228. margin-right: 28rpx;
  229. .avater-img {
  230. width: 100%;
  231. height: 100%;
  232. border-radius: 50%;
  233. }
  234. }
  235. .name-box {
  236. // flex: 1;
  237. padding-top: 25rpx;
  238. .name-top {
  239. font-size: 42rpx;
  240. font-weight: 400;
  241. margin-bottom: 15rpx;
  242. font-size: 32rpx;
  243. font-family: PingFang SC;
  244. font-weight: 500;
  245. color: #FFFFFF;
  246. }
  247. .name-bottom{
  248. margin-top: 16rpx;
  249. display: flex;
  250. align-items: center;
  251. // justify-content: center;
  252. .nameInfo{
  253. color: #FFFFFF;
  254. padding: 6rpx 16rpx;
  255. border: 1rpx solid #FFFFFF;
  256. border-radius: 12rpx;
  257. // background-color: pink;
  258. }
  259. }
  260. .name-footbox {
  261. .name-foot {
  262. text-align: center;
  263. font-size: 22rpx;
  264. font-weight: 400;
  265. color: #FFFFFF;
  266. background: rgba(255, 255, 255, 0.2);
  267. border: 1px solid #FFFFFF;
  268. border-radius: 20rpx;
  269. padding: 3rpx 13rpx;
  270. }
  271. }
  272. }
  273. }
  274. .center-box {
  275. width: 687rpx;
  276. // height: 235px;
  277. background: #FFE8E8;
  278. border-radius: 16rpx;
  279. margin: -90rpx auto 0;
  280. .center-top {
  281. width: 687rpx;
  282. height: 80rpx;
  283. background: #FFFFFF;
  284. border-radius: 16rpx 16rpx 0 0;
  285. display: flex;
  286. align-items: center;
  287. padding-left: 30rpx;
  288. .top-left {
  289. width: 126rpx;
  290. line-height: 32rpx;
  291. text-align: center;
  292. background: linear-gradient(0deg, #C90F1B, #F14D33);
  293. font-size: 22rpx;
  294. font-weight: 400;
  295. color: #FFFFFF;
  296. border-radius: 20rpx;
  297. margin-right: 10rpx;
  298. }
  299. .top-right {
  300. font-size: 22rpx;
  301. font-weight: 400;
  302. color: #CB151D;
  303. }
  304. }
  305. .center-foot {
  306. height: 155rpx;
  307. display: flex;
  308. .foot-list {
  309. flex: 1;
  310. text-align: center;
  311. padding-top: 20rpx;
  312. .list-top {
  313. font-size: 39rpx;
  314. font-weight: 400;
  315. color: #CB141D;
  316. line-height: 58rpx;
  317. }
  318. .list-foot {
  319. font-size: 39rpx;
  320. font-weight: 400;
  321. color: #666666;
  322. line-height: 58rpx;
  323. }
  324. }
  325. }
  326. }
  327. .tt {
  328. display: flex;
  329. flex-wrap: wrap;
  330. padding-left:32rpx;
  331. .tt-box {
  332. width: 206rpx;
  333. height: 206rpx;
  334. border-radius: 10rpx;
  335. display: flex;
  336. flex-direction: column;
  337. align-items: center;
  338. justify-content: center;
  339. margin-right: 35rpx;
  340. margin-bottom: 30rpx;
  341. image {
  342. width: 64rpx;
  343. height: 64rpx;
  344. }
  345. .tt-txt {
  346. font-size: 24rpx;
  347. font-family: PingFang SC;
  348. font-weight: bold;
  349. color: #5A5A74;
  350. padding-top: 35rpx;
  351. }
  352. }
  353. }
  354. }
  355. .nav-wrapper {
  356. width: 678rpx;
  357. height: 560rpx;
  358. background: #FFFFFF;
  359. box-shadow: 0px 2rpx 24rpx 0rpx rgba(0, 0, 0, 0.06);
  360. border-radius: 20rpx;
  361. margin: 32rpx auto 0;
  362. color: #555555;
  363. .nav-item {
  364. height: 115rpx;
  365. border-bottom: 1rpx #F6F6F6 solid;
  366. &:last-of-type {
  367. border-bottom: none;
  368. }
  369. justify-content: space-between;
  370. align-items: center;
  371. padding: 0 36rpx 0 40rpx;
  372. .item-left {
  373. align-items: center;
  374. image {
  375. background-color: red;
  376. }
  377. .img1 {
  378. width: 34rpx;
  379. height: 34rpx;
  380. margin-right: 21rpx;
  381. }
  382. .img2 {
  383. width: 36rpx;
  384. height: 32rpx;
  385. margin-right: 19rpx;
  386. }
  387. .img3 {
  388. width: 28rpx;
  389. height: 36rpx;
  390. margin-right: 25rpx;
  391. }
  392. .img4 {
  393. width: 36rpx;
  394. height: 28rpx;
  395. margin-right: 19rpx;
  396. }
  397. .title {
  398. font-size: 32rpx;
  399. font-family: PingFang SC;
  400. font-weight: 500;
  401. color: #555555;
  402. }
  403. }
  404. .item-right {
  405. line-height: 115rpx;
  406. }
  407. }
  408. }
  409. </style>