Commit 1fcb1399 by xinla

修改海报问题

1 parent e4ec0185
......@@ -4,7 +4,7 @@ const serviceCategory = window.CONFIG.services.wecom + '/poster'
/**
* 查询海报列表
* @param {*} params
* @param {*} params
*/
export function getList(params) {
return request({ url: service + '/list', params })
......@@ -16,7 +16,7 @@ export function getList(params) {
*/
export function updatePoster(data) {
console.log('poster change:', JSON.stringify(data))
return request({ url: serviceCategory + '/update', method: 'put', data })
return request({ url: serviceCategory + '/update', method: 'put', data })
}
/**
......@@ -24,7 +24,6 @@ export function updatePoster(data) {
* @param {*} data
*/
export function addPoster(data) {
console.log('poster add:', JSON.stringify(data))
return request({ url: serviceCategory + '/insert', method: 'post', data })
}
......
......@@ -4,8 +4,6 @@ import MaPage from '@/views/material/components/MaPage'
import SelectMaterial from '@/components/SelectMaterial'
import { fabric } from 'fabric'
import qrCodeImage from '@/assets/poster/img/qrCodeImage.png'
export default {
name: 'Poster',
components: {
......@@ -22,18 +20,7 @@ export default {
edit: false // 编辑弹出显示隐藏
},
rangeErrorMsg: '',
form: {
title: '', // 海报名称
categoryId: '', // 所属分类
type: '1', // 海报类型
// content: '', // 内容
// count: '', // 虚拟次数
// sort: '', // 海报排序
// jump: [], // 跳转页面
delFlag: 0, // 是否启用
backgroundImgPath: '', // 图片url
mediaId: '' // 图片id
},
form: {},
rules: {
title: {
required: true,
......@@ -94,7 +81,14 @@ export default {
this.posterSubassemblyList = data.posterSubassemblyList || []
} else {
// 新增,清除编辑的数据
this.form = {}
this.form = {
title: '', // 海报名称
categoryId: '', // 所属分类
type: '1', // 海报类型
delFlag: 0, // 是否启用
backgroundImgPath: '', // 图片url
mediaId: '' // 图片id
}
this.posterSubassemblyList = []
}
this.dialog.edit = true
......@@ -264,6 +258,7 @@ export default {
},
addObj(type, obj) {
let options = {
fill: '#333333',
left: 100,
top: 100,
borderDashArray: [3, 3],
......@@ -281,10 +276,10 @@ export default {
case 'image':
case 'qrcode':
new fabric.Image.fromURL(type == 'image' ? obj : qrCodeImage, (img) => {
new fabric.Image.fromURL(type == 'image' ? obj : 'http://demo.linkwechat.cn/lib/qrCode.png', (img) => {
img.set(options)
img.scale(this.canvas.width / img.width / 2)
// img.scaleToWidth(200)
// img.scale(this.canvas.width / img.width / 2)
img.scaleToWidth(200)
this.canvas.add(img).setActiveObject(img)
})
break
......@@ -342,8 +337,10 @@ export default {
let vo = null
let i = 0
let len = list.length
console.log(form.posterJSON)
while (i < len) {
vo = list[i]
debugger
let isText = vo.type == 'i-text'
......@@ -359,8 +356,8 @@ export default {
fontTextAlign: align, // 1 2 3 left center right
left: parseInt(vo.left), // - (isText ? 0 : vo.width >> 1), // 显示偏移了
top: parseInt(vo.top), // - (isText ? 0 : vo.height >> 1),
width: parseInt(vo.width + (isText ? vo.fontSize / 2 : 0)),
height: parseInt(vo.height),
width: parseInt(vo.width * vo.scaleX + (isText ? vo.fontSize / 2 : 0)),
height: parseInt(vo.height * vo.scaleY),
imgPath: vo.src || '',
posterId: null,
type: vo.customType, // 1 固定文本 2 固定图片 3 二维码图片
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!