-
-
+
+
-
-
+
+
@@ -287,6 +259,7 @@ onMounted(() => {
* {
box-sizing: border-box;
}
+
.nav {
height: 92px;
background: #ffffff;
@@ -298,6 +271,7 @@ onMounted(() => {
justify-content: center;
align-items: center;
}
+
.classList,
.info {
// background-color: yellow;
@@ -309,10 +283,12 @@ onMounted(() => {
align-items: center;
margin-bottom: 16px;
}
+
.classList {
display: flex;
justify-content: space-between;
}
+
.lesson {
padding-top: 30px;
// padding-bottom: 30px;
@@ -326,6 +302,7 @@ onMounted(() => {
text-overflow: ellipsis;
// flex-direction: column;
}
+
.con {
display: flex;
// justify-content: space-between;
@@ -340,6 +317,7 @@ onMounted(() => {
justify-content: space-evenly;
padding-bottom: 30px;
}
+
.contt {
// background-color: yellow;
padding: 5px;
@@ -348,9 +326,11 @@ onMounted(() => {
// grid-template-columns: repeat(2, 1fr);
// grid-gap: 11px;
}
+
:deep(.el-scrollbar__wrap) {
padding: 0;
}
+
.button {
justify-content: space-between;
@@ -367,13 +347,16 @@ onMounted(() => {
text-overflow: ellipsis;
white-space: nowrap;
}
+
.button :hover {
overflow: visible;
white-space: normal;
}
+
a {
text-decoration: none;
}
+
.some,
.stu {
padding-top: 5px;
@@ -387,6 +370,7 @@ a {
justify-content: center;
align-items: center;
}
+
// .lessonlist-content {
// display: flex;
// justify-content: center;
@@ -417,12 +401,14 @@ ul {
justify-content: space-between;
// align-items: center;
}
+
.lessonlist-item-img {
width: 17%;
height: 40px;
justify-content: center;
align-items: center;
}
+
.lessonlist-item-info {
margin-left: 15px;
width: 80%;
@@ -432,11 +418,13 @@ ul {
// flex-direction: column;
justify-content: space-between;
align-items: center;
+
h5 {
// font-weight: bold;
width: 80%;
text-align: center;
}
+
p {
font-size: small;
width: 20%;
diff --git a/teaching_integration_platform_admin_template/src/views/login/index.vue b/teaching_integration_platform_admin_template/src/views/login/index.vue
index 287fda9..0b3dd63 100644
--- a/teaching_integration_platform_admin_template/src/views/login/index.vue
+++ b/teaching_integration_platform_admin_template/src/views/login/index.vue
@@ -406,12 +406,16 @@ const login = async () => {
isBtnLoading.value = false
$router.push('/curriculumCenter/basicCourseInformation')
channel.postMessage('')
+
+
if ($route.query.redirect) {
$router.push($route.query.redirect as string)
channel.postMessage('')
+
} else {
$router.push('/')
channel.postMessage('')
+
}
})
} catch (error) {
@@ -433,12 +437,15 @@ const phoneLogin = async () => {
isBtnLoading.value = false
$router.push('/curriculumCenter/basicCourseInformation')
channel.postMessage('')
+
if ($route.query.redirect) {
$router.push($route.query.redirect as string)
channel.postMessage('')
+
} else {
$router.push('/')
channel.postMessage('')
+
}
})
.catch((error) => {
diff --git a/teaching_integration_platform_admin_template/vite.config.ts b/teaching_integration_platform_admin_template/vite.config.ts
index 5b2293c..2d49151 100644
--- a/teaching_integration_platform_admin_template/vite.config.ts
+++ b/teaching_integration_platform_admin_template/vite.config.ts
@@ -20,6 +20,9 @@ export default ({ command }: any) => {
symbolId: 'icon-[dir]-[name]',
}),
],
+ server: {
+ host: '0.0.0.0',
+ },
resolve: {
alias: {
'@': path.resolve('./src'), // 相对路径别名配置,使用 @ 代替 src
diff --git a/teaching_integration_platform_template/.env.development b/teaching_integration_platform_template/.env.development
index 6692c9c..dcb1be4 100644
--- a/teaching_integration_platform_template/.env.development
+++ b/teaching_integration_platform_template/.env.development
@@ -1,5 +1,6 @@
# 变量必须以 VITE_ 为前缀才能暴露给外部读取
NODE_ENV = 'development'
VITE_APP_TITLE = '教学一体化平台'
-# VITE_APP_BASE_API = 'http://127.0.0.1:8080'
-VITE_APP_BASE_API = 'http://39.106.16.162:8080'
\ No newline at end of file
+VITE_APP_BASE_API = 'http://127.0.0.1:8080'
+VITE_APP_OTHER_ORIGIN = 'http://127.0.0.1:5173'
+# VITE_APP_BASE_API = 'http://39.106.16.162:8080'
\ No newline at end of file
diff --git a/teaching_integration_platform_template/.env.production b/teaching_integration_platform_template/.env.production
index 0a20fe4..a3dd5a6 100644
--- a/teaching_integration_platform_template/.env.production
+++ b/teaching_integration_platform_template/.env.production
@@ -1,3 +1,4 @@
NODE_ENV = 'production'
VITE_APP_TITLE = '教学一体化平台'
+VITE_APP_OTHER_ORIGIN = 'http://39.106.16.162:5173'
# VITE_APP_BASE_API = '/api'
\ No newline at end of file
diff --git a/teaching_integration_platform_template/src/App.vue b/teaching_integration_platform_template/src/App.vue
index d31088e..ca321d5 100644
--- a/teaching_integration_platform_template/src/App.vue
+++ b/teaching_integration_platform_template/src/App.vue
@@ -3,7 +3,7 @@
diff --git a/teaching_integration_platform_template/src/Layout/tabbar/index.vue b/teaching_integration_platform_template/src/Layout/tabbar/index.vue
index 83a5552..bb3ee87 100644
--- a/teaching_integration_platform_template/src/Layout/tabbar/index.vue
+++ b/teaching_integration_platform_template/src/Layout/tabbar/index.vue
@@ -12,11 +12,12 @@
v-show="!item.meta.hidden" @click="goToRouter(item, index)" :key="item.path">
{{ item.meta.title }}
-
-
+
+
- {{ data.username }}
+ {{ userStore.userInfo.username }}
@@ -28,7 +29,8 @@
-
登录注册
+
登录注册
+
@@ -50,7 +52,7 @@ import useUserStore from '@/store/module/user';
const userStore = useUserStore()
import { constRouter } from '@/router/module/constRouter'
import { useRouter, useRoute } from 'vue-router'
-import { onMounted, ref } from 'vue'
+import { computed, onMounted, ref } from 'vue'
import useSettingStore from '@/store/module/setting'
const $router = useRouter()
const $route = useRoute()
@@ -72,23 +74,38 @@ onMounted(() => {
}
})
})
-const isLogin = ref(false)
-const data = ref
({})
-userGetInfoService(userStore.token).then(res => {
- // @ts-ignore
- if (res.code === 200) {
- isLogin.value = true
- data.value = res.data
- }
-})
function skip(url: string) {
location.assign(url)
}
+// ========================
+let otherWin: any = null;
+function send() {
+ if (otherWin) {
+ otherWin.focus();
+ return
+ }
+ otherWin = window.open(import.meta.env.VITE_APP_OTHER_ORIGIN)
+
+}
+window.onmessage = e => {
+ if (e.origin === import.meta.env.VITE_APP_OTHER_ORIGIN) {
+ userStore.setToken(e.data)
+ userStore.setUserInfo()
+ }
+}
+// ========================
// 退出登录
function logout() {
- isLogin.value = false
+ try {
+ otherWin.postMessage('logout', import.meta.env.VITE_APP_OTHER_ORIGIN)
+ } catch (error) {
+ send()
+ setTimeout(() => {
+ otherWin.postMessage('logout', import.meta.env.VITE_APP_OTHER_ORIGIN)
+ }, 500)
+ }
}
const handleCommand = (command: string) => {
switch (command) {
diff --git a/teaching_integration_platform_template/src/store/module/user.ts b/teaching_integration_platform_template/src/store/module/user.ts
index 55aa1d9..c2932c6 100644
--- a/teaching_integration_platform_template/src/store/module/user.ts
+++ b/teaching_integration_platform_template/src/store/module/user.ts
@@ -4,21 +4,39 @@ import { ref, reactive } from 'vue'
const userStore = defineStore('userStore', () => {
const userInfo = reactive({})
const isLogin = ref(false)
- const token = ref('')
+ const token = ref(localStorage.getItem('TOKEN') || '')
const verifyToken = () => { }
-
- userGetInfoService(token.value).then(res => {
- // @ts-ignore
- if (res.code === 200) {
- Object.assign(userInfo, res.data)
- isLogin.value = true
+ const clearUserInfo = () => {
+ Object.keys(userInfo).forEach(function (prop) {
+ delete userInfo[prop];
+ });
+ }
+ const setToken = (data: string) => {
+ token.value = data
+ localStorage.setItem('TOKEN', data)
+ }
+ const setUserInfo = async () => {
+ try {
+ const res = await userGetInfoService(token.value)
+ // @ts-ignore
+ if (res.code === 200) {
+ Object.assign(userInfo, res.data)
+ isLogin.value = true
+ } else isLogin.value = false
+ } catch (error) {
+ isLogin.value = false
+ clearUserInfo()
}
- })
+ }
+ setUserInfo()
return {
token,
+ setToken,
userInfo,
isLogin,
- verifyToken
+ verifyToken,
+ setUserInfo,
+ clearUserInfo
}
})
export default userStore