领取水晶水晶账户

This commit is contained in:
唐明明
2021-09-26 17:18:46 +08:00
parent 760ab655eb
commit 49c6f7372f
35 changed files with 214 additions and 219 deletions

View File

@@ -36,9 +36,27 @@ const occ = () => {
}) })
} }
// 水晶原石
const crystals = () => {
return request({
url: 'user/account/crystals'
})
}
// 领取水晶
const thawlog = (data) => {
return request({
url: 'user/account/thawlog',
method: 'POST',
data
})
}
export { export {
chain, chain,
situation, situation,
hash, hash,
occ occ,
crystals,
thawlog
} }

View File

@@ -8,21 +8,6 @@
import { request } from '../index' import { request } from '../index'
// 水晶原石
const crystals = () => {
return request({
url: 'user/account/crystals'
})
}
// 领取水晶
const thawlog = (data) => {
return request({
url: 'user/account/thawlog',
method: 'POST',
data
})
}
// 水晶分类 // 水晶分类
const category = () => { const category = () => {
@@ -54,8 +39,6 @@ const operateSign = () => {
} }
export{ export{
crystals,
thawlog,
category, category,
task, task,
sign, sign,

View File

@@ -282,7 +282,6 @@
min-height: 100vh; min-height: 100vh;
padding-top: var(--status-bar-height); padding-top: var(--status-bar-height);
box-sizing: border-box; box-sizing: border-box;
background-image: url(@/static/background/crystal-background.png);
background-size: 100%; background-size: 100%;
background-position: top center; background-position: top center;
background-repeat: no-repeat; background-repeat: no-repeat;

View File

@@ -2,8 +2,8 @@
<view class="content"> <view class="content">
<!-- 账户余额 --> <!-- 账户余额 -->
<view class="total"> <view class="total">
<view class="item nowrap"><image src="@/static/icons/gemstone-icon.png"/>能量球 99</view> <view class="item nowrap"><image src="@/static/icons/gemstone-icon.png"/>{{isAuth ? '能量球' + account.coin : '查看能量球'}}</view>
<view class="item nowrap"><image src="@/static/icons/crystal-icon.png"/>能量碎片 11</view> <view class="item nowrap"><image src="@/static/icons/crystal-icon.png"/>{{isAuth ? '能量碎片' + account.crystal : '查看能量碎片'}}</view>
</view> </view>
<!-- 矿机 --> <!-- 矿机 -->
<view class="ore"> <view class="ore">
@@ -11,123 +11,129 @@
<view class="ball"> <view class="ball">
<view class="shadow"></view> <view class="shadow"></view>
</view> </view>
<block v-if="isAuth">
<view class="ore-lists"> <view class="ore-lists">
<view class="oct-float ore-item" v-for="(item, index) in crystalArr" :key="index" @click="ledCrystal(index)"> <view class="oct-float ore-item" v-for="(item, index) in crystalArr" :key="index" :style="{left: item.left + '%', top: item.top + '%'}" @click="ledCrystal(index)">
<block v-if="item.amount !== null"> <block v-if="item.amount !== null">
<image src="/static/imgs/crystal-ore-icon.png" mode="widthFix" class="icon" /> <view class="oct-icon">
<view class="text">能量碎片{{ item.amount || '-'}}</view> <image src="@/static/icons/crystal-icon.png" mode="widthFix" class="icon" />
</view>
<view class="text">{{ item.amount || '-'}}</view>
</block> </block>
</view> </view>
<navigator url="../index/index" open-type="switchTab" hover-class="none" class="oct-float ore-item-nav"> <view class="oct-float ore-item-nav" @click="issueGoosd">
<image src="/static/imgs/gemstone-ore-icon.png" mode="widthFix" class="icon" /> <view class="oct-icon">
<view class="text">购物<uni-icons type="arrowright" color="#FFFFFF" size="14"></uni-icons></view> <image src="@/static/icons/gemstone-ore-icon.png" mode="widthFix" class="icon" />
</navigator> </view>
<view class="text">发权证<uni-icons type="arrowright" color="#FFFFFF" size="12"></uni-icons></view>
</view> </view>
</view> </view>
<!-- 任务分类 --> </block>
<block v-else>
<view class="ore-lists">
<view class="oct-float oct-login" @click="$Router.push({name: 'Login'})">
<view class="oct-icon">
<image src="@/static/icons/crystal-icon.png" mode="widthFix" class="icon" />
</view>
<view class="text">登录后领取</view>
</view>
</view>
</block>
</view>
<!-- 任务推荐 -->
<scroll-view class="task-block" scroll-x="true"> <scroll-view class="task-block" scroll-x="true">
<view class="item" v-for="(item, index) in categoryArr" :key="index" @click="JumpUrl(item.url, item.title)"> <!-- categoryArr -->
<view class="text">{{ item.remark }}</view> <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="icon"> <view class="icon">
<image :src="item.cover" /> <!-- <image :src="item.cover" /> -->
</view> </view>
<view class="title">{{ item.title }}</view> <view class="title nowrap">任务标题</view>
<view class="submit-title nowrap">能量碎片+10</view>
</view> </view>
</scroll-view> </scroll-view>
<!-- 平台概况 --> <!-- 平台概况 -->
<view class="situation"> <view class="situation">
<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="18" 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 ellipsis">{{ occBalance }}</view> <view class="number nowrap">0</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="18" 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 ellipsis">{{ yesterdayCrystal }}</view> <view class="number nowrap">0</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="18" 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 ellipsis">{{ blockHeight }}</view> <view class="number nowrap">0</view>
</view> </view>
<view class="header-item"> <view class="header-item">
<view class="title">平台累计盈利额<uni-icons class="help-icon" @click="showHelp('gain')" type="help-filled" size="18" 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 ellipsis">{{ gain }}</view> <view class="number nowrap">0</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="18" 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 ellipsis">{{ nodeNumber }}</view> <view class="number nowrap">0</view>
</view> </view>
</view> </view>
<!-- 节点信息 --> <!-- 平台累计盈利能量球 -->
<view class="node-info">
<view class="node-item">
<view class="title">轻节点</view>
<view class="number ellipsis">{{occs.light || '-'}}</view>
</view>
<view class="node-item">
<view class="title">合作节点</view>
<view class="number ellipsis">{{occs.cooperation || '-'}}</view>
</view>
<view class="node-item">
<view class="title">主节点</view>
<view class="number ellipsis">{{occs.main || '-'}}</view>
</view>
<view class="node-item">
<view class="title">超级节点</view>
<view class="number ellipsis">{{occs.super || '-'}}</view>
</view>
<view class="node-item">
<view class="title">运营节点</view>
<view class="number ellipsis">{{occs.operating || '-'}}</view>
</view>
<view class="node-item">
<view class="title">技术节点</view>
<view class="number ellipsis">{{occs.technology || '-'}}</view>
</view>
</view>
<!-- 平台盈利额原石数量 -->
<view class="chart"> <view class="chart">
<view class="title">平台累计营业额和原石价值走势图</view> <view class="title">累计盈利和能量球价值走势图</view>
<view class="chart-f2"> <view class="chart-f2">
<l-f2 ref="chartChange"></l-f2> <l-f2 ref="chartChange"></l-f2>
</view> </view>
</view> </view>
<!-- 提示信息 -->
<u-toast ref="uToast" />
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import { occ } from '@/apis/interfaces/chain' import { occ, 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/'
export default { export default {
components:{
lF2
},
data() { data() {
return { return {
crystalArr : [], // occs : {},
categoryArr : [], // blockHeight : 0,
occs: {}, // occBalance : 0,
blockHeight: 0, // occ : 0,
occBalance: 0, // yesterdayCrystal: 0,
occ: 0, // gain: 0,
yesterdayCrystal: 0, // nodeNumber: 0,
gain: 0, // notice: [],
nodeNumber: 0, // isAuth: false,
notice: [],
// helpToast: {
// occ: '恒量发行原石量',
// occBalance: '平台原石量',
// yesterdayCrystal: '昨日瓜分水晶',
// blockHeight: '区块链高度',
// gain: '平台累计盈利额',
// nodeNumber: '已开通节点数'
// },
isAuth : false, isAuth : false,
helpToast: { chains : {
occ: '恒量发行原石量',
occBalance: '平台原石量', },
yesterdayCrystal: '昨日瓜分水晶', account : { // 账户
blockHeight: '区块链高度', coin : 0,
gain: '平台累计盈利额', crystal : 0
nodeNumber: '已开通节点数' },
} crystalArr : [], // 待领取
allIds : [], // 可领取ids
categoryArr : [], // 推荐列表
}; };
}, },
onShow() { onShow() {
if(this.$store.state.token != '') this.isAuth = true if(this.$store.state.token != '') this.isAuth = true
this.getOcc() this.getIndex()
}, },
methods:{ methods:{
// 求助信息 // 求助信息
@@ -138,72 +144,76 @@
showCancel: false showCancel: false
}) })
}, },
// 原石钱包 // 发权证
openWallet(){ issueGoosd(){
Promise.all([certified(), security()]).then(res=> { console.log('发权证')
let certified = res[0], },
security = res[1] // 领取能量碎片
if(!certified){ ledCrystal(index) {
uni.showModal({ // 播放音频
title: '提示', const innerAudioContext = uni.createInnerAudioContext();
content: '您还为完成个人认证,无法激活您的钱包', innerAudioContext.autoplay = true;
confirmText: '去认证', innerAudioContext.src = require('@/static/mp3/crystal.mp3');
confirmColor: '#009B69', // 请求接口
cancelColor: '#666666', thawlog({
cancelText: '稍后再说', thaw_id: this.crystalArr[index].log_id,
success: res=> { all_ids: this.allIds
if(res.confirm) { }).then(res => {
uni.navigateTo({ uni.showToast({
url: '/pages/certification/personal' image: require('@/static/icons/crystal-icon.png'),
title: '+' + this.crystalArr[index].amount,
duration: 2000
}) })
} this.$set(this.account, 'crystal', res.crystal)
} this.ids = res.all_ids
if (JSON.stringify(res.last) === '[]') {
this.$set(this.crystalArr, index, {
amount: null
}) })
return return
} }
if(!security) { this.$set(this.crystalArr, index, res.last)
uni.showModal({ }).catch(err => {
title: '激活提示', uni.showToast({
content: '您的钱包未激活,是否立即导出助记词并激活您的钱包?', icon: 'none',
confirmText: '去激活', title: err
confirmColor: '#009B69',
cancelColor: '#666666',
cancelText: '稍后再说',
success: res=> {
if(res.confirm) {
uni.navigateTo({
url: '/pages/wallet/add'
})
}
}
})
return
}
uni.navigateTo({
url: '/pages/wallet/property'
}) })
}) })
}, },
// occ信息 // occ信息
getOcc(){ getIndex(){
occ().then(res => { // , occ()
console.log(res) Promise.all([crystals()]).then(res=>{
this.occs = res.occs let crystalsData = res[0]
this.yesterdayCrystal = res.yesterday_crystal // occData = res[1]
this.occ = res.occ if(crystalsData.needLogin){
this.occBalance = res.occ_balance this.account = {
this.blockHeight = res.block_height coin : crystalsData.coin,
this.gain = res.gain crystal : crystalsData.crystal
this.nodeNumber = res.node_number }
this.notice = res.notice this.crystalArr = crystalsData.crystal_array
if(res.help_toast) this.helpToast = res.help_toast this.allIds = crystalsData.all_ids
this.showCartc(res.movements) }
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
title: err.message, title: err.message,
icon : 'none' icon : 'none'
}) })
}) })
// occ().then(res => {
// console.log(res)
// // this.occs = res.occs
// // this.yesterdayCrystal = res.yesterday_crystal
// // this.occ = res.occ
// // this.occBalance = res.occ_balance
// // this.blockHeight = res.block_height
// // this.gain = res.gain
// // this.nodeNumber = res.node_number
// // this.notice = res.notice
// // if(res.help_toast) this.helpToast = res.help_toast
// // this.showCartc(res.movements)
// })
}, },
// 绘制图表 // 绘制图表
showCartc(data){ showCartc(data){
@@ -349,7 +359,7 @@
} }
50% { 50% {
margin-top: 15rpx; margin-top: 10rpx;
} }
100% { 100% {
@@ -374,20 +384,22 @@
.header{ .header{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin-bottom: $margin*2; padding-bottom: $padding;
.number{ .number{
color: white; color: white;
font-size: $title-size; font-size: $title-size;
padding-top: $padding/2;
font-weight: bold; font-weight: bold;
line-height: 70rpx;
} }
.title{ .title{
color: rgba($color: white, $alpha: .4); color: rgba($color: white, $alpha: .4);
font-size: $title-size-sm; font-size: $title-size-sm;
line-height: 40rpx;
} }
.header-item{ .header-item{
width: 50%; width: 50%;
padding: $padding / 2; padding: $padding / 2;
padding-bottom: $padding;
box-sizing: border-box; box-sizing: border-box;
&:first-child{ &:first-child{
width: 100%; width: 100%;
@@ -397,40 +409,16 @@
} }
} }
} }
// 节点信息
.node-info{
display: flex;
flex-wrap: wrap;
margin: 0 -$margin / 2;
.node-item{
background: rgba($color: $block-color, $alpha: .8);
width: calc(50% - #{$margin});
margin: $margin / 2;
padding: $padding;
box-sizing: border-box;
border-radius: $radius/2;
}
.number{
font-size: $title-size + 4;
font-weight: bold;
color: white;
}
.title{
font-size: $title-size-sm;
color: white;
}
}
// 图表 // 图表
.chart{ .chart{
background: rgba($color: $block-color, $alpha: .8); background: rgba($color: $block-color, $alpha: .8);
padding: $padding; padding: $padding/2;
border-radius: $radius/2; border-radius: $radius/2;
margin-top: $margin;
.title{ .title{
text-align: center; text-align: center;
line-height: 80rpx; line-height: 80rpx;
color: white; color: rgba($color: #FFFFFF, $alpha: .4);
font-size: $title-size-m; font-size: $title-size-sm;
} }
.chart-f2{ .chart-f2{
height: 200px; height: 200px;
@@ -473,7 +461,6 @@
} }
// 求助icon // 求助icon
.help-icon{ .help-icon{
vertical-align: middle;
margin-left: $margin/3; margin-left: $margin/3;
opacity: .7; opacity: .7;
} }
@@ -493,64 +480,71 @@
left: 0; left: 0;
height: 100%; height: 100%;
width: 100%; width: 100%;
z-index: 1;
.oct-float-item{ .oct-float-item{
position: absolute; position: absolute;
text-align: center; text-align: center;
.text { .text {
margin-top: $margin / 2;
color: white; color: white;
font-size: $title-size-sm; font-size: $title-size-sm - 4;
line-height: 40rpx; line-height: 40rpx;
text-shadow: 0 3rpx 3rpx rgba($color: #000000, $alpha: .2); text-shadow: 0 3rpx 3rpx rgba($color: #000000, $alpha: .2);
} }
.icon { .oct-icon{
display: inline-block;
width: 58rpx; width: 58rpx;
vertical-align: top; height: 58rpx;
line-height: 58rpx;
background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .0) 40%, #ca66e0);
border-radius: 50%;
box-shadow: 0 0 5rpx 5rpx rgba($color: #ca66e0, $alpha: .5);
.icon {
margin-top: 10rpx;
height: 38rpx;
width: 38rpx;
}
} }
} }
.ore-item-nav{ .ore-item-nav{
@extend .oct-float-item; @extend .oct-float-item;
right: $margin * 3; right: $margin;
top: 12%; top: 12%;
} }
.ore-item { .ore-item {
@extend .oct-float-item; @extend .oct-float-item;
&:nth-child(1) { top: 16%; left: 13%; } }
&:nth-child(2) { top: 50%; right: 10%; } .oct-login{
&:nth-child(3) { top: 23%; right: 20%; } @extend .oct-float-item;
&:nth-child(4) { top: 70%; left: 33%;} left: 42%;
&:nth-child(5) { top: 40%; left: 20%; } top: 45%;
&:nth-child(6) { top: 58%; left: 10%;}
&:nth-child(7) { top: 10%; right: 43%;}
&:nth-child(8) { top: 46%; right: 29%;}
} }
} }
} }
// 任务 // 任务
.task-block { .task-block {
white-space: nowrap; white-space: nowrap;
margin-bottom: $margin;
.item { .item {
background: rgba($color: $mian-color, $alpha: .2); background: $block-color;
display: inline-block; display: inline-block;
margin-left: $margin; margin-left: $margin;
width: 210rpx; width: 260rpx;
padding: $padding * 2 $padding;
border-radius: $radius; border-radius: $radius;
box-sizing: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .06);
text-align: center; text-align: center;
padding: ($padding - 10) $padding/2;
&:first-child { &:first-child {
margin-left: $margin + $margin/2; margin-left: $margin;
} }
&:last-child { &:last-child {
margin-right: $margin + $margin/2; margin-right: $margin;
} }
.icon { .icon {
display: inline-block; display: inline-block;
margin: $margin 0; margin: ($margin/2) 0;
width: 98rpx; width: 98rpx;
height: 98rpx; height: 98rpx;
line-height: 98rpx; line-height: 98rpx;
background: $mian-color-deep; background: #1f183d;
border-radius: 50%; border-radius: 50%;
text-align: center; text-align: center;
image { image {
@@ -560,13 +554,20 @@
} }
} }
.text { .text {
font-size: $title-size-m; font-size: $title-size-sm;
color: $mian-color; color: rgba($color: white, $alpha: .4);
line-height: 40rpx;
} }
.title { .title {
font-size: $title-size; font-size: $title-size-lg;
color: white; color: white;
font-weight: bold; font-weight: bold;
line-height: 50rpx;
}
.submit-title{
font-size: $title-size-sm - 4;
color: rgba($color: white, $alpha: .4);
line-height: 40rpx;
} }
} }
} }

View File

@@ -55,12 +55,6 @@
code: this.code code: this.code
}).then(res => { }).then(res => {
this.$store.commit('setToken', res.token_type + ' ' + res.access_token) this.$store.commit('setToken', res.token_type + ' ' + res.access_token)
if (!res.is_company) {
this.$Router.replace({
name: "Index"
})
return
}
this.$Router.back() this.$Router.back()
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({

Binary file not shown.

Before

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

BIN
static/mp3/crystal.mp3 Normal file

Binary file not shown.