Merge branch 'master' of http://124.222.105.7:3000/dianliang/dl_site_system
This commit is contained in:
commit
1b42cf8172
@ -111,7 +111,7 @@ public class SecurityConfig
|
||||
.authorizeHttpRequests((requests) -> {
|
||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
requests.antMatchers("/login","/wxLogin", "/register", "/captchaImage","/sys/ueditor/exec").permitAll()
|
||||
requests.antMatchers("/login","/wxLogin", "/register", "/captchaImage","/sys/ueditor/exec","/ws/asset/**").permitAll()
|
||||
//相关配置参数可匿名访问
|
||||
.antMatchers("/base/config/getConfigByCode").permitAll()
|
||||
.antMatchers("/base/category/getByCodeInfo").permitAll()
|
||||
|
@ -9,3 +9,6 @@ VUE_APP_BASE_API = '/dev-api'
|
||||
|
||||
# 路由懒加载
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
# websocket
|
||||
VUE_APP_WEBSOCKET = 'ws://localhost:8099/ws/asset/'
|
||||
|
@ -6,3 +6,6 @@ ENV = 'production'
|
||||
|
||||
# 通告快接管理后台/生产环境
|
||||
VUE_APP_BASE_API = 'https://www.ddtg.site/noticeApi'
|
||||
|
||||
# websocket
|
||||
VUE_APP_WEBSOCKET = 'ws://localhost:8099/ws/asset/'
|
||||
|
@ -10,3 +10,6 @@ ENV = 'staging'
|
||||
|
||||
# 成事达管理平台/测试环境
|
||||
VUE_APP_BASE_API = '/stage-api'
|
||||
|
||||
# websocket
|
||||
VUE_APP_WEBSOCKET = 'ws://localhost:8099/ws/asset/'
|
||||
|
@ -7,10 +7,23 @@
|
||||
|
||||
<script>
|
||||
import ThemePicker from "@/components/ThemePicker";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
export default {
|
||||
name: "App",
|
||||
components: { ThemePicker },
|
||||
data(){
|
||||
return{
|
||||
b:false,
|
||||
}
|
||||
},
|
||||
destroyed: function () { // 离开页面生命周期函数
|
||||
this.$websocket.dispatch('websocket_close');
|
||||
},
|
||||
created () {
|
||||
const username = Cookies.get('username')
|
||||
this.$store.dispatch('websocket_init', process.env.VUE_APP_WEBSOCKET+username)
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
|
||||
|
@ -37,6 +37,7 @@ import DictTag from '@/components/DictTag'
|
||||
import VueMeta from 'vue-meta'
|
||||
// 字典数据组件
|
||||
import DictData from '@/components/DictData'
|
||||
import websocket from "./store/websocket";
|
||||
|
||||
// 全局方法挂载
|
||||
Vue.prototype.getDicts = getDicts
|
||||
|
@ -3,6 +3,7 @@ import Vuex from 'vuex'
|
||||
import app from './modules/app'
|
||||
import dict from './modules/dict'
|
||||
import user from './modules/user'
|
||||
import websocket from './modules/websocket'
|
||||
import tagsView from './modules/tagsView'
|
||||
import permission from './modules/permission'
|
||||
import settings from './modules/settings'
|
||||
@ -15,6 +16,7 @@ const store = new Vuex.Store({
|
||||
app,
|
||||
dict,
|
||||
user,
|
||||
websocket,
|
||||
tagsView,
|
||||
permission,
|
||||
settings
|
||||
|
60
dl_vue/src/store/modules/websocket.js
Normal file
60
dl_vue/src/store/modules/websocket.js
Normal file
@ -0,0 +1,60 @@
|
||||
|
||||
const websocket = {
|
||||
state: {
|
||||
websock:null,
|
||||
message:[],
|
||||
count:"0",
|
||||
notice:[]
|
||||
},
|
||||
|
||||
mutations: {
|
||||
WEBSOCKET_INIT(state,url){
|
||||
console.log(url);
|
||||
state.websock = new WebSocket(url);
|
||||
state.websock.onopen=function () {
|
||||
console.log("WebSocket连接成功");
|
||||
};
|
||||
state.websock.onmessage = function (e) {
|
||||
if (e.data.startsWith("C")) {
|
||||
state.count = e.data;
|
||||
|
||||
}
|
||||
else if (e.data.startsWith("系统通知")){
|
||||
state.notice.push(e.data);
|
||||
console.log(state.notice);
|
||||
}
|
||||
else {
|
||||
state.message.push(JSON.parse(e.data));
|
||||
// console.log(state.message);
|
||||
}
|
||||
|
||||
};
|
||||
state.websock.onerror= function () {
|
||||
console.log("WebSocket连接发生错误");
|
||||
};
|
||||
state.websock.onclose = function (e) {
|
||||
console.log("connection closed (" + e.code + ")");
|
||||
};
|
||||
},
|
||||
WEBSOCKET_SEND(state,msg){
|
||||
state.websock.send(msg);
|
||||
},
|
||||
WEBSOCKET_CLOSE(state){
|
||||
state.websock.close();
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
websocket_init({commit}, url) {
|
||||
commit('WEBSOCKET_INIT', url)
|
||||
},
|
||||
websocket_send({commit}, msg) {
|
||||
commit('WEBSOCKET_SEND', msg)
|
||||
},
|
||||
websocket_close({commit}){
|
||||
commit('WEBSOCKET_CLOSE')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default websocket
|
64
dl_vue/src/store/websocket.js
Normal file
64
dl_vue/src/store/websocket.js
Normal file
@ -0,0 +1,64 @@
|
||||
// import Vue from 'vue'
|
||||
// import Vuex from 'vuex'
|
||||
//
|
||||
// Vue.use(Vuex)
|
||||
//
|
||||
// export default new Vuex.Store({
|
||||
// //定义全局变量
|
||||
// state: {
|
||||
// websock:null,
|
||||
// message:[],
|
||||
// count:"0",
|
||||
// notice:[]
|
||||
// },
|
||||
// //改变state的值必须经过
|
||||
// mutations: {
|
||||
// WEBSOCKET_INIT(state,url){
|
||||
// console.log(url);
|
||||
// state.websock = new WebSocket(url);
|
||||
// state.websock.onopen=function () {
|
||||
// console.log("WebSocket连接成功");
|
||||
// };
|
||||
// state.websock.onmessage = function (e) {
|
||||
// if (e.data.startsWith("C")) {
|
||||
// state.count = e.data;
|
||||
//
|
||||
// }
|
||||
// else if (e.data.startsWith("系统通知")){
|
||||
// state.notice.push(e.data);
|
||||
// console.log(state.notice);
|
||||
// }
|
||||
// else {
|
||||
// state.message.push(JSON.parse(e.data));
|
||||
// // console.log(state.message);
|
||||
// }
|
||||
//
|
||||
// };
|
||||
// state.websock.onerror= function () {
|
||||
// console.log("WebSocket连接发生错误");
|
||||
// };
|
||||
// state.websock.onclose = function (e) {
|
||||
// console.log("connection closed (" + e.code + ")");
|
||||
// };
|
||||
// },
|
||||
// WEBSOCKET_SEND(state,msg){
|
||||
// state.websock.send(msg);
|
||||
// },
|
||||
// WEBSOCKET_CLOSE(state){
|
||||
// state.websock.close();
|
||||
// }
|
||||
// },
|
||||
// actions: {
|
||||
// websocket_init({commit}, url) {
|
||||
// commit('WEBSOCKET_INIT', url)
|
||||
// },
|
||||
// websocket_send({commit}, msg) {
|
||||
// commit('WEBSOCKET_SEND', msg)
|
||||
// },
|
||||
// websocket_close({commit}){
|
||||
// commit('WEBSOCKET_CLOSE')
|
||||
// }
|
||||
// },
|
||||
// modules: {
|
||||
// }
|
||||
// })
|
@ -189,6 +189,7 @@ export default {
|
||||
Cookies.remove('rememberMe')
|
||||
}
|
||||
this.$store.dispatch('Login', this.loginForm).then(() => {
|
||||
this.$store.dispatch('websocket_init', process.env.VUE_APP_WEBSOCKET+this.loginForm.username)
|
||||
listAllSite().then(response => {
|
||||
if (response.data && response.data.length > 0) {
|
||||
response.data.map((item) => {
|
||||
|
Loading…
Reference in New Issue
Block a user