Commit e80445bf by hank

h5 兼容小程序修改

parent 3941d1cb
...@@ -119,6 +119,14 @@ export function updateFilmInfo(filmId, filmData, filmName, filmDescribe) { ...@@ -119,6 +119,14 @@ export function updateFilmInfo(filmId, filmData, filmName, filmDescribe) {
filmDescribe filmDescribe
}) })
} }
export function updateBaseFilmInfo(filmId, filmName, filmDescribe) {
// 更新视片基本信息
return post('/template/update/film/base/info', {
filmId,
filmName,
filmDescribe
})
}
export function deleteFilm(filmId) { export function deleteFilm(filmId) {
// 删除视片 // 删除视片
return get(`/template/del/film/info/${filmId}`) return get(`/template/del/film/info/${filmId}`)
......
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
import { setToken } from '@/utils/auth' import { setToken, getToken } from '@/utils/auth'
// import Home from '@/views/Home.vue' // import Home from '@/views/Home.vue'
import Login from '@/views/login/index.vue' import Login from '@/views/login/index.vue'
import User from '@/views/user/index.vue' import User from '@/views/user/index.vue'
...@@ -103,7 +103,7 @@ router.beforeEach((from, to , next) => { ...@@ -103,7 +103,7 @@ router.beforeEach((from, to , next) => {
setToken(from.query.token) setToken(from.query.token)
} }
console.log('路由拦截', to.query, from.query) console.log('路由拦截', to.query, from.query)
if(window.localStorage.getItem('login') ) { if(window.localStorage.getItem('login') || getToken()) {
if(from.path === '/login' ) { if(from.path === '/login' ) {
// console.log('login from.path') // console.log('login from.path')
next({ path: '/' }) next({ path: '/' })
......
<template> <template>
<div class="edit-container"> <div class="edit-container">
<NavBar title="编辑视片" left-arrow> <NavBar title="编辑视片" v-if="!is_mini_token" left-arrow>
<div @click="pageShow">页面管理</div> <div @click="pageShow">页面管理</div>
</NavBar> </NavBar>
<div class="content"> <div class="content">
<div class="content-left"> <div class="content-left">
<div class="content-left-top"> <div class="content-left-top">
<!-- <div class="top-left"> <!-- <div class="top-right">
<div class="left-item" @click="preview">
<van-icon name="eye-o" />预览
</div>
<div class="left-item" @click="pub">
<svg-icon icon-class="guide" />发布
</div>
</div>-->
<div class="top-right">
<span class="im">*</span> <span class="im">*</span>
视片名称: 视片名称:
<input type="text" v-model="templateData.filmName" /> <input type="text" v-model="templateData.filmName" />
...@@ -24,7 +15,7 @@ ...@@ -24,7 +15,7 @@
视片描述: 视片描述:
<input type="text" v-model="templateData.filmDescribe" /> <input type="text" v-model="templateData.filmDescribe" />
</div> </div>
</div> </div> -->
</div> </div>
<iframe <iframe
class="iframe" class="iframe"
...@@ -33,6 +24,9 @@ ...@@ -33,6 +24,9 @@
@click.prevent @click.prevent
scrolling="no" scrolling="no"
style="height:70vw;" style="height:70vw;"
:style="
templateData.templateShow === 'VERTICAL' ? 'height:130vw;' : 'height:70vw;'
"
v-show="!isPreview" v-show="!isPreview"
@load="setList" @load="setList"
:src="templateData.frameUrl+'?isEdit=1&filmId='+templateData.filmId + '&now=' + date" :src="templateData.frameUrl+'?isEdit=1&filmId='+templateData.filmId + '&now=' + date"
...@@ -50,7 +44,7 @@ ...@@ -50,7 +44,7 @@
slot-scope="scope" slot-scope="scope"
@click="goPage(scope.index)" @click="goPage(scope.index)"
> >
<img :src="scope.slider.thumb" alt /> <img :src="scope.slider.thumb" alt />
<div class="page-name">{{scope.slider.name}}</div> <div class="page-name">{{scope.slider.name}}</div>
</div> </div>
</slider> </slider>
...@@ -64,53 +58,6 @@ ...@@ -64,53 +58,6 @@
<div class="content-right"> <div class="content-right">
<div class="title">编辑栏</div> <div class="title">编辑栏</div>
<div class="edit-area"> <div class="edit-area">
<div v-if="false">
<van-collapse v-model="activeName" accordion>
<van-collapse-item
v-for="(item, index) of templateData.listData[currentPage].itemList"
:key="index"
:title="item.name"
:name="index"
>
<div>
<img
v-if="item.type === 'image'"
class="image"
:src="templateData.listData[currentPage].schemaData[item.dataKey].value"
alt
/>
<input
v-if="item.type === 'text'"
class="edit-input"
type="text"
v-model="templateData.listData[currentPage].schemaData[item.dataKey].value"
@keyup="valueChange2()"
/>
<br />
<div class="list-container" v-if="item.type === 'list'">
{{item.itemList}}
<div
class="list-item"
v-for="(item2, index2) in templateData.listData[currentPage].schemaData[item.dataKey]"
:key="index2"
>
<div class="list-item-list" v-for="(item3, index3) in item2" :key="index3">
<input
v-if="index3 != 'index'"
class="edit-input"
type="text"
v-model="item2[index3]"
@keyup="valueChange2()"
/>
</div>
</div>
</div>
<button v-if="item.type === 'image'">上传</button>
<button v-if="item.type === 'video'">上传</button>
</div>
</van-collapse-item>
</van-collapse>
</div>
<div v-if="templateData.listData[currentPage]"> <div v-if="templateData.listData[currentPage]">
<editMenu <editMenu
v-if="loaded " v-if="loaded "
...@@ -226,6 +173,7 @@ export default { ...@@ -226,6 +173,7 @@ export default {
return { return {
activeName: "0", activeName: "0",
canvasImg: "", canvasImg: "",
is_mini_token: false,
templateData: { templateData: {
height: 450, height: 450,
width: 800, width: 800,
...@@ -234,6 +182,7 @@ export default { ...@@ -234,6 +182,7 @@ export default {
filmName: "", filmName: "",
filmDescribe: "", filmDescribe: "",
filmId: "", filmId: "",
templateShow: '',
frameUrl: "", frameUrl: "",
listData: [{}], listData: [{}],
defaultData: [], defaultData: [],
...@@ -269,6 +218,10 @@ export default { ...@@ -269,6 +218,10 @@ export default {
}, },
created() { created() {
let vm = this; let vm = this;
if(sessionStorage.getItem('is_mini_token')) {
this.is_mini_token = true
}
window.addEventListener( window.addEventListener(
"message", "message",
function(e) { function(e) {
...@@ -308,7 +261,9 @@ export default { ...@@ -308,7 +261,9 @@ export default {
next(); next();
} }
}, },
mounted() {}, mounted() {
document.title = '编辑视片'
},
methods: { methods: {
message(data) { message(data) {
window.frames[0].postMessage(data, "https://visual-clouds.bdideal.com"); window.frames[0].postMessage(data, "https://visual-clouds.bdideal.com");
...@@ -454,6 +409,7 @@ export default { ...@@ -454,6 +409,7 @@ export default {
this.templateData.resourceUrl = res.data.resourceUrl; this.templateData.resourceUrl = res.data.resourceUrl;
this.templateData.frameUrl = res.data.frameUrl; this.templateData.frameUrl = res.data.frameUrl;
this.templateData.filmDescribe = res.data.filmDescribe; this.templateData.filmDescribe = res.data.filmDescribe;
this.templateData.templateShow = res.data.templateShow;
this.templateData.listData = JSON.parse(res.data.filmData).pageList; this.templateData.listData = JSON.parse(res.data.filmData).pageList;
this.templateData.templateInfo = JSON.parse(res.data.filmData).templateInfo this.templateData.templateInfo = JSON.parse(res.data.filmData).templateInfo
// this.setList() // this.setList()
...@@ -613,10 +569,10 @@ export default { ...@@ -613,10 +569,10 @@ export default {
.menu-item { .menu-item {
position: relative; position: relative;
width: 80px; width: 80px;
height: 70px; min-height: 70px;
img { img {
border: 1px dashed #666; border: 1px dashed #666;
height: 45px; width: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
// line-height: 65px; // line-height: 65px;
...@@ -869,6 +825,7 @@ export default { ...@@ -869,6 +825,7 @@ export default {
left: 0; left: 0;
right: 0; right: 0;
display: flex; display: flex;
z-index: 100;
justify-content: space-between; justify-content: space-between;
background: white; background: white;
box-sizing: border-box; box-sizing: border-box;
......
<template> <template>
<div class="edit-container"> <div class="edit-container">
<NavBar title="视片详情" left-arrow></NavBar> <NavBar title="视片详情" v-if="!is_mini_token" left-arrow></NavBar>
<div class="content"> <div class="content">
<div class="thumbs"> <div class="thumbs">
<van-swipe> <van-swipe @change="onChange">
<van-swipe-item <van-swipe-item
class="thumb-item" class="thumb-item"
v-for="(thumbs, index) in templateData.templateUrl" v-for="(thumbs, index) in templateData.templateUrl"
...@@ -17,7 +17,11 @@ ...@@ -17,7 +17,11 @@
slot="indicator" slot="indicator"
>{{ current + 1 }}/{{templateData.templateUrl.length}}</div> >{{ current + 1 }}/{{templateData.templateUrl.length}}</div>
</van-swipe> </van-swipe>
<div class="temp-name pl15">{{templateData.filmName}}</div>
<div class="temp-name pl15">
{{templateData.filmName}}
<div class="temp-edit" @click="showEdit">编辑</div>
</div>
<div class="temp-des pl15"> <div class="temp-des pl15">
{{ {{
templateData.filmDescribe}} templateData.filmDescribe}}
...@@ -45,13 +49,28 @@ ...@@ -45,13 +49,28 @@
<van-button type="info" style="width:45%" @click="goEdit">修改视片</van-button> <van-button type="info" style="width:45%" @click="goEdit">修改视片</van-button>
<van-button type="info" @click="goDevices" style="width:45%">更新绑定设备</van-button> <van-button type="info" @click="goDevices" style="width:45%">更新绑定设备</van-button>
</div> </div>
<van-dialog :before-close="beforeClose" v-model="show" title="视片信息" show-cancel-button>
<div class="tips">*视片名称:</div>
<input placeholder="请输入视片名称" v-model="templateData.filmName" class="film-name" type="text" />
<br />
<div class="tips">视片描述:</div>
<input
placeholder="请输入视片描述"
v-model="templateData.filmDescribe"
class="film-name"
type="text"
/>
</van-dialog>
</div> </div>
</template> </template>
<script> <script>
import NavBar from "@/views/layout/navbar"; import NavBar from "@/views/layout/navbar";
import { getFilmDetail, getFilmDeviceList } from "@/api/api"; import {
getFilmDetail,
getFilmDeviceList,
updateBaseFilmInfo
} from "@/api/api";
export default { export default {
data() { data() {
...@@ -60,6 +79,7 @@ export default { ...@@ -60,6 +79,7 @@ export default {
current: 0, current: 0,
page: 1, page: 1,
list: [], list: [],
is_mini_token: false,
loading: false, loading: false,
finished: false, finished: false,
templateData: { templateData: {
...@@ -69,9 +89,9 @@ export default { ...@@ -69,9 +89,9 @@ export default {
frameId: "string", frameId: "string",
filmId: "", filmId: "",
templateUrl: "", templateUrl: "",
filmName: "企业文化2019第三季度展示", filmName: "",
templateName: "企业文化", templateName: "",
filmDescribe: "该模板可用于展示企业文化,包括企业简介,照片墙等", filmDescribe: "",
frameUrl: frameUrl:
"https://visual-clouds.bdideal.com/html/156050648981560a2f35feda34d66afe6765526670da2.html", "https://visual-clouds.bdideal.com/html/156050648981560a2f35feda34d66afe6765526670da2.html",
listData: [] listData: []
...@@ -79,6 +99,10 @@ export default { ...@@ -79,6 +99,10 @@ export default {
}; };
}, },
created() { created() {
if (this.$route.query.token) {
sessionStorage.setItem("is_mini_token", this.$route.query.token);
this.is_mini_token = true;
}
if (this.$route.query.filmId) { if (this.$route.query.filmId) {
this.mode = "film"; this.mode = "film";
this.getFilmDetail(); this.getFilmDetail();
...@@ -88,7 +112,9 @@ export default { ...@@ -88,7 +112,9 @@ export default {
this.getTempalteDetail(); this.getTempalteDetail();
} }
}, },
mounted() {}, mounted() {
document.title = "视片详情";
},
methods: { methods: {
getFilmList() { getFilmList() {
getFilmDeviceList(this.$route.query.filmId, this.page) getFilmDeviceList(this.$route.query.filmId, this.page)
...@@ -117,10 +143,43 @@ export default { ...@@ -117,10 +143,43 @@ export default {
this.templateData.listData = JSON.parse(res.data.filmData); this.templateData.listData = JSON.parse(res.data.filmData);
}); });
}, },
onChange(index) {
console.log(index);
this.current = index + 1;
},
onLoad() { onLoad() {
this.getFilmList(); this.getFilmList();
this.page++; this.page++;
}, },
showEdit() {
this.show = true;
},
beforeClose(action, done) {
console.log(action);
if (action === "confirm") {
if (!this.templateData.filmName) {
this.$toast("请输入视片名称");
done(false);
} else {
updateBaseFilmInfo(
this.$route.query.filmId,
this.templateData.filmName,
this.templateData.filmDescribe
).then(() => {
done();
this.$toast.success("更新成功");
this.show = false;
// updateFilmInfo(res.data.filmId, "数据").then(res => {
// console.log(res, "更新视片成功");
// this.$router.back();
// });
// this.$router.back();
});
}
} else {
done();
}
},
goDevices() { goDevices() {
this.$router.push({ this.$router.push({
path: "/tempaltes/filmdevice", path: "/tempaltes/filmdevice",
...@@ -146,7 +205,7 @@ export default { ...@@ -146,7 +205,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.edit-container { .edit-container {
padding-bottom: 50px; padding-bottom: 50px;
.bgeee { .bgeee {
width: 100%; width: 100%;
background: #eee; background: #eee;
...@@ -155,6 +214,7 @@ export default { ...@@ -155,6 +214,7 @@ export default {
// display: flex; // display: flex;
text-align: left; text-align: left;
justify-content: space-between; justify-content: space-between;
position: relative;
.thumbs { .thumbs {
padding-bottom: 10px; padding-bottom: 10px;
.pl15 { .pl15 {
...@@ -179,12 +239,20 @@ export default { ...@@ -179,12 +239,20 @@ export default {
.temp-name { .temp-name {
font-size: 18px; font-size: 18px;
color: #333333; color: #333333;
position: relative;
} }
.temp-des { .temp-des {
font-size: 14px; font-size: 14px;
color: #bbb; color: #bbb;
line-height: 28px; line-height: 28px;
} }
.temp-edit {
position: absolute;
font-size: 14px;
right: 20px;
top: 0;
color: #fe9110;
}
} }
.myfilms { .myfilms {
.title { .title {
...@@ -197,7 +265,7 @@ export default { ...@@ -197,7 +265,7 @@ export default {
// display: flex; // display: flex;
justify-content: space-between; justify-content: space-between;
padding: 20px; padding: 20px;
.device-item { .device-item {
background: white; background: white;
display: flex; display: flex;
......
<template> <template>
<div class="edit-container"> <div class="edit-container">
<NavBar title="视片设备列表" left-arrow></NavBar> <NavBar title="视片设备列表" v-if="!is_mini_token" left-arrow></NavBar>
<div class="content"> <div class="content">
<div class="myfilms"> <div class="myfilms">
<div class="title"> <div class="title">
...@@ -101,6 +101,7 @@ export default { ...@@ -101,6 +101,7 @@ export default {
current: 0, current: 0,
page: 1, page: 1,
isCheck: [], isCheck: [],
is_mini_token: false,
list: [], list: [],
deviceList: [], deviceList: [],
deviceChecked: [], deviceChecked: [],
...@@ -109,6 +110,9 @@ export default { ...@@ -109,6 +110,9 @@ export default {
}; };
}, },
created() { created() {
if(sessionStorage.getItem('is_mini_token')) {
this.is_mini_token = true;
}
this.getFilmAddDeviceList(); this.getFilmAddDeviceList();
}, },
computed: { computed: {
...@@ -123,7 +127,9 @@ export default { ...@@ -123,7 +127,9 @@ export default {
}); });
} }
}, },
mounted() {}, mounted() {
document.title = '视片设备列表'
},
methods: { methods: {
getFilmList() { getFilmList() {
getFilmDeviceList(this.$route.query.filmId, this.page) getFilmDeviceList(this.$route.query.filmId, this.page)
......
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