user.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <view class="content">
  3. <view class="top"></view>
  4. <view class="top-box">
  5. <view class="user-box">
  6. <view class="avatar" @click="navTo('/pages/user/userinfo')">
  7. <image :src="userInfo.avatar" mode="" class="avatar-img"></image>
  8. </view>
  9. <view class="user-right">
  10. <view class="nickname">
  11. {{userInfo.nickname}}
  12. </view>
  13. <view class="xin-box" v-if="userInfo.level > 0">
  14. <image v-for="ls in userInfo.level" src="../../static/icon/xin.png" mode="" class="xin-img"></image>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="list-box">
  19. <view class="item-box">
  20. <view class="box-top">{{ userInfo.all_integral || '0' }}</view>
  21. <view class="box-foot">累计积分</view>
  22. </view>
  23. <view class="item-box">
  24. <view class="box-top">{{ userInfo.help_num || '0' }}</view>
  25. <view class="box-foot">帮助项目/个</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="menu-box">
  30. <view class="menu" @click="tohelp">
  31. <view class="menu-top" style="width: 54rpx;height: 54rpx;">
  32. <image src="../../static/icon/user4.png" mode="" style="width: 100%;height: 100%;" class="user-img"></image>
  33. </view>
  34. <view class="menu-foot">求救记录</view>
  35. </view>
  36. <view class="menu" @click="torreco">
  37. <view class="menu-top" style="width: 58rpx;height: 52rpx;">
  38. <image src="../../static/icon/user5.png" mode="" style="width: 100%;height: 100%;" class="user-img"></image>
  39. </view>
  40. <view class="menu-foot">救援记录</view>
  41. </view>
  42. <view class="menu" @click="commonaddress">
  43. <view class="menu-top" style="width: 44rpx;height: 54rpx;">
  44. <image src="../../static/icon/user6.png" mode="" style="width: 100%;height: 100%;" class="user-img"></image>
  45. </view>
  46. <view class="menu-foot">常用地址</view>
  47. </view>
  48. <view class="menu" @click="navTo('/pages/applyHelp/cation')">
  49. <view class="menu-top" style="width: 60rpx;height: 50rpx;">
  50. <image src="../../static/icon/user1.png" mode="" style="width: 100%;height: 100%;" class="user-img"></image>
  51. </view>
  52. <view class="menu-foot">申请帮扶</view>
  53. </view>
  54. <view class="menu" @click="navTo('/pages/user/myFu')">
  55. <view class="menu-top" style="width: 54rpx;height: 54rpx;">
  56. <image src="../../static/icon/user2.png" mode="" style="width: 100%;height: 100%;" class="user-img"></image>
  57. </view>
  58. <view class="menu-foot">我的帮扶</view>
  59. </view>
  60. <view class="menu" @click="navTo('/pages/user/integral')">
  61. <view class="menu-top" style="width: 66rpx;height: 58rpx;">
  62. <image src="../../static/icon/user3.png" mode="" style="width: 100%;height: 100%;" class="user-img"></image>
  63. </view>
  64. <view class="menu-foot">积分记录</view>
  65. </view>
  66. <view class="menu" @click="navTo('/pages/fu/getPoints')">
  67. <view class="menu-top" style="width: 82rpx;height: 57rpx;">
  68. <image src="../../static/icon/user7.png" mode="" style="width: 100%;height: 100%;" class="user-img"></image>
  69. </view>
  70. <view class="menu-foot">等级说明</view>
  71. </view>
  72. <view class="menu" @click="navTo('/pages/user/userinfo')">
  73. <view class="menu-top" style="width: 58rpx;height: 54rpx;">
  74. <image src="../../static/icon/user8.png" mode="" style="width: 100%;height: 100%;" class="user-img"></image>
  75. </view>
  76. <view class="menu-foot">设置</view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. <script>
  82. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  83. import { mapState, mapMutations } from 'vuex';
  84. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  85. import { detail_training } from '@/api/train.js';
  86. import { userinfo } from '@/api/user.js';
  87. // #ifdef H5
  88. import { weixindata } from '@/utils/wxAuthorized';
  89. // #endif
  90. export default {
  91. components: {
  92. uniPopup
  93. },
  94. data() {
  95. return {
  96. common_address: '',
  97. show: false, // 弹窗开关
  98. // name:'',
  99. // signDate:'',
  100. // id:0,
  101. // is_over:0
  102. }
  103. },
  104. onShow() {
  105. console.log(this);
  106. // 判断是否已经登录
  107. if (this.hasLogin) {
  108. this.loadBaseData();
  109. } else {
  110. saveUrl();
  111. uni.showModal({
  112. title: '登录',
  113. content: '您未登录,是否马上登陆?',
  114. success: e => {
  115. if (e.confirm) {
  116. interceptor();
  117. }
  118. },
  119. fail: e => {
  120. console.log(e);
  121. }
  122. });
  123. }
  124. this.type = this.userInfo.type;
  125. this.common_address = this.userInfo.common_address
  126. console.log('点前保存的地址', this.common_address)
  127. // 保存当前页面
  128. },
  129. computed: {
  130. ...mapState('user', ['hasLogin', 'userInfo'])
  131. },
  132. methods: {
  133. ...mapMutations('user', ['setUserInfo']),
  134. open() {
  135. this.show = true;
  136. },
  137. navTo(url) {
  138. if (!this.hasLogin) {
  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. return;
  152. }
  153. uni.navigateTo({
  154. url,
  155. fail(e) {
  156. uni.switchTab({
  157. url
  158. })
  159. }
  160. });
  161. },
  162. loadBaseData() {
  163. userinfo({}).then(({
  164. data
  165. }) => {
  166. this.setUserInfo(data);
  167. });
  168. // #ifdef H5
  169. weixindata();
  170. // #endif
  171. detail_training({
  172. id: this.id,
  173. }).then(({
  174. data
  175. }) => {
  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. url: '/pages/form/certificates?name=' + this.name + '&signDate=' + this.signDate
  200. })
  201. }
  202. }
  203. }
  204. </script>
  205. <style lang="scss">
  206. .content {
  207. line-height: 1;
  208. .top {
  209. width: 750rpx;
  210. height: 450rpx;
  211. background-color: #FF727E;
  212. }
  213. .top-box {
  214. width: 690rpx;
  215. height: 360rpx;
  216. background: #FFFFFF;
  217. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  218. border-radius: 12rpx;
  219. margin: -240rpx auto 0;
  220. .user-box {
  221. display: flex;
  222. padding: 40rpx 40rpx 0;
  223. .avatar {
  224. width: 110rpx;
  225. height: 110rpx;
  226. margin-right: 30rpx;
  227. .avatar-img {
  228. width: 110rpx;
  229. height: 110rpx;
  230. border-radius: 50%;
  231. }
  232. }
  233. .user-right {
  234. padding-top: 20rpx;
  235. .nickname {
  236. font-size: 32rpx;
  237. font-weight: 500;
  238. color: #030303;
  239. margin-bottom: 20rpx;
  240. }
  241. .xin-box {
  242. display: flex;
  243. align-items: center;
  244. .xin-img {
  245. width: 37rpx;
  246. height: 32rpx;
  247. margin-right: 6rpx;
  248. }
  249. }
  250. }
  251. }
  252. .list-box {
  253. display: flex;
  254. padding-top: 70rpx;
  255. .item-box {
  256. width: 375rpx;
  257. text-align: center;
  258. .box-top {
  259. font-size: 56rpx;
  260. font-weight: 500;
  261. color: #222222;
  262. margin-bottom: 20rpx;
  263. }
  264. .box-foot {
  265. font-size: 24rpx;
  266. font-weight: 500;
  267. color: #666666;
  268. }
  269. }
  270. }
  271. }
  272. .menu-box {
  273. display: flex;
  274. flex-wrap: wrap;
  275. padding: 80rpx 0rpx 0;
  276. .menu {
  277. text-align: center;
  278. width: 250rpx;
  279. margin-bottom: 70rpx;
  280. .menu-top {
  281. margin: 0 auto;
  282. }
  283. .menu-foot {
  284. font-size: 24rpx;
  285. font-weight: 500;
  286. color: #222222;
  287. margin-top: 25rpx;
  288. }
  289. }
  290. }
  291. }
  292. .jifen-box {
  293. background: #FFFFFF;
  294. padding: 70rpx 50rpx 80rpx;
  295. border-radius: 12rpx;
  296. .now-vip {
  297. .top-vip {
  298. display: flex;
  299. align-items: center;
  300. justify-content: space-between;
  301. font-size: $font-base;
  302. font-family: PingFang SC;
  303. font-weight: 500;
  304. color: #666666;
  305. line-height: 1;
  306. }
  307. .top-num {
  308. display: flex;
  309. align-items: center;
  310. justify-content: space-between;
  311. font-size: 36rpx;
  312. font-family: PingFang SC;
  313. font-weight: 500;
  314. color: #222222;
  315. line-height: 1;
  316. margin-top: 22rpx;
  317. .num-dj {
  318. visibility: hidden;
  319. }
  320. }
  321. .line-progress {
  322. padding: 30rpx 10rpx 24rpx;
  323. }
  324. .vip-icon {
  325. display: flex;
  326. align-items: center;
  327. justify-content: space-between;
  328. font-size: $font-base;
  329. font-family: PingFang SC;
  330. font-weight: 500;
  331. color: #666666;
  332. }
  333. }
  334. .cztx-box {
  335. margin-top: 90rpx;
  336. .cztx-tit {
  337. font-size: 36rpx;
  338. font-family: PingFang SC;
  339. font-weight: 500;
  340. color: #222222;
  341. }
  342. .cztx-vip-box {
  343. .experience-box {
  344. display: flex;
  345. align-items: flex-end;
  346. justify-content: space-around;
  347. padding: 14rpx 0 0;
  348. .exper-text {
  349. font-size: $font-sm;
  350. font-family: PingFang SC;
  351. font-weight: 500;
  352. color: #222222;
  353. margin-bottom: 30rpx;
  354. }
  355. .exper1 {
  356. display: flex;
  357. flex-direction: column;
  358. align-items: center;
  359. .line-exper1 {
  360. width: 14rpx;
  361. height: 26rpx;
  362. background: #E62129;
  363. border-radius: 7rpx 7rpx 0px 0px;
  364. margin-bottom: 24rpx;
  365. }
  366. .exper1-img {
  367. width: 30rpx;
  368. height: 26rpx;
  369. }
  370. }
  371. .exper2 {
  372. display: flex;
  373. flex-direction: column;
  374. align-items: center;
  375. .line-exper2 {
  376. width: 14rpx;
  377. height: 104rpx;
  378. background: #EDEDED;
  379. border-radius: 7rpx 7rpx 0px 0px;
  380. margin-bottom: 24rpx;
  381. }
  382. .exper2-img {
  383. width: 50rpx;
  384. height: 32rpx;
  385. }
  386. }
  387. .exper3 {
  388. display: flex;
  389. flex-direction: column;
  390. align-items: center;
  391. .line-exper3 {
  392. width: 14rpx;
  393. height: 182rpx;
  394. background: #EDEDED;
  395. border-radius: 7rpx 7rpx 0px 0px;
  396. margin-bottom: 24rpx;
  397. }
  398. .exper3-img {
  399. width: 68rpx;
  400. height: 32rpx;
  401. }
  402. }
  403. .exper4 {
  404. display: flex;
  405. flex-direction: column;
  406. align-items: center;
  407. .line-exper4 {
  408. width: 14rpx;
  409. height: 260rpx;
  410. background: #EDEDED;
  411. border-radius: 7rpx 7rpx 0px 0px;
  412. margin-bottom: 24rpx;
  413. }
  414. .exper4-img {
  415. width: 87rpx;
  416. height: 32rpx;
  417. }
  418. }
  419. }
  420. .cztx-experience {
  421. margin-top: 50rpx;
  422. text-align: center;
  423. font-size: $font-sm;
  424. font-family: PingFang SC;
  425. font-weight: 500;
  426. color: #222222;
  427. }
  428. }
  429. }
  430. }
  431. </style>