Browse Source

增加更新日志提醒

develop
fuguobin 10 months ago
parent
commit
4f370eb0bc
  1. 4
      .env.production
  2. 11
      src/api/user/index.ts
  3. 6
      src/store/modules/user.ts
  4. 7
      src/styles/index.scss
  5. 6
      src/views/dashboard/components/BarChart.vue
  6. 2
      src/views/dashboard/components/PieChart.vue
  7. 7
      src/views/dashboard/index.scss
  8. 32
      src/views/dashboard/index.vue

4
.env.production

@ -5,6 +5,6 @@ VITE_APP_PORT = 8089
#VITE_APP_WS_API = 'ws://board.heatiot.cn:8001/prod-api' ## websocket地址 #VITE_APP_WS_API = 'ws://board.heatiot.cn:8001/prod-api' ## websocket地址
#VITE_APP_BASE_API = 'http://board.heatiot.cn:8001/prod-api/' ## 线上接口 #VITE_APP_BASE_API = 'http://board.heatiot.cn:8001/prod-api/' ## 线上接口
#VITE_APP_WS_API = 'ws://${window.location.host}/ws' ## websocket地址 ws://10.10.10.56:9000/websocket/ #VITE_APP_WS_API = 'ws://${window.location.host}/ws' ## websocket地址 ws://10.10.10.56:9000/websocket/
VITE_APP_BASE_API = '/prod-api/' ## 正式环境 # VITE_APP_BASE_API = '/prod-api/' ## 正式环境
# VITE_APP_BASE_API = '/biprod-api/' ## 测试环境 VITE_APP_BASE_API = '/biprod-api/' ## 测试环境

11
src/api/user/index.ts

@ -162,3 +162,14 @@ export function importUser(deptId: number, file: File) {
} }
}); });
} }
/**
*
*/
export function userVersionRelation(data: any) {
return request({
url: 'model/userVersionRelation',
method: 'post',
data: data
});
}

6
src/store/modules/user.ts

@ -16,6 +16,7 @@ export const useUserStore = defineStore('user', () => {
const userInfo = useSessionStorage('userInfo', {}); const userInfo = useSessionStorage('userInfo', {});
const nickname = ref(''); const nickname = ref('');
const avatar = ref(''); const avatar = ref('');
const webVersion = useSessionStorage('webVersion', '');
const roles = ref<Array<string>>([]); // 用户角色编码集合 → 判断路由权限 const roles = ref<Array<string>>([]); // 用户角色编码集合 → 判断路由权限
const perms = ref<Array<string>>([]); // 用户权限编码集合 → 判断按钮权限 const perms = ref<Array<string>>([]); // 用户权限编码集合 → 判断按钮权限
@ -56,6 +57,11 @@ export const useUserStore = defineStore('user', () => {
roles.value = data.roles; roles.value = data.roles;
perms.value = data.permissions; perms.value = data.permissions;
userInfo.value = user; userInfo.value = user;
if(data.webVersion===null){
webVersion.value=''
}else{
webVersion.value=JSON.stringify(data.webVersion)
}
// useStorage('userInfo', user); // useStorage('userInfo', user);
resolve(data); resolve(data);
}) })

7
src/styles/index.scss

@ -199,3 +199,10 @@
color: #eee !important; color: #eee !important;
} }
} }
.el-notification.notice {
border: none !important;
background-color: #fff !important;
.el-notification__content {
color: #000 !important;
}
}

6
src/views/dashboard/components/BarChart.vue

@ -196,7 +196,7 @@ const options = {
precision: 1, precision: 1,
position: 'right', position: 'right',
color: '#000', color: '#000',
valueAnimation: true // valueAnimation: false //
}, },
emphasis: { emphasis: {
focus: 'series' // focus: 'series' //
@ -212,8 +212,8 @@ const options = {
elements: [ elements: [
{ {
type: 'text', type: 'text',
right: 120, right: 50,
bottom: 100, bottom: 50,
style: { style: {
text: startYear, text: startYear,
font: 'bolder 80px monospace', font: 'bolder 80px monospace',

2
src/views/dashboard/components/PieChart.vue

@ -95,7 +95,7 @@ onMounted(() => {});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.table { .table {
width: 540px; width: 498px;
height: 300px; height: 300px;
padding: 10px; padding: 10px;
.header { .header {

7
src/views/dashboard/index.scss

@ -84,4 +84,11 @@
// } // }
// } // }
} }
.statistics{
:deep(.el-card){
.el-card__header{
font-size: 1.4rem;
}
}
}
} }

32
src/views/dashboard/index.vue

@ -51,7 +51,7 @@
<i class="iconfont" :class="item.icon"></i> <i class="iconfont" :class="item.icon"></i>
<span> <span>
<countTo :start="1" :end="item.value" :duration="item.time"></countTo> <countTo :start="1" :end="item.value" :duration="item.time"></countTo>
<span v-if="item.total!=0"><i>/</i>{{ item.total }}</span> <span v-if="item.total != 0"><i>/</i>{{ item.total }}</span>
</span> </span>
</div> </div>
</div> </div>
@ -78,7 +78,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useDateFormat, useNow, useTransition, TransitionPresets } from '@vueuse/core'; import { useDateFormat, useNow, useTransition, TransitionPresets } from '@vueuse/core';
import { useUserStore } from '@/store/modules/user'; import { useUserStore } from '@/store/modules/user';
import { getWeather } from '@/api/user/index'; import { getWeather, userVersionRelation } from '@/api/user/index';
// import { transitionNum } from '@/utils/index'; // import { transitionNum } from '@/utils/index';
import calendar from '@/utils/lunar'; import calendar from '@/utils/lunar';
import countTo from '@/utils/countTo'; import countTo from '@/utils/countTo';
@ -92,6 +92,7 @@ const isCurrentRoute = ref(true);
const userStore = useUserStore(); const userStore = useUserStore();
const duration = 5000; const duration = 5000;
const userNumber = ref(2800); const userNumber = ref(2800);
const notice = ref({});
// const vsitsNumber = transitionNum(720, 5000); // const vsitsNumber = transitionNum(720, 5000);
const currentTime = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss'); const currentTime = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss');
const hoursNow = useNow().value.getHours(); const hoursNow = useNow().value.getHours();
@ -169,10 +170,35 @@ const timePeriod = computed(() => {
onMounted(() => { onMounted(() => {
getWeatherData(); getWeatherData();
const webVersion = sessionStorage.getItem('webVersion');
if (webVersion != '') {
const version = JSON.parse(webVersion);
notice.value = ElNotification({
title: '更新日志',
dangerouslyUseHTMLString: true,
customClass: 'notice',
duration: 0,
message: version.versionDesc.replace(/\n/g, '<br>'),
onClose: () => {
noticeCloce(version.id);
}
});
}
}); });
function noticeCloce(id: any) {
//
const params = {
versionId: id
};
userVersionRelation(params).then((res: any) => {
if (res.code === 200) {
console.log('更新日志关闭!')
}
});
}
function getWeatherData() { function getWeatherData() {
// //
getWeather().then(res => { getWeather().then((res: any) => {
if (res.code === 200) { if (res.code === 200) {
if (isCurrentRoute.value) { if (isCurrentRoute.value) {
timer.value = setTimeout(async () => { timer.value = setTimeout(async () => {

Loading…
Cancel
Save