157578146@qq.com 2 years ago
parent
commit
a48634e3ec
  1. 116
      src/api/cms.js
  2. 2
      src/components/copyright/index.vue
  3. 729
      src/pages/article/add_article.vue
  4. 237
      src/pages/article/article_category.vue
  5. 472
      src/pages/article/index.vue
  6. 90
      src/pages/article/relation.vue
  7. 2
      src/pages/collection/merge.vue
  8. 7
      src/pages/sell/seckillAdd.vue
  9. 31
      src/router/modules/collection.js

116
src/api/cms.js

@ -0,0 +1,116 @@
import request from '@/plugins/request';
/**
* @description 文章列表 发布下架
* @param {Object} param data {Object} 传值参数
*/
export function setRelease (data) {
return request({
url: 'cms/setRelease',
method: 'post',
params: data
});
}
export function setStatus (data) {
return request({
url: 'cms/setStatus',
method: 'post',
data
});
}
/**
* @description 文章管理--列表
* @param {Object} param data {Object} 传值参数
*/
export function cmsListApi (data) {
return request({
url: 'cms/cms',
method: 'get',
params: data
});
}
/**
* @description 文章管理--新增编辑
* @param {Object} param data {Object} 传值参数
*/
export function cmsAddApi (data) {
return request({
url: 'cms/cms',
method: 'post',
data
});
}
/**
* @description 文章管理--文章详情
* @param {Number} param id {Number} 文章id
*/
export function createApi (id) {
return request({
url: `cms/cms/${id}`,
method: 'get'
});
}
/**
* @description 文章分类--新增表单
*/
export function categoryAddApi () {
return request({
url: `cms/category/create`,
method: 'GET'
});
}
/**
* @description 文章分类--列表
* @param {Object} param params {Object} 传值
*/
export function categoryListApi (params) {
return request({
url: `cms/category`,
method: 'GET',
params
});
}
/**
* @description 文章分类--编辑表单
* @param {Number} param id {Number} 文章id
*/
export function categoryEditApi (id) {
return request({
url: `cms/category/${id}/edit`,
method: 'GET'
});
}
/**
* @description 文章分类--修改状态
* @param {Object} param data {Object} 传值
*/
export function statusApi (data) {
return request({
url: `cms/category/set_status/${data.id}/${data.status}`,
method: 'put'
});
}
/**
* @description 文章分类--关联商品
* @param {Number} param id {Number} 文章id
* @param {Object} param data {Object} 传值
*/
export function relationApi (data, id) {
return request({
url: `cms/cms/relation/${id}`,
method: 'put',
data
});
}

2
src/components/copyright/index.vue

