user.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  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/jump/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/user/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/jump/withdrawal'
  202. })
  203. },
  204. navigator() {
  205. uni.navigateTo({
  206. url: '/pages/jump/recharge'
  207. })
  208. },
  209. // 获取用户余额信息
  210. getUserWallet() {
  211. gameWallet().then((res) => {
  212. this.userWallet = +res.data.back.USDT.money.money
  213. })
  214. },
  215. // 加载初始数据
  216. loadBaseData() {
  217. const obj = this
  218. getUserInfo({})
  219. .then(({
  220. data
  221. }) => {
  222. obj.setUserInfo(data);
  223. })
  224. .catch(e => {
  225. console.log(e);
  226. });
  227. },
  228. /**
  229. * 统一跳转接口,拦截未登录路由
  230. * navigator标签现在默认没有转场动画,所以用view
  231. */
  232. navTo(url) {
  233. console.log(url);
  234. if (!this.hasLogin) {
  235. // 保存地址
  236. saveUrl();
  237. // 登录拦截
  238. interceptor();
  239. } else {
  240. uni.navigateTo({
  241. url
  242. });
  243. }
  244. },
  245. cast() {
  246. set_waiter({
  247. uid: this.id
  248. })
  249. .then(e => {
  250. this.$api.msg('绑定成功');
  251. this.$refs.gspass.close();
  252. this.id = '';
  253. })
  254. .catch(err => {
  255. this.$refs.gspass.close();
  256. this.id = '';
  257. });
  258. },
  259. // cancelpass() {
  260. // this.$refs.gspass.close();
  261. // this.id = '';
  262. // }
  263. }
  264. };
  265. </script>
  266. <style lang="scss">
  267. .container {
  268. height: 100%;
  269. line-height: 1;
  270. }
  271. .top {
  272. height: 327rpx;
  273. background-color: #000000;
  274. padding: 0 45rpx;
  275. .my {
  276. padding-top: 40rpx;
  277. font-size: 48rpx;
  278. font-weight: 500;
  279. color: #FFFFFF;
  280. }
  281. .userinfo {
  282. padding-top: 40rpx;
  283. .image {
  284. width: 125rpx;
  285. height: 125rpx;
  286. }
  287. .info {
  288. .infor {
  289. font-size: 30rpx;
  290. font-weight: 500;
  291. color: #FFFFFF;
  292. }
  293. .uservip {
  294. display: flex;
  295. align-items: center;
  296. justify-content: center;
  297. background: url('../../static/img/vip-bg.png') 100%/contain no-repeat;
  298. padding: 6rpx 72rpx;
  299. font-size: 20rpx;
  300. font-weight: 500;
  301. color: #93794B;
  302. }
  303. }
  304. }
  305. }
  306. .in {
  307. width: 128rpx;
  308. height: 45rpx;
  309. }
  310. .inf {
  311. margin-top: 25rpx;
  312. width: 48rpx;
  313. height: 48rpx;
  314. }
  315. // body
  316. .body {
  317. background-color: #191a1f;
  318. padding: 30rpx;
  319. border-top-right-radius: 60rpx;
  320. border-top-left-radius: 60rpx;
  321. color: #FFFFFF;
  322. .yue {
  323. border-radius: 60rpx;
  324. background-color: #000000;
  325. text-align: center;
  326. padding-top: 40rpx;
  327. padding-bottom: 35rpx;
  328. .te {
  329. font-size: 26rpx;
  330. font-weight: 500;
  331. padding-bottom: 30rpx;
  332. }
  333. .tex {
  334. font-size: 48rpx;
  335. font-weight: bold;
  336. padding-bottom: 50rpx;
  337. }
  338. .btn1 {
  339. min-width: 270rpx;
  340. background: #FDB242;
  341. border-radius: 10rpx;
  342. font-size: $font-base;
  343. }
  344. }
  345. .yue1 {
  346. background-color: #000000;
  347. padding: 30rpx;
  348. color: #FFFFFF;
  349. border-radius: 60rpx;
  350. .tj {
  351. font-size: 30rpx;
  352. font-weight: bold;
  353. text-align: center;
  354. }
  355. .tj-item{
  356. padding-top: 26rpx;
  357. font-size: 24rpx;
  358. opacity: 0.65;
  359. }
  360. }
  361. }
  362. .gj {
  363. margin-top: 50rpx;
  364. margin-left: 20rpx;
  365. font-size: 36rpx;
  366. font-weight: bold;
  367. color: #FFFFFF;
  368. padding-bottom: 10rpx;
  369. }
  370. .user-list {
  371. background: #191a1f;
  372. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  373. margin: 0 auto;
  374. padding: 30rpx 25rpx;
  375. border-bottom: 1px solid rgba(240, 240, 240, 0.2);
  376. .left-img {
  377. width: 40rpx;
  378. height: 40rpx;
  379. margin-right: 20rpx;
  380. }
  381. .item-name {
  382. flex-grow: 1;
  383. font-size: 29rpx;
  384. font-weight: bold;
  385. color: #FFF;
  386. }
  387. .right-img {
  388. width: 18rpx;
  389. height: 27rpx;
  390. }
  391. }
  392. </style>