谷粒商城网关路由 三级菜单删除

1.网关路由配置 application.yml
(1) 遇到问题配置网关路由完成后,访问路径200但是没有数据
解决办法:将pom.xml中引用的common去掉,重新写nacos依赖。

spring:
  cloud:
    gateway:
      routes:
#        - id: test_route
#          uri: https://www.baidu.com
#          predicates:
#            - Query=url,baidu
#
#        - id: qq_route
#          uri: https://www.qq.com
#          predicates:
#            - Query=url,qq
#更精确的网关路由放在前面
        - id: product-route
          uri: lb://gulimall-product
          predicates:
            - Path=/api/product/**
          filters:
            - RewritePath=/api/(?<segment>.*),/$\{segment}

        - id: admin_route
          uri: lb://renren-fast
          predicates:
            - Path=/api/**
          filters:
            - RewritePath=/api/(?<segment>.*), /renren-fast/$\{segment}


#          predicates:
#            - Path=/api/**
#          filters:
#            - RewritePath=/api/(?<segment>.*), /renren-fast/$\{segment}



#lb:负载均衡  rewritePath 重写路径
#前端项目 /api
#http://localhost:88/api/captcha.jpg  网关转成了 http:renren-fast:8080/api/captcha.jpg
#                              真正能访问的是: http://localhost:8080/renren-fast/captcha.jpg

2.前端 删除
(1)前端访问商品分类菜单不跳转
解决方法:不适用vscode自动生成的vue模板,按照已有的模板写就可以了

<template>
  <el-tree
    show-checkbox
    node-key="id"
    :expand-on-click-node="false"
    :default-expanded-keys="expandedKeys"
    :data="menus"
    :props="defaultProps"
  >
    <span class="custom-tree-node" slot-scope="{ node, data }">
      <span>{{ node.label }}</span>
      <span>
        <el-button
          v-if="node.level <= 2"
          type="text"
          size="mini"
          @click="() => append(data)"
        >
          Append
        </el-button>
        <el-button
          v-if="node.childNodes.length == 0"
          type="text"
          size="mini"
          @click="() => remove(node, data)"
        >
          Delete
        </el-button>
      </span>
    </span>
  </el-tree>
</template>

<script>
export default {
  components: {},

  data() {
    return {
      expandedKeys: [],
      menus: [],
      defaultProps: {
        children: "children",
        label: "name",
      },
    };
  },

  methods: {
    getMenus() {
      this.$http({
        url: this.$http.adornUrl("/product/category/list"),
        method: "get",
      }).then(({ data }) => {
        console.log("成功获取到菜单数据", data.data);
        this.menus = data.data;
      });
    },
    append(data) {
      console.log("appen", data);
    },

    remove(node, data) {
      console.log("remove1", node, data);
      //消息提示
      this.$confirm(`确定删除【${data.name}】`, "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          //  定义数组传ids
          var ids = [data.id];
          this.$http({
            url: this.$http.adornUrl("/product/category/delete"),
            method: "post",
            data: this.$http.adornData(ids, false),
          }).then(({ data }) => {
            //提示消息删除成功
            this.$message({
              message: "菜单删除成功",
              type: "success",
            });
            //要默认打开之前的id
            this.getMenus();
            this.expandedKeys = [node.data.parentId];
          });
        })
        .catch(() => {});
    },
  },
  created() {
    this.getMenus();
  },
  mounted() {},
  watch: {},
  computed: {},
};
</script>
<!-- 这里或采用lang="less" -->
<style lang="scss">
</style>

3.mybatis-plus逻辑删除
yml

    mybatis-plus:
      global-config:
        db-config:
          logic-delete-value: 1
          logic-not-delete-value: 0

实体类中 逻辑删除字段

@TableLogic(value = "1",delval ="0")
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值