diff --git a/.env b/.env new file mode 100644 index 0000000..5f1c17c --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +VITE_BASE=/ +VITE_API_URL=/admin-api \ No newline at end of file diff --git a/.env.dev b/.env.dev new file mode 100644 index 0000000..24b2d0b --- /dev/null +++ b/.env.dev @@ -0,0 +1,2 @@ +VITE_BASE=/admin/ +VITE_API_URL=/admin-api \ No newline at end of file diff --git a/.env.prod b/.env.prod new file mode 100644 index 0000000..74c93ab --- /dev/null +++ b/.env.prod @@ -0,0 +1,3 @@ + +VITE_BASE=/ +VITE_API_URL=/admin-api \ No newline at end of file diff --git a/src/components/AddMail.vue b/src/components/AddMail.vue index 8542723..1643375 100644 --- a/src/components/AddMail.vue +++ b/src/components/AddMail.vue @@ -168,6 +168,7 @@ interface FormData { fileList: any[]; attachments: String; } +const { VITE_API_URL } = process.env; const formRef = ref(); const form = ref({ @@ -239,8 +240,9 @@ const handleSubmit = () => { // form.value.fileList = [] // form.value.involvedDeptName = '' // }); + const url = VITE_API_URL +'/mailbox/add' request({ - url: '/api/mailbox/add', + url: url, method: 'POST', data: {MailBo:form.value} , headers: { 'Content-Type': 'application/json'} diff --git a/src/components/FileList.vue b/src/components/FileList.vue index 8ccb009..4d9b0a1 100644 --- a/src/components/FileList.vue +++ b/src/components/FileList.vue @@ -9,7 +9,7 @@
@@ -45,7 +45,7 @@ import { watch } from "vue"; -const { VITE_API_URL } = "http://127.0.0.1:5173"; +const { VITE_API_URL } = process.env; const props = defineProps({ files: { type: Array, diff --git a/src/components/HolidayList.vue b/src/components/HolidayList.vue index db8d81a..559858d 100644 --- a/src/components/HolidayList.vue +++ b/src/components/HolidayList.vue @@ -36,6 +36,7 @@ import { ref, onMounted, onBeforeMount } from 'vue'; import { ElMessage } from 'element-plus' import { request } from '../util/axios_config' +const { VITE_API_URL } = process.env; const currenYear = ref(''); const loading = ref(true); @@ -46,8 +47,9 @@ const dayType = ref({ }); const getDateData = () => { + const url = VITE_API_URL +'/outer/holiday/show-holiday' request({ - url: '/api/outer/holiday/show-holiday', + url: url, method: 'GET' }).then(res => { dayType.value = res.data; @@ -92,8 +94,9 @@ const searchHoliday = () => { const refreshHoliday = () => { loading.value = true; + const url = VITE_API_URL +'/outer/holiday/refresh-holiday' request({ - url: '/api/outer/holiday/refresh-holiday', + url: url, method: 'POST', data: { year: currenYear.value }, headers: { 'Content-Type': 'application/json' } diff --git a/src/components/LoginView.vue b/src/components/LoginView.vue index e453b49..863906e 100644 --- a/src/components/LoginView.vue +++ b/src/components/LoginView.vue @@ -24,7 +24,7 @@ import { request } from '../util/axios_config' import router from '../router' import { ElMessage } from 'element-plus' import { useTokenStore } from '../stores/useTokenStore' - +const { VITE_API_URL } = process.env; const tokens = useTokenStore() const login = reactive({ @@ -53,8 +53,9 @@ const inputCheck = () => { // } const loginIn = () => { + const url = VITE_API_URL +'/login' request({ - url: '/api/login', + url: url, method: 'POST', data: login, headers: { 'Content-Type': 'application/json' } diff --git a/src/components/MailDetail.vue b/src/components/MailDetail.vue index 3317aa3..475a318 100644 --- a/src/components/MailDetail.vue +++ b/src/components/MailDetail.vue @@ -47,6 +47,7 @@ import { ref, onMounted } from 'vue'; import router from '../router'; import { request } from '../util/axios_config' +const { VITE_API_URL } = process.env; const mailID = router.currentRoute.value.params.id; const form = ref({ @@ -60,8 +61,9 @@ const form = ref({ }); onMounted(() => { + const url = VITE_API_URL +'/mailbox/detail' request({ - url: '/api/mailbox/detail', + url: url, method: 'POST', data: { id: mailID } }).then(res => { diff --git a/src/components/MailEtl.vue b/src/components/MailEtl.vue index d0d77a4..ee02f4c 100644 --- a/src/components/MailEtl.vue +++ b/src/components/MailEtl.vue @@ -81,7 +81,7 @@ import { request } from '../util/axios_config' import { onMounted, ref } from 'vue'; import router from '../router'; const MailTab = ref('mail_etl') - +const { VITE_API_URL } = process.env; const options = [ { value: 'mail_etl', @@ -135,8 +135,9 @@ const handleResponse = (response) => { const makeRequest = (requestData, callback) => { const data = JSON.stringify(requestData) + const url = VITE_API_URL +'/mailetl/list-submit' request({ - url: 'api/mailetl/list-submit', + url: url, method: 'POST', data: data, headers: { 'Content-Type': 'application/json' } diff --git a/src/components/ManageMail.vue b/src/components/ManageMail.vue index c29d26d..926f381 100644 --- a/src/components/ManageMail.vue +++ b/src/components/ManageMail.vue @@ -110,7 +110,7 @@ import router from '../router'; import AddMail from "../components/AddMail.vue"; const loading = ref(true); - +const { VITE_API_URL } = process.env; const form = ref({ date: '', @@ -152,8 +152,9 @@ const handleResponse = (response) => { const makeRequest = (requestData, callback) => { const data = JSON.stringify(requestData) + const url = VITE_API_URL +'/mailbox/list-submit' request({ - url: 'api/mailbox/list-submit', + url: url, method: 'POST', data: data, headers: { 'Content-Type': 'application/json' } @@ -224,8 +225,9 @@ const out = () => { pageData: pageData.value } const data = JSON.stringify(requestData) + const url = VITE_API_URL +'/mailbox/exportexcel' request({ - url: 'api/mailbox/exportexcel', + url: url, method: 'POST', data: data, headers: { 'Content-Type': 'application/json' }, diff --git a/src/components/ManageUser.vue b/src/components/ManageUser.vue index c4061ce..b206bd2 100644 --- a/src/components/ManageUser.vue +++ b/src/components/ManageUser.vue @@ -101,7 +101,7 @@ import { request } from '../util/axios_config' import { onMounted, ref } from 'vue'; import { ElMessage } from 'element-plus' - +const { VITE_API_URL } = process.env; const loading = ref(true); const form = ref({ date: '', @@ -126,8 +126,9 @@ const pageData = ref({ }) const getData = (data) => { + const url = VITE_API_URL +'/user/list-submit' request({ - url: 'api/user/list-submit', + url: url, method: 'POST', data: data, headers: { 'Content-Type': 'application/json' } @@ -159,8 +160,9 @@ const flexColumnWidth = (label, prop) => { } const handleDelete = (index) => { + const url = VITE_API_URL +'/user/delete-user' request({ - url: 'api/user/delete-user', + url: url, method: 'POST', data: { id: tableData.value[index - 1].id }, }).then(function (response) { @@ -220,8 +222,9 @@ const newUser = ref(false) const submitNewUser = () => { const requestData = newForm.value const data = JSON.stringify(requestData) + const url = VITE_API_URL +'/user/add-user' request({ - url: 'api/user/add-user', + url: url, method: 'POST', data: data, headers: { 'Content-Type': 'application/json' } diff --git a/src/components/Upload.vue b/src/components/Upload.vue index afb458f..827e5c8 100644 --- a/src/components/Upload.vue +++ b/src/components/Upload.vue @@ -1,7 +1,7 @@