fei.wang
6 天以前 645834e1c3efb3a8c50dcbda98d87caba04bd421
pages/index/index.vue
@@ -26,24 +26,28 @@
      <mainCom v-show="currentIndex == 0" ref="mainRef"></mainCom>
      <bumenCom v-show="currentIndex == 5" ref="mainRef" @tobumen="tobumen"></bumenCom>
      <equipmentCom v-show="currentIndex == 1"></equipmentCom>
      <equipmentCom v-show="currentIndex == 1" @toposition="toposition"></equipmentCom>
      <homeCom v-show="currentIndex == 2 && !isceju" :tabheight='tabBarHeight' :webHeight='webHeight'
         :topheight='topheight' :bottomheight='bottomheight' :fenceposition="fenceposition"></homeCom>
         :topheight='topheight' :bottomheight='bottomheight' :fenceposition="fenceposition" :ishide='ishide'
         :isweimap='isweimap'></homeCom>
      <cejuCom v-if="currentIndex == 3 && isceju" :webHeight='webHeight' :topheight='topheight'></cejuCom>
      <fenceCom v-show="currentIndex == 3" @toggle="toggle" @toposition="toposition"></fenceCom>
      <personCom v-show="currentIndex == 4" @tobumen="tobumen"></personCom>
      <personCom v-show="currentIndex == 4" @tobumen="tobumen" @hidemap="hidemap" @weimap="weimap"></personCom>
      <view class="tn-skeleton tn-skeleton-fillet">
         <tn-tabbar @change="chenge" :shadow="false" v-model="currentIndex" :safeAreaInsetBottom="true"
            :list="tabbarList" activeColor="#838383" inactiveColor="#AAAAAA" :activeIconColor="activeIconColor"
            :animation="true" v-if="showTabbar"></tn-tabbar>
      </view>
      <tn-skeleton :show="showSkeleton"></tn-skeleton>
      <u-modal confirmText="去登录" title="您还未登录" content="请登录后查看更多内容!" cancelText="再看看" :show="showfaka"
         @cancel="cancelfaka" @confirm="confirmfaka" ref="uModal" :showCancelButton="true"
         :closeOnClickOverlay="false">
      </u-modal>
      <tn-modal v-model="showqued" :title="titlequeding" :content="contentqueding" :button="buttonqueding"
         @click="clickqued"></tn-modal>
      <successCom ref="refSuccess"></successCom>
   </view>
