区块链首页数据对接

This commit is contained in:
唐明明
2021-09-26 17:38:26 +08:00
parent d9e5150ea2
commit 4a7b322bd4
2 changed files with 27 additions and 63 deletions

View File

@@ -42,14 +42,13 @@
</view>
<!-- 任务推荐 -->
<scroll-view class="task-block" scroll-x="true">
<!-- categoryArr -->
<view class="item" v-for="(item, index) in 10" :key="index" @click="JumpUrl(item.url, item.title)">
<view class="text nowrap">slogan</view>
<view class="item" v-for="(item, index) in categoryArr" :key="index" @click="JumpUrl(item.url, item.title)">
<view class="text nowrap">{{item.remark}}</view>
<view class="icon">
<!-- <image :src="item.cover" /> -->
<image :src="item.ico" />
</view>
<view class="title nowrap">任务标题</view>
<view class="submit-title nowrap">能量碎片+10</view>
<view class="title nowrap">{{item.title}}</view>
<view class="submit-title nowrap">能量碎片{{item.tips}}</view>
</view>
</scroll-view>
<!-- 平台概况 -->
@@ -57,23 +56,23 @@
<view class="header">
<view class="header-item">
<view class="title">平台能量球余量<uni-icons class="help-icon" @click="showHelp('occBalance')" type="help-filled" size="15" color="rgba(255,255,255,.3)" /></view>
<view class="number nowrap">0</view>
<view class="number nowrap">{{chains.balance}}</view>
</view>
<view class="header-item">
<view class="title">上期能量球价值<uni-icons class="help-icon" @click="showHelp('yesterdayCrystal')" type="help-filled" size="15" color="rgba(255,255,255,.3)" /></view>
<view class="number nowrap">0</view>
<view class="number nowrap">{{chains.up}}</view>
</view>
<view class="header-item">
<view class="title">昨日瓜分能量碎片<uni-icons class="help-icon" @click="showHelp('yesterdayCrystal')" type="help-filled" size="15" color="rgba(255,255,255,.3)" /></view>
<view class="number nowrap">0</view>
<view class="number nowrap">{{chains.score}}</view>
</view>
<view class="header-item">
<view class="title">区块链高度<uni-icons class="help-icon" @click="showHelp('blockHeight')" type="help-filled" size="15" color="rgba(255,255,255,.3)" /></view>
<view class="number nowrap">0</view>
<view class="number nowrap">{{chains.height}}</view>
</view>
<view class="header-item">
<view class="title">已开通节点数<uni-icons class="help-icon" @click="showHelp('nodeNumber')" type="help-filled" size="15" color="rgba(255,255,255,.3)" /></view>
<view class="number nowrap">0</view>
<view class="number nowrap">{{chains.number}}</view>
</view>
</view>
<!-- 平台累计盈利能量球 -->
@@ -90,7 +89,7 @@
</template>
<script>
import { occ, crystals, thawlog } from '@/apis/interfaces/chain'
import { chain, crystals, thawlog } from '@/apis/interfaces/chain'
import { certified, security } from '@/apis/interfaces/index'
import F2 from '@/uni_modules/lime-f2/components/lime-f2/f2.min.js'
import lF2 from '@/uni_modules/lime-f2/components/lime-f2/'
@@ -100,27 +99,13 @@
},
data() {
return {
// occs : {},
// blockHeight : 0,
// occBalance : 0,
// occ : 0,
// yesterdayCrystal: 0,
// gain: 0,
// nodeNumber: 0,
// notice: [],
// isAuth: false,
// helpToast: {
// occ: '恒量发行原石量',
// occBalance: '平台原石量',
// yesterdayCrystal: '昨日瓜分水晶',
// blockHeight: '区块链高度',
// gain: '平台累计盈利额',
// nodeNumber: '已开通节点数'
// },
isAuth : false,
chains : {
chains : { // 区块链统计
balance : 0,
height : 0,
number : 0,
score : 0,
up : 0
},
account : { // 账户
coin : 0,
@@ -182,11 +167,12 @@
},
// occ信息
getIndex(){
// , occ()
Promise.all([crystals()]).then(res=>{
let crystalsData = res[0]
// occData = res[1]
if(crystalsData.needLogin){
Promise.all([crystals(), chain()]).then(res=>{
let crystalsData = res[0],
occData = res[1]
console.log(occData)
if(!crystalsData.needLogin){
this.account = {
coin : crystalsData.coin,
crystal : crystalsData.crystal
@@ -194,6 +180,8 @@
this.crystalArr = crystalsData.crystal_array
this.allIds = crystalsData.all_ids
}
this.chains = occData.data
this.categoryArr = occData.tasks
}).catch(err => {
uni.showToast({
title: err.message,