Эх сурвалжийг харах

12.15修改友情链接bug

Jing 3 сар өмнө
parent
commit
700948b7ea
1 өөрчлөгдсөн 108 нэмэгдсэн , 59 устгасан
  1. 108 59
      src/views/website/blogroll.vue

+ 108 - 59
src/views/website/blogroll.vue

@@ -112,7 +112,7 @@
                         <el-radio v-model="ruleForm.type" label="3">底部</el-radio>
                     </el-form-item>
                     <el-form-item label="网站logo:" prop="" :label-width="formLabelWidth" :class="['custom-form-item']"
-                        class="custom-align-right">
+                        class="custom-align-right" v-show="this.ruleForm.type != '2'">
                         <div class="uploaderBox">
                             <!--图片上传组件 start ------------------------------------------------------------>
                             <div class="avatar-upload-container" @mouseenter="hovering = true"
@@ -123,7 +123,6 @@
                                     <!-- 预览图片 -->
                                     <img v-if="logoUrl" :src="logoUrl" class="avatar">
                                     <!-- 上传图标 -->
-                                    <!-- <i v-else class="el-icon-plus avatar-uploader-icon"></i> -->
                                     <div v-else class="chooseImgDiv">
                                         <div>
                                             <img src="@/assets/public/upload/noImage.png">
@@ -131,7 +130,6 @@
                                         </div>
                                     </div>
                                     <input type="hidden" name="logo" v-model="ruleForm.webLogo">
-                                    <!-- <input type="hidden" name="logo" v-model="logoUrl"> -->
                                 </el-upload>
                                 <!-- 删除按钮,当鼠标悬浮时显示 -->
                                 <div v-if="hovering && logoUrl" class="delete-button" @click="handleDelete">
@@ -356,7 +354,8 @@ export default {
             this.ruleForm.webName = ''
             this.ruleForm.webUrl = ''
             this.ruleForm.type = '1'
-            this.ruleForm.webLogo = ''
+            this.logoUrl = 'http://183.131.25.186:9501/image/20241225/17350893036168.png'
+            this.ruleForm.webLogo = 'http://183.131.25.186:9501/image/20241225/17350893036168.png'
             this.ruleForm.webDesc = ''
             this.ruleForm.sort = 0
         },
