index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. <template>
  2. <view class="container">
  3. <view class="tiele-index">首页</view>
  4. <view class="swiper">
  5. <view class="swiper-box">
  6. <swiper circular="true" autoplay="true" @change="swiperChange">
  7. <swiper-item v-for="swiper in banner" :key="swiper.id" @click="ToBanner(swiper)">
  8. <image :src="swiper.pic"></image>
  9. </swiper-item>
  10. </swiper>
  11. <view class="indicator">
  12. <view class="dots" v-for="(swiper, index) in banner" :class="[swiperCurrent >= index ? 'on' : '']"
  13. :key="index"></view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="content">
  18. <!-- <view class="title-box">
  19. <view class="img">
  20. <image src="../../static/index/index01.png" mode=""></image>
  21. </view>
  22. <view class="title">
  23. 算力产品
  24. </view>
  25. </view> -->
  26. <!-- <view class="content-box">
  27. <view class="cpTitle">
  28. <view class="title-left">
  29. <view class="title-img">
  30. <image src="../../static/index/index05.png" mode=""></image>
  31. </view>
  32. <view class="title-title">
  33. BTC服务器创新算力产品
  34. </view>
  35. </view>
  36. <view class="title-right">
  37. 单价:<text> 63 </text>Usdt/T
  38. </view>
  39. </view>
  40. <view class="cpContent">
  41. <view class="left">
  42. <view class="left-img">
  43. <image src="../../static/index/index02.png" mode=""></image>
  44. </view>
  45. <view class="left-title">
  46. S19云杉矿机
  47. </view>
  48. </view>
  49. <view class="between">
  50. <text>预计日产出:0.0125466THS</text>
  51. <text>单份日电费:0.76元/度</text>
  52. <text>平台管理费:20%</text>
  53. <text>产币有效期:720天</text>
  54. <text>上架期:T+1</text>
  55. </view>
  56. <view class="right" @click="navTo()">
  57. 立即购买
  58. </view>
  59. </view>
  60. </view> -->
  61. <view class="title-box">
  62. <view class="img">
  63. <image src="../../static/index/index03.png" mode=""></image>
  64. </view>
  65. <view class="title">
  66. 矿机商城
  67. </view>
  68. </view>
  69. <view class="content-box" v-for="(item,index) in list">
  70. <view class="cpTitle">
  71. <view class="title-left">
  72. <view class="title-img">
  73. <image src="../../static/index/index05.png" mode=""></image>
  74. </view>
  75. <view class="title-title">
  76. {{item.name}}
  77. </view>
  78. </view>
  79. <view class="title-right">
  80. 单价:<text>{{(item.cost_money*1/item.step).toFixed(3)}} </text>{{item.cost_money_type}}/T
  81. </view>
  82. </view>
  83. <view class="cpContent">
  84. <view class="left">
  85. <view class="left-img">
  86. <image :src="item.logo" mode=""></image>
  87. </view>
  88. </view>
  89. <view class="between">
  90. <text>算力:{{item.step}}T</text>
  91. <text>上架期:T+{{item.stand_time}}</text>
  92. <text>产币有效期:无限</text>
  93. <text>预计日产出:{{(item.day_get*1*item.step*1).toFixed(8)*1}}{{item.get_money_type}}</text>
  94. <text>单份日电费:{{item.electric_fee}}元/度</text>
  95. <text>平台管理费:{{item.service_ratio*1}}%</text>
  96. <text>库存:{{item.stock*1}}台</text>
  97. </view>
  98. <view class="right" @click="navTo('./shoppingDetails?id='+item.id)">
  99. 立即购买
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </template>
  107. <script>
  108. import {
  109. mining,
  110. buyMining
  111. } from '@/api/calculation.js';
  112. import {
  113. interceptor
  114. } from '@/utils/loginUtils';
  115. import {
  116. loadIndexs,
  117. moneyType,
  118. getFil,
  119. getDataYun
  120. } from '@/api/index.js';
  121. import {
  122. mapState
  123. } from 'vuex';
  124. export default {
  125. data() {
  126. return {
  127. tabCurrent: '全部',
  128. swiperCurrent: 0,
  129. banner: [],
  130. list: '',
  131. filData: {},
  132. filUserData: [],
  133. };
  134. },
  135. computed: {
  136. ...mapState(['loginInterceptor', 'hasLogin'])
  137. },
  138. onLoad: function(option) {
  139. // this.loadDatass()
  140. if (option.spread) {
  141. // 存储其他邀请人
  142. uni.setStorageSync('spread', option.spread);
  143. }
  144. },
  145. onShow: function() {
  146. // 判断是否强制登录
  147. if (this.loginInterceptor && !this.hasLogin) {
  148. // 登录拦截
  149. interceptor();
  150. } else {
  151. this.loadData();
  152. this.loadDatass()
  153. // this.moneyType();
  154. }
  155. // this.getFil();
  156. // this.getDataYun();
  157. },
  158. //下拉刷新
  159. onPullDownRefresh() {
  160. this.loadData();
  161. // this.moneyType();
  162. setTimeout(function() {
  163. uni.stopPullDownRefresh();
  164. }, 1000);
  165. },
  166. methods: {
  167. /**
  168. * 统一跳转接口,拦截未登录路由
  169. * navigator标签现在默认没有转场动画,所以用view
  170. */
  171. loadData() {
  172. let obj = this
  173. loadIndexs().then(res => {
  174. obj.banner = res.data.banner
  175. console.log(res.data.banner, 'www');
  176. })
  177. },
  178. navTo(url) {
  179. uni.navigateTo({
  180. url
  181. });
  182. },
  183. //轮播图
  184. swiperChange(e) {
  185. // console.log(e);
  186. let index = e.detail.current;
  187. this.swiperCurrent = index;
  188. },
  189. async loadDatass() {
  190. console.trace()
  191. let obj = this;
  192. uni.showLoading({
  193. title: '加载中...'
  194. });
  195. obj.list = []
  196. mining({
  197. page: 1,
  198. limit: 1000
  199. }).then(({
  200. data
  201. }) => {
  202. uni.hideLoading();
  203. console.log(data.data, '9999999999999999999999999999999999')
  204. obj.list = data.data.map(e => {
  205. e.step = +e.step;
  206. e._cost_money = +e._cost_money.replace(e.cost_money_type, '') + e
  207. .cost_money_type;
  208. return e;
  209. });
  210. console.log(obj.list, 'obj.list++++++++++++');
  211. })
  212. },
  213. }
  214. };
  215. </script>
  216. <style lang="scss">
  217. page {
  218. min-height: 100%;
  219. background-color: #ffffff;
  220. .container {
  221. width: 100%;
  222. padding: 25rpx 40rpx;
  223. }
  224. }
  225. .tiele-index {
  226. font-weight: 500;
  227. font-size: 50rpx;
  228. padding: 30rpx 0rpx 30rpx 0rpx;
  229. }
  230. .top-head {
  231. position: fixed;
  232. top: 0;
  233. z-index: 99;
  234. width: 100%;
  235. background-color: #272f41;
  236. padding: 15rpx 35rpx;
  237. color: #edc959;
  238. image {
  239. width: 80rpx;
  240. height: 80rpx;
  241. }
  242. .top-name {
  243. padding-left: 15rpx;
  244. }
  245. }
  246. //轮播图
  247. .swiper {
  248. width: 100%;
  249. display: flex;
  250. justify-content: center;
  251. border-radius: 15rpx;
  252. .swiper-box {
  253. width: 100%;
  254. height: 335rpx;
  255. overflow: hidden;
  256. // box-shadow: 0upx 8upx 25upx rgba(0, 0, 0, 0.2);
  257. //兼容ios,微信小程序
  258. border-radius: 15rpx;
  259. position: relative;
  260. z-index: 1;
  261. swiper {
  262. width: 100%;
  263. height: 100%;
  264. swiper-item {
  265. image {
  266. width: 100%;
  267. height: 100%;
  268. border-radius: 15rpx;
  269. }
  270. }
  271. }
  272. .indicator {
  273. position: absolute;
  274. bottom: 20upx;
  275. left: 20upx;
  276. background-color: rgba(255, 255, 255, 0.4);
  277. width: 150upx;
  278. height: 5upx;
  279. border-radius: 3upx;
  280. overflow: hidden;
  281. display: flex;
  282. .dots {
  283. width: 0upx;
  284. background-color: rgba(255, 255, 255, 1);
  285. transition: all 0.3s ease-out;
  286. &.on {
  287. width: (100%/3);
  288. }
  289. }
  290. }
  291. }
  292. }
  293. .notice-box {
  294. .text-right {
  295. text-align: right;
  296. }
  297. padding: 40rpx 0rpx;
  298. .title {
  299. font-size: 28rpx;
  300. padding-bottom: 19rpx;
  301. font-family: PingFang SC;
  302. font-weight: bold;
  303. color: #000000;
  304. position: relative;
  305. left: -13rpx;
  306. }
  307. .info-box {
  308. width: 678rpx;
  309. height: 282rpx;
  310. margin: 0 auto;
  311. background: #ffffff;
  312. border: 2px solid #5771df;
  313. border-radius: 5rpx;
  314. padding: 15rpx 22rpx 25rpx;
  315. font-size: 22rpx;
  316. font-family: PingFang SC;
  317. font-weight: 500;
  318. color: #333333;
  319. // line-height: 1;
  320. display: flex;
  321. flex-direction: column;
  322. justify-content: space-between;
  323. // justify-content: ;
  324. .top {
  325. display: flex;
  326. align-items: center;
  327. justify-content: space-between;
  328. .top-left {
  329. font-size: 63rpx;
  330. font-family: PingFang SC;
  331. font-weight: bold;
  332. color: #5771df;
  333. }
  334. .top-right {
  335. text-align: right;
  336. .top-right-bottom {
  337. font-size: 30rpx;
  338. font-family: PingFang SC;
  339. font-weight: bold;
  340. color: #5771df;
  341. }
  342. }
  343. }
  344. .middle {
  345. display: flex;
  346. justify-content: space-between;
  347. .middle-item {
  348. display: flex;
  349. flex-direction: column;
  350. .item-val {
  351. font-size: 30rpx;
  352. font-family: PingFang SC;
  353. font-weight: bold;
  354. color: #5771df;
  355. }
  356. }
  357. }
  358. .bottom {
  359. display: flex;
  360. justify-content: space-between;
  361. .item-val {
  362. display: flex;
  363. // justify-content: ;
  364. font-size: 30rpx;
  365. font-family: PingFang SC;
  366. font-weight: bold;
  367. color: #5771df;
  368. }
  369. }
  370. }
  371. .ad {
  372. display: block;
  373. margin: 0 auto;
  374. width: 678rpx;
  375. height: 162rpx;
  376. }
  377. .tit {
  378. margin: 0 auto;
  379. margin-top: 31rpx;
  380. width: 678rpx;
  381. height: 59rpx;
  382. background: #5771df;
  383. border-radius: 5rpx;
  384. text-align: center;
  385. font-size: 28rpx;
  386. font-family: PingFang SC;
  387. font-weight: bold;
  388. color: #ffffff;
  389. line-height: 59rpx;
  390. }
  391. .kg-item {
  392. height: 100%;
  393. height: 610rpx;
  394. border-bottom: 1px solid #f3f4f6;
  395. padding: 40rpx 17rpx 0;
  396. line-height: 1;
  397. font-size: 28rpx;
  398. font-family: PingFang SC;
  399. font-weight: bold;
  400. color: #333333;
  401. .item-na {
  402. padding-bottom: 39rpx;
  403. text {
  404. color: #fb3a2f;
  405. }
  406. }
  407. .item-info {
  408. padding-left: 16rpx;
  409. font-size: 24rpx;
  410. font-family: PingFang SC;
  411. font-weight: bold;
  412. color: #333333;
  413. line-height: 1;
  414. padding-bottom: 24rpx;
  415. display: flex;
  416. justify-content: space-between;
  417. }
  418. }
  419. .notice-title {
  420. padding-bottom: 30rpx;
  421. image {
  422. width: 35rpx;
  423. height: 32rpx;
  424. }
  425. .title {
  426. font-size: 34rpx;
  427. font-weight: bold;
  428. font-style: italic;
  429. color: #333333;
  430. margin-left: 15rpx;
  431. }
  432. }
  433. .notice-list {
  434. .notice-tpl {
  435. image {
  436. width: 99rpx;
  437. height: 113rpx;
  438. }
  439. .name {
  440. font-size: 26rpx;
  441. color: #5d616d;
  442. }
  443. }
  444. }
  445. }
  446. .logo-img {
  447. width: 100%;
  448. height: 210rpx;
  449. }
  450. .quotation-list {
  451. display: flex;
  452. flex-wrap: wrap;
  453. .quotation-tpl {
  454. position: relative;
  455. padding: 22rpx 24rpx;
  456. height: 220rpx;
  457. overflow: hidden;
  458. display: flex;
  459. flex-direction: column;
  460. width: 31%;
  461. margin-bottom: 4%;
  462. margin-right: 2%;
  463. // &:nth-child(2n + 1) {
  464. // margin-right: 2%;
  465. // }
  466. .tpl {
  467. z-index: 99;
  468. position: relative;
  469. font-size: 24rpx;
  470. padding-bottom: 10rpx;
  471. }
  472. .title {
  473. color: #333333;
  474. font-weight: bold;
  475. padding-bottom: 21rpx !important;
  476. }
  477. .num {
  478. color: #fb3a2f;
  479. }
  480. .money {
  481. color: #666666;
  482. }
  483. .tip-box {
  484. image {
  485. width: 100%;
  486. height: 118rpx;
  487. position: absolute;
  488. bottom: 0;
  489. left: 0;
  490. }
  491. .tip {
  492. position: relative;
  493. color: #fb3a2f;
  494. font-size: 26rpx;
  495. text-align: center;
  496. font-weight: 600;
  497. padding-top: 25rpx;
  498. }
  499. .grenn {
  500. color: #606266;
  501. }
  502. }
  503. }
  504. }
  505. .list-box {
  506. image {
  507. width: 326rpx;
  508. height: 210rpx;
  509. }
  510. }
  511. .content {
  512. .title-box {
  513. margin: 30rpx 0;
  514. display: flex;
  515. align-items: center;
  516. .img {
  517. margin-right: 10rpx;
  518. width: 32rpx;
  519. height: 32rpx;
  520. image {
  521. width: 100%;
  522. height: 100%;
  523. }
  524. }
  525. .title {
  526. font-size: 31rpx;
  527. font-family: PingFang SC;
  528. font-weight: bold;
  529. color: #141E47;
  530. line-height: 73rpx;
  531. }
  532. }
  533. .content-box {
  534. width: 670rpx;
  535. height: 310rpx;
  536. background: #FFFFFF;
  537. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  538. border-radius: 20rpx;
  539. margin: 0 auto;
  540. .cpTitle {
  541. display: flex;
  542. justify-content: space-around;
  543. .title-left {
  544. display: flex;
  545. align-items: center;
  546. .title-img {
  547. width: 26rpx;
  548. height: 26rpx;
  549. image {
  550. width: 100%;
  551. height: 100%;
  552. }
  553. }
  554. .title-title {
  555. margin-left: 10rpx;
  556. font-size: 26rpx;
  557. font-family: PingFang SC;
  558. font-weight: bold;
  559. color: #141E47;
  560. line-height: 73rpx;
  561. }
  562. }
  563. .title-right {
  564. font-size: 21rpx;
  565. font-family: PingFang SC;
  566. font-weight: bold;
  567. color: #141E47;
  568. line-height: 73rpx;
  569. text {
  570. font-size: 30rpx;
  571. color: #FF6600;
  572. }
  573. }
  574. }
  575. .cpContent {
  576. padding: 10rpx 20rpx;
  577. display: flex;
  578. justify-content: space-between;
  579. .left {
  580. display: flex;
  581. flex-direction: column;
  582. align-items: center;
  583. .left-img {
  584. width: 95rpx;
  585. height: 116rpx;
  586. image {
  587. width: 100%;
  588. height: 100%;
  589. }
  590. }
  591. .left-title {
  592. font-size: 21rpx;
  593. font-family: PingFang SC;
  594. font-weight: bold;
  595. color: #999999;
  596. line-height: 73rpx;
  597. }
  598. }
  599. .between {
  600. height: 140rpx;
  601. position: absolute;
  602. left: 220rpx;
  603. display: flex;
  604. flex-direction: column;
  605. flex-wrap: wrap;
  606. text {
  607. font-size: 20rpx;
  608. font-family: PingFang SC;
  609. font-weight: bold;
  610. color: #141E47;
  611. }
  612. }
  613. .right {
  614. margin-top: 120rpx;
  615. width: 141rpx;
  616. height: 50rpx;
  617. background: #FF6600;
  618. border-radius: 25rpx;
  619. font-size: 24rpx;
  620. font-family: PingFang SC;
  621. font-weight: 500;
  622. color: #FFFFFF;
  623. line-height: 55rpx;
  624. text-align: center;
  625. }
  626. }
  627. }
  628. }
  629. </style>