|
@@ -14,7 +14,7 @@
|
|
|
<i
|
|
|
v-if="isShow"
|
|
|
class="el-icon-message-solid right-menu-item hover-effect shake"
|
|
|
- @click="openNotice"
|
|
|
+ @click="openNotice()"
|
|
|
style="height: 50px; width: 40px; line-height: 52px; font-size: 22px"
|
|
|
/>
|
|
|
<screenfull id="screenfull" class="right-menu-item hover-effect" />
|
|
@@ -157,79 +157,97 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.openNotice(1);
|
|
|
+ this.openNotice(true);
|
|
|
},
|
|
|
methods: {
|
|
|
- async openNotice(type) {
|
|
|
+ async openNotice(is) {
|
|
|
if (getNotice() && getNotice().length > 0) {
|
|
|
this.lastNotice = JSON.parse(getNotice());
|
|
|
} else {
|
|
|
this.lastNotice = null;
|
|
|
}
|
|
|
- console.log(this.lastNotice);
|
|
|
- this.loading = true;
|
|
|
- const { code, data } = await asyncRequest.list(this.parmValue);
|
|
|
+ const { code, count, item, message } = await this.initData();
|
|
|
if (code === 0) {
|
|
|
- const { list, count } = data;
|
|
|
- if (count !== 0) {
|
|
|
- this.activeMsg = list[0];
|
|
|
- this.isShow = true;
|
|
|
- if (this.lastNotice + "" !== "null") {
|
|
|
- const { type, addtime, sys_type } = this.activeMsg;
|
|
|
- if (
|
|
|
- addtime === this.lastNotice.addtime &&
|
|
|
- sys_type === this.lastNotice.sys_type
|
|
|
- ) {
|
|
|
- if (type === "1") {
|
|
|
- this.checked = true;
|
|
|
- } else {
|
|
|
- this.checked = false;
|
|
|
- }
|
|
|
+ if (count != 0) {
|
|
|
+ this.activeMsg = item;
|
|
|
+ if (this.lastNotice + "" === "null") {
|
|
|
+ this.showModel = true;
|
|
|
+ } else {
|
|
|
+ if (is) {
|
|
|
+ this.typeShow();
|
|
|
} else {
|
|
|
- this.checked = false;
|
|
|
+ this.showModel = true;
|
|
|
}
|
|
|
- } else {
|
|
|
- this.page_set_notice();
|
|
|
- this.checked = false;
|
|
|
- }
|
|
|
- if (type === 1) {
|
|
|
- this.typeShow();
|
|
|
- } else {
|
|
|
- this.showModel = true;
|
|
|
}
|
|
|
} else {
|
|
|
- this.$message.warning("暂无信息推送!");
|
|
|
+ this.$message.warning("暂无系统消息!");
|
|
|
}
|
|
|
} else if (code >= 100 && code <= 104) {
|
|
|
await this.logout();
|
|
|
} else {
|
|
|
- this.activeMsg = null;
|
|
|
- this.isShow = false;
|
|
|
+ this.$message.warning(message);
|
|
|
}
|
|
|
+ },
|
|
|
+
|
|
|
+ async initData() {
|
|
|
+ let res = {
|
|
|
+ code: 0,
|
|
|
+ count: 0,
|
|
|
+ item: {},
|
|
|
+ message: "",
|
|
|
+ };
|
|
|
+
|
|
|
+ this.loading = true;
|
|
|
+ const { code, data, message } = await asyncRequest.list(this.parmValue);
|
|
|
this.loading = false;
|
|
|
+ res.code = code;
|
|
|
+ res.message = message;
|
|
|
+ if (code === 0) {
|
|
|
+ const { list, count } = data;
|
|
|
+ res.count = count;
|
|
|
+ if (count !== 0) {
|
|
|
+ res.item = JSON.parse(JSON.stringify(list[0]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res;
|
|
|
},
|
|
|
typeShow() {
|
|
|
+ const {
|
|
|
+ addtime: laddtime,
|
|
|
+ type: ltype,
|
|
|
+ sys_type: lsys_type,
|
|
|
+ } = this.lastNotice;
|
|
|
+ const { sys_type, addtime } = this.activeMsg;
|
|
|
+ if (laddtime === addtime && lsys_type === sys_type) {
|
|
|
+ if (ltype === "1") {
|
|
|
+ this.showModel = this.is_Tips();
|
|
|
+ } else {
|
|
|
+ this.showModel = true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.showModel = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ is_Tips() {
|
|
|
let nowtime = new Date().valueOf();
|
|
|
- if (this.activeMsg.sys_type === "VER") {
|
|
|
- this.statsTime = new Date(this.activeMsg.addtime).valueOf();
|
|
|
+ console.log(this.lastNotice);
|
|
|
+ const { sys_type, addtime } = this.activeMsg;
|
|
|
+ let timeV = new Date(addtime).valueOf();
|
|
|
+ if (sys_type === "VER") {
|
|
|
+ this.statsTime = timeV;
|
|
|
this.endTime = this.statsTime + 1000 * 60 * 60 * 24 * 7;
|
|
|
-
|
|
|
- if (
|
|
|
- nowtime > this.statsTime &&
|
|
|
- nowtime < this.endTime &&
|
|
|
- !this.checked
|
|
|
- ) {
|
|
|
- this.showModel = true;
|
|
|
+ if (nowtime >= this.statsTime && nowtime <= this.endTime) {
|
|
|
+ return false;
|
|
|
} else {
|
|
|
- this.showModel = false;
|
|
|
+ return true;
|
|
|
}
|
|
|
} else {
|
|
|
this.statsTime = 0;
|
|
|
- this.endTime = new Date(this.activeMsg.addtime).valueOf();
|
|
|
- if (nowtime < this.endTime && !this.checked) {
|
|
|
- this.showModel = true;
|
|
|
+ this.endTime = timeV;
|
|
|
+ if (nowtime <= this.endTime) {
|
|
|
+ return false;
|
|
|
} else {
|
|
|
- this.showModel = false;
|
|
|
+ return true;
|
|
|
}
|
|
|
}
|
|
|
},
|