ruoyi-ui/src/views/honor/honorInfo.vue
@@ -197,6 +197,7 @@
import {Message} from "element-ui";
import { download,uploadPic} from "@/api/doctor/index";
import {listHonor,updateHonor,getHonor} from "@/api/honor/index";
import {listRoot} from "@/api/root";
export default {
  components: {},
@@ -307,33 +308,88 @@
    let _this = this
    if (id) {
      this.loading = true;
      getHonor(id).then((response) => {
        this.formData = response.data;
        let paths = response.data.url.split(",");
        for(let i = 0; i < paths.length; i++)
        {
          if(paths[i]!="") {
      // getHonor(id).then((response) => {
      //   this.formData = response.data;
      //   let paths = response.data.url.split(",");
      //   for(let i = 0; i < paths.length; i++)
      //   {
      //     if(paths[i]!="") {
      //
      //       let pth = paths[i].substr(paths[i].length - 4, paths[i].length)
      //
      //       if (_this.fot.includes(pth) === true)
      //         _this.fileList.push({name:paths[i],url: process.env.VUE_APP_BASE_TRUE_API+paths[i]})
      //       else {
      //       // alert(paths[i])
      //       let nms = paths[i].split("\/")
      //       let nm = nms[nms.length - 1]
      //       _this.fileListOther.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i]})
      //       }
      //     }
      //   }
      //   this.loading = false;
      // });
            let pth = paths[i].substr(paths[i].length - 4, paths[i].length)
            if (_this.fot.includes(pth) === true)
              _this.fileList.push({name:paths[i],url: process.env.VUE_APP_BASE_TRUE_API+paths[i]})
            else {
              // alert(paths[i])
              let nms = paths[i].split("\/")
              let nm = nms[nms.length - 1]
              _this.fileListOther.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i]})
            }
          }
        }
        this.loading = false;
      });
      this.fetchData()
      this.getCateInfor()
    }
      //以下为test
    // if (id){
    //   this.loading =true;
    //   getHonor(id).then((response)=> {
    //   this.formData =response.data;
    //   let paths=response.data.url.split(" ");
    //   for(let i = 0; i < paths.length; i++){
    //     if(paths[i]!=""){
    //       let pth = paths[i].substr(paths[i].length - 4, paths[i].length);
    //       if (_this.fot.includes(pth)) {
    //         _this.fileList.push({
    //           name: paths[i],
    //           url: process.env.VUE_APP_BASE_TRUE_API + paths[i],
    //         });
    //       } else {
    //             // alert(paths[i])
    //             let nms = paths[i].split("\/")
    //             let nm = nms[nms.length - 1]
    //             _this.fileListOther.push({name:nm, url: process.env.VUE_APP_BASE_TRUE_API+paths[i]})
    //             }
    //         }
    //       }
    //       this.loading = false;
    //     });
    //
    //   // getHonor(id).then(response => {
    //   //     //  alert(123)
    //   //     //  alert(123)
    //   //     //   console.log(response.data)
    //   //     //  alert(90)
    //   //     this.formData = response.data;
    //   //     this.isShow_1=true
    //   //     //  alert(this.rootList[0].url)
    //   //     //   this.total = response.data.total;
    //   //     this.loading = false;
    //   //   }
    //   // );
    //   this.getCateInfor()
    //
    // }
  },
  mounted() {},
  methods: {
    // 获取数据方法
    fetchData(id) {
      const url = 'http://47.93.189.255:8080/zHonor/id=${id}'; // 接口 URL'/zHonor/id='+query
      fetch(url)
        .then(response => response.json())
        .then(data => {
          this.formData = data; // 通过将返回数据赋给组件属性来更新视图
        })
        .catch(error => {
          console.error('Error:', error); // 处理错误
        });
    },
    /** 查询类别信息 */
    getCateInfor()
    {