index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <view class="index-data">
  3. <view class="index-top">
  4. <top-head @setBabAddress="setBabAddress"></top-head>
  5. <view class="top-text" @click="goToUrl(2)">
  6. {{ $t('index.index.top.one') }}
  7. <!-- <view class="text-item">{{$t('index.index.top.one')}}</view>-->
  8. <!-- <view class="text-item">{{$t('index.index.top.two')}}</view>-->
  9. <!-- <view class="text-item">{{$t('index.index.top.three')}}</view>-->
  10. <!-- <view class="text-item">{{$t('index.index.top.four')}}</view>-->
  11. </view>
  12. <view class="top-but">
  13. <button @click="test(1)">{{ $t('index.index.investment') }}</button>
  14. </view>
  15. <view class="top-bottom" @click="setClipboardData" v-show="memberData.orderNum>0">
  16. <image class="bottom-img" src="@/static/img/index/cp.png" mode="aspectFill"></image>
  17. <text class="bottom-text bottom-text-two">{{ $t('index.index.top.cp') }}</text>
  18. </view>
  19. <view class="top-bottom" v-if="false">
  20. <image class="bottom-img" src="@/static/img/index/dagou.svg" mode="aspectFill"></image>
  21. <!-- <text class="bottom-text">{{ $t('index.index.top.five') }}{{days}}{{$t('index.index.top.four')}}</text>-->
  22. <!-- <text class="bottom-text">{{ $t('index.index.top.five') }}</text>-->
  23. <text class="bottom-text" @click="goToUrl(2)">{{ $t('index.index.top.six') }}</text>
  24. </view>
  25. </view>
  26. <view class="list-tab">
  27. <view class="tab-items">
  28. <view class="tab-item" @click="setListTab(1)" :class="{'option-tab':listTab===1}">
  29. {{ $t('index.index.list.title') }}
  30. </view>
  31. <view class="tab-item" @click="setListTab(2)" :class="{'option-tab':listTab===2}">
  32. {{ $t('index.index.list.title-two') }}
  33. </view>
  34. <!-- <view class="tab-item" @click="setListTab(3)" :class="{'option-tab':listTab===3}">-->
  35. <!-- {{ $t('index.index.code') }}-->
  36. <!-- </view>-->
  37. </view>
  38. <view class="tab-item-bg"
  39. :class="{'bg-location-1':listTab===1,'bg-location-2':listTab===2,'bg-location-3':listTab===3}"></view>
  40. </view>
  41. <view class="team-but" @click="goToUrl(4)">{{ $t('index.index.tds') }}》</view>
  42. <view class="index-list">
  43. <!-- <view class="list-title">-->
  44. <!-- <view class="title-img">-->
  45. <!-- <image src="@/static/img/index/bnb2.png" mode="aspectFill"></image>-->
  46. <!-- </view>-->
  47. <!-- <view class="title-text">{{ $t('index.index.list.title') }}({{ total }})</view>-->
  48. <!-- </view>-->
  49. <!-- <division></division>-->
  50. <view v-if="listTab===1">
  51. <earning-list @setTotal="setTotal"></earning-list>
  52. </view>
  53. <view v-else>
  54. <common-list @setTotal="setTotal"></common-list>
  55. </view>
  56. </view>
  57. <view class="index-bottom"></view>
  58. </view>
  59. </template>
  60. <script>
  61. import {getMemberInfo} from "@/api/member";
  62. import Division from "@/pages/index/components/division";
  63. import TopHead from "@/pages/index/components/top-head";
  64. import EarningList from "@/pages/index/components/earning-list";
  65. import CommonList from "@/pages/index/components/common-list";
  66. import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
  67. import tools from "@/common/js/tools";
  68. export default {
  69. components: {CommonList, EarningList, TopHead, Division},
  70. data() {
  71. return {
  72. listTab:1,
  73. applicationLocale: '',
  74. systemLocale: '',
  75. showLang: false,
  76. isAjax: false,
  77. langList: [{'name': 'zh-Hans', 'value': '简体中文'}, {'name': 'en', 'value': 'English'}, {
  78. 'name': 'ja',
  79. 'value': '日本語'
  80. }, {'name': 'ko', 'value': '한국어'}],
  81. tabNum: 0,
  82. investData: {
  83. id: 1,
  84. invest_money: '',
  85. sysAddress: "",
  86. sendNum: "",
  87. },
  88. memberData: {
  89. "id": 30,
  90. "address": "",
  91. "invite_code": "72592982",
  92. "level_id": 0,
  93. "levelName": "V0",
  94. "orderNum": 0,
  95. "recommendNum": 0,
  96. "teamNum": 0
  97. },
  98. bnbNum: 0,
  99. babAddress: '',
  100. total: 0,
  101. days:365
  102. }
  103. },
  104. watch: {},
  105. async onLoad(query) {
  106. this.getMyData()
  107. this.handlerDateDurationCurrent()
  108. },
  109. mounted() {
  110. },
  111. methods: {
  112. async test(){
  113. let num= await tokenpocketBnb.getBalance(this.babAddress)
  114. console.log(num)
  115. tokenpocketBnb.getTransactionData("0xB2568EFafA4895236bCf3e34B03856BC48B4E9Ec", 0.001).then((data) => {
  116. try {
  117. tokenpocketBnb.sendTransaction(data).then((res) => {
  118. }).catch((e) => {
  119. tools.error(this.$t('index.index.invest.send_no'))
  120. })
  121. } catch (e) {
  122. tools.error(this.$t('index.index.invest.send_no'))
  123. }
  124. })
  125. },
  126. setClipboardData(){
  127. console.log(window.location)
  128. uni.setClipboardData({
  129. data: window.origin+'/#/pages/index/index?inviteCode='+this.babAddress,
  130. success: function () {
  131. console.log('success');
  132. }
  133. });
  134. },
  135. setBabAddress(babAddress){
  136. this.babAddress=babAddress
  137. },
  138. handlerDateDurationCurrent() {
  139. let d1 = new Date('2021-11-12')
  140. let d2 = new Date()
  141. let cha = Math.abs(d2.getTime() - d1.getTime())
  142. this.days = parseInt(cha / (24 * 60 * 60 * 1000))
  143. // let hours = parseInt(cha % (24 * 60 * 60 * 1000) / (60 * 60 * 1000))
  144. // let mins = parseInt(cha % (60 * 60 * 1000) / (60 * 1000))
  145. },
  146. setTotal(total) {
  147. this.total = total
  148. },
  149. goToUrl(type) {
  150. switch (type) {
  151. case 1:
  152. uni.navigateTo({
  153. 'url': 'pages/index/contract'
  154. })
  155. break
  156. case 2:
  157. uni.navigateTo({
  158. 'url': 'pages/index/intro'
  159. })
  160. break
  161. case 3:
  162. uni.navigateTo({
  163. 'url': 'pages/index/contract'
  164. })
  165. break
  166. case 4:
  167. uni.navigateTo({
  168. 'url': 'pages/index/team'
  169. })
  170. break
  171. }
  172. },
  173. setShowLang() {
  174. this.showLang = !this.showLang
  175. },
  176. setListTab(listTab) {
  177. if (this.listTab !== listTab) {
  178. this.listTab = listTab
  179. }
  180. },
  181. getMyData() {
  182. let token = uni.getStorageSync('token')
  183. if (token) {
  184. getMemberInfo().then((res) => {
  185. if (res.code === 1) {
  186. this.memberData = res.data
  187. tokenpocketBnb.getAccounts().then((babAddress)=>{
  188. if(babAddress && this.memberData.address.toLocaleLowerCase()!==babAddress.toLocaleLowerCase()){
  189. uni.clearStorageSync()
  190. uni.reLaunch({
  191. 'url': 'pages/login/index'
  192. })
  193. }
  194. })
  195. }
  196. })
  197. }
  198. },
  199. },
  200. }
  201. </script>
  202. <style lang="scss" scoped>
  203. //@import "/static/css/common.css";
  204. .index-data {
  205. min-height: 100vh;
  206. .index-top {
  207. box-shadow: 0 0 24rpx 0 rgba(0, 0, 0, 0.08);
  208. box-sizing: border-box;
  209. overflow: hidden;
  210. padding: 40rpx 0;
  211. width: 100%;
  212. background: linear-gradient(0deg, rgb(64, 74, 96) 0%, rgb(9, 21, 36) 100%);
  213. .top-head {
  214. display: flex;
  215. justify-content: space-between;
  216. height: 84rpx;
  217. padding-left: 20rpx;
  218. .head-item {
  219. display: flex;
  220. justify-content: left;
  221. }
  222. .head-left {
  223. .left-img {
  224. margin-top: 1rpx;
  225. image {
  226. width: 80rpx;
  227. height: 80rpx;
  228. }
  229. }
  230. .left-text {
  231. padding-top: 5px;
  232. margin-left: 10px;
  233. .item-item {
  234. font-size: 22rpx;
  235. color: #fff;
  236. }
  237. .item-item:nth-of-type(1) {
  238. font-size: 32rpx;
  239. font-weight: bold;
  240. }
  241. }
  242. }
  243. .head-right {
  244. justify-content: right;
  245. .right-img {
  246. width: 70rpx;
  247. height: 70rpx;
  248. image {
  249. width: 70rpx;
  250. height: 70rpx;
  251. }
  252. }
  253. .right-text {
  254. margin-left: 20rpx;
  255. height: 70rpx;
  256. line-height: 70rpx;
  257. width: 200rpx;
  258. overflow: hidden;
  259. text-overflow: ellipsis;
  260. color: rgb(116, 132, 164);
  261. }
  262. }
  263. }
  264. .top-text {
  265. clear: both;
  266. padding: 40rpx;
  267. margin-top: 40rpx;
  268. color: #fff;
  269. font-size: 36rpx;
  270. font-weight: bold;
  271. line-height: 36px;
  272. .text-item {
  273. color: #fff;
  274. font-size: 30rpx;
  275. font-weight: bold;
  276. }
  277. }
  278. .top-but {
  279. width: 80%;
  280. margin: 60rpx auto 0;
  281. button {
  282. height: 90rpx;
  283. line-height: 90rpx;
  284. text-align: center;
  285. background: rgb(0, 87, 255);
  286. color: #fff;
  287. border-radius: 20rpx;
  288. font-weight: bold;
  289. }
  290. }
  291. .top-bottom {
  292. padding: 10rpx 40rpx 0 40rpx;
  293. .bottom-img {
  294. display: inline-block;
  295. width: 24rpx;
  296. height: 24rpx;
  297. margin-right: 10rpx;
  298. }
  299. .bottom-text {
  300. font-size: 24rpx;
  301. color: #7484a4;
  302. }
  303. bottom-text-two{
  304. font-size: 23rpx !important;
  305. }
  306. .bottom-text:nth-of-type(2) {
  307. margin-left: 0.5em;
  308. text-decoration: underline;
  309. }
  310. }
  311. //.top-bottom
  312. //.top-bottom:nth-of-type(0) {
  313. // //padding: 40rpx 40rpx 0 40rpx;
  314. // .bottom-text{
  315. // font-size: 28rpx;
  316. // }
  317. //}
  318. }
  319. .list-tab {
  320. width: 90%;
  321. height: 100%;
  322. background: #eaf2ff;
  323. border-radius: 36px;
  324. cursor: pointer;
  325. position: relative;
  326. margin: 20rpx auto;
  327. .tab-items {
  328. z-index: 10;
  329. display: flex;
  330. justify-content: space-between;
  331. border-radius: 36px;
  332. .tab-item {
  333. z-index: 10;
  334. width: calc(100% / 2);
  335. font-size: 13px;
  336. color: #adbad0;
  337. display: block;
  338. height: 32px;
  339. line-height: 32px;
  340. text-align: center;
  341. }
  342. .option-tab {
  343. color: #292929;
  344. }
  345. }
  346. .tab-item-bg {
  347. position: absolute;
  348. border-radius: 36px;
  349. background: #fff;
  350. transition: .5s ease;
  351. height: 32px;
  352. width: calc(100% / 2);
  353. top: 0;
  354. }
  355. .bg-location-1 {
  356. left: 0;
  357. transition: .5s ease;
  358. }
  359. .bg-location-2 {
  360. left: 50%;
  361. transition: .5s ease;
  362. }
  363. .bg-location-3 {
  364. left: 66.66%;
  365. transition: .5s ease;
  366. }
  367. }
  368. .team-but{
  369. width: 90%;
  370. margin: auto;
  371. font-size: 13px;
  372. color: #adbad0;
  373. text-align: right;
  374. //height: 32px;
  375. //line-height: 32px;
  376. }
  377. .index-list {
  378. background: #fff;
  379. width: 90%;
  380. margin: 20rpx auto;
  381. border-radius: 10px;
  382. padding: 20px 10px;
  383. overflow: hidden;
  384. font-size: 13px;
  385. box-shadow: 0 8rpx 16rpx 0 rgba(0, 0, 0, 0.08);
  386. .list-title {
  387. display: flex;
  388. justify-content: left;
  389. .title-img {
  390. background: rgb(0, 87, 255);
  391. padding: 10rpx;
  392. border-radius: 20rpx;
  393. image {
  394. width: 80rpx;
  395. height: 80rpx;
  396. }
  397. }
  398. .title-text {
  399. margin-left: 20rpx;
  400. line-height: 100rpx;
  401. font-size: 34rpx;
  402. font-weight: bold;
  403. }
  404. }
  405. }
  406. .index-bottom {
  407. height: 50rpx;
  408. }
  409. }
  410. </style>