“hanlingqiang 1 год назад
Родитель
Сommit
9219fc9d7d
5 измененных файлов с 91 добавлено и 10 удалено
  1. 2 1
      package.json
  2. 2 1
      src/store/modules/user.ts
  3. 5 2
      src/utils/auth.ts
  4. 7 0
      src/utils/jsencrypt.ts
  5. 75 6
      src/views/index.vue

+ 2 - 1
package.json

@@ -27,10 +27,10 @@
     "@element-plus/icons-vue": "2.1.0",
     "@vueup/vue-quill": "1.1.0",
     "@vueuse/core": "9.5.0",
-    "Buffer": "^0.0.0",
     "animate.css": "4.1.1",
     "await-to-js": "^3.0.0",
     "axios": "^1.3.4",
+    "Buffer": "^0.0.0",
     "codemirror": "^6.0.1",
     "dayjs": "^1.11.7",
     "echarts": "5.4.0",
@@ -38,6 +38,7 @@
     "file-saver": "2.0.5",
     "fuse.js": "6.6.2",
     "js-cookie": "3.0.1",
+    "js-md5": "^0.8.3",
     "jsencrypt": "3.3.1",
     "mitt": "^3.0.0",
     "mqtt": "^4.3.7",

+ 2 - 1
src/store/modules/user.ts

@@ -1,7 +1,7 @@
 import { to } from 'await-to-js'
 import defAva from '@/assets/images/profile.jpg'
 import store from '@/store'
-import { getToken, removeToken, setToken } from '@/utils/auth'
+import { getToken, removeToken, setToken, setName } from '@/utils/auth'
 import { login as loginApi, logout as logoutApi, getInfo as getUserInfo } from '@/api/login'
 import { LoginData } from '@/api/types'
 import { listByIds } from '@/api/system/oss'
