Commit 21458125 by hank

图片上传模板预览修改

parent babc733d
......@@ -72,3 +72,11 @@ export function deleteFilm(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) {
params
})
}
export function post (url, data) {
export function post (url, data, headers = {}) {
return apiRequest({
method: 'post',
url,
data
data,
headers
})
}
export function deleted (url, params) {
......
<template>
<van-nav-bar :title="title" :left-arrow="typeof leftArrow !== 'undefined' ? true : false"
@click-left="onClickLeft"
@click-left="myonClickLeft"
@click-right="onClickRight">
<div slot="right" >
<van-icon v-show="showNotice" @click="goNotice" name="chat-o" size="25" />
......@@ -11,7 +11,7 @@
<script>
export default {
props: ['left-arrow', 'title'],
props: ['left-arrow', 'title', 'onClickLeft'],
data() {
return {
left: false,
......@@ -33,8 +33,12 @@ export default {
}
},
methods:{
onClickLeft() {
myonClickLeft() {
if(this.onClickLeft) {
this.onClickLeft()
} else {
this.$router.back()
}
},
onClickRight() {
......
<template>
<div class="edit-container">
<NavBar title="预览" left-arrow></NavBar>
<NavBar title="预览" :onClickLeft="myonClickLeft" left-arrow></NavBar>
<div class="content">
<div class="content-left">
<iframe
@load="getData"
class="iframe"
v-show="loaded"
:src="templateData.frameUrl+'?isPreview=1'"
......@@ -16,7 +17,9 @@
<script>
import NavBar from "@/views/layout/navbar";
// import { setTimeout } from 'timers';
export default {
props: ['myonClickLeft'],
data() {
return {
templateData: {
......@@ -38,36 +41,37 @@ export default {
};
},
created() {
if (this.$route.query.filmId) {
this.mode = "film";
this.getFilmDetail();
}
if (this.$route.query.templateId) {
this.mode = "template";
this.getTempalteDetail();
}
this.getData()
// if (this.$route.query.filmId) {
// this.mode = "film";
// this.getFilmDetail();
// }
// if (this.$route.query.templateId) {
// this.mode = "template";
// this.getTempalteDetail();
// }
},
mounted() {
var vm = this
window.onload = function() {
window.frames[0].postMessage(
"getcolor",
"http://visual-clouds.bdideal.com"
);
vm.message({
type: 'setList',
list: vm.templateData.listData
})
};
// var vm = this
// vm.message({
// type: 'setList',
// list: vm.templateData.listData
// })
this.getData()
},
methods: {
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() {
this.loaded = true
this.templateData = JSON.parse(window.localStorage.getItem('preview'))
this.message({
type: 'setList',
list: this.templateData.listData
})
}
},
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