Commit adf3cf96 by hanjixin

Merge branch 'master' into 'test'

初步定版

![image](/uploads/a7bf119b7e012325f4ed27d711d4b5ad/image.png)

See merge request !1
parents 07f75bba 23fe7361
NODE_ENV='development' NODE_ENV='development'
VUE_APP_BASE_API='https://server.bdideal.com' VUE_APP_BASE_API='https://dev-server.bdideal.com'
\ No newline at end of file \ No newline at end of file
NODE_ENV='production' NODE_ENV='production'
VUE_APP_BASE_API='//127.0.0.1:8082' VUE_APP_BASE_API='https://server.bdideal.com'
\ No newline at end of file \ No newline at end of file
NODE_ENV='production' NODE_ENV='production'
VUE_APP_BASE_API='https://server.bdideal.com' VUE_APP_BASE_API='https://dev-server.bdideal.com'
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"start": "npm run serve", "start": "npm run serve",
"build": "vue-cli-service build --mode production", "build": "vue-cli-service build --mode production",
"build:test": "vue-cli-service build --mode test", "build:test": "vue-cli-service build --mode test",
"postbuild:test": "sh ./uploadTest.sh", "postbuild:test": "",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
"fixlint": "vue-cli-service lint --fix", "fixlint": "vue-cli-service lint --fix",
"test:unit": "vue-cli-service test:unit" "test:unit": "vue-cli-service test:unit"
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="stylesheet" href="https://unpkg.com/vue2-animate/dist/vue2-animate.min.css"/> <link rel="stylesheet" href="https://unpkg.com/vue2-animate/dist/vue2-animate.min.css"/>
<script type="text/javascript" src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script> <script type="text/javascript" src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<title>Vmatrix</title> <title>Vmatrix</title>
<script> <script>
window.jsbridge && window.jsbridge.init() window.jsbridge && window.jsbridge.init();
// console.log(jsbridge)
// arr[index-1] ? arr[index-1].img : '没有了'
</script> </script>
</head> </head>
<body> <body>
......
...@@ -131,6 +131,19 @@ export function deleteFilm(filmId) { ...@@ -131,6 +131,19 @@ export function deleteFilm(filmId) {
// 删除视片 // 删除视片
return get(`/template/del/film/info/${filmId}`) return get(`/template/del/film/info/${filmId}`)
} }
export function createdSchedule(data) {
// 创建任务
return post('/calendar/add/info', data)
}
export function updateSchedule(data) {
// 修改任务
return post('/calendar/update/info', data)
}
export function getScheduleDetail(id) {
return get(`/calendar/get/info/${id}`)
// 修改任务
}
export function getUserInfo() { export function getUserInfo() {
// 获取用户信息 // 获取用户信息
return get(`/user/get/info`) return get(`/user/get/info`)
......
...@@ -32,6 +32,7 @@ const router = new Router({ ...@@ -32,6 +32,7 @@ const router = new Router({
return { x: 0, y: 0 } return { x: 0, y: 0 }
} }
}, },
mode: 'history',
routes: [ routes: [
{ {
path: '', path: '',
......
...@@ -26,7 +26,12 @@ ...@@ -26,7 +26,12 @@
/> />
<div class="checkbox"> <div class="checkbox">
<label v-if="item.enableDisplay"> <label v-if="item.enableDisplay">
<input type="checkbox" style="display: inline;" v-model="schemaData[item.dataKey].visbility" @change="checkboxChange" />是否隐藏 <input
type="checkbox"
style="display: inline;"
v-model="schemaData[item.dataKey].visbility"
@change="checkboxChange"
/>是否隐藏
</label> </label>
</div> </div>
<input <input
...@@ -74,13 +79,16 @@ ...@@ -74,13 +79,16 @@
@click.native="uploadListItem(item.dataKey,index2, index3)" @click.native="uploadListItem(item.dataKey,index2, index3)"
:after-read="uploadAfter" :after-read="uploadAfter"
> >
<van-button icon="photo" type="info">上传图片</van-button> <van-button icon="photo" type="info">上传</van-button>
</van-uploader> </van-uploader>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="create-btn-container"> <div
class="create-btn-container"
v-if="!item.listLimit || (item.listLimit && schemaData[item.dataKey].length < !item.listLimit)"
>
<van-button class="create-btn" type="info" @click="addItem(item)">添加</van-button> <van-button class="create-btn" type="info" @click="addItem(item)">添加</van-button>
</div> </div>
</div> </div>
...@@ -91,17 +99,21 @@ ...@@ -91,17 +99,21 @@
@click.native="uploadItem(item.dataKey)" @click.native="uploadItem(item.dataKey)"
:after-read="uploadAfter" :after-read="uploadAfter"
> >
<van-button icon="photo" type="info">上传图片</van-button> <van-button icon="photo" type="info">上传</van-button>
<br />
</van-uploader> </van-uploader>
<van-button type="info" v-if="item.selectList && item.type !== 'list'" @click="setSelectData(item, index)">选择默认数据</van-button>
</div> </div>
</van-collapse-item> </van-collapse-item>
</van-collapse> </van-collapse>
<selectDataCom :selectList="selectData" @changeSelcetData="changeSelcetData" v-if="selectData.show"></selectDataCom>
</div> </div>
</template> </template>
<script> <script>
import { upload } from "@/api/api"; import { upload } from "@/api/api";
import { getHostUrl } from "@/utils/index"; import { getHostUrl } from "@/utils/index";
import selectDataCom from "./selectData";
export default { export default {
name: "editMenu", name: "editMenu",
props: { props: {
...@@ -118,6 +130,9 @@ export default { ...@@ -118,6 +130,9 @@ export default {
default: () => {} default: () => {}
} }
}, },
components: {
selectDataCom
},
created() { created() {
console.log(this.schemaData); console.log(this.schemaData);
}, },
...@@ -126,7 +141,10 @@ export default { ...@@ -126,7 +141,10 @@ export default {
activeName: "", activeName: "",
dataKey: "", dataKey: "",
listIndex: "", listIndex: "",
itemKey: "" itemKey: "",
selectData: {
show: false
}
}; };
}, },
methods: { methods: {
...@@ -145,7 +163,7 @@ export default { ...@@ -145,7 +163,7 @@ export default {
console.log(key, index, itemKey, "dsadadsa"); console.log(key, index, itemKey, "dsadadsa");
}, },
isSchemaIndex(item) { isSchemaIndex(item) {
console.log(item); // console.log(item);
return item["schemaIndex"] ? item["schemaIndex"] : 0; return item["schemaIndex"] ? item["schemaIndex"] : 0;
}, },
toObj(obj) { toObj(obj) {
...@@ -191,7 +209,7 @@ export default { ...@@ -191,7 +209,7 @@ export default {
}); });
}, },
checkboxChange(value) { checkboxChange(value) {
console.log( this.schemaData, value) console.log(this.schemaData, value);
}, },
setSchemaData(value) { setSchemaData(value) {
this.schemaData[this.dataKey].value = value; this.schemaData[this.dataKey].value = value;
...@@ -205,6 +223,26 @@ export default { ...@@ -205,6 +223,26 @@ export default {
deleteItem(index, arr) { deleteItem(index, arr) {
arr.splice(index, 1); arr.splice(index, 1);
this.$emit("setList", this.schemaData); this.$emit("setList", this.schemaData);
},
setSelectData(item, index) {
const myItem = JSON.parse(JSON.stringify(item))
this.selectData.show = true;
this.selectData.item = myItem;
this.selectData.index = index;
this.selectData.item.selectList = [
"http://pic27.nipic.com/20130313/9252150_092049419327_2.jpg",
"http://pic27.nipic.com/20130313/9252150_092049419327_2.jpg",
"http://pic27.nipic.com/20130313/9252150_092049419327_2.jpg",
"http://pic27.nipic.com/20130313/9252150_092049419327_2.jpg"
];
console.log(this.selectData)
},
changeSelcetData(data) {
console.log(data);
this.dataKey = data.item.dataKey
this.setSchemaData(data.val)
this.selectData.show = false
} }
} }
}; };
......
...@@ -15,7 +15,7 @@ ...@@ -15,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"
...@@ -44,7 +44,7 @@ ...@@ -44,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>
...@@ -164,7 +164,13 @@ ...@@ -164,7 +164,13 @@
import NavBar from "@/views/layout/navbar"; import NavBar from "@/views/layout/navbar";
import preview from "./preview"; import preview from "./preview";
import slider from "./slider"; import slider from "./slider";
import { getFilmDetail, updateFilmInfo, upload } from "@/api/api"; import {
getFilmDetail,
updateFilmInfo,
upload,
getTempalteDetail,
createFilm
} from "@/api/api";
import axios from "axios"; import axios from "axios";
import draggable from "vuedraggable"; import draggable from "vuedraggable";
import editMenu from "./editMenu"; import editMenu from "./editMenu";
...@@ -183,7 +189,7 @@ export default { ...@@ -183,7 +189,7 @@ export default {
filmName: "", filmName: "",
filmDescribe: "", filmDescribe: "",
filmId: "", filmId: "",
templateShow: '', templateShow: "",
frameUrl: "", frameUrl: "",
listData: [{}], listData: [{}],
defaultData: [], defaultData: [],
...@@ -214,14 +220,25 @@ export default { ...@@ -214,14 +220,25 @@ export default {
}, },
computed: { computed: {
poppupList() { poppupList() {
return (this.show || this.pageViews) || this.isPreview; return this.show || this.pageViews || this.isPreview;
} }
}, },
created() { created() {
window.onunload = function() {
window.wx.miniProgram.navigateBack({});
};
window.addEventListener("popstate", () => {
window.wx.miniProgram.navigateBack();
console.log("wx.miniProgram.navigateBack()");
});
let vm = this; let vm = this;
if(sessionStorage.getItem('is_mini_token')) { if (sessionStorage.getItem("is_mini_token")) {
this.is_mini_token = true this.is_mini_token = true;
}
if (this.$route.query.token) {
sessionStorage.setItem("is_mini_token", this.$route.query.token);
this.is_mini_token = true;
} }
window.addEventListener( window.addEventListener(
"message", "message",
...@@ -246,10 +263,10 @@ export default { ...@@ -246,10 +263,10 @@ export default {
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();
// } }
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
console.log(this.poppupList); console.log(this.poppupList);
...@@ -259,11 +276,11 @@ export default { ...@@ -259,11 +276,11 @@ export default {
this.show = false; this.show = false;
this.pageViews = false; this.pageViews = false;
} else { } else {
next(); next();
} }
}, },
mounted() { mounted() {
document.title = '编辑视片' document.title = "编辑视片";
}, },
methods: { methods: {
message(data) { message(data) {
...@@ -403,17 +420,63 @@ export default { ...@@ -403,17 +420,63 @@ export default {
}); });
}, },
getFilmDetail() { getFilmDetail() {
getFilmDetail(this.$route.query.filmId).then(res => { if (this.$route.query.filmId) {
console.log(res.data, "视片详情"); getFilmDetail(this.$route.query.filmId).then(res => {
this.templateData.filmId = res.data.filmId; console.log(res.data, "视片详情");
this.templateData.filmName = res.data.filmName; this.templateData.filmId = res.data.filmId;
this.templateData.filmName = res.data.filmName;
this.templateData.resourceUrl = res.data.resourceUrl;
this.templateData.frameUrl = res.data.frameUrl;
this.templateData.filmDescribe = res.data.filmDescribe;
this.templateData.templateShow = res.data.templateShow;
this.templateData.listData = JSON.parse(res.data.filmData).pageList;
this.templateData.templateInfo = JSON.parse(
res.data.filmData
).templateInfo;
// this.setList()
axios
.get(
res.data.resourceUrl.replace(
"visual-clouds.bdideal.com",
"visual-clouds.oss-cn-beijing.aliyuncs.com"
)
)
.then(res => {
// alert();
var pagesData = res.data.pageList;
this.templateData.defaultData = pagesData;
});
this.loaded = true;
setTimeout(() => {
document.querySelector(".iframe").addEventListener(
"touchmove",
function(e) {
e.preventDefault();
},
false
);
document.querySelector(".iframe").addEventListener(
"click",
function(e) {
e.preventDefault();
},
false
);
}, 300);
// console.log()
// this.setList()
});
}
},
getTempalteDetail() {
getTempalteDetail(this.$route.query.templateId).then(res => {
console.log(res.data, "模板详情");
this.templateData.filmId = "";
this.templateData.filmName = res.data.templateName;
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.templateDescribe;
this.templateData.templateShow = res.data.templateShow; this.templateData.templateShow = res.data.templateShow;
this.templateData.listData = JSON.parse(res.data.filmData).pageList;
this.templateData.templateInfo = JSON.parse(res.data.filmData).templateInfo
// this.setList()
axios axios
.get( .get(
res.data.resourceUrl.replace( res.data.resourceUrl.replace(
...@@ -423,28 +486,14 @@ export default { ...@@ -423,28 +486,14 @@ export default {
) )
.then(res => { .then(res => {
// alert(); // alert();
this.templateData.listData = res.data.pageList;
this.templateData.templateInfo = res.data.templateInfo;
// this.setList()
var pagesData = res.data.pageList; var pagesData = res.data.pageList;
this.templateData.defaultData = pagesData; this.templateData.defaultData = pagesData;
this.setList();
}); });
this.loaded = true; this.loaded = true;
setTimeout(() => {
document.querySelector(".iframe").addEventListener(
"touchmove",
function(e) {
e.preventDefault();
},
false
);
document.querySelector(".iframe").addEventListener(
"click",
function(e) {
e.preventDefault();
},
false
);
}, 300);
// console.log()
// this.setList()
}); });
}, },
publish() { publish() {
...@@ -452,23 +501,48 @@ export default { ...@@ -452,23 +501,48 @@ export default {
alert("数据为空"); alert("数据为空");
return; return;
} }
if (this.mode === "film") { if (this.mode === "film" || window.sessionStorage.getItem("filmId")) {
const filmId = this.$route.query.filmId || window.sessionStorage.getItem("filmId")
updateFilmInfo( updateFilmInfo(
this.$route.query.filmId, filmId,
JSON.stringify({ JSON.stringify({
templateInfo: this.templateData.templateInfo, templateInfo: this.templateData.templateInfo,
pageList: this.templateData.listData pageList: this.templateData.listData
}), }),
this.templateData.filmName, this.templateData.filmName,
this.templateData.filmDescribe this.templateData.filmDescribe
).then(res => { ).then(() => {
this.show = false; this.show = false;
this.$toast.success("更新成功"); this.$toast.success("更新成功");
console.log(res, "更新视片成功"); // window.sessionStorage.setItem("filmId");
this.$router.back(); this.navToWx(filmId)
// this.$router.back();
});
} else {
// "templateId": "string",
// "resourceId": "string",
// "frameId": "string",
// "filmData": "string",
// "filmName": "string"
createFilm({
templateId: this.$route.query.templateId,
filmData: JSON.stringify({
templateInfo: this.templateData.templateInfo,
pageList: this.templateData.listData
}),
filmName: this.templateData.filmName,
filmDescribe: this.templateData.filmDescribe
}).then(res => {
window.sessionStorage.setItem("filmId", res.data.data);
this.navToWx(res.data.data);
}); });
} }
}, },
navToWx(filmId) {
window.wx.miniProgram.navigateTo({
url: `/pages/home/film/schedule_add/components/device/index?fId=${filmId}`
});
},
enterSubmit() { enterSubmit() {
this.message({ this.message({
type: "getList" type: "getList"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
class="custom-indicator" class="custom-indicator"
slot="indicator" slot="indicator"
>{{ current + 1 }}/{{templateData.templateUrl.length}}</div> >{{ current + 1 }}/{{templateData.templateUrl.length}}</div>
</van-swipe> --> </van-swipe>-->
<iframe <iframe
class="iframe" class="iframe"
v-if="loaded" v-if="loaded"
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
:style=" :style="
templateData.templateShow === 'VERTICAL' ? 'height:160vw;' : 'height:70vw;' templateData.templateShow === 'VERTICAL' ? 'height:160vw;' : 'height:70vw;'
" "
:src="templateData.frameUrl+'?filmId='+templateData.filmId+ '&date=' + Date.now()" :src="templateData.frameUrl+'?filmId='+templateData.filmId"
frameborder="0" frameborder="0"
></iframe> ></iframe>
<div class="temp-name pl15"> <div class="temp-name pl15">
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
templateData.filmDescribe}} templateData.filmDescribe}}
</div> </div>
</div> </div>
<div class="bgeee"></div> <!-- <div class="bgeee"></div>
<div class="myfilms"> <div class="myfilms">
<div class="title">投放设备 ({{list.length}})</div> <div class="title">投放设备 ({{list.length}})</div>
<van-list v-model="loading" :finished="finished" finished-text @load="onLoad"> <van-list v-model="loading" :finished="finished" finished-text @load="onLoad">
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</div> </div>
</div> </div>
</van-list> </van-list>
</div> </div>-->
</div> </div>
<div class="createBtn"> <div class="createBtn">
<van-button type="info" style="width:45%" @click="goEdit">修改视片</van-button> <van-button type="info" style="width:45%" @click="goEdit">修改视片</van-button>
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
data() { data() {
return { return {
show: false, show: false,
title: '视片详情', title: "视片详情",
current: 0, current: 0,
page: 1, page: 1,
list: [], list: [],
...@@ -107,11 +107,15 @@ export default { ...@@ -107,11 +107,15 @@ export default {
filmDescribe: "", filmDescribe: "",
frameUrl: frameUrl:
"https://visual-clouds.bdideal.com/html/156050648981560a2f35feda34d66afe6765526670da2.html", "https://visual-clouds.bdideal.com/html/156050648981560a2f35feda34d66afe6765526670da2.html",
listData: [] listData: [],
calendarId: null
} }
}; };
}, },
created() { created() {
window.onunload = function() {
window.wx.miniProgram.navigateBack({});
};
if (this.$route.query.token) { if (this.$route.query.token) {
sessionStorage.setItem("is_mini_token", this.$route.query.token); sessionStorage.setItem("is_mini_token", this.$route.query.token);
this.is_mini_token = true; this.is_mini_token = true;
...@@ -127,6 +131,10 @@ export default { ...@@ -127,6 +131,10 @@ export default {
}, },
mounted() { mounted() {
document.title = "视片详情"; document.title = "视片详情";
window.addEventListener("popstate", () => {
window.wx.miniProgram.navigateBack();
console.log('wx.miniProgram.navigateBack()')
});
}, },
methods: { methods: {
getFilmList() { getFilmList() {
...@@ -153,13 +161,12 @@ export default { ...@@ -153,13 +161,12 @@ export default {
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.templateShow = res.data.templateShow;
this.templateData.calendarId = res.data.calendarId;
this.templateData.listData = JSON.parse(res.data.filmData); this.templateData.listData = JSON.parse(res.data.filmData);
this.loaded = true this.loaded = true;
}); });
}, },
setList() { setList() {},
},
onChange(index) { onChange(index) {
console.log(index); console.log(index);
this.current = index + 1; this.current = index + 1;
...@@ -198,11 +205,9 @@ export default { ...@@ -198,11 +205,9 @@ export default {
} }
}, },
goDevices() { goDevices() {
this.$router.push({ let _this = this;
path: "/tempaltes/filmdevice", window.wx.miniProgram.navigateTo({
query: { url: `/pages/home/film/schedule_add/components/device/index?cId=${_this.templateData.calendarId}&fId=${_this.templateData.filmId}`
filmId: this.$route.query.filmId
}
}); });
}, },
goEdit() { goEdit() {
......
...@@ -4,10 +4,45 @@ ...@@ -4,10 +4,45 @@
<div class="content"> <div class="content">
<div class="myfilms"> <div class="myfilms">
<div class="title"> <div class="title">
已绑定设备 ({{list.length}}) 设备列表
<van-button type="info" @click="show=true">添加设备</van-button> <!-- 已绑定设备 ({{list.length}})
<van-button type="info" @click="show=true">添加设备</van-button> -->
</div> </div>
<van-list v-model="loading" :finished="finished" finished-text @load="onLoad"> <!-- <div class>设备列表</div> -->
<div class="device-list" >
<van-checkbox-group v-model="deviceChecked">
<div
class="device-item"
v-for="(item, index) in dataList"
:key="item.equipmentId"
@click="toggle(index, item)"
>
<div class="left" v-if="item.isUse">已使用</div>
<div class="left" v-else>
<van-checkbox :name="item.equipmentId" ref="checkboxes"></van-checkbox>
</div>
<div class="icon">
<img :src="item.equipmentUrl" alt />
</div>
<div class="right">
<div class="device-name">{{item.equipmentName}}</div>
<div class="device-online">{{item.equipmentState === 'ONLINE' ? '在线' : '离线'}}</div>
</div>
</div>
<!-- <div>{{deviceChecked}}</div> -->
</van-checkbox-group>
</div>
<div class="dialog-bottom">
<div class="left">
<input type="checkbox" @change="checkAll" v-model="isCheck" />
<span>全选,共选择{{deviceChecked.length}}</span>
</div>
<div class="right">
<van-button type="info" @click="enter">确定</van-button>
</div>
</div>
<!-- <van-list v-model="loading" :finished="finished" finished-text @load="onLoad">
<div class="device-list"> <div class="device-list">
<div v-for="item in list" :key="item.equipmentId"> <div v-for="item in list" :key="item.equipmentId">
<van-swipe-cell> <van-swipe-cell>
...@@ -32,7 +67,7 @@ ...@@ -32,7 +67,7 @@
</van-swipe-cell> </van-swipe-cell>
</div> </div>
</div> </div>
</van-list> </van-list> -->
</div> </div>
<van-dialog <van-dialog
:before-close="beforeClose" :before-close="beforeClose"
...@@ -42,44 +77,13 @@ ...@@ -42,44 +77,13 @@
lockScroll lockScroll
style="width:100%;height:100vh;overflow:auto;" style="width:100%;height:100vh;overflow:auto;"
v-model="show" v-model="show"
> >
<van-nav-bar title="设备管理"> <van-nav-bar title="设备管理">
<div slot="right"> <span @click="show=false">关闭</span></div> <div slot="right">
</van-nav-bar> <span @click="show=false">关闭</span>
<div class>设备列表</div>
<div class="device-list" v-if="show">
<van-checkbox-group v-model="deviceChecked">
<div
class="device-item"
v-for="(item, index) in dataList"
:key="item.equipmentId"
@click="toggle(index)"
>
<div class="left" v-if="item.isUse">已使用</div>
<div class="left" v-else>
<van-checkbox :name="item.equipmentId" ref="checkboxes"></van-checkbox>
</div>
<div class="icon">
<img :src="item.equipmentUrl" alt />
</div>
<div class="right">
<div class="device-name">{{item.equipmentName}}</div>
<div class="device-online">{{item.equipmentState === 'ONLINE' ? '在线' : '离线'}}</div>
</div>
</div>
<!-- <div>{{deviceChecked}}</div> -->
</van-checkbox-group>
</div>
<div class="dialog-bottom">
<div class="left">
<input type="checkbox" @change="checkAll" v-model="isCheck" />
<span>全选,共选择{{deviceChecked.length}}台</span>
</div>
<div class="right">
<van-button type="info" @click="enter">确定</van-button>
</div> </div>
</div> </van-nav-bar>
</van-dialog> </van-dialog>
</div> </div>
</div> </div>
...@@ -88,10 +92,11 @@ ...@@ -88,10 +92,11 @@
<script> <script>
import NavBar from "@/views/layout/navbar"; import NavBar from "@/views/layout/navbar";
import { import {
getFilmDeviceList,
getFilmAddDeviceList, getFilmAddDeviceList,
bindDeviceToFilm, bindDeviceToFilm,
createdSchedule,
getScheduleDetail,
updateSchedule
} from "@/api/api"; } from "@/api/api";
export default { export default {
...@@ -110,9 +115,11 @@ export default { ...@@ -110,9 +115,11 @@ export default {
}; };
}, },
created() { created() {
if(sessionStorage.getItem('is_mini_token')) { if (sessionStorage.getItem("is_mini_token")) {
this.is_mini_token = true; this.is_mini_token = true;
} }
this.calendarId = this.$route.query.calendarId;
this.calendarId && this.getScheduleDetail()
this.getFilmAddDeviceList(); this.getFilmAddDeviceList();
}, },
computed: { computed: {
...@@ -128,23 +135,16 @@ export default { ...@@ -128,23 +135,16 @@ export default {
} }
}, },
mounted() { mounted() {
document.title = '视片设备列表' document.title = "视片设备列表";
}, },
methods: { methods: {
getFilmList() { getScheduleDetail() {
getFilmDeviceList(this.$route.query.filmId, this.page) getScheduleDetail(this.calendarId).then(res => {
.then(res => { const arr = res.data.equipmentInfos.map(item => {
console.log(res.data, "device list"); return item.equipmentId
this.list = this.list.concat(res.data.list);
if (res.data.list.length < 10) {
this.finished = true;
this.loading = false;
}
}) })
.catch(() => { this.deviceChecked = arr
this.finished = true; })
this.loading = false;
});
}, },
getFilmAddDeviceList() { getFilmAddDeviceList() {
getFilmAddDeviceList().then(res => { getFilmAddDeviceList().then(res => {
...@@ -167,13 +167,12 @@ export default { ...@@ -167,13 +167,12 @@ export default {
.then(() => { .then(() => {
bindDeviceToFilm([item.equipmentId]).then(() => { bindDeviceToFilm([item.equipmentId]).then(() => {
this.$toast.success("解绑成功"); this.$toast.success("解绑成功");
this.page = 0 this.page = 0;
this.finished = false this.finished = false;
this.list = [] this.list = [];
this.getFilmAddDeviceList() this.getFilmAddDeviceList();
}); });
}); });
}, },
checkAll() { checkAll() {
console.log("checkAll"); console.log("checkAll");
...@@ -192,8 +191,11 @@ export default { ...@@ -192,8 +191,11 @@ export default {
console.log(this.deviceChecked); console.log(this.deviceChecked);
} }
}, },
toggle(index) { toggle(index, item) {
console.log(index, this.deviceChecked, this.$refs.checkboxes) if(item.calendarId) {
this.$toast.success("设备已存在播放任务,此操作覆盖前任务?");
}
console.log(index, this.deviceChecked, this.$refs.checkboxes);
this.$refs.checkboxes[index].toggle(); this.$refs.checkboxes[index].toggle();
}, },
onLoad() { onLoad() {
...@@ -201,19 +203,51 @@ export default { ...@@ -201,19 +203,51 @@ export default {
this.page++; this.page++;
}, },
enter() { enter() {
let equipmentTopicList = [];
let equipmentsIds = [];
this.dataList.map(item => {
equipmentsIds.push(item.equipmentId);
equipmentTopicList.push(item.mqttTopic);
});
if (this.deviceChecked.length) { if (this.deviceChecked.length) {
bindDeviceToFilm(this.deviceChecked, this.$route.query.filmId).then( let obj = {
() => { calendarName: "DEFAULstring",
filmInfos: [
{
filmId: this.$route.query.filmId,
time: "00:00"
}
],
equipmentsIds: equipmentsIds,
equipmentTopicList: equipmentTopicList,
calendarType: this.calendarId ? 'CUSTOME' : "DEFAUL"
};
if (!this.calendarId) {
createdSchedule(obj).then(() => {
this.$toast.success("绑定成功"); this.$toast.success("绑定成功");
this.show = false; this.$router.back();
this.page = 0; });
this.list = []; } else {
this.finished = false; obj.calendarId = this.calendarId;
this.deviceChecked = [] updateSchedule(obj).then(() => {
this.isCheck = [] this.$toast.success("绑定成功");
} this.$router.back();
); });
}
// bindDeviceToFilm(this.deviceChecked, this.$route.query.filmId).then(
// () => {
// this.$toast.success("绑定成功");
// this.show = false;
// this.page = 0;
// this.list = [];
// this.finished = false;
// this.deviceChecked = [];
// this.isCheck = [];
// }
// );
} else { } else {
this.$toast.success("请选择设备");
this.show = false; this.show = false;
} }
} }
......
<template>
<div v-if="selectList.item && selectList.show">
<van-popup
v-model="selectList.show"
position="bottom"
:style="{ height: '300px' }"
v-if="selectList.item"
>
<div class="select-container" v-if="selectList.item.type === 'image'">
<img
class="selectImage"
v-for="(image, index) in selectList.item.selectList"
:key="index"
:src="image"
alt
@click="ItemClick(image)"
/>
</div>
<div class="select-container" v-if="selectList.item.type === 'video'">
<video
class="selectVideo"
v-for="(image, index) in selectList.item.selectList"
:key="index"
:src="image"
alt
@click="ItemClick(image)"
></video>
</div>
<div class="select-container" v-if="selectList.item.type === 'text'">
<div
class="selectText"
v-for="(image, index) in selectList.item.selectList"
:key="index"
:src="image"
@click="ItemClick(image)"
>{{image}}</div>
</div>
</van-popup>
</div>
</template>
<script>
export default {
data() {
return {
show: false
};
},
created() {
// console.log(this.selectList);
},
methods: {
ItemClick(val) {
this.$emit('changeSelcetData', {
val,
index: this.selectList.index,
item: this.selectList.item
} )
}
},
props: ["selectList"],
watch: {
selectList: function(val) {
console.log(val);
}
}
};
</script>
<style lang="scss" scoped>
.select-container {
// overflow: hidden;
height: 100%;
overflow-y: auto;
box-sizing: border-box;
width: 100%;
padding: 20px;
// display: flex;
.selectImage {
display: inline-block;
// height: calc(100% - 20px);
width: 100%;
margin-bottom: 30px;
}
.selectVideo {
display: inline-block;
// height: calc(100% - 20px);
width: 100%;
margin-bottom: 30px;
}
.selectText {
display: block;
word-break: break-all;
// height: calc(100% - 20px);
width: 100%;
margin-bottom: 30px;
}
}
</style>
\ No newline at end of file
scp -r ./dist/* root@39.97.179.60:/data/html
# MaxRocky5721
\ No newline at end of file
scp -r ./dist/* root@39.105.231.218:/data/html scp -r ./dist/* root@39.96.26.20:/data/html
# MaxRocky5721 # MaxRocky5721
\ No newline at end of file
...@@ -8,7 +8,7 @@ function resolve(dir) { ...@@ -8,7 +8,7 @@ function resolve(dir) {
} }
module.exports = { module.exports = {
publicPath: './', publicPath: '/',
// 生产环境是否生成 sourceMap 文件 // 生产环境是否生成 sourceMap 文件
productionSourceMap: false, productionSourceMap: false,
//是否为 Babel 或 TypeScript 使用 thread-loader。该选项在系统的 CPU 有多于一个内核时自动启用,仅作用于生产构建。 //是否为 Babel 或 TypeScript 使用 thread-loader。该选项在系统的 CPU 有多于一个内核时自动启用,仅作用于生产构建。
......
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