Commit 7251fa13 by xinla Committed by Gitee

海报分支合并前端分支

Merge pull request from xinla/dev_poster
2 parents 4949a20e 4f3ad70f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
ENV = 'development' ENV = 'development'
# 仟微管理系统/开发环境 # 仟微管理系统/开发环境
VUE_APP_BASE_API = 'http://146.56.222.200' VUE_APP_BASE_API = 'http://146.56.222.200/api'
# VUE_APP_BASE_API = 'http://n3rpzt.natappfree.cc' # VUE_APP_BASE_API = 'http://n3rpzt.natappfree.cc'
# 开发环境IP # 开发环境IP
......
...@@ -5,4 +5,4 @@ ENV = 'production' ...@@ -5,4 +5,4 @@ ENV = 'production'
VUE_APP_BASE_API = 'http://146.56.222.200' VUE_APP_BASE_API = 'http://146.56.222.200'
# 生产环境IP # 生产环境IP
VUE_APP_BASE_URL = 'http://106.13.236.58:8080' VUE_APP_BASE_URL = 'http://146.56.222.200'
No preview for this file type

853 KB | W: | H:

19.3 KB | W: | H:

linkwe-ui/src/assets/poster/img/qrCodeImage.png
linkwe-ui/src/assets/poster/img/qrCodeImage.png
linkwe-ui/src/assets/poster/img/qrCodeImage.png
linkwe-ui/src/assets/poster/img/qrCodeImage.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
v-model="radio" v-model="radio"
> >
<el-radio v-for="(item, index) in list" :label="item" :key="index"> <el-radio v-for="(item, index) in list" :label="item" :key="index">
<img class="img-li" :src="item.materialUrl" alt /> <img crossorigin="anonymous" class="img-li" :src="item.materialUrl" alt />
<div class="ac mt5">{{ item.materialName }}</div> <div class="ac mt5">{{ item.materialName }}</div>
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
......
<template> <template>
<div> <div>
<div ref="tuiImageEditor" style="width: 100%;height: 100%;"></div> <div ref="tuiImageEditor" style="width: 100%;height: 700px;"></div>
<select-material ref="selectMaterial" type="1" :showArr="[1]" :visible.sync="visible" @success="getMaterial" /> <select-material ref="selectMaterial" type="1" :showArr="[1]" :visible.sync="visible" @success="getMaterial" />
</div> </div>
</template> </template>
...@@ -17,8 +17,7 @@ const includeUIOptions = { ...@@ -17,8 +17,7 @@ const includeUIOptions = {
} }
}; };
const editorDefaultOptions = { const editorDefaultOptions = {
cssMaxWidth: 640, cssMaxHeight: 700
cssMaxHeight: 1136
}; };
export default { export default {
name: 'PosterPage', name: 'PosterPage',
...@@ -61,12 +60,6 @@ export default { ...@@ -61,12 +60,6 @@ export default {
},500) },500)
}); });
} }
this.editorInstance.loadImageFromURL('https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg', 'imagePoster').then(async result => {
console.log('old : ' + result.oldWidth + ', ' + result.oldHeight);
console.log('new : ' + result.newWidth + ', ' + result.newHeight);
// await this.addImage('https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg')
// await this.addText('aloha');
});
// hack UI // hack UI
this.editorInstance.events.addText = [] this.editorInstance.events.addText = []
...@@ -86,6 +79,14 @@ export default { ...@@ -86,6 +79,14 @@ export default {
this.editorInstance = null; this.editorInstance = null;
}, },
methods: { methods: {
getBackgroundUrl(bacUrl) {
this.editorInstance.loadImageFromURL(bacUrl, 'imagePoster').then(async result => {
console.log('old : ' + result.oldWidth + ', ' + result.oldHeight);
console.log('new : ' + result.newWidth + ', ' + result.newHeight);
// await this.addImage('https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg')
// await this.addText('aloha');
});
},
initBtn () { initBtn () {
this.activeObjectId = null; this.activeObjectId = null;
......
...@@ -7,7 +7,7 @@ import { ...@@ -7,7 +7,7 @@ import {
removePoster, removePoster,
} from '@/api/material/poster.js' } from '@/api/material/poster.js'
import MaPage from '@/views/material/components/MaPage' import MaPage from '@/views/material/components/MaPage'
import SelectMaterial from '@/components/SelectMaterial'
// Load Style Code // Load Style Code
import "tui-image-editor/dist/tui-image-editor.css"; import "tui-image-editor/dist/tui-image-editor.css";
import "tui-color-picker/dist/tui-color-picker.css"; import "tui-color-picker/dist/tui-color-picker.css";
...@@ -26,12 +26,14 @@ export default { ...@@ -26,12 +26,14 @@ export default {
name: 'Poster', name: 'Poster',
components: { components: {
MaPage, MaPage,
SelectMaterial,
"tui-image-editor": PosterPage "tui-image-editor": PosterPage
}, },
data () { data () {
return { return {
imgList: {}, imgList: {},
imgData: [], imgData: [],
dialogVisibleSelectMaterial: false,
dialog: { dialog: {
preview: false, // 预览弹出显示隐藏 preview: false, // 预览弹出显示隐藏
edit: false // 编辑弹出显示隐藏 edit: false // 编辑弹出显示隐藏
...@@ -39,6 +41,8 @@ export default { ...@@ -39,6 +41,8 @@ export default {
posterEdit: { posterEdit: {
step: 0 step: 0
}, },
materialSelected: '', // 图片url
rangeErrorMsg: '',
posterForm: { posterForm: {
title: '', // 海报名称 title: '', // 海报名称
categoryId: '', // 所属分类 categoryId: '', // 所属分类
...@@ -47,7 +51,8 @@ export default { ...@@ -47,7 +51,8 @@ export default {
// count: '', // 虚拟次数 // count: '', // 虚拟次数
// sort: '', // 海报排序 // sort: '', // 海报排序
// jump: [], // 跳转页面 // jump: [], // 跳转页面
delFlag: 0 // 是否启用 delFlag: 0, // 是否启用
mediaId: '', // 图片id
}, },
rules: { rules: {
title: { title: {
...@@ -80,6 +85,9 @@ export default { ...@@ -80,6 +85,9 @@ export default {
// path: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.gtimg.com%2Fsports%2Fpics%2Fhv1%2F171%2F106%2F1472%2F95744001.jpg&refer=http%3A%2F%2Fimg1.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1612444990&t=6589254fe9669cc6a45fd3688f269612', // path: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg1.gtimg.com%2Fsports%2Fpics%2Fhv1%2F171%2F106%2F1472%2F95744001.jpg&refer=http%3A%2F%2Fimg1.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1612444990&t=6589254fe9669cc6a45fd3688f269612',
// name: "posterImage" // name: "posterImage"
// }, // },
uiSize: {
height: '700px' // 设置固定高度
},
usageStatistics: false, usageStatistics: false,
menuBarPosition: "right", menuBarPosition: "right",
menu: ['text'], // FIXME 因为借用了CANVAS的UI 所以需要使用TEXT,需要额外注释,后面创建自己的UI在去掉 menu: ['text'], // FIXME 因为借用了CANVAS的UI 所以需要使用TEXT,需要额外注释,后面创建自己的UI在去掉
...@@ -168,8 +176,9 @@ export default { ...@@ -168,8 +176,9 @@ export default {
title: data.title, title: data.title,
categoryId: data.categoryId, categoryId: data.categoryId,
type: data.type, type: data.type,
delFlag: data.delFlag delFlag: data.delFlag,
} }
this.materialSelected = data.backgroundImgPath
this.posterEdit.step = 0 this.posterEdit.step = 0
this.dialog.edit = true this.dialog.edit = true
} catch (error) { } catch (error) {
...@@ -262,9 +271,16 @@ export default { ...@@ -262,9 +271,16 @@ export default {
imageEditor.stopDrawingMode(); imageEditor.stopDrawingMode();
}, },
toNextStep () { toNextStep () {
if (this.materialSelected === '') {
this.rangeErrorMsg = '请选择背景图片'
return
} else {
this.rangeErrorMsg = ''
}
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {
this.posterEdit.step = 1 this.posterEdit.step = 1
this.$refs.tuiImageEditor.getBackgroundUrl(this.materialSelected)
} else { } else {
return false; return false;
} }
...@@ -364,6 +380,16 @@ export default { ...@@ -364,6 +380,16 @@ export default {
this.imgData.push(data) this.imgData.push(data)
// console.log(this.imgData) // console.log(this.imgData)
}, },
// 选择素材确认按钮
submitSelectMaterial(text, image, file) {
this.posterForm.mediaId = image.id
this.materialSelected = image.materialUrl
this.dialogVisibleSelectMaterial = false
},
removeMaterial() {
this.posterForm.mediaId = ''
this.materialSelected = ''
},
// //
async save() { async save() {
let list =[]; let list =[];
...@@ -395,6 +421,11 @@ export default { ...@@ -395,6 +421,11 @@ export default {
let i = 0, len = list.length; let i = 0, len = list.length;
while (i < len) { while (i < len) {
let vo = list[i]; let vo = list[i];
if (!this.imgData[i]) {
console.log('this.imgData[i] is null')
i++;
continue;
}
vo.objType = this.imgData[i].objType; vo.objType = this.imgData[i].objType;
vo.url = this.imgData[i].url; vo.url = this.imgData[i].url;
vo.randomId = this.imgData[i].randomId; vo.randomId = this.imgData[i].randomId;
...@@ -436,13 +467,15 @@ export default { ...@@ -436,13 +467,15 @@ export default {
if (posterForm.id) { if (posterForm.id) {
// 编辑海报 // 编辑海报
res = await updatePoster(Object.assign({}, { res = await updatePoster(Object.assign({}, {
backgroundImgPath: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg', // backgroundImgPath: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg',
posterSubassemblyList: [] backgroundImgPath: this.materialSelected,
posterSubassemblyList: posterSubList
}, this.posterForm)) }, this.posterForm))
} else { } else {
// 新建海报 // 新建海报
res = await addPoster(Object.assign({}, { res = await addPoster(Object.assign({}, {
backgroundImgPath: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg', // backgroundImgPath: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg',
backgroundImgPath: this.materialSelected,
posterSubassemblyList: posterSubList posterSubassemblyList: posterSubList
}, this.posterForm)) }, this.posterForm))
} }
...@@ -457,6 +490,7 @@ export default { ...@@ -457,6 +490,7 @@ export default {
</script> </script>
<template> <template>
<div>
<MaPage <MaPage
ref="page" ref="page"
type="5" type="5"
...@@ -589,6 +623,22 @@ export default { ...@@ -589,6 +623,22 @@ export default {
<el-radio :label="0">否</el-radio> <el-radio :label="0">否</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="背景图片" :required="true" :error="rangeErrorMsg">
<div v-if="materialSelected !== ''">
<el-image
style="width: 100px; height: 100px; cursor: pointer;border-radius: 6px;"
:src="materialSelected"
fit="fit"
>
</el-image>
<i class="el-icon-error" @click="removeMaterial"></i>
</div>
<el-button
icon="el-icon-plus"
size="mini"
@click="dialogVisibleSelectMaterial = true"
>添加图片</el-button>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="success" @click="toNextStep" <el-button type="success" @click="toNextStep"
>前往设计海报</el-button >前往设计海报</el-button
...@@ -601,7 +651,7 @@ export default { ...@@ -601,7 +651,7 @@ export default {
<tui-image-editor <tui-image-editor
ref="tuiImageEditor" ref="tuiImageEditor"
:include-ui="useDefaultUI" :include-ui="useDefaultUI"
:options="options" :options="options"
@getImageData="getImgData" @getImageData="getImgData"
></tui-image-editor> ></tui-image-editor>
</div> </div>
...@@ -645,6 +695,15 @@ export default { ...@@ -645,6 +695,15 @@ export default {
</div> </div>
</el-dialog> </el-dialog>
</MaPage> </MaPage>
<!-- 选择素材弹窗 -->
<SelectMaterial
:visible.sync="dialogVisibleSelectMaterial"
type="1"
:showArr="[1]"
@success="submitSelectMaterial"
>
</SelectMaterial>
</div>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!