Commit 3c84a656 authored by 刘威龙's avatar 刘威龙

司机登录页添加重要提醒功能

parent 312d6302
...@@ -377,3 +377,7 @@ export function GetCarrierList(data) { ...@@ -377,3 +377,7 @@ export function GetCarrierList(data) {
export function OCRService(ocrType, data) { export function OCRService(ocrType, data) {
return Request(`/api/entry/{mini}/m-action/biz.adapter.AdapterTask.service.${ocrType}`, data) return Request(`/api/entry/{mini}/m-action/biz.adapter.AdapterTask.service.${ocrType}`, data)
} }
//查询安全提醒文本
export function GetSafeIndicator(data) {
return Request(`/api/entry/{mini}/m-action/getSafeIndicator`,data);
}
\ No newline at end of file
<template> <template>
<view class="park_content"> <view class="park_content">
<!-- 弹窗遮罩 + 内容 -->
<view class="mask" v-if="visible" @click.stop></view>
<view class="model_box" v-if="visible">
<view class="mb-tit">安全提醒</view>
<view class="mb-content">
<view class="mb-con">
{{text}}
</view>
</view>
<button
class="confirm-btn"
@click="closeReminder"
:disabled="!canClose"
>
{{canClose ? '我已阅读并同意' : `请阅读 ${countDown} 秒后关闭`}}
</button>
</view>
<!-- 原有页面内容 -->
<view class="park_header"> <view class="park_header">
<!-- <image class="header-bg" src="../../static/img/bg/loginBg.png">
</image> -->
<image class="header-bg" src="../../static/img/bg/trina_dl.png"></image> <image class="header-bg" src="../../static/img/bg/trina_dl.png"></image>
</view> </view>
<view class="section_2 flex-col"> <view class="section_2 flex-col">
...@@ -19,11 +36,10 @@ ...@@ -19,11 +36,10 @@
</template> </template>
<script> <script>
import {} from '../../api/apiList.js' import {GetSafeIndicator} from '../../api/apiList.js'
import { import { getLoginInfo } from '../../mixins/loginBehavior'
getLoginInfo
} from '../../mixins/loginBehavior' export default {
export default {
data() { data() {
return { return {
code: "", code: "",
...@@ -35,40 +51,85 @@ ...@@ -35,40 +51,85 @@
title:"回单管理", title:"回单管理",
path:"/subpkg/orderPod/orderPod", path:"/subpkg/orderPod/orderPod",
src: "../../static/img/bg/orderPod.png" src: "../../static/img/bg/orderPod.png"
}/* ,{ }],
title:"在途上报", // 弹窗相关参数(新增)
path:"/subpkg/onWayUpload/onWayUpload", visible: false, // 弹窗是否显示
src: "../../static/img/bg/onWay.png" canClose: false, // 是否允许关闭
} */ countDown: 5 ,// 强制阅读倒计时(秒)
text: ""
],
isAgree: false,
visible: false,
}; };
}, },
onLoad() {}, onLoad() {
// 页面加载时判断是否需要显示弹窗(新增)
let reqData = {
"args": {
}
}
let _this =this;
GetSafeIndicator(reqData).then(res=>{
let data= res.data.data
console.log('返回结果为:', data);
_this.text = data.text.replace(/↵/g, '\n');
console.log('获取text为:', _this.text);
})
this.checkNeedShowReminder();
},
methods: { methods: {
openCard(path) { openCard(path) {
uni.navigateTo({ uni.navigateTo({ url: path });
url: path,
})
}, },
// 新增:判断是否需要显示弹窗(7天间隔逻辑)
checkNeedShowReminder() {
// 获取本地存储的上次弹窗时间(时间戳)
const lastShowTime = uni.getStorageSync('lastReminderTime');
const currentTime = Date.now(); // 当前时间戳(毫秒)
const sevenDays = 7 * 24 * 60 * 60 * 1000; // 7天的毫秒数
// 无记录 或 间隔超过7天 → 显示弹窗
if (!lastShowTime || currentTime - lastShowTime > sevenDays) {
this.visible = true;
this.startCountDown(); // 启动3秒倒计时
}
},
// 新增:3秒强制阅读倒计时
startCountDown() {
const timer = setInterval(() => {
if (this.countDown <= 1) {
clearInterval(timer);
this.countDown = 0;
this.canClose = true; // 倒计时结束,允许关闭
} else {
this.countDown--;
}
}, 1000);
},
// 新增:关闭弹窗
closeReminder() {
if (this.canClose) {
this.visible = false;
// 记录本次弹窗时间,用于下次间隔判断
uni.setStorageSync('lastReminderTime', Date.now());
} }
} }
}
}
</script> </script>
<style lang="scss"> <style lang="scss">
.park_content { .park_content {
/* 新增:弹窗样式 */
.mask { .mask {
position: absolute; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
z-index: 999; z-index: 999;
width: 100%;
height: 100%;
} }
.model_box { .model_box {
width: 80%; width: 80%;
position: fixed; position: fixed;
...@@ -77,55 +138,35 @@ ...@@ -77,55 +138,35 @@
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
z-index: 1000; z-index: 1000;
background: #fff; background: #fff;
height: 25%;
border-radius: 15rpx; border-radius: 15rpx;
overflow: hidden;
padding-bottom: 30rpx;
} }
.confirm-btn {
.mb-content { width: 80%;
padding: 10rpx 20rpx 10rpx 25rpx; height: 80rpx;
box-sizing: border-box; line-height: 80rpx;
height: 55%; background: #005bb5;
overflow: scroll; color: #fff;
} font-size: 28rpx;
border-radius: 40rpx;
.mb-tit { margin: 0 auto;
padding: 15rpx 0rpx;
box-sizing: border-box;
font-size: 34rpx;
text-align: center;
}
.mb-con {
font-size: 30rpx;
text-indent: 1rem;
line-height: 1.5;
}
.shipment_code {
line-height: 40rpx;
font-weight: bolder;
text-shadow: 1rpx 3rpx 12rpx rgba(0, 0, 0, 0.04);
} }
.confirm-btn[disabled] {
.toutitle { background: #ccc;
font-size: 16px; color: #999;
padding-left: 10px;
font-weight: 540;
} }
/* 原有样式保持不变 */
.park_header { .park_header {
background-color: #E9EEF6; background-color: #E9EEF6;
height: 450rpx; height: 450rpx;
.header-bg { .header-bg {
width: 100%; width: 100%;
height: 100%; height: 100%;
margin-top: -20px; margin-top: -20px;
} }
} }
.section_2 { .section_2 {
background-color: rgba(255, 255, 255, 1); background-color: rgba(255, 255, 255, 1);
border-radius: 24px 24px 0px 0px; border-radius: 24px 24px 0px 0px;
...@@ -159,29 +200,47 @@ ...@@ -159,29 +200,47 @@
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
border-radius: 10px; border-radius: 10px;
&:after {
.image_5 { content: "";
}
}
}
.image_2 {
width: 199rpx; width: 199rpx;
height: 199rpx; height: 199rpx;
margin-top: -14px; margin-top: -14px;
} }
.card_title { .card_title {
margin-top: -10rpx; margin-top: -10rpx;
font-size: 30rpx; font-size: 30rpx;
font-weight: 1000; font-weight: 1000;
color: #005bb5; color: #005bb5;
} }
.mb-tit {
&:after { padding: 15rpx 0rpx;
content: ""; box-sizing: border-box;
} font-size: 34rpx;
} text-align: center;
} font-weight: 600;
.image_2 { border-bottom: 1rpx solid #f5f5f5;
width: 199rpx;
height: 199rpx;
margin-top: -14px;
} }
.mb-content {
padding: 20rpx 25rpx;
box-sizing: border-box;
max-height: 300rpx;
overflow: auto;
// 新增:确保父容器不限制子元素换行
white-space: normal;
} }
.mb-con {
// 核心:保留换行符并自动换行
white-space: pre-wrap;
// 补充:长文本自动换行(防止单词/数字溢出)
word-break: break-all;
font-size: 26rpx;
line-height: 2; // 增加行高,让换行后更清晰
color: #666;
}
}
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment