配置后台环境变量

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

@ -2,4 +2,5 @@
NODE_ENV = 'development' NODE_ENV = 'development'
VITE_APP_TITLE = '教学一体化平台' VITE_APP_TITLE = '教学一体化平台'
VITE_APP_BASE_API = 'http://127.0.0.1:8080' VITE_APP_BASE_API = 'http://127.0.0.1:8080'
# VITE_APP_BASE_API = 'http://10.100.200.177: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' NODE_ENV = 'production'
VITE_APP_TITLE = '教学一体化平台' VITE_APP_TITLE = '教学一体化平台'
# VITE_APP_BASE_API = '/api' # 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="!flog && false ? 'tabbar' : 'tabbar-active'">
<div class="container"> <div class="container">
<div class="logo-box"> <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 class="lesson">课图</div>
</div> </div>
<div class="menu"> <div class="menu">
<ul> <ul>
<li v-for="(item, index) in constRouter[0].children" :class="{ active: settingStore.useIndex === index }" <li
v-show="!item.meta.hidden" @click="goToRouter(item, index)" :key="item.path"> 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> <div>{{ item.meta.title }}</div>
</li> </li>
<div v-if="isLogin"> <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"> <el-dropdown @command="handleCommand">
<span class="el-dropdown-link" style="color: #fff;"> <span class="el-dropdown-link" style="color: #fff">
{{ data.username }} {{ data.username }}
<el-icon class="el-icon--right"> <el-icon class="el-icon--right">
<arrow-down /> <arrow-down />
@ -28,7 +42,7 @@
</template> </template>
</el-dropdown> </el-dropdown>
</div> </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> --> <!-- <li v-if="$route.path != '/home'" @click="$router.push('/')">回到首页</li> -->
</ul> </ul>
<div class="entry"> <div class="entry">
@ -45,8 +59,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import useAdminInfoStore from '@/store/module/adminInfo' import useAdminInfoStore from '@/store/module/adminInfo'
const adminInfoStore = useAdminInfoStore() const adminInfoStore = useAdminInfoStore()
import { userGetInfoService } from '@/api/configuration'; import { userGetInfoService } from '@/api/configuration'
import useUserStore from '@/store/module/user'; import useUserStore from '@/store/module/user'
const userStore = useUserStore() const userStore = useUserStore()
import { constRouter } from '@/router/module/constRouter' import { constRouter } from '@/router/module/constRouter'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
@ -57,7 +71,7 @@ const $route = useRoute()
const settingStore = useSettingStore() const settingStore = useSettingStore()
const goToRouter = (item: any, index: number) => { const goToRouter = (item: any, index: number) => {
console.log($route); console.log($route)
settingStore.setuseIndex(index) settingStore.setuseIndex(index)
$router.push({ path: `${item.path}` }) $router.push({ path: `${item.path}` })
@ -74,19 +88,18 @@ onMounted(() => {
}) })
const isLogin = ref(false) const isLogin = ref(false)
const data = ref<any>({}) const data = ref<any>({})
userGetInfoService(userStore.token).then(res => { userGetInfoService(userStore.token).then((res) => {
// @ts-ignore // @ts-ignore
if (res.code === 200) { if (res.code === 200) {
isLogin.value = true isLogin.value = true
data.value = res.data data.value = res.data
} }
}) })
function skip(url: string) { function skip() {
// location.replace(url) // location.replace(url)
window.open(url) window.open(import.meta.env.VITE_ADMIN_URL)
} }
// 退 // 退
function logout() { function logout() {
isLogin.value = false isLogin.value = false

Loading…
Cancel
Save