Jing преди 4 месеца
родител
ревизия
41b1b1aa0f

+ 56 - 0
src/api/advertise.js

@@ -63,4 +63,60 @@ export const delOrderAdmin=(data)=> {
     method: 'post',
     method: 'post',
     data
     data
   })
   })
+}
+
+
+//广告位 ----------------------------------------------->
+// 创建广告位
+export const createAdPlace=(data)=> {
+  return request({
+    url: '/ad/createAdPlace',
+    method: 'post',
+    data
+  })
+}
+
+// 广告位列表
+export const getAdPlaceList=(params)=> {
+  return request({
+    url: '/ad/getAdPlaceList',
+    method: 'get',
+    params
+  })
+}
+
+// 删除广告位
+export const delAdPlace=(data)=> {
+  return request({
+    url: '/ad/delAdPlace',
+    method: 'post',
+    data
+  })
+}
+
+// 修改广告位
+export const updateAdPlace=(data)=> {
+  return request({
+    url: '/ad/updateAdPlace',
+    method: 'post',
+    data
+  })
+}
+
+// 获取广告位下面的广告
+export const getAdList=(params)=> {
+  return request({
+    url: '/ad/getAdList',
+    method: 'get',
+    params
+  })
+}
+
+// 获取广告位详情
+export const getAdPlaceInfo=(params)=> {
+  return request({
+    url: '/ad/getAdPlaceInfo',
+    method: 'get',
+    params
+  })
 }
 }

+ 48 - 0
src/api/link.js

@@ -0,0 +1,48 @@
+// 友情链接
+import request from '@/utils/request'
+
+// 获取并搜索友情链接
+export const getLinkList = (params) => {
+    return request({
+        url: '/link/getLinkList',
+        method: 'get',
+        params
+    })
+}
+
+// 获取友情链接详情
+export const getLinkInfo = (params) => {
+    return request({
+        url: '/link/getLinkInfo',
+        method: 'get',
+        params
+    })
+}
+
+// 创建友情链接
+export const createLink = (data) => {
+    return request({
+        url: '/link/createLink',
+        method: 'post',
+        data
+    })
+}
+
+// 删除友情链接
+export const delLink = (data) => {
+    return request({
+        url: '/link/delLink',
+        method: 'post',
+        data
+    })
+}
+
+
+// 修改友情链接
+export const updateLink = (data) => {
+    return request({
+        url: '/link/updateLink',
+        method: 'post',
+        data
+    })
+}

BIN
src/assets/advertise/sample_graph.png


+ 78 - 49
src/router/index.js

@@ -325,7 +325,6 @@ export const constantRoutes = [
         component: () => import('@/views/chat/contacts'),
         component: () => import('@/views/chat/contacts'),
         meta: {
         meta: {
           title: '通讯录',
           title: '通讯录',
-
           hidden: true,
           hidden: true,
           breadcrumb: true
           breadcrumb: true
         }
         }
@@ -333,22 +332,21 @@ export const constantRoutes = [
     ]
     ]
   },
   },
   {
   {
-        path: '/webCrawler',
-        component: Layout,
-        children: [
-          {
-            name: '',
-            path: '',
-            component: () => import('@/views/crawler/webCrawler'),
-            meta: {
-              title: '建立网站',
-              hidden: true,
-              breadcrumb: true
-            }
-          }
-        ]
-      },
-
+    path: '/webCrawler',
+    component: Layout,
+    children: [
+      {
+        name: '',
+        path: '',
+        component: () => import('@/views/crawler/webCrawler'),
+        meta: {
+          title: '建立网站',
+          hidden: true,
+          breadcrumb: true
+        }
+      }
+    ]
+  },
   {
   {
     path: '/topic',
     path: '/topic',
     component: Layout,
     component: Layout,
@@ -366,23 +364,22 @@ export const constantRoutes = [
     ]
     ]
   },
   },
   {
   {
-        path: '/webRule',
-        component: Layout,
-        children: [
-          {
-            name: '',
-            path: '',
-            component: () => import('@/views/crawler/webRule'),
-            meta: {
-              title: '规则列表',
-              hidden: true,
-              breadcrumb: true
-            }
-          }
-        ]
-      },
+    path: '/webRule',
+    component: Layout,
+    children: [
+      {
+        name: '',
+        path: '',
+        component: () => import('@/views/crawler/webRule'),
+        meta: {
+          title: '规则列表',
+          hidden: true,
+          breadcrumb: true
+        }
+      }
+    ]
+  },
   {
   {
-
     path: '/creatTopic',
     path: '/creatTopic',
     component: Layout,
     component: Layout,
     children: [
     children: [
@@ -399,22 +396,21 @@ export const constantRoutes = [
     ]
     ]
   },
   },
   {
   {
-        path: '/webCrawlerList',
-        component: Layout,
-        children: [
-          {
-            name: '',
-            path: '',
-            component: () => import('@/views/crawler/webCrawlerList'),
-            meta: {
-              title: '采集列表',
-              hidden: true,
-              breadcrumb: true
-            }
-          }
-        ]
-      },
-
+    path: '/webCrawlerList',
+    component: Layout,
+    children: [
+      {
+        name: '',
+        path: '',
+        component: () => import('@/views/crawler/webCrawlerList'),
+        meta: {
+          title: '采集列表',
+          hidden: true,
+          breadcrumb: true
+        }
+      }
+    ]
+  },
   {
   {
     path: '/webCrawlerListEdit',
     path: '/webCrawlerListEdit',
     component: Layout,
     component: Layout,
@@ -463,6 +459,39 @@ export const constantRoutes = [
       }
       }
     ]
     ]
   },
   },
+  {
+    path: '/blogroll',
+    component: Layout,
+    children: [
+      {
+        name: '',
+        path: '',
+        component: () => import('@/views/website/blogroll.vue'),
+        meta: {
+          title: '友情链接',
+          hidden: true,
+          breadcrumb: true
+        }
+      }
+    ]
+  },
+  // adPlaceDetail
+  {
+    path: '/adPlaceDetail',
+    component: Layout,
+    children: [
+      {
+        name: '',
+        path: '',
+        component: () => import('@/views/advertise/adPlaceDetail'),
+        meta: {
+          title: '广告位详情',
+          hidden: true,
+          breadcrumb: true
+        }
+      }
+    ]
+  },
   // {
   // {
   //   path: '/documentation',
   //   path: '/documentation',
   //   component: Layout,
   //   component: Layout,

+ 118 - 0
src/views/advertise/adPlaceDetail.vue

@@ -0,0 +1,118 @@
+<template>
+    <!-- 广告位详情 -->
+    <div>
+        <!--表格内容 start------------------------------------------------------------>
+        <div class="layerBox">
+            <tableTitle :name="tableDivTitle" />
+            <el-table class="my-table" :data="tableData" style="width: 100%">
+                <el-table-column fixed prop="id" label="编号" width="90">
+                </el-table-column>
+                <el-table-column prop="website_name" label="网站名称" width="">
+                </el-table-column>
+                <el-table-column prop="name" label="广告名称" width="">
+                </el-table-column>
+                <!-- <el-table-column prop="image_src" label="广告图" width="">
+                </el-table-column> -->
+                <el-table-column label="广告图" width="">
+                    <template slot-scope="scope">
+                        <img :src="scope.row.image_src" alt="" class="uploadImage">
+                    </template>
+                </el-table-column>
+                <!-- <el-table-column prop="status" label="尺寸" width="">
+                </el-table-column> -->
+                <el-table-column prop="image_url" label="广告链接" width="">
+                </el-table-column>
+                <el-table-column prop="fromtime" label="开始时间" width="">
+                </el-table-column>
+                <el-table-column prop="totime" label="结束时间" width="">
+                </el-table-column>
+                <el-table-column prop="day" label="剩余时间 (天)" width="">
+                </el-table-column>
+            </el-table>
+        </div>
+        <!--分页 start------------------------------------------------------------>
+        <div class="alignBox">
+            <el-row>
+                <el-col :span="24">
+                    <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                        :current-page="page" :page-size="pageSize" layout="total, prev, pager, next, jumper"
+                        :total="total">
+                    </el-pagination>
+                </el-col>
+            </el-row>
+        </div>
+        <!--分页 end------------------------------------------------------------>
+        <!--表格内容 end------------------------------------------------------------>
+    </div>
+
+</template>
+
+<script>
+//表格标题
+import tableTitle from './components/tableTitle'
+
+//引入公用样式
+import '@/styles/global.less';
+import { getAdList } from '@/api/advertise'
+export default {
+    components: {
+        tableTitle,//表格标题
+    },
+    data() {
+        return {
+            tableDivTitle: "广告位详情",  //列表标题
+
+            tableData: [],//表格数据
+
+            //活动id
+            activeid: "",
+
+            // 分页相关
+            page: 1,
+            pageSize: 10,
+            total: 0,
+
+        }
+    },
+
+    methods: {
+        //1.1 开始请求列表信息方法
+        getData() {
+            getAdList({
+                pid: this.activeid,
+                page: this.page,
+                pageSize: this.pageSize
+            }).then(data => {
+                console.log(data);
+                this.tableData = data.data.rows
+            })
+
+        },
+        //1.2 列表内容分页
+        //直接跳转
+        handleSizeChange(val) {
+            this.page = val;
+            this.getData();
+        },
+        //1.3 点击分页
+        handleCurrentChange(val) {
+            this.page = val;
+            this.getData();
+        },
+    },
+    mounted() {
+        this.activeid = this.$route.query.id
+        console.log(this.activeid);
+
+        this.getData()
+
+
+    },
+}
+</script>
+
+<style scoped lang="less">
+.layerBox {
+    padding: 30px 20px;
+}
+</style>

