123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
- <title>点检巡店</title>
- <script src="js/vue@2.6.11"></script>
- <script src="js/uni.webview.1.5.2.js"></script>
-
- <script type="text/javascript" charset="utf-8" src="js/moment.min.js"></script>
- <script type="text/javascript" charset="utf-8" src="js/moment-with-locales.min.js"></script>
- <link rel="stylesheet" href="antd/antd.min.css" />
- <script type="text/javascript" charset="utf-8" src="antd/antd.min.js"></script>
-
- <script type="text/javascript" charset="utf-8" src="imgEdit/ped.min.js"></script>
-
- <link rel="stylesheet" href="aliplayer/aliplayer-min.css" />
- <script type="text/javascript" charset="utf-8" src="aliplayer/aliplayer-h5-min.js"></script>
-
- <link rel="stylesheet" href="css/styles.css" />
- </head>
- <body>
- <div class="storeCheck" id="app">
-
- <div class="videoPlay" v-if="xdType=='video'">
-
- <div class="control-yt" v-show="showYt&&!showYtbtns" @click="openYt"></div>
- <div class="control-yt-close" v-show="showYtbtns" @click="openYt"></div>
- <div v-show="showYtbtns" @click="kzYt(1)" class="ytBtns yt-left"></div>
- <div v-show="showYtbtns" @click="kzYt(2)" class="ytBtns yt-right"></div>
- <div v-show="showYtbtns" @click="kzYt(3)" class="ytBtns yt-top"></div>
- <div v-show="showYtbtns" @click="kzYt(4)" class="ytBtns yt-bottom"></div>
-
- <div class="prism-player" id="player-con"></div>
- </div>
-
- <div class="checkWork">
-
- <div class="checkWork-head">
- <div class="checkWork-head-row" v-if="xdType=='video'">
-
- <div>
- <div>机位:</div>
- <div></div>
- <div>
- <a-dropdown>
- <a-menu selectable slot="overlay" @click="onVideoListClick">
- <a-menu-item v-for="item in videoList" :key="item.gbId"> {{item.name}} </a-menu-item>
- </a-menu>
- <a class="ant-dropdown-link" @click="e => e.preventDefault()">
- {{curVideo&&curVideo.name}}
- <a-icon type="down" />
- </a>
- </a-dropdown>
- </div>
- </div>
-
-
- </div>
- </div>
-
- <div class="checkWork-body">
- <div style="width: 100%;" class="checkWork-body-tabCons">
- <div class="tabCons-items" v-for="(zb,zbIndex) in zbItem" :key="zb.id">
- <div>
- <div><b>{{zb.assessTargetName}}</b></div>
-
- <div @click="openCamera(zbIndex)">
- <a-icon type="camera" style="font-size: 30px;" />
- </div>
- </div>
-
- <div class="photos">
- <div v-for="(photo,pindex) in zb.taskTargetPhotoList" :key="photo.id">
- <a-avatar :size="40" shape="square" :src="photo.photoPath" />
- </div>
- </div>
-
- <div class="remarks">
- 评论:{{zb.comments}}
- </div>
-
- <div>
- <div>
-
- </div>
- <div>
-
- <a-icon @click="selZbResult(0,zb,zbIndex)" type="minus-circle" :class="zb.result=='NOT_WORK'?'choose-bsy':''" />
- </div>
- <div>
-
- <a-icon @click="selZbResult(1,zb,zbIndex)" type="close-circle" :class="zb.result=='NOT_PASS'?'choose-bhg':''" />
- </div>
- <div>
-
- <a-icon @click="selZbResult(2,zb,zbIndex)" type="check-circle" :class="zb.result=='PASS'?'choose-hg':''" />
- </div>
- </div>
- </div>
- <div v-if="!zbItem" style="text-align: center;padding-top: 50px;">
- 暂无数据
- </div>
- </div>
- </div>
-
- <div class="checkWork-button">
- <div v-if="xdType=='video'" @click="submitTask">提交</div>
- </div>
- </div>
-
- <a-drawer title="快拍" placement="bottom" :closable="true" :visible="showPz" @close="onClosePz" :height="360">
- <div class="pzPopus">
-
- <div class="pz-pinglun">
- <div class="remarks">
- <a-textarea placeholder="请填写备注内容(选填)" v-model="curZbItem.comments" :rows="4" />
- </div>
- <div class="icons" @click="takePhotos(2)">
- <a-icon class="aicon" type="camera" />
- </div>
- </div>
-
- <div class="imglist">
- <div v-for="(photo,pindex) in curZbItem.taskTargetPhotoList" :key="pindex">
- <img @click="editImgs(photo.photoPath,activeZbIndex,pindex)" :src="photo.photoPath">
- <a-icon @click.stop="delImgs(pindex)" class="aicon" type="close" />
- </div>
- </div>
-
- <div class="f-btns" v-if="allPf.length==zbItem.length">
- <a-button size="large" @click="saveZbPlImgs" type="primary" block> 提交 </a-button>
- </div>
- </div>
- </a-drawer>
-
- <div v-if="showLoading" class="loading">
- <a-spin />
- </div>
- </div>
- <script>
-
- var vm = new Vue({
- el: '#app',
- data: {
- xdType: 'video',
- player: null,
- videoPlayerStatus: '',
- videoList: [],
- curVideo: null,
- showYt: false,
- showYtbtns: false,
- showPz: false,
- showLoading: true,
- isEditImg: false,
- PED: null,
- activeZbIndex: 0,
- activeZbPhoto: 0,
- curZbItem: {
- comments: '',
- taskTargetPhotoList: []
- },
- zbItem: [],
- },
- mounted() {
- let _this = this
- moment.locale('zh-cn');
- },
- computed: {
-
- finishPc() {
- let allPf = []
- this.zbItem.map(item=>{
- if(item.result&&item.result!=''){
- allPf.push(true)
- }
- })
- return allPf
- }
- },
- methods: {
-
- resetPage() {
- this.activeZbIndex = 0
- this.activeZbPhoto = 0
- this.curZbItem = {
- comments: '',
- taskTargetPhotoList: []
- }
- this.showPz = false
- },
-
- setTyps(type, storeName) {
- console.log(type)
- this.xdType = type
-
- document.title = storeName
- },
-
- setVideoList(data) {
- this.videoList = JSON.parse(data)
- this.curVideo = this.videoList[0]
- this.getVideoUrl()
- },
-
- getTaskDetail(data) {
- this.zbItem = JSON.parse(data)
- this.showLoading = false
- },
-
- onVideoListClick({
- key
- }) {
- this.videoPlayerStatus = ''
- let v = this.videoList.find(item => item.gbId == key)
- if (v) {
- this.curVideo = v
- this.getVideoUrl()
- }
- },
-
- getVideoUrl() {
- this.sendMsg('getVideoUrl', JSON.stringify(this.curVideo))
- },
-
- getVideoUrlSuccess(url) {
-
- this.showYt = false
- this.showYtbtns = false
- if (this.player) {
- this.player.dispose()
- }
- this.videoInit(url)
- },
-
- videoInit(videoSrc) {
- const _this = this
-
- _this.player = new Aliplayer({
- 'id': 'player-con',
- 'source': videoSrc,
- 'width': '100%',
- 'height': '240px',
- 'autoplay': false,
- 'isLive': true,
- 'rePlay': true,
- 'playsinline': true,
- 'preload': true,
- 'language': 'zh-cn',
- 'useH5Prism': true,
- 'extraInfo': {
- 'crossOrigin': 'anonymous'
- },
- 'skinLayout': [{
- 'name': 'bigPlayButton',
- 'align': 'cc'
- },
- {
- 'name': 'errorDisplay',
- 'align': 'tlabs',
- 'x': 0,
- 'y': 0
- },
- {
- 'name': 'infoDisplay'
- },
- {
- 'name': 'controlBar',
- 'align': 'blabs',
- 'x': 0,
- 'y': 0,
- 'children': [{
- 'name': 'fullScreenButton',
- 'align': 'tr',
- 'x': 15,
- 'y': 10
- },
- {
- 'name': 'volume',
- 'align': 'tr',
- 'x': 15,
- 'y': 8
- },
- {
- 'name': 'liveDisplay',
- 'align': 'tl',
- 'x': 15,
- 'y': 2
- }
- ]
- }
- ]
- }, function(player) {
- _this.sendMsg('message', 'The player is created')
- })
-
- _this.player.on('playing', function() {
-
- _this.videoPlayerStatus = 'playing'
- })
- _this.player.on('error', function(e) {
- console.log(JSON.stringify(e), 'error')
- })
- },
-
- sendMsg(action, msg) {
- uni.postMessage({
- data: {
- action: action,
- msg: msg
- }
- })
- },
-
- openYt() {
- this.showYtbtns = !this.showYtbtns
- },
-
- kzYt(index) {
- const cmd = ['left', 'right', 'up', 'down']
- this.sendMsg('kzyt', '控制云台' + cmd[index - 1])
- },
-
- openCamera(index) {
-
- this.showPz = true
- this.activeZbIndex = index
- this.sendMsg('getWinStatus', JSON.stringify({
- key: 'showPz',
- val: true
- }))
-
- let obj = this.zbItem[this.activeZbIndex]
- this.curZbItem = Object.assign({
- comments: '',
- taskTargetPhotoList: []
- }, JSON.parse(JSON.stringify(obj)))
-
- this.takePhotos(1)
- },
-
- takePhotos(type) {
- if (!this.curZbItem.taskTargetPhotoList || this.curZbItem.taskTargetPhotoList.length < 6) {
- let pd = JSON.stringify({
- streamId: this.curVideo && this.curVideo.streamId,
- videoPlayerStatus: this.videoPlayerStatus,
- type: type
- });
- this.sendMsg('takePhotos', this.xdType == 'video' ? pd : '')
- } else {
- this.sendMsg('toast', '最多抓拍6张图片')
- }
- },
-
- takePhotoSuccess(url) {
- let obj = {
- photoPath: url
- }
- if (!this.curZbItem.hasOwnProperty('taskTargetPhotoList')) {
- this.curZbItem.taskTargetPhotoList = [obj]
- } else {
- this.curZbItem.taskTargetPhotoList.push(obj)
- this.curZbItem.taskTargetPhotoList.splice()
- }
- },
-
- onClosePz() {
- this.showPz = false
- this.sendMsg('getWinStatus', JSON.stringify({
- key: 'showPz',
- val: false
- }))
- },
-
- delImgs(index) {
- this.sendMsg('delImgs', index)
- },
- delImgsSuccess(index) {
- console.log(index, 'delImgsSuccess')
- this.curZbItem.taskTargetPhotoList.splice(index, 1)
- },
-
- editImgs(url, index, pindex) {
- let _this = this
- _this.activeZbIndex = index
- _this.activeZbPhoto = pindex
- _this.sendMsg('getWinStatus', JSON.stringify({
- key: 'isEditImg',
- val: true
- }))
- this.PED = new window.PED.imageInfo(
- url,
- function(data) {
-
- _this.sendMsg('saveEditImg', data)
- },
- function() {
- _this.sendMsg('getWinStatus', JSON.stringify({
- key: 'isEditImg',
- val: false
- }))
- })
- },
-
- closeImgsEdit() {
- this.PED.hidePED()
- this.sendMsg('getWinStatus', JSON.stringify({
- key: 'isEditImg',
- val: false
- }))
- },
-
- updateItemImg(path) {
- let photoList = this.curZbItem.taskTargetPhotoList
- photoList[this.activeZbPhoto].photoPath = path
- },
-
- selZbResult(type, zb, zbIndex) {
- let result = ['NOT_WORK', 'NOT_PASS', 'PASS']
- zb.result = result[type]
- this.zbItem.splice(zbIndex, 1, zb)
- },
-
- saveZbPlImgs() {
- this.zbItem.splice(this.activeZbIndex, 1, this.curZbItem)
- this.onClosePz()
- },
-
- submitTask() {
- this.sendMsg('submitTask', JSON.stringify(this.zbItem))
- },
- }
- })
- </script>
- </body>
- </html>
|