@kotori-bot/kotori-plugin-webui 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,763 @@
1
- "use strict";(self["webpackChunkkams"]=self["webpackChunkkams"]||[]).push([[60],{1349:function(t,e,n){n.d(e,{A:function(){return c}});var i=function(){var t=this,e=t._self._c;return e("aside",{ref:"aside",staticClass:"k-sb-aside k-aside"},[e("div",{staticClass:"k-aside-default"},[t._t("default")],2),e("div",{staticClass:"k-aside-inner"},[t._t("inner")],2)])},s=[],o={name:"k-sb-aside"},r=o,a=n(1656),l=(0,a.A)(r,i,s,!1,null,null,null),c=l.exports},4844:function(t,e,n){n.d(e,{A:function(){return u}});var i=function(){var t=this,e=t._self._c;return e("ul",{staticClass:"k-menu",style:{flexDirection:this.mode}},[t._t("default")],2)},s=[],o=(n(4114),n(6848)),r={name:"k-menu",data(){return{activeIndex:this.defaultActive}},provide(){return{root:this}},props:{activeColor:{type:String},activeShape:{type:Array,default(){return[]}},backgroundColor:{type:String},textColor:{},mode:{type:String,default(){return"column"}},defaultActive:{type:String},router:{type:Boolean}},methods:{changeRouteFn(t){this.router&&this.$router.push(t),this.activeIndex=t}},computed:{rootMenu(){return{activeColor:this.activeColor,backgroundColor:this.backgroundColor,activeIndex:this.defaultActive}}},watch:{defaultActive(t){this.activeIndex=t}},beforeCreate(){this.$bus=new o["default"]},mounted(){this.$bus.$on("changeRoute",this.changeRouteFn)},beforeDestroy(){this.$bus.$off("changeRoute",this.changeRouteFn)}},a=r,l=n(1656),c=(0,l.A)(a,i,s,!1,null,"8321ac56",null),u=c.exports},2222:function(t,e,n){n.d(e,{A:function(){return c}});var i=function(){var t=this,e=t._self._c;return e("el-tooltip",{ref:"tooltip",staticClass:"item",attrs:{disabled:!t.tips,effect:"dark",content:t.title,placement:"right",manual:""}},[e("li",{staticClass:"k-menu-item",class:[{className:t.className},{active:t.active},t.direction],style:[t.itemStyle,{height:`${t.height}px`,minHeight:`${t.height}px`},{justifyContent:t.align}],on:{mouseenter:t.onmouseenterFn,mouseleave:t.onMouseLeaveFn,click:t.handleClickFn}},[t.activeShape.includes("line")?[e("transition",{attrs:{appear:"",name:"appear"}},[e("div",{directives:[{name:"show",rawName:"v-show",value:t.active,expression:"active"}],staticClass:"current-shape line",style:{background:t.root.activeColor}})])]:t._e(),t.activeShape.includes("circle")?[e("transition",{attrs:{appear:""}},[e("div",{directives:[{name:"show",rawName:"v-show",value:t.active,expression:"active"}],staticClass:"current-shape circle",style:t.circleStyle})])]:t._e(),t._t("default")],2)])},s=[],o={name:"k-menu-item",data(){return{activeColor:this.root.activeColor}},inject:["root"],methods:{onmouseenterFn(){this.$el.style.backgroundColor=this.root.backgroundColor,this.handleTooltipFn(!0)},onMouseLeaveFn(){this.activeShape.includes("background")&&this.active||(this.$el.style.backgroundColor="",this.handleTooltipFn(!1))},handleClickFn(){this.root.$bus.$emit("changeRoute",this.index),this.$emit("click",this),this.root.$emit("select",this)},handleTooltipFn(t){this.$refs.tooltip.showPopper=t}},computed:{active(){if(!this.root.router)return this.root.activeIndex===this.index;const t=this.root.activeIndex.split("/"),e=this.index.split("/");return t.includes(e[1])},itemStyle(){const t={color:this.active?this.root.activeColor:this.root.textColor,borderLeftColor:this.active?this.root.activeColor:this.root.textColor,backgroundColor:""};return this.activeShape.includes("background")&&(t.backgroundColor=this.active?this.root.backgroundColor:""),t},circleStyle(){return{border:`3px solid ${this.root.activeColor}`,filter:`drop-shadow(0 0 4px ${this.root.activeColor})`}},activeShape(){return this.root.activeShape},tips(){return!!this.title},direction(){return`k-menu-item-${this.root.mode}`}},beforeMount(){},mounted(){},props:{icon:{type:String,default(){return""}},index:{type:String},title:{type:String},width:{type:String,default(){return"70"}},height:{type:String,default(){return"70"}},className:{type:String,default(){return""}},align:{type:String,default(){return"center"}}}},r=o,a=n(1656),l=(0,a.A)(r,i,s,!1,null,"dbebb810",null),c=l.exports},9060:function(t,e,n){n.r(e),n.d(e,{default:function(){return M}});var i=function(){var t=this,e=t._self._c;return e("el-container",{directives:[{name:"resize-ob",rawName:"v-resize-ob",value:t.resizeFn,expression:"resizeFn"}],staticClass:"main-container"},[e("k-aside"),e("el-container",{staticClass:"kams-main-container",attrs:{direction:"vertical"}},[e("k-header"),e("el-main",{class:{isPadding:t.isPadding,lessPadding:t.getIsNarrowScreen}},[e("transition",{attrs:{name:"pps",mode:"out-in"}},[e("keep-alive",{attrs:{include:"kConsole"}},[e("router-view")],1)],1)],1),t.isFooter?e("k-footer"):t._e()],1)],1)},s=[],o=(n(4114),n(3518)),r=function(){var t=this,e=t._self._c;return e("transition",[e("el-aside",{directives:[{name:"show",rawName:"v-show",value:!t.$store.state.layoutOption.isFoldAside,expression:"!$store.state.layoutOption.isFoldAside"}],staticClass:"k-aside"},[e("div",{staticClass:"logo"},[e("img",{attrs:{src:n(3086),alt:""}})]),e("k-menu",{attrs:{"default-active":t.$route.path,"active-color":"#752bec","active-shape":["line"],"text-color":"#061e26","background-color":"#00000017",mode:"column",tips:!0,router:""}},t._l(t.menus,(function(t,n){return e("k-menu-item",{key:n,attrs:{index:t.indexPath,title:t.content,width:"60",height:"60"}},[e("i",{class:t.icon})])})),1),e("div",{staticClass:"empty"}),e("el-tooltip",{attrs:{effect:"dark",content:"退出登录",placement:"right"}},[e("div",{staticClass:"quit"},[e("i",{staticClass:"el-icon-switch-button",attrs:{slot:"reference"},on:{click:t.quitFn},slot:"reference"})])])],1)],1)},a=[],l=n(1552),c=n(1349),u=n(2222),d=n(4844),h={name:"k-aside",components:{kMenuItem:u.A,kMenu:d.A,kAside:c.A},data(){return{visible:!1,isShowDialog:!1,dialogData:{title:"提示",message:"确认退出登录?"},menus:[{icon:"el-icon-pie-chart",content:"数据中心",indexPath:"/dataCenter"},{icon:"el-icon-printer",content:"实例管理",indexPath:"/bots"},{icon:"el-icon-files",content:"模块管理",indexPath:"/modules"},{icon:"el-icon-shopping-bag-1",content:"模块中心",indexPath:"/modulesCenter"},{icon:"el-icon-set-up",content:"指令管理",indexPath:"/command"},{icon:"el-icon-setting",content:"配置查看",indexPath:"/config"},{icon:"el-icon-chat-line-square",content:"沙盒测试",indexPath:"/sandBox"},{icon:"el-icon-cpu",content:"控制台",indexPath:"/console"}]}},methods:{...(0,o.PY)("layoutOption",["updateToken"]),cancelFn(){this.isShowDialog=!1},quitFn(){this.$dialog({content:this.dialogData.message,title:this.dialogData.title}).then((()=>{(0,l.jd)()})).then((()=>{this.updateToken(""),this.$router.push("/login")})).catch((()=>{this.cancelFn()}))}},mounted(){}},p=h,m=n(1656),v=(0,m.A)(p,r,a,!1,null,"20b675e9",null),f=v.exports,g=function(){var t=this,e=t._self._c;return e("el-footer",{attrs:{height:"30px"}},[e("pps-context-menu",{attrs:{menus:t.menus,position:"top"}},[e("div",{staticClass:"version detail",attrs:{slot:"content"},slot:"content"},[e("div",{staticClass:"kotori"},["dev"===t.status?.mode?e("strong",{staticStyle:{padding:"1px","border-radius":"3px",border:"1px solid #ff9955",color:"#fff","background-color":"#ff9955"}},[t._v("Dev")]):t._e(),t._v(" kams v"+t._s(t.version)),t.screenWidth>440?e("span",[t._v(" kotori v"+t._s(t.status?.main))]):t._e(),t.screenWidth>570?e("span",[t._v(" loader v"+t._s(t.status?.loader))]):t._e()])])]),e("pps-context-menu",{attrs:{menus:[{label:"内存",rate:t.roundedRam.rate},{label:"CPU",rate:t.roundedCpu.rate}],position:"top"},scopedSlots:t._u([{key:"item",fn:function({menu:n}){return t._l(n,(function(n,i){return e("div",{key:i,staticClass:"menu-item"},[e("div",{staticClass:"rate"},[e("span",[t._v(t._s(n.label))]),e("el-progress",{attrs:{percentage:Number(n.rate)}})],1)])}))}}])},[e("div",{staticClass:"status detail",attrs:{slot:"content"},slot:"content"},[e("span",[t._v("内存:"+t._s(t.fixedFn(t.roundedRam.rate))+" %")]),t._v("   "),e("span",[t._v("CPU:"+t._s(t.fixedFn(t.roundedCpu.rate))+" %")])])])],1)},k=[],b={rE:"1.5.1"},C={name:"k-footer",data(){return{status:"",version:b.rE,screenWidth:window.innerWidth}},methods:{...(0,o.PY)("webSocketOption",["updateCpu","updateRam"]),contextMenuFn(){},fixedFn(t){return Number(t).toFixed(1)}},computed:{...(0,o.L8)("webSocketOption",["roundedRam","roundedCpu"]),menus(){return[{label:`主程序版本: v${this.status.main}`},{label:`核心版本: v${this.status.core}`},{label:`加载器版本: v${this.status.loader}`}]}},created(){(0,l.P8)().then((({data:t})=>{this.status=t}))},mounted(){this.$ws.bus.$on("wsMessage",(t=>{"stats"===t.type&&(this.updateCpu(t.data.cpu),this.updateRam(t.data.ram))}))},beforeDestroy(){this.$ws.bus.$off("wsMessage")}},F=C,x=(0,m.A)(F,g,k,!1,null,"fc9fc340",null),y=x.exports,w=function(){var t=this,e=t._self._c;return e("el-header",[e("span",{staticClass:"header-left"},[e("pps-button",{nativeOn:{click:function(e){return t.onFold()}}},[e("i",{class:t.arrowClass})]),e("pps-button",{on:{click:function(e){return t.toggleFullscreen()}}},[e("i",{staticClass:"el-icon-full-screen"})])],1),e("span",{staticClass:"title header-center"},[t._v(t._s(t.pathTitle))]),e("span",{staticClass:"header-right"},[e("pps-icon",{attrs:{icon:"pps-icon-github"},on:{click:t.linkGithubFn}}),e("pps-icon",{attrs:{icon:"pps-icon-qq"},on:{click:t.linkQQFn}}),e("pps-icon",{attrs:{icon:"pps-icon-help"},on:{click:t.linkDocsFn}})],1)])},$=[],_=n(9529),S={name:"kHeader",methods:{onFold(){this.$store.commit("layoutOption/updateIsFoldAside",!this.$store.state.layoutOption.isFoldAside)},clearvuexFn(){localStorage.removeItem("vuex")},linkGithubFn(){window.open("https://github.com/kotorijs","_blank")},linkQQFn(){window.open("https://qm.qq.com/q/Nb3lQPt7We","_blank")},linkDocsFn(){window.open("https://kotori.js.org/","_blank")}},computed:{...(0,o.L8)("layoutOption",["getIsFoldAside"]),pathTitle(){return this.$route.matched[1].meta.title},isPadding(){return"/console"===this.$route.path},arrowClass(){return this.getIsFoldAside?"el-icon-d-arrow-right":"el-icon-d-arrow-left"}},mixins:[_.U]},A=S,P=(0,m.A)(A,w,$,!1,null,null,null),I=P.exports;const q=["/console","/sandBox"];var R={name:"myLayout",components:{kAside:f,kFooter:y,kHeader:I},data(){return{}},methods:{...(0,o.i0)("modulesDetail",{getModules:"getData"}),...(0,o.i0)("command",["getCommands"]),handleAside(){q.includes(this.$route.path)||this.isSmall?this.$store.commit("layoutOption/updateIsFoldAside",!0):this.$store.commit("layoutOption/updateIsFoldAside",!1)},resizeFn(t,e){Math.floor(t)<=528?this.$store.commit("layoutOption/updateIsNarrowScreen",!0):this.$store.commit("layoutOption/updateIsNarrowScreen")},async isVersionLatest(){return new Promise(((t,e)=>{(0,l.nI)().then((({data:n})=>{const i=n["@kotori-bot/kotori-plugin-webui"].slice(1).split(".").join(""),s=b.rE.split(".").join("");s<i?(this.$message.error("当前版本过低,请更新webui插件"),this.$route.path.includes("/login")||(this.$store.commit("layoutOption/updateToken"),this.$router.push("/login")),e(new Error("版本过低"))):t()}))}))}},mounted(){},created(){this.getCommands(),this.getModules(),this.isVersionLatest().then((()=>{this.handleAside(),this.$ws.init()})).catch((()=>{}))},beforeDestroy(){console.log("layout beforeDestroy"),this.$ws.instance&&this.$ws.close()},updated(){this.isVersionLatest().then((()=>{this.handleAside()})).catch((()=>{}))},computed:{...(0,o.L8)("layoutOption",["getIsFoldAside","getIsNarrowScreen"]),isPadding(){return!!q.includes(this.$route.path)},isFooter(){return!q[0].includes(this.$route.path)}}},O=R,D=(0,m.A)(O,i,s,!1,null,"9f713dae",null),M=D.exports},9529:function(t,e,n){n.d(e,{B:function(){return s},U:function(){return i}});const i={methods:{toggleFullscreen(){this.isFullscreen()?this.exit():this.enter(document.documentElement)},isFullscreen(){return!!document.fullscreenElement||!!document.webkitFullscreenElement||!!document.mozFullScreenElement||!!document.msFullscreenElement||null},enter(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen&&t.msRequestFullscreen()},exit(){document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()}}},s={props:{chatTarget:{type:Object,default(){return null}},memberList:{type:Array,default(){return[]}}},methods:{tranRoleFn(t){const e={lord:"群主",admin:"管理员","super-admin":"bot",expellee:"已退群"};return e[t]||""},avatarContextMenuFn(t){const{uid:e,task:n,key:i}=t;if(n){const t=this.admin.getUserById(e);this.$emit("handleMenuAction",{targetUser:t,actionType:i,groupId:this.chatTarget.id})}}}}},3086:function(t,e,n){t.exports=n.p+"img/favicon.b107f5c1.svg"}}]);
2
- //# sourceMappingURL=60.2ef17362.js.map
1
+ 'use strict'
2
+ ;(self['webpackChunkkams'] = self['webpackChunkkams'] || []).push([
3
+ [60],
4
+ {
5
+ 1349: function (t, e, n) {
6
+ n.d(e, {
7
+ A: function () {
8
+ return c
9
+ }
10
+ })
11
+ var i = function () {
12
+ var t = this,
13
+ e = t._self._c
14
+ return e('aside', { ref: 'aside', staticClass: 'k-sb-aside k-aside' }, [
15
+ e('div', { staticClass: 'k-aside-default' }, [t._t('default')], 2),
16
+ e('div', { staticClass: 'k-aside-inner' }, [t._t('inner')], 2)
17
+ ])
18
+ },
19
+ s = [],
20
+ o = { name: 'k-sb-aside' },
21
+ r = o,
22
+ a = n(1656),
23
+ l = (0, a.A)(r, i, s, !1, null, null, null),
24
+ c = l.exports
25
+ },
26
+ 4844: function (t, e, n) {
27
+ n.d(e, {
28
+ A: function () {
29
+ return u
30
+ }
31
+ })
32
+ var i = function () {
33
+ var t = this,
34
+ e = t._self._c
35
+ return e('ul', { staticClass: 'k-menu', style: { flexDirection: this.mode } }, [t._t('default')], 2)
36
+ },
37
+ s = [],
38
+ o = (n(4114), n(6848)),
39
+ r = {
40
+ name: 'k-menu',
41
+ data() {
42
+ return { activeIndex: this.defaultActive }
43
+ },
44
+ provide() {
45
+ return { root: this }
46
+ },
47
+ props: {
48
+ activeColor: { type: String },
49
+ activeShape: {
50
+ type: Array,
51
+ default() {
52
+ return []
53
+ }
54
+ },
55
+ backgroundColor: { type: String },
56
+ textColor: {},
57
+ mode: {
58
+ type: String,
59
+ default() {
60
+ return 'column'
61
+ }
62
+ },
63
+ defaultActive: { type: String },
64
+ router: { type: Boolean }
65
+ },
66
+ methods: {
67
+ changeRouteFn(t) {
68
+ this.router && this.$router.push(t), (this.activeIndex = t)
69
+ }
70
+ },
71
+ computed: {
72
+ rootMenu() {
73
+ return {
74
+ activeColor: this.activeColor,
75
+ backgroundColor: this.backgroundColor,
76
+ activeIndex: this.defaultActive
77
+ }
78
+ }
79
+ },
80
+ watch: {
81
+ defaultActive(t) {
82
+ this.activeIndex = t
83
+ }
84
+ },
85
+ beforeCreate() {
86
+ this.$bus = new o['default']()
87
+ },
88
+ mounted() {
89
+ this.$bus.$on('changeRoute', this.changeRouteFn)
90
+ },
91
+ beforeDestroy() {
92
+ this.$bus.$off('changeRoute', this.changeRouteFn)
93
+ }
94
+ },
95
+ a = r,
96
+ l = n(1656),
97
+ c = (0, l.A)(a, i, s, !1, null, '8321ac56', null),
98
+ u = c.exports
99
+ },
100
+ 2222: function (t, e, n) {
101
+ n.d(e, {
102
+ A: function () {
103
+ return c
104
+ }
105
+ })
106
+ var i = function () {
107
+ var t = this,
108
+ e = t._self._c
109
+ return e(
110
+ 'el-tooltip',
111
+ {
112
+ ref: 'tooltip',
113
+ staticClass: 'item',
114
+ attrs: { disabled: !t.tips, effect: 'dark', content: t.title, placement: 'right', manual: '' }
115
+ },
116
+ [
117
+ e(
118
+ 'li',
119
+ {
120
+ staticClass: 'k-menu-item',
121
+ class: [{ className: t.className }, { active: t.active }, t.direction],
122
+ style: [
123
+ t.itemStyle,
124
+ { height: `${t.height}px`, minHeight: `${t.height}px` },
125
+ { justifyContent: t.align }
126
+ ],
127
+ on: { mouseenter: t.onmouseenterFn, mouseleave: t.onMouseLeaveFn, click: t.handleClickFn }
128
+ },
129
+ [
130
+ t.activeShape.includes('line')
131
+ ? [
132
+ e('transition', { attrs: { appear: '', name: 'appear' } }, [
133
+ e('div', {
134
+ directives: [{ name: 'show', rawName: 'v-show', value: t.active, expression: 'active' }],
135
+ staticClass: 'current-shape line',
136
+ style: { background: t.root.activeColor }
137
+ })
138
+ ])
139
+ ]
140
+ : t._e(),
141
+ t.activeShape.includes('circle')
142
+ ? [
143
+ e('transition', { attrs: { appear: '' } }, [
144
+ e('div', {
145
+ directives: [{ name: 'show', rawName: 'v-show', value: t.active, expression: 'active' }],
146
+ staticClass: 'current-shape circle',
147
+ style: t.circleStyle
148
+ })
149
+ ])
150
+ ]
151
+ : t._e(),
152
+ t._t('default')
153
+ ],
154
+ 2
155
+ )
156
+ ]
157
+ )
158
+ },
159
+ s = [],
160
+ o = {
161
+ name: 'k-menu-item',
162
+ data() {
163
+ return { activeColor: this.root.activeColor }
164
+ },
165
+ inject: ['root'],
166
+ methods: {
167
+ onmouseenterFn() {
168
+ ;(this.$el.style.backgroundColor = this.root.backgroundColor), this.handleTooltipFn(!0)
169
+ },
170
+ onMouseLeaveFn() {
171
+ ;(this.activeShape.includes('background') && this.active) ||
172
+ ((this.$el.style.backgroundColor = ''), this.handleTooltipFn(!1))
173
+ },
174
+ handleClickFn() {
175
+ this.root.$bus.$emit('changeRoute', this.index),
176
+ this.$emit('click', this),
177
+ this.root.$emit('select', this)
178
+ },
179
+ handleTooltipFn(t) {
180
+ this.$refs.tooltip.showPopper = t
181
+ }
182
+ },
183
+ computed: {
184
+ active() {
185
+ if (!this.root.router) return this.root.activeIndex === this.index
186
+ const t = this.root.activeIndex.split('/'),
187
+ e = this.index.split('/')
188
+ return t.includes(e[1])
189
+ },
190
+ itemStyle() {
191
+ const t = {
192
+ color: this.active ? this.root.activeColor : this.root.textColor,
193
+ borderLeftColor: this.active ? this.root.activeColor : this.root.textColor,
194
+ backgroundColor: ''
195
+ }
196
+ return (
197
+ this.activeShape.includes('background') &&
198
+ (t.backgroundColor = this.active ? this.root.backgroundColor : ''),
199
+ t
200
+ )
201
+ },
202
+ circleStyle() {
203
+ return {
204
+ border: `3px solid ${this.root.activeColor}`,
205
+ filter: `drop-shadow(0 0 4px ${this.root.activeColor})`
206
+ }
207
+ },
208
+ activeShape() {
209
+ return this.root.activeShape
210
+ },
211
+ tips() {
212
+ return !!this.title
213
+ },
214
+ direction() {
215
+ return `k-menu-item-${this.root.mode}`
216
+ }
217
+ },
218
+ beforeMount() {},
219
+ mounted() {},
220
+ props: {
221
+ icon: {
222
+ type: String,
223
+ default() {
224
+ return ''
225
+ }
226
+ },
227
+ index: { type: String },
228
+ title: { type: String },
229
+ width: {
230
+ type: String,
231
+ default() {
232
+ return '70'
233
+ }
234
+ },
235
+ height: {
236
+ type: String,
237
+ default() {
238
+ return '70'
239
+ }
240
+ },
241
+ className: {
242
+ type: String,
243
+ default() {
244
+ return ''
245
+ }
246
+ },
247
+ align: {
248
+ type: String,
249
+ default() {
250
+ return 'center'
251
+ }
252
+ }
253
+ }
254
+ },
255
+ r = o,
256
+ a = n(1656),
257
+ l = (0, a.A)(r, i, s, !1, null, 'dbebb810', null),
258
+ c = l.exports
259
+ },
260
+ 9060: function (t, e, n) {
261
+ n.r(e),
262
+ n.d(e, {
263
+ default: function () {
264
+ return M
265
+ }
266
+ })
267
+ var i = function () {
268
+ var t = this,
269
+ e = t._self._c
270
+ return e(
271
+ 'el-container',
272
+ {
273
+ directives: [{ name: 'resize-ob', rawName: 'v-resize-ob', value: t.resizeFn, expression: 'resizeFn' }],
274
+ staticClass: 'main-container'
275
+ },
276
+ [
277
+ e('k-aside'),
278
+ e(
279
+ 'el-container',
280
+ { staticClass: 'kams-main-container', attrs: { direction: 'vertical' } },
281
+ [
282
+ e('k-header'),
283
+ e(
284
+ 'el-main',
285
+ { class: { isPadding: t.isPadding, lessPadding: t.getIsNarrowScreen } },
286
+ [
287
+ e(
288
+ 'transition',
289
+ { attrs: { name: 'pps', mode: 'out-in' } },
290
+ [e('keep-alive', { attrs: { include: 'kConsole' } }, [e('router-view')], 1)],
291
+ 1
292
+ )
293
+ ],
294
+ 1
295
+ ),
296
+ t.isFooter ? e('k-footer') : t._e()
297
+ ],
298
+ 1
299
+ )
300
+ ],
301
+ 1
302
+ )
303
+ },
304
+ s = [],
305
+ o = (n(4114), n(3518)),
306
+ r = function () {
307
+ var t = this,
308
+ e = t._self._c
309
+ return e(
310
+ 'transition',
311
+ [
312
+ e(
313
+ 'el-aside',
314
+ {
315
+ directives: [
316
+ {
317
+ name: 'show',
318
+ rawName: 'v-show',
319
+ value: !t.$store.state.layoutOption.isFoldAside,
320
+ expression: '!$store.state.layoutOption.isFoldAside'
321
+ }
322
+ ],
323
+ staticClass: 'k-aside'
324
+ },
325
+ [
326
+ e('div', { staticClass: 'logo' }, [e('img', { attrs: { src: n(3086), alt: '' } })]),
327
+ e(
328
+ 'k-menu',
329
+ {
330
+ attrs: {
331
+ 'default-active': t.$route.path,
332
+ 'active-color': '#752bec',
333
+ 'active-shape': ['line'],
334
+ 'text-color': '#061e26',
335
+ 'background-color': '#00000017',
336
+ mode: 'column',
337
+ tips: !0,
338
+ router: ''
339
+ }
340
+ },
341
+ t._l(t.menus, function (t, n) {
342
+ return e(
343
+ 'k-menu-item',
344
+ { key: n, attrs: { index: t.indexPath, title: t.content, width: '60', height: '60' } },
345
+ [e('i', { class: t.icon })]
346
+ )
347
+ }),
348
+ 1
349
+ ),
350
+ e('div', { staticClass: 'empty' }),
351
+ e('el-tooltip', { attrs: { effect: 'dark', content: '退出登录', placement: 'right' } }, [
352
+ e('div', { staticClass: 'quit' }, [
353
+ e('i', {
354
+ staticClass: 'el-icon-switch-button',
355
+ attrs: { slot: 'reference' },
356
+ on: { click: t.quitFn },
357
+ slot: 'reference'
358
+ })
359
+ ])
360
+ ])
361
+ ],
362
+ 1
363
+ )
364
+ ],
365
+ 1
366
+ )
367
+ },
368
+ a = [],
369
+ l = n(1552),
370
+ c = n(1349),
371
+ u = n(2222),
372
+ d = n(4844),
373
+ h = {
374
+ name: 'k-aside',
375
+ components: { kMenuItem: u.A, kMenu: d.A, kAside: c.A },
376
+ data() {
377
+ return {
378
+ visible: !1,
379
+ isShowDialog: !1,
380
+ dialogData: { title: '提示', message: '确认退出登录?' },
381
+ menus: [
382
+ { icon: 'el-icon-pie-chart', content: '数据中心', indexPath: '/dataCenter' },
383
+ { icon: 'el-icon-printer', content: '实例管理', indexPath: '/bots' },
384
+ { icon: 'el-icon-files', content: '模块管理', indexPath: '/modules' },
385
+ { icon: 'el-icon-shopping-bag-1', content: '模块中心', indexPath: '/modulesCenter' },
386
+ { icon: 'el-icon-set-up', content: '指令管理', indexPath: '/command' },
387
+ { icon: 'el-icon-setting', content: '配置查看', indexPath: '/config' },
388
+ { icon: 'el-icon-chat-line-square', content: '沙盒测试', indexPath: '/sandBox' },
389
+ { icon: 'el-icon-cpu', content: '控制台', indexPath: '/console' }
390
+ ]
391
+ }
392
+ },
393
+ methods: {
394
+ ...(0, o.PY)('layoutOption', ['updateToken']),
395
+ cancelFn() {
396
+ this.isShowDialog = !1
397
+ },
398
+ quitFn() {
399
+ this.$dialog({ content: this.dialogData.message, title: this.dialogData.title })
400
+ .then(() => {
401
+ ;(0, l.jd)()
402
+ })
403
+ .then(() => {
404
+ this.updateToken(''), this.$router.push('/login')
405
+ })
406
+ .catch(() => {
407
+ this.cancelFn()
408
+ })
409
+ }
410
+ },
411
+ mounted() {}
412
+ },
413
+ p = h,
414
+ m = n(1656),
415
+ v = (0, m.A)(p, r, a, !1, null, '20b675e9', null),
416
+ f = v.exports,
417
+ g = function () {
418
+ var t = this,
419
+ e = t._self._c
420
+ return e(
421
+ 'el-footer',
422
+ { attrs: { height: '30px' } },
423
+ [
424
+ e('pps-context-menu', { attrs: { menus: t.menus, position: 'top' } }, [
425
+ e('div', { staticClass: 'version detail', attrs: { slot: 'content' }, slot: 'content' }, [
426
+ e('div', { staticClass: 'kotori' }, [
427
+ 'dev' === t.status?.mode
428
+ ? e(
429
+ 'strong',
430
+ {
431
+ staticStyle: {
432
+ padding: '1px',
433
+ 'border-radius': '3px',
434
+ border: '1px solid #ff9955',
435
+ color: '#fff',
436
+ 'background-color': '#ff9955'
437
+ }
438
+ },
439
+ [t._v('Dev')]
440
+ )
441
+ : t._e(),
442
+ t._v(' kams v' + t._s(t.version)),
443
+ t.screenWidth > 440 ? e('span', [t._v(' kotori v' + t._s(t.status?.main))]) : t._e(),
444
+ t.screenWidth > 570 ? e('span', [t._v(' loader v' + t._s(t.status?.loader))]) : t._e()
445
+ ])
446
+ ])
447
+ ]),
448
+ e(
449
+ 'pps-context-menu',
450
+ {
451
+ attrs: {
452
+ menus: [
453
+ { label: '内存', rate: t.roundedRam.rate },
454
+ { label: 'CPU', rate: t.roundedCpu.rate }
455
+ ],
456
+ position: 'top'
457
+ },
458
+ scopedSlots: t._u([
459
+ {
460
+ key: 'item',
461
+ fn: function ({ menu: n }) {
462
+ return t._l(n, function (n, i) {
463
+ return e('div', { key: i, staticClass: 'menu-item' }, [
464
+ e(
465
+ 'div',
466
+ { staticClass: 'rate' },
467
+ [
468
+ e('span', [t._v(t._s(n.label))]),
469
+ e('el-progress', { attrs: { percentage: Number(n.rate) } })
470
+ ],
471
+ 1
472
+ )
473
+ ])
474
+ })
475
+ }
476
+ }
477
+ ])
478
+ },
479
+ [
480
+ e('div', { staticClass: 'status detail', attrs: { slot: 'content' }, slot: 'content' }, [
481
+ e('span', [t._v('内存:' + t._s(t.fixedFn(t.roundedRam.rate)) + ' %')]),
482
+ t._v('   '),
483
+ e('span', [t._v('CPU:' + t._s(t.fixedFn(t.roundedCpu.rate)) + ' %')])
484
+ ])
485
+ ]
486
+ )
487
+ ],
488
+ 1
489
+ )
490
+ },
491
+ k = [],
492
+ b = { rE: '1.5.2' },
493
+ C = {
494
+ name: 'k-footer',
495
+ data() {
496
+ return { status: '', version: b.rE, screenWidth: window.innerWidth }
497
+ },
498
+ methods: {
499
+ ...(0, o.PY)('webSocketOption', ['updateCpu', 'updateRam']),
500
+ contextMenuFn() {},
501
+ fixedFn(t) {
502
+ return Number(t).toFixed(1)
503
+ }
504
+ },
505
+ computed: {
506
+ ...(0, o.L8)('webSocketOption', ['roundedRam', 'roundedCpu']),
507
+ menus() {
508
+ return [
509
+ { label: `主程序版本: v${this.status.main}` },
510
+ { label: `核心版本: v${this.status.core}` },
511
+ { label: `加载器版本: v${this.status.loader}` }
512
+ ]
513
+ }
514
+ },
515
+ created() {
516
+ ;(0, l.P8)().then(({ data: t }) => {
517
+ this.status = t
518
+ })
519
+ },
520
+ mounted() {
521
+ this.$ws.bus.$on('wsMessage', (t) => {
522
+ 'stats' === t.type && (this.updateCpu(t.data.cpu), this.updateRam(t.data.ram))
523
+ })
524
+ },
525
+ beforeDestroy() {
526
+ this.$ws.bus.$off('wsMessage')
527
+ }
528
+ },
529
+ F = C,
530
+ x = (0, m.A)(F, g, k, !1, null, 'fc9fc340', null),
531
+ y = x.exports,
532
+ w = function () {
533
+ var t = this,
534
+ e = t._self._c
535
+ return e('el-header', [
536
+ e(
537
+ 'span',
538
+ { staticClass: 'header-left' },
539
+ [
540
+ e(
541
+ 'pps-button',
542
+ {
543
+ nativeOn: {
544
+ click: function (e) {
545
+ return t.onFold()
546
+ }
547
+ }
548
+ },
549
+ [e('i', { class: t.arrowClass })]
550
+ ),
551
+ e(
552
+ 'pps-button',
553
+ {
554
+ on: {
555
+ click: function (e) {
556
+ return t.toggleFullscreen()
557
+ }
558
+ }
559
+ },
560
+ [e('i', { staticClass: 'el-icon-full-screen' })]
561
+ )
562
+ ],
563
+ 1
564
+ ),
565
+ e('span', { staticClass: 'title header-center' }, [t._v(t._s(t.pathTitle))]),
566
+ e(
567
+ 'span',
568
+ { staticClass: 'header-right' },
569
+ [
570
+ e('pps-icon', { attrs: { icon: 'pps-icon-github' }, on: { click: t.linkGithubFn } }),
571
+ e('pps-icon', { attrs: { icon: 'pps-icon-qq' }, on: { click: t.linkQQFn } }),
572
+ e('pps-icon', { attrs: { icon: 'pps-icon-help' }, on: { click: t.linkDocsFn } })
573
+ ],
574
+ 1
575
+ )
576
+ ])
577
+ },
578
+ $ = [],
579
+ _ = n(9529),
580
+ S = {
581
+ name: 'kHeader',
582
+ methods: {
583
+ onFold() {
584
+ this.$store.commit('layoutOption/updateIsFoldAside', !this.$store.state.layoutOption.isFoldAside)
585
+ },
586
+ clearvuexFn() {
587
+ localStorage.removeItem('vuex')
588
+ },
589
+ linkGithubFn() {
590
+ window.open('https://github.com/kotorijs', '_blank')
591
+ },
592
+ linkQQFn() {
593
+ window.open('https://qm.qq.com/q/Nb3lQPt7We', '_blank')
594
+ },
595
+ linkDocsFn() {
596
+ window.open('https://kotori.js.org/', '_blank')
597
+ }
598
+ },
599
+ computed: {
600
+ ...(0, o.L8)('layoutOption', ['getIsFoldAside']),
601
+ pathTitle() {
602
+ return this.$route.matched[1].meta.title
603
+ },
604
+ isPadding() {
605
+ return '/console' === this.$route.path
606
+ },
607
+ arrowClass() {
608
+ return this.getIsFoldAside ? 'el-icon-d-arrow-right' : 'el-icon-d-arrow-left'
609
+ }
610
+ },
611
+ mixins: [_.U]
612
+ },
613
+ A = S,
614
+ P = (0, m.A)(A, w, $, !1, null, null, null),
615
+ I = P.exports
616
+ const q = ['/console', '/sandBox']
617
+ var R = {
618
+ name: 'myLayout',
619
+ components: { kAside: f, kFooter: y, kHeader: I },
620
+ data() {
621
+ return {}
622
+ },
623
+ methods: {
624
+ ...(0, o.i0)('modulesDetail', { getModules: 'getData' }),
625
+ ...(0, o.i0)('command', ['getCommands']),
626
+ handleAside() {
627
+ q.includes(this.$route.path) || this.isSmall
628
+ ? this.$store.commit('layoutOption/updateIsFoldAside', !0)
629
+ : this.$store.commit('layoutOption/updateIsFoldAside', !1)
630
+ },
631
+ resizeFn(t, e) {
632
+ Math.floor(t) <= 528
633
+ ? this.$store.commit('layoutOption/updateIsNarrowScreen', !0)
634
+ : this.$store.commit('layoutOption/updateIsNarrowScreen')
635
+ },
636
+ async isVersionLatest() {
637
+ return new Promise((t, e) => {
638
+ ;(0, l.nI)().then(({ data: n }) => {
639
+ const i = n['@kotori-bot/kotori-plugin-webui'].slice(1).split('.').join(''),
640
+ s = b.rE.split('.').join('')
641
+ s < i
642
+ ? (this.$message.error('当前版本过低,请更新webui插件'),
643
+ this.$route.path.includes('/login') ||
644
+ (this.$store.commit('layoutOption/updateToken'), this.$router.push('/login')),
645
+ e(new Error('版本过低')))
646
+ : t()
647
+ })
648
+ })
649
+ }
650
+ },
651
+ mounted() {},
652
+ created() {
653
+ this.getCommands(),
654
+ this.getModules(),
655
+ this.isVersionLatest()
656
+ .then(() => {
657
+ this.handleAside(), this.$ws.init()
658
+ })
659
+ .catch(() => {})
660
+ },
661
+ beforeDestroy() {
662
+ console.log('layout beforeDestroy'), this.$ws.instance && this.$ws.close()
663
+ },
664
+ updated() {
665
+ this.isVersionLatest()
666
+ .then(() => {
667
+ this.handleAside()
668
+ })
669
+ .catch(() => {})
670
+ },
671
+ computed: {
672
+ ...(0, o.L8)('layoutOption', ['getIsFoldAside', 'getIsNarrowScreen']),
673
+ isPadding() {
674
+ return !!q.includes(this.$route.path)
675
+ },
676
+ isFooter() {
677
+ return !q[0].includes(this.$route.path)
678
+ }
679
+ }
680
+ },
681
+ O = R,
682
+ D = (0, m.A)(O, i, s, !1, null, '9f713dae', null),
683
+ M = D.exports
684
+ },
685
+ 9529: function (t, e, n) {
686
+ n.d(e, {
687
+ B: function () {
688
+ return s
689
+ },
690
+ U: function () {
691
+ return i
692
+ }
693
+ })
694
+ const i = {
695
+ methods: {
696
+ toggleFullscreen() {
697
+ this.isFullscreen() ? this.exit() : this.enter(document.documentElement)
698
+ },
699
+ isFullscreen() {
700
+ return (
701
+ !!document.fullscreenElement ||
702
+ !!document.webkitFullscreenElement ||
703
+ !!document.mozFullScreenElement ||
704
+ !!document.msFullscreenElement ||
705
+ null
706
+ )
707
+ },
708
+ enter(t) {
709
+ t.requestFullscreen
710
+ ? t.requestFullscreen()
711
+ : t.webkitRequestFullscreen
712
+ ? t.webkitRequestFullscreen()
713
+ : t.mozRequestFullScreen
714
+ ? t.mozRequestFullScreen()
715
+ : t.msRequestFullscreen && t.msRequestFullscreen()
716
+ },
717
+ exit() {
718
+ document.exitFullscreen
719
+ ? document.exitFullscreen()
720
+ : document.webkitExitFullscreen
721
+ ? document.webkitExitFullscreen()
722
+ : document.mozCancelFullScreen
723
+ ? document.mozCancelFullScreen()
724
+ : document.msExitFullscreen && document.msExitFullscreen()
725
+ }
726
+ }
727
+ },
728
+ s = {
729
+ props: {
730
+ chatTarget: {
731
+ type: Object,
732
+ default() {
733
+ return null
734
+ }
735
+ },
736
+ memberList: {
737
+ type: Array,
738
+ default() {
739
+ return []
740
+ }
741
+ }
742
+ },
743
+ methods: {
744
+ tranRoleFn(t) {
745
+ const e = { lord: '群主', admin: '管理员', 'super-admin': 'bot', expellee: '已退群' }
746
+ return e[t] || ''
747
+ },
748
+ avatarContextMenuFn(t) {
749
+ const { uid: e, task: n, key: i } = t
750
+ if (n) {
751
+ const t = this.admin.getUserById(e)
752
+ this.$emit('handleMenuAction', { targetUser: t, actionType: i, groupId: this.chatTarget.id })
753
+ }
754
+ }
755
+ }
756
+ }
757
+ },
758
+ 3086: function (t, e, n) {
759
+ t.exports = n.p + 'img/favicon.b107f5c1.svg'
760
+ }
761
+ }
762
+ ])
763
+ //# sourceMappingURL=60.2ef17362.js.map