配置后台环境变量

develoop
JayChou 2 weeks ago
parent 2c6924f501
commit 1069809d06
  1. 1
      .env.development
  2. 1
      .env.production
  3. 39
      src/Layout/tabbar/index.vue

@ -3,3 +3,4 @@ NODE_ENV = 'development'
VITE_APP_TITLE = '教学一体化平台'
VITE_APP_BASE_API = 'http://127.0.0.1:8080'
# VITE_APP_BASE_API = 'http://10.100.200.177:8080'
VITE_ADMIN_URL = 'http://127.0.0.1:8080'

@ -1,3 +1,4 @@
NODE_ENV = 'production'
VITE_APP_TITLE = '教学一体化平台'
# VITE_APP_BASE_API = '/api'
VITE_ADMIN_URL = 'http://127.0.0.1:8080'

@ -2,20 +2,34 @@
<div :class="!flog && false ? 'tabbar' : 'tabbar-active'">
<div class="container">
<div class="logo-box">
<div class="logo"><img :src="adminInfoStore.info.logo"></div>
<div class="logo"><img :src="adminInfoStore.info.logo" /></div>
<div class="lesson">课图</div>
</div>
<div class="menu">
<ul>
<li v-for="(item, index) in constRouter[0].children" :class="{ active: settingStore.useIndex === index }"
v-show="!item.meta.hidden" @click="goToRouter(item, index)" :key="item.path">
<li
v-for="(item, index) in constRouter[0].children"
:class="{ active: settingStore.useIndex === index }"
v-show="!item.meta.hidden"
@click="goToRouter(item, index)"
:key="item.path"
>
<div>{{ item.meta.title }}</div>
</li>
<div v-if="isLogin">
<img :src="data.icon" alt="" style="width: 24px; height: 24px; margin: 0 10px; border-radius: 50%" />
<img
:src="data.icon"
alt=""
style="
width: 24px;
height: 24px;
margin: 0 10px;
border-radius: 50%;
"
/>
<el-dropdown @command="handleCommand">
<span class="el-dropdown-link" style="color: #fff;">
<span class="el-dropdown-link" style="color: #fff">
{{ data.username }}
<el-icon class="el-icon--right">
<arrow-down />
@ -28,7 +42,7 @@
</template>
</el-dropdown>
</div>
<li v-else @click="skip('http://localhost:8888/')">登录注册</li>
<li v-else @click="skip">登录注册</li>
<!-- <li v-if="$route.path != '/home'" @click="$router.push('/')">回到首页</li> -->
</ul>
<div class="entry">
@ -45,8 +59,8 @@
<script lang="ts" setup>
import useAdminInfoStore from '@/store/module/adminInfo'
const adminInfoStore = useAdminInfoStore()
import { userGetInfoService } from '@/api/configuration';
import useUserStore from '@/store/module/user';
import { userGetInfoService } from '@/api/configuration'
import useUserStore from '@/store/module/user'
const userStore = useUserStore()
import { constRouter } from '@/router/module/constRouter'
import { useRouter, useRoute } from 'vue-router'
@ -57,7 +71,7 @@ const $route = useRoute()
const settingStore = useSettingStore()
const goToRouter = (item: any, index: number) => {
console.log($route);
console.log($route)
settingStore.setuseIndex(index)
$router.push({ path: `${item.path}` })
@ -74,19 +88,18 @@ onMounted(() => {
})
const isLogin = ref(false)
const data = ref<any>({})
userGetInfoService(userStore.token).then(res => {
userGetInfoService(userStore.token).then((res) => {
// @ts-ignore
if (res.code === 200) {
isLogin.value = true
data.value = res.data
}
})
function skip(url: string) {
function skip() {
// location.replace(url)
window.open(url)
window.open(import.meta.env.VITE_ADMIN_URL)
}
// 退
function logout() {
isLogin.value = false

Loading…
Cancel
Save