+ 372 - 356
src/views/advertise/adPlaceList.vue

@@ -1,44 +1,28 @@
 <template>
 <template>
-    <!-- 广告列表 -->
+    <!-- 广告位管理 -->
     <div>
     <div>
-        <!-- 提示信息 -->
-        <div class="tips">
-            <el-row>
-                <el-col :span="12">
-                    <i class="tipsIcon"></i>
-                    <span class="tipsText">7个工作日内,若运营没有操作用户的申请,则用户申请的时间、信息等将会释放。</span>
-                </el-col>
-            </el-row>
-        </div>
         <!-- 头部搜索框部分 -->
         <!-- 头部搜索框部分 -->
         <div class="title">
         <div class="title">
             <el-row>
             <el-row>
                 <el-col :span="6" class="left">
                 <el-col :span="6" class="left">
                     <div class="searchBox">
                     <div class="searchBox">
-                        <div class="searchTitle">工单编号</div>
-                        <el-input class="input" v-model="order_code" placeholder="请输入工单编号"></el-input>
-                    </div>
-                </el-col>
-                <el-col :span="6" class="left">
-                    <div class="searchBox">
-                        <div class="searchTitle">审核状态</div>
-                        <el-select v-model="status" placeholder="请选择审核状态">
-                            <el-option v-for="item in order" :key="item.value" :label="item.label" :value="item.value">
+                        <div class="searchTitle">网站名称</div>
+                        <el-select v-model="webSiteName_id" :multiple="false" :multiple-limit="1" filterable remote
+                            reserve-keyword placeholder="请输入网站名称" :remote-method="getWebNavList"
+                            :loading="webSiteLoading" @change="selectWebSite">
+                            <el-option v-for="item in webSiteList" :key="item.value" :label="item.label"
+                                :value="item.value">
                             </el-option>
                             </el-option>
                         </el-select>
                         </el-select>
                     </div>
                     </div>
                 </el-col>
                 </el-col>
                 <el-col :span="6" class="left">
                 <el-col :span="6" class="left">
                     <div class="searchBox">
                     <div class="searchBox">
-                        <div class="searchTitle">广告状态</div>
-                        <el-select v-model="ad_status" placeholder="请选择广告状态">
-                            <el-option v-for="item in order_ad" :key="item.value" :label="item.label"
-                                :value="item.value">
-                            </el-option>
-                        </el-select>
+                        <div class="searchTitle">广告位名称</div>
+                        <el-input v-model="adPlaceName" class="input" placeholder="请输入广告位名称"></el-input>
                     </div>
                     </div>
                 </el-col>
                 </el-col>
-                <el-col :span="6" class="right">
+                <el-col :span="8" class="right">
                     <div class="btnList">
                     <div class="btnList">
                         <button class="search" @click="goSearch">搜索</button>
                         <button class="search" @click="goSearch">搜索</button>
                         <button class="reset" @click="goReset">重置</button>
                         <button class="reset" @click="goReset">重置</button>
@@ -49,36 +33,35 @@
         <!--表格内容 start------------------------------------------------------------>
         <!--表格内容 start------------------------------------------------------------>
         <div class="layerBox">
         <div class="layerBox">
             <tableTitle :name="tableDivTitle" />
             <tableTitle :name="tableDivTitle" />
+            <button class="btn" @click="addWebsite">添加广告位</button>
             <el-row>
             <el-row>
                 <template>
                 <template>
                     <el-table class="my-table" :data="tableData" style="width: 100%">
                     <el-table class="my-table" :data="tableData" style="width: 100%">
                         <el-table-column fixed prop="id" label="编号" width="90">
                         <el-table-column fixed prop="id" label="编号" width="90">
                         </el-table-column>
                         </el-table-column>
-                        <el-table-column prop="order_num" label="工单编号" width="120">
-                        </el-table-column>
-                        <el-table-column prop="user_name" label="广告名称" width="255">
+                        <el-table-column prop="website_name" label="网站名称" width="160">
                         </el-table-column>
                         </el-table-column>
-                        <el-table-column prop="status" label="审核状态" width="90" algin="center">
+                        <el-table-column prop="name" label="广告位名称" width="230">
                         </el-table-column>
                         </el-table-column>
-                        <el-table-column prop="ad_status" label="广告状态" width="90">
+                        <el-table-column prop="type_name" label="广告类型" width="110">
                         </el-table-column>
                         </el-table-column>
-                        <el-table-column prop="sttime" label="开始时间" width="120">
+                        <el-table-column prop="size" label="宽/高 (PX)" width="120">
                         </el-table-column>
                         </el-table-column>
-                        <el-table-column prop="edtime" label="结束时间" width="120">
+                        <el-table-column prop="price" label="价格 (天)" width="110">
                         </el-table-column>
                         </el-table-column>
-                        <el-table-column prop="cttime" label="创建时间" width="">
+                        <el-table-column prop="created_at" label="创建时间" width="190">
                         </el-table-column>
                         </el-table-column>
-                        <el-table-column prop="admin_user_name" label="操作人" width="100">
+                        <el-table-column prop="updated_at" label="修改时间" width="190">
                         </el-table-column>
                         </el-table-column>
-                        <el-table-column fixed="right" label="操作" width="330">
+                        <el-table-column fixed="right" label="操作" width="300">
                             <template slot-scope="scope">
                             <template slot-scope="scope">
                                 <div class="listBtnBox">
                                 <div class="listBtnBox">
                                     <div class="listDeleteBtn" @click="deleteRow(scope.row.id)"><i
                                     <div class="listDeleteBtn" @click="deleteRow(scope.row.id)"><i
                                             class="el-icon-delete"></i>删除</div>
                                             class="el-icon-delete"></i>删除</div>
                                     <div class="listEditBtn" @click="goEdit(scope.row.id, scope.row)"><i
                                     <div class="listEditBtn" @click="goEdit(scope.row.id, scope.row)"><i
                                             class="el-icon-edit-outline"></i>编辑</div>
                                             class="el-icon-edit-outline"></i>编辑</div>
-                                    <div class="listReviewBtn" @click="goReview(scope.row.id, scope.row)"><i
-                                            class="review"></i>审核</div>
+                                    <div class="listLookBtn" @click="goLook(scope.row.id)"><i
+                                            class="el-icon-view"></i>查看</div>
                                 </div>
                                 </div>
                             </template>
                             </template>
                         </el-table-column>
                         </el-table-column>
@@ -101,96 +84,82 @@
         <!--表格内容 end------------------------------------------------------------>
         <!--表格内容 end------------------------------------------------------------>
 
 
         <!-- 弹出框 编辑 start----------------------------------------------------------->
         <!-- 弹出框 编辑 start----------------------------------------------------------->
-        <el-dialog :title="dialogName" :visible.sync="dialogTableVisible" width="56%" top="8vh">
+        <el-dialog :title="dialogName" :visible.sync="dialogTableVisible" width="50%" top="8vh"
+            :close-on-click-modal="false">
             <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
             <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
                 <div class="dialogText">
                 <div class="dialogText">
-                    <el-form-item label="广告名称:" prop="">
-                        <el-input v-model="ruleForm.name" disabled placeholder="请输入网站名称"></el-input>
+                    <el-form-item label="网站名称:" prop="webName">
+                        <el-select v-model="ruleForm.webName" :multiple="false" :multiple-limit="1" filterable remote
+                            reserve-keyword placeholder="请输入网站名称" :remote-method="getWebNavList"
+                            :loading="webSiteLoading" @change="detectionWebSite">
+                            <el-option v-for="item in webSiteList" :key="item.value" :label="item.label"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
                     </el-form-item>
                     </el-form-item>
