index.vue 10 KB

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