丸子 9 months ago
parent
commit
bd065223bb
8 changed files with 93 additions and 25 deletions
  1. 25 8
      package-lock.json
  2. 1 0
      package.json
  3. 2 0
      src/main.js
  4. 18 0
      src/store/index.js
  5. 24 13
      src/views/AILaboratory.vue
  6. 16 1
      src/views/AIPainting.vue
  7. 4 1
      src/views/AIQuestions.vue
  8. 3 2
      src/views/Login.vue

+ 25 - 8
package-lock.json

@@ -19,6 +19,7 @@
         "router": "^2.2.0",
         "router": "^2.2.0",
         "vue": "^3.5.17",
         "vue": "^3.5.17",
         "vue-router": "^4.5.1",
         "vue-router": "^4.5.1",
+        "vuex": "^4.0.2",
         "web-storage-cache": "^1.1.1"
         "web-storage-cache": "^1.1.1"
       },
       },
       "devDependencies": {
       "devDependencies": {
@@ -3584,6 +3585,12 @@
       "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
       "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
       "license": "MIT"
       "license": "MIT"
     },
     },
+    "node_modules/jsencrypt": {
+      "version": "3.3.2",
+      "resolved": "https://registry.npmjs.org/jsencrypt/-/jsencrypt-3.3.2.tgz",
+      "integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==",
+      "license": "MIT"
+    },
     "node_modules/jsesc": {
     "node_modules/jsesc": {
       "version": "3.1.0",
       "version": "3.1.0",
       "resolved": "https://registry.npmmirror.com/jsesc/-/jsesc-3.1.0.tgz",
       "resolved": "https://registry.npmmirror.com/jsesc/-/jsesc-3.1.0.tgz",
@@ -3608,13 +3615,6 @@
         "node": ">=6"
         "node": ">=6"
       }
       }
     },
     },
-
-    "node_modules/jsencrypt": {
-      "version": "3.3.2",
-      "resolved": "https://registry.npmjs.org/jsencrypt/-/jsencrypt-3.3.2.tgz",
-      "integrity": "sha512-arQR1R1ESGdAxY7ZheWr12wCaF2yF47v5qpB76TtV64H1pyGudk9Hvw8Y9tb/FiTIaaTRUyaSnm5T/Y53Ghm/A==",
-      "license": "MIT"
-    },
     "node_modules/linkify-it": {
     "node_modules/linkify-it": {
       "version": "5.0.0",
       "version": "5.0.0",
       "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
       "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
@@ -4407,12 +4407,29 @@
         "vue": "^3.2.0"
         "vue": "^3.2.0"
       }
       }
     },
     },
-
+    "node_modules/vuex": {
+      "version": "4.0.2",
+      "resolved": "https://registry.npmmirror.com/vuex/-/vuex-4.0.2.tgz",
+      "integrity": "sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==",
+      "license": "MIT",
+      "dependencies": {
+        "@vue/devtools-api": "^6.0.0-beta.11"
+      },
+      "peerDependencies": {
+        "vue": "^3.0.2"
+      }
+    },
     "node_modules/web-storage-cache": {
     "node_modules/web-storage-cache": {
       "version": "1.1.1",
       "version": "1.1.1",
       "resolved": "https://registry.npmjs.org/web-storage-cache/-/web-storage-cache-1.1.1.tgz",
       "resolved": "https://registry.npmjs.org/web-storage-cache/-/web-storage-cache-1.1.1.tgz",
       "integrity": "sha512-D0MieGooOs8RpsrK+vnejXnvh4OOv/+lTFB35JRkJJQt+uOjPE08XpaE0QBLMTRu47B1KGT/Nq3Gbag3Orinzw==",
       "integrity": "sha512-D0MieGooOs8RpsrK+vnejXnvh4OOv/+lTFB35JRkJJQt+uOjPE08XpaE0QBLMTRu47B1KGT/Nq3Gbag3Orinzw==",
       "license": "MIT"
       "license": "MIT"
+    },
+    "node_modules/yallist": {
+      "version": "3.1.1",
+      "resolved": "https://registry.npmmirror.com/yallist/-/yallist-3.1.1.tgz",
+      "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
+      "license": "ISC"
     }
     }
   }
   }
 }
 }

+ 1 - 0
package.json

@@ -20,6 +20,7 @@
     "router": "^2.2.0",
     "router": "^2.2.0",
     "vue": "^3.5.17",
     "vue": "^3.5.17",
     "vue-router": "^4.5.1",
     "vue-router": "^4.5.1",
