s
This commit is contained in:
parent
1a12c62b7a
commit
9293c7d456
5
.env
5
.env
@ -1,8 +1,9 @@
|
||||
# Glob API URL
|
||||
VITE_GLOB_API_URL=/api
|
||||
|
||||
VITE_APP_API_BASE_URL=https://erpapi.fontree.cn
|
||||
|
||||
VITE_APP_API_BASE_URL=http://114.218.158.24:9020
|
||||
https://erpapi.fontree.cn #正式
|
||||
http://114.218.158.24:9020#测试
|
||||
# Whether long replies are supported, which may result in higher API fees
|
||||
VITE_GLOB_OPEN_LONG_REPLY=true
|
||||
|
||||
|
@ -13,12 +13,12 @@
|
||||
<body class="dark:bg-black">
|
||||
<div id="app">
|
||||
<style>
|
||||
.loading-wrap {
|
||||
/* .loading-wrap {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
}*/
|
||||
|
||||
.balls {
|
||||
width: 4em;
|
||||
@ -69,13 +69,13 @@
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="loading-wrap">
|
||||
<!-- <div class="loading-wrap">
|
||||
<div class="balls">
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
</div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
</body>
|
||||
|
13
src/App.vue
13
src/App.vue
@ -1,4 +1,4 @@
|
||||
<script setup lang="ts">
|
||||
<script setup >
|
||||
import { NConfigProvider } from 'naive-ui'
|
||||
import { NaiveProvider } from '@/components/common'
|
||||
import { useTheme } from '@/hooks/useTheme'
|
||||
@ -7,8 +7,15 @@ import zhCN from 'ant-design-vue/es/locale/zh_CN';
|
||||
|
||||
const { theme } = useTheme()
|
||||
const { language } = useLanguage()
|
||||
import { GlobalThemeOverrides } from 'naive-ui'
|
||||
const themeOverrides: GlobalThemeOverrides = {
|
||||
import {Local} from './utils/storage/storage.js'
|
||||
const props = window.$wujie?.props;
|
||||
if (props){
|
||||
Local.set('token',props.token)
|
||||
Local.set('mode',props.mode)
|
||||
Local.set('userInfo',props.userInfo)
|
||||
Local.set('isGPT4',props.isGPT4)
|
||||
}
|
||||
const themeOverrides = {
|
||||
common: {
|
||||
primaryColorHover:'#764CF6',
|
||||
primaryColor:'#764CF6'
|
||||
|
@ -8,6 +8,7 @@ import Antd from "ant-design-vue";
|
||||
import "ant-design-vue/dist/reset.css";
|
||||
import ElementPlus from 'element-plus'
|
||||
import 'element-plus/dist/index.css'
|
||||
|
||||
async function bootstrap() {
|
||||
const app = createApp(App)
|
||||
setupAssets()
|
||||
@ -17,10 +18,10 @@ async function bootstrap() {
|
||||
setupStore(app)
|
||||
setupI18n(app)
|
||||
await setupRouter(app)
|
||||
// 子页面中
|
||||
|
||||
app.mount('#app')
|
||||
}
|
||||
const origins=['https://erp.fontree.cn','http://172.16.100.93:9010']
|
||||
/* const origins=['https://erp.fontree.cn','http://172.16.100.93:9010']
|
||||
window.addEventListener('message', function(event) {
|
||||
if (origins.includes(event.origin)){
|
||||
localStorage.setItem('token',event.data.token)
|
||||
@ -28,5 +29,5 @@ window.addEventListener('message', function(event) {
|
||||
localStorage.setItem('userInfo',JSON.stringify(event.data.userInfo))
|
||||
localStorage.setItem('isGPT4',event.data.isGPT4)
|
||||
}
|
||||
});
|
||||
}); */
|
||||
bootstrap()
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
import axios from "axios";
|
||||
import { ElLoading } from 'element-plus'
|
||||
import {Local} from '@/utils/storage/storage.js'
|
||||
const request = axios.create({
|
||||
baseURL:import.meta.env.VITE_APP_API_BASE_URL,
|
||||
timeout:5000
|
||||
@ -12,7 +13,7 @@ loading=ElLoading.service({
|
||||
text: '加载中',
|
||||
background: 'rgba(0, 0, 0, 0.7)',
|
||||
})
|
||||
config.headers.Authorization =localStorage.getItem('token')
|
||||
config.headers.Authorization =Local.get('token')
|
||||
return config;
|
||||
});
|
||||
request.interceptors.response.use((res)=>{
|
||||
|
53
src/utils/storage/storage.js
Normal file
53
src/utils/storage/storage.js
Normal file
@ -0,0 +1,53 @@
|
||||
/**
|
||||
* window.localStorage 浏览器永久缓存
|
||||
* @method set 设置永久缓存
|
||||
* @method get 获取永久缓存
|
||||
* @method remove 移除永久缓存
|
||||
* @method clear 移除全部永久缓存
|
||||
*/
|
||||
export const Local = {
|
||||
// 设置永久缓存
|
||||
set(key, val) {
|
||||
window.localStorage.setItem(key, JSON.stringify(val));
|
||||
},
|
||||
// 获取永久缓存
|
||||
get(key) {
|
||||
let json = window.localStorage.getItem(key);
|
||||
return JSON.parse(json);
|
||||
},
|
||||
// 移除永久缓存
|
||||
remove(key) {
|
||||
window.localStorage.removeItem(key);
|
||||
},
|
||||
// 移除全部永久缓存
|
||||
clear() {
|
||||
window.localStorage.clear();
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* window.sessionStorage 浏览器临时缓存
|
||||
* @method set 设置临时缓存
|
||||
* @method get 获取临时缓存
|
||||
* @method remove 移除临时缓存
|
||||
* @method clear 移除全部临时缓存
|
||||
*/
|
||||
export const Session = {
|
||||
// 设置临时缓存
|
||||
set(key, val) {
|
||||
window.sessionStorage.setItem(key, JSON.stringify(val));
|
||||
},
|
||||
// 获取临时缓存
|
||||
get(key) {
|
||||
let json = window.sessionStorage.getItem(key);
|
||||
return JSON.parse(json);
|
||||
},
|
||||
// 移除临时缓存
|
||||
remove(key) {
|
||||
window.sessionStorage.removeItem(key);
|
||||
},
|
||||
// 移除全部临时缓存
|
||||
clear() {
|
||||
window.sessionStorage.clear();
|
||||
},
|
||||
};
|
@ -1,5 +1,6 @@
|
||||
<script setup >
|
||||
import {uploadFormData, uploadImg} from "@/api/api";
|
||||
import {Local} from "@/utils/storage/storage";
|
||||
import dayjs from "dayjs";
|
||||
import { computed, onMounted, onUnmounted, ref,watch } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
@ -45,7 +46,6 @@ dataSources.value.forEach((item, index) => {
|
||||
if (item.loading)
|
||||
updateChatSome(+uuid, index, { loading: false })
|
||||
})
|
||||
|
||||
function handleSubmit() {
|
||||
dataSources.value.push({
|
||||
dateTime: dayjs().format('YYYY/MM/DD HH:mm:ss'),
|
||||
@ -138,7 +138,7 @@ const sendDataStream = async () => {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/json",
|
||||
Authorization: localStorage.getItem('token'),
|
||||
Authorization: Local.get('token'),
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user