@ -13,7 +13,7 @@
}
},
mounted () {
this.getVersion();
// this.getVersion();
},
methods: {
getVersion () {

729
src/pages/article/add_article.vue

@ -0,0 +1,729 @@
<template>
<div class="article-manager">
<Card
:bordered="false"
dis-hover
class="ivu-mt"
>
<PageHeader
style="padding: 10px 0; margin-bottom: 20px;"
hidden-breadcrumb
>
<div slot="title">
<router-link :to="{ path: '/store/article/index' }"><Button
icon="ios-arrow-back"
size="small"
class="mr20"
>返回</Button></router-link>
<span
v-text="$route.params.id > 0 ? '编辑文章' : '添加文章'"
class="mr20"
></span>
</div>
</PageHeader>
<Form
class="form"
ref="formValidate"
:model="formValidate"
:rules="ruleValidate"
:label-width="labelWidth"
:label-position="labelPosition"
@submit.native.prevent
>
<div class="goodsTitle acea-row">
<div class="title">文章信息</div>
</div>
<Row
>
<Col
span='24'
v-bind="grid"
class="mr50"
>
<FormItem
label="标题:"
prop="title"
label-for="title"
>
<Input
v-model="formValidate.title"
placeholder="请输入"
maxlength="20"
element-id="title"
style="width:400px"
/>
</FormItem>
</Col>
</Row>
<Row>
<Col v-bind="grid" class="mr50">
<FormItem label="文章分类:" label-for="cid" prop="cid">
<Select v-model="formValidate.cid" style="width:400px" >
<Option v-for="item in treeData" :value="item.id" :key="item.id">{{ item.title }}</Option>
</Select>
</FormItem>
</Col>
</Row>
<Row >
<Col class="mr50">
<FormItem label="关联内容:">
<Row :class="{'mb10':!(formValidate.relate.length==index+1)}" v-for="(item,index) in formValidate.relate" :key="index">
<Select
@on-change="selectType"
placeholder="请选择关联类型"
v-model="formValidate.relate[index].type"
style="width:150px;margin-right: 10px;" >
<Option :value="1">首发活动</Option>
<Option :value="2">合成活动</Option>
<Option :value="3">流转市场(藏品)</Option>
<Option :value="4">流转市场(盲盒)</Option>
</Select>
<template v-if="formValidate.relate[index].type==1">
<Select ref="select_1" filterable @on-select="itemSelect($event,index)" :disabled='!formValidate.relate[index].type' placeholder="请搜索或选择关联的活动" v-model.lazy="formValidate.relate[index].active_id" style="width:240px" >
<Option v-for="item in activeList" :value="item.id" :key="item.id" :label="item.title">{{`${item.title}${item.active_type==4? '秒杀活动':item.active_type==2? '盲拍活动':'抽签活动' }`}}</Option>
</Select>
</template>
<template v-else-if="formValidate.relate[index].type==2">
<Select filterable @on-select="itemSelect($event,index)" :disabled='!formValidate.relate[index].type' placeholder="请搜索或选择关联的活动" v-model.lazy="formValidate.relate[index].merge_id" style="width:240px" >
<Option v-for="item in mergeList" :value="item.id" :key="item.id">{{ item.title }}</Option>
</Select>
</template>
<template v-else-if="formValidate.relate[index].type==3">
<Select filterable @on-select="itemSelect($event,index)" :disabled='!formValidate.relate[index].type' placeholder="请搜索或选择关联的活动" v-model="formValidate.relate[index].goods_id" style="width:240px" >
<Option v-for="item in goodsList" :value="item.id" :key="item.id">{{ item.title }}</Option>
</Select>
</template>
<template v-else-if="formValidate.relate[index].type==4">
<Select filterable @on-select="itemSelect($event,index)" :disabled='!formValidate.relate[index].type' placeholder="请搜索或选择关联的活动" v-model.lazy="formValidate.relate[index].box_id" style="width:240px" >
<Option v-for="item in boxList" :value="item.id" :key="item.id">{{ item.title }}</Option>
</Select>
</template>
<template v-else>
<Select :disabled='!formValidate.relate[index].type' placeholder="请搜索或选择关联的活动" v-model="formValidate.relate[index].goods_id" style="width:240px" >
<Option v-for="item in goodsList" :value="item.id" :key="item.id">{{ item.title }}</Option>
</Select>
</template>
<a @click="RelateFn('del',index)" v-if="formValidate.relate.length>1" style="color: red; margin-left: 8px;">删除</a>
<a @click="RelateFn('add',index)" v-if="formValidate.relate.length==index+1" style="margin-left: 8px;">添加</a>
<a @click="RelateFn('clear',index)" v-if="index==0" style="margin-left: 8px;">清空</a>
</Row>
</FormItem>
</Col>
</Row>
<Row >
<Col class="mr50">
<FormItem label="推送时间:">
<RadioGroup v-model="formValidate.send_type">
<Radio :label="1">立即推送</Radio>
<Radio :label="2">定时推送</Radio>
</RadioGroup>
<DatePicker
v-model="formValidate.send_time"
v-if="formValidate.send_type==2"
type="datetime"
format="yyyy-MM-dd HH:mm:ss"
placeholder="请选择推送时间"
style="width: 200px;margin-left: 15px;" />
</FormItem>
</Col>
</Row>
<Row >
<Col class="mr50">
<FormItem label="微信通知:">
<RadioGroup v-model="formValidate.open_wechat_msg">
<Radio :label="1"></Radio>
<Radio :label="0"></Radio>
</RadioGroup>
</FormItem>
</Col>
</Row>
<Row >
<FormItem label="状态:" >
<Switch
:true-value="1"
:false-value="0"
v-model="formValidate.status"
size="large"
>
<template #open>
<span>上架</span>
</template>
<template #close>
<span>下架</span>
</template>
</Switch>
</FormItem>
</Row>
<Col
v-bind="grid"
class="mr50"
>
<FormItem
label="图文封面:"
>
<div
class="picBox"
@click="modalPicTap('单选')"
>
<div
class="pictrue"
v-if="formValidate.image_input"
><img :src="formValidate.image_input"></div>
<div
class="upLoad acea-row row-center-wrapper"
v-else
>
<Icon
type="ios-camera-outline"
size="26"
class="iconfont"
/>
</div>
</div>
</FormItem>
</Col>
<Row>
<Col
span="12"
class="mr50"
>
<FormItem
label="文章简介:"
prop="synopsis"
label-for="synopsis"
>
<Input
v-model="formValidate.synopsis"
type="textarea"
placeholder="请输入简介..."
style="width: 90%"
:rows="5"
/>
</FormItem>
</Col>
</Row>
<div class="goodsTitle acea-row">
<div class="title">文章内容</div>
</div>
<FormItem
label="文章内容:"
prop="content"
>
<vue-ueditor-wrap
v-model="formValidate.content"
@beforeInit="addCustomDialog"
:config="myConfig"
style="width: 90%;"
></vue-ueditor-wrap>
</FormItem>
<Row
span='24'
style="justify-content: center;"
>
<Button
type="primary"
class="submission"
@click="onsubmit('formValidate')"
>提交</Button>
</Row>
</Form>
<Modal
v-model="modalPic"
width="950px"
scrollable
footer-hide
closable
title='上传商品图'
:mask-closable="false"
:z-index="1"
>
<uploadPictures
:isChoice="isChoice"
@getPic="getPic"
:gridBtn="gridBtn"
:gridPic="gridPic"
v-if="modalPic"
></uploadPictures>
</Modal>
<Spin fix v-show="spin"></Spin>
</Card>
</div>
</template>
<script>
import { mapState, mapActions } from 'vuex';
import uploadPictures from '@/components/uploadPictures';
import VueUeditorWrap from 'vue-ueditor-wrap';
import { cmsAddApi, createApi, categoryListApi } from '@/api/cms';
import {getList} from '@/api/merge'
import {getGoodsActiveList,getGoodsList} from '@/api/duandian/digitalStorage'
import {getBoxList} from "@/api/duandian/sell";
export default {
name: 'addArticle',
components: { uploadPictures, VueUeditorWrap },
data () {
const validateUpload = (rule, value, callback) => {
if (this.formValidate.image_input) {
callback()
} else {
callback(new Error('请上传图文封面'))
}
}
const validateUpload2 = (rule, value, callback) => {
if (!this.formValidate.cid) {
callback(new Error('请选择文章分类'))
} else {
callback()
}
}
return {
spin:false,
activeList:[],//
mergeList:[],//
goodsList:[],//
boxList:[],//
dialog: {},
isChoice: '单选',
grid: {
xl: 8,
lg: 8,
md: 12,
sm: 24,
xs: 24
},
gridPic: {
xl: 6,
lg: 8,
md: 12,
sm: 12,
xs: 12
},
gridBtn: {
xl: 4,
lg: 8,
md: 8,
sm: 8,
xs: 8
},
loading: false,
formValidate: {
id: 0,
title: '',
author: '',
image_input: '',
content: '',
synopsis: '',
url: '',
is_hot: 0,
is_banner: 0,
cid: '',
visit: 0,
status:1,
open_wechat_msg:1,
send_type:1,
formValidate:'',
relate:[
{
title:'',
type:'',
merge_id:'',
goods_id:'',
box_id:'',
active_id:'',
type:'',
}
]
},
ruleValidate: {
title: [
{ required: true, message: '请输入标题', trigger: 'blur' }
],
// author: [
// { required: true, message: '', trigger: 'blur' }
// ],
cid: [
{ required: true, validator: validateUpload2, trigger: 'change', type: 'number' }
],
image_input: [
{ required: true, validator: validateUpload, trigger: 'change' }
],
content: [
{ required: true, message: '请输入文章内容', trigger: 'change' }
]
},
value: '',
modalPic: false,
template: false,
treeData: [],
formValidate2: {
type: 1
},
myConfig: {
autoHeightEnabled: false, //
initialFrameHeight: 500, //
initialFrameWidth: '100%', //
UEDITOR_HOME_URL: '/store/UEditor/',
serverUrl: ''
}
}
},
computed: {
...mapState('admin/layout', [
'isMobile'
]),
labelWidth () {
return this.isMobile ? undefined : 120;
},
labelPosition () {
return this.isMobile ? 'top' : 'right';
}
},
watch: {
$route (to, from) {
if (this.$route.params.id) {
this.getDetails()
} else {
this.formValidate = {
id: 0,
title: '',
author: '',
image_input: '',
content: '',
synopsis: '',
url: '',
is_hot: 0,
is_banner: 0
}
}
}
},
methods: {
itemSelect(e,index){
this.$set(this.formValidate.relate[index],'title',e.label);
},
selectType(e){
if(!e) return;
// this.spin=true;
// //
// if(e==1){
// if(this.activeList.length==0) {
// this.spin=false;
// }
// this.spin=false;
// }
// //
// else if(e==2){
// if(this.mergeList.length==0) {
// }
// this.spin=false;
// }
// //
// else if(e==3) {
// if(this.goodsList.length==0) {
// }
// }
// //
// else if(e==4) {
// if(this.boxList.length==0) {
// }
// }
},
RelateFn(value,index){
console.log(value,index);
if(value=='add') {
console.log(this.formValidate.relate[index]);
if(!this.formValidate.relate[index].merge_id && !this.formValidate.relate[index].active_id && !this.formValidate.relate[index].goods_id&& !this.formValidate.relate[index].box_id) return this.$Message.error('请完善改行数据再添加')
this.formValidate.relate.push({
type:'',
merge_id:0,
goods_id:0,
active_id:0,
box_id:0,
})
} else if(value=='clear'){
this.$set(this.formValidate,'relate',[]);
const item ={
type:'',
merge_id:0,
goods_id:0,
active_id:0,
box_id:0,
}
this.$set(this.formValidate.relate,index,item);
setTimeout(res=>{
this.$set(this.formValidate.relate[index],'goods_id',0);
},200)
}
else {
this.formValidate.relate.splice(index,1)
}
},
...mapActions('admin/page', [
'close'
]),
// getContent (val) {
// this.formValidate.content = val.content;
// },
//
modalPicTap () {
this.modalPic = true
},
//
getPic (pc) {
this.formValidate.image_input = pc.att_dir;
this.modalPic = false;
},
//
getClass () {
categoryListApi(this.formValidate2).then(async res => {
this.treeData = res.data;
}).catch(res => {
this.$Message.error(res.msg);
})
},
//
getSelectData(){
getGoodsActiveList({page:1,limit:999,is_show:1,active_type:''}).then(res=>{
this.activeList=res.data.data;
})
getList({status:[3,4,5],page:1,limit:999}).then(res=>{
this.mergeList=[...res.data.data];
this.spin=false;
})
getGoodsList({page:1,limit:999,status:1}).then(res=>{
this.goodsList=[...res.data.data];
this.spin=false;
})
getBoxList({page:1,limit:999,status:2}).then(res=>{
this.boxList=[...res.data.data];
this.spin=false;
})
},
//
onsubmit (name) {
const type =this.formValidate.relate[0].type;
this.$refs[name].validate((valid) => {
if (valid) {
if(this.formValidate.send_type==2 && this.formValidate.send_time=='') return this.$Message.error(`请选择定时推送时间`);
// if(!type) {
// this.formValidate.relate=[];
// }
cmsAddApi(this.formValidate).then(async res => {
if(res.status != 200) return this.$Message.error(`${res.msg},不可修改`);
this.$Message.success('保存成功');
setTimeout(() => {
this.$router.push({ path: '/store/article/index' });
}, 500);
}).catch(res => {
this.$Message.error(res.msg);
})
} else {
return false;
}
})
},
//
getDetails () {
createApi(this.$route.params.id ? this.$route.params.id : 0).then(async res => {
let data = res.data;
let news = data.info;
this.formValidate = {
id: news.id,
title: news.title,
author: news.author,
image_input: news.image_input,
content: news.content.content,
synopsis: news.synopsis,
status:news.status,
url: news.url,
is_hot: news.is_hot,
is_banner: news.is_banner,
cid: news.cid,
visit: news.visit,
relate:news.relate,
content:news.content.content,
send_type:news.send_type,
send_time:news.send_time,
open_wechat_msg:news.open_wechat_msg
}
if(this.formValidate.relate.length==0) {
this.formValidate.relate.push({
type:'',
merge_id:'',
goods_id:'',
active_id:'',
type:'',
})
}
}).catch(res => {
this.loading = false;
this.$Message.error(res.msg);
})
},
//
addCustomDialog (editorId) {
window.UE.registerUI('test-dialog', function (editor, uiName) {
// dialog
let dialog = new window.UE.ui.Dialog({
// 2
iframeUrl: '/admin/widget.images/index.html?fodder=dialog',
//
editor: editor,
// dialog
name: uiName,
// dialog
title: '上传图片',
// dialog
cssRules: 'width:1200px;height:500px;padding:20px;'
});
this.dialog = dialog;
var btn = new window.UE.ui.Button({
name: 'dialog-button',
title: '上传图片',
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -726px -77px;`,
onclick: function () {
// dialog
dialog.render();
dialog.open();
}
});
return btn;
}, 37);
window.UE.registerUI(
"video-dialog",
function (editor, uiName) {
let dialog = new window.UE.ui.Dialog({
iframeUrl: "/admin/widget.video/index.html?fodder=video",
editor: editor,
name: uiName,
title: "上传视频",
cssRules: "width:1000px;height:500px;padding:20px;",
});
this.dialog = dialog;
let btn = new window.UE.ui.Button({
name: "video-button",
title: "上传视频",
cssRules: `background-image: url(../../../assets/images/icons.png);background-position: -320px -20px;`,
onclick: function () {
// dialog
dialog.render();
dialog.open();
},
});
return btn;
},
38
);
}
},
mounted () {
if (this.$route.params.id) {
this.getDetails()
}
},
created () {
this.getClass();
this.getSelectData();
}
}
</script>
<style scoped>
.picBox {
display: inline-block;
cursor: pointer;
}
.form .goodsTitle {
border-bottom: 1px solid rgba(0, 0, 0, 0.09);
margin-bottom: 25px;
}
.form .goodsTitle ~ .goodsTitle {
margin-top: 20px;
}
.form .goodsTitle .title {
border-bottom: 2px solid #1890ff;
padding: 0 8px 12px 5px;
color: #000;
font-size: 14px;
}
.form .goodsTitle .icons {
font-size: 15px;
margin-right: 8px;
color: #999;
}
.form .add {
font-size: 12px;
color: #1890ff;
padding: 0 12px;
cursor: pointer;
}
.form .radio {
margin-right: 20px;
}
.form .submission {
width: 10%;
margin-left: 27px;
}
.form .upLoad {
width: 58px;
height: 58px;
line-height: 58px;
border: 1px dotted rgba(0, 0, 0, 0.1);
border-radius: 4px;
background: rgba(0, 0, 0, 0.02);
}
.form .iconfont {
color: #898989;
}
.form .pictrue {
width: 60px;
height: 60px;
border: 1px dotted rgba(0, 0, 0, 0.1);
margin-right: 10px;
}
.form .pictrue img {
width: 100%;
height: 100%;
}
.Modals .address {
width: 90%;
}
.Modals .address .iconfont {
font-size: 20px;
}
</style>

237
src/pages/article/article_category.vue

@ -0,0 +1,237 @@
<template>
<div>
<Card :bordered="false" dis-hover class="ivu-mt">
<Form ref="formValidate" :model="formValidate" :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
<Row type="flex" :gutter="24">
<Col v-bind="grid">
<FormItem label="是否显示:" label-for="status">
<Select v-model="formValidate.status" placeholder="请选择" element-id="status" clearable @on-change="userSearchs">
<Option value="all">全部</Option>
<Option value="1">显示</Option>
<Option value="0">不显示</Option>
</Select>
</FormItem>
</Col>
<Col v-bind="grid">
<FormItem label="分类昵称:" prop="title" label-for="status2">
<Input search enter-button placeholder="请输入分类昵称" v-model="formValidate.title" @on-search="userSearchs"/>
</FormItem>
</Col>
</Row>
<Row type="flex">
<Col v-bind="grid">
<Button v-auth="['store-article-article_category']" type="primary" icon="md-add" @click="add">添加文章分类</Button>
</Col>
</Row>
</Form>
<Divider dashed/>
<vxe-table
class="vxeTable"
highlight-hover-row
:loading="loading"
header-row-class-name="false"
:tree-config="{children: 'children'}"
:data="categoryList">
<vxe-table-column field="id" title="ID" tooltip width="80"></vxe-table-column>
<vxe-table-column field="title" title="分类昵称" min-width="130"></vxe-table-column>
<vxe-table-column field="image" title="分类图片" min-width="130">
<template v-slot="{ row }">
<viewer>
<div class="tabBox_img">
<img v-lazy="row.image + $picSize(60)">
</div>
</viewer>
</template>
</vxe-table-column>
<vxe-table-column field="status" title="状态" min-width="120">
<template v-slot="{ row }">
<i-switch v-model="row.status" :value="row.status" :true-value="1" :false-value="0" @on-change="onchangeIsShow(row)" size="large">
<span slot="open">显示</span>
<span slot="close">隐藏</span>
</i-switch>
</template>
</vxe-table-column>
<vxe-table-column field="date" title="操作" align="center" width="250" fixed="right">
<template v-slot="{ row }">
<a @click="edit(row)">编辑</a>
<Divider type="vertical" />
<a @click="del(row,'删除文章分类')">删除</a>
<Divider type="vertical" />
<a @click="lookUp(row)">查看文章</a>
</template>
</vxe-table-column>
</vxe-table>
<!-- <div class="acea-row row-right page">-->
<!-- <Page :total="total" :current="formValidate.page" show-elevator show-total @on-change="pageChange"-->
<!-- :page-size="formValidate.limit"/>-->
<!-- </div>-->
</Card>
</div>
</template>
<script>
import { mapState, mapMutations } from 'vuex';
import { categoryAddApi, categoryEditApi, categoryListApi, statusApi } from '@/api/cms';
export default {
name: 'articleCategory',
data () {
return {
grid: {
xl: 7,
lg: 7,
md: 12,
sm: 24,
xs: 24
},
loading: false,
formValidate: {
status: '',
page: 1,
limit: 20,
type: 0
},
total: 0,
columns1: [
{
title: 'ID',
key: 'id',
width: 80
},
{
title: '分类昵称',
key: 'title',
minWidth: 130
},
{
title: '分类图片',
slot: 'images',
minWidth: 130
},
{
title: '状态',
slot: 'statuss',
minWidth: 130
},
{
title: '操作',
slot: 'action',
fixed: 'right',
minWidth: 120
}
],
FromData: null,
modalTitleSs: '',
categoryId: 0,
categoryList: []
}
},
computed: {
...mapState('admin/layout', [
'isMobile'
]),
labelWidth () {
return this.isMobile ? undefined : 75;
},
labelPosition () {
return this.isMobile ? 'top' : 'right';
}
},
mounted () {
this.getList();
},
methods: {
...mapMutations('admin/userLevel', [
'getCategoryId'
]),
//
add () {
this.$modalForm(categoryAddApi()).then(() => this.getList());
// categoryAddApi().then(async res => {
// this.$refs.edits.modals = true;
// this.FromData = res.data;
// }).catch(res => {
// this.$Message.error(res.msg);
// })
},
//
edit (row) {
this.$modalForm(categoryEditApi(row.id)).then(() => this.getList());
// categoryEditApi(row.id).then(async res => {
// this.FromData = res.data;
// this.$refs.edits.modals = true;
// }).catch(res => {
// this.$Message.error(res.msg);
// })
},
//
del (row, tit) {
let delfromData = {
title: tit,
num: 0,
url: `cms/category/${row.id}`,
method: 'DELETE',
ids: ''
}
this.$modalSure(delfromData).then((res) => {
this.$Message.success(res.msg);
this.getList();
}).catch(res => {
this.$Message.error(res.msg);
});
},
//
getList () {
this.loading = true;
categoryListApi(this.formValidate).then(async res => {
let data = res.data
this.categoryList = data.list;
this.total = data.count;
this.loading = false;
}).catch(res => {
this.loading = false;
this.$Message.error(res.msg);
})
},
pageChange (index) {
this.formValidate.page = index;
this.getList();
},
//
userSearchs () {
this.formValidate.page = 1;
this.getList();
},
//
onchangeIsShow (row) {
let data = {
id: row.id,
status: row.status
}
statusApi(data).then(async res => {
this.$Message.success(res.msg);
}).catch(res => {
this.$Message.error(res.msg);
})
},
//
lookUp (row) {
this.$router.push({ path: '/store/article/index',
query: {
id: row.id
} });
// xia mian chu cun mei yong;
this.getCategoryId(row.id)
}
}
}
</script>
<style scoped lang="stylus">
.tabBox_img
width 36px
height 36px
border-radius:4px
cursor pointer
img
width 100%
height 100%
</style>

472
src/pages/article/index.vue

@ -0,0 +1,472 @@
<template>
<div>
<Card
:bordered="false"
dis-hover
class="ivu-mt"
>
<Form
ref="artFrom"
:model="artFrom"
:label-width="labelWidth"
:label-position="labelPosition"
@submit.native.prevent
>
<Row
type="flex"
:gutter="24"
>
<Col v-bind="grid">
<FormItem
label="文章搜索:"
label-for="title"
>
<Input
search
enter-button
placeholder="请输入"
v-model="artFrom.title"
style="width:80%;"
@on-search="userSearchs"
/>
</FormItem>
</Col>
<Col v-bind="grid">
<FormItem label="状态:">
<Select v-model="artFrom.status" clearable style="width:250px" @on-change="handleCheckChange">
<Option :value="1">已上架</Option>
<Option :value="0">未上架</Option>
</Select>
</FormItem>
</Col>
<Col v-bind="grid">
<FormItem label="文章分类:">
<Select v-model="artFrom.pid" clearable style="width:250px" @on-change="handleCheckChange">
<Option v-for="item in treeData" :value="item.id" :key="item.value">{{ item.title }}</Option>
</Select>
</FormItem>
</Col>
</Row>
<Row type="flex">
<Col v-bind="grid">
<router-link
:to="'/store/article/add_article'"
v-auth="['store-article-index']"
><Button
type="primary"
class="bnt"
icon="md-add"
>添加文章</Button></router-link>
</Col>
</Row>
</Form>
<Table
:columns="columns1"
:data="cmsList"
ref="table"
class="mt25"
:loading="loading"
highlight-row
no-userFrom-text="暂无数据"
no-filtered-userFrom-text="暂无筛选结果"
>
<template
slot-scope="{ row, index }"
slot="up_status"
>
<div>
<Switch
:true-value="1"
:false-value="0"
v-model="row.status"
size="large"
@on-change="isShow(row.id,row.status)"
>
<template #open>
<span>上架</span>
</template>
<template #close>
<span>下架</span>
</template>
</Switch>
</div>
</template>
<template
slot-scope="{ row, index }"
slot="titles"
>
<span>{{ row.title}}</span>
</template>
<template
slot-scope="{ row, index }"
slot="image_inputs"
>
<!-- <viewer v-if="row.image_input.length!==0">
<div class="tabBox_img" v-for="(item, index) in row.image_input" :key="index">
<img v-lazy="item">
</div>
</viewer> -->
<viewer>
<div class="tabBox_img">
<img v-if="row.image_input" v-lazy="row.image_input + $picSize(60)">
</div>
</viewer>
</template>
<template
slot-scope="{ row, index }"
slot="action"
>
<a @click="edit(row,'查看')">{{row.is_release==1? '查看':'编辑'}}</a>
<Divider type="vertical" />
<!-- <a :class="{'dele' : row.is_release ==1}" @click="edit(row,'发布')">发布</a>
<Divider type="vertical" /> -->
<!-- <template>
<Divider type="vertical" />
<a :class="{'dele' : row.is_release !=1}" v-if="row.status==1" @click="edit(row,'下架')">下架</a>
<a v-else @click="edit(row,'上架')">上架</a>
</template> -->
<a @click="del(row,'删除文章', index)">删除</a>
</template>
</Table>
<div class="acea-row row-right page">
<Page
:total="total"
:current="artFrom.page"
show-elevator
show-total
@on-change="pageChange"
:page-size="artFrom.limit"
/>
</div>
</Card>
<!--关联-->
<Modal
v-model="modals"
title="商品列表"
footerHide
class="paymentFooter"
scrollable
width="900"
@on-cancel="cancel"
>
<goods-list
ref="goodslist"
@getProductId="getProductId"
v-if="modals"
></goods-list>
</Modal>
</div>
</template>
<script>
import { mapState } from 'vuex';
import { cmsListApi, categoryListApi, relationApi,setStatus,setRelease} from '@/api/cms';
import relationList from './relation';
import { formatDate } from '@/utils/validate';
import goodsList from '@/components/goodsList/index';
export default {
name: 'addArticle',
data () {
return {
modalTitleSs: '',
currentTab: '',
grid: {
xl: 8,
lg: 8,
md: 12,
sm: 24,
xs: 24
},
loading: false,
artFrom: {
pid: 0,
title: '',
page: 1,
limit: 20,
status:'',
},
total: 0,
columns1: [
{
title: 'ID',
key: 'id',
width: 80
},
// {
// title: '',
// slot: 'image_inputs',
// width: 130
// },
{
title: '文章名称',
slot: 'titles',
minWidth: 130
},
{
title: '分类',
key: 'catename',
minWidth: 130
},
// {
// title: '',
// key: 'sort',
// minWidth: 60
// },
{
title: '状态',
slot: 'up_status',
minWidth: 80
},
{
title: '浏览量',
key: 'visit',
minWidth: 80
},
{
title: '时间',
key: 'add_time',
sortable: true,
render: (h, params) => {
return h('div',
formatDate(new Date(Number(params.row.add_time) * 1000), 'yyyy-MM-dd hh:mm')
)
},
minWidth: 120
},
{
title: '操作',
slot: 'action',
fixed: 'right',
minWidth: 120
}
],
cmsList: [],
treeData: [],
list: [],
cid: 0, // id
cmsId: 0,
formValidate: {
type: 1
},
rows: {},
modal_loading: false,
modals: false
}
},
components: {
relationList,
goodsList
},
computed: {
...mapState('admin/layout', [
'isMobile'
]),
labelWidth () {
return this.isMobile ? undefined : 75;
},
labelPosition () {
return this.isMobile ? 'top' : 'right';
}
},
created () {
this.artFrom.pid = this.$route.query.id ? this.$route.query.id : 0;
this.getList();
this.getClass();
},
methods: {
//
getProductId (row) {
let data = {
product_id: row.id
};
relationApi(data, this.rows.id).then(async res => {
this.$Message.success(res.msg);
row.id = 0;
this.modal_loading = false;
this.modals = false;
setTimeout(() => {
this.getList();
}, 500);
}).catch(res => {
this.modal_loading = false;
this.loading = false;
this.$Message.error(res.msg);
})
},
cancel () {
this.modals = false;
},
//
getList () {
this.loading = true;
cmsListApi(this.artFrom).then(async res => {
let data = res.data
this.cmsList = data.list;
this.total = data.count;
this.loading = false;
}).catch(res => {
this.loading = false;
this.$Message.error(res.msg);
})
},
//
getClass () {
categoryListApi(this.formValidate).then(async res => {
let data = res.data
this.treeData = data;
let obj = {
id: 0,
title: '全部'
}
this.treeData.unshift(obj);
}).catch(res => {
this.$Message.error(res.msg);
})
},
pageChange (index) {
this.artFrom.page = index;
this.getList();
},
//
handleCheckChange (data) {
this.artFrom.page = 1;
this.getList();
},
isShow(id,status){
setStatus({id,status}).then(res=>{
if(res.status !=200) return this.$Message.error(res.msg);
this.$Message.success(res.msg);
this.getList();
})
},
//
async edit (row,value) {
if(value=='查看') {
this.$router.push({ path: '/store/article/add_article/' + row.id });
return
}
if(value=='发布') {
this.$Modal.confirm({
title: '温馨提示',
content: '<p>确定要发布该数据吗</p>',
onOk: () => {
setRelease({id:row.id}).then(res=>{
if(res.status !=200) return this.$Message.error(res.msg);
this.$Message.success(res.msg);
this.getList();
})
},
});
}
if(value=='上架') {
this.$Modal.confirm({
title: '温馨提示',
content: '<p>确定要上架该数据吗</p>',
onOk: () => {
setStatus({id:row.id,status:1}).then(res=>{
if(res.status !=200) return this.$Message.error(res.msg);
this.$Message.success(res.msg);
this.getList();
})
},
});
}
if(value=='下架') {
this.$Modal.confirm({
title: '温馨提示',
content: '<p>确定要下架该数据吗</p>',
onOk: () => {
setStatus({id:row.id,status:0}).then(res=>{
if(res.status !=200) return this.$Message.error(res.msg);
this.$Message.success(res.msg);
this.getList();
})
},
});
}
console.log(row,value)
},
//
artRelation (row, tit, num) {
this.rows = row;
if (row.product_id === 0) {
this.modals = true;
} else {
let delfromData = {
title: tit,
num: num,
url: `/cms/cms/unrelation/${row.id}`,
method: 'PUT',
ids: ''
}
this.$modalSure(delfromData).then((res) => {
this.$Message.success(res.msg);
this.getList()
}).catch(res => {
this.$Message.error(res.msg);
});
}
},
//
del (row, tit, num) {
let delfromData = {
title: tit,
num: num,
url: `cms/cms/${row.id}`,
method: 'DELETE',
ids: ''
};
this.$modalSure(delfromData).then((res) => {
this.$Message.success(res.msg);
this.cmsList.splice(num, 1);
}).catch(res => {
this.$Message.error(res.msg);
});
},
//
userSearchs () {
this.artFrom.page = 1;
this.getList();
}
}
}
</script>
<style scoped lang="stylus">
.treeSel >>>.ivu-select-dropdown-list {
padding: 0 10px !important;
box-sizing: border-box;
}
.tabBox_img {
width: 36px;
height: 36px;
border-radius: 4px;
cursor: pointer;
img {
width: 100%;
height: 100%;
}
}
.dele {
pointer-events:none;
color: #999;
}
</style>

90
src/pages/article/relation.vue

@ -0,0 +1,90 @@
<template>
<Modal v-model="modals" scrollable footer-hide closable title="选择商品" :mask-closable="false" width="950" @on-cancel="handleReset">
<Form ref="levelFrom" :model="levelFrom" :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
<Row type="flex" :gutter="24">
<Col v-bind="grid">
<FormItem label="商品名称:" prop="status2" label-for="status2">
<Input search enter-button v-model="levelFrom.name" placeholder="请输入商品名称" @on-search="userSearchs" style="width: 100%"/>
</FormItem>
</Col>
</Row>
</Form>
<Divider dashed />
<Table :columns="columns1" :data="levelLists" ref="table"
:loading="loading"
no-userFrom-text="暂无数据"
no-filtered-userFrom-text="暂无筛选结果">
<template slot-scope="{ row, index }" slot="is_shows">
<i-switch v-model="row.is_show" :value="row.is_show" :true-value="1" :false-value="0" size="large" @on-change="onchangeIsShow(row)">
<span slot="open">显示</span>
<span slot="close">隐藏</span>
</i-switch>
</template>
<template slot-scope="{ row, index }" slot="is_musts">
<i-switch v-model="row.is_must" :value="row.is_must" :true-value="1" :false-value="0" size="large" @on-change="onchangeIsMust(row)">
<span slot="open">全部完成</span>
<span slot="close">达成其一</span>
</i-switch>
</template>
<template slot-scope="{ row, index }" slot="action">
<a @click="edit(row)">编辑 | </a>
<a @click="del(row,'删除任务')"> 删除</a>
</template>
</Table>
<div class="acea-row row-right page">
<Page :total="total" show-elevator show-total @on-change="pageChange"
:page-size="levelFrom.limit"/>
</div>
<!-- 新建 编辑表单-->
<edit-from ref="edits" :FromData="FromData" @submitFail="submitFail" :titleType="titleType"></edit-from>
</Modal>
</template>
<script>
export default {
name: 'relation',
data () {
return {
modals: false,
grid: {
xl: 12,
lg: 12,
md: 12,
sm: 24,
xs: 24
}
}
},
methods: {
//
handleReset () {
this.modals = false;
},
//
userSearchs () {
this.getList();
},
//
getList () {
this.loading = true;
taskListApi(this.levelId, this.levelFrom).then(async res => {
let data = res.data
this.levelLists = data.list;
this.total = res.data.count;
this.loading = false;
}).catch(res => {
this.loading = false;
this.$Message.error(res.msg);
})
},
pageChange (index) {
this.levelFrom.page = index;
this.getList();
},
}
}
</script>
<style scoped>
</style>

2
src/pages/collection/merge.vue

@ -871,7 +871,7 @@
}
},
created () {
this.base_data={...this.channeldata},
this.base_data={...this.channeldata};
this.getList()
},
methods: {

7
src/pages/sell/seckillAdd.vue

@ -36,14 +36,15 @@
<!-- 秒杀信息-->
<Col span="24">
<!-- <Col span="24">
<FormItem label="类型:" prop="goods_type">
<RadioGroup v-model="formValidate.goods_type" @on-change="goodsTypeRadio">
<Radio :label="1" :disabled='flag'>藏品</Radio>
<Radio :label="2" :disabled='flag'>盲盒</Radio>
</RadioGroup>
</FormItem>
</Col>
</Col> -->
<Col span="24" v-if="formValidate.goods_type==1">
<FormItem label="选择藏品:" prop="goods">
<Button type="primary" v-show="formValidate.goods.length == 0"
@ -174,7 +175,7 @@
</FormItem>
<FormItem v-if="formValidate.tag.length > 0">
<div class="item_tag">
<Tag v-for="(item,index) in formValidate.tag" closable color="green" :name="item" @on-close="handleClose2">
<Tag v-for="(item,index) in formValidate.tag" :key="index" closable color="green" :name="item" @on-close="handleClose2">
{{item}}
</Tag>
</div>

31
src/router/modules/collection.js

@ -1,7 +1,5 @@
import BasicLayout from '@/layouts/basic-layout';
import BasicLayout from '@/layouts/basic-layout'
const pre = 'collection_';
export default {
path: '/store/collection/',
name: 'capital',
@ -42,5 +40,32 @@ export default {
},
component: () => import('@/pages/collection/mergeSave')
},
{
path: '/store/article/index',
name: `${pre}article`,
meta: {
title: '文章管理',
auth: ['store-article-index']
},
component: () => import('@/pages/article/index')
},
{
path: '/store/article/article_category',
name: `${pre}article_category`,
meta: {
title: '文章分类',
auth: ['store-article-article_category']
},
component: () => import('@/pages/article/article_category')
},
{
path: '/store/article/add_article/:id?',
name: `${pre}add_article`,
meta: {
title: '添加文章',
auth: ['store-article-add_article']
},
component: () => import('@/pages/article/add_article')
},
]
}
Loading…
Cancel
Save