Commit b82cfced authored by 罗新东's avatar 罗新东

修改了扫码模块

parent 25f68366
<template> <template>
<div id='content'> <div id="content">
<van-image <van-image
width="100" width="100"
height="100" height="100"
:src="require('../../assets/result/fail.png')" :src="require('../../assets/result/fail.png')"
/> />
<div class='text'>{{text}}</div> <div class="text">{{ text }}</div>
<div class='button'> <div class="content" v-if="content">
<van-button block color="#52c41a" @click="$router.back()">返回</van-button> {{ content }}
</div>
<div class="button">
<van-button block color="#52c41a" @click="$router.back()"
>返回</van-button
>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data(){ data() {
return { return {
text:'操作失败' text: "操作失败",
} content: "",
};
}, },
mounted(){ mounted() {
let text = this.$route.query.text; let {text,content} = this.$route.query;
if(text){ if(text){
this.text=text this.text=text;
} this.content=content;
} }
},
}; };
</script> </script>
<style scoped> <style scoped>
#content{ #content {
text-align: center; text-align: center;
padding-top: 2rem; padding-top: 2rem;
} }
.text{ .text {
margin-top:0.6rem; margin-top: 0.6rem;
font-size: 0.8rem; font-size: 0.8rem;
color:#e84335 color: #e84335;
} }
.button{ .button {
padding: 1rem 0.5rem; padding: 1rem 0.5rem;
} }
.content {
font-size: 0.5rem;
color: #aaa;
padding-top: 10px;
}
</style> </style>
\ No newline at end of file
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
:src="require('../../assets/result/success.png')" :src="require('../../assets/result/success.png')"
/> />
<div class='text'>{{text}}</div> <div class='text'>{{text}}</div>
<div class='content' v-if="content">
{{content}}
</div>
<div class='button'> <div class='button'>
<van-button block color="#52c41a" @click="$router.back()">返回</van-button> <van-button block color="#52c41a" @click="$router.back()">返回</van-button>
</div> </div>
...@@ -16,13 +19,15 @@ ...@@ -16,13 +19,15 @@
export default { export default {
data(){ data(){
return { return {
text:'操作成功' text:'操作成功',
content:''
} }
}, },
mounted(){ mounted(){
let text = this.$route.query.text; let {text,content} = this.$route.query;
if(text){ if(text){
this.text=text this.text=text;
this.content=content;
} }
} }
}; };
...@@ -41,4 +46,9 @@ export default { ...@@ -41,4 +46,9 @@ export default {
.button{ .button{
padding: 1rem 0.5rem; padding: 1rem 0.5rem;
} }
.content{
font-size: 0.5rem;
color: #aaa;
padding-top: 10px;
}
</style> </style>
\ No newline at end of file
<template> <template>
<div id='content'> <div id="content">
<van-image <van-image
width="100" width="100"
height="100" height="100"
:src="require('../../assets/result/warn.png')" :src="require('../../assets/result/warn.png')"
/> />
<div class='text'>{{text}}</div> <div class="text">{{ text }}</div>
<div class='button'> <div class="content" v-if="content">
<van-button block color="#52c41a" @click="$router.back()">返回</van-button> {{ content }}
</div>
<div class="button">
<van-button block color="#52c41a" @click="$router.back()"
>返回</van-button
>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
data(){ data() {
return { return {
text:'警告信息' text: "警告信息",
} content: "",
};
}, },
mounted(){ mounted() {
let text = this.$route.query.text; let {text,content} = this.$route.query;
if(text){ if(text){
this.text=text this.text=text;
} this.content=content;
} }
},
}; };
</script> </script>
<style scoped> <style scoped>
#content{ #content {
text-align: center; text-align: center;
padding-top: 2rem; padding-top: 2rem;
} }
.text{ .text {
margin-top:0.6rem; margin-top: 0.6rem;
font-size: 0.8rem; font-size: 0.8rem;
color:#faad14 color: #faad14;
} }
.button{ .button {
padding: 1rem 0.5rem; padding: 1rem 0.5rem;
} }
.content {
font-size: 0.5rem;
color: #aaa;
padding-top: 10px;
}
</style> </style>
\ No newline at end of file
...@@ -20,21 +20,30 @@ export default { ...@@ -20,21 +20,30 @@ export default {
.then((res) => { .then((res) => {
this.$toast.clear(); this.$toast.clear();
// this.$toast.success("扫码成功"); // this.$toast.success("扫码成功");
let obj ={ res.data.details=res.data.details=='签到成功'?'您已签到':res.data.details;
签到成功:'success', let obj = {
签到失败:'fail', 您已签到: "success",
重复签到:'warn' 签到失败: "fail",
} 重复签到: "warn",
};
this.$router.replace({ this.$router.replace({
name:obj[res.data.details], name: obj[res.data.details],
query:{ query: {
text:res.data.details text: res.data.details,
} content:res.data.details=='签到失败'&&'请联系管理员'
}) },
});
}) })
.catch(() => { .catch(() => {
this.$toast.clear(); this.$toast.clear();
this.$toast.fail("扫码失败,请稍后再试"); // this.$toast.fail("扫码失败,请稍后再试");
this.$router.replace({
name: 'fail',
query: {
text: '扫码失败',
content:'请联系管理员'
},
});
}); });
}, },
}, },
......
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