获取main-entry用来获取anti_content
This commit is contained in:
@@ -5,52 +5,57 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { sendChromeAPIMessage } from '@/api/chromeApi'
|
||||
import { Message } from 'element-ui'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
component: 'Home'
|
||||
}
|
||||
},
|
||||
import {sendChromeAPIMessage} from '@/api/chromeApi'
|
||||
import {Message} from 'element-ui'
|
||||
|
||||
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) {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
component: 'Home'
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
if (!this.$store.state.token) {
|
||||
this.$router.push('/login')
|
||||
} else {
|
||||
this.$store.dispatch('getUserInfo');
|
||||
this.getMainEntry()
|
||||
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 {
|
||||
if (!this.$store.state.mallId) {
|
||||
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}`)
|
||||
} 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
this.$store.commit('setMallList', res.result.companyList[0].malInfoList)
|
||||
} else {
|
||||
Message.error("【拼多多】" + res.error_msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
methods: {
|
||||
async getMainEntry() {
|
||||
chrome.runtime.sendMessage({type: "init", url: this.$base + "main-entry"})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@import '../assets/css/index.scss';
|
||||
@import '../assets/css/index.scss';
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user