user.vue 8.3 KB

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