define([ 'text!./index.html', "kefu-assets/api/kefu", 'css!./index.css' ], function (template, kefuApi) { return { name: "base-header", template, props: { kefuInfo: { type: Object, default: function () { return {} } }, online: { type: Boolean, default: true } }, data() { return { menuList: [ { key: 0, title: '客户信息', }, { key: 1, title: '交易订单', }, // { // key: 2, // title: '商品信息', // }, ], curIndex: 0, isOnline: false } }, mounted() { document.addEventListener('click', () => { this.isOnline = false }) }, methods: { selectTab(item) { this.curIndex = item.key; this.bus.$emit('selectRightMenu', this.curIndex) }, setOnline() { this.isOnline = !this.isOnline }, changeOnline(type) { this.$emit('set-online', type); this.isOnline = false; }, // 退出登录 outLogin() { this.$Modal.confirm({ title: '退出登录确认', content: '您确定退出登录当前账户吗?', onOk: () => { kefuApi.logout() .then(res => { this.$Message.success(res.msg); setTimeout(() => { window.location.href = "/kefu/dashboard/login"; }, 500); }) .catch(err => { this.$Message.error(err.msg); }); }, onCancel: () => { } }); }, // 搜索 bindSearch(e) { this.$emit('search', e.target.value); }, // inputChange inputChange(e) { this.bus.$emit('change', e.target.value) } } }; });