zoukankan      html  css  js  c++  java
  • axios请求2

    一、

    代码

    代码如下:

        btnClick3() {
          let url = "http://www.fanglianmeng.com/demo.php";
          var self = this;
          /*
          let data = {
            encryptedData: this.encryptedData,
            iv: this.iv,
            se_key: this.se_key
          };
          */
          let data = {
            encryptedData:
              "/orja5PuklpYKYQOGeILQtzS2uJXUN3jdFzs8JvCLzmQBW5Jlrf7gDH8AIyNsEy5J5VbhqYKqO/CXHW6Ik1ZoiFdu952s8atuMFReWz6HLxIa8XDBBr/mdWA3OK2d90kl3TUKjhww2aANWOo87znRsf4yEutWv+B46fuqNn3203zaPnqQkkTnBiUsNxhm3G33OuJxEXQOJOEohQ2tqyzVA==",
            iv: "AZh7f5qnKsFAoIFs/+qqtw==",
            se_key: "O6s9nzO/Yv0x+YhC2kNe+A=="
          };
          
          console.log(data, data);
          alert(url);
    
          var fd = new FormData();
          fd.append("encryptedData", data.encryptedData);
          fd.append("iv", data.iv);
          fd.append("se_key", data.se_key);
    
          let config = {
            headers: {
              "content-type": "application/x-www-form-urlencoded"
            }
          };
    
          this.$axios({
            method: "post", // 请求方式
            url: url, // 后台接口
            data: fd, //data键值   不能用params
            config
          })
            .then(response => {
              // 请求成功
              alert("请求1成功:" + JSON.stringify(response));
              console.log("请求1成功:" + JSON.stringify(response));
              self.tel = response.phoneNumber;
              console.log(self.tel);
            })
            .catch(error => {
              // 请求失败
              alert("请求1失败:" + JSON.stringify(error));
              console.log("请求1失败:" + error);
            });
        },
  • 相关阅读:
    高斯消元
    Luogu P2068 统计和
    Luogu P1892 [BOI2003]团伙
    Luogu P2866 [USACO06NOV]糟糕的一天Bad Hair Day
    Luogu P3916 图的遍历
    Luogu P1041 [2003NOIP提高组]传染病控制
    Luogu P3901 数列找不同
    Luogu 2951 捉迷藏Hide and Seek
    Luogu P1550 打井Watering Hole
    洛谷——P1044 栈
  • 原文地址:https://www.cnblogs.com/fger/p/12834210.html
Copyright © 2011-2022 走看看