index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <template>
  2. <view class="container">
  3. <navBar></navBar>
  4. <view class="contenCenter">
  5. <!-- 轮播图 -->
  6. <swiper class="top-swiper position-relative" autoplay="true" duration="400" interval="5000">
  7. <swiper-item v-for="(item, index) in bannerList" :key="index" class="carousel-item">
  8. <image :src="baseURL+item" />
  9. </swiper-item>
  10. </swiper>
  11. <!-- 轮播图END -->
  12. <!-- 中间列表 -->
  13. <view class="itemList flex padding-r-30 margin-t-30">
  14. <view class="itemLeft flex">
  15. <image class="itemImg topOne" src="../../static/img/itemList.png" mode="widthFix"></image>
  16. <view class="itemTitle">
  17. {{($t("home.共创社区"))}}
  18. </view>
  19. </view>
  20. <view class="itemRight flex" @click="openPayMoney">
  21. <view>
  22. <view class="moneyLine text-linear-gradient">
  23. $300
  24. </view>
  25. <view class="margin-t-10">
  26. {{($t("home.立即前往"))}}
  27. </view>
  28. </view>
  29. <image class="next" src="../../static/img/mininext.png" mode="scaleToFill"></image>
  30. </view>
  31. </view>
  32. <view class="itemList flex padding-r-30 ">
  33. <view class="itemLeft flex">
  34. <image class="itemImg" src="../../static/img/itemList1.png" mode="center"></image>
  35. <view class="itemTitle">
  36. {{($t("home.闪兑"))}}
  37. </view>
  38. </view>
  39. <view class="itemRight flex" @click="navto('./buling')">
  40. <view>
  41. {{($t("home.立即前往"))}}
  42. </view>
  43. <image class="next" src="../../static/img/mininext.png" mode="scaleToFill"></image>
  44. </view>
  45. </view>
  46. <view class="itemList flex padding-r-30">
  47. <view class="itemLeft flex">
  48. <image class="itemImg" src="../../static/img/itemList2.png" mode="center"></image>
  49. <view class="itemTitle">
  50. {{($t("home.节点认购"))}}
  51. </view>
  52. </view>
  53. <view class="itemRight flex" @click="navto('./node')">
  54. <view>
  55. {{($t("home.立即前往"))}}
  56. </view>
  57. <image class="next" src="../../static/img/mininext.png" mode="scaleToFill"></image>
  58. </view>
  59. </view>
  60. <view class="itemList flex padding-v-30 padding-c-30">
  61. <view class="itemLeft flex">
  62. <view class="imageBg flex-center">
  63. <image class="bgTip" src="../../static/img/itemList3.png" mode="center"></image>
  64. </view>
  65. <view class="itemTitle">
  66. <view class="nameBox flex flex-start">
  67. <view class="name">
  68. BCMM
  69. </view>
  70. <!-- <view class="upNum">
  71. <text class="font-size-sm">+</text>10%
  72. </view> -->
  73. </view>
  74. <view class="type margin-t-10">
  75. {{($t("home.币种"))}}
  76. </view>
  77. </view>
  78. </view>
  79. <view class="itemRight">
  80. <view class="money">
  81. {{indexBase.price}}U
  82. </view>
  83. <view class="moneyText">
  84. {{($t("home.今日价格"))}}
  85. </view>
  86. </view>
  87. </view>
  88. <view class="itemList flex padding-r-30">
  89. <view class="itemLeft flex">
  90. <image class="itemImg" src="../../static/img/itemList4.png" mode="center"></image>
  91. <view class="itemTitle">
  92. {{($t("home.模式说明"))}}
  93. </view>
  94. </view>
  95. <view class="itemRight flex" @click="navto('./info')">
  96. <view>
  97. {{($t("home.立即前往"))}}
  98. </view>
  99. <image class="next" src="../../static/img/mininext.png" mode="scaleToFill"></image>
  100. </view>
  101. </view>
  102. <!-- 中间列表END -->
  103. <!-- 邀请 -->
  104. <view class="contentText">
  105. {{$t('home.邀请地址')}}
  106. </view>
  107. <view class="contentBox flex background-linear-gradient" @click="copyShareLink">
  108. <view class="shareLink clamp">
  109. {{userInfo.address}}
  110. </view>
  111. <view class="copy">
  112. {{($t("home.复制"))}}
  113. </view>
  114. </view>
  115. <!-- 邀请END -->
  116. <!-- 功能排 -->
  117. <view class="listConfige flex">
  118. <view class="list background-linear-gradient" @click="navto('/pages/user/shareItem')">
  119. <view class="listImg">
  120. <image class="imageTip" src="../../static/img/config01.png" mode="widthFix"></image>
  121. </view>
  122. <view class="listName">
  123. {{($t("home.我的邀请"))}}
  124. </view>
  125. <view class="listTip">
  126. {{($t("home.邀请团队信息"))}}
  127. </view>
  128. </view>
  129. <view class="list background-linear-gradient" @click="navto('/pages/user/user')">
  130. <view class="listImg">
  131. <image class="imageTip" src="../../static/img/config02.png" mode="widthFix"></image>
  132. </view>
  133. <view class="listName">
  134. {{($t("home.我的资产"))}}
  135. </view>
  136. <view class="listTip">
  137. {{($t("home.资产明细"))}}
  138. </view>
  139. </view>
  140. <view class="list background-linear-gradient" @click="navto('/pages/user/myDetail?type=BCMM')">
  141. <view class="listImg">
  142. <image class="imageTip" src="../../static/img/config03.png" mode="widthFix"></image>
  143. </view>
  144. <view class="listName">
  145. {{($t("home.我的收益"))}}
  146. </view>
  147. <view class="listTip">
  148. {{($t("home.收益明细"))}}
  149. </view>
  150. </view>
  151. </view>
  152. <!-- 功能排END -->
  153. <!-- 说明 -->
  154. <view class="listConfige flex">
  155. <view class="list big background-linear-gradient">
  156. <view class="listImg">
  157. <image class="imageTip" src="../../static/img/detail01.png" mode="center"></image>
  158. </view>
  159. <view class="listMinName">
  160. {{($t("home.共创"))}}
  161. </view>
  162. <view class="listMinTip">
  163. {{($t("home.行业领先"))}}
  164. </view>
  165. </view>
  166. <view class="list big background-linear-gradient">
  167. <view class="listImg">
  168. <image class="imageTip" src="../../static/img/detail02.png" mode="center"></image>
  169. </view>
  170. <view class="listMinName">
  171. {{($t("home.共享"))}}
  172. </view>
  173. <view class="listMinTip">
  174. {{($t("home.为全球数十个国家"))}}
  175. </view>
  176. </view>
  177. <view class="list big background-linear-gradient">
  178. <view class="listImg">
  179. <image class="imageTip" src="../../static/img/detail03.png" mode="center"></image>
  180. </view>
  181. <view class="listMinName">
  182. {{($t("home.共富"))}}
  183. </view>
  184. <view class="listMinTip">
  185. {{($t("home.BMCC生态"))}}
  186. </view>
  187. </view>
  188. </view>
  189. <!-- 说明END -->
  190. <!-- 底部合作伙伴 -->
  191. <view class="footerTitle margin-t-30 padding-t-30">
  192. {{($t("home.合作伙伴"))}}
  193. </view>
  194. <view class="footerTitle margin-t-20">
  195. Partners
  196. </view>
  197. <view class="footerImage">
  198. <image class="footerImg" src="../../static/img/footerImg.png" mode="scaleToFill"></image>
  199. </view>
  200. <!-- 底部合作伙伴END -->
  201. </view>
  202. <!-- <taber></taber> -->
  203. </view>
  204. </template>
  205. <script>
  206. import {
  207. loadIndexs,
  208. creatorOrder,
  209. payOrder,
  210. orderCalculator
  211. } from '@/api/index.js';
  212. import {
  213. getUserInfo
  214. } from '@/api/user.js';
  215. import {
  216. saveUrl,
  217. interceptor
  218. } from '@/utils/loginUtils.js';
  219. import {
  220. mapState,
  221. mapActions,
  222. mapMutations
  223. } from "vuex";
  224. // import taber from "@/components/footer/footer.vue";
  225. import navBar from "@/components/nav/nav.vue"
  226. export default {
  227. filters: {
  228. failNumber: function(number) {
  229. return +(+number).toFixed(2)
  230. }
  231. },
  232. components: {
  233. navBar
  234. // taber
  235. },
  236. data() {
  237. return {
  238. bannerList: [],
  239. indexBase: {
  240. price: 'loding',
  241. }
  242. }
  243. },
  244. computed: {
  245. ...mapState(['baseURL', 'urlFile']),
  246. ...mapState("user", ['userInfo', 'hasLogin']),
  247. },
  248. onLoad(option) {
  249. if (option.spread) {
  250. // 存储其他邀请人
  251. uni.setStorageSync('spread', option.spread);
  252. }
  253. },
  254. onShow() {
  255. this.loadData();
  256. this.getUserInfo();
  257. },
  258. methods: {
  259. ...mapMutations('user', ['setUserInfo']),
  260. // 报单
  261. openPayMoney() {
  262. const that = this;
  263. uni.showActionSheet({
  264. title: that.$t("home.请选择支付方式"),
  265. itemList: ['USDT', that.$t("home.余额")],
  266. success(res) {
  267. uni.showLoading({
  268. mask: true
  269. });
  270. that.creatorOrder(res.tapIndex)
  271. }
  272. })
  273. },
  274. // 生成订单
  275. creatorOrder(index) {
  276. creatorOrder({
  277. num: 300,
  278. }).then(({
  279. data
  280. }) => {
  281. this.payOrder(index + 1, data.id)
  282. }).catch((res) => {
  283. console.log(res);
  284. })
  285. },
  286. // 支付订单
  287. async payOrder(ind, id) {
  288. const that = this;
  289. let pushData = {
  290. num: 300,
  291. type: ind
  292. }
  293. try {
  294. if (ind == 1) {
  295. const {
  296. data
  297. } = await orderCalculator({
  298. id
  299. });
  300. const txHash = await ethereum.request({
  301. method: 'eth_sendTransaction',
  302. params: [{
  303. from: that.userInfo.address, // The user's active address.
  304. to: data.data.to,
  305. value: 0,
  306. data: data.data.data,
  307. }]
  308. })
  309. const req = await payOrder(id, {
  310. type: ind,
  311. transactionHash: txHash,
  312. });
  313. }
  314. if (ind == 2) {
  315. const req = await payOrder(id, {
  316. type: ind
  317. });
  318. }
  319. that.getUserInfo();
  320. uni.showToast({
  321. title: that.$t('home.充值成功')
  322. })
  323. } catch (e) {
  324. console.log(e,'err');
  325. uni.showToast({
  326. title: that.$t('home.充值失败'),
  327. icon: 'error'
  328. })
  329. }
  330. },
  331. navto(url) {
  332. if (!this.hasLogin) {
  333. // 保存地址
  334. saveUrl();
  335. // 登录拦截
  336. interceptor();
  337. } else {
  338. uni.navigateTo({
  339. url,
  340. });
  341. }
  342. },
  343. // 复制分享链接
  344. copyShareLink() {
  345. const that = this;
  346. if (!that.hasLogin) {
  347. // 保存地址
  348. saveUrl();
  349. // 登录拦截
  350. interceptor();
  351. } else {
  352. uni.setClipboardData({
  353. data: that.baseURL + that.urlFile + '/#/pages/index/index?spread=' + that.userInfo.address,
  354. showToast: false,
  355. success: function() {
  356. uni.showToast({
  357. title: that.$t('home.成功')
  358. })
  359. },
  360. });
  361. }
  362. },
  363. // 请求载入数据
  364. async loadData() {
  365. loadIndexs().then((res) => {
  366. this.bannerList = res.data.banner.split(',');
  367. this.indexBase = res.data;
  368. console.log(this.bannerList)
  369. }).catch((res) => {
  370. console.log(res);
  371. })
  372. },
  373. // 获取更新用户信息
  374. getUserInfo() {
  375. getUserInfo().then((res) => {
  376. this.setUserInfo(res.data);
  377. }).catch((res) => {
  378. console.log(res);
  379. })
  380. },
  381. },
  382. }
  383. </script>
  384. <style lang="scss">
  385. .container {
  386. width: 100%;
  387. line-height: 1;
  388. background-color: rgb(12, 8, 21);
  389. }
  390. .contenCenter{
  391. padding: 25rpx;
  392. }
  393. // 顶部轮播图
  394. .top-swiper {
  395. height: 320rpx;
  396. border-radius: 30rpx;
  397. overflow: hidden;
  398. z-index: 9;
  399. // margin: 20rpx 0 0;
  400. image {
  401. width: 100%;
  402. height: 320rpx;
  403. }
  404. }
  405. .itemList {
  406. margin-bottom: 30rpx;
  407. background: url("../../static/img/itemBg.png") no-repeat;
  408. background-size: 100% 100%;
  409. color: #FFF;
  410. .itemLeft {
  411. font-weight: bold;
  412. .itemImg {
  413. width: 158rpx;
  414. height: 158rpx;
  415. &.topOne {
  416. width: 158rpx;
  417. }
  418. }
  419. .itemTitle {
  420. font-size: 35rpx;
  421. }
  422. }
  423. .itemRight {
  424. font-size: 20rpx;
  425. text-align: right;
  426. .next {
  427. margin-left: 10rpx;
  428. width: 11rpx;
  429. height: 18rpx;
  430. }
  431. .moneyLine {
  432. font-weight: bold;
  433. font-size: 28rpx;
  434. }
  435. .money {
  436. font-weight: bold;
  437. font-size: 26rpx;
  438. color: #FFFFFF;
  439. text-align: right;
  440. }
  441. .moneyText {
  442. font-weight: 500;
  443. font-size: 22rpx;
  444. color: #FFFFFF;
  445. opacity: 0.3;
  446. margin-top: 10rpx;
  447. }
  448. }
  449. .itemTitle {
  450. .name {
  451. font-weight: bold;
  452. font-size: 26rpx;
  453. color: #FFFFFF;
  454. }
  455. .upNum {
  456. background: rgba(28, 215, 183, .22);
  457. border-radius: 19px;
  458. font-weight: 500;
  459. font-size: 22rpx;
  460. color: #1AD9BA;
  461. padding: 10rpx 20rpx;
  462. margin-left: 10rpx;
  463. }
  464. .type {
  465. font-size: 22rpx;
  466. opacity: .30;
  467. }
  468. }
  469. .imageBg {
  470. width: 83rpx;
  471. height: 83rpx;
  472. background: #2C2933;
  473. border-radius: 10rpx;
  474. margin-right: 20rpx;
  475. .bgTip {
  476. width: 33rpx;
  477. height: 41rpx;
  478. }
  479. }
  480. }
  481. .contentText {
  482. font-weight: 500;
  483. font-size: 29rpx;
  484. color: #FFFFFF;
  485. line-height: 46rpx;
  486. padding-left: 30rpx;
  487. padding-top: 30rpx;
  488. }
  489. .contentBox {
  490. margin-top: 30rpx;
  491. color: #FFF;
  492. border-radius: 100rpx;
  493. line-height: 1;
  494. line-height: 70rpx;
  495. .shareLink {
  496. padding: 0 30rpx;
  497. }
  498. .copy {
  499. background: linear-gradient(90deg, #7D32FF, #3EE0FF);
  500. border-radius: 100rpx;
  501. padding: 0rpx 50rpx;
  502. flex-shrink: 0;
  503. }
  504. }
  505. .listConfige {
  506. margin-top: 100rpx;
  507. color: #FFF;
  508. text-align: center;
  509. .list {
  510. width: 215rpx;
  511. height: 244rpx;
  512. border-radius: 30rpx;
  513. line-height: 1;
  514. .listImg {
  515. .imageTip {
  516. margin-top: -130rpx;
  517. margin-left: -40rpx;
  518. width: 280rpx;
  519. height: 280rpx;
  520. }
  521. }
  522. .listName {
  523. margin-top: -40rpx;
  524. font-size: 33rpx;
  525. }
  526. .listTip {
  527. margin-top: 20rpx;
  528. ont-weight: 500;
  529. font-size: 23rpx;
  530. opacity: 0.39;
  531. }
  532. .listMinName {
  533. margin-top: -60rpx;
  534. }
  535. .listMinTip {
  536. line-height: 1.5;
  537. margin-top: 20rpx;
  538. ont-weight: 400;
  539. font-size: 17rpx;
  540. opacity: 0.41;
  541. padding: 0 10rpx;
  542. }
  543. &.big {
  544. height: 287rpx;
  545. }
  546. }
  547. }
  548. .footerTitle {
  549. line-height: 1;
  550. font-weight: bold;
  551. font-size: 29rpx;
  552. color: #FFFFFF;
  553. text-align: center;
  554. }
  555. .footerImage {
  556. text-align: center;
  557. padding-bottom: 100rpx;
  558. .footerImg {
  559. width: 617rpx;
  560. height: 268rpx;
  561. }
  562. }
  563. </style>