@@ -364,18 +363,15 @@ export default {
         goEdit(id, val) {
             this.dialogTableVisible = true //弹框显示
             this.dialogName = "编辑"    //弹框名字
-            // console.log(val);
+            console.log(id, val);
 
             this.activeId = id //活动id
-            this.website_id=val.website_id //网站id
+            this.website_id = val.website_id //网站id
             this.ruleForm.correlationWeb = val.website_name
             this.ruleForm.webName = val.title
             this.ruleForm.webUrl = val.url
-            if (val.logo_url == '') {
-                this.ruleForm.webLogo = val.logo_url //logo不应该是地址 应该是图片
-            } else {
-                this.logoUrl = val.logo_url
-            }
+            this.ruleForm.webLogo = val.logo_url
+            this.logoUrl = val.logo_url
             this.ruleForm.webDesc = val.describe
             this.ruleForm.sort = val.sort
             if (val.type == "图片") {
@@ -396,29 +392,54 @@ export default {
                 this.$message.error("请输入并选择关联网站名称");
                 return
             }
+            // 添加
             if (this.dialogName == "添加") {
-                // 添加
-                createLink({
-                    title: this.ruleForm.webName,
-                    website_id: this.website_id,
-                    sort: this.ruleForm.sort,
-                    url: this.ruleForm.webUrl,
-                    type: this.ruleForm.type,
-                    logo_url: this.ruleForm.webLogo,
-                    describe: this.ruleForm.webDesc
-                }).then(data => {
-                    console.log(data);
-                    if (data.code == 200) {
-                        this.$message({
-                            message: "添加成功",
-                            type: 'success'
-                        });
-                        this.dialogTableVisible = false
-                        this.getData()
-                    } else {
-                        this.$message.error(data.message)
-                    }
-                })
+                if (this.ruleForm.type == '2') {
+                    createLink({
+                        title: this.ruleForm.webName,
+                        website_id: this.website_id,
+                        sort: this.ruleForm.sort,
+                        url: this.ruleForm.webUrl,
+                        type: this.ruleForm.type,
+                        logo_url: '',
+                        describe: this.ruleForm.webDesc
+                    }).then(data => {
+                        console.log(data);
+                        if (data.code == 200) {
+                            this.$message({
+                                message: "添加成功",
+                                type: 'success'
+                            });
+                            this.dialogTableVisible = false
+                            this.getData()
+                        } else {
+                            this.$message.error(data.message)
+                        }
+                    })
+                } else {
+                    createLink({
+                        title: this.ruleForm.webName,
+                        website_id: this.website_id,
+                        sort: this.ruleForm.sort,
+                        url: this.ruleForm.webUrl,
+                        type: this.ruleForm.type,
+                        logo_url: this.ruleForm.webLogo,
+                        describe: this.ruleForm.webDesc
+                    }).then(data => {
+                        console.log(data);
+                        if (data.code == 200) {
+                            this.$message({
+                                message: "添加成功",
+                                type: 'success'
+                            });
+                            this.dialogTableVisible = false
+                            this.getData()
+                        } else {
+                            this.$message.error(data.message)
+                        }
+                    })
+                }
+
             }
             if (this.dialogName == "编辑") {
                 if (this.website_id == " ") {
@@ -426,31 +447,60 @@ export default {
                     this.dialogTableVisible = true
                     return
                 }
-                updateLink({
-                    title: this.ruleForm.webName,
-                    website_id: this.website_id,
-                    sort: this.ruleForm.sort,
-                    url: this.ruleForm.webUrl,
-                    type: this.ruleForm.type,
-                    logo_url: this.ruleForm.webLogo,
-                    describe: this.ruleForm.webDesc,
-                    id: this.activeId,
-                }).then(data => {
-                    console.log(data);
-                    if (data.code == 200) {
-                        this.$message({
-                            message: "修改成功",
-                            type: 'success'
-                        })
-                        this.dialogTableVisible = false
-                        this.getData()
-                    } else {
-                        this.$message({
-                            message: data.message,
-                            type: 'error'
-                        })
-                    }
-                })
+                if (this.ruleForm.type == '2') {
+                    updateLink({
+                        title: this.ruleForm.webName,
+                        website_id: this.website_id,
+                        sort: this.ruleForm.sort,
+                        url: this.ruleForm.webUrl,
+                        type: this.ruleForm.type,
+                        logo_url: '',
+                        describe: this.ruleForm.webDesc,
+                        id: this.activeId,
+                    }).then(data => {
+                        console.log(data);
+                        if (data.code == 200) {
+                            this.$message({
+                                message: "修改成功",
+                                type: 'success'
+                            })
+                            this.dialogTableVisible = false
+                            this.getData()
+                        } else {
+                            this.$message({
+                                message: data.message,
+                                type: 'error'
+                            })
+                        }
+                    })
+                } else {
+                    updateLink({
+                        title: this.ruleForm.webName,
+                        website_id: this.website_id,
+                        sort: this.ruleForm.sort,
+                        url: this.ruleForm.webUrl,
+                        type: this.ruleForm.type,
+                        logo_url: this.ruleForm.webLogo,
+                        describe: this.ruleForm.webDesc,
+                        id: this.activeId,
+                    }).then(data => {
+                        console.log(data);
+                        if (data.code == 200) {
+                            this.$message({
+                                message: "修改成功",
+                                type: 'success'
+                            })
+                            this.dialogTableVisible = false
+                            this.getData()
+                        } else {
+                            this.$message({
+                                message: data.message,
+                                type: 'error'
+                            })
+                        }
+                    })
+                }
+
             }
         },
         //取消添加或编辑
@@ -479,7 +529,6 @@ export default {
 
             this.$store.dispatch('pool/uploadFile', formData).then(res => {
                 console.log('res', res);
-
                 this.logoUrl = res.data.imgUrl;//显示缩略图
                 this.ruleForm.webLogo = res.data.imgUrl;//提供表单地址
                 console.log(res.data.imgUrl)