index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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/logo1.png" mode="aspectFill"></image>
  8. </view>
  9. <view class="left-text">
  10. <view class="item-item">BNBDAO</view>
  11. <view class="item-item">WEB3 DATA</view>
  12. </view>
  13. </view>
  14. <view class="head-item head-right">
  15. <view class="right-img" @click.stop="setShowLang"><image src="@/static/img/index/yy.svg" mode="aspectFill"></image></view>
  16. <view class="right-text">{{babAddress}}</view>
  17. </view>
  18. </view>
  19. <!-- <view class="top-lang" :class="{'show-lang':showLang}">-->
  20. <!-- <view class="lang-item" v-for="langItem in langList" @click.stop="setLocaleLang(langItem.name)">{{langItem.value}}</view>-->
  21. <!-- </view>-->
  22. <view class="top-text">
  23. <view class="text-item">Use your NFTs as collateral</view>
  24. <view class="text-item"> to borrow ETH or deposit</view>
  25. <view class="text-item"> your ETH and earn yields</view>
  26. <view class="text-item"> instantly!</view>
  27. </view>
  28. <view class="top-but">
  29. <button>定金</button>
  30. </view>
  31. <view class="top-bottom">
  32. <image class="bottom-img" src="@/static/img/index/dagou.svg" mode="aspectFill"></image>
  33. <text class="bottom-text">Running SAFE for 236 days. Read more in the </text>
  34. <text class="bottom-text"> Audit report</text>
  35. </view>
  36. </view>
  37. <view class="index-list">
  38. <view class="list-title">
  39. <view class="title-img"> <image src="@/static/img/index/bnb2.png" mode="aspectFill"></image></view>
  40. <view class="title-text">我的收支明细(100)</view>
  41. </view>
  42. <division ></division>
  43. <view v-for="i in 5" class="item">
  44. <view class="list-item">
  45. <view class="item-line">
  46. <view class="item-text">BNB</view>
  47. </view>
  48. <view class="item-line line-text">
  49. <view class="item-text">平台分润</view>
  50. </view>
  51. <view class="item-line">
  52. <view class="item-text">BNB Number</view>
  53. <view class="item-text text-two">
  54. <view class="text-img">
  55. <image src="@/static/img/index/bnb2.png"></image>
  56. </view>
  57. <view class="text">56</view>
  58. </view>
  59. </view>
  60. <view class="item-line">
  61. <view class="item-text">积分</view>
  62. <view class="item-text text-two">
  63. <view class="text-img">
  64. <image src="@/static/img/index/jf.svg"></image>
  65. </view>
  66. <view class="text">56</view>
  67. </view>
  68. </view>
  69. <view class="item-line">
  70. <view class="item-text">手续费</view>
  71. <view class="item-text">56 </view>
  72. </view>
  73. <view class="item-line">
  74. <view class="item-text">时间</view>
  75. <view class="item-text">56 </view>
  76. </view>
  77. </view>
  78. <division class="division-item"></division>
  79. </view>
  80. </view>
  81. <view class="index-bottom"></view>
  82. </view>
  83. </template>
  84. <script>
  85. import {getInvestData, setInvest} from "@/api/contract";
  86. import tools from "@/common/js/tools";
  87. import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
  88. import {getMemberInfo} from "@/api/member";
  89. import Division from "@/pages/index/components/division";
  90. export default {
  91. components: {Division},
  92. data() {
  93. return {
  94. applicationLocale: '',
  95. systemLocale: '',
  96. showLang: false,
  97. isAjax: false,
  98. langList:[{'name':'zh-Hans','value':'简体中文'},{'name':'en','value':'English'},{'name':'ja','value':'日本語'},{'name':'ko','value':'한국어'}],
  99. tabNum:0,
  100. investData:{
  101. id: 1,
  102. invest_money: '',
  103. sysAddress: "",
  104. sendNum: "",
  105. },
  106. memberData:{
  107. "id": 30,
  108. "address": "",
  109. "invite_code": "72592982",
  110. "level_id": 0,
  111. "levelName": "V0",
  112. "recommendNum": 0,
  113. "teamNum": 0
  114. },
  115. bnbNum:0,
  116. babAddress:''
  117. }
  118. },
  119. watch: {},
  120. async onLoad(query) {
  121. this.applicationLocale = uni.getLocale();
  122. this.getInvestData()
  123. this.bnbNum = await tokenpocketBnb.getBalance();
  124. console.log('this.bnbNum:'+this.bnbNum)
  125. this.getMyData()
  126. },
  127. mounted() {
  128. },
  129. methods: {
  130. setShowLang() {
  131. this.showLang = !this.showLang
  132. },
  133. setLocaleLang(code) {
  134. uni.setLocale(code);
  135. this.$i18n.locale = code;
  136. this.applicationLocale = code;
  137. this.showLang = false
  138. },
  139. setTabNum(tabNum){
  140. if(tabNum!==this.tabNum){
  141. this.tabNum=tabNum
  142. }
  143. },
  144. getMyData(){
  145. this.babAddress= tokenpocketBnb.getMyAddress()
  146. getMemberInfo().then((res)=>{
  147. if(res.code===1){
  148. this.memberData=res.data
  149. }
  150. })
  151. },
  152. getInvestData() {
  153. getInvestData().then((res) => {
  154. if (res.code === 1) {
  155. this.investData = res.data
  156. } else {
  157. tools.goToError(4)
  158. }
  159. }).catch((e) => {
  160. tools.goToError(4)
  161. })
  162. },
  163. async setInvest() {
  164. if (this.bnbNum < this.investData.invest_money && !tools.isDevelopment()) {
  165. tools.error(this.$t('index.index.invest.no_usdt'))
  166. return
  167. }
  168. if (this.isAjax) {
  169. return
  170. }
  171. // this.isAjax = true
  172. tokenpocketBnb.getTransactionData(this.investData.sysAddress, 0.0001).then((data)=>{
  173. try {
  174. tokenpocketBnb.sendTransaction(data).then((res)=>{
  175. this.sendSetInvest(res)
  176. }).catch((e)=>{
  177. tools.error(this.$t('index.index.invest.send_no'))
  178. })
  179. }catch (e) {
  180. tools.error(this.$t('index.index.invest.send_no'))
  181. }
  182. })
  183. },
  184. sendSetInvest(hashRes){
  185. setInvest({'txid':hashRes,'id':this.investData.id}).then((res)=>{
  186. if(res.code===1){
  187. tools.success(res.msg)
  188. // setTimeout(()=>{
  189. // tools.leftClick()
  190. // },1500)
  191. }else {
  192. this.isAjax = false
  193. tools.error(res.msg)
  194. }
  195. })
  196. },
  197. },
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. //@import "/static/css/common.css";
  202. .index-data{
  203. .index-top{
  204. box-shadow:0 0 24rpx 0 #000;
  205. box-sizing: border-box;
  206. overflow: hidden;
  207. padding: 40rpx 0;
  208. width: 100%;
  209. background: linear-gradient(0deg, rgb(64, 74, 96) 0%, rgb(9, 21, 36) 100%);
  210. .top-head{
  211. display: flex;
  212. justify-content: space-between;
  213. height: 84rpx;
  214. padding-left: 20rpx;
  215. .head-item{
  216. display: flex;
  217. justify-content: left;
  218. }
  219. .head-left{
  220. .left-img{
  221. margin-top: 1rpx;
  222. image{
  223. width: 80rpx;
  224. height: 80rpx;
  225. }
  226. }
  227. .left-text{
  228. padding-top: 5px;
  229. margin-left: 10px;
  230. .item-item{
  231. font-size: 22rpx;
  232. color: #fff;
  233. }
  234. .item-item:nth-of-type(1){
  235. font-size: 32rpx;
  236. font-weight: bold;
  237. }
  238. }
  239. }
  240. .head-right{
  241. justify-content: right;
  242. .right-img{
  243. width: 70rpx;
  244. height: 70rpx;
  245. image{
  246. width: 70rpx;
  247. height: 70rpx;
  248. }
  249. }
  250. .right-text{
  251. margin-left: 20rpx;
  252. height: 70rpx;
  253. line-height: 70rpx;
  254. width: 200rpx;
  255. overflow: hidden;
  256. text-overflow: ellipsis;
  257. color: rgb(116, 132, 164);
  258. }
  259. }
  260. }
  261. .top-text{
  262. clear: both;
  263. padding: 40rpx;
  264. margin-top: 40rpx;
  265. .text-item{
  266. color: #fff;
  267. font-size: 50rpx;
  268. font-weight: bold;
  269. }
  270. }
  271. .top-but{
  272. width: 80%;
  273. margin: 60rpx auto 0;
  274. button{
  275. height: 90rpx;
  276. line-height: 90rpx;
  277. text-align: center;
  278. background: rgb(0, 87, 255);
  279. color: #fff;
  280. border-radius: 20rpx;
  281. font-weight: bold;
  282. }
  283. }
  284. .top-bottom{
  285. padding: 40rpx;
  286. .bottom-img{
  287. display: inline-block;
  288. width: 24rpx;
  289. height: 24rpx;
  290. margin-right: 10rpx;
  291. }
  292. .bottom-text{
  293. font-size: 24rpx;
  294. color: #7484a4;
  295. }
  296. .bottom-text:nth-of-type(2){
  297. margin-left: 0.5em;
  298. text-decoration: underline;
  299. }
  300. }
  301. }
  302. .index-list{
  303. background: #fff;
  304. width: 90%;
  305. margin: 40rpx auto;
  306. border-radius: 10px;
  307. padding: 20px 10px;
  308. overflow: hidden;
  309. font-size: 13px;
  310. box-shadow: 0 8rpx 16rpx 0 rgba(0,0,0,0.08);
  311. .list-title{
  312. display: flex;
  313. justify-content: left;
  314. .title-img{
  315. background: rgb(0, 87, 255);
  316. padding: 10rpx;
  317. border-radius: 20rpx;
  318. image{
  319. width: 80rpx;
  320. height: 80rpx;
  321. }
  322. }
  323. .title-text{
  324. margin-left: 20rpx;
  325. line-height: 100rpx;
  326. font-size: 34rpx;
  327. font-weight: bold;
  328. }
  329. }
  330. .list-item{
  331. margin-top: 20rpx;
  332. .item-line{
  333. margin-bottom: 20rpx;
  334. display: flex;
  335. justify-content: space-between;
  336. .item-text{
  337. font-size: 26rpx;
  338. color: rgb(177, 177, 177);
  339. line-height: 42rpx;
  340. height: 42rpx;
  341. }
  342. .text-two{
  343. display: flex;
  344. justify-content: right;
  345. .text-img{
  346. display: inline-block;
  347. padding: 6rpx;
  348. background: rgb(0, 87, 255);
  349. border-radius: 50%;
  350. height: 42rpx;
  351. width: 42rpx;
  352. box-sizing: border-box;
  353. image{
  354. width: 30rpx;
  355. height: 30rpx;
  356. z-index: 100;
  357. }
  358. }
  359. .text{
  360. margin-left: 10rpx;
  361. font-size: 30rpx;
  362. }
  363. }
  364. }
  365. .line-text{
  366. margin-bottom: 40rpx;
  367. .item-text{
  368. font-weight: bold;
  369. font-size: 26rpx;
  370. color: #222;
  371. }
  372. }
  373. }
  374. .item:last-child{
  375. .division-item{
  376. display: none;
  377. }
  378. }
  379. }
  380. .index-bottom{
  381. height: 50rpx;
  382. }
  383. }
  384. </style>