@@ -288,15 +349,21 @@ export default {
}
},
computed: {
- ...mapState(['pageTitle']) // 从Vuex映射showSidebar状态到组件的计算属性中
+ ...mapState(['pageTitle','secondMenu']), // 从Vuex映射showSidebar状态到组件的计算属性中
+ menuItem() {
+ return this.$store.state.currentMenuItem;
+ }
},
watch: {
- '$store.state.currentMenuItem'(newVal) {
- this.type = newVal.type
- //查询是否添加了此服务
- this.getServiceInfo()
- this.getServiceAddInfo();
- },
+ '$store.state.currentMenuItem': {
+ handler(newVal) {
+ this.type = newVal.type
+ //查询是否添加了此服务
+ this.getServiceInfo()
+ this.getServiceAddInfo();
+ },
+ deep: true // 添加深度监听
+ }
},
created() {
if (!this.$route.query.uid && !this.$route.query.prodid) {
@@ -305,33 +372,38 @@ export default {
}
this.uid = this.$route.query.uid
this.prodid = this.$route.query.prodid
-
this.loadPddSDK()
},
mounted() {
+ if(this.menuItem){
+ this.type = this.menuItem.type
+ //查询是否添加了此服务
+ this.getServiceInfo()
+ this.getServiceAddInfo();
+ }
store.commit('SET_PAGETITLE', '站点信息');
- this.getAddServiceList();
+ // this.getAddServiceList();
},
methods: {
handleAlert() {
this.alertShow = !this.alertShow
},
//获得左侧菜单导航
- getAddServiceList() {
- const that = this
- that.$http('POST', '/agentnew/ajax_get_service_add_list', {
- uid: that.uid,
- prodid: that.prodid,
- }).then(response => {
- that.$nextTick(() => {
- that.menuList = response.data
- store.commit('SET_SECOND_MENU', response.data);
- that.setMenuList()
- })
- }).catch(error => {
- console.error(error, 'error')
- })
- },
+ // getAddServiceList() {
+ // const that = this
+ // that.$http('POST', '/agentnew/ajax_get_service_add_list', {
+ // uid: that.uid,
+ // prodid: that.prodid,
+ // }).then(response => {
+ // that.$nextTick(() => {
+ // that.menuList = response.data
+ // store.commit('SET_SECOND_MENU', response.data);
+ // that.setMenuList()
+ // })
+ // }).catch(error => {
+ // console.error(error, 'error')
+ // })
+ // },
//获得要添加的服务信息
getServiceAddInfo() {
this.serviceAddInfo = {}
@@ -621,6 +693,45 @@ export default {
}