doum
2026-06-16 77094dd01f0c6ff59b4fb4fa1105addf34b2398c
h5/pages/index.vue
@@ -17,19 +17,23 @@
      <view class="list">
         <view v-for="item in list2" class="item" @click="itemClick(item)">
            <image :src="item.img"></image>
            <view class="name">{{item.name}}</view>
            <view class="name">{{item.name}}</view>
            <view v-if="item.name == '待办中心' && taskNum" class="superscript">{{taskNum}}</view>
         </view>
      </view>
      <view class="loginout" @click="loginOut">退出登陆</view>
      <view class="footer-actions">
         <view class="switch-role" @click="switchRole">切换角色</view>
         <view class="loginout" @click="loginOut">退出登录</view>
      </view>
   </view>
</template>
<script>
   import {
      logoutPost,
      logoutPost,
      myNoticesH5
   } from '@/api'
   import { switchRole as doSwitchRole, goRoleSelect } from '@/utils/roleSwitch.js'
   export default {
      data() {
         return {
@@ -51,12 +55,12 @@
                  url: '/pages/operation/device',
                  img: require('@/static/home/ic_fangkebaobe@2x.png'),
                  auth: 'weixin:menu:visitcar'
               },
               {
                  name: '库存盘点',
                  url: '/pages/inventory/index',
                  img: require('@/static/home/ic_pandian@2x.png'),
                  auth: 'weixin:menu:visitcar'
               },
               {
                  name: '库存盘点',
                  url: '/pages/inventory/index',
                  img: require('@/static/home/ic_pandian@2x.png'),
                  auth: 'weixin:menu:visitcar'
               },
            ],
            list2: [{
@@ -70,20 +74,20 @@
                  url: '/pages/operation/record',
                  img: require('@/static/home/ic_wodehuiyi@2x.png'),
                  auth: 'weixin:menu:visitcar'
               },
               {
                  name: '待办中心',
                  url: '/pages/workOrder/wait',
                  img: require('@/static/home/ic_daiban@2x.png'),
                  auth: 'weixin:menu:visitcar'
               },
            ],
               {
                  name: '待办中心',
                  url: '/pages/workOrder/wait',
                  img: require('@/static/home/ic_daiban@2x.png'),
                  auth: 'weixin:menu:visitcar'
               },
            ],
            taskNum: 0
         }
      },
      onShow() {
         myNoticesH5({ page: 1, capacity: 1,model: {status: 0}}).then(res => {
            this.taskNum = res.data.total
         myNoticesH5({ page: 1, capacity: 1,model: {status: 0}}).then(res => {
            this.taskNum = res.data.total
         })
      },
      methods: {
@@ -92,16 +96,11 @@
               url: item.url
            })
         },
         switchRole () {
            doSwitchRole(logoutPost)
         },
         loginOut() {
            logoutPost().then(res => {
               this.$store.commit('empty')
               setTimeout(() => {
                  uni.redirectTo({
                     url: '/pages/login'
                  })
               }, 300)
            })
            // window.location.href= 'https://zhcg.fnwtzx.com/fn_h5'
            logoutPost().catch(() => {}).finally(() => goRoleSelect())
         },
      }
@@ -149,7 +148,7 @@
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 25%;
            width: 25%;
            position: relative;
            image {
               width: 88rpx;
@@ -160,37 +159,53 @@
            .name {
               font-size: 26rpx;
            }
            .superscript{
               height: 40rpx;
               width: 40rpx;
               position: absolute;
               top: -16rpx;
               right: 24rpx;
               background-color: red;
               color: #fff;
               font-size: 24rpx;
               display: flex;
               align-items: center;
               justify-content: center;
               border-radius: 50%;
            }
            .superscript{
               height: 40rpx;
               width: 40rpx;
               position: absolute;
               top: -16rpx;
               right: 24rpx;
               background-color: red;
               color: #fff;
               font-size: 24rpx;
               display: flex;
               align-items: center;
               justify-content: center;
               border-radius: 50%;
            }
         }
      }
      .loginout {
      .footer-actions {
         position: fixed;
         bottom: 88rpx;
         left: 50%;
         transform: translate(-50%, 0);
         width: 152rpx;
         left: 0;
         right: 0;
         display: flex;
         justify-content: center;
         align-items: center;
         gap: 24rpx;
      }
      .switch-role,
      .loginout {
         height: 60rpx;
         padding: 0 32rpx;
         border-radius: 30rpx;
         border: 1rpx solid $primaryColor;
         color: $primaryColor;
         font-size: 26rpx;
         display: flex;
         justify-content: center;
         align-items: center;
      }
      .switch-role {
         border: 1rpx solid $primaryColor;
         color: $primaryColor;
      }
      .loginout {
         border: 1rpx solid #ccc;
         color: #666;
      }
   }
</style>