修改所有vue文件中的环境变量调用
This commit is contained in:
@@ -119,7 +119,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, onMounted, computed, watch } from 'vue';
|
||||
import { ref, reactive, onMounted, computed } from 'vue';
|
||||
import axios from 'axios';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
@@ -149,11 +149,11 @@ onMounted(() => {
|
||||
fetchCoverImage();
|
||||
fetchBaseInfo();
|
||||
});
|
||||
|
||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
|
||||
// 从后端获取封面图
|
||||
const fetchCoverImage = async () => {
|
||||
try {
|
||||
const response = await axios.post('http://localhost:8080/api/page-image/get', { page: 'BaseOverview' });
|
||||
const response = await axios.post(`${API_BASE_URL}/page-image/get`, { page: 'BaseOverview' });
|
||||
if (response.data.message === '查询成功') {
|
||||
pageImageUrl.value = response.data.images[0].image_url;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ const fetchCoverImage = async () => {
|
||||
// 从后端获取基地概况信息并绑定到页面
|
||||
const fetchBaseInfo = async () => {
|
||||
try {
|
||||
const response = await axios.get('http://localhost:8080/api/base-overview');
|
||||
const response = await axios.get(`${API_BASE_URL}/base-overview`);
|
||||
if (response.data.success) {
|
||||
Object.assign(baseInfo, response.data.data);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user