部署到 cf

This commit is contained in:
ivamp 2023-12-10 23:48:54 +08:00
parent b4ae8d70c0
commit 62355d8a1d
6 changed files with 24 additions and 94 deletions

16
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,16 @@
stages:
- build_and_deploy
node-build:
image: node:20
stage: build_and_deploy
script:
- yarn config set registry https://registry.npm.taobao.org/
- yarn install
- yarn run build
- yarn add wrangler -g
- echo n | npx wrangler pages deploy dist --project-name=document-web
artifacts:
paths:
- dist

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Welcome to Vuetify 3</title>
<title>资料库</title>
</head>
<body>

View File

@ -3,51 +3,15 @@ import { DocumentsApi, Configuration, LibrariesApi } from "../openapi";
// import axios from "axios";
// import router from "@/router";
import {useUserStore} from "@/store/user";
// // const config = useConfigStore()
// import config from "@/plugins/config"
import { useConfigStore } from "@/store/config";
// instance.interceptors.request.use(
// (config) => {
// if (config.headers === undefined) {
// // config.headers = {};
// }
// config.headers["Accept"] = "application/json";
// // @ts-ignore
// if (process.env.NODE_ENV === "development") {
// // user.jwt_token 取中间
// config.headers["X-Jwt-Payload"] = user.jwt_token?.split(".")[1]
// } else {
// config.headers["Authorization"] = "Bearer " + user.jwt_token;
// }
// return config;
// },
// (error) => {
// console.error("axios request error", error);
// return Promise.reject(error);
// }
// );
// instance.interceptors.response.use(
// (res) => {
// return Promise.resolve(res);
// },
// (error) => {
// console.error("axios response error", error);
// return Promise.reject(error);
// }
// );
// export default instance;
const userStore = useUserStore()
const configStore = useConfigStore()
const conf = new Configuration
conf.basePath = "https://document.awa.im/api"
conf.basePath = configStore.apiServer
conf.apiKey = "Bearer " + userStore.jwt_token
const document = new DocumentsApi(conf);
const library = new LibrariesApi(conf);

View File

@ -1,52 +0,0 @@
import axios from "axios";
// import router from "@/router";
// import {useUserStore} from "@/stores/user";
// // const config = useConfigStore()
// import config from "@/plugins/config"
let axios_config = {
baseURL: config.baseUrl,
timeout: 100000,
}
// 实例
let instance = axios.create(axios_config);
instance.interceptors.request.use(
(config) => {
if (config.headers === undefined) {
// config.headers = {};
}
const user = useUserStore()
config.headers["Accept"] = "application/json";
// @ts-ignore
if (process.env.NODE_ENV === "development") {
// user.jwt_token 取中间
config.headers["X-Jwt-Payload"] = user.jwt_token?.split(".")[1]
} else {
config.headers["Authorization"] = "Bearer " + user.jwt_token;
}
return config;
},
(error) => {
console.error("axios request error", error);
return Promise.reject(error);
}
);
instance.interceptors.response.use(
(res) => {
return Promise.resolve(res);
},
(error) => {
console.error("axios response error", error);
return Promise.reject(error);
}
);
export default instance;

View File

@ -5,7 +5,8 @@ export const useConfigStore = defineStore('app', {
state: () => ({
appName: "资料库",
description: "Leaf Library",
accountServer: "https://httpbin.awa.im",
accountServer: "https://oauth.leaflow.cn",
apiServer: "https://document-api.leaflow.cn/api",
}),
actions: {
getAppName(): string {

1
tsconfig.tsbuildinfo Normal file

File diff suppressed because one or more lines are too long