添加合作伙伴,客户端底部配置,政策批量打标签

This commit is contained in:
熊丽君
2021-10-28 14:22:23 +08:00
parent 11dc40aac7
commit bd79569058
6 changed files with 364 additions and 33 deletions

View File

@ -57,7 +57,7 @@
"path-to-regexp": "2.4.0",
"quill": "1.3.7",
"screenfull": "4.2.0",
"sortablejs": "1.8.4",
"sortablejs": "^1.8.4",
"vue": "2.6.10",
"vue-count-to": "1.0.13",
"vue-cropper": "0.4.9",

View File

@ -34,3 +34,29 @@ export function delPartner(data) {
data
});
}
// 重新排序的数组集合
export function newList(data) {
return request({
url: '/partner/newList',
method: 'post',
data
});
}
// 获取底部
export function getBottom(params) {
return request({
url: '/bottom/getBottom',
params
});
}
// 修改底部
export function updateBottom(data) {
return request({
url: '/bottom/updateBottom',
method: 'post',
data
});
}

View File

@ -29,6 +29,7 @@ export function getLabelSetting(params) {
});
}
// 设置政策标签 body里id(政策),ids(标签id数组)
// 设置政策标签 policyIds(政策),labelIds(标签id数组)
export function setPolicyLabel(data) {
return request({
url: '/policy/setPolicyLabel',

View File

@ -1,5 +1,225 @@
<template>
<div>
footer
<div class="app-container">
<el-card>
<el-form
style="width:50%"
:model="ruleForm"
ref="ruleForm"
:rules="rules"
label-width="80px"
>
<el-form-item label="地址" prop="address">
<el-input
placeholder="请输入地址"
maxlength="35"
show-word-limit
v-model="ruleForm.address">
</el-input>
</el-form-item>
<el-form-item label="联系人" prop="linkman">
<el-input
placeholder="请输入联系人"
maxlength="10"
show-word-limit
v-model="ruleForm.linkman">
</el-input>
</el-form-item>
<el-form-item label="电话" prop="phone">
<el-input
placeholder="请输入电话"
maxlength="23"
show-word-limit
v-model="ruleForm.phone">
</el-input>
</el-form-item>
<el-form-item label="公众号" prop="wx">
<!-- <multi-upload v-model="selectProductPics" :maxCount="1"></multi-upload> -->
<el-upload
:action="upload.minioUploadUrl"
list-type="picture-card"
:limit="1"
:file-list="list"
:before-upload="beforeUpload"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemove"
:on-exceed="handleExceed"
:on-success="handleUploadSuccess"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
<span style="color:#999"> 建议上传100*100分辨率的照片</span>
</el-form-item>
<el-form-item label="QQ群" prop="qq">
<el-upload
:action="upload.minioUploadUrl"
list-type="picture-card"
:limit="1"
:file-list="list2"
:before-upload="beforeUpload"
:on-preview="handlePictureCardPreview"
:on-remove="handleRemoveQq"
:on-exceed="handleExceed"
:on-success="handleUploadSuccessQq"
>
<i class="el-icon-plus"></i>
</el-upload>
<el-dialog :visible.sync="dialogVisible">
<img width="100%" :src="dialogImageUrl" alt="">
</el-dialog>
<span style="color:#999"> 建议上传100*100分辨率的照片</span>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button>
</el-form-item>
</el-form>
</el-card>
</div>
</template>
<script>
import { getBottom, updateBottom } from '@/api/asdm/partner';
import MultiUpload from '@/components/Upload/multiUpload';
import Editor from '@/components/Editor';
export default {
components: {
MultiUpload,
Editor
},
data() {
return {
dialogImageUrl: '',
dialogVisible: false,
upload:{
minioUploadUrl: process.env.VUE_APP_BASE_API + '/minio/upload'
},
list:[],
list2:[],
ruleForm: {
pic: '',
title: '',
textWord: '',
evenMore: '',
},
rules: {
address: [{ required: true, message: '请输入地址', trigger: 'blur' }],
linkman: [{ required: true, message: '请输入联系人', trigger: 'blur' }],
phone: [{ required: true, message: '请输入电话', trigger: 'blur' }],
wx: [{ required: true, message: '请上传公众号图片', trigger: 'blur' }],
qq: [{ required: true, message: '请上传QQ群图片', trigger: 'blur' }],
}
};
},
computed: {
//主图和画册图片
selectProductPics: {
get: function() {
let pics = [];
if (
this.ruleForm.pic === undefined ||
this.ruleForm.pic == null ||
this.ruleForm.pic === ''
) {
return pics;
}
pics.push(this.ruleForm.pic);
if (
this.ruleForm.albumPics === undefined ||
this.ruleForm.albumPics == null ||
this.ruleForm.albumPics === ''
) {
return pics;
}
let albumPics = this.ruleForm.albumPics.split(',');
for (let i = 0; i < albumPics.length; i++) {
pics.push(albumPics[i]);
}
return pics;
},
set: function(newValue) {
if (newValue == null || newValue.length === 0) {
this.ruleForm.pic = null;
this.ruleForm.albumPics = null;
} else {
this.ruleForm.pic = newValue[0];
// this.ruleForm.picList = newValue;
this.ruleForm.albumPics = '';
if (newValue.length > 1) {
for (let i = 1; i < newValue.length; i++) {
this.ruleForm.albumPics += newValue[i];
if (i !== newValue.length - 1) {
this.ruleForm.albumPics += ',';
}
}
}
}
}
}
},
methods: {
// 文件列表移除文件时的钩子
handleRemove(file, fileList) {
this.ruleForm.wx = ''
},
handleRemoveQq(file, fileList) {
this.ruleForm.qq = ''
},
// 点击文件列表中已上传的文件时的钩子
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
},
// handlePictureQq(file){},
// 文件超出个数限制时的钩子
handleExceed(files, fileList) {
this.$message({
message: '最多只能上传1张图片',
type: 'warning',
duration: 1000
});
},
// 文件上传成功时的钩子
handleUploadSuccess(res, file){
this.ruleForm.wx = res.data.url
},
handleUploadSuccessQq(res, file){
this.ruleForm.qq = res.data.url
},
beforeUpload(file){
if (file.type.indexOf("image/") == -1) {
this.msgError("文件格式错误,请上传图片类型,如JPGPNG后缀的文件。");
return false
}
},
getData() {
getBottom().then(res=>{
this.ruleForm = res.data
if(this.ruleForm.wx&&this.ruleForm.qq){
this.$nextTick(()=>{
let obj = new Object();
obj.url = this.ruleForm.wx;
let obj2 = new Object();
obj2.url = this.ruleForm.qq;
this.list.push(obj)
this.list2.push(obj2)
})
}
})
},
submitForm(formName){
this.$refs[formName].validate(valid=>{
if(valid){
updateBottom(this.ruleForm).then(res=>{
this.msgSuccess(res.message)
})
}
})
},
},
created() {
this.getData();
}
};
</script>

View File

@ -7,7 +7,15 @@
添加
</el-button>
</el-card>
<el-table style="width: 100%" class="table-container" :data="rotationList">
<el-alert
style="margin-top:20px"
title="拖动表格即可对每项进行排序。且至少显示16个"
type="warning"
center
show-icon
:closable="false">
</el-alert>
<el-table style="width: 100%" class="table-container" :data="rotationList" row-key="partnerId">
<el-table-column
label="序号"
align="center"
@ -28,32 +36,30 @@
prop="status"
>
<template slot-scope="scope">
{{scope.row.status=='1'?'显示':'不显示'}}
<el-tag type="success" v-if="scope.row.status=='1'">显示</el-tag>
<el-tag type="danger" v-else>不显示</el-tag>
</template>
</el-table-column>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
></el-table-column>
>
<!-- <template slot-scope="scope">
{{parseTime(scope.row.createTime)}}
</template> -->
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button @click="handleUpdate(scope.row)" type="text" size="small"
>编辑</el-button
>
<!-- <el-button @click="handleDelete(scope.row.partnerId)" type="text" size="small"
<el-button @click="handleDelete(scope.row.partnerId)" type="text" size="small"
>删除</el-button
> -->
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog
title="合作伙伴Logo"
:visible.sync="dialogVisible"
@ -83,8 +89,9 @@
</div>
</template>
<script>
import { getList,addPartner, delPartner, updatePartner } from '@/api/asdm/partner';
import { getList,addPartner, delPartner, updatePartner,newList } from '@/api/asdm/partner';
import MultiUpload from '@/components/Upload/multiUpload';
import Sortable from 'sortablejs'
const defaultParams = {
img: '',
status: '1',
@ -95,10 +102,6 @@ export default {
},
data() {
return {
queryParams: {
pageNum: 1,
pageSize: 10
},
total: 0,
rotationList: [],
dialogVisible: false,
@ -154,9 +157,27 @@ export default {
}
}
},
mounted() {
this.rowDrop()
},
methods: {
//行拖拽
rowDrop() {
const tbody = document.querySelector('.el-table__body-wrapper tbody')
const _this = this
Sortable.create(tbody, {
onEnd({ newIndex, oldIndex }) {
if(newIndex===oldIndex) return false
const currRow = _this.rotationList.splice(oldIndex, 1)[0]
_this.rotationList.splice(newIndex, 0, currRow)
newList({list:_this.rotationList}).then(({message})=>{
this.msgSuccess(message);
})
}
})
},
getList() {
getList(this.queryParams).then(({ data }) => {
getList().then(({ data }) => {
this.rotationList = data.list;
this.total = data.total
});
@ -173,6 +194,15 @@ export default {
this.$refs[formName].validate(valid=>{
if(valid){
if(this.ruleForm.partnerId){
if(this.ruleForm.status==0){
const leng = this.rotationList.filter(item=>{
return item.status==1
}).length
if(leng<=16){
this.msgError('最低显示16个')
return false
}
}
updatePartner(this.ruleForm).then(res=>{
this.msgSuccess(res.data)
this.ruleForm = Object.assign({}, defaultParams),
@ -193,13 +223,25 @@ export default {
},
/** 删除按钮操作 */
handleDelete(id) {
this.$confirm('确认删除该轮播图?', '提示', {
const _this = this
_this.$confirm('确认删除该伙伴?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(function() {
return delPartner({ids:[id]});
const leng = _this.rotationList.filter(item=>{
return item.status==1
}).length
if(leng<=16){
_this.msgError('最低显示不能低于16个')
return new Promise((resolve, reject)=>{
// resolve();
reject();
})
}else{
return delPartner({ids:[id]});
}
})
.then(() => {
this.getList();

View File

@ -50,7 +50,7 @@
/>
</el-select>
</el-form-item>
<el-form-item label="推送状态">
<!-- <el-form-item label="推送状态">
<el-select
v-model="queryParams.status"
placeholder="请选择"
@ -63,7 +63,7 @@
:value="item.value"
/>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="城市选择">
<el-cascader
v-model="queryParams.city"
@ -97,14 +97,20 @@
<i class="el-icon-tickets"></i>
<span>数据列表</span>
<div class="btn-add">
<el-button @click="batchLabel" size="small">批量标签</el-button>
<el-button @click="batchPush" size="small" type="warning">批量推送</el-button>
<el-button @click="handlePage(null)" size="small" type="primary">添加政策</el-button>
</div>
</el-card>
<!-- v-loading="loading" -->
<div style="margin-top:15px">
<el-tabs v-model="queryParams.status" @tab-click="handleSearchList">
<el-tab-pane label="未推送" name="0"></el-tab-pane>
<el-tab-pane label="已推送" name="1"></el-tab-pane>
</el-tabs>
</div>
<el-table
class="table-container"
:data="libraryList"
@selection-change="handleSelectionChange"
>
@ -164,15 +170,15 @@
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<p>
<div>
<el-button size="small" type="text" @click="open(scope.row)"
>标签管理</el-button
>
<el-button size="small" type="text" @click="openTime(scope.row)"
>截止时间</el-button
>
</p>
<p>
</div>
<div>
<el-button
size="small"
type="text"
@ -185,7 +191,7 @@
@click="handleDelete(scope.row.id)"
>删除</el-button
>
</p>
</div>
</template>
</el-table-column>
<el-table-column label="推送" align="center" prop="roleName" width="150">
@ -330,6 +336,7 @@ export default {
queryParams: {
pageNum: 1,
pageSize: 10,
status: 0
},
// 遮罩层
loading: true,
@ -365,9 +372,11 @@ export default {
this.getList();
},
getList() {
this.loading = true
getPolicy(this.queryParams).then(({ data }) => {
this.libraryList = data.list;
this.total = data.total;
this.loading = false
});
},
// 处理序号=》倒序
@ -395,6 +404,29 @@ export default {
return this.msgInfo('请选择要操作的数据');
this.push(this.ids);
},
batchLabel(row) {
if (this.ids == null || this.ids.length < 1)
return this.msgInfo('请选择要操作的数据');
this.policyId = null
this.str = '标签设置';
this.dialogVisible = true;
getLabelSetting({ policyId: 1, pageNum: 1, pageSize: 100 }).then(
({ data }) => {
this.labelList = data.list;
this.arr = data.list.map((item) => {
return item.labelList
? item.labelList
.map((v) => {
if (v.isHas) {
return v.id;
}
})
.filter((i) => i)
: undefined;
});
}
);
},
open(row) {
this.str = '标签设置';
this.dialogVisible = true;
@ -469,7 +501,12 @@ export default {
this.arr.map((item) => {
ids = [...ids, ...item];
});
setPolicyLabel({ id: this.policyId, ids }).then(({ message }) => {
let infoIds = this.policyId || this.ids;
if(typeof infoIds=='string'){
infoIds = [infoIds]
}
// setPolicyLabel({ id: this.policyId, ids }).then(({ message }) => {
setPolicyLabel({ policyIds: infoIds, labelIds:ids }).then(({ message }) => {
this.msgSuccess(message);
this.dialogVisible = false;
});
@ -525,6 +562,11 @@ export default {
};
</script>
<style lang="scss" scoped>
.el-table{
/deep/td{
padding: 0 !important;
}
}
.el-dialog{
.el-form{
.el-select{