@@ -47,6 +47,7 @@ export const useUserStore = defineStore('user', () => {
         roles.value = ['ROLE_DEFAULT']
       }
       name.value = user.userName
+      setName(user.userName)
       nickname.value = user.nickName
       if (profile) {
         const ossObj = await listByIds(profile)

+ 5 - 2
src/utils/auth.ts

@@ -1,15 +1,18 @@
 import useUserStore from "@/store/modules/user";
 
 const TokenKey = 'Admin-Token'
+const NameKey = 'Login-Name'
 
 const tokenStorage = useStorage<null | string>(TokenKey, null)
+const nameStorage = useStorage<null | string>(NameKey, null)
 
 export const getToken = () => tokenStorage.value
-
 export const setToken = (token: string) => (tokenStorage.value = token)
-
 export const removeToken = () => (tokenStorage.value = null)
 
+export const getName = () => nameStorage.value
+export const setName = (name: string) => (nameStorage.value = name)
+
 export const hasPermission = (permission:string)=>{
   const permissions = useUserStore().permissions
   const permissionDatas = permission

+ 7 - 0
src/utils/jsencrypt.ts

@@ -1,4 +1,5 @@
 import JSEncrypt from 'jsencrypt'
+import jsMd5 from 'js-md5'
 // 密钥对生成 http://web.chacuo.net/netrsakeypair
 
 const publicKey =
@@ -27,3 +28,9 @@ export const decrypt = (txt: string) => {
   encryptor.setPrivateKey(privateKey) // 设置私钥
   return encryptor.decrypt(txt) // 对数据进行解密
 }
+
+// MD5加密并返回
+const md5Key = '876456'
+export const md5Encrypt = (txt: string) => {
+  return jsMd5(txt + md5Key)
+}

+ 75 - 6
src/views/index.vue

@@ -50,12 +50,27 @@
       </el-col>
     </el-row>
 
+    <el-row :gutter="10" class="top_row">
+      <el-col :span="8" class="box-card_bg" v-for="(item, index) in state.jumpListData" :key="index">
+        <el-card @click="jumpweb(item.type)" :style="{ background: item.bgColor }" class="box-card-num">
+          <el-row class="box-card-row" style="margin:0">
+            <el-col :span="16" class="box_left">
+              <p class="jump_title">{{ item.name }}</p>
+            </el-col>
+            <el-col :span="8">
+              <el-image style="width:125px;height:80px" :src="item.icon" fit="cover"></el-image>
+            </el-col>
+          </el-row>
+        </el-card>
+      </el-col>
+    </el-row>
+
     <el-row :gutter="10">
       <el-col :span="24">
         <el-card class="box-bottom_bg">
           <p>平台架构图</p>
           <el-divider />
-          <el-image :src="home_5" fit="contain"></el-image>
+          <el-image class="framework" :src="home_5" fit="contain"></el-image>
         </el-card>
       </el-col>
     </el-row>
@@ -65,11 +80,18 @@
 <script setup name="Index" lang="ts">
 import { categoryList, productList, deviceList, deviceCategory,deviceStates } from '@/api/home'
 import * as echarts from 'echarts'
+import { md5Encrypt } from '@/utils/jsencrypt'
 import home_1 from '@/assets/images/home/home_1.png'
 import home_2 from '@/assets/images/home/home_2.png'
 import home_3 from '@/assets/images/home/home_3.png'
 import home_4 from '@/assets/images/home/home_4.png'
 import home_5 from '@/assets/images/home/home_5.png'
+import { getName } from '@/utils/auth'
+enum TypeApi {
+  tend = 'tend',
+  health = 'health',
+  bed = 'bed'
+}
 const deviceNum_ref = ref()
 const state = reactive({
   deviceListData: [
@@ -106,6 +128,26 @@ const state = reactive({
       name: '设备状态统计'
     }
   ],
+  jumpListData: [
+    {
+      type:TypeApi.tend,
+      name: '安全照护',
+      bgColor: 'linear-gradient(225deg, #F1F7FF 0%, #FFFFFF 36%, #FFFFFF 100%)',
+      icon: home_1
+    },
+    {
+      type:TypeApi.health,
+      name: '健康监测',
+      bgColor: 'linear-gradient(225deg, #FFF6EE 0%, #FFFFFF 36%, #FFFFFF 100%)',
+      icon: home_2
+    },
+    {
+      type:TypeApi.bed,
+      name: '数字家床',
+      bgColor: 'linear-gradient(225deg, #EEFFF5 0%, #FFFFFF 36%, #FFFFFF 100%)',
+      icon: home_3
+    }
+  ],
   pieOptionData: [],
   pieColor: [
     'rgba(255, 162, 23, 1)',
@@ -401,6 +443,29 @@ const getDataList = async () => {
 const goTarget = (url: string) => {
   window.open(url, '__blank')
 }
+const jumpweb =(type) => {
+  let md5Txt = md5Encrypt(String(getName()).toLowerCase())
+  let paraStr = `user=${getName()}&token=${md5Txt}`
+  switch (type) {
+    case TypeApi.tend:
+      {
+        window.open(`https://web.poteviohealth.com/zhylsafecase/index.html?${paraStr}`,'_blank')
+      }
+      break
+    case TypeApi.health:
+      {
+        window.open(`https://web.poteviohealth.com/r/daping/health/index.html?${paraStr}`,'_blank')
+      }
+      break
+    case TypeApi.bed:
+      {
+        window.open(`https://web.poteviohealth.com/boss/daping/data.html?${paraStr}`,'_blank')
+      }
+      break
+    default:
+      break
+  }
+}
 onMounted(() => {
   getDataList()
 })
@@ -443,6 +508,11 @@ onMounted(() => {
           font-weight: 600;
           color: #000B19;
         }
+
+        .jump_title {
+          margin-top: 40px;
+          color: #636363 !important;
+        }
       }
     }
 
@@ -563,6 +633,10 @@ onMounted(() => {
 
   .el-row:nth-of-type(3) {
     margin-top: 15px;
+  }
+
+  .el-row:nth-of-type(4) {
+    margin-top: 15px;
 
     .box-bottom_bg {
       width: 100%;
@@ -588,11 +662,6 @@ onMounted(() => {
 
 
 
-
-
-
-
-
   blockquote {
     padding: 10px 20px;
     margin: 0 0 20px;