Commit 7251fa13 by xinla Committed by Gitee

海报分支合并前端分支

Merge pull request from xinla/dev_poster
2 parents 4949a20e 4f3ad70f
......@@ -2,7 +2,7 @@
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'
# 开发环境IP
......
......@@ -5,4 +5,4 @@ ENV = 'production'
VUE_APP_BASE_API = 'http://146.56.222.200'
# 生产环境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 {
v-model="radio"
>
<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>
</el-radio>
</el-radio-group>
......
<template>
<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" />
</div>
</template>
......@@ -17,8 +17,7 @@ const includeUIOptions = {
}
};
const editorDefaultOptions = {
cssMaxWidth: 640,
cssMaxHeight: 1136
cssMaxHeight: 700
};
export default {
name: 'PosterPage',
......@@ -61,12 +60,6 @@ export default {
},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
this.editorInstance.events.addText = []
......@@ -86,6 +79,14 @@ export default {
this.editorInstance = null;
},
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 () {
this.activeObjectId = null;
......
......@@ -7,7 +7,7 @@ import {
removePoster,
} from '@/api/material/poster.js'
import MaPage from '@/views/material/components/MaPage'
import SelectMaterial from '@/components/SelectMaterial'
// Load Style Code
import "tui-image-editor/dist/tui-image-editor.css";
import "tui-color-picker/dist/tui-color-picker.css";
......@@ -26,12 +26,14 @@ export default {
name: 'Poster',
components: {
MaPage,
SelectMaterial,
"tui-image-editor": PosterPage
},
data () {
return {
imgList: {},
imgData: [],
dialogVisibleSelectMaterial: false,
dialog: {
preview: false, // 预览弹出显示隐藏
edit: false // 编辑弹出显示隐藏
......@@ -39,6 +41,8 @@ export default {
posterEdit: {
step: 0
},
materialSelected: '', // 图片url
rangeErrorMsg: '',
posterForm: {
title: '', // 海报名称
categoryId: '', // 所属分类
......@@ -47,7 +51,8 @@ export default {
// count: '', // 虚拟次数
// sort: '', // 海报排序
// jump: [], // 跳转页面
delFlag: 0 // 是否启用
delFlag: 0, // 是否启用
mediaId: '', // 图片id
},
rules: {
title: {
......@@ -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',
// name: "posterImage"
// },
uiSize: {
height: '700px' // 设置固定高度
},
usageStatistics: false,
menuBarPosition: "right",
menu: ['text'], // FIXME 因为借用了CANVAS的UI 所以需要使用TEXT,需要额外注释,后面创建自己的UI在去掉
......@@ -168,8 +176,9 @@ export default {
title: data.title,
categoryId: data.categoryId,
type: data.type,
delFlag: data.delFlag
delFlag: data.delFlag,
}
this.materialSelected = data.backgroundImgPath
this.posterEdit.step = 0
this.dialog.edit = true
} catch (error) {
......@@ -262,9 +271,16 @@ export default {
imageEditor.stopDrawingMode();
},
toNextStep () {
if (this.materialSelected === '') {
this.rangeErrorMsg = '请选择背景图片'
return
} else {
this.rangeErrorMsg = ''
}
this.$refs.form.validate((valid) => {
if (valid) {
this.posterEdit.step = 1
this.$refs.tuiImageEditor.getBackgroundUrl(this.materialSelected)
} else {
return false;
}
......@@ -364,6 +380,16 @@ export default {
this.imgData.push(data)
// 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() {
let list =[];
......@@ -395,6 +421,11 @@ export default {
let i = 0, len = list.length;
while (i < len) {
let vo = list[i];
if (!this.imgData[i]) {
console.log('this.imgData[i] is null')
i++;
continue;
}
vo.objType = this.imgData[i].objType;
vo.url = this.imgData[i].url;
vo.randomId = this.imgData[i].randomId;
......@@ -436,13 +467,15 @@ export default {
if (posterForm.id) {
// 编辑海报
res = await updatePoster(Object.assign({}, {
backgroundImgPath: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg',
posterSubassemblyList: []
// backgroundImgPath: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2980445260,41238050&fm=26&gp=0.jpg',
backgroundImgPath: this.materialSelected,
posterSubassemblyList: posterSubList
}, this.posterForm))
} else {
// 新建海报
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
}, this.posterForm))
}
......@@ -457,6 +490,7 @@ export default {
</script>
<template>
<div>
<MaPage
ref="page"
type="5"
......@@ -589,6 +623,22 @@ export default {
<el-radio :label="0">否</el-radio>
</el-radio-group>
</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-button type="success" @click="toNextStep"
>前往设计海报</el-button
......@@ -601,7 +651,7 @@ export default {
<tui-image-editor
ref="tuiImageEditor"
:include-ui="useDefaultUI"
:options="options"
:options="options"
@getImageData="getImgData"
></tui-image-editor>
</div>
......@@ -645,6 +695,15 @@ export default {
</div>
</el-dialog>
</MaPage>
<!-- 选择素材弹窗 -->
<SelectMaterial
:visible.sync="dialogVisibleSelectMaterial"
type="1"
:showArr="[1]"
@success="submitSelectMaterial"
>
</SelectMaterial>
</div>
</template>
<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!