zoukankan      html  css  js  c++  java
  • axios 使用

      //注册获取新的验证码
      mutations_registration_get_verificationCode(store) {
        let registration_get_code = store.state.registration.registration_get_code; //设置是否允许 获取新的求情的标志位
        let params = {
          number: 1252223333
        };
        if (!registration_get_code) {
          return false;
        }
        store.state.registration.registration_get_code = false; // 不允许发送请求
        console.log("registration_get_code");
        get("/verificationCode ", params)
          .then(response => {
            alert("then");
            console.log(response);
          })
          .catch(err => {
            alert("get err");
          });
    
        post("/verificationCode ", params)
          .then(response => {
            console.log(response);
          })
          .catch(err => {
            console.log(err);
            alert("post err");
            console.log(" error");
          }).finally(()=>{
            alert('axios end')
          })
    
        // 服务调取成功后 启动技术
        mutations_registration_set_interver(store);
        function mutations_registration_set_interver(store) {
          let time = 10;
          let store1 = store;
          let defaultText = store1.state.registration.getVerificationDefaultText;
          alert("mutations_registration_set_interver");
          let timer = setInterval(function() {
            time -= 1;
            store1.state.registration.getVerificationTimer = time;
            store1.state.registration.getVerificationText = `重发(${time}s)`;
            if (time <= 0) {
              clearInterval(timer);
              store1.state.registration.getVerificationText = defaultText;
              store.state.registration.registration_get_code = true; // 允许发送请求
            }
          }, 1000);
        }
      },
    

      

    https://www.tongbiao.xyz/
  • 相关阅读:
    for循环
    条件语句练习
    语句
    语言基础
    python -- 异步IO 协程
    转--python -- 收发邮件
    hive vs hbase
    postgresql 常用速查
    转--利用hexo搭建个人静态博客
    转- --python 3 编码
  • 原文地址:https://www.cnblogs.com/tongbiao/p/9408228.html
Copyright © 2011-2022 走看看