index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <view class="container">
  3. <view class="top flex">
  4. <view class="icon1 flex">
  5. <image class="img margin-r-10" src="../../static/shouye/shouye1.png" mode="scaleToFill"></image>
  6. <text class="tet">{{$t('login.a0')}}</text>
  7. </view>
  8. <view class="flex">
  9. <view class="icon2 text clamp margin-r-10">
  10. {{userInfo.account||'链接钱包'}}
  11. </view>
  12. <view class="icon1 margin-r-10">
  13. <image class="langTip" src="../../static/shouye/shouye2.png" mode="scaleToFill"></image>
  14. </view>
  15. <view class="text1 margin-r-10">
  16. <picker :range="langList" range-key='label' @change="selectLang">
  17. <view>{{label}}</view>
  18. </picker>
  19. </view>
  20. <view class="icon1">
  21. <image class="langTipDom" src="../../static/shouye/shouye3.png" mode="scaleToFill"></image>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="flex item">
  26. <view class="item-style flex" v-for="(item,ind) in gameList"
  27. @click="openurl(`/pages/index/entertainment?title=${item.name}&id=${item.id}`)">
  28. <image class="item-tip" :src="`../../static/shouye/index_item_${ind+1}.png`" mode="scaleToFill">
  29. </image>
  30. <view class="name">
  31. {{item.name}}
  32. </view>
  33. <view class="item-next flex-center">
  34. <image src="../../static/img/zhiya1.png" mode="widthFix" class="next-img"></image>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="flex shop-detail-data">
  39. <view class="data-list">
  40. <view class="num-box">
  41. <text>{{active_user}}</text><text class="num-tip">+</text>
  42. </view>
  43. <view class="name">
  44. {{$t('homepledge.活跃用户')}}
  45. </view>
  46. </view>
  47. <view class="data-list">
  48. <view class="num-box">
  49. <text>1000000</text><text class="num-tip">+</text>
  50. </view>
  51. <view class="name">
  52. {{$t('homepledge.累计返奖')}}
  53. </view>
  54. </view>
  55. <view class="data-list">
  56. <view class="num-box">
  57. <text>10000</text><text class="num-tip">+</text>
  58. </view>
  59. <view class="name">
  60. {{$t('homepledge.总用户')}}
  61. </view>
  62. </view>
  63. </view>
  64. <view class="title">
  65. {{$t('homepledge.游戏流程')}}
  66. </view>
  67. <image class="conetnt-img" src="../../static/shouye/index-content.png" mode="widthFix"></image>
  68. <view class="title">
  69. {{$t('homepledge.合作伙伴')}}
  70. </view>
  71. <image class="conetnt-img" src="../../static/shouye/index-bottom.png" mode="widthFix"></image>
  72. <taber tab='index'></taber>
  73. </view>
  74. </template>
  75. <script>
  76. import {
  77. getIndex
  78. } from '@/api/index.js';
  79. import {
  80. getGameList,
  81. } from "@/api/game.js";
  82. import {
  83. mapState,
  84. mapActions,
  85. mapMutations
  86. } from "vuex";
  87. import taber from "@/components/footer/footer.vue";
  88. export default {
  89. components: {
  90. taber
  91. },
  92. data() {
  93. return {
  94. gameList: [],
  95. active_user: '0'
  96. }
  97. },
  98. computed: {
  99. ...mapState({
  100. langList: "langList",
  101. lang: "lang",
  102. }),
  103. ...mapState('user', ['userInfo']),
  104. label() {
  105. const label = this.langList.find((item) => {
  106. console.log(this.lang, item.value);
  107. return item.value == this.lang
  108. }).label;
  109. return label
  110. }
  111. },
  112. onLoad(option) {
  113. // #ifndef MP
  114. if (option.spread) {
  115. // 存储其他邀请人
  116. uni.setStorageSync('spread', option.spread);
  117. }
  118. // #endif
  119. // #ifdef MP
  120. if (option.scene) {
  121. // 存储小程序邀请人
  122. uni.setStorage({
  123. key: 'spread_code',
  124. data: option.scene
  125. });
  126. }
  127. // #endif
  128. },
  129. onShow() {
  130. this.getGameList();
  131. this.loadData();
  132. },
  133. methods: {
  134. ...mapMutations('user', ['setUserInfo', 'login']),
  135. ...mapActions({
  136. setLang: "setLang",
  137. }),
  138. openurl(url){
  139. uni.navigateTo({
  140. url: url,
  141. fail: (err) => {
  142. uni.showModal({
  143. title: '错误',
  144. content: err,
  145. showCancel: false,
  146. });
  147. }
  148. });
  149. },
  150. // 请求载入数据
  151. async loadData() {
  152. getIndex({})
  153. .then(({
  154. data
  155. }) => {
  156. this.active_user = data.active_user
  157. console.log(data);
  158. })
  159. .catch(e => {});
  160. },
  161. selectLang(value) {
  162. this.setLang(this.langList[value.detail.value].value);
  163. },
  164. getGameList() {
  165. getGameList().then((res) => {
  166. this.gameList = res.data.list;
  167. if (this.gameList.length > 2) {
  168. this.gameList = this.gameList.slice(0, 2)
  169. }
  170. })
  171. },
  172. },
  173. }
  174. </script>
  175. <style lang="scss">
  176. .container {
  177. width: 100%;
  178. background-color: #000000;
  179. padding-top: var(--status-bar-height);
  180. }
  181. .title {
  182. color: $base-color;
  183. text-align: center;
  184. font-size: 58rpx;
  185. }
  186. .item {
  187. padding: 30rpx;
  188. .item-style {
  189. border-radius: 20rpx;
  190. width: 320rpx;
  191. padding: 30rpx 0;
  192. background-color: #191A1F;
  193. flex-direction: column;
  194. color: #FFFFFF;
  195. font-size: 38rpx;
  196. .item-tip {
  197. width: 209rpx;
  198. height: 209rpx;
  199. }
  200. .name {
  201. font-weight: bold;
  202. }
  203. .item-next {
  204. margin-top: 20rpx;
  205. width: 34rpx;
  206. height: 34rpx;
  207. border-radius: 20rpx;
  208. background-color: $color-yellow;
  209. font-size: 0;
  210. .next-img {
  211. width: 10rpx;
  212. }
  213. }
  214. }
  215. }
  216. .shop-detail-data {
  217. padding: 50rpx 30rpx;
  218. .data-list {
  219. text-align: center;
  220. .num-box {
  221. color: #FFF;
  222. font-size: 40rpx;
  223. font-weight: bold;
  224. .num-tip {
  225. font-size: $font-lg;
  226. color: $color-yellow;
  227. }
  228. }
  229. .name {
  230. font-size: $font-sm;
  231. color: $font-color-disabled;
  232. }
  233. }
  234. }
  235. .conetnt-img {
  236. width: 690rpx;
  237. margin: 30rpx;
  238. margin-top: 50rpx;
  239. }
  240. .top {
  241. font-weight: 500;
  242. padding: 40rpx 30rpx 24rpx 30rpx;
  243. line-height: 1;
  244. .icon1 {
  245. line-height: 0;
  246. .img {
  247. width: 47rpx;
  248. height: 47rpx;
  249. }
  250. .tet {
  251. font-size: 28rpx;
  252. color: #C3A76C;
  253. }
  254. }
  255. .icon2 {
  256. background: #292C3D;
  257. border: 2px solid #414243;
  258. border-radius: 21rpx;
  259. }
  260. .langTip {
  261. width: 34rpx;
  262. height: 34rpx;
  263. }
  264. .langTipDom {
  265. width: 23rpx;
  266. height: 15rpx;
  267. }
  268. .text {
  269. font-size: 24rpx;
  270. color: #FFFFFF;
  271. padding: 10rpx 20rpx;
  272. max-width: 200rpx;
  273. }
  274. .text1 {
  275. font-size: 24rpx;
  276. color: #FFFFFF;
  277. }
  278. }
  279. </style>