+    "vuex": "^4.0.2",
     "web-storage-cache": "^1.1.1"
     "web-storage-cache": "^1.1.1"
   },
   },
   "devDependencies": {
   "devDependencies": {

+ 2 - 0
src/main.js

@@ -4,8 +4,10 @@ import ElementPlus from 'element-plus'
 import 'element-plus/dist/index.css'
 import 'element-plus/dist/index.css'
 import App from './App.vue'
 import App from './App.vue'
 import router from './router'
 import router from './router'
+import store from './store'
 
 
 const app = createApp(App)
 const app = createApp(App)
 app.use(ElementPlus)
 app.use(ElementPlus)
 app.use(router)
 app.use(router)
+app.use(store)
 app.mount('#app')
 app.mount('#app')

+ 18 - 0
src/store/index.js

@@ -0,0 +1,18 @@
+import { createStore } from 'vuex'
+
+export default createStore({
+  state: {
+    tenantId: null
+  },
+  mutations: {
+    setTenantId(state, tenantId) {
+      state.tenantId = tenantId
+    }
+  },
+  actions: {
+    // 可以添加异步操作来获取 tenantId
+  },
+  getters: {
+    getTenantId: state => state.tenantId
+  }
+})

+ 24 - 13
src/views/AILaboratory.vue

@@ -87,9 +87,10 @@ const toggleDrawer = () => {
   drawerVisible.value = !drawerVisible.value
   drawerVisible.value = !drawerVisible.value
 }
 }
 
 
+
 // 返回上一页
 // 返回上一页
 const goBack = () => {
 const goBack = () => {
-  router.go(-1)
+  router.push('/home')
 }
 }
 // 引入
 // 引入
 import NumberPeople00 from '@/assets/images/xiaozhi.png'
 import NumberPeople00 from '@/assets/images/xiaozhi.png'
@@ -115,13 +116,13 @@ const navigateToAIQuestions = person => {
     path: '/ai-questions', 
     path: '/ai-questions', 
     query: {  id: person.id, name: person.name, image: person.image, message: person.message }
     query: {  id: person.id, name: person.name, image: person.image, message: person.message }
   }); 
   }); 
-};
+}; 
 
 
 // 跳转智能问答
 // 跳转智能问答
