second commit

This commit is contained in:
robin 2021-10-02 16:28:09 +08:00
parent 1b50066e33
commit 37afebf1d0
2 changed files with 96 additions and 0 deletions

74
App.vue Normal file
View File

@ -0,0 +1,74 @@
<!--
* @Author: Robin.lau
* @Email: 329080237@qq.com
* @Wechat: 15618110227
-->
<template>
<div id="app">
<router-view v-if="isRouterAlive" :key="key"></router-view>
</div>
</template>
<script>
export default {
name: 'App',
provide() {
return {
reload: this.reload,
}
},
data() {
return {
isRouterAlive: true,
userInfo: JSON.parse(localStorage.getItem("userInfo")),
}
},
created() {
if(this.userInfo){
this.initSocket()
}
},
computed: {
key() {
return this.$route.path
}
},
methods: {
reload() {
this.isRouterAlive = false
this.$nextTick(function() {
this.isRouterAlive = true
})
},
// websocket
initSocket() {
let that = this;
if ("WebSocket" in window) {
//线
//that.ws = new WebSocket("ws://wb-web.traumwork.com/ws/client/"+that.userInfo.id+"/");
//
that.ws = new WebSocket("ws://127.0.0.1:8000/ws/client/"+that.userInfo.id+"/");
that.wsGlobal.setWs(that.ws);
that.ws.onopen = function () {
console.log('websocket连接成功');
};
that.ws.onclose = function () {
// websocket
console.log("连接已关闭...");
//线
// setTimeout(() => {
// that.initSocket();
// }, 3000);
};
} else {
// WebSocket
console.log("您的浏览器不支持 WebSocket!");
this.openNotificationWithIcon('error', '浏览器', '您的浏览器不支持显示消息请更换', 1,1)
}
}
}
}
</script>

22
manage.py Normal file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "apiset.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
# issue is really that Django is missing to avoid masking other
# exceptions on Python 2.
try:
import django
except ImportError:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
)
raise
execute_from_command_line(sys.argv)