@gonsin/gview 1.0.1-alpha.0
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.
- package/.browserslistrc +2 -0
- package/README.md +26 -0
- package/babel.config.js +5 -0
- package/package.json +29 -0
- package/postcss.config.js +5 -0
- package/public/css/theme/animate.min.css +7 -0
- package/public/css/theme/brownishTheme.css +10 -0
- package/public/css/theme/coffeeTheme.css +10 -0
- package/public/css/theme/cyanTheme.css +10 -0
- package/public/css/theme/defaultTheme.css +10 -0
- package/public/css/theme/greenTheme.css +16 -0
- package/public/css/theme/greyTheme.css +10 -0
- package/public/css/theme/orangeTheme.css +10 -0
- package/public/css/theme/purpleTheme.css +10 -0
- package/public/css/theme/skyblueTheme.css +10 -0
- package/public/favicon.ico +0 -0
- package/public/imgs/antOutline-border.png +0 -0
- package/public/imgs/bg.png +0 -0
- package/public/imgs/logo.png +0 -0
- package/public/imgs/menu.png +0 -0
- package/public/index.html +17 -0
- package/src/App.vue +143 -0
- package/src/api/api.js +28 -0
- package/src/api/index.js +31 -0
- package/src/api/request.js +210 -0
- package/src/assets/font/font.scss +12 -0
- package/src/assets/font/font_dev.scss +12 -0
- package/src/assets/font/icon.scss +179 -0
- package/src/assets/images/svg/color.svg +1 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/scss/common.scss +338 -0
- package/src/assets/scss/themeColor.scss +35 -0
- package/src/components/MyDialog.vue +251 -0
- package/src/components/MyForm.vue +324 -0
- package/src/components/MyFormAutocomplete.vue +135 -0
- package/src/components/MyFormCascader.vue +107 -0
- package/src/components/MyFormCheckBox.vue +67 -0
- package/src/components/MyFormEditor.vue +85 -0
- package/src/components/MyFormInput.vue +68 -0
- package/src/components/MyFormLine.vue +49 -0
- package/src/components/MyFormRadio.vue +92 -0
- package/src/components/MyFormSelect.vue +122 -0
- package/src/components/MyFormSelectDate.vue +72 -0
- package/src/components/MyFormSelectDateTime.vue +82 -0
- package/src/components/MyFormSelectTime.vue +84 -0
- package/src/components/MyFormSwitch.vue +60 -0
- package/src/components/MyFormTag.vue +67 -0
- package/src/components/MyFormTree.vue +137 -0
- package/src/components/MyFormUploads.vue +91 -0
- package/src/components/MyHeader.vue +176 -0
- package/src/components/MyMenus.vue +150 -0
- package/src/components/MyPageHeader.vue +344 -0
- package/src/components/MyTab.vue +69 -0
- package/src/components/MyTable.vue +245 -0
- package/src/components/Templatess.vue +630 -0
- package/src/index.js +23 -0
- package/src/main.js +86 -0
- package/src/router.js +52 -0
- package/src/store/index.js +71 -0
- package/src/utils/common.js +96 -0
- package/src/utils/permission.js +36 -0
- package/src/views/GView.vue +185 -0
- package/src/views/Home.vue +26 -0
- package/src/views/Login.vue +249 -0
- package/src/websocket/test.js +140 -0
- package/src/websocket/websocket.js +141 -0
- package/src/websocket/websocket1.js +117 -0
- package/src/websocket/websocket2.js +128 -0
- package/vue.config.js +42 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: lzx lzx@gonsin.cn
|
|
3
|
+
* @Date: 2022-06-27 13:55:43
|
|
4
|
+
* @LastEditors: lzx lzx@gonsin.cn
|
|
5
|
+
* @LastEditTime: 2022-06-28 14:03:34
|
|
6
|
+
* @FilePath: \client\src\websocket\websocket.js
|
|
7
|
+
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
+
*/
|
|
9
|
+
import { mapActions } from "vuex";
|
|
10
|
+
|
|
11
|
+
export const data = {
|
|
12
|
+
//websocket
|
|
13
|
+
ip: process.env.NODE_ENV !== 'development' ? window.location.origin.replace(window.location.protocol, pre) + '/gview/websocket' : "http://192.168.2.192:8089/gview/websocket".replace('http', 'ws'),
|
|
14
|
+
webSocket: null,
|
|
15
|
+
lockReconnect: false,
|
|
16
|
+
tt: false,
|
|
17
|
+
sendParams: {
|
|
18
|
+
head: "gonsin",
|
|
19
|
+
cmd: {
|
|
20
|
+
cmd: "client",
|
|
21
|
+
subcmd: "heart",
|
|
22
|
+
respone: 0,
|
|
23
|
+
},
|
|
24
|
+
args: {},
|
|
25
|
+
},
|
|
26
|
+
// 心跳发送指令,超过40s未发送则断开连接
|
|
27
|
+
//心跳检测
|
|
28
|
+
heartCheck: null,
|
|
29
|
+
timeoutObj: null,
|
|
30
|
+
serverTimeoutObj: null,
|
|
31
|
+
}
|
|
32
|
+
export const initWebSocket =()=> {
|
|
33
|
+
try {
|
|
34
|
+
if (typeof WebSocket === "undefined") {
|
|
35
|
+
alert("您的浏览器不支持WebSocket,请尽快升级");
|
|
36
|
+
} else {
|
|
37
|
+
console.log(data.ip)
|
|
38
|
+
data.webSocket = new WebSocket(data.ip);
|
|
39
|
+
init(); // 封装有websocket监听方法
|
|
40
|
+
}
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.log(error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export const init =()=> {
|
|
46
|
+
|
|
47
|
+
data.webSocket.onopen = () => {
|
|
48
|
+
// this.$notify.success('Websocket successfully connected')
|
|
49
|
+
console.log("webSocket连接成功至:" + data.ip);
|
|
50
|
+
clearInterval(data.timeoutObj);
|
|
51
|
+
clearTimeout(data.serverTimeoutObj);
|
|
52
|
+
let model = {
|
|
53
|
+
head: "gonsin",
|
|
54
|
+
cmd: {
|
|
55
|
+
cmd: "client",
|
|
56
|
+
subcmd: "heart",
|
|
57
|
+
respone: 0,
|
|
58
|
+
},
|
|
59
|
+
args: {},
|
|
60
|
+
};
|
|
61
|
+
data.timeoutObj = setInterval(function () {
|
|
62
|
+
//这里发送一个心跳,后端收到后,返回一个心跳消息,
|
|
63
|
+
//onmessage拿到返回的心跳就说明连接正常
|
|
64
|
+
data.webSocket.send(JSON.stringify(model));
|
|
65
|
+
}, 40000);
|
|
66
|
+
// // 连接成功,注册dataId
|
|
67
|
+
// that.registerMessage();
|
|
68
|
+
};
|
|
69
|
+
data.webSocket.onmessage = (msg) => {
|
|
70
|
+
console.log("onmessage....................");
|
|
71
|
+
// console.log('on_message:',msg);
|
|
72
|
+
let data = JSON.parse(msg.data);
|
|
73
|
+
|
|
74
|
+
};
|
|
75
|
+
data.webSocket.onerror = () => {
|
|
76
|
+
console.log("websocket连接错误...");
|
|
77
|
+
};
|
|
78
|
+
data.webSocket.onclose = () => {
|
|
79
|
+
console.log("websocket断开连接...");
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 注册站内信指令
|
|
84
|
+
*/
|
|
85
|
+
export const registerMessage=(dataId, fun)=> {
|
|
86
|
+
console.log(this.$store)
|
|
87
|
+
let params = {
|
|
88
|
+
head: "gonsin",
|
|
89
|
+
cmd: {
|
|
90
|
+
cmd: "gview_client",
|
|
91
|
+
subcmd: "register",
|
|
92
|
+
},
|
|
93
|
+
args: {
|
|
94
|
+
dataId: dataId,
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
// data.webSocket.send(JSON.stringify(params));
|
|
98
|
+
// this.$store.dispatch('setUpdateFunction', dataId,fun);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* 注销站内信指令
|
|
102
|
+
*/
|
|
103
|
+
export const unregisterMessage =(dataId)=> {
|
|
104
|
+
let params = {
|
|
105
|
+
head: "gonsin",
|
|
106
|
+
cmd: {
|
|
107
|
+
cmd: "gview_client",
|
|
108
|
+
subcmd: "unregister",
|
|
109
|
+
},
|
|
110
|
+
args: {
|
|
111
|
+
dataId: dataId,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
data.webSocket.send(JSON.stringify(params));
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 处理站内消息回调
|
|
118
|
+
*/
|
|
119
|
+
export const handleMessageCallback =(data)=> {
|
|
120
|
+
console.log(data);
|
|
121
|
+
console.log("处理站内消息................");
|
|
122
|
+
this.$notify({
|
|
123
|
+
title: data.args.message,
|
|
124
|
+
message: data.args.message,
|
|
125
|
+
type: "success",
|
|
126
|
+
offset: 100,
|
|
127
|
+
});
|
|
128
|
+
}
|
package/vue.config.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: your name
|
|
3
|
+
* @Date: 2020-06-30 18:26:00
|
|
4
|
+
* @LastEditTime: 2022-11-28 14:30:14
|
|
5
|
+
* @LastEditors: lrm lrm@gonsin.cn
|
|
6
|
+
* @Description: In User Settings Edit
|
|
7
|
+
* @FilePath: \client\vue.config.js
|
|
8
|
+
*/
|
|
9
|
+
module.exports = {
|
|
10
|
+
lintOnSave: false,
|
|
11
|
+
// assetsDir: 'static', // 配置js、css静态资源二级目录的位置
|
|
12
|
+
// publicPath:'./',
|
|
13
|
+
productionSourceMap: false, // 生产环境不生成.map文件
|
|
14
|
+
devServer:{
|
|
15
|
+
port:8085, //端口
|
|
16
|
+
// open:false, //编译完成后是否自动打开浏览器
|
|
17
|
+
proxy:{ // 本地环境代理
|
|
18
|
+
'/api':{
|
|
19
|
+
target:'http://192.168.2.192:8088',
|
|
20
|
+
// target:'http://192.168.2.153:8088',
|
|
21
|
+
// target:'http://192.168.2.194:8888',
|
|
22
|
+
// target:'http://192.168.2.162:8088'
|
|
23
|
+
changeOrigin:true,
|
|
24
|
+
disableHostCheck: false, // 新增该配置项
|
|
25
|
+
// pathRewrite:{
|
|
26
|
+
// '/api':''
|
|
27
|
+
// }
|
|
28
|
+
},
|
|
29
|
+
'/restapi':{
|
|
30
|
+
target:'http://192.168.2.192:8088',
|
|
31
|
+
// target:'http://192.168.2.153:8088',
|
|
32
|
+
// target:'http://192.168.2.194:8888',
|
|
33
|
+
// target:'http://192.168.2.162:8088',
|
|
34
|
+
changeOrigin:true,
|
|
35
|
+
disableHostCheck: false, // 新增该配置项
|
|
36
|
+
// pathRewrite:{
|
|
37
|
+
// '/api':''
|
|
38
|
+
// }
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
}
|