Commit 30024249 by zhanghui1

还是搞不明白

parent c71f3f79
<template>
<div id="app" :class="gradeClass">
<!-- <transition name="fade" mode="out-in">
<router-view/>
</transition> -->
<router-view/>
<transition :name="'vux-pop-' + (direction === '' ? '' : (direction === 'forward' ? 'in' : 'out'))" v-if="left">
<transition :name="'vux-pop-' + (direction === '' ? '' : (direction === 'forward' ? 'in' : 'out'))" v-if="left">
<mr-navigation>
<router-view></router-view>
</mr-navigation>
......@@ -15,7 +10,6 @@
<router-view></router-view>
</mr-navigation>
</transition>
</div>
</template>
<script>
......@@ -24,12 +18,12 @@ export default {
name: 'app',
data() {
return {
left: false
left: false
}
},
computed: {
...mapState('translate', ['direction']),
finallyDirection () {
finallyDirection() {
return this.tempDirection || this.direction
}
},
......@@ -49,26 +43,78 @@ export default {
height: 100%;
position: relative;
}
.mobile-android .vux-pop-in-enter-active,
.mobile-android .vux-pop-in-leave-activ,
.mobile-android .vux-pop-out-enter-active,
.mobile-android .vux-pop-out-enter-active{
transition-duration:.2s;
transition-timing-function:cubic-bezier(.4,.6,.2,1);
opacity: 1;
}
.vux-pop-in-enter{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);opacity:1;z-index:2}
.vux-pop-in-enter-active{box-shadow:0 0 10px rgba(0,0,0,.15)}
.vux-pop-in-enter-to{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1;z-index:2}
.vux-pop-in-leave{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:.8;z-index:1}
.vux-pop-in-leave-to{-webkit-transform:translate3d(-33%,0,0);transform:translate3d(-33%,0,0);opacity:0;z-index:1}
.mobile-android .vux-pop-in-enter-active,
.mobile-android .vux-pop-in-leave-activ,
.mobile-android .vux-pop-out-enter-active,
.mobile-android .vux-pop-out-enter-active {
transition-duration: .2s;
transition-timing-function: cubic-bezier(.4, .6, .2, 1);
opacity: 1;
}
.vux-pop-in-enter {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
opacity: 1;
z-index: 2
}
.vux-pop-in-enter-active {
box-shadow: 0 0 10px rgba(0, 0, 0, .15)
}
.vux-pop-in-enter-to {
-webkit-transform: translateZ(0);
transform: translateZ(0);
opacity: 1;
z-index: 2
}
.vux-pop-in-leave {
-webkit-transform: translateZ(0);
transform: translateZ(0);
opacity: .8;
z-index: 1
}
.vux-pop-in-leave-to {
-webkit-transform: translate3d(-33%, 0, 0);
transform: translate3d(-33%, 0, 0);
opacity: 0;
z-index: 1
}
.vux-pop-out-enter{-webkit-transform:translate3d(-33%,0,0);transform:translate3d(-33%,0,0);opacity:.8;z-index:1}
.vux-pop-out-enter-to{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1;z-index:1}
.vux-pop-out-leave{-webkit-transform:translateZ(0);transform:translateZ(0);opacity:1;z-index:2}
.vux-pop-out-leave-active{box-shadow:0 0 10px rgba(0,0,0,.15)}
.vux-pop-out-leave-to{-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0);opacity:1;z-index:2}
.vux-pop-out-enter {
-webkit-transform: translate3d(-33%, 0, 0);
transform: translate3d(-33%, 0, 0);
opacity: .8;
z-index: 1
}
.vux-pop-out-enter-to {
-webkit-transform: translateZ(0);
transform: translateZ(0);
opacity: 1;
z-index: 1
}
.vux-pop-out-leave {
-webkit-transform: translateZ(0);
transform: translateZ(0);
opacity: 1;
z-index: 2
}
.vux-pop-out-leave-active {
box-shadow: 0 0 10px rgba(0, 0, 0, .15)
}
.vux-pop-out-leave-to {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
opacity: 1;
z-index: 2
}
</style>
......@@ -135,7 +135,7 @@ export default {
* @return {[type]} [description]
*/
getLucky(coin_type) {
return $axios($store.state.common_url + "/pool/lucky?coin_type=" + coin_type)
return $axios(Vue.$store.state.poolinApp.common_url + "/pool/lucky?coin_type=" + coin_type)
},
/**
* [getBlocks 获取矿池出块数据]
......@@ -145,7 +145,7 @@ export default {
* @return {[type]} [description]
*/
getBlocks(coin_type) {
return $axios($store.state.common_url + "/pool/blocks/merge?coin_type=" + coin_type)
return $axios(Vue.$store.state.poolinApp.common_url + "/pool/blocks/merge?coin_type=" + coin_type)
},
/**
* [getStats 获取矿池实时算力-合并]
......@@ -155,7 +155,7 @@ export default {
* @return {[type]} [description]
*/
getStats(coin_type) {
return $axios($store.state.common_url + "/pool/stats/merge?coin_type=" + coin_type)
return $axios(Vue.$store.state.poolinApp.common_url + "/pool/stats/merge?coin_type=" + coin_type)
},
/**
* [getShareHistory 获取矿池算力历史-合并]
......@@ -167,7 +167,7 @@ export default {
* @return {[type]} [description]
*/
getShareHistory(count, dimension, coin_type) {
return $axios($store.state.common_url + "/pool/share-history/merge?count=" + count + "&dimension=" + dimension + "&coin_type=" + coin_type)
return $axios(Vue.$store.state.poolinApp.common_url + "/pool/share-history/merge?count=" + count + "&dimension=" + dimension + "&coin_type=" + coin_type)
},
/**
* [getSubAccount 获取子账户列表]
......@@ -176,7 +176,7 @@ export default {
* @return {[type]} [description]
*/
getSubAccount() {
return $axios($store.state.common_url + "/subaccount")
return $axios(Vue.$store.state.poolinApp.common_url + "/subaccount")
},
/**
* [getSubAccountById 获取子账户详情]
......@@ -187,13 +187,13 @@ export default {
*/
getSubAccountById(puid) {
return new Promise(function (relsove, reject) {
if (!$store.state.SubAccount) $store.state.SubAccount = {};
if ($store.state.SubAccount['SubAccount' + puid]) {
relsove($store.state.SubAccount['SubAccount' + puid])
if (!Vue.$store.state.poolinApp.SubAccount) Vue.$store.state.poolinApp.SubAccount = {};
if (Vue.$store.state.poolinApp.SubAccount['SubAccount' + puid]) {
relsove(Vue.$store.state.poolinApp.SubAccount['SubAccount' + puid])
} else {
$axios($store.state.common_url + "/subaccount/" + puid).then(function (res) {
$store.state.SubAccount['SubAccount' + puid] = res;
relsove($store.state.SubAccount['SubAccount' + puid])
$axios(Vue.$store.state.poolinApp.common_url + "/subaccount/" + puid).then(function (res) {
Vue.$store.state.poolinApp.SubAccount['SubAccount' + puid] = res;
relsove(Vue.$store.state.poolinApp.SubAccount['SubAccount' + puid])
})
}
})
......@@ -206,7 +206,7 @@ export default {
* @return {[type]} [description]
*/
createAccount(params) {
return $axios.post($store.state.common_url + "/subaccount/create", params)
return $axios.post(Vue.$store.state.poolinApp.common_url + "/subaccount/create", params)
},
/**
* [getUrl 获取初始接口]
......@@ -217,7 +217,7 @@ export default {
*/
getUrl() {
//console.log("getUrl")
return $axios($store.state.base_url)
return $axios(Vue.$store.state.poolinApp.base_url)
// .then(res => { return mock.getUrl })
},
/**
......@@ -230,9 +230,9 @@ export default {
getCoins() {
//console.log("getCoins")
new Promise((resolve, reject) => {
resolve($store.state.init_url.coins)
resolve(Vue.$store.state.poolinApp.init_url.coins)
})
// return $axios($store.state.base_url).then(res => { return res.data.coins })
// return $axios(Vue.$store.state.poolinApp.base_url).then(res => { return res.data.coins })
},
/**
* [getAllRegions 获取初始接口的所有节点]
......@@ -244,13 +244,13 @@ export default {
getAllRegions() {
//console.log("getAllRegions")
// return new Promise((resolve, reject) => {
// resolve($store.state.init_url.regions)
// resolve(Vue.$store.state.poolinApp.init_url.regions)
// })
let coin_type = localStorage.getItem('coin_type');
let regions = [];
let obj = {};
return new Promise((resolve, reject) => {
_.each($store.state.init_url.regions, function (v, k) {
_.each(Vue.$store.state.poolinApp.init_url.regions, function (v, k) {
_.each(v.supported_coin_types, function (v1, k1) {
if (v1.coin_type == coin_type) {
obj = { region_id: v.region_id, text_en: v.text_en, 'text_zh-cn': v['text_zh-cn'] }
......@@ -272,7 +272,7 @@ export default {
//console.log("getRegionInfo")
return new Promise((resolve, reject) => {
let cur_region;
_.each($store.state.init_url.regions, function (v, k) {
_.each(Vue.$store.state.poolinApp.init_url.regions, function (v, k) {
if (v.region_id == region_id) {
cur_region = v;
}
......@@ -289,7 +289,7 @@ export default {
*/
getUserList() {
//console.log("getUserList")
return $axios($store.state.common_url + '/subaccount');
return $axios(Vue.$store.state.poolinApp.common_url + '/subaccount');
},
/**
* [getUser 获取当前帐户信息]
......@@ -301,7 +301,7 @@ export default {
*/
getUser(puid) {
//console.log("getUser")
return $axios($store.state.common_url + '/subaccount/' + puid)
return $axios(Vue.$store.state.poolinApp.common_url + '/subaccount/' + puid)
},
/**
* [getZonglanList 获取单个币种多个节点数据]
......@@ -336,7 +336,7 @@ export default {
// console.log("getApiBaseUrl")
return new Promise((resolve, reject) => {
let api_base_url = '';
_.each($store.state.init_url.regions, function (v, k) {
_.each(Vue.$store.state.poolinApp.init_url.regions, function (v, k) {
if (v.region_id == region_id) {
_.each(v.supported_coin_types, function (v1, k1) {
if (v1.coin_type == cointype) {
......@@ -573,7 +573,7 @@ export default {
*/
getRegionCoins(region_id) {
let arr_coins = [];
_.map($store.state.init_url.regions, function (v, i, o) {
_.map(Vue.$store.state.poolinApp.init_url.regions, function (v, i, o) {
if (v.region_id == region_id) {
_.map(v.supported_coin_types, function (v1, i1, o1) {
arr_coins.push(v1.coin_type)
......@@ -605,7 +605,7 @@ export default {
getStratumUrl(region_id, coin_type) {
return new Promise((resolve, reject) => {
let stratum_url = '';
_.each($store.state.init_url.regions, function (v, k) {
_.each(Vue.$store.state.poolinApp.init_url.regions, function (v, k) {
if (v.region_id == region_id) {
_.each(v.supported_coin_types, function (v1, k1) {
if (v1.coin_type == coin_type) {
......@@ -626,11 +626,11 @@ export default {
*/
getStratumUrls(coin_type) {
//mock.getUrl.data
//$store.state.init_url
//Vue.$store.state.poolinApp.init_url
let data = [];
return new Promise((resolve, reject) => {
let stratum_url = '';
_.each($store.state.init_url.regions, function (v, k) {
_.each(Vue.$store.state.poolinApp.init_url.regions, function (v, k) {
_.each(v.supported_coin_types, function (v1, k1) {
if (v1.coin_type == coin_type) {
data.push({ region_id: v.region_id, text_en: v.text_en, 'text_zh-cn': v['text_zh-cn'], coin_info: v1 })
......@@ -649,7 +649,7 @@ export default {
* @return {[type]} [description]
*/
getSummary(puid, coin_type) {
return $axios($store.state.common_url + "/subaccount/summary?puid=" + puid + "&coin_type=" + coin_type)
return $axios(Vue.$store.state.poolinApp.common_url + "/subaccount/summary?puid=" + puid + "&coin_type=" + coin_type)
},
/**
* [getAllRegionByCoin 根据币种获取到所有节点所支持的所有节点]
......@@ -662,7 +662,7 @@ export default {
let regions = [];
let obj = {};
return new Promise((resolve, reject) => {
_.each($store.state.init_url.regions, function (v, k) {
_.each(Vue.$store.state.poolinApp.init_url.regions, function (v, k) {
_.each(v.supported_coin_types, function (v1, k1) {
if (v1.coin_type == coin_type) {
obj = { region_id: v.region_id, text_en: v.text_en, 'text_zh-cn': v['text_zh-cn'] }
......@@ -677,25 +677,25 @@ export default {
* 创建 token
*/
createToken(puid, params) {
return $axios.post($store.state.common_url + '/watcher/token/create?puid=' + puid, params)
return $axios.post(Vue.$store.state.poolinApp.common_url + '/watcher/token/create?puid=' + puid, params)
},
/**
* 列出 token
*/
listToken(puid, coin) {
return $axios($store.state.common_url + '/watcher/token?puid=' + puid + '&coin_type=' + coin)
return $axios(Vue.$store.state.poolinApp.common_url + '/watcher/token?puid=' + puid + '&coin_type=' + coin)
},
/**
* 获取 token 详情
*/
getTokenInfo(token) {
return $axios($store.state.common_url + '/watcher/token/info?token=' + token)
return $axios(Vue.$store.state.poolinApp.common_url + '/watcher/token/info?token=' + token)
},
/**
* 移除 token
*/
delToken(puid, params) {
return $axios.post($store.state.common_url + '/watcher/token/delete?puid=' + puid, params)
return $axios.post(Vue.$store.state.poolinApp.common_url + '/watcher/token/delete?puid=' + puid, params)
},
/**
* 获取所支持币种
......
<template>
<div class="tab-bar">
<ul flex="main:justify box:mean cross:center">
<li @click="goTo(0)" :class="$store.state.tab_bar==0?'active':''">
<li @click="goTo(0)" :class="$store.state.poolinApp.tab_bar==0?'active':''">
<i class="iconfont icon-tubiaozhexiantu"></i>
<p>用户面板</p>
</li>
<li @click="goTo(1)" :class="$store.state.tab_bar==1?'active':''">
<li @click="goTo(1)" :class="$store.state.poolinApp.tab_bar==1?'active':''">
<i class="iconfont icon-cabinet-settings"></i>
<p>矿机</p>
</li>
<li @click="goTo(2)" :class="$store.state.tab_bar==2?'active':''">
<li @click="goTo(2)" :class="$store.state.poolinApp.tab_bar==2?'active':''">
<i class="iconfont icon-licaishouyi"></i>
<p>收益</p>
</li>
<li @click="goTo(3)" :class="$store.state.tab_bar==3?'active':''">
<li @click="goTo(3)" :class="$store.state.poolinApp.tab_bar==3?'active':''">
<i class="iconfont icon-unie606"></i>
<p>设置</p>
</li>
......@@ -21,45 +21,74 @@
</div>
</template>
<script>
export default {
name: 'tabbar',
data() {
return {
}
},
mounted() {
export default {
name: 'tabbar',
data() {
return {
puid: '',
coin_type: '',
region_id: '',
}
},
mounted() {
let self = this;
this.puid = this.$route.params.puid || localStorage.getItem('puid'); //相关路由参数
this.coin_type = this.$route.params.coin_type || localStorage.getItem('coin_type');
this.region_id = this.$route.params.region_id || localStorage.getItem('region_id');
this.language = localStorage.getItem('language');
},
methods: {
goTo(n) {
this.$store.state.poolinApp.tab_bar = n;
},
methods: {
goTo(n) {
this.$store.state.tab_bar=n;
switch (n) {
case 0:
this.$router.replace('/my/7/ltc/shenzhen/dashboard')
break;
case 1:
this.$router.replace('/my/7/ltc/shenzhen/miners')
break;
case 2:
this.$router.replace('/my/7/ltc/shenzhen/payments')
break;
default:
this.$router.replace('/settings')
break;
}
switch (n) {
case 0:
this.$router.replace('/my/' + this.puid + '/' + this.coin_type + '/' + this.region_id + '/dashboard')
break;
case 1:
this.$router.replace('/my/' + this.puid + '/' + this.coin_type + '/' + this.region_id + '/miners')
break;
case 2:
this.$router.replace('/my/' + this.puid + '/' + this.coin_type + '/' + this.region_id + '/payments')
break;
default:
this.$router.replace('/settings')
break;
}
}
}
}
</script>
<style lang="less">
.tab-bar {position: fixed; left: 0; right: 0; bottom: 0; background: #fff; height:1rem;padding: .10rem 0;box-shadow: 0 -2px 10px #e5eaf0;box-sizing: border-box;
li {text-align: center;
.iconfont {color: #b8b8b8;font-size: .40rem;}
p {color: #727272;font-size: .20rem;margin-top: .02rem;}
.tab-bar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
background: #fff;
height: 1rem;
padding: .10rem 0;
box-shadow: 0 -2px 10px #e5eaf0;
box-sizing: border-box;
li {
text-align: center;
.iconfont {
color: #b8b8b8;
font-size: .40rem;
}
p {
color: #727272;
font-size: .20rem;
margin-top: .02rem;
}
&.active {
p, .iconfont {color: #1c5fa9; }
p,
.iconfont {
color: #1c5fa9;
}
}
}
}
</style>
<template>
<div class="my-popup">
<ul>
<li class="list-coin" v-for="cur_coin in $store.state['cur_coins']" :key="cur_coin" @click="coinAcitve(cur_coin)" :class="cur_coin==coin_type?'active':''">
<b :class="cur_coin">{{cur_coin|uppercase}}{{$store.state.init_url.coins[cur_coin]['text_zh-cn']}}</b>
<li class="list-coin" v-for="cur_coin in $store.state.poolinApp['cur_coins']" :key="cur_coin" @click="coinAcitve(cur_coin)" :class="cur_coin==coin_type?'active':''">
<b :class="cur_coin">{{cur_coin|uppercase}}{{$store.state.poolinApp.init_url.coins[cur_coin]['text_zh-cn']}}</b>
<i class="iconfont icon-dui"></i>
</li>
</ul>
......@@ -22,8 +22,8 @@ export default {
methods: {
coinAcitve(cur_coin) {
this.$emit('childCoin', cur_coin)
this.$store.commit('setCoinType', cur_coin)
this.coin_type=cur_coin
this.$store.commit('poolinApp/setCoinType', cur_coin)
this.coin_type = cur_coin
}
}
}
......
......@@ -29,7 +29,7 @@ export default {
maxOnOff: false
}),
computed: {
...mapState(["txt", "init_url", "cur_coins"]),
...mapState('poolinApp',["txt", "init_url", "cur_coins"]),
line: function() {
let self = this;
return {
......
......@@ -37,13 +37,13 @@
</div>
<div flex="main:center dir:top box:center cross:center">
<p>
<span class="v" v-if="$store.state.coin_type=='xmr'" style="font-size:0.28rem;"><animated-num :value="(payment_stats.yesterday_amount)/Math.pow(10,12)" :fixed=12></animated-num></span>
<span class="v" v-if="$store.state.poolinApp.coin_type=='xmr'" style="font-size:0.28rem;"><animated-num :value="(payment_stats.yesterday_amount)/Math.pow(10,12)" :fixed=12></animated-num></span>
<span class="v" v-else><animated-num :value="(payment_stats.yesterday_amount)/Math.pow(10,8)" :fixed=8></animated-num></span>
<span class="k">{{$route.params.coin_type|uppercase}}</span>
</p>
<h3 class="title f24gray">昨日收益</h3>
<p class="small-k-v mt20">
<span class="v" v-if="$store.state.coin_type=='xmr'"><animated-num :value="(payment_stats.today_estimate)/Math.pow(10,12)" :fixed=12></animated-num></span>
<span class="v" v-if="$store.state.poolinApp.coin_type=='xmr'"><animated-num :value="(payment_stats.today_estimate)/Math.pow(10,12)" :fixed=12></animated-num></span>
<span class="v" v-else><animated-num :value="(payment_stats.today_estimate)/Math.pow(10,8)" :fixed=8></animated-num></span>
<span class="k">{{$route.params.coin_type|uppercase}}</span>
</p>
......@@ -55,14 +55,14 @@
<div class="list">
<h3>账户收益</h3>
<mt-cell title="余额">
<span class="v" v-if="$store.state.coin_type=='xmr'"><animated-num :value="payment_stats.balance/Math.pow(10,12)" :fixed=12></animated-num></span>
<span class="v" v-if="$store.state.poolinApp.coin_type=='xmr'"><animated-num :value="payment_stats.balance/Math.pow(10,12)" :fixed=12></animated-num></span>
<span class="v" v-else><animated-num :value="payment_stats.balance/Math.pow(10,8)" :fixed=8></animated-num></span>
<span class="k">{{$store.state.coin_type|uppercase}}</span>
<span class="k">{{$store.state.poolinApp.coin_type|uppercase}}</span>
</mt-cell>
<mt-cell title="已支付">
<span class="v" v-if="$store.state.coin_type=='xmr'"><animated-num :value="payment_stats.total_paid_amount/Math.pow(10,12)" :fixed=12></animated-num></span>
<span class="v" v-if="$store.state.poolinApp.coin_type=='xmr'"><animated-num :value="payment_stats.total_paid_amount/Math.pow(10,12)" :fixed=12></animated-num></span>
<span class="v" v-else><animated-num :value="payment_stats.total_paid_amount/Math.pow(10,8)" :fixed=8></animated-num></span>
<span class="k">{{$store.state.coin_type|uppercase}}</span>
<span class="k">{{$store.state.poolinApp.coin_type|uppercase}}</span>
</mt-cell>
<mt-cell title="上一次支付时间"><span class="v">2017-11-02 8:00</span></mt-cell>
<mt-cell title="待确认支付"><span class="v">119.71423071</span> <span class="k">BTC</span></mt-cell>
......@@ -140,7 +140,7 @@ export default {
self.pageInit();
window.dingshiqi = setInterval(function() {
self.pageInit();
}, $store.state.refresh_time)
}, $store.state.poolinApp.refresh_time)
},
pageInit() {
let self = this;
......@@ -217,8 +217,8 @@ export default {
this.showSide = false;
},
fromSubAccount(obj) {
this.$store.commit('setPuid', obj.puid)
this.$store.commit('setCoinType', obj.default_coin_type)
this.$store.commit('poolinApp/setPuid', obj.puid)
this.$store.commit('poolinApp/setCoinType', obj.default_coin_type)
this.showSide = false;
this.$route.params.puid = obj.puid;
this.$route.params.coin_type = obj.default_coin_type;
......@@ -228,7 +228,7 @@ export default {
})
},
fromRegion(msg) {
this.$store.commit('setRegionId', msg)
this.$store.commit('poolinApp/setRegionId', msg)
this.showRegion = false;
this.$route.params.region_id = msg;
this.$router.replace({
......@@ -236,7 +236,7 @@ export default {
})
},
fromCoin(msg) {
this.$store.commit('setCoinType', msg)
this.$store.commit('poolinApp/setCoinType', msg)
this.showCoin = false;
this.$route.params.coin_type = msg;
this.getRegionInfo();
......
......@@ -90,7 +90,7 @@ export default {
self.pageInit();
window.dingshiqi = setInterval(function() {
self.pageInit();
}, $store.state.refresh_time)
}, $store.state.poolinApp.refresh_time)
},
pageInit() {
let self = this;
......@@ -139,8 +139,8 @@ export default {
this.showSide = false;
},
fromSubAccount(obj) {
this.$store.commit('setPuid', obj.puid)
this.$store.commit('setCoinType', obj.default_coin_type)
this.$store.commit('poolinApp/setPuid', obj.puid)
this.$store.commit('poolinApp/setCoinType', obj.default_coin_type)
this.showSide = false;
this.$route.params.puid = obj.puid;
this.$route.params.coin_type = obj.default_coin_type;
......@@ -150,7 +150,7 @@ export default {
})
},
fromRegion(msg) {
this.$store.commit('setRegionId', msg)
this.$store.commit('poolinApp/setRegionId', msg)
this.showRegion = false;
this.$route.params.region_id = msg;
this.$router.replace({
......@@ -158,7 +158,7 @@ export default {
})
},
fromCoin(msg) {
this.$store.commit('setCoinType', msg)
this.$store.commit('poolinApp/setCoinType', msg)
this.showCoin = false;
this.$route.params.coin_type = msg;
this.$router.replace({
......
......@@ -4,7 +4,7 @@
<div class="swiper">
<swiper :options="swiperOption" ref="mySwiper">
<!-- slides -->
<swiper-slide flex="main:center cross:center" v-for="(coin,coinIdx) in $store.state.cur_coins" :key="coin"><span :class="coinIdx==active?coin+' active':coin+''" @click="changeCoin(coin,coinIdx)">{{coin|uppercase}}</span></swiper-slide>
<swiper-slide flex="main:center cross:center" v-for="(coin,coinIdx) in $store.state.poolinApp.cur_coins" :key="coin"><span :class="coinIdx==active?coin+' active':coin+''" @click="changeCoin(coin,coinIdx)">{{coin|uppercase}}</span></swiper-slide>
<!-- Optional controls -->
<div class="swiper-button-prev" slot="button-prev"></div>
<div class="swiper-button-next" slot="button-next"></div>
......@@ -45,12 +45,12 @@ export default {
debugger: true,
slidesPerView: 3,
},
coin: $store.state.cur_coins[0],
coin: $store.state.poolinApp.cur_coins[0],
active: 0
}
},
computed: {
...mapState(["txt", "init_url", "cur_coins"]),
...mapState('poolinApp',["txt", "init_url", "cur_coins"]),
swiper() {
return this.$refs.mySwiper.swiper
}
......
......@@ -59,7 +59,7 @@
<script>
import tabbar from "@/components/Common/Tabbar.vue";
export default {
name: 'dashboard',
name: 'settings',
components: {
tabbar
},
......
......@@ -114,7 +114,7 @@ export default {
language: '',
}),
computed: {
...mapState(["txt", "init_url", "cur_coins"]),
...mapState('poolinApp',["txt", "init_url", "cur_coins"]),
line: function() {
let self = this;
return {
......
......@@ -40,7 +40,7 @@ export default {
unit: ''
}),
computed: {
...mapState(["txt", "init_url", "cur_coins"]),
...mapState('poolinApp',["txt", "init_url", "cur_coins"]),
line: function() {
let self = this;
return {
......
......@@ -57,7 +57,7 @@ export default {
maxOnOff:false,
}),
computed: {
...mapState(["txt", "init_url", "cur_coins"]),
...mapState('poolinApp',["txt", "init_url", "cur_coins"]),
line: function() {
let self = this;
return {
......
......@@ -40,7 +40,7 @@ export default {
}),
props: ["params_coin"],
computed: {
...mapState(["txt", "init_url", "cur_coins"]),
...mapState("poolinApp",["txt", "init_url", "cur_coins"]),
line: function() {
let self = this;
return {
......@@ -137,7 +137,7 @@ export default {
},
},
watch: {
params_coin(){
params_coin() {
this.pageInitInterval()
}
},
......@@ -151,39 +151,37 @@ export default {
self.pageInit();
window.dingshiqi = setInterval(function() {
self.pageInit();
}, $store.state.refresh_time)
}, $store.state.poolinApp.refresh_time)
},
pageInit() {
let self = this;
this.language = localStorage.getItem('language');
fn.getStats(self.params_coin)
.then(res => {
if (res.data.err_no == 0) {
self.shares_1h = res.data.data.shares.shares_1h
self.shares_unit = res.data.data.shares.shares_unit
self.workers = res.data.data.workers
} else {
this.$message.error("获取矿池合并实时算力错误!")
}
})
fn.getStats(self.params_coin).then(res => {
if (res.data.err_no == 0) {
self.shares_1h = res.data.data.shares.shares_1h
self.shares_unit = res.data.data.shares.shares_unit
self.workers = res.data.data.workers
} else {
this.$message.error("获取矿池合并实时算力错误!")
}
})
fn.getShareHistory(72, "1h", self.params_coin)
.then(res => {
let hour;
self.shareHistoryTime = [];
self.shareHistoryYes = [];
self.shareHistoryNo = [];
if (res.data.err_no == 0) {
self.unit = res.data.data.unit;
_.each(res.data.data.tickers, function(v, i) {
self.shareHistoryTime.push(fn.getYMDHM(v[0] * 1000))
self.shareHistoryYes.push(v[1]);
self.shareHistoryNo.push(v[2]);
});
} else {
this.$message.error("获取矿池合并算力历史错误!")
}
})
fn.getShareHistory(72, "1h", self.params_coin).then(res => {
let hour;
self.shareHistoryTime = [];
self.shareHistoryYes = [];
self.shareHistoryNo = [];
if (res.data.err_no == 0) {
self.unit = res.data.data.unit;
_.each(res.data.data.tickers, function(v, i) {
self.shareHistoryTime.push(fn.getYMDHM(v[0] * 1000))
self.shareHistoryYes.push(v[1]);
self.shareHistoryNo.push(v[2]);
});
} else {
this.$message.error("获取矿池合并算力历史错误!")
}
})
}
}
}
......
......@@ -16,12 +16,12 @@ import scrollKeeper from './maxrocky/scrollKeeper'
import routeTranslate from './maxrocky/routeTranslate'
import BetterScroll from './maxrocky/betterScroll'
Vue.use(CacheNavigation, {router})
Vue.use(CacheNavigation, { router })
Vue.use(scrollKeeper)
Vue.use(routeTranslate, {router, store})
Vue.use(routeTranslate, { router, store })
Vue.use(BetterScroll)
window.$store = store;
window.$store=Vue.$store = Vue.prototype.$store= store;
Vue.use(VueAwesomeSwiper)
Vue.use(VueClipboard)
Vue.use(MintUI)
......@@ -49,7 +49,7 @@ axios.interceptors.request.use(config => {
function checkToken() {
return new Promise((resolve, reject) => {
resolve("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlEwTTBNRUl4UVRVME5qazJNa0ZFT0RCRk56WkJNVGc0TmtFd09UWkNOakZGTlRFMFEwVTJOdyJ9.eyJpc3MiOiJodHRwczovL2Jsb2NraW4uYXV0aDAuY29tLyIsInN1YiI6ImF1dGgwfDU5ZjE3OTc5ZDljMGM1MzZiZjRhMzVjMSIsImF1ZCI6WyJodHRwczovL3d3dy5wb29saW4uY29tL2FwaSIsImh0dHBzOi8vYmxvY2tpbi5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNTE3MDIzMTQyLCJleHAiOjE1MTcwMzAzNDIsImF6cCI6IkZhczI5dWJNNW52NElFMlZUQ3ZEWU5iaWtIeTF0bDBkIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSByZWFkIHdyaXRlIn0.rhEE0XwPWhXU-bxDbEeZFmpGzs-jzbM5z9Zd0U7B6YN5mJpHDTRXkMmUvda5rDDxe8sTPw6yKkYvGYdvZeNenlZjsQDe_j1m6OxqrCGT9_3NqXQWS-26aY0vHdbjPINIltzmikJ8QmFWjl9-I-9onp7lOW9N-mB9lCc-Ff6jDMMpVtJGe-mgsE_Ywp57qzkB-TmipHq-gq6BtQ644WqwzJmSWszOrvX7FYxhpOscPTo9O4oYypym4Inc-71NQ-caxwtuTAAbRgR_-enfJ0BYwu0CogWJflew8qbrz2DjZeU6tvUAGoCHDj83aHRygCw3eZPx6jYTEOscfZLjNce_5g");
resolve("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IlEwTTBNRUl4UVRVME5qazJNa0ZFT0RCRk56WkJNVGc0TmtFd09UWkNOakZGTlRFMFEwVTJOdyJ9.eyJpc3MiOiJodHRwczovL2Jsb2NraW4uYXV0aDAuY29tLyIsInN1YiI6ImF1dGgwfDU5ZjE3OTc5ZDljMGM1MzZiZjRhMzVjMSIsImF1ZCI6WyJodHRwczovL3d3dy5wb29saW4uY29tL2FwaSIsImh0dHBzOi8vYmxvY2tpbi5hdXRoMC5jb20vdXNlcmluZm8iXSwiaWF0IjoxNTE3MTEyNjkzLCJleHAiOjE1MTcxMTk4OTMsImF6cCI6IkZhczI5dWJNNW52NElFMlZUQ3ZEWU5iaWtIeTF0bDBkIiwic2NvcGUiOiJvcGVuaWQgcHJvZmlsZSByZWFkIHdyaXRlIn0.GFgTnVQnQp1TcycKZP9shxTOPh0k6uLyeQQs00AcqT7-UZ6NDJwGghwfLBhc-LSVMYIwzOuIbiNlwaCzJ2m7OrOiXVJ2PXdDjhfbFOlw7WvXQ1TV_cgLWzOqSGHAtrCQkXFm5Op5gGRsnbpmUOf4IzY2CfyLAhfP0UOmnYn7UgC9iBCNb67C43IAH_CUbLySYXxggNUKhuDGVT99wBdO8RcR6SypaP6e_Rxegb5fI_cR_FZYUQjlKB2dkUsjEN2bmg8ffYpI6s_bWNN06BYnswgMGfF2GRGPz1AJb7SHyqTBXKVaY3qd0eSmbCl3tEFZNEg9uIG74Mu6F47P_KKv2A");
})
}
window.$axios = Vue.prototype.$axios = axios;
......@@ -57,7 +57,6 @@ window.$axios = Vue.prototype.$axios = axios;
window.$router = router.$router = router
Vue.config.productionTip = false
new Vue({
......@@ -66,4 +65,4 @@ new Vue({
router,
template: '<App/>',
components: { App }
})
})
\ No newline at end of file
import Vue from 'vue'
import Router from 'vue-router'
import fn from '@/assets/js/function.js'
// import $store from '@/store/modules/poolinApp.js'
Vue.use(Router)
import Home from '@/components/Home'
......@@ -34,202 +33,194 @@ import NoticeShow from '@/components/Notice/detail'
const router = new Router({
routes: [{
path: '/',
name: 'home',
component: Home,
meta: {
title: 'Home.vue'
}
}, {
path: '/login',
name: 'login',
component: Login,
meta: {
title: 'Login.vue'
}
}, {
path: '/reg',
name: 'reg',
component: Reg,
meta: {
title: 'Reg.vue'
}
}, {
path: '/jump',
name: 'jump',
component: Jump,
meta: {
title: 'Jump.vue'
}
}, {
path: '/create',
name: 'create',
component: Create,
meta: {
title: 'Create.vue'
}
}, {
path: '/welcome',
name: 'welcome',
component: Welcome,
meta: {
title: 'Welcome.vue'
}
}, {
path: '/subaccount',
name: 'subaccount',
component: Subaccount,
meta: {
title: 'Subaccount.vue'
}
}, {
path: '/my/:puid/:coin_type',
name: 'no',
component: no,
meta: {
title: 'no.vue'
}
}, {
path: '/my/:puid/:coin_type/:region_id/dashboard',
name: 'dashboard',
component: Dashboard,
meta: {
title: 'Dashboard.vue'
}
}, {
path: '/my/:puid/:coin_type/:region_id/miners',
name: 'miners',
component: Miners,
meta: {
title: 'Miners.vue'
}
}, {
path: '/my/:puid/:coin_type/:region_id/miners/:worker_id',
name: 'minershow',
component: MinerShow,
meta: {
title: 'MinerShow.vue'
}
}, {
path: '/my/:puid/:coin_type/:region_id/payments',
name: 'payments',
component: Payments,
meta: {
title: 'Payments.vue'
}
}, {
path: '/settings',
name: 'settings',
component: Settings,
meta: {
title: 'Settings.vue'
}
}, {
path: '/defaultCoin',
name: 'defaultCoin',
component: DefaultCoin,
meta: {
title: 'DefaultCoin.vue'
}
}, {
path: '/language',
name: 'language',
component: Language,
meta: {
title: 'Language.vue'
}
}, {
path: '/account',
name: 'account',
component: Account,
meta: {
title: 'Account.vue'
}
}, {
path: '/notice',
name: 'notice',
component: Notice,
meta: {
title: 'Notice.vue'
}
}, {
path: '/noticeList',
name: 'noticeList',
component: NoticeList,
meta: {
title: 'NoticeList.vue'
}
}, {
path: '/noticeShow',
name: 'noticeShow',
component: NoticeShow,
meta: {
title: 'NoticeShow.vue'
}
},
]
path: '/',
name: 'home',
component: Home,
meta: {
title: 'Home.vue'
}
}, {
path: '/login',
name: 'login',
component: Login,
meta: {
title: 'Login.vue'
}
}, {
path: '/reg',
name: 'reg',
component: Reg,
meta: {
title: 'Reg.vue'
}
}, {
path: '/jump',
name: 'jump',
component: Jump,
meta: {
title: 'Jump.vue'
}
}, {
path: '/create',
name: 'create',
component: Create,
meta: {
title: 'Create.vue'
}
}, {
path: '/welcome',
name: 'welcome',
component: Welcome,
meta: {
title: 'Welcome.vue'
}
}, {
path: '/subaccount',
name: 'subaccount',
component: Subaccount,
meta: {
title: 'Subaccount.vue'
}
}, {
path: '/my/:puid/:coin_type',
name: 'no',
component: no,
meta: {
title: 'no.vue'
}
}, {
path: '/my/:puid/:coin_type/:region_id/dashboard',
name: 'dashboard',
component: Dashboard,
meta: {
title: 'Dashboard.vue'
}
}, {
path: '/my/:puid/:coin_type/:region_id/miners',
name: 'miners',
component: Miners,
meta: {
title: 'Miners.vue'
}
}, {
path: '/my/:puid/:coin_type/:region_id/miners/:worker_id',
name: 'minershow',
component: MinerShow,
meta: {
title: 'MinerShow.vue'
}
}, {
path: '/my/:puid/:coin_type/:region_id/payments',
name: 'payments',
component: Payments,
meta: {
title: 'Payments.vue'
}
}, {
path: '/settings',
name: 'settings',
component: Settings,
meta: {
title: 'Settings.vue'
}
}, {
path: '/defaultCoin',
name: 'defaultCoin',
component: DefaultCoin,
meta: {
title: 'DefaultCoin.vue'
}
}, {
path: '/language',
name: 'language',
component: Language,
meta: {
title: 'Language.vue'
}
}, {
path: '/account',
name: 'account',
component: Account,
meta: {
title: 'Account.vue'
}
}, {
path: '/notice',
name: 'notice',
component: Notice,
meta: {
title: 'Notice.vue'
}
}, {
path: '/noticeList',
name: 'noticeList',
component: NoticeList,
meta: {
title: 'NoticeList.vue'
}
}, {
path: '/noticeShow',
name: 'noticeShow',
component: NoticeShow,
meta: {
title: 'NoticeShow.vue'
}
}, ]
})
router.beforeEach((to, from, next) => {
//console.log(to)
var arr = ['home', 'jump'];
if (localStorage.getItem('enter_panel') == null) {
Vue.$store.commit('poolinApp/setEnterPannel', Vue.$store.state.poolinApp.enter_panel);
}
if (localStorage.getItem('puid') == null) {
Vue.$store.commit('poolinApp/setPuid', '');
} else {
Vue.$store.commit('poolinApp/setPuid', localStorage.getItem('puid'))
}
if (localStorage.getItem('enter_panel') == "true") {
Vue.$store.commit('poolinApp/setEnterPannel', true);
}
// if (localStorage.getItem('enter_panel') == null) {
// $store.commit('poolinApp/setEnterPannel', $store.state.poolinApp.enter_panel);
// }
// next()
// if (localStorage.getItem('puid') == null) {
// $store.commit('poolinApp/setPuid', '');
// } else {
// if (to.params.puid) {
// $store.commit('poolinApp/setPuid', to.params.puid)
// }
// }
// if (localStorage.getItem('enter_panel') == "true") {
// $store.commit('poolinApp/setEnterPannel', true);
// }
// if (localStorage.getItem('language') == null) {
// $store.commit('poolinApp/setLanguage', $store.state.language)
// }
//最先执行的初始数据
// if ($store.state.cur_coins.length == 0) {
// $axios($store.state.base_url).then(res => {
// $store.commit('poolinApp/setInitUrl', res.data);
// $store.commit('poolinApp/setCurCoins', fn.getCoinsOnly(res.data));
if (localStorage.getItem('language') == null) {
Vue.$store.commit('poolinApp/setLanguage', Vue.$store.state.poolinApp.language)
}
// if (localStorage.getItem('coin_type') == null) {
// $store.commit('poolinApp/setCoinType', $store.state.cur_coins[0]);
// } else {
// if (to.params.coin_type) {
// $store.commit('poolinApp/setCoinType', to.params.coin_type);
// } else {
// $store.commit('poolinApp/setCoinType', localStorage.getItem('coin_type'));
// }
// }
// 最先执行的初始数据
if (Vue.$store.state.poolinApp.cur_coins.length == 0) {
$axios(Vue.$store.state.poolinApp.base_url).then(res => {
Vue.$store.commit('poolinApp/setInitUrl', res.data);
Vue.$store.commit('poolinApp/setCurCoins', fn.getCoinsOnly(res.data));
// if (localStorage.getItem("region_id") == null) {
// $store.commit('poolinApp/setRegionId', res.data.regions[0].region_id);
// } else {
// if (to.params.region_id) {
// $store.commit('poolinApp/setRegionId', to.params.region_id);
// } else {
// $store.commit('poolinApp/setRegionId', localStorage.getItem('region_id'));
// }
// }
// modeSwitch(to, from, next)
// })
// } else {
// modeSwitch(to, from, next)
// }
if (localStorage.getItem('coin_type') == null) {
Vue.$store.commit('poolinApp/setCoinType', Vue.$store.state.poolinApp.cur_coins[0]);
} else {
if (to.params.coin_type) {
Vue.$store.commit('poolinApp/setCoinType', to.params.coin_type);
} else {
Vue.$store.commit('poolinApp/setCoinType', localStorage.getItem('coin_type'));
}
}
if (localStorage.getItem("region_id") == null) {
Vue.$store.commit('poolinApp/setRegionId', res.data.regions[0].region_id);
} else {
if (to.params.region_id) {
Vue.$store.commit('poolinApp/setRegionId', to.params.region_id);
} else {
Vue.$store.commit('poolinApp/setRegionId', localStorage.getItem('region_id'));
}
}
modeSwitch(to, from, next)
})
} else {
modeSwitch(to, from, next)
}
})
// router.afterEach((to, from) => {
// clearInterval(window.dingshiqi);
// document.title = to.meta.title;
// })
router.afterEach((to, from) => {
clearInterval(window.dingshiqi);
document.title = to.meta.title;
})
export default router
......@@ -260,7 +251,7 @@ function modeSwitch(to, from, next) {
} else {
// alert("进入正常模式")
localStorage.removeItem('read_token');
$store.state.read_token = '';
Vue.$store.state.poolinApp.read_token = '';
next();
// var arr = ['index', 'stats', 'callback', 'jump'];
// if ($auth.isAuthenticated() || arr.indexOf(to.name) > -1) {
......
import dictionaries from '@/assets/js/dictionaries.js'; //字典
export default {
namespaced: true,
state: {
refresh_time: 10000, //定时刷新
refresh_time: 60000, //定时刷新
// is_login: $auth.isAuthenticated(), //是否登录
init_url: {},
cur_coins: [],
......
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 sign in to comment