index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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 margin-r-10" v-if="userInfo.nickname">
  10. {{userInfo.nickname}}
  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. <!-- 轮播图 -->
  26. <view class="uni-margin-wrap margin-b-10">
  27. <swiper indicator-color='rgba(255,255,255,0.69)' indicator-active-color='#FFF' class="swiper" circular
  28. :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval" :duration="duration">
  29. <swiper-item class="swiper-box">
  30. <image class="swiper-item" src="../../static/shouye/shouye4.png" mode="scaleToFill"></image>
  31. </swiper-item>
  32. <swiper-item class="swiper-box">
  33. <image class="swiper-item" src="../../static/shouye/shouye4.png" mode="scaleToFill"></image>
  34. </swiper-item>
  35. </swiper>
  36. </view>
  37. <!-- 底部 -->
  38. <view class="tra flex margin-b-10">
  39. <view class="tra-item">
  40. {{$t('home.b8')}}
  41. </view>
  42. <view class="tra-item">
  43. {{$t('home.k1')}}
  44. </view>
  45. <view class="tra-item">
  46. {{$t('home.b0')}}
  47. </view>
  48. </view>
  49. <!-- 每一项 -->
  50. <view class="list flex" v-for="(item,ind) in navList">
  51. <view class="list-item flex-start">
  52. <!-- <image class="img margin-r-10" :src="item.img" mode="scaleToFill"> </image> -->
  53. <text class="tli">{{ind}}</text>
  54. </view>
  55. <view class="list-item">
  56. {{item.data[0].idxPx}}
  57. </view>
  58. <view class="list-item ">
  59. {{((item.data[0].idxPx - item.data[0].high24h) / item.data[0].high24h) | decimalPlaces}}
  60. </view>
  61. </view>
  62. <taber tab='index'></taber>
  63. </view>
  64. </template>
  65. <script>
  66. import {prices} from "@/api/index.js"
  67. import {
  68. mapState,
  69. mapActions
  70. } from "vuex";
  71. import taber from "@/components/footer/footer.vue";
  72. export default {
  73. components: {
  74. taber
  75. },
  76. data() {
  77. return {
  78. indicatorDots: true,
  79. autoplay: true,
  80. interval: 5000,
  81. duration: 500,
  82. navList: {},
  83. }
  84. },
  85. computed: {
  86. ...mapState({
  87. langList: "langList",
  88. lang: "lang",
  89. }),
  90. ...mapState('user', ['userInfo']),
  91. label() {
  92. const label = this.langList.find((item) => {
  93. console.log(this.lang, item.value);
  94. return item.value == this.lang
  95. }).label;
  96. return label
  97. }
  98. },
  99. filters: {
  100. decimalPlaces(value) {
  101. if (typeof value !== 'number') {
  102. return value;
  103. }
  104. return value.toFixed(5);
  105. }
  106. },
  107. onLoad() {
  108. this.loadData()
  109. },
  110. methods: {
  111. ...mapActions({
  112. setLang: "setLang",
  113. }),
  114. getCurrent() {
  115. let pages = getCurrentPages();
  116. let curPage = pages[pages.length - 1];
  117. return curPage
  118. },
  119. selectLang(value) {
  120. this.setLang(this.langList[value.detail.value].value);
  121. let path = '/' + this.getCurrent().route
  122. },
  123. loadData(source) {
  124. //这里是将订单挂载到tab列表下
  125. const that = this;
  126. prices({})
  127. .then(({
  128. data
  129. }) => {
  130. console.log('1111',data );
  131. that.navList = data.prices
  132. })
  133. .catch(e => {
  134. console.log(e);
  135. });
  136. },
  137. },
  138. }
  139. </script>
  140. <style lang="scss">
  141. .container {
  142. width: 100%;
  143. height: 1600rpx;
  144. background-color: #000000;
  145. padding-top: var(--status-bar-height);
  146. }
  147. .top {
  148. font-weight: 500;
  149. padding: 40rpx 30rpx 24rpx 30rpx;
  150. line-height: 1;
  151. .icon1 {
  152. line-height: 0;
  153. .img {
  154. width: 47rpx;
  155. height: 47rpx;
  156. }
  157. .tet {
  158. font-size: 28rpx;
  159. color: #C3A76C;
  160. }
  161. }
  162. .icon2 {
  163. background: #292C3D;
  164. border: 2px solid #414243;
  165. border-radius: 21rpx;
  166. }
  167. .langTip {
  168. width: 34rpx;
  169. height: 34rpx;
  170. }
  171. .langTipDom {
  172. width: 23rpx;
  173. height: 15rpx;
  174. }
  175. .text {
  176. font-size: 24rpx;
  177. color: #FFFFFF;
  178. padding: 10rpx 20rpx;
  179. }
  180. .text1 {
  181. font-size: 24rpx;
  182. color: #FFFFFF;
  183. }
  184. }
  185. .uni-margin-wrap {
  186. height: 394rpx;
  187. .swiper {
  188. height: 100%;
  189. .swiper-box {
  190. height: 100%;
  191. text-align: center;
  192. .swiper-item {
  193. width: 100%;
  194. height: 100%;
  195. }
  196. }
  197. }
  198. }
  199. .tra {
  200. height: 93rpx;
  201. background: #2B2A26;
  202. padding: 0 30rpx;
  203. font-size: 24rpx;
  204. color: #999999;
  205. .tra-item {
  206. width: 33.3%;
  207. }
  208. .tra-item:nth-child(2) {
  209. text-align: center;
  210. }
  211. .tra-item:nth-child(3) {
  212. text-align: right;
  213. }
  214. }
  215. .list {
  216. font-weight: bold;
  217. font-size: 30rpx;
  218. color: #FFFFFF;
  219. padding: 20rpx 30rpx 20rpx 30rpx;
  220. line-height: 1;
  221. border-bottom: 1px solid #2B2A26;
  222. .list-item:nth-child(2) {
  223. text-align: center;
  224. }
  225. .list-item:nth-child(3) {
  226. text-align: right;
  227. }
  228. .list-item {
  229. width: 33.3%;
  230. .img {
  231. width: 60rpx;
  232. height: 60rpx;
  233. }
  234. .button {
  235. padding: 10rpx 20rpx;
  236. border-radius: 10rpx;
  237. min-width: 150rpx;
  238. text-align: center;
  239. display: inline-block;
  240. &.up {
  241. background: #FB5E57;
  242. }
  243. &.dom {
  244. background: #77DA90;
  245. }
  246. }
  247. }
  248. }
  249. </style>