解决两个问题:

1、config.js中写错URL导致axios请求失败;
2、axios为CROS发送两次请求,第一次的method是options,在token过滤器中需要忽略。
This commit is contained in:
2023-02-04 18:16:14 +08:00
parent 72b935c4b3
commit e676e98a6e
13 changed files with 172 additions and 82 deletions

View File

@@ -2,8 +2,8 @@
* @Author: Kane
* @Date: 2023-01-06 15:30:12
* @LastEditors: Kane
* @LastEditTime: 2023-02-01 16:07:55
* @FilePath: \IT工具综合平台\src\views\overview\Desktop.vue
* @LastEditTime: 2023-02-04 16:56:36
* @FilePath: /IT/src/views/overview/Desktop.vue
* @Description:
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
@@ -60,33 +60,52 @@
<el-col :span="10"></el-col>
</el-row>
</el-form>
<el-button type="danger" @click="test_1">测试</el-button>
<el-button type="danger" @click="testRequest">测试</el-button>
</template>
<script >
import { reactive, onBeforeMount } from "vue";
import { query_requirement_status } from "@/utils/api/requirement/requirement.js";
export default {
name: "DeskTop",
data()
setup()
{
let start_date = reactive(new Date());
let end_date = reactive(new Date());
onBeforeMount(() =>
{
end_date = new Date(Date.now());
start_date = new Date();
start_date.setMonth(end_date.getMonth() - 1);
});
const testRequest = () =>
{
//加载数据;
query_requirement_status()
.then((response) =>
{
// debugger;
const data = response.data;
console.log(data);
})
.catch((error) =>
{
// debugger;
console.log(error);
});
};
return {
start_date: null,
end_date: null,
start_date,
end_date,
testRequest,
};
},
methods: {
test_1()
{
this.deleteConfirm();
},
},
created()
{
this.end_date = new Date(Date.now());
this.start_date = new Date();
this.start_date.setMonth(this.end_date.getMonth() - 1);
//this.start_date.setMonth();
}
};
</script>