-                    <el-form-item label="广告网址:" prop="">
-                        <el-input v-model="ruleForm.name" disabled placeholder="请输入网站名称"></el-input>
+                    <el-form-item label="广告位名称:" prop="adName">
+                        <el-input v-model="ruleForm.adName" placeholder="请输入广告位名称"></el-input>
                     </el-form-item>
                     </el-form-item>
-                    <el-form-item label="广告图:" prop="">
-                        <div class="adImage">
-                            <img src="../../assets/advertise/404.png" alt="">
+                    <el-form-item label="广告位介绍:" prop="adDesc">
+                        <el-input v-model="ruleForm.adDesc" type="textarea" :rows="2" placeholder="请输入广告位介绍"
+                            resize="none">
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="广告示例图:" prop="adPhoto" :label-width="formLabelWidth"
+                        :class="['custom-form-item']" class="custom-align-right">
+                        <div class="uploaderBox">
+                            <!--图片上传组件 start ------------------------------------------------------------>
+                            <div class="avatar-upload-container" @mouseenter="hovering = true"
+                                @mouseleave="hovering = false">
+                                <!-- 上传组件 -->
+                                <el-upload class="avatar-uploader" action="#" :show-file-list="false"
+                                    :before-upload="beforeAvatarUpload">
+                                    <!-- 预览图片 -->
+                                    <img v-if="logoUrl" :src="logoUrl" class="avatar">
+                                    <div v-else class="chooseImgDiv">
+                                        <div>
+                                            <img src="@/assets/public/upload/noImage.png">
+                                            <div>选择图片</div>
+                                        </div>
+                                    </div>
+                                    <input type="hidden" name="logo" v-model="ruleForm.adPhoto">
+                                </el-upload>
+                                <!-- 删除按钮,当鼠标悬浮时显示 -->
+                                <div v-if="hovering && logoUrl" class="delete-button" @click="handleDelete">
+                                    <i class="el-icon-delete"></i>
+                                </div>
+                            </div>
+                            <!--图片上传组件 end ------------------------------------------------------------>
                         </div>
                         </div>
                     </el-form-item>
                     </el-form-item>
-                    <el-form-item label="持续时间:" prop="">
-                        <el-date-picker v-model="ruleForm.startTime" type="datetime" disabled placeholder="选择日期时间">
-                        </el-date-picker> 至
-                        <el-date-picker v-model="ruleForm.endTime" type="datetime" disabled placeholder="选择日期时间">
-                        </el-date-picker>
+                    <el-form-item label="广告类型:" prop="adType">
+                        <el-radio v-model="ruleForm.adType" label='2'>图片</el-radio>
                     </el-form-item>
                     </el-form-item>
-                    <el-form-item label="广告尺寸:" prop="">
-                        <el-radio v-model="ruleForm.radio" label="1">1200x90px</el-radio>
-                        <el-radio v-model="ruleForm.radio" label="2">420x560px</el-radio>
+                    <el-form-item label="广告位大小:" prop="adSize">
+                        <el-select v-model="ruleForm.adSize" placeholder="请选择广告位大小">
+                            <el-option v-for="item in options" :key="item.value" :label="item.label"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
                     </el-form-item>
                     </el-form-item>
-
                     <el-form-item label="价格:" prop="price">
                     <el-form-item label="价格:" prop="price">
-                        <div class="price">
-                            <el-input v-model="ruleForm.price" placeholder="请输入价格"></el-input> 元 x
-                            <el-input v-model="ruleForm.days" disabled placeholder="请输入天数"></el-input> 天 x
-                            <el-input v-model="ruleForm.num" disabled placeholder="请输入个数"></el-input> 个
-                        </div>
+                        <el-input v-model="ruleForm.price" placeholder="请输入价格"></el-input>
                     </el-form-item>
                     </el-form-item>
-                    <el-form-item label="广告位置:" prop="">
-                        <span class="example" @click="goGraph">查看示例图</span>
-                        <div>
-                            <el-button disabled v-for="item in 12" class="el_btnList">中农兴业网 一号广告位</el-button>
-                        </div>
+                    <el-form-item label="状态:" prop="status">
+                        <el-radio v-model="ruleForm.status" label="1">通过</el-radio>
+                        <el-radio v-model="ruleForm.status" label="2">下架</el-radio>
                     </el-form-item>
                     </el-form-item>
                 </div>
                 </div>
                 <div class="dialogBtn">
                 <div class="dialogBtn">
-                    <button class="cancel" @click="cancelForm">取消</button>
-                    <button class="submit" @click="submitForm">提交</button>
+                    <!-- <button class="cancel" @click="cancelForm">取消</button>
+                    <button class="submit" @click="submitForm">提交</button> -->
+                    <el-button type="info" @click="cancelForm">取消</el-button>
+                    <el-button type="primary" @click="submitForm">提交</el-button>
                 </div>
                 </div>
             </el-form>
             </el-form>
         </el-dialog>
         </el-dialog>
         <!-- 弹出框 编辑 end----------------------------------------------------------->
         <!-- 弹出框 编辑 end----------------------------------------------------------->
-
-        <!-- 弹出框 广告位示例图 start----------------------------------------------------------->
-        <el-dialog title="审核状态" :visible.sync="dialogVisible" width="50%" top="25vh">
-            <ul class="graph">
-                <li>
-                    <h3>首页:</h3>
-                    <img src="../../assets/advertise/guanggaowei2.png" alt="">
-                </li>
-                <li>
-                    <h3>列表页:</h3>
-                    <img src="../../assets/advertise/guanggaowei1.png" alt="">
-                </li>
-            </ul>
-            <div slot="footer" class="dialog-footer">
-                <el-button @click="dialogVisible = false">取 消</el-button>
-                <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
-            </div>
-        </el-dialog>
-        <!-- 弹出框 广告位示例图 end----------------------------------------------------------->
-
-        <!-- 弹出框 审核 start----------------------------------------------------------->
-        <el-dialog title="审核状态" :visible.sync="dialogFormVisible" width="35%" top="25vh">
-            <el-form ref="form" :model="form" label-width="80px">
-                <div class="radioGroup">
-                    <el-radio-group v-model="status_radio">
-                        <el-radio :label="3">通过</el-radio>
-                        <el-radio :label="6">驳回</el-radio>
-                    </el-radio-group>
-                    <el-form-item v-show="this.status_radio == 6" label="驳回原因:" :label-width="formLabelWidth"
-                        prop="name">
-                        <el-input v-model="textarea" type="textarea" resize="none" :rows="3" placeholder="请输入内容">
-                        </el-input>
-                    </el-form-item>
-                </div>
-
-            </el-form>
-            <div slot="footer" class="dialog-footer">
-                <el-button @click="dialogFormVisible = false">取 消</el-button>
-                <el-button type="primary" @click="subimtStatus">确 定</el-button>
-            </div>
-        </el-dialog>
-        <!-- 弹出框 审核 end----------------------------------------------------------->
     </div>
     </div>
-
 </template>
 </template>
 
 
 <script>
 <script>
@@ -199,76 +168,35 @@ import tableTitle from './components/tableTitle.vue';
 
 
 //引入公用样式
 //引入公用样式
 import '@/styles/global.less';
 import '@/styles/global.less';
