user.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. <template>
  2. <view class="container">
  3. <view class="top">
  4. <view class="my">{{$t('home.d4')}}</view>
  5. <view class="userinfo flex">
  6. <view class="flex" @click="navTo('/pages/user/set')">
  7. <image class="image margin-r-10" :src="userInfo.avatar || '/static/error/missing-face.png'" mode="scaleToFill">
  8. </image>
  9. <view class="info">
  10. <view class="infor margin-b-20">{{ userInfo.nickname || '游客' }}</view>
  11. <view class="uservip">
  12. {{userInfo.vip ? userInfo.vip_name: '粉丝'}}
  13. </view>
  14. </view>
  15. </view>
  16. <image @click="showY" class="inf" src="../../static/shouye/userinfo.png" mode="scaleToFill"></image>
  17. </view>
  18. </view>
  19. <!-- 余额 -->
  20. <view class="body">
  21. <view v-if="show" class="yue">
  22. <view class="te">
  23. {{$t('user.c1')}}
  24. </view>
  25. <view class="tex">
  26. {{userWallet}}U
  27. </view>
  28. <view class="btn flex">
  29. <button class="btn1" @click="navigator"> <text>{{$t('user.a7')}}</text> </button>
  30. <button class="btn1" @click="navigatorT"> <text>{{$t('user.a6')}}</text> </button>
  31. </view>
  32. </view>
  33. <view v-else class="yue1">
  34. <view class="tj">統計表</view>
  35. <view class="tj-item flex ">
  36. <view class="lj">{{$t('user.a4')}}{{$t('user.a7')}}</view>
  37. <view class="ljsu">0.000</view>
  38. </view>
  39. <view class="tj-item flex">
  40. <view class="lj">{{$t('user.a4')}}{{$t('user.a6')}}</view>
  41. <view class="ljsu">0.000</view>
  42. </view>
  43. <view class="tj-item flex">
  44. <view class="lj">{{$t('user.a8')}}</view>
  45. <view class="ljsu">0.000</view>
  46. </view>
  47. <view class="tj-item flex">
  48. <view class="lj">{{$t('user.a9')}}</view>
  49. <view class="ljsu">0.000</view>
  50. </view>
  51. <view class="tj-item flex">
  52. <view class="lj">{{$t('user.a10')}}</view>
  53. <view class="ljsu">0.000</view>
  54. </view>
  55. </view>
  56. <!-- 列表 -->
  57. <view class="gj">
  58. {{$t('user.b1')}}
  59. </view>
  60. <view class="user-list flex" @click="navTo('/pages/user/team')">
  61. <image src="../../static/shouye/yue.png" mode="scaleToFill" class="left-img"></image>
  62. <view class="item-name">
  63. {{$t('user.b2')}}
  64. </view>
  65. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  66. </view>
  67. <!-- 额外添加 -->
  68. <view class="user-list flex" @click="navTo('/pages/user/shareQrCode')">
  69. <image src="../../static/shouye/money.png" mode="scaleToFill" class="left-img"></image>
  70. <view class="item-name">
  71. {{$t('user.b3')}}
  72. </view>
  73. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  74. </view>
  75. <!-- 额外添加 -->
  76. <view class="user-list flex" @click="navTo('/pages/tabulation/tabulation')">
  77. <image src="../../static/shouye/liebiao.png" mode="scaleToFill" class="left-img"></image>
  78. <view class="item-name">
  79. {{$t('user.b4')}}
  80. </view>
  81. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  82. </view>
  83. <view class="user-list flex" @click="navTo('/pages/user/favorites')">
  84. <image src="../../static/shouye/liebiao.png" mode="scaleToFill" class="left-img"></image>
  85. <view class="item-name">
  86. {{$t('user.b5')}}
  87. </view>
  88. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  89. </view>
  90. <view class="user-list flex" @click="openKf()">
  91. <image src="../../static/shouye/liuyan.png" mode="scaleToFill" class="left-img"></image>
  92. <view class="item-name">
  93. {{$t('user.b6')}}
  94. </view>
  95. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  96. </view>
  97. <view class="user-list flex" @click="navTo('/pages/transaction/transaction')">
  98. <image src="../../static/shouye/jiaoyi.png" mode="scaleToFill" class="left-img"></image>
  99. <view class="item-name">
  100. {{$t('user.b7')}}
  101. </view>
  102. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  103. </view>
  104. <view class="user-list flex" @click="navTo('/pages/public/login')">
  105. <image src="../../static/shouye/tuichu.png" mode="scaleToFill" class="left-img"></image>
  106. <view class="item-name">
  107. {{$t('user.b8')}}
  108. </view>
  109. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  110. </view>
  111. <!-- todo -->
  112. <view class="user-list flex" @click="navTo('/pages/user/set')">
  113. <image src="../../static/shouye/shezhi.png" mode="scaleToFill" class="left-img"></image>
  114. <view class="item-name">
  115. {{$t('user.b9')}}
  116. </view>
  117. <image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
  118. </view>
  119. </view>
  120. <taber tab='user'></taber>
  121. </view>
  122. </template>
  123. <script>
  124. import {
  125. gameWallet,
  126. } from "@/api/game.js";
  127. import taber from "@/components/footer/footer.vue";
  128. import {
  129. mapState,
  130. mapMutations
  131. } from 'vuex';
  132. import {
  133. orderData,
  134. getUserInfo,
  135. } from '@/api/user.js';
  136. import {
  137. saveUrl,
  138. interceptor
  139. } from '@/utils/loginUtils.js';
  140. let startY = 0,
  141. moveY = 0,
  142. pageAtTop = true;
  143. export default {
  144. components: {
  145. taber
  146. },
  147. data() {
  148. return {
  149. current: 2,
  150. store_name: '',
  151. achievement: '',
  152. code: '',
  153. levelList: [],
  154. show: true,
  155. userWallet: 0, //余额
  156. };
  157. },
  158. onShow() {
  159. // 判断是否已经登录
  160. // if (this.hasLogin) {
  161. // this.loadBaseData();
  162. // }
  163. this.loadBaseData();
  164. this.getUserWallet();
  165. },
  166. filters: {
  167. phone(e) {
  168. var subStr1 = e.substr(0, 3);
  169. var subStr2 = e.substr(e.length - 4, 4);
  170. var subStr = subStr1 + '...' + subStr2;
  171. e = subStr;
  172. return e;
  173. }
  174. },
  175. onReady() {
  176. // 初始化获取页面宽度
  177. uni.createSelectorQuery()
  178. .select('.container')
  179. .fields({
  180. size: true
  181. },
  182. data => {
  183. // 计算最多下拉的高度
  184. this.userDowm = Math.floor((data.width / 750) * 185);
  185. // 计算最大触发修改高度事件
  186. this.userMaxDowm = Math.floor((data.width / 750) * 250);
  187. }
  188. )
  189. .exec();
  190. },
  191. computed: {
  192. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  193. },
  194. methods: {
  195. ...mapMutations('user', ['setUserInfo']),
  196. showY() {
  197. this.show = !this.show
  198. },
  199. navigatorT() {
  200. uni.navigateTo({
  201. url: '/pages/withdrawal/withdrawal'
  202. })
  203. },
  204. navigator() {
  205. uni.navigateTo({
  206. url: '/pages/recharge/recharge'
  207. })
  208. },
  209. // 获取用户余额信息
  210. getUserWallet() {
  211. gameWallet().then((res) => {
  212. this.userWallet = +res.data.back.USDT.money.money
  213. })
  214. // if (this.history.next.id) {
  215. // this.opTiem();
  216. // } else {
  217. // this.gameInit();
  218. // }
  219. },
  220. // 加载初始数据
  221. loadBaseData() {
  222. const obj = this
  223. getUserInfo({})
  224. .then(({
  225. data
  226. }) => {
  227. obj.setUserInfo(data);
  228. })
  229. .catch(e => {
  230. console.log(e);
  231. });
  232. },
  233. /**
  234. * 统一跳转接口,拦截未登录路由
  235. * navigator标签现在默认没有转场动画,所以用view
  236. */
  237. navTo(url) {
  238. console.log(url);
  239. if (!this.hasLogin) {
  240. // 保存地址
  241. saveUrl();
  242. // 登录拦截
  243. interceptor();
  244. } else {
  245. uni.navigateTo({
  246. url
  247. });
  248. }
  249. },
  250. cast() {
  251. set_waiter({
  252. uid: this.id
  253. })
  254. .then(e => {
  255. this.$api.msg('绑定成功');
  256. this.$refs.gspass.close();
  257. this.id = '';
  258. })
  259. .catch(err => {
  260. this.$refs.gspass.close();
  261. this.id = '';
  262. });
  263. },
  264. // cancelpass() {
  265. // this.$refs.gspass.close();
  266. // this.id = '';
  267. // }
  268. }
  269. };
  270. </script>
  271. <style lang="scss">
  272. .container {
  273. height: 100%;
  274. line-height: 1;
  275. }
  276. .top {
  277. height: 327rpx;
  278. background-color: #000000;
  279. padding: 0 45rpx;
  280. .my {
  281. padding-top: 40rpx;
  282. font-size: 48rpx;
  283. font-weight: 500;
  284. color: #FFFFFF;
  285. }
  286. .userinfo {
  287. padding-top: 40rpx;
  288. .image {
  289. width: 125rpx;
  290. height: 125rpx;
  291. }
  292. .info {
  293. .infor {
  294. font-size: 30rpx;
  295. font-weight: 500;
  296. color: #FFFFFF;
  297. }
  298. .uservip {
  299. display: flex;
  300. align-items: center;
  301. justify-content: center;
  302. background: url('../../static/img/vip-bg.png') 100%/contain no-repeat;
  303. padding: 6rpx 72rpx;
  304. font-size: 20rpx;
  305. font-weight: 500;
  306. color: #93794B;
  307. }
  308. }
  309. }
  310. }
  311. .in {
  312. width: 128rpx;
  313. height: 45rpx;
  314. }
  315. .inf {
  316. margin-top: 25rpx;
  317. width: 48rpx;
  318. height: 48rpx;
  319. }
  320. // body
  321. .body {
  322. background-color: #191a1f;
  323. padding: 30rpx;
  324. border-top-right-radius: 60rpx;
  325. border-top-left-radius: 60rpx;
  326. color: #FFFFFF;
  327. .yue {
  328. border-radius: 60rpx;
  329. background-color: #000000;
  330. text-align: center;
  331. padding-top: 40rpx;
  332. padding-bottom: 35rpx;
  333. .te {
  334. font-size: 26rpx;
  335. font-weight: 500;
  336. padding-bottom: 30rpx;
  337. }
  338. .tex {
  339. font-size: 48rpx;
  340. font-weight: bold;
  341. padding-bottom: 50rpx;
  342. }
  343. .btn1 {
  344. min-width: 270rpx;
  345. background: #FDB242;
  346. border-radius: 10rpx;
  347. font-size: $font-base;
  348. }
  349. }
  350. .yue1 {
  351. background-color: #000000;
  352. padding: 30rpx;
  353. color: #FFFFFF;
  354. border-radius: 60rpx;
  355. .tj {
  356. font-size: 30rpx;
  357. font-weight: bold;
  358. text-align: center;
  359. }
  360. .tj-item{
  361. padding-top: 26rpx;
  362. font-size: 24rpx;
  363. opacity: 0.65;
  364. }
  365. }
  366. }
  367. .gj {
  368. margin-top: 50rpx;
  369. margin-left: 20rpx;
  370. font-size: 36rpx;
  371. font-weight: bold;
  372. color: #FFFFFF;
  373. padding-bottom: 10rpx;
  374. }
  375. .user-list {
  376. background: #191a1f;
  377. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  378. margin: 0 auto;
  379. padding: 30rpx 25rpx;
  380. border-bottom: 1px solid rgba(240, 240, 240, 0.2);
  381. .left-img {
  382. width: 40rpx;
  383. height: 40rpx;
  384. margin-right: 20rpx;
  385. }
  386. .item-name {
  387. flex-grow: 1;
  388. font-size: 29rpx;
  389. font-weight: bold;
  390. color: #FFF;
  391. }
  392. .right-img {
  393. width: 18rpx;
  394. height: 27rpx;
  395. }
  396. }
  397. </style>