Commit 899c5c19 authored by xhx's avatar xhx

feat:用户不同展示及奖励详情

parent 8936841a
...@@ -2,4 +2,5 @@ NODE_ENV="development" ...@@ -2,4 +2,5 @@ NODE_ENV="development"
#VUE_APP_URL="http://172.16.100.59:8090" #VUE_APP_URL="http://172.16.100.59:8090"
VUE_APP_URL="http://172.16.100.59:8092" VUE_APP_URL="http://172.16.100.59:8092"
VUE_APP_CHAIN="http://172.16.100.59:8801" VUE_APP_CHAIN="http://172.16.100.59:8801"
#VUE_APP_CHAIN="https://mainnet.bityuan.com/api" #VUE_APP_CHAIN="https://mainnet.bityuan.com/api"
\ No newline at end of file VUE_APP_AIRDROP = "http://172.16.100.59:8091"
\ No newline at end of file
NODE_ENV='development' NODE_ENV='development'
#VUE_APP_URL="http://172.16.100.59:8090" VUE_APP_URL="http://172.16.100.59:8090"
VUE_APP_URL="http://172.16.100.59:8092" #VUE_APP_URL="http://172.16.100.59:8092"
VUE_APP_CHAIN="http://172.16.100.59:8801" VUE_APP_CHAIN="http://172.16.100.59:8801"
\ No newline at end of file
...@@ -17,19 +17,20 @@ ...@@ -17,19 +17,20 @@
"axios": "^0.21.1", "axios": "^0.21.1",
"babel-plugin-import": "^1.13.3", "babel-plugin-import": "^1.13.3",
"better-scroll": "^2.4.2", "better-scroll": "^2.4.2",
"compression-webpack-plugin": "^6.1.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"dayjs": "^1.10.7",
"postcss": "^7", "postcss": "^7",
"register-service-worker": "^1.7.1", "register-service-worker": "^1.7.1",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2", "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2",
"terser-webpack-plugin": "^4.2.3",
"vant": "^2.12.25", "vant": "^2.12.25",
"vconsole": "^3.9.1", "vconsole": "^3.9.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-class-component": "^7.2.3", "vue-class-component": "^7.2.3",
"vue-property-decorator": "^9.1.2", "vue-property-decorator": "^9.1.2",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
"vuex": "^3.4.0", "vuex": "^3.4.0"
"terser-webpack-plugin": "^4.2.3",
"compression-webpack-plugin": "^6.1.1"
}, },
"devDependencies": { "devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.18.0", "@typescript-eslint/eslint-plugin": "^4.18.0",
......
...@@ -8,9 +8,8 @@ ...@@ -8,9 +8,8 @@
import Vue from 'vue' import Vue from 'vue'
import { isBind } from '@/service/pool' import { isBind } from '@/service/pool'
import service from '@/service/chain33' import service from '@/service/chain33'
import { closeWebview, getDeviceId } from '@/utils/bridge' import { getDeviceId, getCurrentBTYAddress } from '@/utils/bridge' // 币钱包环境
import { getCurrentBTYAddress } from '@/utils/bridge' // 币钱包环境 import { test } from '@/utils/test' // 本地测试
// import { test } from '@/utils/test' // 本地测试
import { Toast } from 'vant' import { Toast } from 'vant'
export default Vue.extend({ export default Vue.extend({
methods: { methods: {
...@@ -27,32 +26,15 @@ export default Vue.extend({ ...@@ -27,32 +26,15 @@ export default Vue.extend({
const _result = response.data.result?.data const _result = response.data.result?.data
Toast.clear() Toast.clear()
if (walletRes.data.result?.datas) { if (walletRes.data.result?.datas) {
// 查询到存在其他地址,退出应用 // 查询到存在冷钱包,跳转空白页
Toast({ this.$router.replace({ path: '/noPage', query: { type: '3', status: '1' }})
message: '该账户不具备进入条件,将于3秒后退出',
forbidClick: true,
duration: 3000,
className: 'toast_x'
})
setTimeout(() => {
closeWebview()
}, 3000)
} }
// 存在地址,判断此地址是否属于当前项目,若不是,退出应用 // 存在地址,判断此地址是否属于当前项目,
if (_result) { if (_result) {
isBind(_result).catch((res: any) => { isBind(_result).catch((res: any) => {
console.log('isBind', res.response)
const reason = res.response.data.reason const reason = res.response.data.reason
if (reason) { if (reason) {
Toast({ this.$router.replace({ path: '/noPage', query: { type: '3' }})
message: '该账户不具备进入条件,将于3秒后退出',
forbidClick: true,
duration: 3000,
className: 'toast_x'
})
setTimeout(() => {
closeWebview()
}, 3000)
} }
}) })
} }
...@@ -63,7 +45,9 @@ export default Vue.extend({ ...@@ -63,7 +45,9 @@ export default Vue.extend({
className: 'toast_x' className: 'toast_x'
}) })
} }
} },
}, },
mounted() { mounted() {
getCurrentBTYAddress('',(res: string) => { getCurrentBTYAddress('',(res: string) => {
...@@ -76,6 +60,7 @@ export default Vue.extend({ ...@@ -76,6 +60,7 @@ export default Vue.extend({
}) })
}) })
// this.$store.commit('app/SET_ADDRESS', test.addr) // this.$store.commit('app/SET_ADDRESS', test.addr)
// this.$store.commit('app/SET_DEVICEID', test.amei)
// this.hasPoolAddr(test.addr) // this.hasPoolAddr(test.addr)
} }
}) })
......
<template> <template>
<div class="mining-card bg-card-color px-2 pt-10 pb-2 rounded-lg"> <div class="mining-card bg-card-color px-2 pt-10 pb-2 rounded-lg">
<div class="mining-name bg-gradient-3 text-white text-13px rounded-r-full">{{ info.name }}</div> <div class="mining-name bg-gradient-3 text-white text-13px rounded-r-full">{{ info.name }}</div>
<time-box :date="runDays" :prefix="prefix" /> <!-- <time-box :date="runDays" :prefix="prefix" /> -->
<div class="text-right text-white2 text-sm" @click="showInfo">票池每票日产出</div>
<div> <div>
<div class="px-2 flex items-center justify-between"> <div class="px-2 flex items-center justify-between">
<span class="font-semibold text-white1">{{ info.friendlyName }}</span> <span class="font-semibold text-white1">{{ info.friendlyName }}</span>
</div> </div>
<div class="pb-3 flex items-center justify-between"> <div class="pb-3 flex items-center justify-between">
<div class="px-2 flex flex-col items-start"> <div class="px-2 flex flex-col items-start">
<div class="income-count">{{ info.dayRate || 0 }}</div> <div class="income-count">{{ rest || 0 }}</div>
<div class="text-xs text-white2">票池每票日奖励</div> <div class="text-xs text-white2">可委托票数约</div>
</div> </div>
<button class="w-24 h-9 rounded-full text-sm text-brown1 text-medium bg-gradient-4" @click="goMining">立即委托</button> <button class="w-24 h-9 rounded-full text-sm text-brown1 text-medium bg-gradient-4" @click="goMining">立即委托</button>
</div> </div>
...@@ -32,25 +33,36 @@ ...@@ -32,25 +33,36 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue' import Vue from 'vue'
import InfoBar from '@/components/InfoBar.vue' import InfoBar from '@/components/InfoBar.vue'
import TimeBox from './TimeBox.vue' import { TICKET_COUNT } from '@/constance/const'
// import TimeBox from './TimeBox.vue'
// import Popup from '@/components/Popup.vue';
export default Vue.extend({ export default Vue.extend({
props: { props: {
info: { info: {
type: [Object as any, Number] type: [Object as any, Number]
},
coin: {
type: Number,
default: 0
} }
}, },
components: { components: {
InfoBar, InfoBar,
TimeBox // 'van-popup': Popup
// TimeBox
}, },
data() { data() {
return { return {
show: true,
prefix: '' prefix: ''
} }
}, },
methods: { methods: {
goMining() { goMining() {
this.$emit('goDetails', (this.info as any)) this.$emit('goDetails', (this.info as any))
},
showInfo() {
this.$emit('showInfo', (this.info as any).dayRate)
} }
}, },
computed: { computed: {
...@@ -63,6 +75,9 @@ export default Vue.extend({ ...@@ -63,6 +75,9 @@ export default Vue.extend({
} else { } else {
return Number(info.startTime) + (+info.days * 3600 * 24) + '' return Number(info.startTime) + (+info.days * 3600 * 24) + ''
} }
},
rest() {
return Math.floor(this.coin/TICKET_COUNT)
} }
} }
}) })
......
<template> <template>
<van-popup v-model="show" :close-on-click-overlay="false"> <van-popup v-model="show" :close-on-click-overlay="false">
<div class="p-3 flex flex-col bg-theme-color text-white1"> <div class="p-3 flex flex-col bg-theme-color text-white1 m-popup">
<div class="mb-5">{{ title }}</div> <div class="mb-5">{{ title }}</div>
<input class="mb-2 bg-theme-color border-b border-solid border-white2" type="text" v-model="val"> <div class="flex items-center justify-between">
<input class="mb-2 mr-3 bg-theme-color border-b border-solid border-white2 flex-1" type="text" v-model="val">
<van-icon name="scan" size="30" @click="scan" />
</div>
<button class="bg-blue" @click="submit">确定</button> <button class="bg-blue" @click="submit">确定</button>
</div> </div>
</van-popup> </van-popup>
...@@ -10,10 +13,12 @@ ...@@ -10,10 +13,12 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue' import Vue from 'vue'
import { Popup } from 'vant' import { Popup, Icon } from 'vant';
import { getScan } from '../utils/bridge';
export default Vue.extend({ export default Vue.extend({
components: { components: {
'van-popup': Popup 'van-popup': Popup,
'van-icon': Icon
}, },
data() { data() {
return { return {
...@@ -33,7 +38,24 @@ export default Vue.extend({ ...@@ -33,7 +38,24 @@ export default Vue.extend({
methods: { methods: {
submit() { submit() {
this.$emit('getMessage', this.val) this.$emit('getMessage', this.val)
},
scan() {
console.log('123')
getScan('', (v: string) => {
// this.$emit('getMessage', v)
this.val = v
})
} }
} }
}) })
</script> </script>
<style lang="scss" scoped>
/deep/ .van-popup--center {
width: 100%;
border-radius: 12px;
}
.m-popup {
width: 90vw;
}
</style>
...@@ -5,3 +5,5 @@ export const TICKET_COUNT = process.env.NODE_ENV !== 'production' ? 10000 : 3000 ...@@ -5,3 +5,5 @@ export const TICKET_COUNT = process.env.NODE_ENV !== 'production' ? 10000 : 3000
export const INCOME = 100 export const INCOME = 100
export const TICKET_ADDRESS = '16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp' export const TICKET_ADDRESS = '16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp'
export const USER_TYPE = ['社区节点身份', '超级节点身份']
...@@ -20,7 +20,16 @@ const routes: Array<RouteConfig> = [ ...@@ -20,7 +20,16 @@ const routes: Array<RouteConfig> = [
path: '/mine', path: '/mine',
name: 'Mine', name: 'Mine',
component: () => import(/* webpackChunkName: "about" */ '../views/Mine/index.vue') component: () => import(/* webpackChunkName: "about" */ '../views/Mine/index.vue')
// component: () => import(/* webpackChunkName: "about" */ '../views/Mine.vue') },
{
path: '/record',
name: 'record',
component: () => import(/* webpackChunkName: "about" */ '../views/Record/index.vue')
},
{
path: '/noPage',
name: 'noPage',
component: () => import(/* webpackChunkName: "about" */ '../views/NoPage/index.vue')
}, },
] ]
......
import { request } from "./service";
import store from '@/store/index'
import { AxiosResponse, AxiosRequestConfig } from "axios";
const service = request(`/air`)
service.interceptors.request.use(function (config: AxiosRequestConfig) {
if ((store.state as any).app.address) {
const { address } = (store.state as any).app
config.headers['Auth-Addr'] = address
}
return config;
}, function (error) {
return Promise.reject(error);
});
service.interceptors.response.use(function (res: AxiosResponse) {
return res.data
}, function(error) {
return Promise.reject(error)
})
export const getMinerData = (data: {page: number, pageSize: number, month: string}) => {
return service.get('/miner-data', { params: data})
}
\ No newline at end of file
...@@ -5,7 +5,6 @@ import { AxiosResponse, AxiosRequestConfig } from "axios"; ...@@ -5,7 +5,6 @@ import { AxiosResponse, AxiosRequestConfig } from "axios";
const service = request('/api') const service = request('/api')
service.interceptors.request.use(function (config: AxiosRequestConfig) { service.interceptors.request.use(function (config: AxiosRequestConfig) {
console.log(store.state)
if ((store.state as any).app.address) { if ((store.state as any).app.address) {
const { address, deviceId } = (store.state as any).app const { address, deviceId } = (store.state as any).app
config.headers['Auth-Addr'] = address config.headers['Auth-Addr'] = address
...@@ -17,10 +16,10 @@ service.interceptors.request.use(function (config: AxiosRequestConfig) { ...@@ -17,10 +16,10 @@ service.interceptors.request.use(function (config: AxiosRequestConfig) {
return Promise.reject(error); return Promise.reject(error);
}); });
service.interceptors.response.use(function (res: AxiosResponse) { // service.interceptors.response.use(function (res: AxiosResponse) {
// 除了code: 200, 其余均在 catch 状态 // // 除了code: 200, 其余均在 catch 状态
return res // return res
}) // })
/** /**
* 邀请用户 * 邀请用户
...@@ -32,6 +31,14 @@ export const invitePool = function(invitation: string) { ...@@ -32,6 +31,14 @@ export const invitePool = function(invitation: string) {
} }
/** /**
* 用户信息
* @returns
*/
export const getUserInfo = function() {
return service.post('/web/user-info', {})
}
/**
* 绑定委托 * 绑定委托
* @param id * @param id
* @param amount * @param amount
......
...@@ -5,4 +5,5 @@ export const sign = (params: any, fn?: Function) => _jsBridge.sign(params, fn) ...@@ -5,4 +5,5 @@ export const sign = (params: any, fn?: Function) => _jsBridge.sign(params, fn)
export const getCurrentBTYAddress = (params: any, fn?: Function) => _jsBridge.getCurrentBTYAddress(params, fn) export const getCurrentBTYAddress = (params: any, fn?: Function) => _jsBridge.getCurrentBTYAddress(params, fn)
export const signGroup = (params: any, fn?: Function) => _jsBridge.signTxGroup(params, fn) export const signGroup = (params: any, fn?: Function) => _jsBridge.signTxGroup(params, fn)
export const closeWebview = () => _jsBridge.closeCurrentWebview() export const closeWebview = () => _jsBridge.closeCurrentWebview()
export const getDeviceId = (params: any, fn?: Function) => _jsBridge.getDeviceId(params, fn) export const getDeviceId = (params: any, fn?: Function) => _jsBridge.getDeviceId(params, fn)
\ No newline at end of file export const getScan = (params: any, fn?: Function) => _jsBridge.scanQRCode(params, fn)
\ No newline at end of file
import { isBind } from '@/service/pool'
import service from '@/service/chain33'
// import { getDeviceId, getCurrentBTYAddress } from '@/utils/bridge' // 币钱包环境
import { test } from '@/utils/test' // 本地测试
import { Toast } from 'vant'
import router from '@/router'
export const hasPoolAddr = async function (addr: string) {
Toast.loading({
duration: 0,
forbidClick: true,
className: 'toast_x'
})
try {
const response = await service.getTicketAddress(addr)
const walletRes = await service.getWalletAddress(addr)
const _result = response.data.result?.data
Toast.clear()
if (walletRes.data.result?.datas) {
// 查询到存在其他地址,跳转空白页
router.push({ path: '/noPage', query: { type: '3' }})
}
// 存在地址,判断此地址是否属于当前项目,若不是,退出应用
if (_result) {
isBind(_result).catch((res: any) => {
const reason = res.response.data.reason
if (reason) {
router.push({ path: '/noPage', query: { type: '3' }})
}
})
}
} catch (e) {
console.log(e)
Toast({
message: '请求超时,请稍后再试',
className: 'toast_x'
})
}
}
\ No newline at end of file
...@@ -7,10 +7,12 @@ ...@@ -7,10 +7,12 @@
// privateKey: '0xCC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944' // privateKey: '0xCC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944'
// } // }
export const test = { export const test = {
// addr: '1Lm22ZxsCHYE3PNtEnGYZJduJs5KG95GUp', // addr: '16GgdskdRFasxuMdtBaxNS4ZagyZgEUuMs',
// addr: '16vD58z9z2Uvpci8ssvj797ENahbYZ497W', // addr: '16vD58z9z2Uvpci8ssvj797ENahbYZ497W',
addr: '16GgdskdRFasxuMdtBaxNS4ZagyZgEUuMs', // addr: '1GEb8GgdfEiDZPr6K5Snm5Hecvptzs8e8W',
// addr: '1LGQLmGVHSNthZcLbGpVfJTDmcicMQprZs', addr: '12yDPVPZQ8kWtvnpx8tw321tfQ82HpbnVq',
// addr: '17WCg9v62d4UWomBv69dhQvGeBzq7aUa6X',
amei: '353615334688244',
privateKey: '0xa65b62735022cd47b11c5a88b0caac8d360810257aaf1e14bbc330dee63b35ff' privateKey: '0xa65b62735022cd47b11c5a88b0caac8d360810257aaf1e14bbc330dee63b35ff'
} }
// export const test = { // export const test = {
......
...@@ -72,8 +72,8 @@ export default Vue.extend({ ...@@ -72,8 +72,8 @@ export default Vue.extend({
return signTxGroup(txs.join(),'none',-1); return signTxGroup(txs.join(),'none',-1);
}, },
async buy(value: string) { async buy(value: string) {
if (this.profit/this.ticketNum < +this.info.minTicket) { if (this.profit/this.ticketNum < +(this.min as number)) {
Toast(`您的票数余额为${Math.floor(this.profit/this.ticketNum)}票,不足${this.info.minTicket}票`) Toast(`您的票数余额为${Math.floor(this.profit/this.ticketNum)}票,不足${this.min}票`)
return return
} }
const bindRes = await service.createBindMiner({ const bindRes = await service.createBindMiner({
......
<template> <template>
<div class="px-4 pt-20"> <div class="px-4 pt-20">
<div class="flex flex-col py-4 px-5 mb-11 bg-card bg-cover rounded-lg"> <div class="flex flex-col py-4 px-5 mb-11 bg-card bg-cover rounded-lg">
<div class="text-sm text-left pb-3 tracking-normal hide">当前地址:{{ addr }}</div> <div class="flex justify-between text-sm text-left pb-3">
<span>当前地址:{{ addr }}</span>
<span @click="$router.push('/record')">奖励记录</span>
</div>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<div> <div>
<p class="text-xs text-brown">可领奖励</p> <p class="text-xs text-brown">可领奖励</p>
...@@ -116,6 +119,7 @@ export default Vue.extend({ ...@@ -116,6 +119,7 @@ export default Vue.extend({
console.log('address--info', this.$store.state.app.address) console.log('address--info', this.$store.state.app.address)
console.log('每票所含的数值', TICKET_COUNT) console.log('每票所含的数值', TICKET_COUNT)
this.addr = this.$store.state.app.address this.addr = this.$store.state.app.address
this.addr = this.addr.slice(0, 5) + '...' + this.addr.slice(this.addr.length - 10)
this.getInfo() this.getInfo()
this.getFee() this.getFee()
Bus.$on('updateMsg', () => { Bus.$on('updateMsg', () => {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
v-model="isLoading" v-model="isLoading"
success-text="刷新成功" success-text="刷新成功"
@refresh="onRefresh"> @refresh="onRefresh">
<MiningCard v-for="(i, index) in lists" :key="index" :info="i" @goDetails="goDetails" /> <MiningCard v-for="(i, index) in lists" :key="index" :info="i" :coin="coins" @goDetails="goDetails" @showInfo="showTheInfo" />
</van-pull-refresh> </van-pull-refresh>
</div> </div>
</template> </template>
...@@ -26,24 +26,37 @@ ...@@ -26,24 +26,37 @@
</template> </template>
</div> </div>
</div> </div>
<Popup :show="show" @getMessage="addInvite" /> <x-popup :show="show" @getMessage="addInvite" />
<van-popup v-model="showInfo">
<div class="mining-card-info">
<p class="text-lg text-white">票池每日矿产出</p>
<div class="mining-card-img">
<img class="w-full h-full" src="@/assets/image/BTY.png" alt="">
</div>
<p class="text-orange1 text-2xl">{{ val }}</p>
</div>
</van-popup>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import Vue from 'vue' import Vue from 'vue'
import MiningCard from '@/components/MiningCard.vue' import MiningCard from '@/components/MiningCard.vue'
import Popup from '@/components/Popup.vue' import xPopup from '@/components/Popup.vue'
import constant from '@/constance/Image' import constant from '@/constance/Image'
import Bus from '@/utils/bus' import Bus from '@/utils/bus'
import { invitePool, poolList, checkBind } from '@/service/pool' import { invitePool, poolList, checkBind, getUserInfo } from '@/service/pool'
import service from '@/service/chain33' import service from '@/service/chain33'
import { PullRefresh, Toast } from 'vant' import { PullRefresh, Toast, Popup } from 'vant'
// import { getDeviceId, getCurrentBTYAddress } from '@/utils/bridge' // 币钱包环境
import { test } from '@/utils/test' // 本地测试
export default Vue.extend({ export default Vue.extend({
components: { components: {
'van-pull-refresh': PullRefresh, 'van-pull-refresh': PullRefresh,
'van-popup': Popup,
MiningCard, MiningCard,
Popup 'x-popup': xPopup
}, },
data() { data() {
return { return {
...@@ -55,7 +68,10 @@ export default Vue.extend({ ...@@ -55,7 +68,10 @@ export default Vue.extend({
count: 0, count: 0,
timer: 0, timer: 0,
waiter: 180000, waiter: 180000,
show: false show: false,
showInfo: false,
coins: 0,
val: ''
} }
}, },
computed: { computed: {
...@@ -64,6 +80,26 @@ export default Vue.extend({ ...@@ -64,6 +80,26 @@ export default Vue.extend({
}, },
}, },
methods: { methods: {
getInfo() {
getUserInfo().then(res => {
const type = res.data.data.type + ''
const status = res.data.data.status + ''
if (type === '1' || type === '2') {
this.$router.replace({ path: '/noPage', query: { type: type }})
} else if (status === '1') {
this.$router.replace({ path: '/noPage', query: { status }})
}
})
},
getCoins() {
service.getBalance(this.$store.state.app.address, 'coins').then((res: any) => {
this.coins = Math.floor(res.data.result[0].balance / 1e8)
})
},
showTheInfo(val: string) {
this.showInfo = true
this.val = val
},
getList() { getList() {
poolList({ poolList({
page: this.page, page: this.page,
...@@ -178,9 +214,26 @@ export default Vue.extend({ ...@@ -178,9 +214,26 @@ export default Vue.extend({
}) })
}, },
}, },
created() { mounted() {
this.getList() // getCurrentBTYAddress('',(res: string) => {
this.setTimer() // console.log('BTY ADDRESS', res)
// this.$store.commit('app/SET_ADDRESS', res)
// getDeviceId('', (ret: string) => {
// console.log(ret, 'DEVICEID')
// this.$store.commit('app/SET_DEVICEID', ret)
// hasPoolAddr(res)
// this.getInfo()
// this.getCoins()
// this.getList()
// this.setTimer()
// })
// })
setTimeout(() => {
this.getInfo()
this.getCoins()
this.getList()
this.setTimer()
}, 500)
}, },
beforeDestroy() { beforeDestroy() {
if (this.timer) clearInterval(this.timer) if (this.timer) clearInterval(this.timer)
...@@ -233,11 +286,32 @@ export default Vue.extend({ ...@@ -233,11 +286,32 @@ export default Vue.extend({
} }
} }
} }
.mining-card-info {
width: 224px;
height: 222px;
padding-top: 11px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
background: #3A3A3C;
border-radius: 27px;
border: 1px solid #A67855;
position: relative;
.mining-card-img {
width: 44px;
height: 44px;
margin-top: 50px;
margin-bottom: 25px;
}
p {
margin-bottom: 0;
}
}
/deep/ .van-pull-refresh { /deep/ .van-pull-refresh {
overflow: inherit; overflow: inherit;
} }
/deep/ .van-popup--center { /deep/ .van-popup--center {
width: 90%; border-radius: 27px;
border-radius: 12px;
} }
</style> </style>
\ No newline at end of file
<template>
<div class="w-full min-h-screen flex items-center justify-center text-white">
<span v-if="state === 0">当前地址为票池地址,无操作页面</span>
<span v-else-if="state === 1">当前地址为{{ msg }}地址,详情请前往后台管理系统查看</span>
<span v-else>当前地址非新用户,无操作页面</span>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import { USER_TYPE } from '@/constance/const';
export default Vue.extend({
data() {
return {
msg: '',
state: 0
}
},
mounted() {
const status = this.$route.query.status
const type:number = +this.$route.query.type - 1
this.msg = USER_TYPE[type]
if (status) {
this.state = 0
} else if (type < 2) {
this.state = 1
this.msg = USER_TYPE[type]
} else {
this.state = 2
}
}
})
</script>
\ No newline at end of file
<template>
<div class="mb-3 py-2 px-3 text-sm flex flex-col items-between justify-center bg-card2-color rounded-lg">
<div class="flex items-center justify-between">
<span class="text-lg text-white">投票</span>
<span class="text-orange1">+{{ info.amount }} BTY</span>
</div>
<div class="flex items-center justify-between text-white2">
<span class="">{{ hash }}</span>
<span class="">{{ timer }}</span>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import dayjs from 'dayjs'
export default Vue.extend({
props: {
info: {
type: Object
}
},
computed: {
timer() {
const time = +((this.info as any).minedTime + '000')
return dayjs(time).format('MM-DD HH:mm:ss')
},
hash() {
const _hash = this.info.hash
return _hash.slice(0, 8) + '...' + _hash.slice(_hash.length - 8)
}
}
})
</script>
\ No newline at end of file
<template>
<div class="h-screen overflow-hidden">
<nav-bar left-arrow @click-left="onClickLeft" fixed>
<template #title>
<div class="text-lg text-white">
奖励记录
</div>
</template>
</nav-bar>
<div class="mb-3 py-5 pt-28 flex relative flex-col items-center justify-center">
<div
class="absolute right-0 p-2 px-3 text-white2 text-sm bg-card-color rounded-l-full"
style="top: 60px"
@click="showPicker = true">
{{ nowYear }}年{{ pagination.month }}月
<van-icon name="arrow-down" />
</div>
<span class="text-white2 text-sm mb-4">总收益(BTY)</span>
<span class="text-orange1 text-4xl">{{ amount }}</span>
</div>
<div class="px-4 overflow-x-hidden" style="height: calc(100vh - 210px);">
<record-item v-for="(i, index) in airList" :key="index" :info="i" />
</div>
<van-popup v-model="showPicker" round position="bottom">
<van-picker
show-toolbar
value-key="label"
:columns="columns"
@cancel="onCancel"
@confirm="onConfirm"
/>
</van-popup>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import RecordItem from './RecordItem.vue'
import { NavBar, Icon, Picker, Popup } from 'vant';
import { getMinerData } from '../../service/airdrop';
import dayjs from 'dayjs';
export default Vue.extend({
components: {
RecordItem,
NavBar,
'van-icon': Icon,
'van-picker': Picker,
'van-popup': Popup
},
data() {
return {
showPicker: false,
columns: [
{
label: '1月',
value: '1'
},
{
label: '2月',
value: '2'
},
{
label: '3月',
value: '3'
},
{
label: '4月',
value: '4'
},
{
label: '5月',
value: '5'
},
{
label: '6月',
value: '6'
},
{
label: '7月',
value: '7'
},
{
label: '8月',
value: '8'
},
{
label: '9月',
value: '9'
},
{
label: '10月',
value: '10'
},
{
label: '11月',
value: '11'
},
{
label: '12月',
value: '12'
},
],
amount: '',
airList: [] as any,
pagination: {
page: 1,
pageSize: 100,
month: dayjs(Date.now()).format('MM')
}
}
},
computed: {
nowYear() {
return dayjs(Date.now()).format('YYYY')
}
},
methods: {
onClickLeft() {
this.$router.back()
},
onConfirm(val: {value: string}) {
this.pagination.month = val.value
this.pagination.page = 1
this.getMiner()
},
onCancel() {
this.showPicker = false
},
getMiner() {
getMinerData(this.pagination).then(res => {
this.amount = res.data.amount
this.airList = res.data.list
if (this.showPicker) this.showPicker = false
})
}
},
created() {
this.getMiner()
}
})
</script>
<style lang="scss" scoped>
/deep/ .van-nav-bar {
background: #323232;
color: #fff;
}
/deep/ .van-nav-bar .van-icon {
color: #fff;
}
/deep/ .van-nav-bar__content {
height: 56px;
}
/deep/ .van-hairline--bottom::after {
border-bottom: none;
}
/deep/ .van-picker {
background: #1d1d1d;
}
/deep/ .van-picker__mask {
background-image: linear-gradient(
180deg
,rgba(28, 28, 28 , 0.9),rgba(24, 24, 24, 0.4)),linear-gradient(
0deg
,rgba(28, 28, 28 , 0.9),rgba(24, 24, 24, 0.4))
}
/deep/ .van-picker-column__item {
color: rgba(255, 255, 255, 1)
}
</style>
\ No newline at end of file
...@@ -21,14 +21,14 @@ module.exports = { ...@@ -21,14 +21,14 @@ module.exports = {
'^/api': '' '^/api': ''
} }
}, },
// '/chain': { '/air': {
// target: process.env.VUE_APP_CHAIN, // target: process.env.VUE_APP_AIRDROP,
// // target: 'http://172.16.100.59:8090', target: 'http://172.16.100.59:8091',
// changeOrigin: true, changeOrigin: true,
// pathRewrite: { pathRewrite: {
// '^/api': '' '^/air': ''
// } }
// }, },
} }
}, },
// configureWebpack: config => { // configureWebpack: config => {
......
...@@ -3633,6 +3633,11 @@ dashdash@^1.12.0: ...@@ -3633,6 +3633,11 @@ dashdash@^1.12.0:
dependencies: dependencies:
assert-plus "^1.0.0" assert-plus "^1.0.0"
dayjs@^1.10.7:
version "1.10.7"
resolved "https://registry.nlark.com/dayjs/download/dayjs-1.10.7.tgz#2cf5f91add28116748440866a0a1d26f3a6ce468"
integrity sha1-LPX5Gt0oEWdIRAhmoKHSbzps5Gg=
de-indent@^1.0.2: de-indent@^1.0.2:
version "1.0.2" version "1.0.2"
resolved "https://registry.nlark.com/de-indent/download/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" resolved "https://registry.nlark.com/de-indent/download/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment