Commit 6b4f558e authored by xhx's avatar xhx

fix: 合并

parents b5232011 5dd832ec
......@@ -11,9 +11,10 @@ import service from '@/service/chain33'
import { getDeviceId, getCurrentBTYAddress } from '@/utils/bridge' // 币钱包环境
import { test } from '@/utils/test' // 本地测试
import { Toast } from 'vant'
import { getUserInfo } from '@/service/pool'
export default Vue.extend({
methods: {
// 账号是否能进入投票
// 账号是否能进入投票,账户可多次切换,刷新时判断是否需重定向回首页
async hasPoolAddr(addr: string) {
Toast.loading({
duration: 0,
......@@ -26,27 +27,49 @@ export default Vue.extend({
const _result = response.data.result?.data
Toast.clear()
if (walletRes.data.result?.datas) {
// 查询到存在冷钱包,跳转空白页
// 查询到存在冷钱包,跳转空白页(即存在挖矿用户,为票池地址)
this.$router.replace({ path: '/noPage', query: { type: '3', status: '1' }})
} else {
// 多账户切换时重定向
this.$router.replace({ path: '/' })
}
// 存在地址,判断此地址是否属于当前项目,
// 若存在地址,判断此地址是否属于当前项目,catch 表明不是当前项目用户
if (_result) {
isBind(_result).catch((res: any) => {
const reason = res.response.data.reason
if (reason) {
this.$router.replace({ path: '/noPage', query: { type: '3' }})
} else {
// 多账户切换时重定向
this.$router.replace({ path: '/' })
}
}).then(() => {
// 多账户切换时重定向
this.$router.replace({ path: '/' })
})
}
} catch (e) {
console.log(e)
Toast({
message: '请求超时,请稍后再试',
className: 'toast_x'
})
}
},
// 获取用户类型,type -> 1: 社区阶段 2:超级节点 status -> 1:票池地址
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 }})
} else {
// 多账户切换时重定向
this.$router.replace({ path: '/' })
}
})
},
},
mounted() {
......@@ -57,6 +80,7 @@ export default Vue.extend({
console.log(ret, 'DEVICEID')
this.$store.commit('app/SET_DEVICEID', ret)
this.hasPoolAddr(res)
this.getInfo()
})
})
// this.$store.commit('app/SET_ADDRESS', test.addr)
......
......@@ -45,11 +45,10 @@ import MiningCard from '@/components/MiningCard.vue'
import xPopup from '@/components/Popup.vue'
import constant from '@/constance/Image'
import Bus from '@/utils/bus'
import { invitePool, poolList, checkBind, getUserInfo } from '@/service/pool'
import { invitePool, poolList, checkBind } from '@/service/pool'
import service from '@/service/chain33'
import { PullRefresh, Toast, Popup } from 'vant'
// import { getDeviceId, getCurrentBTYAddress } from '@/utils/bridge' // 币钱包环境
import { test } from '@/utils/test' // 本地测试
export default Vue.extend({
components: {
......@@ -80,19 +79,6 @@ export default Vue.extend({
},
},
methods: {
getInfo() {
getUserInfo().then(res => {
const type = res.data.data.type + ''
const status = res.data.data.status + ''
if (type === '2') {
this.$router.replace({ path: '/noPage', query: { type: type }})
} else if (type === '1') {
this.$router.replace({ path: '/nodePage' })
} 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)
......@@ -220,11 +206,6 @@ export default Vue.extend({
},
mounted() {
setTimeout(() => {
// Toast.loading({
// forbidClick: true,
// duration: 0
// })
this.getInfo()
this.getCoins()
this.getList()
this.setTimer()
......
......@@ -3,7 +3,8 @@ const CompressionWebpackPlugin = require('compression-webpack-plugin')
module.exports = {
// ...other vue-cli plugin options...
// 项目方地址
// publicPath: '/vote',
css: {
// loaderOptions: {
// less: {
......
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