Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
<template>
<div>
<input type="button" @click="join(8058865)" value="8058865" name="mr_id">
<input type="button" @click="join(8058866)" value="8058866" name="mr_id">
<input type="button" @click="join(8058867)" value="8058867" name="mr_id">
</div>
</template>
<script>
import '../rawsdk/zjsdk2.js'
import '../js/demo_config.js'
import '../js/demo_public.js'
import '../js/demo_enterMeeting.js'
import append_dev_header from '../rawsdk/dev_header'//必要
import md5 from '../js/md5'
export default {
methods: {
//新建视频页面
join(id) {
var route = this.$router.resolve({
name: 'video',
})
sessionStorage.setItem("id", id);
window.open(route.href, '_blank')
},
},
data() {
return {
cert_code: '',
date_time: ''
}
},
mounted() {
const xhr = new XMLHttpRequest()
//获取验证码
xhr.open('get', '/api/rest/v1/app1/manager/sessions/verify-code/', true);
xhr.send(); //发送请求
xhr.onreadystatechange = function () {
console.log(xhr.readyState)
console.log(xhr.status)
if (xhr.readyState == 4 && xhr.status == 200) {
console.log('responseText:' + xhr.responseText);
console.log('responseXML:' + xhr.responseXML)
var json = JSON.parse(xhr.responseText);
this.cert_code = json.cert_code
this.date_time = json.date_time
//登录
xhr.open('post', '/api/rest/v1/app1/manager/sessions/login_req/', true);
var fd = new FormData()
fd.append('cmdid', 'login_req')
fd.append('login_id', 'hmy@ecflow.com.cn')//加了这一句
fd.append('login_pwd', md5('123456'))//加了这一句
fd.append('login_type', 1)//加了这一句
fd.append('cert_code', this.cert_code)//加了这一句
fd.append('date_time', this.date_time)//加了这一句
xhr.send(fd); //发送请求
// console.log('this.code:' + this.cert_code)
// console.log('this.time:' + this.date_time)
// xhr.onreadystatechange = function () {
// console.log(xhr.readyState)
// console.log(xhr.status)
// if (xhr.readyState == 4 && xhr.status == 200) {
// console.log('responseText:' + xhr.responseText);
// console.log('responseXML:' + xhr.responseXML)
// var json = JSON.parse(xhr.responseText);
// } else {
// console.log('statusText:' + xhr.statusText);
// }
// };
} else {
console.log('statusText:' + xhr.statusText);
}
};
},
}
</script>
<style scoped>
div {
display: flex;
justify-content: space-around;
align-items: center;
}
input {
width: 100px;
height: 100px;
border-radius: 10px;
background-color: lightblue;
color: blue;
font-weight: bolder;
font-size: larger;
border-color: lightyellow;
}
</style>
在第二个send(最后一个)处报错,有时候一开始是能成功的,然后一旦报错就会一直有,隔一段时间可能又好了
而且一开始是这个错误,刷新之后就会变成POST http://127.0.0.1:5173/api/rest/v1/app1/manager/sessions/login_req/ 405 (Method Not Allowed)
然后就一直是POST http://127.0.0.1:5173/api/rest/v1/app1/manager/sessions/login_req/ 405 (Method Not Allowed)了
希望能让其稳定有效