123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758 |
- <!-- 通栏 -->
- <template>
- <div>
- <!-- 头部搜索框部分 -->
- <div class="title">
- <el-row>
- <el-col :span="6" class="left">
- <div class="searchBox">
- <div class="searchTitle">通栏名称</div>
- <el-input v-model="apiData.sector_name" clearable placeholder="请输入通栏名称"></el-input>
- </div>
- </el-col>
- <el-col :span="6" class="left">
- <div class="searchBox">
- <div class="searchTitle">所属风格</div>
- <el-select v-model="apiData.template_class_id" clearable placeholder="请选择所属风格" @change="getSkinList">
- <el-option v-for="item in class_options" :key="item.class_id" :label="item.name" :value="item.class_id">
- </el-option>
- </el-select>
- </div>
- </el-col>
- <el-col :span="6" class="left">
- <div class="searchBox">
- <div class="searchTitle">所属皮肤</div>
- <el-select v-model="apiData.template_id" clearable placeholder="请选择所属皮肤">
- <el-option v-for="item in template_options" :key="item.template_id" :label="item.template_name" :value="item.template_id">
- </el-option>
- </el-select>
-
- </div>
- </el-col>
- <el-col :span="6" class="right">
- <div class="btnList">
- <button class="search" @click="goSearch">搜索</button>
- <button class="reset" @click="goReset">重置</button>
- </div>
- </el-col>
- </el-row>
- <el-row class="rowMargin">
- <el-col :span="6" class="left">
- <div class="searchBox">
- <div class="searchTitle">尺寸</div>
- <div class="sizeBox">
- <div class="sizeInput"><el-input v-model="apiData.width" clearable placeholder="宽"></el-input> </div>
- <div class="sizeInputSymbol">*</div>
- <div class="sizeInput"><el-input v-model="apiData.height" clearable placeholder="高"></el-input></div>
- </div>
- </div>
- </el-col>
- </el-row>
- </div>
- <!--表格内容 start------------------------------------------------------------>
- <div class="layerBox">
- <tableTitle :name="tableDivTitle" />
- <!-- <button class="btn" @click="goLook">查看测试</button> -->
- <!-- <button class="btn" @click="addPlate">添加通栏</button> -->
- <button class="btn" @click="addPlatetest">添加通栏</button>
- <el-row>
- <template>
- <el-table class="my-table" :data="tableData" style="width: 100%" >
- <el-table-column fixed prop="sector_id" label="编号" width="90"></el-table-column>
- <el-table-column prop="sector_name" label="通栏名称" width=""></el-table-column>
- <el-table-column prop="sector_size" label="尺寸" width=""></el-table-column>
- <el-table-column prop="template_name" label="所属皮肤" width=""></el-table-column>
- <el-table-column prop="class_name" label="所属风格" width=""></el-table-column>
- <el-table-column prop="place_name" label="所属版式" width="230">
- </el-table-column>
- <el-table-column prop="pagetype" label="所属页面" width="230">
- </el-table-column>
- <el-table-column prop="created_at" label="添加时间" width=""></el-table-column>
- <el-table-column prop="updated_at" label="修改时间" width=""></el-table-column>
- <el-table-column fixed="right" label="操作" width="200">
- <template slot-scope="scope">
- <div class="listBtnBox">
- <div class="listDeleteBtn" @click="deleteRow(scope.row.id)">
- <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 class="listEditBtn" @click="goEdittest(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------------------------------------------------------------>
-
- <!-- 弹出框 编辑 end----------------------------------------------------------->
- </div>
- </template>
- <script>
- //表格标题
- import tableTitle from './components/tableTitle.vue';
- import tagInput from '../../components/InputTag/index.vue';
- //引入公用样式
- import '@/styles/global.less';
- // import { getSectorList, addSector, delSector, updateSector, getSectorInfo } from '@/api/plate'
- // import { getTemplateClass } from '@/api/style'
- export default {
- components: {
- tableTitle,//表格标题-
- tagInput
- },
- data() {
- const validateEmpty = (rule, value, callback) => {
- if (value.length == 0) {
- callback(new Error('该项不能为空!'))
- } else {
- callback()
- }
- }
- const validateArray = (rule, value, callback) => {
- if (value.length == 0) {
- callback(new Error('该项不能为空!'))
- } else {
- callback()
- }
- }
- return {
- //1.1 初始化信息
- tableDivTitle: "通栏列表", //列表标题
- dialogTableVisible: false, //编辑弹框
- dialogName: '编辑', //编辑弹窗名称
- plateLoading: true, //表格内容加载中
- tableData: [],//表格数据
- class_options: [],//风格下拉列表
- template_options: [],//皮肤下拉列表
- // componen_code: [],//组件版式及组件下拉列表
- sectorPlace_options: [],//通栏模版类型下拉列表
- component_option: [],
- tags: [],//标签数据
- // 1.2搜索框相关
- apiData:{
- pagetype: '',//页面类型
- template_class_id: '',//模板风格
- tempalte_id: '',//皮肤名称
- sector_name: '',//通栏名称
- width: '',//通栏宽度
- height: '',//通栏高度
- keyword: '',//通栏关键词
- },
- templateStyle: '',//风格
- plateName: '',
- pageType: '',//页面类型
- value: '',
- checkList: [
- {
- value: 1,
- label: '首页',
- },
- {
- value: 2,
- label: '分类页',
- },
- {
- value: 3,
- label: '列表页',
- },
- {
- value: 4,
- label: '详情页',
- },
- {
- value: 5,
- label: '搜索页',
- },
- {
- value: 6,
- label: '特殊列表页',
- },
- {
- value: 7,
- label: '特殊详情页',
- },
- ],
- //活动id
- activeid: "",
- newArr: [],
- // 1.3 分页相关
- page: 1,
- pageSize: 10,
- total: 0,
- formLabelWidth: '', //广告示例图相关
- //1.4 弹框相关数据
- ruleForm: {
- sectorName: '', //通栏名称
- sectorPlace: null, //通栏模版类型
- component_num: null, //组件数量
- sectorId: null, //通栏编号id
- templateStyle: '', //所属皮肤
- pageType: '', //页面类型
- sizeList: '', //尺寸
- sectorType: null, //通栏类别
- pageType: [], //页面类型
- sectorKeyword: '', //通栏关键词
- image: '', //通栏展示图
- sector_img:'', //通栏版式预览图
- component_code: [], //所选择位置的组件
- sector_width:'',
- sector_height:'',
- },
- rules: {
- sectorName: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- component_num: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- sectorId: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- templateStyle: [{ required: true, trigger: 'blur', validator: validateEmpty }], //关联皮肤名称
- sectorType: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- pageType: [{ required: true, trigger: 'blur', validator: validateArray }],
- image: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- sectorPlace: [{ required: true, trigger: 'blur', validator: validateEmpty }],
- },
- //1.5 弹窗中 上传logo图片
- logoUrl: '',
- hovering: false, // 鼠标悬浮状态 悬浮时显示删除
- }
- },
- methods: {
- //1.列表和分页相关 start ------------------------------------------------------------>
- //1.1 开始请求列表信息方法
- getData() {
- const data = {
- page: this.page,
- page_size: this.pageSize,
- sector_name: this.apiData.sector_name ?? '', //通栏名称
- template_class_id: this.apiData.template_class_id ?? null, //风格id
- template_id: this.apiData.template_id ?? null, //通栏id
- width: this.apiData.width ?? null, //通栏宽度
- height: this.apiData.height ?? null, //通栏高度
- keyword: this.apiData.keyword ?? '', //通栏关键词
- }
- this.$store.dispatch('plate/getSectorList', data).then(data => {
- this.tableData = data.data.data
- this.total = data.data.total
- console.log("typeof(,",data.data.data);
- for (let i = 0; i < data.data.data.length; i++) {
- const item = data.data.data[i];
- this.tableData[i].sector_size = item.sector_width + ' * ' + item.sector_height;
- let pageArray = JSON.parse(item.page_type);
- if (Array.isArray(pageArray)) {
- // item.tags = keywordArray;
- item.pagetype = pageArray.map(type => {
- const pageTypeMap = {
- 1: '首页',
- 2: '分类页',
- 3: '列表页',
- 4: '详情页',
- 5: '搜索页',
- 6: '特殊列表页',
- 7: '特殊详情页'
- };
- return pageTypeMap[type] || type;
- }).join(' | ');
- } else {
- item.pagetype = '';
- }
- }
- })
- },
-
- // // 获取版式列表
- // getPlaceList(sectorType) {
- // let data = {
- // component_num : this.ruleForm.component_num,
- // type_id: 1,
- // }
- // this.$store.dispatch('plate/getAllSectorPlace',data).then(res => {
- // this.sectorPlace_options = res.data
- // }).catch(() => {
- // this.$message({
- // type: 'error',
- // message: '网络错误,请重试!'
- // });
- // })
- // },
- //获取风格列表
- getStyleList() {
- this.$store.dispatch('genre/getTemplateClass').then(res => {
- this.class_options = res.data
- // console.log(res.data);
- }).catch(() => {
- this.$message({
- type: 'error',
- message: '网络错误,请重试!'
- });
- })
- },
- //获取皮肤列表
- getSkinList() {
- let data = [];
- // console.log("5588888",this.apiData.template_class_id);
- if(this.apiData.template_class_id){
- let data = {
- templte_class_id: this.apiData.template_class_id,
- }
- }
- this.$store.dispatch('plate/getAllTemplate', data).then(res => {
- this.template_options = res.data
- console.log(res.data);
- }).catch(() => {
- this.$message({
- type: 'error',
- message: '网络错误,请重试!'
- });
- })
- },
- //1.2 删除内容
- deleteRow(id) {
- console.log(id);
- let data = new FormData()
- data.append('id', id)
- this.$confirm('注意:删除后,该条信息及其绑定关系全部删除', '是否确认删除该条信息?', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- }).then(() => {
- console.log("当前删除:" + id)
- this.$store.dispatch('plate/delSector', {id:id}).then(res => {
- console.log(res);
- if (res.code = 200) {
- this.$message({
- message: '删除成功',
- type: 'success'
- })
- this.getData()
- } else if (res.code == 0) {
- this.$message({
- message: res.message,
- type: 'error'
- })
- }
- })
- }).catch(() => {
- this.$message({
- type: 'warning',
- message: '已取消删除'
- });
- });
- },
- goEdittest(id, val) {
- let data = {
- id: id
- }
- this.$router.push({
- path: '/plateDetail',
- query: data
- });
- },
- // 1.6 搜索按钮
- goSearch() {
- const data = {
- page: this.page,
- page_size: this.pageSize,
- sector_name: this.apiData.sector_name ?? '', //通栏名称
- template_class_id: this.apiData.template_class_id ?? null, //风格id
- template_id: this.apiData.template_id ?? null, //通栏id
- width: this.apiData.width ?? null, //通栏宽度
- height: this.apiData.height ?? null, //通栏高度
- keyword: this.apiData.keyword ?? '', //通栏关键词
- }
- this.$store.dispatch('plate/getSectorList',data ).then(data => {
- this.tableData = data.data.data
- this.total = data.data.total
- for (let i = 0; i < data.data.data.length; i++) {
- const item = data.data.data[i];
- this.tableData[i].sector_size = item.sector_width + ' * ' + item.sector_height;
- let pageArray = JSON.parse(item.page_type);
- if (Array.isArray(pageArray)) {
- // item.tags = keywordArray;
- item.pagetype = pageArray.map(type => {
- const pageTypeMap = {
- 1: '首页',
- 2: '分类页',
- 3: '列表页',
- 4: '详情页',
- 5: '搜索页',
- 6: '特殊列表页',
- 7: '特殊详情页'
- };
- return pageTypeMap[type] || type;
- }).join(' | ');
- } else {
- item.pagetype = '';
- }
- }
- })
- },
- //1.7 重置按钮
- goReset() {
- this.apiData.pagetype = '',//页面类型
- this.apiData.template_class_id= '',//模板风格
- this.apiData.template_id = '',//皮肤名称
- this.apiData.sector_name= '',//通栏名称
- this.apiData.width= '',//通栏宽度
- this.apiData.height= '',//通栏高度
- this.apiData.keyword= '',//通栏关键词
- this.page=1
- this.pageSize=10
- this.getData()
- },
- //直接跳转
- handleSizeChange(val) {
- this.page = val;
- this.getData();
- },
- //1.5 点击分页
- handleCurrentChange(val) {
- this.page = val;
- this.getData();
- },
- //列表和分页相关 end ------------------------------------------------------------>
- //1.10 添加通栏测试
- addPlatetest() {
- this.$router.push({
- path: '/plateDetail',
- });
- },
- },
- mounted() {
- this.getData()
- this.getStyleList()
- this.getSkinList()
- // this.getPlaceList()
- },
-
- }
- </script>
- <style scoped lang="less">
- input[aria-hidden=true] {
- display: none !important;
- }
- // 提示信息
- .tips {
- margin: 30px;
- background-color: #e9ecf9;
- border-radius: 11px;
- .tipsIcon {
- margin: 10px 15px;
- display: inline-block;
- width: 24px;
- height: 24px;
- background: url("../../assets/advertise/Info Circle.png") no-repeat;
- vertical-align: middle;
- }
- .tipsText {
- font-size: 14px;
- color: #666666;
- }
- }
- // 头部
- .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 {
- ::v-deep .el-input {
- position: relative;
- font-size: 14px;
- display: inline-block;
- width: 80%;
- }
- .searchTitle {
- padding-bottom: 10px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 14px;
- color: #999999;
- line-height: 16px;
- }
- .el-select {
- width: 100%;
- display: inline-block;
- position: relative;
- }
- }
- .btnList {
- float: right;
- padding-top: 28px;
- button {
- 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 {
- margin-left: 0px;
- padding-left: 0px;
- margin-right: 20px;
- width: 76px;
- height: 36px;
- line-height: 36px;
- }
- ::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;
- }
- }
- .sizeBox {
- display: flex;
- align-items: center;
- width: 80%;
- .sizeInputSymbol {
- width: 30px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .sizeInput {
- width: 50%;
- ::v-deep .el-input {
- position: relative;
- font-size: 14px;
- display: inline-block;
- width: 100%;
- }
- }
- }
- // 弹出层内容
- .dialogText {
- margin: 0 7px 0 3px;
- padding-bottom: 1px;
- padding: 30px 60px 1px 20px;
- background-color: #f5f7fb;
- .adImage {
- width: 140px;
- height: 140px;
- line-height: 210px;
- border-radius: 12px;
- border: 1px solid rgba(85, 112, 241, 0.11);
- img {
- width: 140px;
- height: 80px;
- }
- }
- ::v-deep .avatar {
- width: 140px;
- height: auto;
- }
- .price {
- ::v-deep .el-input {
- width: 29%;
- }
- }
- .example {
- font-family: Microsoft YaHei;
- color: #5570F1;
- }
- .el_btnList {
- margin-right: 15px;
- margin-top: 20px;
- }
- //日期时间选择器的宽
- ::v-deep .el-date-editor.el-input {
- width: 48%;
- }
- ::v-deep .el-button+.el-button {
- margin-left: 0px;
- }
- ::v-deep .el-select {
- width: 100%;
- }
- ::v-deep .el-form-item {
- margin-bottom: 50px;
- }
- }
- // 弹出层按钮
- .dialogBtn {
- text-align: center;
- margin: 50px auto 20px;
- clear: both;
- 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;
- }
- }
- //审核弹出框
- .radioGroup {
- ::v-deep .el-form-item {
- margin-top: 40px;
- margin-bottom: 0;
- }
- }
- .graph {
- background-color: #f5f7fb;
- padding: 60px 100px;
- overflow: hidden;
- li {
- float: left;
- }
- >li:first-child {
- margin-right: 100px;
- }
- }
- .dialog-footer {
- margin: 0 auto;
- }
- .rowMargin {
- margin-top: 20px;
- }
- .componentOptions{
- float: left;
- margin-right: 30px;
- width: 470px;
- }
- .componentOption_one{
- width: 337px;
- }
- </style>
|