Commit a4c93918 by hank

修改编辑项的注释

parent 304210bb
...@@ -27,12 +27,14 @@ ...@@ -27,12 +27,14 @@
<div> <div>
<div <div
class="input-title" class="input-title"
v-if="item.type === 'text' || item.type === 'textarea'" v-if="item.type === 'text' || item.type === 'textarea' || item.type === 'number'"
>{{item.description}}</div> >{{item.description}}</div>
<input <input
v-if="item.type === 'text'" v-if="item.type === 'text'"
class="edit-input" class="edit-input"
type="text" type="text"
:maxlength="item.maxlength ? parseInt(item.maxlength) : ''"
:minlength="item.minlength ? parseInt(item.maxlength) : ''"
@blur="onBlur" @blur="onBlur"
@change="valueChange2()" @change="valueChange2()"
:placeholder="item.description" :placeholder="item.description"
......
...@@ -385,19 +385,19 @@ export default { ...@@ -385,19 +385,19 @@ export default {
this.itemListIndex = 0; this.itemListIndex = 0;
} }
}, },
activated() { activated() { // keepalive 下显示触发
document.title = "编辑作品"; document.title = "编辑作品";
window.addEventListener("popstate", listenRouterBack, false); window.addEventListener("popstate", listenRouterBack, false);
// this.currentPage = JSON.parse(JSON.stringify(this.currentPage)) // this.currentPage = JSON.parse(JSON.stringify(this.currentPage))
this.goPage(0) this.goPage(0)
}, },
deactivated() { deactivated() { // keepalive 隐藏显示触发
window.removeEventListener("popstate", listenRouterBack, false); window.removeEventListener("popstate", listenRouterBack, false);
}, },
destroyed() { destroyed() { // 页面销毁触发
window.removeEventListener("popstate", listenRouterBack, false); window.removeEventListener("popstate", listenRouterBack, false);
}, },
created() { created() { // 当前实例创建完成触发
let ua = window.navigator.userAgent; let ua = window.navigator.userAgent;
//$alert('浏览器版本: ' + app + '\n' + '用户代理: ' + ua); //$alert('浏览器版本: ' + app + '\n' + '用户代理: ' + ua);
if (ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) { if (ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
...@@ -426,7 +426,8 @@ export default { ...@@ -426,7 +426,8 @@ export default {
window.addEventListener( window.addEventListener(
"message", "message",
function(e) { function(e) {
console.log(e.data, "模板页面发来的消息"); // console.log(e.data, "模板页面发来的消息"); // 监听
if (typeof e.data === "object" && e.data["type"] == "edit") { if (typeof e.data === "object" && e.data["type"] == "edit") {
vm.editIndex = e.data.index; vm.editIndex = e.data.index;
vm.editObj = e.data.item; vm.editObj = e.data.item;
...@@ -475,7 +476,7 @@ export default { ...@@ -475,7 +476,7 @@ export default {
// }, 1000); // }, 1000);
}, },
methods: { methods: {
listenRouterBack() { listenRouterBack() { // 监听路由变化防止点击两次返回
window.wx.miniProgram.navigateBack(); window.wx.miniProgram.navigateBack();
}, },
message(data) { message(data) {
...@@ -487,10 +488,10 @@ export default { ...@@ -487,10 +488,10 @@ export default {
// window.frames[1].postMessage(data, "https://visual-clouds.bdideal.com"); // window.frames[1].postMessage(data, "https://visual-clouds.bdideal.com");
// document.querySelector('.iframe').postMessage(data, "https://visual-clouds.bdideal.com") // document.querySelector('.iframe').postMessage(data, "https://visual-clouds.bdideal.com")
}, },
setItemListIndex(index) { setItemListIndex(index) { // 设置编辑项数据激活index
this.itemListIndex = index; this.itemListIndex = index;
}, },
onSheetSelect(item) { onSheetSelect(item) { // 当actionSheet 被点击时候
this.showSheet = false; this.showSheet = false;
if (item.action === "createPage") { if (item.action === "createPage") {
this.createPage(this.currentPage); this.createPage(this.currentPage);
...@@ -500,37 +501,37 @@ export default { ...@@ -500,37 +501,37 @@ export default {
this.pageShow(); this.pageShow();
} }
}, },
dragChange(value) { dragChange() {
console.log("dragChange", value); // 放页面拖拽发生时执行
this.message({ this.message({
type: "setList", type: "setList",
pages: this.templateData.listData pages: this.templateData.listData
}); });
}, },
setList() { setList() {
// 给iframe 设置数据
this.message({ this.message({
type: "setList", type: "setList",
pages: this.templateData.listData pages: this.templateData.listData
}); });
}, },
NextSlider() { NextSlider() { // 切换到下一个页面
if (this.currentPage < this.templateData.listData.length - 1) { if (this.currentPage < this.templateData.listData.length - 1) {
++this.currentPage; ++this.currentPage;
this.goPage(this.currentPage); this.goPage(this.currentPage);
} }
}, },
PreSlider() { PreSlider() { // 切换到上一个页面
if (this.currentPage >= 1) { if (this.currentPage >= 1) {
--this.currentPage; --this.currentPage;
this.goPage(this.currentPage); this.goPage(this.currentPage);
} }
}, },
setClipImg(show) { setClipImg(show) { // 当裁剪时触发 暂未使用
this.clipImg = show; this.clipImg = show;
}, },
goPage(index) { goPage(index) { // 设置页面切换
this.currentPage = index; this.currentPage = index;
console.log(index);
this.editIndex = ""; this.editIndex = "";
this.editObj = {}; this.editObj = {};
this.message({ this.message({
...@@ -544,7 +545,7 @@ export default { ...@@ -544,7 +545,7 @@ export default {
}); });
this.pageViews = true; this.pageViews = true;
}, },
createPage(index) { createPage(index) { // 新增页面
this.templateData.listData.splice( this.templateData.listData.splice(
index, index,
0, 0,
...@@ -557,7 +558,7 @@ export default { ...@@ -557,7 +558,7 @@ export default {
this.$toast.success("创建成功"); this.$toast.success("创建成功");
this.pageViews = false; this.pageViews = false;
}, },
deletePage(index) { deletePage(index) { // 删除页面
if (this.templateData.listData.length < 2) { if (this.templateData.listData.length < 2) {
this.$toast.fail("至少存留一页"); this.$toast.fail("至少存留一页");
return false; return false;
...@@ -581,7 +582,7 @@ export default { ...@@ -581,7 +582,7 @@ export default {
} }
}, 1000); }, 1000);
}, },
valueChange() { valueChange() { // 当value 变化的时候
this.message({ this.message({
type: "setData", type: "setData",
index: this.editIndex, index: this.editIndex,
...@@ -645,7 +646,7 @@ export default { ...@@ -645,7 +646,7 @@ export default {
// (item = Object.assign(item, item.default)); // (item = Object.assign(item, item.default));
}); });
}, },
getFilmDetail() { getFilmDetail() { // 获取影片详情数据
if (this.$route.query.filmId) { if (this.$route.query.filmId) {
getFilmDetail(this.$route.query.filmId).then(res => { getFilmDetail(this.$route.query.filmId).then(res => {
console.log(res.data, "作品详情"); console.log(res.data, "作品详情");
...@@ -689,7 +690,7 @@ export default { ...@@ -689,7 +690,7 @@ export default {
}); });
} }
}, },
getTempalteDetail() { getTempalteDetail() { // 获取模板详情
getTempalteDetail(this.$route.query.templateId).then(res => { getTempalteDetail(this.$route.query.templateId).then(res => {
console.log(res.data, "模板详情"); console.log(res.data, "模板详情");
this.templateData.filmId = ""; this.templateData.filmId = "";
...@@ -726,7 +727,7 @@ export default { ...@@ -726,7 +727,7 @@ export default {
} }
}); });
}, },
publish() { publish() { // 发布作品或更新作品
if (!this.templateData.listData.length) { if (!this.templateData.listData.length) {
alert("数据为空"); alert("数据为空");
return; return;
...@@ -754,11 +755,6 @@ export default { ...@@ -754,11 +755,6 @@ export default {
this.$toast.clear(); this.$toast.clear();
}); });
} else { } else {
// "templateId": "string",
// "resourceId": "string",
// "frameId": "string",
// "filmData": "string",
// "filmName": "string"
createFilm({ createFilm({
templateId: this.$route.query.templateId, templateId: this.$route.query.templateId,
filmData: JSON.stringify({ filmData: JSON.stringify({
...@@ -769,7 +765,7 @@ export default { ...@@ -769,7 +765,7 @@ export default {
filmDescribe: this.templateData.filmDescribe filmDescribe: this.templateData.filmDescribe
}) })
.then(res => { .then(res => {
window.sessionStorage.setItem("filmId", res.data.data); window.sessionStorage.setItem("filmId", res.data.data); // 设置id 防止回退的时候再次点击发布执行创建接口
this.templateData.filmId = res.data.data; this.templateData.filmId = res.data.data;
this.navToWx(res.data.data); this.navToWx(res.data.data);
}) })
...@@ -778,7 +774,7 @@ export default { ...@@ -778,7 +774,7 @@ export default {
}); });
} }
}, },
navToWx(fId) { navToWx(fId) { // 跳转到微信小程序选择设备页面
const filmId = const filmId =
this.$route.query.filmId || this.$route.query.filmId ||
window.sessionStorage.getItem("filmId") || window.sessionStorage.getItem("filmId") ||
......
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