</template>
@@ -73,7 +77,7 @@
   import equipmentCom from './equipment.vue';
   import fenceCom from './fence.vue';
   export default {
   export default {
      components: {
         bumenCom,
         successCom,
@@ -85,6 +89,22 @@
      },
      data() {
         return {
            buttonqueding: [{
                  text: '取消',
                  backgroundColor: '#E6E6E6',
                  fontColor: '#FFFFFF'
               },
               {
                  text: '确定',
                  backgroundColor: 'tn-bg-indigo',
                  fontColor: '#FFFFFF'
               }
            ],
            contentqueding: '',
            titlequeding: '使用提醒',
            showqued: false,
            isweimap: false,
            ishide: false,
            indexlist: [2],
            fenceposition: '',
            step: '',
@@ -121,8 +141,8 @@
               {
                  title: '信息',
                  activeIcon: '/static/tabbar/info_l_icon.png',
                  inactiveIcon: '/static/tabbar/info_f_icon.png',
                  activeIcon: '/static/tabbar/message1.png',
                  inactiveIcon: '/static/tabbar/message0.png',
                  iconSize: 42,
                  activeColor: '#40A290',
                  // count: 0,
@@ -133,8 +153,8 @@
               },
               {
                  title: '标签',
                  activeIcon: '/static/tabbar/equipment_f_icon.png',
                  inactiveIcon: '/static/tabbar/equipment_l_icon.png',
                  activeIcon: '/static/tabbar/shebei1.png',
                  inactiveIcon: '/static/tabbar/shebeilx.png',
                  iconSize: 42,
                  activeColor: '#40A290',
                  // activeIconColor: '#FFFFFF',
@@ -155,8 +175,8 @@
               },
               {
                  title: '围栏',
                  activeIcon: '/static/tabbar/fence_f_icon.png',
                  inactiveIcon: '/static/tabbar/fence_l_icon.png',
                  activeIcon: '/static/tabbar/fence1.png',
                  inactiveIcon: '/static/tabbar/fengce0.png',
                  iconSize: 42,
                  activeColor: '#40A290',
                  // activeIconColor: '#FFFFFF',
@@ -167,8 +187,8 @@
               {
                  title: '我的',
                  activeIcon: '/static/tabbar/my_f_icon.png',
                  inactiveIcon: '/static/tabbar/my_l_icon.png',
                  activeIcon: '/static/tabbar/wo1.png',
                  inactiveIcon: '/static/tabbar/wo0.png',
                  iconSize: 42,
                  activeColor: '#40A290',
               }
@@ -310,12 +330,18 @@
               this.getapp();
            }, 1000);
         },
         hidemap(e) {
            this.ishide = e
         },
         weimap(e) {
            this.isweimap = e
         },
         tobumen(e) {
            this.currentIndex = e
         },
         toposition(e) {
            this.currentIndex = 2
            console.log(e);
            this.fenceposition = e
         },
         // beforeSwitch(index) {
@@ -416,12 +442,53 @@
            });
         },
         clickqued(e) {
               var state = ''
            if (e.index == 0) {
               this.showqued = false
            } else {
               console.log(11111111);
               this.showqued = false
               if (this.step == 'START' || this.step == '') {
                  this.tabbarList[2].title = '暂停'
                  this.tabbarList[2].activeIcon = 'stop'
                  this.activeIconColor = 'tn-cool-bg-color-16'
                  this.step = 'STOP'
                  state = 'START'
                  // zystate = 'START'
                  store.commit('$tStore', {
                     name: 'zystate',
                     value: 'START'
                  })
                  this.workAudio()
               } else if (this.step == 'STOP') {
                  this.tabbarList[2].title = '开始'
                  this.tabbarList[2].activeIcon = 'play'
                  this.activeIconColor = 'tn-cool-bg-color-9'
                  this.step = 'START'
                  state = 'STOP'
                  store.commit('$tStore', {
                     name: 'zystate',
                     value: 'STOP'
                  })
                  this.workAudio()
               }
               // }
               const params1 = {
                  status: state,
                  company: this.company,
                  addperson: this.vuex_user,
               }
               startorstop(params1).then((res) => {})
            }
         },
         chenge(index) {
            console.log(3333333);
            console.log(index);
            this.indexlist.push(index)
            console.log(this.tarindex);
            var state = ''
            if (this.vuex_is_login) {
               if (this.tarindex == 2 && index == 2) {
                  const params = {
@@ -431,41 +498,44 @@
                     if (uni.getStorageSync('isfence') == true) {
                        findAllFence(params).then((res) => {
                           if (res.data.length > 0) {
                              this.showqued = true
                              if (this.step == 'START' || this.step == '') {
                                 console.log(111111);
                                 this.tabbarList[2].title = '暂停'
                                 this.tabbarList[2].activeIcon = 'stop'
                                 this.activeIconColor = 'tn-cool-bg-color-16'
                                 this.step = 'STOP'
                                 state = 'START'
                                 // zystate = 'START'
                                 store.commit('$tStore', {
                                    name: 'zystate',
                                    value: 'START'
                                 })
                                 this.workAudio()
                                 this.contentqueding = "是否确定开始作业"
                                 // console.log(111111);
                                 // this.tabbarList[2].title = '暂停'
                                 // this.tabbarList[2].activeIcon = 'stop'
                                 // this.activeIconColor = 'tn-cool-bg-color-16'
                                 // this.step = 'STOP'
                                 // state = 'START'
                                 // // zystate = 'START'
                                 // store.commit('$tStore', {
                                 //    name: 'zystate',
                                 //    value: 'START'
                                 // })
                                 // this.workAudio()
                              } else if (this.step == 'STOP') {
                                 console.log(222222);
                                 this.tabbarList[2].title = '开始'
                                 this.tabbarList[2].activeIcon = 'play'
                                 this.activeIconColor = 'tn-cool-bg-color-9'
                                 this.step = 'START'
                                 state = 'STOP'
                                 store.commit('$tStore', {
                                    name: 'zystate',
                                    value: 'STOP'
                                 })
                                 this.workAudio()
                                 this.contentqueding = "是否确定暂停作业"
                                 // console.log(222222);
                                 // this.tabbarList[2].title = '开始'
                                 // this.tabbarList[2].activeIcon = 'play'
                                 // this.activeIconColor = 'tn-cool-bg-color-9'
                                 // this.step = 'START'
                                 // state = 'STOP'
                                 // store.commit('$tStore', {
                                 //    name: 'zystate',
                                 //    value: 'STOP'
                                 // })
                                 // this.workAudio()
                              }
                              // }
                              const params1 = {
                                 status: state,
                                 company: this.company,
                                 addperson: this.vuex_user,
                              // const params1 = {
                              //    status: state,
                              //    company: this.company,
                              //    addperson: this.vuex_user,
                              }
                              startorstop(params1).then((res) => {})
                              // }
                              // startorstop(params1).then((res) => {})
                           } else {
                              this.$refs.refSuccess.showBox({
                                 type: 'error',
@@ -487,18 +557,7 @@
                        txt: '请先登录'
                     });
                  }
                  //判断是否有围栏,以及围栏是否启用
               } else {
                  if (index != 2) {
                     this.tabbarList[2].title = '首页'
                     this.activeIconColor = 'tn-cool-bg-color-7'
@@ -510,9 +569,7 @@
                     // this.tabbarList[2].title = '开始'
                     // this.tabbarList[2].activeIcon = 'play'
                     // this.activeIconColor = 'tn-cool-bg-color-9'
                     console.log(this.step);
                     if (this.step == 'START' || this.step == '') {
                        console.log(111111);
                        this.tabbarList[2].title = '开始'
                        this.tabbarList[2].activeIcon = 'play'
                        this.activeIconColor = 'tn-cool-bg-color-9'
@@ -525,7 +582,6 @@
                        // })
                        // this.workAudio()
                     } else if (this.step == 'STOP') {
                        console.log(222222);
                        this.tabbarList[2].title = '暂停'
                        this.tabbarList[2].activeIcon = 'stop'
                        this.activeIconColor = 'tn-cool-bg-color-16'
@@ -542,9 +598,6 @@
               }
               this.tarindex = index
            } else {
               // this.tarindex == 2 && index == 2''
               console.log(index);
               console.log(this.currentIndex);
               if (index != 4) {
                  this.showfaka = true
               }