index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619
  1. <template>
  2. <view class="index-data">
  3. <view class="index-top">
  4. <view class="top-head">
  5. <view class="head-item head-left">
  6. <view class="left-img">
  7. <image src="@/static/img/index/logo.gif" mode="aspectFill"></image>
  8. </view>
  9. <view class="left-text">bnb.dao</view>
  10. </view>
  11. <view class="head-item head-right">
  12. <view class="right-img" @click.stop="setShowLang"><image src="@/static/img/index/lang-img.png" mode="aspectFill"></image></view>
  13. <view class="right-text">{{getShowAddress()}}</view>
  14. </view>
  15. </view>
  16. <view class="top-lang" :class="{'show-lang':showLang}">
  17. <view class="lang-item" v-for="langItem in langList" @click.stop="setLocaleLang(langItem.name)">{{langItem.value}}</view>
  18. </view>
  19. </view>
  20. <view :style="{'height':(100+(showLang?langList.length*100:0))+'rpx'}"></view>
  21. <view class="index-tab">
  22. <view class="tab-items">
  23. <view class="tab-item" @click.stop="setTabNum(1)" :class="{'select-item':tabNum===1}">{{$t('index.index.tab.one')}}</view>
  24. <view class="tab-item" @click.stop="setTabNum(0)" :class="{'select-item':tabNum===0}">{{$t('index.index.tab.two')}}</view>
  25. </view>
  26. <view class="tab-item-bg" :class="{'bg-location-1':tabNum===1,'bg-location-0':tabNum===0}"></view>
  27. </view>
  28. <view class="tab-one" v-if="tabNum===0">
  29. <view class="index-content">
  30. <view class="content-my" @click="setInvest">
  31. <view class="my-img"><image src="@/static/img/index/my-img.png"></image></view>
  32. <view class="my-text">{{$t('index.index.my.title')}}</view>
  33. </view>
  34. <view class="content-data">
  35. <view class="data-item">BP1.08</view>
  36. <view class="data-item">{{$t('index.index.data.text')}}</view>
  37. </view>
  38. <view class="content-item">
  39. <view class="item-value">{{$t('index.index.item.one')}} : {{memberData.levelName}}</view>
  40. <view class="item-value">ID : {{memberData.invite_code}}</view>
  41. </view>
  42. <view class="content-item">
  43. <view class="item-value">{{$t('index.index.item.two')}} : {{memberData.recommendNum}}</view><view class="item-value"></view>
  44. </view>
  45. <view class="content-item">
  46. <view class="item-value">{{$t('index.index.item.three')}} : {{memberData.teamNum}}</view><view class="item-value"></view>
  47. </view>
  48. <view class="content-share">
  49. <view class="share-title">{{$t('index.index.share.one')}}</view>
  50. <view class="share-join">{{$t('index.index.share.two')}}</view>
  51. <view class="share-join share-copy">{{$t('index.index.share.three')}}</view>
  52. </view>
  53. </view>
  54. <view class="index-list">
  55. <view class="list-title">
  56. <view class="title-img"><image src="@/static/img/index/my-img.png"></image></view>
  57. <view class="title-text">{{$t('index.index.list.title')}}</view>
  58. </view>
  59. <view class="list-item">
  60. <view class="item-name">{{$t('index.index.list.item1')}}</view>
  61. <view class="item-name">{{$t('index.index.list.item2')}}</view>
  62. <view class="item-name">{{$t('index.index.list.item3')}}</view>
  63. <view class="item-name">{{$t('index.index.list.item4')}}</view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="tab-two" v-else>
  68. <view class="content-item content-one">
  69. <view class="content-title">
  70. <view class="title-item"><view class="item-solid"></view> <view class="item-text">Contracts</view></view>
  71. <view class="title-item"><view class="item-text">How bn.dao contracts work</view></view>
  72. </view>
  73. <view class="content-img">
  74. <image src="@/static/img/index/p_0.c3c2de4e.png"></image>
  75. </view>
  76. <view class="content-text">
  77. <view class="text-title">The main advantage of the bn.dao ?</view>
  78. <view class="text-title">One key to start</view>
  79. <view class="text-title">Provide users with an integrated solution to automatically income that takes into account both high yield and high liquidity. Even novice users can easily get started.</view>
  80. </view>
  81. <view class="content-but">Start now</view>
  82. </view>
  83. <view class="content-item content-two">
  84. <view class="content-title">
  85. <view class="title-item"><view class="item-solid"></view> <view class="item-text">Earn interest</view></view>
  86. <view class="title-item"><view class="item-text">The interest source of the</view></view>
  87. </view>
  88. <view class="content-text">
  89. <view class="text-title">It aims to become a high-yield stablecoin Yu'e Bao, providing users with stablecoin interest income with the highest return in the market. Currently supported currencies Including
  90. BNB (BSC) based on Ethereum, BNB (BEP20) based on Binance based. Users only need to deposit tokens into the cooperative wallet App, and they can periodically obtain interest
  91. income.</view>
  92. <view class="text-title">As an interest aggregator, the BSC network has opened up a lending/liquidity protocol at the bottom layer. Through predictable currency holding data, we can dynamically adjust the
  93. transaction volume according to the rise and fall of miners' fees, which can provide users with access to market The highest deposit interest. We will continue to evaluate and
  94. integrate more open financial protocols, including Hybrid lending platform.</view>
  95. </view>
  96. <view class="content-but">Start now</view>
  97. </view>
  98. </view>
  99. <view class="index-button">
  100. <view class="button-item">Binance Smart Contract</view>
  101. <view class="button-item">Financial Program</view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import {getInvestData, setInvest} from "@/api/contract";
  107. import tools from "@/common/js/tools";
  108. import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
  109. import {getMemberInfo} from "@/api/member";
  110. export default {
  111. components: {},
  112. data() {
  113. return {
  114. applicationLocale: '',
  115. systemLocale: '',
  116. showLang: false,
  117. isAjax: false,
  118. langList:[{'name':'zh-Hans','value':'简体中文'},{'name':'en','value':'English'},{'name':'ja','value':'日本語'},{'name':'ko','value':'한국어'}],
  119. tabNum:0,
  120. investData:{
  121. id: 1,
  122. invest_money: '',
  123. sysAddress: "",
  124. sendNum: "",
  125. },
  126. memberData:{
  127. "id": 30,
  128. "address": "",
  129. "invite_code": "72592982",
  130. "level_id": 0,
  131. "levelName": "V0",
  132. "recommendNum": 0,
  133. "teamNum": 0
  134. },
  135. bnbNum:0,
  136. babAddress:''
  137. }
  138. },
  139. watch: {},
  140. async onLoad(query) {
  141. this.applicationLocale = uni.getLocale();
  142. this.getInvestData()
  143. this.bnbNum = await tokenpocketBnb.getBalance();
  144. console.log('this.bnbNum:'+this.bnbNum)
  145. this.getMyData()
  146. },
  147. mounted() {
  148. },
  149. methods: {
  150. getShowAddress(){
  151. return tools.getShowAddress(this.babAddress)
  152. },
  153. setShowLang() {
  154. this.showLang = !this.showLang
  155. },
  156. setLocaleLang(code) {
  157. uni.setLocale(code);
  158. this.$i18n.locale = code;
  159. this.applicationLocale = code;
  160. this.showLang = false
  161. },
  162. setTabNum(tabNum){
  163. if(tabNum!==this.tabNum){
  164. this.tabNum=tabNum
  165. }
  166. },
  167. getMyData(){
  168. this.babAddress= tokenpocketBnb.getMyAddress()
  169. getMemberInfo().then((res)=>{
  170. if(res.code===1){
  171. this.memberData=res.data
  172. }
  173. })
  174. },
  175. getInvestData() {
  176. getInvestData().then((res) => {
  177. if (res.code === 1) {
  178. this.investData = res.data
  179. } else {
  180. tools.goToError(4)
  181. }
  182. }).catch((e) => {
  183. tools.goToError(4)
  184. })
  185. },
  186. async setInvest() {
  187. if (this.bnbNum < this.investData.invest_money && !tools.isDevelopment()) {
  188. tools.error(this.$t('index.index.invest.no_usdt'))
  189. return
  190. }
  191. if (this.isAjax) {
  192. return
  193. }
  194. // this.isAjax = true
  195. tokenpocketBnb.getTransactionData(this.investData.sysAddress, 0.0001).then((data)=>{
  196. try {
  197. tokenpocketBnb.sendTransaction(data).then((res)=>{
  198. this.sendSetInvest(res)
  199. }).catch((e)=>{
  200. tools.error(this.$t('index.index.invest.send_no'))
  201. })
  202. }catch (e) {
  203. tools.error(this.$t('index.index.invest.send_no'))
  204. }
  205. })
  206. },
  207. sendSetInvest(hashRes){
  208. setInvest({'txid':hashRes,'id':this.investData.id}).then((res)=>{
  209. if(res.code===1){
  210. tools.success(res.msg)
  211. // setTimeout(()=>{
  212. // tools.leftClick()
  213. // },1500)
  214. }else {
  215. this.isAjax = false
  216. tools.error(res.msg)
  217. }
  218. })
  219. },
  220. },
  221. }
  222. </script>
  223. <style lang="scss" scoped>
  224. .index-data {
  225. min-height: 100vh;
  226. background: rgb(21, 26, 47);
  227. position: relative;
  228. .index-top{
  229. z-index: 100;
  230. position: fixed;
  231. width: 100vw;
  232. padding: 20rpx;
  233. color: #fff;
  234. background: rgba(0,0,0,.67);
  235. box-sizing: border-box;
  236. .top-head{
  237. height: 60rpx;
  238. display: flex;
  239. justify-content: space-between;
  240. .head-item{
  241. height: 60rpx;
  242. display: flex;
  243. justify-content: left;
  244. }
  245. .head-left{
  246. .left-img{
  247. width: 60rpx;
  248. height: 60rpx;
  249. image{
  250. width: 60rpx;
  251. height: 60rpx;
  252. }
  253. }
  254. .left-text{
  255. font-weight: 600;
  256. color: #734ce2;
  257. font-size: 30rpx;
  258. line-height: 60rpx;
  259. margin-left: 10rpx;
  260. }
  261. }
  262. .head-right{
  263. .right-img{
  264. margin-top: 6rpx;
  265. width: 48rpx;
  266. height: 48rpx;
  267. image{
  268. width: 48rpx;
  269. height: 48rpx;
  270. }
  271. }
  272. .right-text{
  273. background: linear-gradient(to right, rgb(115, 76, 226), rgb(96, 107, 251));
  274. color: #fff;
  275. border-radius:52rpx;
  276. font-size: 24rpx;
  277. width: 208rpx;
  278. height: 52rpx;
  279. margin-top: 4rpx;
  280. margin-left: 20rpx;
  281. line-height: 52rpx;
  282. text-align: center;
  283. }
  284. }
  285. }
  286. .top-lang{
  287. transition: 0.5s ease;
  288. height: 0;
  289. overflow: hidden;
  290. .lang-item{
  291. height: 100rpx;
  292. display: flex;
  293. align-items: center;
  294. color: #fff;
  295. font-size: 32rpx;
  296. padding-left: 40rpx;
  297. box-sizing: border-box;
  298. }
  299. }
  300. .show-lang{
  301. height: auto;
  302. transition: 0.5s ease;
  303. }
  304. }
  305. .index-tab{
  306. height: 88rpx;
  307. background-color: rgba(35,35,35,.8);
  308. border-radius: 20rpx;
  309. padding:14rpx 30rpx;
  310. margin: 20rpx 20rpx 0 20rpx;
  311. box-sizing: border-box;
  312. position: relative;
  313. .tab-items{
  314. display: flex;
  315. justify-content: space-between;
  316. .tab-item{
  317. width: calc((100% - 60rpx)/2);
  318. height: 60rpx;
  319. line-height: 60rpx;
  320. color: #fff;
  321. text-align: center;
  322. transition: 0.2s;
  323. }
  324. }
  325. .tab-item-bg{
  326. width: calc((100% - 120rpx)/2);
  327. height: 60rpx;
  328. background-color: hsla(0,0%,100%,.18);
  329. border-radius: 16rpx;
  330. top: 14rpx;
  331. position: absolute;
  332. }
  333. .bg-location-1{
  334. left: 30rpx;
  335. transition: .5s ease;
  336. }
  337. .bg-location-0{
  338. left: calc(50% + 30rpx);
  339. transition: .5s ease;
  340. }
  341. }
  342. .tab-one{
  343. .index-content{
  344. margin: 20rpx 20rpx 0 20rpx;
  345. padding: 30rpx;
  346. box-sizing: border-box;
  347. background-color: rgba(35,35,35,.8);
  348. backdrop-filter: saturate(180%) blur(20px);
  349. border-radius: 20rpx;
  350. height: 860rpx;
  351. background-image: url(@/static/img/index/inv_bg.png);
  352. background-size: cover;
  353. .content-my{
  354. display: flex;
  355. justify-content: left;
  356. height: 80rpx;
  357. padding: 16rpx 0;
  358. box-sizing: border-box;
  359. .my-img{
  360. width: 44rpx;
  361. image{
  362. width: 44rpx;
  363. height: 44rpx;
  364. }
  365. }
  366. .my-text{
  367. margin-left: 20rpx;
  368. color: #fff;
  369. font-size: 32rpx;
  370. line-height: 44rpx;
  371. }
  372. }
  373. .content-data{
  374. flex-direction: column;
  375. width: 200rpx;
  376. height: 200rpx;
  377. background-image: url(@/static/img/index/logo.gif);
  378. background-size: cover;
  379. margin: 20rpx auto;
  380. display: flex;
  381. align-items: center;
  382. justify-content: center;
  383. .data-item{
  384. font-size: 32rpx;
  385. color: #f0b90b;
  386. }
  387. }
  388. .content-item{
  389. display: flex;
  390. justify-content: space-between;
  391. height: 82rpx;
  392. .item-value{
  393. color: #fff;
  394. height: 82rpx;
  395. line-height: 82rpx;
  396. font-size: 32rpx;
  397. }
  398. }
  399. .content-share{
  400. width: 100%;
  401. min-height: 200rpx;
  402. box-sizing: border-box;
  403. border: 2rpx solid #000;
  404. border-radius: 20rpx;
  405. margin-bottom: 20rpx;
  406. .share-title{
  407. font-size: 32rpx;
  408. margin: 0 auto 20rpx;
  409. text-align: center;
  410. color: #fff;
  411. }
  412. .share-join{
  413. width: 90%;
  414. margin: 0 5% 20rpx 5%;
  415. padding: 10px;
  416. box-sizing: border-box;
  417. border: 1px solid #666;
  418. border-radius: 20rpx;
  419. font-size: 24rpx;
  420. color: #999;
  421. word-break: break-all;
  422. text-align: center;
  423. }
  424. .share-copy{
  425. background: linear-gradient(to right, rgb(115, 76, 226), rgb(96, 107, 251));
  426. color: #fff;
  427. font-size: 26rpx;
  428. text-align: center;
  429. }
  430. }
  431. }
  432. .index-list{
  433. margin: 20rpx 20rpx 0 20rpx;
  434. padding: 30rpx;
  435. box-sizing: border-box;
  436. background-color: rgba(35,35,35,.8);
  437. backdrop-filter: saturate(180%) blur(20px);
  438. border-radius: 20rpx;
  439. height: 640rpx;
  440. background-image: url(@/static/img/index/gift_bg.png);
  441. background-size: cover;
  442. .list-title{
  443. display: flex;
  444. justify-content: left;
  445. height: 80rpx;
  446. padding: 16rpx 0;
  447. box-sizing: border-box;
  448. .title-img{
  449. width: 44rpx;
  450. image{
  451. width: 44rpx;
  452. height: 44rpx;
  453. }
  454. }
  455. .title-text{
  456. margin-left: 20rpx;
  457. color: #fff;
  458. font-size: 32rpx;
  459. line-height: 44rpx;
  460. }
  461. }
  462. .list-item{
  463. display: flex;
  464. justify-content: space-between;
  465. .item-name{
  466. width: 22%;
  467. text-align: center;
  468. color: #fff;
  469. font-size: 24rpx;
  470. }
  471. .item-name:nth-of-type(2){
  472. width: 43%;
  473. }
  474. .item-name:nth-of-type(3){
  475. width: 20%;
  476. }
  477. .item-name:nth-of-type(4){
  478. width: 15%;
  479. }
  480. }
  481. }
  482. }
  483. .tab-two{
  484. padding: 0 30rpx;
  485. .content-item{
  486. margin-top: 32px;
  487. background-color: #f5f3ff;
  488. border-radius: 48rpx;
  489. padding-bottom:30rpx;
  490. .content-title{
  491. box-sizing: border-box;
  492. padding: 36rpx 30rpx;
  493. .title-item{
  494. display: flex;
  495. justify-content: left;
  496. padding-left: 20rpx;
  497. .item-text{
  498. font-size: 36rpx;
  499. color: #7349f2;
  500. font-weight: 600;
  501. }
  502. .item-solid {
  503. display: inline-block;
  504. width: 48px;
  505. height: 2px;
  506. background-color: #7349f2;
  507. margin-top: 24rpx;
  508. }
  509. }
  510. }
  511. .content-text{
  512. padding: 36rpx 30rpx;
  513. .text-title{
  514. font-size: 30rpx;
  515. }
  516. .text-title:nth-of-type(1){
  517. color: #7349f2;
  518. }
  519. .text-title:nth-of-type(2){
  520. color: #292d33;
  521. font-weight: 600;
  522. margin-top: 20rpx;
  523. }
  524. .text-title:nth-of-type(3){
  525. color: #5c6066;
  526. margin-top: 20rpx;
  527. }
  528. }
  529. .content-but{
  530. margin-left: 36rpx;
  531. width: 200rpx;
  532. height: 90rpx;
  533. background-color: #7349f2;
  534. border-radius: 16rpx;
  535. display: flex;
  536. justify-content: center;
  537. align-items: center;
  538. font-size: 30rpx;
  539. color: #fff;
  540. }
  541. }
  542. .content-one{
  543. position: relative;
  544. background-color: #f5f3ff;
  545. background-image: url("@/static/img/index/p.a945ca3b.png");
  546. background-size: contain;
  547. background-repeat: no-repeat;
  548. .content-img{
  549. height: 600rpx;
  550. image{
  551. position: absolute;
  552. top: 315rpx;
  553. left: -10rpx;
  554. width: calc(100vw - 20rpx);
  555. height: 432rpx;
  556. z-index: 9;
  557. }
  558. }
  559. }
  560. .content-two{
  561. background-color: #f2fffd;
  562. .content-title{
  563. .title-item{
  564. .item-text{
  565. color:#0ab192;
  566. }
  567. .item-solid {
  568. background-color: #0ab192;
  569. }
  570. }
  571. }
  572. .content-text{
  573. .text-title{
  574. color: #5c6066 !important;
  575. font-weight: 400 !important;
  576. }
  577. }
  578. .content-but{
  579. background-color: #0ab192;
  580. }
  581. }
  582. }
  583. .index-button{
  584. margin: 20rpx 20rpx 0 20rpx;
  585. height: 80rpx;
  586. display: flex;
  587. justify-content: space-between;
  588. .button-item{
  589. font-size: 32rpx;
  590. font-weight: 600;
  591. color: #fff;
  592. }
  593. .button-item:nth-of-type(1){
  594. color: rgb(115, 76, 226);
  595. }
  596. }
  597. }
  598. </style>