|
@@ -1,10 +1,6 @@
|
|
|
<template>
|
|
|
<div class="navbar">
|
|
|
- <hamburger
|
|
|
- :is-active="sidebar.opened"
|
|
|
- class="hamburger-container"
|
|
|
- @toggleClick="toggleSideBar"
|
|
|
- />
|
|
|
+ <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
|
|
|
|
|
|
<breadcrumb class="breadcrumb-container" v-if="showBreadcrumb" />
|
|
|
|
|
@@ -26,18 +22,9 @@
|
|
|
<span style="font-size: 16px; margin-left: 6px;">家用工程机登录</span>
|
|
|
</div>
|
|
|
|
|
|
- <el-badge
|
|
|
- :value="noticeCount"
|
|
|
- :max="10"
|
|
|
- :hidden="!noticeVisible"
|
|
|
- class="right-menu-item hover-effect"
|
|
|
- >
|
|
|
+ <el-badge :value="noticeCount" :max="10" :hidden="!noticeVisible" class="right-menu-item hover-effect">
|
|
|
<el-tooltip effect="dark" content="系统消息" placement="bottom">
|
|
|
- <i
|
|
|
- class="el-icon-message-solid"
|
|
|
- @click="goNotice"
|
|
|
- style="font-size: 24px; line-height: 50px"
|
|
|
- ></i>
|
|
|
+ <i class="el-icon-message-solid" @click="goNotice" style="font-size: 24px; line-height: 50px"></i>
|
|
|
</el-tooltip>
|
|
|
<!-- <el-button icon="el-icon-message-solid" type="text" class="notice-icon" @click="goNotice"></el-button> -->
|
|
|
</el-badge>
|
|
@@ -61,31 +48,13 @@
|
|
|
</el-dropdown>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog
|
|
|
- title="绑定工程机系统"
|
|
|
- :visible.sync="dialogFormVisible"
|
|
|
- :modal="false"
|
|
|
- width="30%"
|
|
|
- >
|
|
|
+ <el-dialog title="绑定工程机系统" :visible.sync="dialogFormVisible" :modal="false" width="30%">
|
|
|
<el-form ref="engineForm" :model="engineForm" :rules="engineFormRules">
|
|
|
<el-form-item label="账号" :label-width="formLabelWidth" prop="account">
|
|
|
- <el-input
|
|
|
- v-model="engineForm.account"
|
|
|
- placeholder="请输入账号"
|
|
|
- autocomplete="off"
|
|
|
- ></el-input>
|
|
|
+ <el-input v-model="engineForm.account" placeholder="请输入账号" autocomplete="off"></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item
|
|
|
- label="密码"
|
|
|
- :label-width="formLabelWidth"
|
|
|
- prop="password"
|
|
|
- >
|
|
|
- <el-input
|
|
|
- v-model="engineForm.password"
|
|
|
- placeholder="请输入密码"
|
|
|
- autocomplete="off"
|
|
|
- show-password
|
|
|
- ></el-input>
|
|
|
+ <el-form-item label="密码" :label-width="formLabelWidth" prop="password">
|
|
|
+ <el-input v-model="engineForm.password" placeholder="请输入密码" autocomplete="off" show-password></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -144,14 +113,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getRebateOrderMsg } from '@/api/dashboard'
|
|
|
-import { mapGetters } from 'vuex'
|
|
|
-import Breadcrumb from '@/components/Breadcrumb'
|
|
|
-import Hamburger from '@/components/Hamburger'
|
|
|
-import Screenfull from '@/components/Screenfull'
|
|
|
-import NavMenu from '@/components/NavMenu'
|
|
|
-import { getNoticeListCount } from '@/api/notice'
|
|
|
-import { bindEngineAccount, checkEngineAccount } from '@/api/setting'
|
|
|
+import { getRebateOrderMsg } from "@/api/dashboard";
|
|
|
+import { mapGetters } from "vuex";
|
|
|
+import Breadcrumb from "@/components/Breadcrumb";
|
|
|
+import Hamburger from "@/components/Hamburger";
|
|
|
+import Screenfull from "@/components/Screenfull";
|
|
|
+import NavMenu from "@/components/NavMenu";
|
|
|
+import { getNoticeListCount } from "@/api/notice";
|
|
|
+import { bindEngineAccount, checkEngineAccount } from "@/api/setting";
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
@@ -176,19 +145,19 @@ export default {
|
|
|
formLabelWidth: "100px",
|
|
|
dialogFormVisible: false,
|
|
|
//websocket错误连接次数
|
|
|
- wsConnectErrorTime:1,
|
|
|
+ wsConnectErrorTime: 1,
|
|
|
websock: null,
|
|
|
- lockReconnect:false,
|
|
|
+ lockReconnect: false,
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
const that = this;
|
|
|
// 开定时器轮询未读消息接口(写在全局vuex里比较好)
|
|
|
// that.initNotice();
|
|
|
- that.tcMessage();
|
|
|
- this.intivalId = setInterval(function () {
|
|
|
- that.tcMessage();
|
|
|
- }, 5000);
|
|
|
+ // that.tcMessage();
|
|
|
+ // this.intivalId = setInterval(function () {
|
|
|
+ // that.tcMessage();
|
|
|
+ // }, 5000);
|
|
|
// this.timer = setInterval(function () {
|
|
|
// that.initNotice();
|
|
|
// }, 3000);
|
|
@@ -228,9 +197,8 @@ export default {
|
|
|
async logout() {
|
|
|
await this.$store.dispatch("user/logout");
|
|
|
// this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
|
|
- this.$store.commit('tagsView/SET_RESET_VIES')
|
|
|
+ this.$store.commit("tagsView/SET_RESET_VIES");
|
|
|
this.$router.push(`/login`);
|
|
|
-
|
|
|
},
|
|
|
initNotice() {
|
|
|
getNoticeListCount().then((res) => {
|
|
@@ -241,25 +209,25 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- async tcMessage() {
|
|
|
- // 长链接
|
|
|
- // let data = {
|
|
|
- // type: 'RebateOrderMsg',
|
|
|
- // params: {
|
|
|
- // }
|
|
|
- // }
|
|
|
- // this.websocketSend(JSON.stringify(data))
|
|
|
- let res = await getRebateOrderMsg();
|
|
|
- if (res.data.hasMessage) {
|
|
|
- this.$notify.info({
|
|
|
- title: "消息",
|
|
|
- message: res.data.messages,
|
|
|
- position: "bottom-right",
|
|
|
- duration: 4000,
|
|
|
- showClose: false,
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
+ // async tcMessage() {
|
|
|
+ // // 长链接
|
|
|
+ // // let data = {
|
|
|
+ // // type: 'RebateOrderMsg',
|
|
|
+ // // params: {
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+ // // this.websocketSend(JSON.stringify(data))
|
|
|
+ // let res = await getRebateOrderMsg();
|
|
|
+ // if (res.data.hasMessage) {
|
|
|
+ // this.$notify.info({
|
|
|
+ // title: "消息",
|
|
|
+ // message: res.data.messages,
|
|
|
+ // position: "bottom-right",
|
|
|
+ // duration: 4000,
|
|
|
+ // showClose: false,
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // },
|
|
|
goNotice() {
|
|
|
this.$router.push("/notice/index");
|
|
|
},
|
|
@@ -392,21 +360,21 @@ export default {
|
|
|
//this.heartCheck.reset().start();
|
|
|
},
|
|
|
websocketOnerror: function (e) {
|
|
|
- console.debug("WebSocket连接发生错误,第%s次",this.wsConnectErrorTime);
|
|
|
+ console.debug("WebSocket连接发生错误,第%s次", this.wsConnectErrorTime);
|
|
|
|
|
|
this.wsConnectErrorTime = this.wsConnectErrorTime + 1;
|
|
|
- if(this.wsConnectErrorTime>5){
|
|
|
+ if (this.wsConnectErrorTime > 5) {
|
|
|
console.debug("WebSocket连接错误超过5次,就不再重新连了!");
|
|
|
- this.lockReconnect = true
|
|
|
+ this.lockReconnect = true;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
this.reconnect();
|
|
|
},
|
|
|
websocketOnmessage: function (e) {
|
|
|
- console.debug("-----接收消息-------",e.data);
|
|
|
+ console.debug("-----接收消息-------", e.data);
|
|
|
let data = eval("(" + e.data + ")"); //解析对象
|
|
|
- if (data.type === 'RebateOrderMsg') {
|
|
|
+ if (data.type === "RebateOrderMsg") {
|
|
|
if (data.res.hasMessage) {
|
|
|
this.$notify.info({
|
|
|
title: "消息",
|
|
@@ -420,12 +388,13 @@ export default {
|
|
|
},
|
|
|
websocketOnclose: function (e) {
|
|
|
console.debug("connection closed (" + e + ")");
|
|
|
- if(e){
|
|
|
+ if (e) {
|
|
|
console.debug("connection closed (" + e.code + ")");
|
|
|
}
|
|
|
this.reconnect();
|
|
|
},
|
|
|
- websocketSend(text) { // 数据发送
|
|
|
+ websocketSend(text) {
|
|
|
+ // 数据发送
|
|
|
try {
|
|
|
this.websock.send(text);
|
|
|
} catch (err) {
|
|
@@ -434,7 +403,7 @@ export default {
|
|
|
},
|
|
|
reconnect() {
|
|
|
var that = this;
|
|
|
- if(that.lockReconnect) return;
|
|
|
+ if (that.lockReconnect) return;
|
|
|
that.lockReconnect = true;
|
|
|
//没连接上会一直重连,设置延迟避免请求过多
|
|
|
setTimeout(function () {
|