韩佳耀 2022-10-25 16:01 采纳率: 100%
浏览 181
已结题

Failed to load resource: the server responded with a status of 405 (Method Not Allowed)

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)了
希望能让其稳定有效

  • 写回答

8条回答 默认 最新

  • 游一游走一走 2022-10-25 16:30
    关注

    重新创建一个请求试试看

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

问题事件

  • 系统已结题 11月3日
  • 已采纳回答 10月26日
  • 赞助了问题酬金50元 10月25日
  • 赞助了问题酬金20元 10月25日
  • 展开全部

悬赏问题

  • ¥15 对于这个复杂问题的解释说明
  • ¥50 三种调度算法报错 采用的你的方案
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败