lanan-repair-app/pages-home/home/index1.vue

569 lines
13 KiB
Vue
Raw Normal View History

2025-10-14 20:13:29 +08:00
<template>
<view class="content_">
<view class="topt_">
<view class="db_">
<view class="ds_">
<view class="user_img">
<image src="/static/icons/avatar.png" mode=""></image>
<view class="img_bo">蓝安汽修</view>
</view>
<view class="">
<view class="user_name">思利利</view>
<view class="user_gly">维修业务管理员</view>
</view>
</view>
<view class="top_time">
<view class="time_left">2015年08月12日</view>
<view class="time_right">星期二</view>
</view>
</view>
<view class="jg_">
<view class="jg_box">
<image src="/static/icons/order-icon3.png" mode=""></image>
<view class="">内部管理</view>
</view>
<view class="jg_box">
<image src="/static/icons/order-icon3.png" mode=""></image>
<view class="">业务管理</view>
</view>
<view class="jg_box">
<image src="/static/icons/order-icon3.png" mode=""></image>
<view class="">数据统计</view>
</view>
<view class="jg_box">
<image src="/static/icons/order-icon3.png" mode=""></image>
<view class="">消息通知</view>
</view>
</view>
</view>
<view class="bo_">
<view class="db_">
<view class="jg_left">
<view class="ds_">
<image src="/pages-home/static/waitingReceiveNum.png" mode=""></image>
<view class="">待审批工单</view>
</view>
<view class="">26</view>
</view>
<view class="jg_right">
<view class="ds_">
<image src="/pages-home/static/waitingReceiveNum.png" mode=""></image>
<view class="">待办工单</view>
</view>
<view class="">26</view>
</view>
</view>
<view class="db_">
<view class="three1">
<view class="">
<view class="t_size">进厂数</view>
<view class="t_num">123</view>
</view>
<image src="/pages-home/static/waitingReceiveNum.png" mode=""></image>
</view>
<view class="three2">
<view class="">
<view class="t_size">维修中</view>
<view class="t_num">123</view>
</view>
<image src="/pages-home/static/waitingReceiveNum.png" mode=""></image>
</view>
<view class="three3">
<view class="">
<view class="t_size">已竣工</view>
<view class="t_num">123</view>
</view>
<image src="/pages-home/static/waitingReceiveNum.png" mode=""></image>
</view>
</view>
<view class="db_c">
<view class="ds_">
<view class="gang_"></view>
<view class="title_">工单列表</view>
</view>
<view class="ds_h">查看全部</view>
</view>
<view class="c_box">
<view class="db_">
<view class="">
<view class="size1">川EPY528</view>
<view class="size2">东风</view>
</view>
<view class="">
<view class="size3">维修保养</view>
<view class="size4">进厂报修项目</view>
</view>
</view>
<view class="cont_title">
<view class="c_t_title">所有维修项目</view>
<view class="c_t_size">轿车二级维护发动机维修空调系统检修</view>
</view>
<view class="end_">
<view class="r_buttom">作废</view>
<view class="l_buttom">展开</view>
<view class="l_buttom">查看详情</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {getToken,getUserInfo} from "@/utils/auth";
import request from '@/utils/request';
let innerAudioContext ='';
const keepAlivePlugin = uni.requireNativePlugin('Ba-KeepAlive')
export default {
data() {
return {
// 是否正在播放
ifPlay:false,
keepLive: {
channelId: 'Ba-KeepAlive',
channelName: "Ba-KeepAlive",
title: "汽修小助手正在运行",
content: "汽修小助手正在运行",
dataResult: "",
type: undefined
}
}
},
onLoad() {
// #ifdef APP
//保活技术
this.register()
// #endif
if (getToken()) {
this.getNoReadNum()
//跳转首页
//判断是否是仓管,仓管需要跳单独的首页
let userInfo = getUserInfo()
if (userInfo.roleCodes.includes('repair_warehouse')) {
//仓管
uni.navigateTo({
url: '/pages-warehouse/home/home'
})
} else {
uni.navigateTo({
url: '/pages-home/home/home'
})
}
} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
},
onShow(){
if (getToken()) {
//判断是否是仓管,仓管需要跳单独的首页
let userInfo = getUserInfo()
if (userInfo.roleCodes.includes('repair_warehouse')) {
//仓管
uni.navigateTo({
url: '/pages-warehouse/home/home'
})
} else {
uni.navigateTo({
url: '/pages-home/home/home'
})
}
} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
},
methods: {
register() { //注册
console.log(keepAlivePlugin, 'keepAlive');
keepAlivePlugin.register({
channelId: this.keepLive.channelId,
channelName: this.keepLive.channelName,
title: this.keepLive.title,
content: this.keepLive.content,
},
(res) => {
console.log('保活注册', res);
});
},
/**
* 获取未读消息数量
* @returns {Promise<void>}
*/
async getNoReadNum(){
await request({
url: "/admin-api/system/notify-message/get-unread-count?systemCode=weixiu",
method: "GET"
}).then((res) => {
if(res.code==200 && res.data>0){
this.dianyidain()
}
})
},
dianyidain() {
if(!this.ifPlay){
console.log('执行了dianyidain');
if(innerAudioContext!=""){
try {
console.log('调用前先销毁');
innerAudioContext.stop();
innerAudioContext.destroy();
innerAudioContext="";
}catch (e){
console.log('销毁出错');
}
}
innerAudioContext = uni.createInnerAudioContext();
this.ifPlay=true
// #ifdef APP-PLUS
innerAudioContext.src = '../../static/msgV.mp3';
// #endif
// #ifndef APP-PLUS
innerAudioContext.src = 'https://www.nuoyunr.com/lananRsc/rescue/msgV.mp3';
// #endif
// 设置播放次数和计数器
const playCount = 4;
let currentCount = 0;
// 初次播放
innerAudioContext.play();
// 震动
uni.vibrateLong({
success: function () {
console.log('success');
}
});
innerAudioContext.onError((err) => {
console.error('播放错误', err);
this.ifPlay=false
innerAudioContext.stop();
innerAudioContext.destroy(); // 播放错误后释放实例
});
// 监听音频播放结束事件
innerAudioContext.onEnded(() => {
// 播放计数加一
currentCount++;
// 判断是否达到播放次数上限
if (currentCount < playCount) {
// 继续播放
innerAudioContext.play();
// 震动
uni.vibrateLong({
success: function () {
console.log('success');
}
});
} else {
// 播放完成,可以在这里添加额外的逻辑
console.log('播放完成');
this.ifPlay=false
//及时释放资源
innerAudioContext.stop();
innerAudioContext.destroy();
}
});
}else{
console.log('正在播放音频,拒绝播放请求');
}
},
}
}
</script>
<style lang="scss" scoped>
.content_{
}
.topt_{
width: 100%;
height: 408rpx;
background: linear-gradient( 180deg, #2D3BFF 0%, #1463FF 100%);
border-radius: 0rpx 0rpx 12rpx 12rpx;
box-sizing: border-box;
padding: 30rpx;
padding-top: 96px;
}
.db_{
display: flex;
align-items: center;
justify-content: space-between;
}
.db_c{
display: flex;
align-items: center;
justify-content: space-between;
margin: 30rpx auto;
}
.ds_{
display: flex;
align-items: center;
}
.top_time{
display: flex;
align-items: center;
justify-content: space-between;
}
.time_left{
width: 210rpx;
height: 52rpx;
background: rgba(255,255,255,0.4);
border-radius: 36rpx 0rpx 0rpx 36rpx;
background: #7e90fe;
color: #fff;
}
.time_right{
background: #fff;
color: #214FFF;
border-radius: 36rpx 0rpx 0rpx 36rpx;
width: 118rpx;
height: 52rpx;
}
.user_gly{
font-weight: 400;
color: rgba(255,255,255,0.83);
font-size: 24rpx;
}
.user_name{
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
margin-bottom: 5rpx;
}
.user_img{
position: relative;
text-align: center;
image{
width: 96rpx;
height: 96rpx;
}
}
.img_bo{
width: 116rpx;
height: 32rpx;
background: linear-gradient( 180deg, #8DB4FF 0%, #3069FF 100%);
border-radius: 20rpx;
border: 1rpx solid rgba(255,255,255,0.46);
font-weight: 500;
font-size: 24rpx;
color: #FFFFFF;
}
.jg_{
display: flex;
align-items: center;
justify-content: space-between;
}
.jg_box{
text-align: center;
font-weight: 400;
font-size: 28rpx;
color: #FFFFFF;
width: 25%;
image{
width: 56rpx;
height: 56rpx;
margin-bottom: 10rpx;
}
}
.bo_{
width: 100%;
box-sizing: border-box;
padding: 30rpx;
}
.jg_left{
width: 356rpx;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx;
color: #fff;
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
background: linear-gradient( 68deg, #6CAFFF 0%, #0059FF 100%);
image{
width: 40rpx;
height: 40rpx;
margin-right: 15rpx;
}
}
.jg_right{
width: 356rpx;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 30rpx;
color: #fff;
font-weight: bold;
font-size: 28rpx;
color: #FFFFFF;
background: linear-gradient( 68deg, #87E2FF 0%, #008BFF 100%);
image{
width: 40rpx;
height: 40rpx;
margin-right: 15rpx;
}
}
.three1{
width: 234rpx;
height: 120rpx;
background: linear-gradient( 68deg, #EEF5FF 0%, #D7E0FC 100%);
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 10rpx;
padding-left: 30rpx;
image{
width: 96rpx;
height: 92rpx;
}
}
.three2{
width: 234rpx;
height: 120rpx;
background: linear-gradient( 84deg, #E3F2F5 0%, #AFEEF8 100%);
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 10rpx;
padding-left: 30rpx;
image{
width: 96rpx;
height: 92rpx;
}
}
.three3{
width: 234rpx;
height: 120rpx;
background: linear-gradient( 84deg, #E8F2E1 0%, #CCEFDD 100%);
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 10rpx;
padding-left: 30rpx;
image{
width: 96rpx;
height: 92rpx;
}
}
.t_size{
font-weight: 400;
font-size: 28rpx;
color: #284F89;
margin-bottom: 10rpx;
}
.t_num{
font-weight: bold;
font-size: 28rpx;
color: #3E4045;
}
.gang_{
width: 8rpx;
height: 40rpx;
background: #195AFF;
margin-right: 8rpx;
border-radius: 8px;
}
.title_{
font-weight: 800;
font-size: 28rpx;
color: #23252B;
}
.ds_h{
display: flex;
align-items: center;
font-weight: 400;
font-size: 28rpx;
color: #9799A1;
}
.c_box{
width: 100%;
height: 300rpx;
background: #FFFFFF;
border-radius: 8rpx;
box-sizing: border-box;
padding: 30rpx;
margin: 10px auto;
}
.size1{
font-weight: 600;
font-size: 28rpx;
color: #3B3D41;
}
.size2{
font-weight: 400;
font-size: 24rpx;
color: #686B71;
}
.size3{
font-weight: 600;
font-size: 28rpx;
color: #3B3D41;
}
.size4{
font-weight: 400;
font-size: 24rpx;
color: #176C97;
}
.cont_title{
height: 98rpx;
background: #F7F8F9;
border-radius: 8rpx;
width: 100%;
box-sizing: border-box;
padding: 10rpx;
margin: 10rpx auto;
}
.c_t_title{
font-weight: 400;
font-size: 24rpx;
color: #176C97;
}
.c_t_size{
font-weight: 600;
font-size: 24rpx;
color: #3B3D41;
}
.end_{
display: flex;align-items: center;justify-content: end;
}
.l_buttom{
width: 168rpx;
height: 48rpx;
background: #FFFFFF;
border-radius: 30rpx;
border: 2rpx solid #2E90F2;
color: #2E90F2;
display: flex;
align-items: center;
justify-content: center;
font-weight: 400;
font-size: 28rpx;
color: #2E90F2;
margin-left: 10rpx;
}
.r_buttom{
width: 168rpx;
height: 48rpx;
background: #FFFFFF;
border-radius: 30rpx;
border: 2rpx solid #F2612E;
color: #F2612E;
display: flex;
align-items: center;
justify-content: center;
font-weight: 400;
font-size: 28rpx;
margin-left: 10rpx;
}
</style>