区块链首页数据对接

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

@@ -8,31 +8,10 @@
import { request } from '../index' import { request } from '../index'
// 最新区块列表 // 最新统计
const chain = () => { const chain = () => {
return request({ return request({
url: 'chain' url: 'chain/tasks'
})
}
// 发行量概况
const situation = () => {
return request({
url: 'nodes'
})
}
// 区块详情
const hash = (hash) => {
return request({
url: 'chain/block/' + hash
})
}
// 区块链首页
const occ = () => {
return request({
url: 'occ/index'
}) })
} }
@@ -54,9 +33,6 @@ const thawlog = (data) => {
export { export {
chain, chain,
situation,
hash,
occ,
crystals, crystals,
thawlog thawlog
} }

View File

@@ -42,14 +42,13 @@
</view> </view>
<!-- 任务推荐 --> <!-- 任务推荐 -->
<scroll-view class="task-block" scroll-x="true"> <scroll-view class="task-block" scroll-x="true">
<!-- categoryArr --> <view class="item" v-for="(item, index) in categoryArr" :key="index" @click="JumpUrl(item.url, item.title)">
<view class="item" v-for="(item, index) in 10" :key="index" @click="JumpUrl(item.url, item.title)"> <view class="text nowrap">{{item.remark}}</view>
<view class="text nowrap">slogan</view>
<view class="icon"> <view class="icon">
<!-- <image :src="item.cover" /> --> <image :src="item.ico" />
</view> </view>
<view class="title nowrap">任务标题</view> <view class="title nowrap">{{item.title}}</view>
<view class="submit-title nowrap">能量碎片+10</view> <view class="submit-title nowrap">能量碎片{{item.tips}}</view>
</view> </view>
</scroll-view> </scroll-view>
<!-- 平台概况 --> <!-- 平台概况 -->
@@ -57,23 +56,23 @@
<view class="header"> <view class="header">
<view class="header-item"> <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="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>
<view class="header-item"> <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="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>
<view class="header-item"> <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="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>
<view class="header-item"> <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="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>
<view class="header-item"> <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="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>
</view> </view>
<!-- 平台累计盈利能量球 --> <!-- 平台累计盈利能量球 -->
@@ -90,7 +89,7 @@
</template> </template>
<script> <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 { certified, security } from '@/apis/interfaces/index'
import F2 from '@/uni_modules/lime-f2/components/lime-f2/f2.min.js' import F2 from '@/uni_modules/lime-f2/components/lime-f2/f2.min.js'
import lF2 from '@/uni_modules/lime-f2/components/lime-f2/' import lF2 from '@/uni_modules/lime-f2/components/lime-f2/'
@@ -100,27 +99,13 @@
}, },
data() { data() {
return { 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, isAuth : false,
chains : { chains : { // 区块链统计
balance : 0,
height : 0,
number : 0,
score : 0,
up : 0
}, },
account : { // 账户 account : { // 账户
coin : 0, coin : 0,
@@ -182,11 +167,12 @@
}, },
// occ信息 // occ信息
getIndex(){ getIndex(){
// , occ() Promise.all([crystals(), chain()]).then(res=>{
Promise.all([crystals()]).then(res=>{ let crystalsData = res[0],
let crystalsData = res[0] occData = res[1]
// occData = res[1]
if(crystalsData.needLogin){ console.log(occData)
if(!crystalsData.needLogin){
this.account = { this.account = {
coin : crystalsData.coin, coin : crystalsData.coin,
crystal : crystalsData.crystal crystal : crystalsData.crystal
@@ -194,6 +180,8 @@
this.crystalArr = crystalsData.crystal_array this.crystalArr = crystalsData.crystal_array
this.allIds = crystalsData.all_ids this.allIds = crystalsData.all_ids
} }
this.chains = occData.data
this.categoryArr = occData.tasks
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
title: err.message, title: err.message,