This commit is contained in:
zk
2023-12-19 18:10:46 +08:00
parent 3e53c75a6f
commit 8dccce0208
16 changed files with 128 additions and 35 deletions
+22 -11
View File
@@ -4,6 +4,8 @@ import { useUserStore } from '/@/store/modules/user.ts';
import { getAuthCache } from '/@/utils/auth.ts';
import { TOKEN_KEY } from '/@/enum/cacheEnum.ts';
import { useMessage } from '/@/hooks/web/useMessage.ts';
import { checkStatus } from '/@/api/checkStatus.ts';
import router from '/@/router';
const { createMessage, createErrorModal } = useMessage();
const { VITE_GLOB_API_URL } = getAppEnvConfig();
@@ -17,18 +19,27 @@ const service = axios.create({
'Content-Type': 'application/json;charset=UTF-8',
'X-Access-Token': token || getAuthCache(TOKEN_KEY),
},
/**
* @description: 响应错误处理
*/
responseInterceptorsCatch(error: any) {
const { response, code, message, config } = error || {};
const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none';
if (errorMessageMode === 'message') {
createMessage.error(message);
}
return Promise.reject(error);
},
});
service.interceptors.request.use((config, options) => {
config.headers['X-Access-Token'] = token || getAuthCache(TOKEN_KEY);
return config;
});
service.interceptors.response.use(
(response) => {
return response;
},
(error) => {
if (error.response) {
switch (error.response.data.code) {
case 401:
router.replace({
path: '/login',
});
}
}
return Promise.reject(error.response.data); // 返回接口返回的错误信息
}
);
export const get = (url, params = {}) => {
return new Promise((resolve, reject) => {
service
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

-3
View File
@@ -148,7 +148,6 @@ export const Map = {
this.overlayGroup.on('click', function (e) {
//拿到点中携带的数据
// console.log(e.target.getExtData());
if (!isFunction(callback)) return;
callback(e.target.getExtData());
});
@@ -166,7 +165,6 @@ export const Map = {
* @param result
*/
createAircraft(result: ResultType[]) {
console.log('result', result);
this.removeOverlayGroup();
this.clearActiveHospital();
// debugger;
@@ -180,7 +178,6 @@ export const Map = {
arr,
{
renderMarker: (context) => {
console.log('context', context);
let factor = Math.pow(context.count / count, 1 / 18);
let div = document.createElement('div');
div.className = 'render-air';
@@ -39,7 +39,7 @@
const dataSource = ref([]);
const pagination = ref({
current: 1,
pageSize: 2,
pageSize: 10,
total: 0,
onChange: pageChange,
});
@@ -90,7 +90,6 @@
}
function interval() {
console.log(55555);
// timer.value = setInterval(() => {
let page = pagination.value.current < pages.value ? pagination.value.current + 1 : 1;
init(page);
@@ -13,7 +13,7 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import AllLookItem from '/@/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/allLookItem.vue';
import AllLookItem from '/@/components/secondaryScreen/secondMap/components/userInfoModal/allLookItem.vue';
import { propTypes } from '/@/utils/propTypes';
const props = defineProps({
@@ -29,4 +29,4 @@
emit('changeParamsDate', v.target.value);
}
</script>
<style scoped lang="less"></style>
<style scoped lang="less"></style>
@@ -2,7 +2,7 @@
<div style="display: flex; margin-top: 20px">
<div style="width: calc(70% - 20px); border: 1px solid #ededed; padding: 20px">
<div style="display: flex; align-items: center; padding: 10px 0; justify-content: flex-start">
<img src="../../../../../../assets/images/allLook/heart_rate.png" alt="" />
<img :src="heart_rate" alt="" />
心率
</div>
<div style="display: flex">
@@ -34,7 +34,7 @@
</div>
<div style="width: 30%; margin-left: 20px; border: 1px solid #ededed; padding: 20px">
<div style="display: flex; align-items: center; padding: 10px 0; justify-content: flex-start">
<img src="../../../../../../assets/images/allLook/blood_oxygen.png" alt="" />
<img :src="blood" alt="" />
血氧
</div>
<div style="display: flex">
@@ -56,7 +56,7 @@
<div style="display: flex; margin-top: 20px">
<div style="width: calc(70% - 20px); border: 1px solid #ededed; padding: 20px">
<div style="display: flex; align-items: center; padding: 10px 0; justify-content: flex-start">
<img src="../../../../../../assets/images/allLook/sleep.png" alt="" />
<img :src="sleep" alt="" />
睡眠
</div>
<div style="display: flex">
@@ -92,7 +92,7 @@
</div>
<div style="width: 30%; margin-left: 20px; border: 1px solid #ededed; padding: 20px">
<div style="display: flex; align-items: center; padding: 10px 0; justify-content: flex-start">
<img src="../../../../../../assets/images/allLook/pressure.png" alt="" />
<img :src="pressure" alt="" />
压力
</div>
@@ -117,7 +117,7 @@
<div style="display: flex; margin-top: 20px">
<div style="width: 100%; border: 1px solid #ededed">
<div style="display: flex; align-items: center; padding: 30px 20px 10px; justify-content: flex-start">
<img src="../../../../../../assets/images/allLook/motion.png" alt="" />
<img :src="temperature" alt="" />
运动
</div>
<div style="display: flex; justify-content: space-between">
@@ -177,7 +177,7 @@
<div style="display: flex; margin-top: 20px">
<div style="width: calc(70% - 20px); border: 1px solid #ededed; padding: 20px">
<div style="display: flex; align-items: center; padding: 10px 0; justify-content: flex-start">
<img src="../../../../../../assets/images/allLook/temperature.png" alt="" />
<img :src="temperature" alt="" />
体温
</div>
<div style="display: flex">
@@ -212,6 +212,11 @@
<script setup lang="ts">
import { propTypes } from '/@/utils/propTypes';
const blood = new URL('/@/assets/images/blood_oxygen.png', import.meta.url).href;
const heart_rate = new URL('/@/assets/images/heart_rate.png', import.meta.url).href;
const temperature = new URL('/@/assets/images/temperature.png', import.meta.url).href;
const pressure = new URL('/@/assets/images/pressure.png', import.meta.url).href;
const sleep = new URL('/@/assets/images/sleep.png', import.meta.url).href;
const props = defineProps({
infoData: propTypes.object.def({}),
});
@@ -226,6 +231,7 @@
function getC(c) {
return c === 0 ? 0 + '(千卡)' : parseFloat(c / 1000).toFixed(3) + '(千卡)';
}
function getK(k) {
return k === 0 ? 0 + 'km' : parseFloat(k / 1000).toFixed(3) + 'km';
}
@@ -243,15 +249,19 @@
height: 30px;
margin-right: 5px;
}
.label-d {
width: 50%;
}
.value-d {
width: 50%;
text-align: center;
}
.border-d {
position: relative;
&:after {
content: '';
height: 90%;
@@ -262,8 +272,10 @@
background-color: #d3d3d3;
}
}
.border-d-d {
position: relative;
&:after {
content: '';
height: 90%;
@@ -274,10 +286,11 @@
background-color: #d3d3d3;
}
}
.label-d,
.value-d {
div {
padding: 5px 0;
}
}
</style>
</style>
@@ -1,10 +1,30 @@
import { get } from '/@/api/request.ts';
import { get, post } from '/@/api/request.ts';
export enum Api {
footerStatistic = '/health-watch/watch/deptStatisticData/listByorgCode',
mapListApi = '/health-watch/watch/watchDevice/getMapList',
getUserListByDeptId = '/health-watch/watch/watchDevice/getUserListByDeptId',
queryAllStatistics = '/health-watch/watch/watchData/queryAllStatistics',
// 心率
queryHeartRateStatistics = '/health-watch/watch/watchData/queryHeartRateStatistics',
queryHeartRateStatisticsPage = '/health-watch/watch/watchData/queryHeartRateStatisticsPage',
// 血氧
queryBloodOxygenStatistics = '/health-watch/watch/watchData/queryBloodOxygenStatistics',
queryBloodOxygenStatisticsPage = '/health-watch/watch/watchData/queryBloodOxygenStatisticsPage',
// 压力
queryStressStatistics = '/health-watch/watch/watchData/queryStressStatistics',
queryStressStatisticsPage = '/health-watch/watch/watchData/queryStressStatisticsPage',
// 睡眠
querySleepStatistics = '/health-watch/watch/watchData/querySleepStatistics',
querySleepStatisticsPage = '/health-watch/watch/watchData/querySleepStatisticsPage',
// 体温
queryBodyTemperatureStat = '/health-watch/watch/watchData/queryBodyTemperatureStat',
queryBodyTemperatureStatPage = '/health-watch/watch/watchData/queryBodyTemperatureStatPage',
// 锻炼
queryExercisePage = '/health-watch/watch/watchData/queryExercisePage',
// 步数
queryStepStatistics = '/health-watch/watch/watchData/queryStepStatistics',
queryStepStatisticsPage = '/health-watch/watch/watchData/queryStepStatisticsPage',
// 获取是否有数据
userDataDayByYear = '/health-watch/watch/watchData/userDataDayByYear',
}
@@ -18,3 +38,21 @@ export const mapListApi = (params) => get(Api.mapListApi, params);
export const getUserListByDeptId = (params) => get(Api.getUserListByDeptId, params);
export const queryAllStatisticsApi = (params) => get(Api.queryAllStatistics, params);
export const userDataDayByYearApi = (params) => get(Api.userDataDayByYear, params);
// 血氧
export const queryBloodOxygenStatisticsApi = (params: any) => post(Api.queryBloodOxygenStatistics, params);
export const queryBloodOxygenStatisticsPageApi = (params: any) => post(Api.queryBloodOxygenStatisticsPage, params);
// 压力
export const queryStressStatisticsApi = (params: any) => post(Api.queryBloodOxygenStatisticsPage, params);
export const queryStressStatisticsPageApi = (params: any) => post(Api.queryStressStatisticsPage, params);
// 睡眠
export const querySleepStatisticsApi = (params: any) => post(Api.querySleepStatistics, params);
export const querySleepStatisticsPageApi = (params: any) => post(Api.querySleepStatisticsPage, params);
// 体温
export const queryBodyTemperatureStatApi = (params: any) => post(Api.queryBodyTemperatureStat, params);
export const queryBodyTemperatureStatPageApi = (params: any) => post(Api.queryBodyTemperatureStatPage, params);
// 锻炼
export const queryExercisePageApi = (params: any) => post(Api.queryExercisePage, params);
// 步数
export const queryStepStatisticsApi = (params: any) => post(Api.queryStepStatistics, params);
export const queryStepStatisticsPageApi = (params: any) => post(Api.queryStepStatisticsPage, params);
+24 -1
View File
@@ -1,4 +1,6 @@
import { createRouter, createWebHistory, Router, RouteRecordRaw } from 'vue-router';
import {createRouter, createWebHistory, Router, RouteRecordRaw} from 'vue-router';
import {getAuthCache} from '/@/utils/auth.ts';
import {TOKEN_KEY} from '/@/enum/cacheEnum.ts';
const routes: Array<RouteRecordRaw> = [
{
@@ -34,6 +36,27 @@ const routes: Array<RouteRecordRaw> = [
const router: Router = createRouter({
history: createWebHistory('/'),
// mode: 'hash',
routes: [...routes],
});
let token = getAuthCache(TOKEN_KEY);
// router.beforeEach((to, from, next) => {
// console.log('to', to);
// console.log('token', token);
// // token = null;
// if (token) {
// // 如果已经登录的话
// next();
// } else {
// if (to.path === '/login') {
// // 如果是登录页面的话,直接next()
// next();
// } else {
// // 否则 跳转到登录页面
// next({
// path: '/login',
// });
// }
// }
// });
export default router;
+2 -1
View File
@@ -93,7 +93,8 @@ export const useUserStore = defineStore({
this.setToken('');
this.setUserInfo(null);
this.setLoginInfo(null);
goLogin && (await router.push({ path: PageEnum.BASE_LOGIN }));
console.log('goLogin', goLogin);
goLogin && router.replace({ path: PageEnum.BASE_LOGIN });
},
},
});
+17 -6
View File
@@ -1,30 +1,40 @@
import { onMounted, onUnmounted, ref } from 'vue';
import { getAppEnvConfig } from '/@/utils/env.ts';
import { useUserStore } from '/@/store/modules/user.ts';
import { getAuthCache } from '/@/utils/auth.ts';
import { TOKEN_KEY } from '/@/enum/cacheEnum.ts';
import { useRouter } from 'vue-router';
const router = useRouter();
const userStore = useUserStore();
const { token } = userStore;
const { VITE_GLOB_API_YIN_JI, VITE_GLOB_API_JIAN_CE } = getAppEnvConfig();
//健康监测工具报警
export const basicPath = VITE_GLOB_API_YIN_JI;
//应急求助
export const emergencyPath = VITE_GLOB_API_JIAN_CE;
const token =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiaWRlbnRpZmllciI6ImU5Y2EyM2Q2OGQ4ODRkNGViYjE5ZDA3ODg5NzI3ZGFlIiwiZXhwIjoxNzAzMjExNzQ1fQ.dadvKgAgzfK6DUd8xtrgadxPbPXUsayNNSrt3mNxKC8';
let t = token || getAuthCache(TOKEN_KEY);
export function useSocket(path = basicPath) {
const socket = ref();
let socketData = ref({});
function init() {
if (!t) {
return router?.replace('/login');
}
if (typeof WebSocket === 'undefined') {
alert('您的浏览器不支持socket');
} else {
// 实例化socket
socket.value = new WebSocket(path, [token]);
socket.value = new WebSocket(path, [t]);
// 监听socket连接
socket.value.onopen = open;
// 监听socket错误信息
socket.value.onerror = error;
// 监听socket消息
socket.value.onmessage = getMessage;
socket.value.onclose = close;
}
}
@@ -37,7 +47,7 @@ export function useSocket(path = basicPath) {
}
function getMessage(msg) {
console.log('y', msg.data);
console.log('getMessage', msg);
socketData.value = JSON.parse(msg.data);
}
@@ -45,7 +55,8 @@ export function useSocket(path = basicPath) {
socketData.value = data;
}
function close() {
function close(data) {
console.log(data);
console.log('socket已经关闭');
}
@@ -53,7 +64,7 @@ export function useSocket(path = basicPath) {
init();
});
onUnmounted(() => {
socket.value.onclose = close;
//socket.value.onclose = close;
});
return { socket, socketData, setSocketData };
}
+1 -1
View File
@@ -84,7 +84,7 @@
}
function clickBack() {
router.go(-1);
router.replace({ path: '/home' });
}
</script>
<style lang="less" scoped>