57 lines
1.9 KiB
Vue
57 lines
1.9 KiB
Vue
<template>
|
|
<div id="app">
|
|
<router-view></router-view>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { sendChromeAPIMessage } from '@/api/chromeApi'
|
|
import { Message } from 'element-ui'
|
|
export default {
|
|
data () {
|
|
return {
|
|
component: 'Home'
|
|
}
|
|
},
|
|
|
|
created () {
|
|
if (!this.$store.state.token) {
|
|
this.$router.push('/login')
|
|
} else {
|
|
this.$store.dispatch('getUserInfo');
|
|
sendChromeAPIMessage({url: 'bg/quiet/api/mms/userInfo', needMallId: false, data: {}}).then((res) => {
|
|
if (res.errorCode == 1000000) {
|
|
if (res.result.companyList[0].malInfoList.length == 1) {
|
|
this.$store.commit('setMallId', `${res.result.companyList[0].malInfoList[0].mallId}`)
|
|
this.$store.commit('setMallName', `${res.result.companyList[0].malInfoList[0].mallName}`)
|
|
} else {
|
|
if (!this.$store.state.mallId) {
|
|
this.$store.commit('setMallId', `${res.result.companyList[0].malInfoList[0].mallId}`)
|
|
this.$store.commit('setMallName', `${res.result.companyList[0].malInfoList[0].mallName}`)
|
|
} else {
|
|
let temp = res.result.companyList[0].malInfoList.filter(item => {
|
|
return item.mallId == this.$store.state.mallId
|
|
})
|
|
if (temp.length == 0) {
|
|
this.$store.commit('setMallId', `${res.result.companyList[0].malInfoList[0].mallId}`)
|
|
this.$store.commit('setMallName', `${res.result.companyList[0].malInfoList[0].mallName}`)
|
|
}
|
|
}
|
|
}
|
|
this.$store.commit('setMallList', res.result.companyList[0].malInfoList)
|
|
} else {
|
|
Message.error("【拼多多】" + res.error_msg)
|
|
}
|
|
})
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
@import '../assets/css/index.scss';
|
|
</style>
|