feat:chrome插件提交

This commit is contained in:
fanxb 2019-12-14 00:20:47 +08:00
parent 7d04719990
commit b804ee8520
2 changed files with 12 additions and 9 deletions

View File

@ -33,6 +33,7 @@ axios.interceptors.request.use(
axios.interceptors.response.use( axios.interceptors.response.use(
res => { res => {
if (res.data.code === -1) { if (res.data.code === -1) {
localStorage.removeItem('token');
window.vueInstance.$router.replace('/public/login'); window.vueInstance.$router.replace('/public/login');
} else if (res.data.code === 1) { } else if (res.data.code === 1) {
return res.data.data; return res.data.data;

View File

@ -10,7 +10,9 @@
<el-button slot="append" icon="el-icon-search"></el-button> <el-button slot="append" icon="el-icon-search"></el-button>
</el-input> </el-input>
<div class="searchResult"> <div class="searchResult">
<div class="item" v-for="item in searchList" :key="item.bookmarkId"><a target="_blank" :href="item.url">{{item.name}}</a></div> <div class="item" v-for="item in searchList" :key="item.bookmarkId">
<a target="_blank" :href="item.url">{{ item.name }}</a>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -22,14 +24,14 @@ export default {
data() { data() {
return { return {
personInfo: {}, personInfo: {},
searchContent: "", searchContent: '',
searchList: [], searchList: [],
timeOut: null timeOut: null,
}; };
}, },
watch: { watch: {
searchContent(newVal, oldVal) { searchContent(newVal, oldVal) {
if (newVal.trim() != oldVal) { if (newVal.trim() !== oldVal) {
if (this.timeOut != null) { if (this.timeOut != null) {
clearTimeout(this.timeOut); clearTimeout(this.timeOut);
} }
@ -39,7 +41,7 @@ export default {
this.timeOut = null; this.timeOut = null;
}, 200); }, 200);
} }
} },
}, },
created() { created() {
window.token = localStorage.getItem('token'); window.token = localStorage.getItem('token');
@ -47,11 +49,11 @@ export default {
}, },
methods: { methods: {
async init() { async init() {
let personInfo = await axios.get("/user/currentUserInfo"); let personInfo = await axios.get('/user/currentUserInfo');
window.personInfo = personInfo; window.personInfo = personInfo;
this.personInfo = personInfo; this.personInfo = personInfo;
} },
} },
}; };
</script> </script>