Commit 21458125 by hank

图片上传模板预览修改

parent babc733d
...@@ -72,3 +72,11 @@ export function deleteFilm(filmId) { ...@@ -72,3 +72,11 @@ export function deleteFilm(filmId) {
// 删除影片 // 删除影片
return get(`/myequipment/del/film/info/${filmId}`) return get(`/myequipment/del/film/info/${filmId}`)
} }
export function upload(file) {
// 上传文件
let formData = new FormData()
formData.append('resource', file)
return post(`/common/upload/resource`,formData, {
'Content-Type': 'multipart/form-data'
} )
}
\ No newline at end of file
...@@ -38,11 +38,12 @@ export function get (url, params) { ...@@ -38,11 +38,12 @@ export function get (url, params) {
params params
}) })
} }
export function post (url, data) { export function post (url, data, headers = {}) {
return apiRequest({ return apiRequest({
method: 'post', method: 'post',
url, url,
data data,
headers
}) })
} }
export function deleted (url, params) { export function deleted (url, params) {
......
<template> <template>
<van-nav-bar :title="title" :left-arrow="typeof leftArrow !== 'undefined' ? true : false" <van-nav-bar :title="title" :left-arrow="typeof leftArrow !== 'undefined' ? true : false"
@click-left="onClickLeft" @click-left="myonClickLeft"
@click-right="onClickRight"> @click-right="onClickRight">
<div slot="right" > <div slot="right" >
<van-icon v-show="showNotice" @click="goNotice" name="chat-o" size="25" /> <van-icon v-show="showNotice" @click="goNotice" name="chat-o" size="25" />
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<script> <script>
export default { export default {
props: ['left-arrow', 'title'], props: ['left-arrow', 'title', 'onClickLeft'],
data() { data() {
return { return {
left: false, left: false,
...@@ -33,8 +33,12 @@ export default { ...@@ -33,8 +33,12 @@ export default {
} }
}, },
methods:{ methods:{
onClickLeft() { myonClickLeft() {
if(this.onClickLeft) {
this.onClickLeft()
} else {
this.$router.back() this.$router.back()
}
}, },
onClickRight() { onClickRight() {
......
<template> <template>
<div class="edit-container"> <div class="edit-container">
<NavBar title="预览" left-arrow></NavBar> <NavBar title="预览" :onClickLeft="myonClickLeft" left-arrow></NavBar>
<div class="content"> <div class="content">
<div class="content-left"> <div class="content-left">
<iframe <iframe
@load="getData"
class="iframe" class="iframe"
v-show="loaded" v-show="loaded"
:src="templateData.frameUrl+'?isPreview=1'" :src="templateData.frameUrl+'?isPreview=1'"
...@@ -16,7 +17,9 @@ ...@@ -16,7 +17,9 @@
<script> <script>
import NavBar from "@/views/layout/navbar"; import NavBar from "@/views/layout/navbar";
// import { setTimeout } from 'timers';
export default { export default {
props: ['myonClickLeft'],
data() { data() {
return { return {
templateData: { templateData: {
...@@ -38,36 +41,37 @@ export default { ...@@ -38,36 +41,37 @@ export default {
}; };
}, },
created() { created() {
if (this.$route.query.filmId) { // if (this.$route.query.filmId) {
this.mode = "film"; // this.mode = "film";
this.getFilmDetail(); // this.getFilmDetail();
} // }
if (this.$route.query.templateId) { // if (this.$route.query.templateId) {
this.mode = "template"; // this.mode = "template";
this.getTempalteDetail(); // this.getTempalteDetail();
} // }
this.getData()
}, },
mounted() { mounted() {
var vm = this // var vm = this
window.onload = function() { // vm.message({
window.frames[0].postMessage( // type: 'setList',
"getcolor", // list: vm.templateData.listData
"http://visual-clouds.bdideal.com" // })
); this.getData()
vm.message({
type: 'setList',
list: vm.templateData.listData
})
};
}, },
methods: { methods: {
message(data) { message(data) {
window.frames[0].postMessage(data, "http://visual-clouds.bdideal.com"); // window.frames[0].postMessage(data, "http://visual-clouds.bdideal.com");
window.frames[1].postMessage(data, "http://127.0.0.1:9000");
}, },
getData() { getData() {
this.loaded = true this.loaded = true
this.templateData = JSON.parse(window.localStorage.getItem('preview')) this.templateData = JSON.parse(window.localStorage.getItem('preview'))
this.message({
type: 'setList',
list: this.templateData.listData
})
} }
}, },
components: { components: {
......
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 sign in to comment