-import { getStatus, getOrderListAdmin, getOrderDetailAdmin, applyOrderStatusAdmin, editOrderAdmin, rejectOrderAdmin, endOrderAdmin, delOrderAdmin } from '@/api/advertise'
+import { createAdPlace, getAdPlaceList, delAdPlace, updateAdPlace, getAdList, getAdPlaceInfo } from '@/api/advertise'
 export default {
 export default {
     components: {
     components: {
         tableTitle,//表格标题-
         tableTitle,//表格标题-
     },
     },
     data() {
     data() {
+        const validateEmpty = (rule, value, callback) => {
+            if (value.length == 0) {
+                callback(new Error('该项不能为空!'))
+            } else {
+                callback()
+            }
+        }
         return {
         return {
             tableDivTitle: "广告列表",  //列表标题
             tableDivTitle: "广告列表",  //列表标题
             dialogTableVisible: false,      //编辑弹框
             dialogTableVisible: false,      //编辑弹框
             dialogName: '编辑', //编辑弹窗名称
             dialogName: '编辑', //编辑弹窗名称
-            dialogFormVisible: false,     //审核弹框
-            dialogVisible: false,  //示例图弹窗
 
 
-            form: {},  //审核状态的ref属性名称
+            tableData: [],//表格数据
 
 
+            // 可以输入的搜索框相关
+            webSiteList: [],//获取关联网站列表
+            webSiteLoading: false,
 
 
-            tableData: [],//表格数据
+            //3.4 上传logo图片
+            logoUrl: '',
+            hovering: false, // 鼠标悬浮状态 悬浮时显示删除
 
 
-            // 搜索框相关
-            order_code: '', //工单编号 
-            status: '',//审核状态
-            ad_status: '',//广告状态
-            order: [ //审核状态数据
-                {
-                    value: 1,
-                    label: '已通过'
-                },
-                {
-                    value: 2,
-                    label: '已驳回'
-                },
-                {
-                    value: 5,
-                    label: '待审核'
-                },
-            ],
-            order_ad: [ //广告状态数据
-                {
-                    value: 1,
-                    label: '待投放'
-                },
-                {
-                    value: 2,
-                    label: '已驳回'
-                },
-                {
-                    value: 3,
-                    label: '已撤回'
-                },
-                {
-                    value: 4,
-                    label: '已修改'
-                },
-                {
-                    value: 5,
-                    label: '已过期'
-                },
-                {
-                    value: 6,
-                    label: '待审核'
-                },
-                {
-                    value: 7,
-                    label: '已结束'
-                },
-                {
-                    value: 8,
-                    label: '投放中'
-                }
-            ],
+            value: '',
 
 
             //活动id
             //活动id
             activeid: "",
             activeid: "",
@@ -276,83 +204,58 @@ export default {
             // 分页相关
             // 分页相关
             page: 1,
             page: 1,
             pageSize: 10,
             pageSize: 10,
-            total: '',
+            total: 0,
 
 
-            // 审核弹窗相关
-            status_radio: "",   //审核状态
-            textarea: '',    //驳回原因
+            options: [
+                {
+                    value: '1',
+                    label: '1200x90'
+                }
+            ],
+
+            formLabelWidth: '', //广告示例图相关
 
 
-            formLabelWidth: '',
+
+            // 搜索框相关
+            webSiteName_id: '', //网站名称id
+            adPlaceName: '', //广告位名称
+            website_id: "", //网站id
 
 
             ruleForm: {
             ruleForm: {
-                name: '', //广告名称
-                ad_url: '', //广告网址
-                radio: '',//广告尺寸
-                startTime: '', //开始时间
-                endTime: '',   //结束时间
+                webName: '', //网站名称
+                adName: '', //广告位名称
+                adDesc: '',//广告位介绍
+                adPhoto: '', //广告示例图
+                adType: '',//广告类型
+                adSize: '',   //广告位大小
                 price: '',  //价格
                 price: '',  //价格
-                days: '',   //天数
-                num: '',   //个数
+                status: '',   //状态
             },
             },
             rules: {
             rules: {
-                name: [
-                    { required: true, message: '请输入网站名称', trigger: 'blur' },
-                ],
-                price: [
-                    { required: true, message: '请输入要修改的价格', trigger: 'change' }
-                ]
+                webName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                adName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                adDesc: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                adPhoto: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                adType: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                adSize: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                price: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                status: [{ required: true, trigger: 'blur', validator: validateEmpty }],
             }
             }
         }
         }
     },
     },
-    watch: {
-        status_radio: {
-            handler(newVal, oldVal) {
-                // console.log(newVal);
-            },
-            deep: true,
-            immediate: true
-        }
-    },
     methods: {
     methods: {
         //1.列表和分页相关 start ------------------------------------------------------------>
         //1.列表和分页相关 start ------------------------------------------------------------>
         //1.1 开始请求列表信息方法
         //1.1 开始请求列表信息方法
         getData() {
         getData() {
-            let data = new FormData()
-            data.append('page', this.page)
-            data.append('pageSize', this.pageSize)
-            console.log(data);
-
-            getOrderListAdmin(data).then(data => {
-                console.log("全部数据", data);
-                console.log(data.data.rows);
+            getAdPlaceList({
+                page: this.page,
+                pageSize: this.pageSize
+            }).then(data => {
+                console.log(data);
                 this.tableData = data.data.rows
                 this.tableData = data.data.rows
                 this.total = data.data.count
                 this.total = data.data.count
                 for (let item of this.tableData) {
                 for (let item of this.tableData) {
-                    if (item.status == 1) {
-                        item.status = "已通过"
-                    } else if (item.status == 2) {
-                        item.status = "已驳回"
-                    } else if (item.status == 6) {
-                        item.status = "待审核"
-                    }
-
-                    if (item.ad_status == 1) {
-                        item.ad_status = "待投放"
-                    } else if (item.ad_status == 2) {
-                        item.ad_status = "已驳回"
-                    } else if (item.ad_status == 3) {
-                        item.ad_status = "已撤回"
-                    } else if (item.ad_status == 4) {
-                        item.ad_status = "已修改"
-                    } else if (item.ad_status == 5) {
-                        item.ad_status = "已过期"
-                    } else if (item.ad_status == 6) {
-                        item.ad_status = "待审核"
-                    } else if (item.ad_status == 7) {
-                        item.ad_status = "已结束"
-                    } else if (item.ad_status == 8) {
-                        item.ad_status = "待投放"
-                    }
+                    item.size = item.width + 'x' + item.height
                 }
                 }
             })
             })
         },
         },
@@ -362,32 +265,30 @@ export default {
             console.log(id);
             console.log(id);
             let data = new FormData()
             let data = new FormData()
             data.append('id', id)
             data.append('id', id)
-
             this.$confirm('注意:删除后,该条信息及其绑定关系全部删除', '是否确认删除该条信息?', {
             this.$confirm('注意:删除后,该条信息及其绑定关系全部删除', '是否确认删除该条信息?', {
                 confirmButtonText: '确定',
                 confirmButtonText: '确定',
                 cancelButtonText: '取消',
                 cancelButtonText: '取消',
             }).then(() => {
             }).then(() => {
                 console.log("当前删除:" + id)
                 console.log("当前删除:" + id)
-                let data = new FormData()
-                data.append('id', id)
-                console.log(data);
 
 
-                delOrderAdmin(data).then(data => {
+                delAdPlace({
+                    id: id
+                }).then(data => {
                     console.log(data);
                     console.log(data);
-                    if (data.code == 0) {
+                    if (data.code = 200) {
+                        this.$message({
+                            message: '删除成功',
+                            type: 'success'
+                        })
+                        this.getData()
+                    } else if (data.code == 0) {
                         this.$message({
                         this.$message({
                             message: data.message,
                             message: data.message,
                             type: 'error'
                             type: 'error'
                         })
                         })
                     }
                     }
-                    if (data.code == 200) {
-                        this.$message({
-                            type: 'success',
-                            message: '删除成功!'
-                        });
-                    }
-                    this.getData()
                 })
                 })
+
             }).catch(() => {
             }).catch(() => {
                 this.$message({
                 this.$message({
                     type: 'warning',
                     type: 'warning',
@@ -413,159 +314,259 @@ export default {
         },
         },
         // 1.6 搜索按钮
         // 1.6 搜索按钮
         goSearch() {
         goSearch() {
-            console.log(this.status);
-            
-            let data = new FormData()
-            data.append('page', this.page)
-            data.append('pageSize', this.pageSize)
-            data.append('status', this.status)
-            data.append('ad_status', this.ad_status)
-            data.append('order_num', this.order_code)
-            data.append('sttime', "")
-            data.append('edtime', "")
-            console.log(data);
-
-            getOrderListAdmin(data).then(data => {
+            getAdPlaceList({
+                page: this.page,
+                pageSize: this.pageSize,
+                name: this.adPlaceName,
+                website_id: this.webSiteName_id, //广告位名称 id
+            }).then(data => {
                 console.log(data);
                 console.log(data);
-                console.log(data.data.rows);
                 this.tableData = data.data.rows
                 this.tableData = data.data.rows
                 this.total = data.data.count
                 this.total = data.data.count
                 for (let item of this.tableData) {
                 for (let item of this.tableData) {
-                    if (item.status == 1) {
-                        item.status = "已通过"
-                    } else if (item.status == 2) {
-                        item.status = "已驳回"
-                    } else if (item.status == 6) {
-                        item.status = "待审核"
-                    }
-
-                    if (item.ad_status == 1) {
-                        item.ad_status = "待投放"
-                    } else if (item.ad_status == 2) {
-                        item.ad_status = "已驳回"
-                    } else if (item.ad_status == 3) {
-                        item.ad_status = "已撤回"
-                    } else if (item.ad_status == 4) {
-                        item.ad_status = "已修改"
-                    } else if (item.ad_status == 5) {
-                        item.ad_status = "已过期"
-                    } else if (item.ad_status == 6) {
-                        item.ad_status = "待审核"
-                    } else if (item.ad_status == 7) {
-                        item.ad_status = "已结束"
-                    } else if (item.ad_status == 8) {
-                        item.ad_status = "待投放"
-                    }
+                    item.size = item.width + 'x' + item.height
                 }
                 }
             })
             })
+
         },
         },
         //1.7 重置按钮
         //1.7 重置按钮
         goReset() {
         goReset() {
-            this.order_code = '',
-                this.status = ''
-            this.ad_status = ''
-            this.getData();
+            this.webSiteName_id = ""
+            this.adPlaceName = ""
+            this.getData()
         },
         },
         //列表和分页相关 end ------------------------------------------------------------>
         //列表和分页相关 end ------------------------------------------------------------>
 
 
         //1.9 编辑
         //1.9 编辑
         goEdit(id, val) {
         goEdit(id, val) {
-            console.log(id);
-
+            // console.log(id);
+            this.dialogName = '编辑'
             this.activeid = id
             this.activeid = id
             this.dialogTableVisible = true
             this.dialogTableVisible = true
             console.log(id, val);
             console.log(id, val);
-            this.ruleForm.name = val.user_name
-            this.ruleForm.ad_url = val.ad_url
-            // this.ruleForm.radio = val.width
-            this.ruleForm.startTime = val.sttime
-            this.ruleForm.endTime = val.edtime
-            this.ruleForm.price = val.price
-            this.ruleForm.days = val.days
+            // console.log("状态", val.status);
+
+            //数据回显
+            this.website_id = val.website_id
+            this.ruleForm.webName = val.website_name //网站名称
+            this.ruleForm.adName = val.name //广告位名称
+            this.ruleForm.adDesc = val.introduce //广告位介绍
+            this.logoUrl = val.thumb //广告示例图
+            this.ruleForm.adPhoto = val.thumb //广告示例图
+            this.ruleForm.price = val.price //价格
+            this.ruleForm.status = val.status //状态
+
+            if (val.ad_size_id == 1) {
+                this.ruleForm.adSize = '1'  //广告位大小
+            }
+            if (val.typeid == 2) {
+                this.ruleForm.adType = '2' //广告类型
+            }
+            if (val.status == 1) {
+                this.ruleForm.status = '1' //状态
+            } else if (val.status == 2) {
+                this.ruleForm.status = '2' //状态
+            }
+
         },
         },
 
 
-        //2.0 审核
-        goReview(id, val) {
+        //2.0 查看
+        goLook(id) {
             this.activeid = id
             this.activeid = id
-            this.dialogFormVisible = true
+            this.$router.push({
+                path: '/adPlaceDetail',
+                query: {
+                    id: this.activeid
+                }
+            })
         },
         },
 
 
-        //审核中的确定
-        subimtStatus() {
-            if (this.status_radio == '3') {
-                let data = new FormData()
-                data.append('id', this.activeid)
-                applyOrderStatusAdmin(data).then(data => {
+        //1.7 添加
+        addWebsite() {
+            this.dialogTableVisible = true
+            this.dialogName = "添加"
+
+            //添加时清空回显回来的数据
+            this.ruleForm.webName = '' //网站名称
+            this.ruleForm.adName = '' //广告位名称
+            this.ruleForm.adDesc = '' //广告位介绍
+            this.ruleForm.adPhoto = '' //广告示例图
+            this.ruleForm.adSize = '' //广告尺寸
+            this.ruleForm.adType = '2' //广告类型
+            this.ruleForm.price = '' //价格
+            this.ruleForm.status = '' //状态
+            this.logoUrl = ''
+        },
+
+        // 弹出层相关方法
+        // 提交表单
+        submitForm() {
+            // 判断用户是否输入数据
+            if (this.ruleForm.webName == '') {
+                this.$message({
+                    message: '请将数据填写完整',
+                    type: 'error'
+                })
+                return
+            }
+            if (this.dialogName == "添加") {
+                createAdPlace({
+                    name: this.ruleForm.adName,
+                    website_id: this.website_id,
+                    price: this.ruleForm.price,
+                    thumb: this.ruleForm.adPhoto,
+                    typeid: this.ruleForm.adType,
+                    ad_size_id: this.ruleForm.adSize,
+                    status: this.ruleForm.status,
+                    introduce: this.ruleForm.adDesc,
+                }).then(data => {
                     console.log(data);
                     console.log(data);
                     if (data.code == 200) {
                     if (data.code == 200) {
                         this.$message({
                         this.$message({
-                            message: '已修改审核状态',
+                            message: '添加成功',
                             type: 'success'
                             type: 'success'
                         })
                         })
-                        this.dialogFormVisible = false
+                        this.dialogTableVisible = false
                         this.getData()
                         this.getData()
-                    }
-                    if (data.code == 0) {
+                    } else if (data.code == 0) {
+                        this.$message({
+                            message: data.message,
+                            type: 'error'
+                        })
+                        this.dialogTableVisible = true
+                        return
+                    } else {
                         this.$message({
                         this.$message({
                             message: data.message,
                             message: data.message,
                             type: 'error'
                             type: 'error'
                         })
                         })
+                        this.dialogTableVisible = true
+                        return
                     }
                     }
                 })
                 })
             }
             }
-            if (this.status_radio == '6') {
-                let data = new FormData()
-                data.append('id', this.activeid)
-                data.append('reason', this.textarea)
-                rejectOrderAdmin(data).then(data=>{
+
+            if (this.website_id == '') {
+                this.$message({
+                    message: '请输入并选择网站名称',
+                    type: 'error'
+                })
+                this.dialogVisible = true
+            }
+            if (this.dialogName == "编辑") {
+                updateAdPlace({
+                    name: this.ruleForm.adName,
+                    website_id: this.website_id,
+                    price: this.ruleForm.price,
+                    thumb: this.ruleForm.adPhoto,
+                    typeid: this.ruleForm.adType,
+                    ad_size_id: this.ruleForm.adSize,
+                    status: this.ruleForm.status,
+                    introduce: this.ruleForm.adDesc,
+                    id: this.activeid
+                }).then(data => {
                     console.log(data);
                     console.log(data);
-                    if(data.code==200){
+                    if (data.code == 200) {
                         this.$message({
                         this.$message({
-                            message:'修改成功',
-                            type:'success'
+                            message: '编辑成功',
+                            type: 'success'
                         })
                         })
-                        this.dialogFormVisible = false
-                        this.getData()
+                        this.dialogTableVisible = false
                     }
                     }
-                    if(data.code==0){
+                    if (data.code == 0) {
                         this.$message({
                         this.$message({
-                            message:data.message,
-                            type:'error'
+                            message: data.message,
+                            type: 'error'
                         })
                         })
+                        this.dialogTableVisible = true
                     }
                     }
+                    this.getData()
                 })
                 })
             }
             }
 
 
         },
         },
-        // 弹出层相关方法
-        // 提交表单
-        submitForm() {
-            let data = new FormData()
-            data.append('id', this.activeid)
-            data.append('price', this.ruleForm.price)
-            editOrderAdmin(data).then(data => {
-                console.log(data);
-                if (data.code == 200) {
-                    this.dialogTableVisible = false
-                    this.$message({
-                        message: '修改成功',
-                        type: 'success'
-                    })
-                }
-                if (data.code == 0) {
-                    this.$message({
-                        message: data.message + ',需要保留两位小数',
-                        type: 'error'
-                    })
-                    this.dialogTableVisible = true
-                }
-            })
-        },
         //取消添加或编辑
         //取消添加或编辑
         cancelForm() {
         cancelForm() {
             this.dialogTableVisible = false
             this.dialogTableVisible = false
         },
         },
+        //3.6 上传图片操作
+        beforeAvatarUpload(file) {
+            const isJPG = file.type === 'image/jpeg';
+            const isPNG = file.type === 'image/png';
+            const isLt2M = file.size / 1024 / 1024 < 2;
+
+            if (!isJPG && !isPNG) {
+                this.$message.error('上传图片只能是 JPG 或 PNG 格式!');
+                return false;
+            }
+            if (!isLt2M) {
+                this.$message.error('上传图片大小不能超过 2MB!');
+                return false;
+            }
 
 
+            const formData = new FormData();
+            formData.append('file', file);
+
+            this.$store.dispatch('pool/uploadFile', formData).then(res => {
+                this.logoUrl = res.data.imgUrl;//显示缩略图
+                this.ruleForm.adPhoto = res.data.imgUrl;//提供表单地址
+                console.log(res.data.imgUrl)
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '网络错误,请重试!'
+                });
+            })
+
+            // 阻止默认的上传行为
+            return false;
+        },
+        handleDelete() {
+            // 删除图片
+            this.logoUrl = ''; // 清空图片 URL
+        },
+
+        //搜索部分的输入关键词下拉框
+        selectWebSite(value) {
+            this.webSiteName_id = value
+        },
+
+        //添加 / 编辑弹窗中输入关键词下拉框 
+        // 判断是否已经关联了网站
+        detectionWebSite(value) {
+            console.log(value);
+            this.website_id = value
+            console.log(this.website_id);
+
+        },
+
+        //
+        getWebNavList(query) {
+            if (query !== '') {
+                this.webSiteLoading = true;
+                let data = { keyword: query }
+                let dataArr = [];
+                this.$store.dispatch('pool/getNavWebList', data).then(res => {
+                    console.log(res.data)
+                    for (let item of res.data) {
+                        let data = {};
+                        data.key = item.id;
+                        data.value = item.id;
+                        data.label = item.website_name;
+                        dataArr.push(data)
+                    }
+                    this.webSiteList = dataArr;
+                    this.webSiteLoading = false;
+                }).catch(() => {
+                    this.$message({
+                        type: 'info',
+                        message: '网络错误,请重试!'
+                    });
+                })
+            } else {
+                this.navList = [];
+            }
+        },
     },
     },
     mounted() {
     mounted() {
         this.getData()
         this.getData()
@@ -574,6 +575,10 @@ export default {
 </script>
 </script>
 
 
 <style scoped lang="less">
 <style scoped lang="less">
+input[aria-hidden=true] {
+    display: none !important;
+}
+
 // 提示信息
 // 提示信息
 .tips {
 .tips {
     margin: 30px;
     margin: 30px;
@@ -617,7 +622,7 @@ export default {
             position: relative;
             position: relative;
             font-size: 14px;
             font-size: 14px;
             display: inline-block;
             display: inline-block;
-            width: 73%;
+            width: 80%;
         }
         }
 
 
         .searchTitle {
         .searchTitle {
@@ -645,7 +650,7 @@ export default {
             height: 38px;
             height: 38px;
             border: none;
             border: none;
             border-radius: 8px;
             border-radius: 8px;
-            padding: 0 20px;
+            padding: 0 30px;
         }
         }
 
 
         .search {
         .search {
@@ -690,7 +695,7 @@ export default {
 
 
     .listDeleteBtn,
     .listDeleteBtn,
     .listEditBtn,
     .listEditBtn,
-    .listReviewBtn {
+    .listLookBtn {
         margin-left: 0px;
         margin-left: 0px;
         padding-left: 0px;
         padding-left: 0px;
         margin-right: 20px;
         margin-right: 20px;
@@ -700,20 +705,15 @@ export default {
     }
     }
 
 
 
 
-    .listReviewBtn {
+    .listLookBtn {
         text-align: center;
         text-align: center;
         border-radius: 8px;
         border-radius: 8px;
         cursor: pointer;
         cursor: pointer;
-        color: #519C66;
-        background-color: rgba(81, 156, 102, 0.16);
+        color: #55b5f1;
+        background-color: rgba(85, 181, 241, 0.16);
 
 
-        >.review {
-            display: inline-block;
-            width: 20px;
-            height: 20px;
-            background: url("../../assets/advertise/Shield.png");
-            margin-right: 6px;
-            vertical-align: -6px;
+        >i {
+            padding-right: 8px;
         }
         }
     }
     }
 
 
@@ -736,7 +736,8 @@ export default {
 .dialogText {
 .dialogText {
     margin: 0 7px 0 3px;
     margin: 0 7px 0 3px;
     padding-bottom: 1px;
     padding-bottom: 1px;
-    padding: 0px 60px 1px 20px;
+    padding: 30px 60px 1px 20px;
+    background-color: #f5f7fb;
 
 
     .adImage {
     .adImage {
         width: 140px;
         width: 140px;
@@ -751,6 +752,13 @@ export default {
         }
         }
     }
     }
 
 
+
+
+    ::v-deep .avatar {
+        width: 140px;
+        height: auto;
+    }
+
     .price {
     .price {
         ::v-deep .el-input {
         ::v-deep .el-input {
             width: 29%;
             width: 29%;
@@ -775,6 +783,14 @@ export default {
     ::v-deep .el-button+.el-button {
     ::v-deep .el-button+.el-button {
         margin-left: 0px;
         margin-left: 0px;
     }
     }
+
+    ::v-deep .el-select {
+        width: 100%;
+    }
+
+    ::v-deep .el-form-item {
+        margin-bottom: 50px;
+    }
 }
 }
 
 
 // 弹出层按钮
 // 弹出层按钮

+ 762 - 0
src/views/website/blogroll.vue

@@ -0,0 +1,762 @@
+<template>
+    <!-- 友情链接列表 -->
+    <div>
+        <div class="title">
+            <el-row>
+                <el-col :span="6" class="left">
+                    <div class="searchBox">
+                        <div class="searchTitle">所属站点</div>
+                        <el-select v-model="siteName" :multiple="false" :multiple-limit="1" filterable remote
+                            reserve-keyword placeholder="请输入所属站点" :remote-method="getWebNavList"
+                            :loading="webSiteLoading" @change="selectWebSite">
+                            <el-option v-for="item in webSiteList" :key="item.value" :label="item.label"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
+                    </div>
+                </el-col>
+                <el-col :span="6" class="left">
+                    <div class="searchBox">
+                        <div class="searchTitle">链接名称</div>
+                        <el-input v-model="webName" placeholder="请输入链接名称"></el-input>
+                    </div>
+                </el-col>
+                <el-col :span="10" class="right">
+                    <div class="btnList">
+                        <button class="search" @click="goSearch">搜索</button>
+                        <button class="reset" @click="reset">重置</button>
+                    </div>
+                </el-col>
+            </el-row>
+        </div>
+        <!--表格内容 start------------------------------------------------------------>
+        <div class="layerBox">
+            <tableTitle :name="tableDivTitle" />
+            <button class="btn" @click="addWebsite">添加链接</button>
+            <el-row>
+                <template>
+                    <el-table class="my-table" :data="tableData" style="width: 100%">
+                        <el-table-column fixed prop="id" label="编号" width="70">
+                        </el-table-column>
+                        <el-table-column prop="website_name" label="关联网站" width="180">
+                        </el-table-column>
+                        <el-table-column prop="title" label="链接名称" width="160">
+                        </el-table-column>
+                        <el-table-column prop="url" label="链接网址" width="180">
+                        </el-table-column>
+                        <el-table-column prop="type" label="类型" width="90">
+                        </el-table-column>
+                        <el-table-column label="网站LOGO" width="150">
+                            <template slot-scope="scope">
+                                <img :src="scope.row.logo_url" alt="" class="uploadImage">
+                            </template>
+                        </el-table-column>
+                        <el-table-column prop="sort" label="排序" width="90">
+                        </el-table-column>
+                        <el-table-column prop="created_at" label="创建时间" width="180">
+                        </el-table-column>
+                        <el-table-column prop="updated_at" label="修改时间" width="180">
+                        </el-table-column>
+                        <el-table-column fixed="right" label="操作" width="220">
+                            <template slot-scope="scope">
+                                <div class="listBtnBox">
+                                    <div class="listDeleteBtn" @click="deleteRow(scope.row.id, scope.row)">
+                                        <i class="el-icon-delete"></i>删除
+                                    </div>
+                                    <div class="listEditBtn" @click="goEdit(scope.row.id, scope.row)">
+                                        <i class="el-icon-edit-outline"></i>编辑
+                                    </div>
+                                </div>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </template>
+            </el-row>
+        </div>
+        <!--分页 start------------------------------------------------------------>
+        <div class="alignBox">
+            <el-row>
+                <el-col :span="24">
+                    <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                        :current-page="page" :page-size="pageSize" layout="total, prev, pager, next, jumper"
+                        :total="total">
+                    </el-pagination>
+                </el-col>
+            </el-row>
+        </div>
+        <!--分页 end------------------------------------------------------------>
+        <!--表格内容 end------------------------------------------------------------>
+
+        <!-- 弹出框 start------------------------------------------------------------>
+        <el-dialog :title="dialogName" :visible.sync="dialogTableVisible" width="50%" :close-on-click-modal="false">
+            <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
+                <div class="dialogText">
+                    <el-form-item label="关联网站:" prop="correlationWeb">
+                        <el-select v-model="ruleForm.correlationWeb" :multiple="false" :multiple-limit="1" filterable
+                            remote reserve-keyword placeholder="请输入关联网站名称" :remote-method="getWebNavList"
+                            :loading="webSiteLoading" @change="detectionWebSite">
+                            <el-option v-for="item in webSiteList" :key="item.value" :label="item.label"
+                                :value="item.value">
+                            </el-option>
+                        </el-select>
+                    </el-form-item>
+                    <el-form-item label="链接名称:" prop="webName">
+                        <el-input v-model="ruleForm.webName" placeholder="请输入链接名称"></el-input>
+                    </el-form-item>
+                    <el-form-item label="链接地址:" prop="webUrl">
+                        <el-input v-model="ruleForm.webUrl" placeholder="请输入链接地址"></el-input>
+                    </el-form-item>
+                    <el-form-item label="类型:" prop="type">
+                        <el-radio v-model="ruleForm.type" label="1">图片</el-radio>
+                        <el-radio v-model="ruleForm.type" label="2">文本</el-radio>
+                        <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">
+                        <div class="uploaderBox">
+                            <!--图片上传组件 start ------------------------------------------------------------>
+                            <div class="avatar-upload-container" @mouseenter="hovering = true"
+                                @mouseleave="hovering = false">
+                                <!-- 上传组件 -->
+                                <el-upload class="avatar-uploader" action="#" :show-file-list="false"
+                                    :before-upload="beforeAvatarUpload">
+                                    <!-- 预览图片 -->
+                                    <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">
+                                            <div>选择图片</div>
+                                        </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">
+                                    <i class="el-icon-delete"></i>
+                                </div>
+                            </div>
+                            <!--图片上传组件 end ------------------------------------------------------------>
+                        </div>
+                    </el-form-item>
+                    <el-form-item label="网站介绍:" prop="">
+                        <el-input v-model="ruleForm.webDesc" type="textarea" :rows="3" placeholder="请输入网站介绍"
+                            resize="none">
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item label="排序:" prop="sort">
+                        <el-input v-model="ruleForm.sort" placeholder="请输入排序"></el-input>
+                    </el-form-item>
+
+                </div>
+                <div class="dialogBtn">
+                    <!-- <button class="cancel" @click="cancelForm">取消</button>
+                    <button class="submit" @click="submitFormTow">提交</button> -->
+                    <el-button type="info" @click="cancelForm">取消</el-button>
+                    <el-button type="primary" @click="submitForm">提交</el-button>
+                </div>
+            </el-form>
+        </el-dialog>
+        <!-- 弹出框 end------------------------------------------------------------>
+    </div>
+
+</template>
+
+<script>
+//表格标题
+import tableTitle from './components/blogroll/tableTitle.vue';
+//引入公用样式
+import '@/styles/global.less';
+// 引入api
+import { getLinkInfo, getLinkList, createLink, delLink, updateLink } from '@/api/link.js'
+
+export default {
+    components: {
+        tableTitle,//表格标题
+    },
+    data() {
+        const validateEmpty = (rule, value, callback) => {
+            if (value.length == 0) {
+                callback(new Error('该项不能为空!'))
+            } else {
+                callback()
+            }
+        }
+        return {
+            tableDivTitle: "友情链接列表",  //表格标题
+            webName: '', // 网站名称
+            activeId: '', // 被编辑的网站的id
+            activeType: '', //被编辑网站的type
+            disabled: true, //是否禁用
+
+
+            //搜索相关
+            siteName: '', //所属站点
+            webName: '', //网站名称
+
+            //3.4 上传logo图片
+            logoUrl: '',
+            hovering: false, // 鼠标悬浮状态 悬浮时显示删除
+
+
+            // 分页器相关
+            total: 0,
+            page: 1,
+            pageSize: 10,
+
+            //表格相关
+            tableData: [],
+
+            //弹出框相关
+            dialogTableVisible: false,  //是否显示
+            dialogName: '',     //弹框标题名
+
+
+            // 可以输入的搜索框相关
+            webSiteList: [],//获取关联网站列表
+            webSiteLoading: false,
+
+            options: [],
+            value: [],
+            list: [],
+
+            value: '',
+            radio: '1',
+            textarea: '',
+
+            // 图片相关
+            formLabelWidth: '120px',//表单的长度
+
+
+            website_id: "",
+            //表单相关
+            ruleForm: {
+                correlationWeb: '', //关联网站
+                webName: '',  //网站名称
+                webUrl: '', //网站地址
+                type: '1',  //类型
+                webLogo: '', //网站logo
+                webDesc: '', //网站介绍
+                sort: '',  //排序
+            },
+            rules: {   //规则
+                correlationWeb: [{ required: true, trigger: 'blur', validator: validateEmpty }], //关联网站
+                webName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                webUrl: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                type: [{ required: true, trigger: 'blur', validator: validateEmpty }],
+                sort: [{ required: true, trigger: 'blur', validator: validateEmpty }]
+            },
+
+        }
+    },
+    methods: {
+        //1.列表和分页相关 start ------------------------------------------------------------>
+        //1.1 获取网站列表数据
+        getData() {
+            getLinkList({
+                page: this.page,
+                pageSize: this.pageSize,
+            }).then(data => {
+                console.log(data);
+                this.tableData = data.data.rows
+                this.total = data.data.count
+                for (let item of this.tableData) {
+                    if (item.type == '1') {
+                        item.type = '图片'
+                    } else if (item.type == '2') {
+                        item.type = '文字'
+                    } else if (item.type == '3') {
+                        item.type = '底部'
+                    }
+                }
+            })
+        },
+        //1.2 删除内容
+        deleteRow(id, val) {
+            this.activeId = id
+            this.$confirm('注意:删除后,该条信息及其绑定关系全部删除', '是否确认删除该条信息?', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+            }).then(() => {
+                console.log("当前删除:" + id)
+                delLink({
+                    id: this.activeId,
+                }).then(data => {
+                    console.log(data);
+                    if (data.code == 200) {
+                        this.$message({
+                            type: 'success',
+                            message: '删除成功!'
+                        });
+                        this.getData()
+                    } else if (data.code == 0) {
+                        this.$message({
+                            type: 'error',
+                            message: data.message
+                        });
+                    }
+                })
+            }).catch(() => {
+                this.$message({
+                    type: 'warning',
+                    message: '已取消'
+                });
+            });
+        },
+
+        //1.3 列表内容分页
+        //直接跳转
+        handleSizeChange(val) {
+            this.page = val;
+            this.getData();
+        },
+        //1.4 点击分页
+        handleCurrentChange(val) {
+            this.page = val;
+            this.getData();
+        },
+
+        // 1.5 搜索按钮
+        goSearch() {
+            getLinkList({
+                page: this.page,
+                pageSize: this.pageSize,
+                website_id: this.siteName,
+                title: this.webName
+            }).then(data => {
+                console.log(data);
+                this.tableData = data.data.rows
+                this.total = data.data.count
+                for (let item of this.tableData) {
+                    if (item.type == '1') {
+                        item.type = '图片'
+                    } else if (item.type == '2') {
+                        item.type = '文字'
+                    } else if (item.type == '3') {
+                        item.type = '底部'
+                    }
+                }
+            })
+        },
+        //1.6 重置按钮
+        reset() {
+            this.siteName = ''
+            this.webName = ''
+            this.getData()
+        },
+        //列表和分页相关 end ------------------------------------------------------------>
+
+        //1.7 添加
+        addWebsite() {
+            this.dialogTableVisible = true //弹窗是否显示
+            this.dialogName = "添加"  //弹窗名称
+            this.ruleForm.correlationWeb = ''
+            this.ruleForm.webName = ''
+            this.ruleForm.webUrl = ''
+            this.ruleForm.type = '1'
+            this.ruleForm.webLogo = ''
+            this.ruleForm.webDesc = ''
+            this.ruleForm.sort = 0
+        },
+        //1.8 编辑
+        goEdit(id, val) {
+            this.dialogTableVisible = true //弹框显示
+            this.dialogName = "编辑"    //弹框名字
+            // console.log(val);
+
+            this.activeId = 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.webDesc = val.describe
+            this.ruleForm.sort = val.sort
+            if (val.type == "图片") {
+                this.ruleForm.type = '1'
+            } else if (val.type == "文字") {
+                this.ruleForm.type = '2'
+            } else if (val.type == "底部") {
+                this.ruleForm.type = '3'
+            }
+        },
+
+
+        // 弹出层相关方法
+        // 提交表单
+        submitForm() {
+            // console.log(123)
+            if (this.ruleForm.correlationWeb == '') {
+                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.dialogName == "编辑") {
+                if (this.website_id == " ") {
+                    this.$message.error("请输入并选择关联网站");
+                    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'
+                        })
+                    }
+                })
+            }
+        },
+        //取消添加或编辑
+        cancelForm() {
+            this.dialogTableVisible = false
+        },
+        //3.6 上传图片操作
+        beforeAvatarUpload(file) {
+            console.log(file);
+            // this.ruleForm.webLogo=file
+            const isJPG = file.type === 'image/jpeg';
+            const isPNG = file.type === 'image/png';
+            const isLt2M = file.size / 1024 / 1024 < 2;
+
+            if (!isJPG && !isPNG) {
+                this.$message.error('上传头像图片只能是 JPG 或 PNG 格式!');
+                return false;
+            }
+            if (!isLt2M) {
+                this.$message.error('上传头像图片大小不能超过 2MB!');
+                return false;
+            }
+
+            const formData = new FormData();
+            formData.append('file', file);
+
+            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)
+            }).catch(() => {
+                this.$message({
+                    type: 'info',
+                    message: '网络错误,请重试!'
+                });
+            })
+
+            // 阻止默认的上传行为
+            return false;
+        },
+        handleDelete() {
+            // 删除图片
+            this.logoUrl = ''; // 清空图片 URL
+        },
+
+        //搜索部分的输入关键词下拉框
+        selectWebSite(value) {
+            this.siteName = value
+        },
+
+        //添加 / 编辑弹窗中输入关键词下拉框 
+        // 判断是否已经关联了网站
+        detectionWebSite(value) {
+            console.log(value);
+            this.website_id = value
+            // let data = {
+            //     website_id: value
+            // }
+            //验证一下是不是存在了关联网站名称
+            // this.$store.dispatch('pool/getAdminWebsiteCategory', data).then(res => {
+            //     if (res.data.length > 0) {
+            //         this.ruleForm.webName = "";
+            //         this.$message({
+            //             type: 'warning',
+            //             message: '该网站已经关联了导航,请重新选择!'
+            //         });
+            //     }
+            // })
+        },
+
+        //
+        getWebNavList(query) {
+            if (query !== '') {
+                this.webSiteLoading = true;
+                let data = { keyword: query }
+                let dataArr = [];
+                this.$store.dispatch('pool/getNavWebList', data).then(res => {
+                    console.log(res.data)
+                    for (let item of res.data) {
+                        let data = {};
+                        data.key = item.id;
+                        data.value = item.id;
+                        data.label = item.website_name;
+                        dataArr.push(data)
+                    }
+                    this.webSiteList = dataArr;
+                    this.webSiteLoading = false;
+                }).catch(() => {
+                    this.$message({
+                        type: 'info',
+                        message: '网络错误,请重试!'
+                    });
+                })
+            } else {
+                this.navList = [];
+            }
+        },
+    },
+    mounted() {
+        //获取网站列表数据
+        this.getData()
+
+    }
+}
+</script>
+
+<style scoped lang="less">
+.title {
+    margin: 30px 30px 20px 30px;
+    padding: 30px 30px 40px 30px;
+    background-color: #fff;
+    border-radius: 20px 20px 20px 20px;
+    border: 1px solid #E9EDF7;
+
+    .left {
+        float: left;
+    }
+
+    .right {
+        float: right;
+    }
+
+    .searchBox {
+        .searchTitle {
+            padding-bottom: 10px;
+            font-family: Microsoft YaHei, Microsoft YaHei;
+            font-weight: 400;
+            font-size: 14px;
+            color: #999999;
+            line-height: 16px;
+        }
+
+        .el-select {
+            width: 85%;
+            display: inline-block;
+            position: relative;
+        }
+    }
+
+    .btnList {
+        float: right;
+        padding-top: 28px;
+
+        button {
+            width: 120px;
+            height: 38px;
+            border: none;
+            border-radius: 8px;
+            // padding: 0 30px;
+        }
+
+        .search {
+            background-color: #5570f1;
+            color: #fff;
+            margin-right: 20px;
+        }
+
+        .reset {
+            font-family: Microsoft YaHei, Microsoft YaHei;
+            font-weight: 400;
+            font-size: 16px;
+            color: #333333;
+            background: #F5F7FB;
+            border-radius: 8px 8px 8px 8px;
+            border: 1px solid rgba(85, 112, 241, 0.11);
+        }
+    }
+}
+
+.layerBox {
+    padding: 30px 20px;
+    position: relative;
+
+    .btn {
+        position: absolute;
+        top: 30px;
+        right: 20px;
+        height: 38px;
+        color: #fff;
+        background-color: #5570f1;
+        border: none;
+        border-radius: 8px;
+        padding: 8px 28px 9px;
+        box-sizing: border-box;
+    }
+
+    .listBtnBox {
+        justify-content: left;
+    }
+
+
+    .listDeleteBtn,
+    .listEditBtn,
+    .listLookBtn {
+        margin-left: 0px;
+        padding-left: 0px;
+        margin-right: 20px;
+        width: 76px;
+        height: 36px;
+        line-height: 36px;
+    }
+
+
+    .listLookBtn {
+        text-align: center;
+        border-radius: 8px;
+        cursor: pointer;
+        color: #55b5f1;
+        background-color: rgba(85, 181, 241, 0.16);
+
+        >i {
+            padding-right: 8px;
+        }
+    }
+
+    .uploadImage {
+        width: 130px;
+    }
+
+    // from表单中每条数据的下外边距
+    ::v-deep .el-form-item {
+        margin-bottom: 50px;
+    }
+
+    //下拉框宽度
+    ::v-deep .el-select {
+        width: 100%;
+    }
+
+    ::v-deep .el-input--medium,
+    ::v-deep .el-form-item__label {
+        line-height: 36px;
+        font-size: 16px;
+    }
+}
+
+// 弹出层内容
+.dialogText {
+    margin: 0 7px 0 3px;
+    padding-top: 20px;
+    padding-bottom: 1px;
+    padding: 20px 60px 1px 20px;
+    background-color: #f5f7fb;
+
+    // from表单中每条数据的下外边距
+    ::v-deep .el-form-item {
+        margin-bottom: 50px;
+    }
+
+    //下拉框宽度
+    ::v-deep .el-select {
+        width: 100%;
+    }
+
+    //图片的宽高
+    ::v-deep .avatar {
+        width: 140px;
+        height: auto;
+    }
+
+    .keywords {
+        position: relative;
+
+        i {
+            position: absolute;
+            top: 0;
+            left: -15px;
+        }
+    }
+}
+
+// 弹出层按钮
+.dialogBtn {
+    text-align: center;
+    margin: 50px auto 20px;
+
+    ::v-deep .avatar {
+        width: 140px;
+        height: 50px;
+        display: block;
+    }
+
+    button {
+        width: 184px;
+        padding: 16px;
+        font-family: Microsoft YaHei, Microsoft YaHei;
+        font-weight: 400;
+        font-size: 20px;
+        border: none;
+        border-radius: 12px 12px 12px 12px;
+    }
+
+    // 取消
+    .cancel {
+        color: #333333;
+        background-color: #f5f7fb;
+        border: 2px solid rgba(85, 112, 241, 0.11);
+    }
+
+    // 提交
+    .submit {
+        color: #fff;
+        background-color: #5570F1;
+        margin-left: 40px;
+    }
+}
+</style>

+ 41 - 0
src/views/website/components/blogroll/tableTitle.vue

@@ -0,0 +1,41 @@
+<template>
+  <div class="tableTitle">
+    <span class="tableFloatLine"></span>
+    {{name}}
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    name: {
+      type: String,
+      required: true,
+    },
+  },
+  data() {
+    return {
+      someData: '',
+    };
+  },
+};
+</script>
+
+<style scoped lang="less">
+  .tableTitle {
+    height: 38px;
+    line-height: 38px;
+    color:#333333;
+    position: relative;
+    margin-bottom: 30px;
+    .tableFloatLine {
+      width: 3px;
+      height:16px;
+      background:#5570F1;
+      display: block;
+      position: absolute;
+      left:-20px;
+      top:10px;
+    }
+  }
+</style>