123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490 |
- <!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/less" type="text/css" href="css/styles.less" />
- <script src="js/less.min.js"></script>
- </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.id"> {{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 class="checkWork-head-row">
- <div>
- <div>进度:{{kptj.finishedTargetCount}}/{{kptj.totalTargetCount}}</div>
- <div>耗时:{{kptj.haoshi}}</div>
-
- </div>
- <div>
- <div>不适用:{{kptj.notWorkTargetCount}}</div>
- <div>不合格:{{kptj.notPassTargetCount}}</div>
- <div>合格:{{kptj.passTargetCount}}</div>
- </div>
- </div>
- </div>
-
- <div class="checkWork-body">
- <div class="checkWork-body-tabs">
- <div class="tabs-items"
- :class="activeIndex==index?'active':''"
- v-for="(item,index) in kpItem"
- @click="getKpItemZb(index)"
- :key="item.id">
- <div v-if="isDelItem"><a-icon @click.stop="confirmDelKpx(item.id)" class="aicon" type="close" /></div>
- <div>{{item.assessItemName}}</div>
- <div>{{item.finishedTargetCount}}/{{item.totalTargetCount}}</div>
- </div>
- <div class="tabs-items" v-if="kpItem.length>0">
- <div class="edit" v-if="!isDelItem" @click="isDelItem=true">编辑</div>
- <div class="edit" @click="isDelItem=false" v-else>取消编辑</div>
- </div>
- </div>
- <div 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.taskTargetPhotoVOList"
- :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)" type="minus-circle" :class="zb.result=='NOT_WORK'?'choose-bsy':''"/>
- </div>
- <div>
-
- <a-icon @click="selZbResult(1,zb)" type="close-circle" :class="zb.result=='NOT_PASS'?'choose-bhg':''"/>
- </div>
- <div>
-
- <a-icon @click="selZbResult(2,zb)" type="check-circle" :class="zb.result=='PASS'?'choose-hg':''"/>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="checkWork-button">
- <div v-if="xdType=='video'" @click="submitTask">提交本次巡店</div>
- <div v-if="xdType=='scene'" @click="nextStep">下一步</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">
- <a-icon class="aicon" type="camera" />
- </div>
- </div>
-
- <div class="imglist">
- <div v-for="(photo,pindex) in curZbItem.taskTargetPhotoVOList"
- :key="photo.id"
- >
- <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">
- <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>
- window.onload = function(){
- vm.showLoading = false
- }
-
-
- var vm = new Vue({
- el: '#app',
- data: {
- xdType:'video',
- player: null,
- videoList: [],
- curVideo: null,
- showYt: false,
- showYtbtns: false,
- showPz: false,
- isDelItem: false,
- showLoading: true,
- isEditImg: false,
- PED: null,
- hsID: null,
- activeIndex:0,
- activeZbIndex:0,
- activeZbPhoto:0,
- curZbItem: {comments:'',taskTargetPhotoVOList:[]},
-
- kptj:{
- haoshi: '0时0分'
- },
-
- kpItem: [],
- zbItem: []
- },
- mounted () {
- let _this = this
- moment.locale('zh-cn');
-
- this.hsID = setInterval(function(){
- _this.haoshi()
- }, 60000)
- },
- destroyed() {
- clearInterval(this.hsID)
- },
- methods: {
-
- resetPage(){
- this.activeIndex = 0
- this.activeZbIndex = 0
- this.activeZbPhoto = 0
- this.curZbItem = {comments:'',taskTargetPhotoVOList:[]}
- this.isDelItem = false
- this.showPz = false
- },
-
- setTyps(type){
- console.log(type)
- this.xdType = type
-
- document.title = type=='video'?'远程巡店':'现场巡店'
- },
-
- setVideoList(data){
- this.videoList = JSON.parse(data)
- this.curVideo = this.videoList[0]
- this.videoInit()
- },
-
- getTaskDetail(data){
- this.kptj = JSON.parse(data)
- this.haoshi()
- },
-
- getTaskItem(data){
- this.kpItem = JSON.parse(data)
- this.zbItem = this.kpItem.length ? this.kpItem[this.activeIndex].taskTargetVOList : []
- },
-
- onVideoListClick({ key }){
- let v = this.videoList.find(item=>item.id == key)
- if(v){
- this.curVideo = v
-
- this.showYt = false
- this.showYtbtns = false
- this.player.dispose()
- this.videoInit()
- }
- },
-
- videoInit(){
- const _this = this
- const videoSrc = this.curVideo.videoSrc
-
- _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.showYt = true
- })
- _this.player.on('error',function(e){
- console.log(JSON.stringify(e),'error')
- })
- },
-
- haoshi(){
- let s = this.kptj.startTime
- this.kptj.haoshi = moment().diff(s,'hours') + '时' + moment().diff(s,'minutes')%60 + '分'
- },
-
- 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 = JSON.parse(JSON.stringify(obj))
- },
-
- onClosePz(){
- this.showPz = false
- this.sendMsg('getWinStatus',JSON.stringify({key:'showPz',val: false}))
- },
-
- delImgs(index){
- this.sendMsg('delImgs',index)
- },
- delImgsSuccess(index){
- this.curZbItem.taskTargetPhotoVOList.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.taskTargetPhotoVOList
- photoList[this.activeZbPhoto].photoPath = path
- },
-
- updateKpFinish(){
- let kpItem = this.kpItem[this.activeIndex]
- let a = 0
- this.zbItem.map(item=>{
- if(item.result){
- a++
- }
- })
- kpItem.finishedTargetCount = a
-
- this.sendMsg('updateKpTj','')
- },
-
- confirmDelKpx(id){
- this.sendMsg('delKpItem',id)
- },
-
- delKpItemSuccess(id){
- let index = this.kpItem.findIndex(item=> item.id == id)
- if(index>=0){
- this.kpItem.splice(index,1)
- this.getKpItemZb(0)
-
- this.sendMsg('updateKpTj','')
- }
- },
-
- getKpItemZb(index){
- this.activeIndex = index
- this.zbItem = this.kpItem[index].taskTargetVOList
- },
-
- selZbResult(type,zb){
- let {id,taskItemId,taskId} = zb
- let result = ['NOT_WORK','NOT_PASS','PASS']
- this.sendMsg('selZbResult',JSON.stringify({result:result[type],id:id,taskItemId:taskItemId,taskId:taskId}))
- },
-
- saveZbResultSuccess(data){
- let {id,result} = JSON.parse(data)
- console.log(id,result)
- let zb = this.zbItem.find(item=> item.id == id)
- if(zb){
- zb.result = result
-
- this.updateKpFinish()
- }
- },
-
- saveZbPlImgs(){
- this.sendMsg('saveZbPlImgs',JSON.stringify(this.curZbItem))
- },
-
- saveZbPlImgsSuccess(){
- this.zbItem.splice(this.activeZbIndex,1,this.curZbItem)
- this.onClosePz()
- },
-
- submitTask(){
- this.sendMsg('submitTask','')
- },
-
- nextStep(){
- this.sendMsg('nextStep','')
- }
- }
- })
-
- </script>
- </body>
- </html>
|