Commit 38a9de52 authored by yyh's avatar yyh

浏览器环境配置

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