index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  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}}/{{item.unit}}
  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}}{{item.unit}}</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. console.log('start')
  153. this.loadDatass()
  154. // this.moneyType();
  155. }
  156. // this.getFil();
  157. // this.getDataYun();
  158. },
  159. //下拉刷新
  160. onPullDownRefresh() {
  161. this.loadData();
  162. // this.moneyType();
  163. setTimeout(function() {
  164. uni.stopPullDownRefresh();
  165. }, 1000);
  166. },
  167. methods: {
  168. /**
  169. * 统一跳转接口,拦截未登录路由
  170. * navigator标签现在默认没有转场动画,所以用view
  171. */
  172. loadData() {
  173. let obj = this
  174. loadIndexs().then(res => {
  175. obj.banner = res.data.banner
  176. console.log(res.data.banner, 'www');
  177. })
  178. },
  179. navTo(url) {
  180. uni.navigateTo({
  181. url
  182. });
  183. },
  184. //轮播图
  185. swiperChange(e) {
  186. // console.log(e);
  187. let index = e.detail.current;
  188. this.swiperCurrent = index;
  189. },
  190. loadDatass() {
  191. // console.trace()
  192. let obj = this;
  193. // uni.showLoading({
  194. // title: '加载中...'
  195. // });
  196. obj.list = []
  197. mining({
  198. page: 1,
  199. limit: 1000
  200. }).then(({
  201. data
  202. }) => {
  203. uni.hideLoading();
  204. console.log(data.data, '9999999999999999999999999999999999')
  205. obj.list = data.data.map(e => {
  206. e.step = +e.step;
  207. e._cost_money = +e._cost_money.replace(e.cost_money_type, '') + e
  208. .cost_money_type;
  209. return e;
  210. });
  211. console.log(obj.list, 'obj.list++++++++++++');
  212. })
  213. },
  214. }
  215. };
  216. </script>
  217. <style lang="scss">
  218. page {
  219. min-height: 100%;
  220. background-color: #ffffff;
  221. .container {
  222. width: 100%;
  223. padding: 25rpx 40rpx;
  224. }
  225. }
  226. .tiele-index {
  227. font-weight: 500;
  228. font-size: 50rpx;
  229. padding: 30rpx 0rpx 30rpx 0rpx;
  230. }
  231. .top-head {
  232. position: fixed;
  233. top: 0;
  234. z-index: 99;
  235. width: 100%;
  236. background-color: #272f41;
  237. padding: 15rpx 35rpx;
  238. color: #edc959;
  239. image {
  240. width: 80rpx;
  241. height: 80rpx;
  242. }
  243. .top-name {
  244. padding-left: 15rpx;
  245. }
  246. }
  247. //轮播图
  248. .swiper {
  249. width: 100%;
  250. display: flex;
  251. justify-content: center;
  252. border-radius: 15rpx;
  253. .swiper-box {
  254. width: 100%;
  255. height: 335rpx;
  256. overflow: hidden;
  257. // box-shadow: 0upx 8upx 25upx rgba(0, 0, 0, 0.2);
  258. //兼容ios,微信小程序
  259. border-radius: 15rpx;
  260. position: relative;
  261. z-index: 1;
  262. swiper {
  263. width: 100%;
  264. height: 100%;
  265. swiper-item {
  266. image {
  267. width: 100%;
  268. height: 100%;
  269. border-radius: 15rpx;
  270. }
  271. }
  272. }
  273. .indicator {
  274. position: absolute;
  275. bottom: 20upx;
  276. left: 20upx;
  277. background-color: rgba(255, 255, 255, 0.4);
  278. width: 150upx;
  279. height: 5upx;
  280. border-radius: 3upx;
  281. overflow: hidden;
  282. display: flex;
  283. .dots {
  284. width: 0upx;
  285. background-color: rgba(255, 255, 255, 1);
  286. transition: all 0.3s ease-out;
  287. &.on {
  288. width: (100%/3);
  289. }
  290. }
  291. }
  292. }
  293. }
  294. .notice-box {
  295. .text-right {
  296. text-align: right;
  297. }
  298. padding: 40rpx 0rpx;
  299. .title {
  300. font-size: 28rpx;
  301. padding-bottom: 19rpx;
  302. font-family: PingFang SC;
  303. font-weight: bold;
  304. color: #000000;
  305. position: relative;
  306. left: -13rpx;
  307. }
  308. .info-box {
  309. width: 678rpx;
  310. height: 282rpx;
  311. margin: 0 auto;
  312. background: #ffffff;
  313. border: 2px solid #5771df;
  314. border-radius: 5rpx;
  315. padding: 15rpx 22rpx 25rpx;
  316. font-size: 22rpx;
  317. font-family: PingFang SC;
  318. font-weight: 500;
  319. color: #333333;
  320. // line-height: 1;
  321. display: flex;
  322. flex-direction: column;
  323. justify-content: space-between;
  324. // justify-content: ;
  325. .top {
  326. display: flex;
  327. align-items: center;
  328. justify-content: space-between;
  329. .top-left {
  330. font-size: 63rpx;
  331. font-family: PingFang SC;
  332. font-weight: bold;
  333. color: #5771df;
  334. }
  335. .top-right {
  336. text-align: right;
  337. .top-right-bottom {
  338. font-size: 30rpx;
  339. font-family: PingFang SC;
  340. font-weight: bold;
  341. color: #5771df;
  342. }
  343. }
  344. }
  345. .middle {
  346. display: flex;
  347. justify-content: space-between;
  348. .middle-item {
  349. display: flex;
  350. flex-direction: column;
  351. .item-val {
  352. font-size: 30rpx;
  353. font-family: PingFang SC;
  354. font-weight: bold;
  355. color: #5771df;
  356. }
  357. }
  358. }
  359. .bottom {
  360. display: flex;
  361. justify-content: space-between;
  362. .item-val {
  363. display: flex;
  364. // justify-content: ;
  365. font-size: 30rpx;
  366. font-family: PingFang SC;
  367. font-weight: bold;
  368. color: #5771df;
  369. }
  370. }
  371. }
  372. .ad {
  373. display: block;
  374. margin: 0 auto;
  375. width: 678rpx;
  376. height: 162rpx;
  377. }
  378. .tit {
  379. margin: 0 auto;
  380. margin-top: 31rpx;
  381. width: 678rpx;
  382. height: 59rpx;
  383. background: #5771df;
  384. border-radius: 5rpx;
  385. text-align: center;
  386. font-size: 28rpx;
  387. font-family: PingFang SC;
  388. font-weight: bold;
  389. color: #ffffff;
  390. line-height: 59rpx;
  391. }
  392. .kg-item {
  393. height: 100%;
  394. height: 610rpx;
  395. border-bottom: 1px solid #f3f4f6;
  396. padding: 40rpx 17rpx 0;
  397. line-height: 1;
  398. font-size: 28rpx;
  399. font-family: PingFang SC;
  400. font-weight: bold;
  401. color: #333333;
  402. .item-na {
  403. padding-bottom: 39rpx;
  404. text {
  405. color: #fb3a2f;
  406. }
  407. }
  408. .item-info {
  409. padding-left: 16rpx;
  410. font-size: 24rpx;
  411. font-family: PingFang SC;
  412. font-weight: bold;
  413. color: #333333;
  414. line-height: 1;
  415. padding-bottom: 24rpx;
  416. display: flex;
  417. justify-content: space-between;
  418. }
  419. }
  420. .notice-title {
  421. padding-bottom: 30rpx;
  422. image {
  423. width: 35rpx;
  424. height: 32rpx;
  425. }
  426. .title {
  427. font-size: 34rpx;
  428. font-weight: bold;
  429. font-style: italic;
  430. color: #333333;
  431. margin-left: 15rpx;
  432. }
  433. }
  434. .notice-list {
  435. .notice-tpl {
  436. image {
  437. width: 99rpx;
  438. height: 113rpx;
  439. }
  440. .name {
  441. font-size: 26rpx;
  442. color: #5d616d;
  443. }
  444. }
  445. }
  446. }
  447. .logo-img {
  448. width: 100%;
  449. height: 210rpx;
  450. }
  451. .quotation-list {
  452. display: flex;
  453. flex-wrap: wrap;
  454. .quotation-tpl {
  455. position: relative;
  456. padding: 22rpx 24rpx;
  457. height: 220rpx;
  458. overflow: hidden;
  459. display: flex;
  460. flex-direction: column;
  461. width: 31%;
  462. margin-bottom: 4%;
  463. margin-right: 2%;
  464. // &:nth-child(2n + 1) {
  465. // margin-right: 2%;
  466. // }
  467. .tpl {
  468. z-index: 99;
  469. position: relative;
  470. font-size: 24rpx;
  471. padding-bottom: 10rpx;
  472. }
  473. .title {
  474. color: #333333;
  475. font-weight: bold;
  476. padding-bottom: 21rpx !important;
  477. }
  478. .num {
  479. color: #fb3a2f;
  480. }
  481. .money {
  482. color: #666666;
  483. }
  484. .tip-box {
  485. image {
  486. width: 100%;
  487. height: 118rpx;
  488. position: absolute;
  489. bottom: 0;
  490. left: 0;
  491. }
  492. .tip {
  493. position: relative;
  494. color: #fb3a2f;
  495. font-size: 26rpx;
  496. text-align: center;
  497. font-weight: 600;
  498. padding-top: 25rpx;
  499. }
  500. .grenn {
  501. color: #606266;
  502. }
  503. }
  504. }
  505. }
  506. .list-box {
  507. image {
  508. width: 326rpx;
  509. height: 210rpx;
  510. }
  511. }
  512. .content {
  513. .title-box {
  514. margin: 30rpx 0;
  515. display: flex;
  516. align-items: center;
  517. .img {
  518. margin-right: 10rpx;
  519. width: 32rpx;
  520. height: 32rpx;
  521. image {
  522. width: 100%;
  523. height: 100%;
  524. }
  525. }
  526. .title {
  527. font-size: 31rpx;
  528. font-family: PingFang SC;
  529. font-weight: bold;
  530. color: #141E47;
  531. line-height: 73rpx;
  532. }
  533. }
  534. .content-box {
  535. width: 670rpx;
  536. height: 310rpx;
  537. background: #FFFFFF;
  538. box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(50, 50, 52, 0.06);
  539. border-radius: 20rpx;
  540. margin: 0 auto;
  541. .cpTitle {
  542. display: flex;
  543. justify-content: space-around;
  544. .title-left {
  545. display: flex;
  546. align-items: center;
  547. .title-img {
  548. width: 26rpx;
  549. height: 26rpx;
  550. image {
  551. width: 100%;
  552. height: 100%;
  553. }
  554. }
  555. .title-title {
  556. margin-left: 10rpx;
  557. font-size: 26rpx;
  558. font-family: PingFang SC;
  559. font-weight: bold;
  560. color: #141E47;
  561. line-height: 73rpx;
  562. }
  563. }
  564. .title-right {
  565. font-size: 21rpx;
  566. font-family: PingFang SC;
  567. font-weight: bold;
  568. color: #141E47;
  569. line-height: 73rpx;
  570. text {
  571. font-size: 30rpx;
  572. color: #FF6600;
  573. }
  574. }
  575. }
  576. .cpContent {
  577. padding: 10rpx 20rpx;
  578. display: flex;
  579. justify-content: space-between;
  580. .left {
  581. display: flex;
  582. flex-direction: column;
  583. align-items: center;
  584. .left-img {
  585. width: 95rpx;
  586. height: 116rpx;
  587. image {
  588. width: 100%;
  589. height: 100%;
  590. }
  591. }
  592. .left-title {
  593. font-size: 21rpx;
  594. font-family: PingFang SC;
  595. font-weight: bold;
  596. color: #999999;
  597. line-height: 73rpx;
  598. }
  599. }
  600. .between {
  601. height: 140rpx;
  602. position: absolute;
  603. left: 220rpx;
  604. display: flex;
  605. flex-direction: column;
  606. flex-wrap: wrap;
  607. text {
  608. font-size: 20rpx;
  609. font-family: PingFang SC;
  610. font-weight: bold;
  611. color: #141E47;
  612. }
  613. }
  614. .right {
  615. margin-top: 120rpx;
  616. width: 141rpx;
  617. height: 50rpx;
  618. background: #FF6600;
  619. border-radius: 25rpx;
  620. font-size: 24rpx;
  621. font-family: PingFang SC;
  622. font-weight: 500;
  623. color: #FFFFFF;
  624. line-height: 55rpx;
  625. text-align: center;
  626. }
  627. }
  628. }
  629. }
  630. </style>