Commit 34122328 authored by Mac's avatar Mac

1

parent 74e816eb
...@@ -61,42 +61,37 @@ ...@@ -61,42 +61,37 @@
<q-card-section class="q-pt-none"> <q-card-section class="q-pt-none">
<el-form ref="addMsg" :model="addMsg" label-width="120px"> <el-form ref="addMsg" :model="addMsg" label-width="120px">
<el-form-item label="添加方式:"> <el-form-item label="添加方式:">
<q-radio v-model="addMsg.Addtype" val="1" label="新建" /> <q-radio v-model="Addtype" val="1" label="新建" />
<q-radio v-model="addMsg.Addtype" val="2" label="导入" /> <q-radio v-model="Addtype" val="2" label="导入" />
</el-form-item>
<div v-if="Addtype ==1 ">
<el-form-item label="素材分组:">
<q-select filled stack-label option-value="Id" option-label="Name" style="width: 80%;"
v-model="addMsg.MediaGroupId" ref="Id" :options="classifyList" label="分组" :dense="false" emit-value map-options />
</el-form-item> </el-form-item>
<div v-if="addMsg.Addtype ==1 ">
<el-form-item label="图片封面:" required> <el-form-item label="图片封面:" required>
<div class="up-box" @click="selectimg(2)"> <div class="up-box" @click="selectimg(2)">
<span v-if="addMsg.CoverImage==''">+</span> <span v-if="addMsg.AppletModel.ImagePath==''">+</span>
<q-img v-else :src="addMsg.CoverImage" style="width: 100%;height: 100%;display: flex;"> <q-img v-else :src="addMsg.AppletModel.ImagePath" style="width: 100%;height: 100%;display: flex;">
</q-img> </q-img>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="添加标题:" required> <el-form-item label="添加标题:" required>
<q-input clearable standout="bg-primary text-white" v-model="addMsg.title" label="标题" style="width: 80%;" /> <q-input clearable standout="bg-primary text-white" filled v-model="addMsg.AppletModel.Title" label="标题" style="width: 80%;" :rules="[val => !!val || '请输入标题']"/>
</el-form-item> </el-form-item>
<el-form-item label="AppID:" required> <el-form-item label="AppID:" required>
<q-input clearable standout="bg-primary text-white" v-model="addMsg.AppID" label="请填写小程序AppID,必须是关联到企业的小程序应用" style="width: 80%;" /> <q-input clearable standout="bg-primary text-white" filled v-model="addMsg.AppletModel.AppletId" label="请填写小程序AppID,必须是关联到企业的小程序应用" style="width: 80%;" :rules="[val => !!val || '请输入小程序ID']"/>
</el-form-item> </el-form-item>
<el-form-item label="page路径:" required> <el-form-item label="page路径:" required>
<q-input clearable standout="bg-primary text-white" v-model="addMsg.link" label="请填写小程序路径,例如:pages/index" style="width: 80%;" /> <q-input clearable standout="bg-primary text-white" filled v-model="addMsg.AppletModel.Page" label="请填写小程序路径,例如:pages/index" style="width: 80%;" :rules="[val => !!val || '请输入路径']"/>
</el-form-item> </el-form-item>
<el-form-item label="素材同步:">
<div class="q-gutter-sm" style="align-items: flex-start;display: flex;">
<q-radio v-model="addMsg.issynchro" val="2" label="不同步" />
<q-radio v-model="addMsg.issynchro" val="1" label="同步至【内容引擎】" />
<div v-if="addMsg.issynchro==1" style="width: 200px;">
<q-select filled stack-label option-value="ID" option-label="Name"
v-model="addMsg.classifyId" ref="ID" :options="classifyList" label="分类" :dense="false" emit-value map-options />
</div>
</div>
</el-form-item>
</div> </div>
<div v-if="addMsg.Addtype ==2 "> <div v-if="Addtype ==2 ">
<el-form-item label="小程序:" required> <el-form-item label="小程序:" required>
<q-btn color="accent" class="q-mr-md" label="选择小程序" @click="selectimg(4)" /> <q-btn color="accent" class="q-mr-md" label="选择小程序" @click="selectimg(6)" />
</el-form-item> </el-form-item>
</div> </div>
...@@ -106,12 +101,12 @@ ...@@ -106,12 +101,12 @@
<q-separator /> <q-separator />
<q-card-actions align="right" class="bg-white"> <q-card-actions align="right" class="bg-white">
<q-btn class="q-mr-md" label="取消" @click="closeEditOrder" /> <q-btn class="q-mr-md" label="取消" @click="closeEditOrder" />
<q-btn color="accent" class="q-mr-md" label="保存" @click="saveOrderInfo()" /> <q-btn color="accent" class="q-mr-md" label="确定" @click="saveOrderInfo()" />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- 图片 --> <!-- 图片 -->
<selectMaterial v-if="isshowselectMaterial" :materialType="materialType" :saveobj='Selectobj' <selectMaterial v-if="isshowselectMaterial" :materialType="materialType" :saveobj='Selectobj' :classifyList='classifyList'
@close="getclose()" @success='getsuccess'> @close="getclose()" @success='getsuccess'>
</selectMaterial> </selectMaterial>
</div> </div>
...@@ -121,6 +116,9 @@ ...@@ -121,6 +116,9 @@
import { import {
UploadSelfFile UploadSelfFile
} from "../../api/common/common"; //上传图片 } from "../../api/common/common"; //上传图片
import {
setWeChatMediumInfo,//新增素材
} from '../../api/system/wechat';
import selectMaterial from "./selectMaterial" import selectMaterial from "./selectMaterial"
export default { export default {
...@@ -129,6 +127,10 @@ ...@@ -129,6 +127,10 @@
type: Object, type: Object,
default: null, default: null,
}, },
classifyList: {
type: Array,
default: [],
},
}, },
components: { components: {
selectMaterial, selectMaterial,
...@@ -136,30 +138,28 @@ ...@@ -136,30 +138,28 @@
data() { data() {
return { return {
IsShow: true, IsShow: true,
Addtype: "1",//添加方式 1为新建
addMsg: { addMsg: {
Addtype: '1',//添加方式 1为新建 Id: 0,
CoverImage: '', Type: 6,
title:'', Is_Sync: 1,
Content:'', MediaGroupId: '',
issynchro:'1', AppletModel:{
classifyId:'', AppletId: '',
AppID:'', Page: '',
link:'', Title: '',
ImageName: '',
ImagePath: '',
}
}, },
materialType: 2, materialType: 2,
Selectobj: {}, Selectobj: {},
isshowselectMaterial: false, isshowselectMaterial: false,
classifyList:[
{Name:'活动',ID:1,},
{Name:'产品',ID:2,},
{Name:'校园',ID:3,},
],
} }
}, },
created() { created() {
if (JSON.stringify(this.saveobj) !== '{}') {
this.addMsg = JSON.parse(JSON.stringify(this.saveobj))
}
}, },
mounted() { mounted() {
...@@ -180,15 +180,76 @@ ...@@ -180,15 +180,76 @@
this.isshowselectMaterial = false this.isshowselectMaterial = false
}, },
getsuccess(data) {//选择数据回来 getsuccess(data) {//选择数据回来
this.Selectobj = data if(this.materialType==2){
this.addMsg.AppletModel.ImageName = data.ImageModel.ImageName
this.addMsg.AppletModel.ImagePath = data.ImageModel.ImagePath
}else{
this.$emit('success', data)
}
this.addMsg.CoverImage = data.img this.addMsg.CoverImage = data.img
this.isshowselectMaterial = false this.isshowselectMaterial = false
}, },
saveOrderInfo(){ setWeChat(){
this.$emit('success',this.addMsg) setWeChatMediumInfo(this.addMsg).then(res => {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '操作成功',
position: 'top'
})
this.Selectobj = JSON.parse(JSON.stringify(this.addMsg))
this.Selectobj.Id = res.Data
this.$emit('success', this.Selectobj)
})
},
saveOrderInfo() {//小程序
if (this.addMsg.MediaGroupId == '') {
this.$q.notify({
type: 'negative',
message: `请选择分组选择`,
position: 'top'
})
return
}
if (this.addMsg.AppletModel.ImagePath == '') {
this.$q.notify({
type: 'negative',
message: `请填写上传图片`,
position: 'top'
})
return
}
if (this.addMsg.AppletModel.AppletId == '') {
this.$q.notify({
type: 'negative',
message: `请填写小程序ID`,
position: 'top'
})
return
}
if (this.addMsg.AppletModel.Page == '') {
this.$q.notify({
type: 'negative',
message: `请填写路径`,
position: 'top'
})
return
}
if (this.addMsg.AppletModel.Title == '') {
this.$q.notify({
type: 'negative',
message: `请填写小程序标题`,
position: 'top'
})
return
} }
this.setWeChat()
},
......
...@@ -61,39 +61,41 @@ ...@@ -61,39 +61,41 @@
<q-card-section class="q-pt-none"> <q-card-section class="q-pt-none">
<el-form ref="addMsg" :model="addMsg" label-width="120px"> <el-form ref="addMsg" :model="addMsg" label-width="120px">
<el-form-item label="添加方式:"> <el-form-item label="添加方式:">
<q-radio v-model="addMsg.Addtype" val="1" label="新建" /> <q-radio v-model="Addtype" val="1" label="新建" />
<q-radio v-model="addMsg.Addtype" val="2" label="导入" /> <q-radio v-model="Addtype" val="2" label="导入" />
</el-form-item>
<div v-if="Addtype ==1 ">
<el-form-item label="分组:">
<q-select filled stack-label option-value="Id" option-label="Name" style="width: 80%;"
v-model="addMsg.MediaGroupId" ref="Id" :options="classifyList" label="分组"
:dense="false" emit-value map-options />
</el-form-item> </el-form-item>
<div v-if="addMsg.Addtype ==1 ">
<el-form-item label="图片封面:" required> <el-form-item label="图片封面:" required>
<div class="up-box" @click="selectimg(2)"> <div class="up-box" @click="selectimg(2)">
<span v-if="addMsg.CoverImage==''">+</span> <span v-if="addMsg.ImgTextModel.ImgPath==''">+</span>
<q-img v-else :src="addMsg.CoverImage" style="width: 100%;height: 100%;display: flex;"> <q-img v-else :src="addMsg.ImgTextModel.ImgPath"
style="width: 100%;height: 100%;display: flex;">
</q-img> </q-img>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="添加标题:" required> <el-form-item label="添加标题:" required>
<q-input clearable standout="bg-primary text-white" v-model="addMsg.title" label="标题" style="width: 80%;" /> <q-input clearable standout="bg-primary text-white" filled
</el-form-item> v-model="addMsg.ImgTextModel.Title" label="标题" style="width: 80%;"
<el-form-item label="添加描述:"> :rules="[val => !!val || '请输入标题']" />
<q-input v-model="addMsg.Content" filled clearable type="textarea" label="文本内容" style="width: 80%;"/>
</el-form-item>
<el-form-item label="素材同步:">
<div class="q-gutter-sm" style="align-items: flex-start;display: flex;">
<q-radio v-model="addMsg.issynchro" val="2" label="不同步" />
<q-radio v-model="addMsg.issynchro" val="1" label="同步至【内容引擎】" />
<div v-if="addMsg.issynchro==1" style="width: 200px;">
<q-select filled stack-label option-value="ID" option-label="Name"
v-model="addMsg.classifyId" ref="ID" :options="classifyList" label="分类" :dense="false" emit-value map-options />
</div>
</div>
</el-form-item> </el-form-item>
<el-form-item label="点击链接:" required> <el-form-item label="点击链接:" required>
<q-input clearable standout="bg-primary text-white" v-model="addMsg.link" label="请输入跳转链接,且必须以http://或https://开头" style="width: 80%;" /> <q-input clearable standout="bg-primary text-white" filled
v-model="addMsg.ImgTextModel.ImgLink" label="请输入跳转链接,且必须以http://或https://开头"
style="width: 80%;" :rules="[ val => !!val || '请输入跳转链接']" />
</el-form-item> </el-form-item>
<el-form-item label="添加描述:">
<q-input v-model="addMsg.ImgTextModel.Description" filled clearable type="textarea"
label="文本内容" style="width: 80%;" />
</el-form-item>
</div> </div>
<div v-if="addMsg.Addtype ==2 "> <div v-if="Addtype ==2 ">
<el-form-item label="图片:" required> <el-form-item label="图片:" required>
<q-btn color="accent" class="q-mr-md" label="选择图文" @click="selectimg(3)" /> <q-btn color="accent" class="q-mr-md" label="选择图文" @click="selectimg(3)" />
</el-form-item> </el-form-item>
...@@ -105,12 +107,12 @@ ...@@ -105,12 +107,12 @@
<q-separator /> <q-separator />
<q-card-actions align="right" class="bg-white"> <q-card-actions align="right" class="bg-white">
<q-btn class="q-mr-md" label="取消" @click="closeEditOrder" /> <q-btn class="q-mr-md" label="取消" @click="closeEditOrder" />
<q-btn color="accent" class="q-mr-md" label="保存" @click="saveOrderInfo()" /> <q-btn color="accent" class="q-mr-md" label="确定" @click="saveOrderInfo()" />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
<!-- 图片 --> <!-- 图片 -->
<selectMaterial v-if="isshowselectMaterial" :materialType="materialType" :saveobj='Selectobj' <selectMaterial v-if="isshowselectMaterial" :materialType="materialType" :classifyList='classifyList'
@close="getclose()" @success='getsuccess'> @close="getclose()" @success='getsuccess'>
</selectMaterial> </selectMaterial>
</div> </div>
...@@ -120,6 +122,9 @@ ...@@ -120,6 +122,9 @@
import { import {
UploadSelfFile UploadSelfFile
} from "../../api/common/common"; //上传图片 } from "../../api/common/common"; //上传图片
import {
setWeChatMediumInfo,//新增素材
} from '../../api/system/wechat';
import selectMaterial from "./selectMaterial" import selectMaterial from "./selectMaterial"
export default { export default {
...@@ -128,6 +133,10 @@ ...@@ -128,6 +133,10 @@
type: Object, type: Object,
default: null, default: null,
}, },
classifyList: {
type: Array,
default: [],
},
}, },
components: { components: {
selectMaterial, selectMaterial,
...@@ -135,29 +144,28 @@ ...@@ -135,29 +144,28 @@
data() { data() {
return { return {
IsShow: true, IsShow: true,
Addtype: "1",//添加方式 1为新建
addMsg: { addMsg: {
Addtype: '1',//添加方式 1为新建 Id: 0,
CoverImage: '', Type: 3,
title:'', Is_Sync: 1,
Content:'', MediaGroupId: '',
issynchro:'1', ImgTextModel: {
classifyId:'', ImgName: '',
link:'', ImgPath: '',
Title: '',
Description: '',
ImgLink: '',
}
}, },
materialType: 2, materialType: 2,
Selectobj: {}, Selectobj: {},
isshowselectMaterial: false, isshowselectMaterial: false,
classifyList:[
{Name:'活动',ID:1,},
{Name:'产品',ID:2,},
{Name:'校园',ID:3,},
],
} }
}, },
created() { created() {
if (JSON.stringify(this.saveobj) !== '{}') {
this.addMsg = JSON.parse(JSON.stringify(this.saveobj))
}
}, },
mounted() { mounted() {
...@@ -178,13 +186,77 @@ ...@@ -178,13 +186,77 @@
this.isshowselectMaterial = false this.isshowselectMaterial = false
}, },
getsuccess(data) {//选择数据回来 getsuccess(data) {//选择数据回来
this.Selectobj = data console.log(data)
this.addMsg.CoverImage = data.img if(this.materialType==2){
this.addMsg.ImgTextModel.ImgName = data.ImageModel.ImageName
this.addMsg.ImgTextModel.ImgPath = data.ImageModel.ImagePath
}else{
this.$emit('success', data)
}
this.isshowselectMaterial = false this.isshowselectMaterial = false
}, },
saveOrderInfo(){
this.$emit('success',this.addMsg)
saveOrderInfo() {//图文提交
if (this.addMsg.MediaGroupId == '') {
this.$q.notify({
type: 'negative',
message: `请选择分组选择`,
position: 'top'
})
return
}
if (this.addMsg.ImgTextModel.ImgPath == '') {
this.$q.notify({
type: 'negative',
message: `请上传图片`,
position: 'top'
})
return
}
if (this.addMsg.ImgTextModel.Title == '') {
this.$q.notify({
type: 'negative',
message: `请填写标题`,
position: 'top'
})
return
}
if (this.addMsg.ImgTextModel.ImgLink == '') {
this.$q.notify({
type: 'negative',
message: `请填写跳转链接`,
position: 'top'
})
return
}
var Expression = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
var objExp = new RegExp(Expression);
if (objExp.test(this.addMsg.ImgTextModel.ImgLink)) {
// plus.runtime.openWeb(this.link)
} else {
this.$q.notify({
type: 'negative',
message: `上传的链接开头非http或https`,
position: 'top'
})
return
}
this.setWeChat()
},
setWeChat() {
setWeChatMediumInfo(this.addMsg).then(res => {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '操作成功',
position: 'top'
})
this.Selectobj = JSON.parse(JSON.stringify(this.addMsg))
this.Selectobj.Id = res.Data
this.$emit('success', this.Selectobj)
})
} }
......
<style> <style>
.selectMaterial .imgstyle { .selectMaterial .imgstyle {
width: 100%; width: 100%;
height: 126px; height: 126px;
...@@ -27,7 +23,8 @@ ...@@ -27,7 +23,8 @@
border: 1px dashed #d9d9d9; border: 1px dashed #d9d9d9;
line-height: 118px; line-height: 118px;
} }
.selectMaterial .onetext {
.selceimg .onetext {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
...@@ -51,7 +48,7 @@ ...@@ -51,7 +48,7 @@
<div class="col row wrap q-mr-lg q-col-gutter-md" style="margin-top: 0;"> <div class="col row wrap q-mr-lg q-col-gutter-md" style="margin-top: 0;">
<div class="col-4"> <div class="col-4">
<q-select filled stack-label @input="resetSearch" option-value="Id" option-label="Name" <q-select filled stack-label @input="resetSearch" option-value="Id" option-label="Name"
v-model="msg.MediaGroupId" ref="Id" :options="classifyList" label="分组" :dense="false" emit-value v-model="msg.MediaGroupId" ref="Id" :options="xialaList" label="分组" :dense="false" emit-value
map-options /> map-options />
</div> </div>
<div class="col-4"> <div class="col-4">
...@@ -65,13 +62,28 @@ ...@@ -65,13 +62,28 @@
</div> </div>
<div class="q-pa-md"> <div class="q-pa-md">
<div class="q-col-gutter-md row items-start" v-if="data.length>0"> <div class="q-col-gutter-md row items-start" v-if="data.length>0">
<div class="col-2" v-for="(x,y) in data" @click="Selectobj = x"> <div class="col-2 selceimg" v-for="(x,y) in data" @click="Selectobj = x">
<q-img :src="x.ImageModel.ImagePath" class="imgstyle" v-if="x.Type==2" <q-img v-if="x.Type==2" :src="x.ImageModel.ImagePath" class="imgstyle"
:style="{border:x.Id == Selectobj.Id?'2px solid #91d5ff':'2px solid #FFF'}"> :style="{border:x.Id == Selectobj.Id?'3px solid #91d5ff':'3px solid #FFF'}">
<div class="absolute-bottom text-subtitle1 text-center onetext" style="padding: 0;padding: 0 5px;font-size: 12px;"> <div class="absolute-bottom text-subtitle1 text-center onetext"
style="padding: 0;padding: 0 5px;font-size: 12px;">
{{x.ImageModel.ImageName}} {{x.ImageModel.ImageName}}
</div> </div>
</q-img> </q-img>
<q-img v-if="x.Type==3 && x.ImgTextModel" :src="x.ImgTextModel.ImgPath" class="imgstyle"
:style="{border:x.Id == Selectobj.Id?'3px solid #91d5ff':'3px solid #FFF'}">
<div class="absolute-bottom text-subtitle1 text-center onetext"
style="padding: 0;padding: 0 5px;font-size: 12px;">
{{x.ImgTextModel.Title}}
</div>
</q-img>
<q-img v-if="x.Type==6 && x.AppletModel" :src="x.AppletModel.ImagePath" class="imgstyle"
:style="{border:x.Id == Selectobj.Id?'3px solid #91d5ff':'3px solid #FFF'}">
<div class="absolute-bottom text-subtitle1 text-center onetext"
style="padding: 0;padding: 0 5px;font-size: 12px;">
{{x.AppletModel.Title}}
</div>
</q-img>
</div> </div>
<q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount" <q-pagination class="full-width justify-end" v-model="msg.pageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" /> :input="true" @input="changePage" />
...@@ -87,7 +99,7 @@ ...@@ -87,7 +99,7 @@
<q-separator /> <q-separator />
<q-card-actions align="right" class="bg-white"> <q-card-actions align="right" class="bg-white">
<q-btn class="q-mr-md" label="取消" @click="closeEditOrder" /> <q-btn class="q-mr-md" label="取消" @click="closeEditOrder" />
<q-btn color="accent" class="q-mr-md" label="保存" @click="saveOrderInfo()" /> <q-btn color="accent" class="q-mr-md" label="确定" @click="saveOrderInfo()" />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
...@@ -98,29 +110,27 @@ ...@@ -98,29 +110,27 @@
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-section class="q-pt-none" style="margin-top: 15px;height: 300px;"> <q-card-section class="q-pt-none" style="margin-top: 15px;height: 300px;">
<el-form ref="localMsg" :model="localMsg" label-width="120px"> <el-form ref="localMsg" :model="localMsg" label-width="120px" v-if="materialType==2 ">
<el-form-item label="素材分组:">
<div class="q-gutter-sm" style="align-items: flex-start;display: flex;">
<div style="width: 400px;">
<q-select filled stack-label option-value="Id" option-label="Name" v-model="localMsg.MediaGroupId"
ref="Id" :options="classifyList" label="分组" :dense="false" emit-value map-options />
</div>
</div>
</el-form-item>
<el-form-item label="上传图片:"> <el-form-item label="上传图片:">
<el-upload class="avatar-uploader addDutyMain" action="" :before-upload="uploadFile" <el-upload class="avatar-uploader addDutyMain" action="" :before-upload="uploadFile"
:show-file-list="false"> :show-file-list="false">
<i class="el-icon-plus avatar-uploader-icon" v-if="localMsg.img==''"></i> <i class="el-icon-plus avatar-uploader-icon" v-if="localMsg.ImageModel.ImagePath==''"></i>
<q-img v-else :src="localMsg.img" style="width: 100%;height: 100%;border-radius: 6px;display: flex;"> <q-img v-else :src="localMsg.ImageModel.ImagePath" style="width: 100%;height: 100%;border-radius: 6px;display: flex;">
</q-img> </q-img>
</el-upload> </el-upload>
<div>(图片大小不超过2M,支持JPG、JPEG及PNG格式)</div> <div>(图片大小不超过2M,支持JPG、JPEG及PNG格式)</div>
</el-form-item> </el-form-item>
<el-form-item label="素材同步:">
<div class="q-gutter-sm" style="align-items: flex-start;display: flex;">
<q-radio v-model="localMsg.issynchro" val="2" label="不同步" />
<q-radio v-model="localMsg.issynchro" val="1" label="同步至【内容引擎】" />
<div v-if="localMsg.issynchro==1" style="width: 200px;">
<q-select filled stack-label option-value="ID" option-label="Name" v-model="localMsg.classifyId"
ref="ID" :options="classifyList" label="分类" :dense="false" emit-value map-options />
</div>
</div>
</el-form-item>
</el-form> </el-form>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
...@@ -142,13 +152,11 @@ ...@@ -142,13 +152,11 @@
getMediumTypeEnumList, getMediumTypeEnumList,
getWeChatMediumGroupList, getWeChatMediumGroupList,
getWeChatMediumPageList,//素材列表 getWeChatMediumPageList,//素材列表
setWeChatMediumInfo,//新增素材
} from '../../api/system/wechat'; } from '../../api/system/wechat';
export default { export default {
props: { props: {
saveobj: {
type: Object,
default: null,
},
materialType: { materialType: {
type: Number, type: Number,
default: 1 default: 1
...@@ -174,22 +182,27 @@ ...@@ -174,22 +182,27 @@
}, },
data: [], data: [],
pageCount: 0, pageCount: 0,
Selectobj: null, Selectobj: { Id: 0 },
localMsg: {//本地上传对象 localMsg: {//本地上传对象
img: '', Id: 0,
issynchro: '1',//是否同步 1是 Type: 0,
classifyID: 0,//同步的时候的分类id Is_Sync: 1,
} MediaGroupId: '',
},
xialaList: [],
} }
}, },
created() { created() {
this.Selectobj = JSON.parse(JSON.stringify(this.saveobj))
this.msg.Type = this.materialType; this.msg.Type = this.materialType;
let obj={ this.gettype()
Id:0, let obj = {
Name:'全部' Id: 0,
Name: '全部'
} }
this.classifyList = this.classifyList.unshift(obj) let data = JSON.parse(JSON.stringify(this.classifyList))
data.unshift(obj)
this.xialaList = data
this.getList() this.getList()
}, },
mounted() { mounted() {
...@@ -199,6 +212,34 @@ ...@@ -199,6 +212,34 @@
}, },
methods: { methods: {
gettype() {
this.localMsg.Type = this.materialType;
this.localMsg.Id = 0;
this.localMsg.Is_Sync = 1;
this.localMsg.MediaGroupId = '';
if (this.materialType == 2) {//图片
this.localMsg.ImageModel = {
ImageName: '',
ImagePath: ''
};
} else if (this.materialType == 3) {//图文
this.localMsg.ImgTextModel = {
ImgName: '',
ImgPath: '',
Title: '',
Description: '',
ImgLink: '',
};
} else if (this.materialType == 6) {//小程序
this.localMsg.AppletModel = {
AppletId: '',
Page: '',
Title: '',
ImageName: '',
ImagePath: '',
};
}
},
//关闭弹窗 //关闭弹窗
closeEditOrder() { closeEditOrder() {
// this.IsShowEditOrder = false; // this.IsShowEditOrder = false;
...@@ -210,7 +251,7 @@ ...@@ -210,7 +251,7 @@
this.loading = false this.loading = false
this.data = res.Data.PageData; this.data = res.Data.PageData;
this.pageCount = res.Data.PageCount this.pageCount = res.Data.PageCount
this.dataList.forEach(x => { this.data.forEach(x => {
x.check = false x.check = false
}) })
...@@ -226,7 +267,7 @@ ...@@ -226,7 +267,7 @@
this.getList() this.getList()
}, },
saveOrderInfo() {//保存返回数据 saveOrderInfo() {//保存返回数据
if (JSON.stringify(this.Selectobj) == "{}") { if (this.Selectobj.Id == 0) {
this.$q.notify({ this.$q.notify({
type: 'negative', type: 'negative',
message: `还未选择`, message: `还未选择`,
...@@ -243,13 +284,73 @@ ...@@ -243,13 +284,73 @@
savelocal() {//本地上传操作 savelocal() {//本地上传操作
//这里做上传操作 刷新列表 //这里做上传操作 刷新列表
setWeChatMediumInfo(this.localMsg).then(res => {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '操作成功',
position: 'top'
})
this.Selectobj = JSON.parse(JSON.stringify(this.localMsg))
this.Selectobj.Id = res.Data
this.$emit('success', this.Selectobj)
this.gettype()
})
}, },
uploadFile(files) { uploadFile(files) {//图片上传
UploadSelfFile("course", files, res => { if (this.materialType == 2 || this.materialType == 3 || this.materialType == 6) {//图文和图片、小程序的时候处理
let types = ['image/jpeg', 'image/jpg', 'image/png'];
const isImage = types.includes(files.type);
if (this.materialType == 2 || this.materialType == 3) {
const isLtSize = files.size / 1024 / 1024 < 2;
if (!isLtSize) {
this.$q.notify({
type: 'negative',
message: `上传图片大小不能超过 2MB!`,
position: 'top'
})
return false;
}
} else {
const isLtSize = files.size / 1024 / 1024 < 1;
if (!isLtSize) {
this.$q.notify({
type: 'negative',
message: `上传图片大小不能超过 1MB!`,
position: 'top'
})
return false;
}
}
if (!isImage) {
this.$q.notify({
type: 'negative',
message: `上传图片只能是 JPG、JPEG、PNG 格式!`,
position: 'top'
})
} else {
wechatUploadSelfFile('wechatcatalogue', files, res => {
if (res.Code == 1) { if (res.Code == 1) {
this.localMsg.img = res.FileUrl; if (this.materialType == 2) {
this.localMsg.ImageModel.ImageName = res.FileName;
this.localMsg.ImageModel.ImagePath = res.FileUrl;
} else if (this.materialType == 3) {
this.localMsg.ImgTextModel.ImgName = res.FileName;
this.localMsg.ImgTextModel.ImgPath = res.FileUrl;
} else {
this.localMsg.AppletModel.ImageName = res.FileName;
this.localMsg.AppletModel.ImagePath = res.FileUrl;
} }
});
this.$forceUpdate();
}
})
}
}
}, },
......
...@@ -56,6 +56,37 @@ ...@@ -56,6 +56,37 @@
{{addMsg.Content}} {{addMsg.Content}}
</div> </div>
</div> </div>
<div style="display: flex;align-items: flex-start;margin-top: 15px;" v-for="(item,index) in MediumModel" :key="index">
<i class="el-icon-user" style="margin-right:20px;font-size: 40px;color: #1890ff;"></i>
<div v-if="item.Type==2" style="width: 1px; flex:1;">
<q-img :src="item.ImageModel.ImagePath"
style="width: 70%;">
</q-img>
</div>
<div v-if="item.Type==3" style="width: 1px; flex:1;padding: 10px 15px; border: 1px solid #eee; border-radius: 4px; background: #fff;">
<div>{{item.ImgTextModel.Title}}</div>
<div style="display: flex;align-items: flex-start;justify-content: space-between;">
<div style="width: 1px;flex:1">
{{item.ImgTextModel.Description}}
</div>
<q-img :src="item.ImgTextModel.ImgPath"
style="width: 80px;height: 80px;margin-left: 10px;">
</q-img>
</div>
</div>
<div v-if="item.Type==6" style="width: 70%;padding: 10px 15px; border: 1px solid #eee; border-radius: 4px; background: #fff;">
<div>{{item.AppletModel.Title}}</div>
<q-img :src="item.AppletModel.ImagePath"
style="width: 100%;">
</q-img>
</div>
</div>
</div> </div>
</div> </div>
<div class="box_r"> <div class="box_r">
...@@ -87,8 +118,9 @@ ...@@ -87,8 +118,9 @@
<div v-if="MediumModel.length>0"> <div v-if="MediumModel.length>0">
<div class="row items-center" v-for="(x,y) in MediumModel" :key="y"> <div class="row items-center" v-for="(x,y) in MediumModel" :key="y">
<i class="el-icon-link"></i> <i class="el-icon-link"></i>
<span style="margin-left: 10px;cursor: pointer;" @click="selectimg">{{Selectobj.name}}</span> <span style="margin-left: 10px;cursor: pointer;" >{{getType(x,'title')}}</span>
<i style="margin-left: 10px;cursor: pointer" class="el-icon-close" @click="Selectobj={}"></i> <i style="margin-left: 10px;cursor: pointer" class="el-icon-close"
@click="deleteModel(y)"></i>
</div> </div>
</div> </div>
...@@ -108,7 +140,8 @@ ...@@ -108,7 +140,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<q-card-actions align="left" class="bg-white" style="margin-top: 15px;"> <q-card-actions align="left" class="bg-white" style="margin-top: 15px;">
<q-btn color="accent" class="q-mr-md" label="保存" @click="savemove()" style="width: 100px;" :loading="loading"/> <q-btn color="accent" class="q-mr-md" label="保存" @click="savemove()" style="width: 100px;"
:loading="loading" />
<q-btn class="q-mr-md" label="返回" @click="goblck()" style="width: 60px;" /> <q-btn class="q-mr-md" label="返回" @click="goblck()" style="width: 60px;" />
</q-card-actions> </q-card-actions>
</div> </div>
...@@ -139,14 +172,13 @@ ...@@ -139,14 +172,13 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- 图片 --> <!-- 图片 -->
<selectMaterial v-if="isshowselectMaterial" :materialType="materialType" :saveobj='Selectobj' :classifyList='classifyList' <selectMaterial v-if="isshowselectMaterial" :materialType="materialType" :classifyList='classifyList'
@close="getclose()" @success='getsuccess'> @close="getclose()" @success='getsuccess'>
</selectMaterial> </selectMaterial>
<!-- 图文 --> <!-- 图文 -->
<imagetextform v-if="isshowimagetext" :saveobj='Selectobj' @close="gettwclose()" @success='gettwsuccess'> <imagetextform v-if="isshowimagetext" @close="gettwclose()" @success='gettwsuccess' :classifyList='classifyList'></imagetextform>
</imagetextform>
<!-- 小程序 --> <!-- 小程序 -->
<appletform v-if="isshowapplet" :saveobj='Selectobj' @close="getxcxclose()" @success='getxcxsuccess'> <appletform v-if="isshowapplet" @close="getxcxclose()" @success='getxcxsuccess' :classifyList='classifyList'>
</appletform> </appletform>
</div> </div>
</template> </template>
...@@ -179,7 +211,7 @@ ...@@ -179,7 +211,7 @@
outerVisible: false,//选择人员弹窗 outerVisible: false,//选择人员弹窗
filterText: '',//人员选择 帅选 filterText: '',//人员选择 帅选
memberList: [],// memberList: [],//
allmemberList:[], allmemberList: [],
showMember: [], showMember: [],
membertype: '1', membertype: '1',
ryList: [], ryList: [],
...@@ -198,9 +230,8 @@ ...@@ -198,9 +230,8 @@
isshowselectMaterial: false, isshowselectMaterial: false,
isshowimagetext: false, isshowimagetext: false,
isshowapplet: false, isshowapplet: false,
Selectobj: {},//选中对象 MediumModel: [],//已选的添加内容
MediumModel:[], classifyList: [],
classifyList:[],
} }
}, },
created() { created() {
...@@ -219,7 +250,7 @@ ...@@ -219,7 +250,7 @@
queryEmployee({}).then(res => { queryEmployee({}).then(res => {
if (res.Code == 1) { if (res.Code == 1) {
this.memberList = res.Data; this.memberList = res.Data;
this.allmemberList = JSON.parse(JSON.stringify(res.Data)) ; this.allmemberList = JSON.parse(JSON.stringify(res.Data));
} }
}).catch(() => { }).catch(() => {
...@@ -258,7 +289,7 @@ ...@@ -258,7 +289,7 @@
if (!value) return true; if (!value) return true;
return data.DepartmentName.indexOf(value) !== -1; return data.DepartmentName.indexOf(value) !== -1;
}, },
getmemlist(){ getmemlist() {
if (this.filterText === '') { if (this.filterText === '') {
this.memberList = JSON.parse(JSON.stringify(this.allmemberList)) this.memberList = JSON.parse(JSON.stringify(this.allmemberList))
} else { } else {
...@@ -285,9 +316,34 @@ ...@@ -285,9 +316,34 @@
}, },
getsuccess(data) {//选择数据回来 getsuccess(data) {//选择数据回来
this.Selectobj = data this.ISidentical(data)
this.isshowselectMaterial = false this.isshowselectMaterial = false
}, },
ISidentical(data){//返回来的数据进行判断再添加
if(this.MediumModel.length>0){
let isyes = false
this.MediumModel.map(x=>{
if(x.Id== data.Id){
isyes = true;
return
}
})
if(isyes==false){
this.MediumModel.push(data)
}else{
this.$q.notify({
type: 'negative',
message: `重复选择、请您重新选择!`,
position: 'top'
})
return
}
}else{
this.MediumModel = [];
this.MediumModel.push(data)
}
},
selecttextimg() {//图文 selecttextimg() {//图文
this.isshowimagetext = true; this.isshowimagetext = true;
...@@ -299,7 +355,7 @@ ...@@ -299,7 +355,7 @@
this.isshowimagetext = false; this.isshowimagetext = false;
}, },
gettwsuccess(data) {//图文返回成功 gettwsuccess(data) {//图文返回成功
this.Selectobj = data this.ISidentical(data)
this.isshowimagetext = false this.isshowimagetext = false
}, },
...@@ -314,8 +370,8 @@ ...@@ -314,8 +370,8 @@
getxcxclose() {//小程序 关闭 getxcxclose() {//小程序 关闭
this.isshowapplet = false; this.isshowapplet = false;
}, },
getxcxsuccess() {//小程序 关闭 getxcxsuccess(data) {//小程序 关闭
this.Selectobj = data this.ISidentical(data)
this.isshowapplet = false this.isshowapplet = false
}, },
savemove() {//保存 savemove() {//保存
...@@ -336,6 +392,16 @@ ...@@ -336,6 +392,16 @@
return return
} }
} }
this.addMsg.MediumIds == ''
if(this.MediumModel && this.MediumModel.length>0){
let ids=[]
this.MediumModel.forEach(x=>{
ids.push(x.Id)
})
this.addMsg.MediumIds = ids.join(',')
}
if (this.addMsg.MediumIds == '') { if (this.addMsg.MediumIds == '') {
this.addMsg.Type = 1; this.addMsg.Type = 1;
if (this.addMsg.Content == '') { if (this.addMsg.Content == '') {
...@@ -367,6 +433,29 @@ ...@@ -367,6 +433,29 @@
goblck() {//返回上一个页面 goblck() {//返回上一个页面
this.$router.go(-1);//返回上一层 this.$router.go(-1);//返回上一层
}, },
getType(row, name) {
let title = ''
let content = ''
if (row.Type == 2) {
title = row.ImageModel.ImageName
content = row.ImageModel.ImagePath
} else if (row.Type == 3) {
title = row.ImgTextModel.Title
content = row.ImgTextModel.ImgPath
} else if (row.Type == 6) {
title = row.AppletModel.Title
content = row.AppletModel.ImagePath
}
if (name == 'title') {
return title
} else if (name == 'content') {
return content
}
},
deleteModel(index){
this.MediumModel.splice(index,1)
}
} }
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
getWeChatWelcomesPageList(this.msg).then(res => { getWeChatWelcomesPageList(this.msg).then(res => {
this.loading = false this.loading = false
this.data = res.Data.PageData; this.data = res.Data.PageData;
this.pageCount = res.Data.Count this.pageCount = res.Data.PageCount
this.data.forEach(x => { this.data.forEach(x => {
x.UserIdName = '' x.UserIdName = ''
x.UserIdList.map((j, i) => { x.UserIdList.map((j, i) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment