Vue发送请求模板

GET

api

//获取定金
      getTbusinessCost(cemBuyId,talkId){
        this.$api({
          url: `/cms/tBusinessCost/getTBusinessPrice`,
          params:{
            cemBuyId,
            talkId,
          },
          after: data =>{
            this.$set(this.dataForm,'price',data.tBusinessCostEntity.price);
          }
        })
      },

接收请求

    public R getTBusinessPrice(@RequestParam("cemBuyId") Integer cemBuyId, @RequestParam("talkId") Integer talkId) {
        var tBusinessCostEntity = tBusinessCostService.getPriceByBuyIdAndTalkId(cemBuyId, talkId);
        return R.ok().put("tBusinessCostEntity", tBusinessCostEntity);
    }

http

this.$http({
            url: this.$http.adornUrl(`/cms/sysOss/info/${this.dataForm.id}`),
            method: "get",
            params: this.$http.adornParams(),
          }).then(({ data }) => {
            if (data && data.code === 0) {
              this.dataForm.url = data.sysOss.url;
              this.dataForm.createDate = data.sysOss.createDate;
            }
          });

//补充 添加参数的方法
  params: this.$http.adornParams({
          'page': this.pageIndex,
          'limit': this.pageSize,
          'key': this.dataForm.key,
          'id': this.dataForm.id,
        }),

this.$http({
          url: this.$http.adornUrl('/cms/cemBuy/reserveDelete'),
          method: 'post',
          data: ids
        })

POST

 this.$handle({
        tip: `是否确认${isUse ? "禁用" : "启用"}该服务?`,
        url: `/cms/cemStoneType/${isUse ? "disable" : "enable"}`,
        params: { id },
        after: () => {
          this.$success();
          this.getDataList();
        },
      });

接收

    @PostMapping("/disable")
    public R disable(Integer id){
        cemStoneTypeService.disable(id);

        return R.ok();
    }

或者

this.$http.httpPost(`/mobile/onlineShop/updataGoodNum`, {
     id: id,
     name: name,
     price: price,
     count: count,
 }).then(data => {
     if (data && data.code === 0) {
         this.$message.success({
             type: 'success',
             message: '修改成功!',
             duration: 1500,
             onClose: () => {
                 // this.$router.push({name: "reIndex"});
             },
         })
     } else {
         this.$message.error(data.msg);
     }
 });

http

this.$http({
          url: this.$http.adornUrl('/cms/cemBuyerRetained/delete'),
          method: 'post',
          data: this.$http.adornData(ids, false)
        }).then(({data}) => {
          if (data && data.code === 0) {
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {
                this.getDetailList(1)
              }
            })
          } else {
            this.$message.error(data.msg)
          }
        })

接收

    @PostMapping("/delete")
    @RequiresPermissions("cms:cemBuyerRetained:delete")
    public R delete(@RequestBody Long[] ids){
        cemBuyerRetainedService.removeRetainByIds(Arrays.asList(ids));
        return R.ok();
    }
   

或者

  this.$http.httpGet(`mobile/cemBuy/list`,
 {
    buyerId:this.$store.state.buyerId
  }).then(data =>{
        if (data && data.code === 0) {
          this.buyList = data.page.list;
        }
      });
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值