-const navigateToAI = (group) => {
+const navigateToAI = (group) => { 
   if (group.title === "智能问答") {
   if (group.title === "智能问答") {
     let person = { id: 10, name: '小智', image: NumberPeople00, message: '您好,我是您的AI智能助手小智,我会尽力回答您的问题或提供有用的建议!!!!'  };
     let person = { id: 10, name: '小智', image: NumberPeople00, message: '您好,我是您的AI智能助手小智,我会尽力回答您的问题或提供有用的建议!!!!'  };
-    router.push({
+    router.push({ 
       // 跳转问答页面
       // 跳转问答页面
       path: '/ai-questions',
       path: '/ai-questions',
       query: {  id: person.id, name: person.name, image: person.image, message: person.message }
       query: {  id: person.id, name: person.name, image: person.image, message: person.message }
@@ -130,6 +131,9 @@ const navigateToAI = (group) => {
   if (group.title === "智能绘画") {
   if (group.title === "智能绘画") {
     router.push('/ai-painting')
     router.push('/ai-painting')
   }
   }
+  if (group.title === '数字人老师') {
+    router.push('/ai-laboratory') // 添加跳转到AI实验室的逻辑
+  }
 }
 }
 
 
 // 渲染侧边栏
 // 渲染侧边栏
@@ -179,7 +183,7 @@ const groupList = ref([
     to bottom,
     to bottom,
     #e2ddfc,
     #e2ddfc,
     #f1effd
     #f1effd
-  ); /* 设置悬停、聚焦、点击状态下的背景色 */
+  );
 }
 }
 
 
 .icon-expand {
 .icon-expand {
@@ -187,7 +191,7 @@ const groupList = ref([
   height: rpx(30);
   height: rpx(30);
   z-index: 9999;
   z-index: 9999;
   position: absolute;
   position: absolute;
-  cursor: pointer; // 添加鼠标指针样式
+  cursor: pointer;
 }
 }
 .icon-expand .el-icon {
 .icon-expand .el-icon {
   font-size: rpx(15);
   font-size: rpx(15);
@@ -230,30 +234,37 @@ const groupList = ref([
   color: white;
   color: white;
 }
 }
 
 
-.el-menu ::v-deep(.el-menu-item:hover),
-.el-menu ::v-deep(.el-menu-item:focus),
-.el-menu ::v-deep(.el-menu-item:active){
+.el-menu ::v-deep(.el-menu-item:hover){
   background: linear-gradient(
   background: linear-gradient(
     to bottom,
     to bottom,
     #ffefb0,
     #ffefb0,
     #ffcc00
     #ffcc00
-  ); /* 设置悬停、聚焦、点击状态下的背景色 */
+  );
+  box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
+  color: black;
+  font-size: rpx(8);
+}
+.el-menu-vertical-demo .el-menu-item.is-active {
+   background: linear-gradient(
+    to bottom,
+    #ffefb0,
+    #ffcc00
+  );
   box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
   box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
   color: black;
   color: black;
   font-size: rpx(8);
   font-size: rpx(8);
 }
 }
-
 // 右侧数字人内容
 // 右侧数字人内容
 .number-people {
 .number-people {
   flex: 1;
   flex: 1;
   height: 100%;
   height: 100%;
   display: flex;
   display: flex;
-  flex-direction: column; /* 子元素上下排列 */
+  flex-direction: column; 
   background: linear-gradient(
   background: linear-gradient(
     to bottom,
     to bottom,
     #e2ddfc,
     #e2ddfc,
     #f1effd
     #f1effd
-  ); /* 设置悬停、聚焦、点击状态下的背景色 */
+  );
 }
 }
 // 标题样式
 // 标题样式
 .title-box {
 .title-box {

+ 16 - 1
src/views/AIPainting.vue

@@ -176,6 +176,7 @@ import demo1 from '@/assets/images/ai-demo/ai-image-demo1.png'
 import demo2 from '@/assets/images/ai-demo/ai-image-demo2.png'
 import demo2 from '@/assets/images/ai-demo/ai-image-demo2.png'
 import demo3 from '@/assets/images/ai-demo/ai-image-demo3.png'
 import demo3 from '@/assets/images/ai-demo/ai-image-demo3.png'
 import demo4 from '@/assets/images/ai-demo/ai-image-demo4.png'
 import demo4 from '@/assets/images/ai-demo/ai-image-demo4.png'
+import NumberPeople00 from '@/assets/images/xiaozhi.png'
 import {
 import {
   Document,
   Document,
   Menu as IconMenu,
   Menu as IconMenu,
@@ -192,7 +193,7 @@ import {
 } from '@element-plus/icons-vue'
 } from '@element-plus/icons-vue'
 // 返回上一页
 // 返回上一页
 const goBack = () => {
 const goBack = () => {
-  router.go(-1)
+  router.push('/ai-laboratory')
 }
 }
 const router = useRouter()
 const router = useRouter()
 const route = useRoute()
 const route = useRoute()
@@ -217,6 +218,9 @@ const navigateToAI = (group) => {
   if (group.title === "智能绘画") {
   if (group.title === "智能绘画") {
     router.push('/ai-painting')
     router.push('/ai-painting')
   }
   }
+  if (group.title === '数字人老师') {
+    router.push('/ai-laboratory') // 添加跳转到AI实验室的逻辑
+  }
 }
 }
 
 
 // 渲染侧边栏
 // 渲染侧边栏
@@ -448,6 +452,17 @@ const inProgressTimerFun = () => {
   color: black;
   color: black;
   font-size: rpx(8);
   font-size: rpx(8);
 }
 }
+.el-menu-vertical-demo .el-menu-item.is-active {
+  /* 可根据需求修改选中样式 */
+  background: linear-gradient(
+    to bottom,
+    #ffefb0,
+    #ffcc00
+  ); /* 设置悬停、聚焦、点击状态下的背景色 */
+  box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
+  color: black;
+  font-size: rpx(8);
+}
 
 
 // 侧边栏
 // 侧边栏
 .left-group2 {
 .left-group2 {

+ 4 - 1
src/views/AIQuestions.vue

@@ -142,6 +142,9 @@ const navigateToAI = group => {
   if (group.title === '智能绘画') {
   if (group.title === '智能绘画') {
     router.push('/ai-painting')
     router.push('/ai-painting')
   }
   }
+  if (group.title === '数字人老师') {
+    router.push('/ai-laboratory') // 添加跳转到AI实验室的逻辑
+  }
 }
 }
 // 处理菜单展开和关闭
 // 处理菜单展开和关闭
 const handleOpen = () => {}
 const handleOpen = () => {}
@@ -149,7 +152,7 @@ const handleClose = () => {}
 
 
 // 返回上一页
 // 返回上一页
 const goBack = () => {
 const goBack = () => {
-  router.go(-1)
+   router.push('/ai-laboratory')
 }
 }
 const router = useRouter()
 const router = useRouter()
 const route = useRoute()
 const route = useRoute()

+ 3 - 2
src/views/Login.vue

@@ -91,6 +91,7 @@ const getTenantId = async () => {
   if (loginData.value.tenantEnable === true) {
   if (loginData.value.tenantEnable === true) {
     try {
     try {
       const res = await getTenantIdByName(loginData.value.loginForm.tenantName)
       const res = await getTenantIdByName(loginData.value.loginForm.tenantName)
+      console.log(res);
       if (res && res.data) {
       if (res && res.data) {
         //记录租户id
         //记录租户id
         tenantId.value = res.data
         tenantId.value = res.data
@@ -126,7 +127,6 @@ const handleLogin = async params => {
         if (!res) {
         if (!res) {
           return
           return
         }
         }
-
         //【补充】校验登录状态
         //【补充】校验登录状态
         //成功-失败-提示文字
         //成功-失败-提示文字
         // 校验登录状态,返回数据中 code 为 200 表示成功
         // 校验登录状态,返回数据中 code 为 200 表示成功
@@ -144,7 +144,6 @@ const handleLogin = async params => {
             text: '正在加载系统中...',
             text: '正在加载系统中...',
             background: 'rgba(0, 0, 0, 0.7)'
             background: 'rgba(0, 0, 0, 0.7)'
           })
           })
-
           // 登录成功后,跳转到指定的页面
           // 登录成功后,跳转到指定的页面
           router.push('/home')
           router.push('/home')
         } else {
         } else {
@@ -171,6 +170,8 @@ onMounted(() => {
     router.push('/home')
     router.push('/home')
   }
   }
 })
 })
+
+
 </script>
 </script>
 
 
 <style scoped lang="scss">
 <style scoped lang="scss">