Commit 38a9de52 authored by yyh's avatar yyh

浏览器环境配置

parent 01205811
VUE_APP_SERVER=http://172.16.101.87:46789/api VUE_APP_SERVER=http://172.16.101.87:46789/api
VUE_APP_BROWSER=http://www.baidu.com VUE_APP_BROWSER=http://47.114.159.142:9033
\ No newline at end of file \ No newline at end of file
VUE_APP_SERVER=http://172.16.101.87:46789/api VUE_APP_SERVER=http://172.16.101.87:46789/api
VUE_APP_BROWSER=http://www.baidu.com VUE_APP_BROWSER=http://47.114.159.142:9033
\ No newline at end of file \ No newline at end of file
NODE_ENV=development NODE_ENV=development
VUE_APP_SERVER=http://172.16.101.87:46789/api VUE_APP_SERVER=http://172.16.101.87:46789/api
VUE_APP_BROWSER=http://www.baidu.com VUE_APP_BROWSER=http://47.114.159.142:9033
\ No newline at end of file \ No newline at end of file
...@@ -77,6 +77,7 @@ const instance = axios.create({ timeout: 1000 * 12}); ...@@ -77,6 +77,7 @@ const instance = axios.create({ timeout: 1000 * 12});
// 设置post请求头 // 设置post请求头
instance.defaults.headers.post['Content-Type'] = 'application/json'; instance.defaults.headers.post['Content-Type'] = 'application/json';
let loading: any; let loading: any;
let time: number;
/** /**
* 请求拦截器 * 请求拦截器
* 每次请求前,如果存在token则在请求头中携带token * 每次请求前,如果存在token则在请求头中携带token
...@@ -95,6 +96,7 @@ instance.interceptors.request.use( ...@@ -95,6 +96,7 @@ instance.interceptors.request.use(
duration: 0, duration: 0,
forbidClick: true, forbidClick: true,
}); });
time = Date.now();
} }
config.cancelToken = new CancelToken((c) => { config.cancelToken = new CancelToken((c) => {
removePendingAjax(config, c); removePendingAjax(config, c);
...@@ -111,9 +113,14 @@ instance.interceptors.response.use( ...@@ -111,9 +113,14 @@ instance.interceptors.response.use(
// 请求成功 // 请求成功
(res: any) => { (res: any) => {
removePendingAjax(res.config); removePendingAjax(res.config);
setTimeout(() => { const diff = 200 - (Date.now() - time);
loading.clear(); if (diff) {
}, 200); setTimeout(() => {
loading && loading.clear();
}, diff);
} else {
loading && loading.clear();
}
if ( res.status === 200) { if ( res.status === 200) {
if (res.data.code === 200) { if (res.data.code === 200) {
return Promise.resolve(res.data.data); return Promise.resolve(res.data.data);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
:proof="proof" :proof="proof"
:key="proof.id" :key="proof.id"
@show-more-action="showMoreAction" @show-more-action="showMoreAction"
@click.native="goProofDetail(proof.id)" @click.native="goProofDetail(proof)"
></proof-item> ></proof-item>
</van-list> </van-list>
...@@ -120,10 +120,10 @@ export default class ProofList extends Vue { ...@@ -120,10 +120,10 @@ export default class ProofList extends Vue {
private select(type: string) { private select(type: string) {
const obj: any = { const obj: any = {
blockChain: () => { this.blockChainProof(this.currentProof); }, blockChain: () => { this.blockChainProof(this.currentProof); },
edit: () => { this.goProofDetail(this.currentProof.id); }, edit: () => { this.goProofDetail(this.currentProof); },
del: () => { this.delProof(this.currentProof.id); }, del: () => { this.delProof(this.currentProof.id); },
copy: () => { this.copyProof(this.currentProof); }, copy: () => { this.copyProof(this.currentProof); },
blockquery: () => { this.goToBROWSER(); }, blockquery: () => { this.goToBROWSER(this.currentProof); },
copyhash: () => { this.copyHash(this.currentProof); }, copyhash: () => { this.copyHash(this.currentProof); },
del2: () => { this.abandonProof(this.currentProof.id); }, del2: () => { this.abandonProof(this.currentProof.id); },
}; };
...@@ -156,8 +156,12 @@ export default class ProofList extends Vue { ...@@ -156,8 +156,12 @@ export default class ProofList extends Vue {
}); });
} }
private goProofDetail(proofId: string) { private goProofDetail(proof: any) {
this.$router.push({ name: 'ProofDetail', query: { proofId }}); if ([ChainStatus.SUCCESS].includes(proof.status) ) {
location.href = process.env.VUE_APP_BROWSER + `/product?hash=0x${proof.hash}`;
} else {
this.$router.push({ name: 'ProofDetail', query: { proofId: proof.id }});
}
} }
private showMoreAction(data: any) { private showMoreAction(data: any) {
this.show = true; this.show = true;
...@@ -246,8 +250,8 @@ export default class ProofList extends Vue { ...@@ -246,8 +250,8 @@ export default class ProofList extends Vue {
this.$copyText(proof.hash); this.$copyText(proof.hash);
this.$toast('hash地址复制成功'); this.$toast('hash地址复制成功');
} }
private goToBROWSER() { private goToBROWSER(proof: any) {
location.href = process.env.VUE_APP_BROWSER; location.href = process.env.VUE_APP_BROWSER + `/product?hash=0x${proof.hash}`;
} }
} }
</script> </script>
......
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