task.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <view class="">
  3. <view class="top-wrap">
  4. <view class="user-calling">
  5. <view class="calling">
  6. <image class="avatar" :src="userInfo.avatar" mode="" v-if="userInfo.avatar"></image>
  7. <image class="avatar" src="../../static/error/missing-face.png" mode="" v-else></image>
  8. <view class="u-name">
  9. {{userInfo.phone}}
  10. </view>
  11. <image class="user-shop-icon" v-if="pUser.zero_level" :src="pUser.zero_level.icon" mode=""></image>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="flex banne">
  16. <image src="../../static/img/jfc.png" mode="" @click="navto('/pages/zero/award?type=9')"></image>
  17. <image src="../../static/img/scjf.png" mode="" @click="navto('/pages/zero/award?type=10')"></image>
  18. </view>
  19. <view class="gg-wrap flex">
  20. <image src="../../static/icon/jiang.png" mode=""></image>
  21. <view class="gg-tit">
  22. <view class="tit">
  23. 观看视频赚阅读积分
  24. </view>
  25. <view class="">
  26. 观看可获得阅读积分
  27. </view>
  28. </view>
  29. <view class="gg-btn" @click="navto('/pages/zero/ren')">
  30. 去观看
  31. </view>
  32. </view>
  33. <view class="bottom-list" v-for="key in navList">
  34. <view class="flex list-item">
  35. <view class="logo-wrap" :style="{'background-color': key.bgc}">
  36. <image :src="key.img" mode="" class="logo"></image>
  37. </view>
  38. <view class="much">
  39. <view class="">
  40. {{key.name}}
  41. </view>
  42. <view class="val">
  43. 余额:{{pUser[key.val]*1 || '0'}}
  44. </view>
  45. </view>
  46. <!-- <view class="btn" v-if="key.hz" @click="navto('/pages/zero/jfhz?type=3')">
  47. 兑换余额宝
  48. </view> -->
  49. <view class="btn" v-if="key.gs" @click="navto('/pages/zero/gs')">
  50. 挂售
  51. </view>
  52. <view class="btn" v-if="key.dy" @click="navto('/pages/zero/jfhz?type=0')">
  53. 兑换阅读积分
  54. </view>
  55. <view class="btn" v-if="key.agent" @click="navto('/pages/zero/jfhz?type=1')">
  56. 兑换复投积分
  57. </view>
  58. <view class="btn" v-if="key.ygs" @click="navto('/pages/zero/gs?type=1')">
  59. 挂售
  60. </view>
  61. <view class="btn" v-if="key.ye" @click="navto('/pages/zero/jfhz?type=2')">
  62. 兑换阅读积分
  63. </view>
  64. <view class="more" @click="navto('/pages/user/sz?type=' + key.type)">
  65. 明细
  66. </view>
  67. <image src="../../static/icon/back.png" mode="" class="black"></image>
  68. </view>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import {
  74. mapState,
  75. mapMutations
  76. } from 'vuex';
  77. import {
  78. passUser
  79. } from '@/api/zero.js'
  80. import {
  81. getUserInfo,
  82. getLevelList
  83. } from '@/api/user.js';
  84. export default {
  85. data() {
  86. return {
  87. pUser: {},
  88. listList: [],
  89. navList: [{
  90. name: '阅读积分',
  91. val: 'points',
  92. type: 8,
  93. hz: true,
  94. gs: true,
  95. dy: false,
  96. agent: false,
  97. img: '../../static/icon/task1.png',
  98. bgc: '#fef2f2'
  99. },
  100. {
  101. name: '通证',
  102. val: 'pass',
  103. type: 9,
  104. gs: false,
  105. hz: false,
  106. dy: true,
  107. agent: false,
  108. img: '../../static/icon/task2.png',
  109. bgc: '#fcf7e3'
  110. },
  111. {
  112. name: '商场积分',
  113. val: 'integral',
  114. type: 10,
  115. hz: false,
  116. dy: false,
  117. agent: true,
  118. img: '../../static/icon/task3.png',
  119. bgc: '#f7ecfc'
  120. },
  121. // {
  122. // name: '余额宝',
  123. // val: 'freeze_points',
  124. // type: 11,
  125. // hz: false,
  126. // dy: false,
  127. // agent: false,
  128. // ye: true,
  129. // ygs: true,
  130. // img: '../../static/icon/task3.png',
  131. // bgc: '#f7ecfc'
  132. // },
  133. ]
  134. }
  135. },
  136. computed: {
  137. ...mapState('user', ['userInfo', 'hasLogin'])
  138. },
  139. onShow() {
  140. this.getLevelList()
  141. this.passUser()
  142. },
  143. methods: {
  144. passUser() {
  145. passUser().then(res => {
  146. // console.log(res);
  147. this.pUser = res.data
  148. })
  149. },
  150. getLevelList() {
  151. getLevelList().then(res => {
  152. this.listList = res.data.list
  153. })
  154. },
  155. showLevel(val) {
  156. let data = this.listList.find(item => item.grade == val)
  157. console.log(data);
  158. if (data) {
  159. return data.icon
  160. } else {
  161. return ''
  162. }
  163. },
  164. navto(url) {
  165. uni.navigateTo({
  166. url,
  167. fail() {
  168. uni.switchTab({
  169. url
  170. })
  171. }
  172. })
  173. },
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. page {
  179. background-color: #fff;
  180. min-height: 100%;
  181. }
  182. .top-wrap {
  183. // height: 260rpx;
  184. padding-top: 220rpx;
  185. background-color: #282623;
  186. }
  187. .user-calling {
  188. height: 115rpx;
  189. border-radius: 50rpx 50rpx 0 0;
  190. background-color: #fff;
  191. position: relative;
  192. }
  193. .calling {
  194. width: 720rpx;
  195. height: 190rpx;
  196. position: absolute;
  197. left: 0;
  198. right: 0;
  199. top: -110rpx;
  200. background-image: url('../../static/img/calling.png');
  201. background-size: contain;
  202. margin: auto;
  203. .avatar {
  204. width: 106rpx;
  205. height: 106rpx;
  206. border-radius: 50%;
  207. position: absolute;
  208. top: 40rpx;
  209. left: 48rpx;
  210. }
  211. .u-name {
  212. position: absolute;
  213. top: 57rpx;
  214. left: 193rpx;
  215. font-size: 36rpx;
  216. font-weight: bold;
  217. color: #773B00;
  218. }
  219. .user-shop-icon {
  220. position: absolute;
  221. top: 110rpx;
  222. left: 193rpx;
  223. width: 120rpx;
  224. height: 40rpx;
  225. }
  226. }
  227. .banne {
  228. justify-content: center;
  229. padding: 20rpx 0;
  230. background-color: #fff;
  231. image {
  232. width: 340rpx;
  233. height: 204rpx;
  234. margin: 0 8rpx;
  235. }
  236. }
  237. .bottom-list {
  238. .list-item {
  239. width: 670rpx;
  240. height: 131rpx;
  241. // background-color: red;
  242. border-bottom: 1px solid #E8E8E8;
  243. margin: auto;
  244. .logo-wrap {
  245. width: 81rpx;
  246. height: 81rpx;
  247. border-radius: 50%;
  248. display: flex;
  249. justify-content: center;
  250. align-items: center;
  251. .logo {
  252. width: 40rpx;
  253. height: 40rpx;
  254. }
  255. }
  256. .much {
  257. padding-left: 14rpx;
  258. flex-grow: 1;
  259. font-size: 30rpx;
  260. font-weight: bold;
  261. color: #333333;
  262. .val {
  263. padding-top: 15rpx;
  264. font-size: 22rpx;
  265. font-weight: 500;
  266. color: #999999;
  267. }
  268. }
  269. .btn {
  270. // width: 127rpx;
  271. height: 52rpx;
  272. padding: 0 10px;
  273. border: 2px solid #ff5050;
  274. border-radius: 26rpx;
  275. display: flex;
  276. justify-content: center;
  277. align-items: center;
  278. font-size: 26rpx;
  279. font-weight: 500;
  280. color: #ff5050;
  281. margin-right: 10rpx;
  282. }
  283. .more {
  284. font-size: 24rpx;
  285. font-weight: 500;
  286. color: #999999;
  287. padding-right: 14rpx;
  288. }
  289. .black {
  290. width: 16rpx;
  291. height: 27rpx;
  292. }
  293. }
  294. }
  295. .gg-wrap {
  296. width: 702rpx;
  297. height: 140rpx;
  298. background: #FEFEFE;
  299. box-shadow: 0rpx 0rpx 29rpx 0rpx rgba(231, 71, 68, 0.09);
  300. border-radius: 4rpx;
  301. margin: 20rpx auto;
  302. padding: 30rpx 40rpx 40rpx 90rpx;
  303. position: relative;
  304. image {
  305. position: absolute;
  306. top: 0;
  307. left: 26rpx;
  308. width: 45rpx;
  309. height: 60rpx;
  310. }
  311. .gg-tit {
  312. font-size: 24rpx;
  313. font-weight: 500;
  314. color: #999999;
  315. .tit {
  316. padding-bottom: 20rpx;
  317. font-size: 32rpx;
  318. font-weight: bold;
  319. color: #333333;
  320. }
  321. }
  322. .gg-btn {
  323. width: 125rpx;
  324. height: 46rpx;
  325. background: linear-gradient(60deg, #FF8F3B, #FF3106);
  326. border-radius: 23rpx;
  327. font-size: 24rpx;
  328. font-weight: 500;
  329. color: #FFFFFF;
  330. text-align: center;
  331. line-height: 45rpx;
  332. }
  333. }
  334. </style>