领取水晶水晶账户

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 {
chain,
situation,
hash,
occ
occ,
crystals,
thawlog
}

View File

@@ -8,21 +8,6 @@
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 = () => {
@@ -54,8 +39,6 @@ const operateSign = () => {
}
export{
crystals,
thawlog,
category,
task,
sign,

View File

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

View File

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