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

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

parent 312d6302
......@@ -377,3 +377,7 @@ export function GetCarrierList(data) {
export function OCRService(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>
<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">
<!-- <image class="header-bg" src="../../static/img/bg/loginBg.png">
</image> -->
<image class="header-bg" src="../../static/img/bg/trina_dl.png"></image>
</view>
<view class="section_2 flex-col">
......@@ -19,11 +36,10 @@
</template>
<script>
import {} from '../../api/apiList.js'
import {
getLoginInfo
} from '../../mixins/loginBehavior'
export default {
import {GetSafeIndicator} from '../../api/apiList.js'
import { getLoginInfo } from '../../mixins/loginBehavior'
export default {
data() {
return {
code: "",
......@@ -35,40 +51,85 @@
title:"回单管理",
path:"/subpkg/orderPod/orderPod",
src: "../../static/img/bg/orderPod.png"
}/* ,{
title:"在途上报",
path:"/subpkg/onWayUpload/onWayUpload",
src: "../../static/img/bg/onWay.png"
} */
],
isAgree: false,
visible: false,
}],
// 弹窗相关参数(新增)
visible: false, // 弹窗是否显示
canClose: false, // 是否允许关闭
countDown: 5 ,// 强制阅读倒计时(秒)
text: ""
};
},
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: {
openCard(path) {
uni.navigateTo({
url: path,
})
uni.navigateTo({ 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>
<style lang="scss">
.park_content {
.park_content {
/* 新增:弹窗样式 */
.mask {
position: absolute;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
z-index: 999;
width: 100%;
height: 100%;
}
.model_box {
width: 80%;
position: fixed;
......@@ -77,55 +138,35 @@
transform: translate(-50%, -50%);
z-index: 1000;
background: #fff;
height: 25%;
border-radius: 15rpx;
overflow: hidden;
padding-bottom: 30rpx;
}
.mb-content {
padding: 10rpx 20rpx 10rpx 25rpx;
box-sizing: border-box;
height: 55%;
overflow: scroll;
}
.mb-tit {
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 {
width: 80%;
height: 80rpx;
line-height: 80rpx;
background: #005bb5;
color: #fff;
font-size: 28rpx;
border-radius: 40rpx;
margin: 0 auto;
}
.toutitle {
font-size: 16px;
padding-left: 10px;
font-weight: 540;
.confirm-btn[disabled] {
background: #ccc;
color: #999;
}
/* 原有样式保持不变 */
.park_header {
background-color: #E9EEF6;
height: 450rpx;
.header-bg {
width: 100%;
height: 100%;
margin-top: -20px;
}
}
.section_2 {
background-color: rgba(255, 255, 255, 1);
border-radius: 24px 24px 0px 0px;
......@@ -159,29 +200,47 @@
align-items: center;
flex-direction: column;
border-radius: 10px;
.image_5 {
&:after {
content: "";
}
}
}
.image_2 {
width: 199rpx;
height: 199rpx;
margin-top: -14px;
}
.card_title {
margin-top: -10rpx;
font-size: 30rpx;
font-weight: 1000;
color: #005bb5;
}
&:after {
content: "";
}
}
}
.image_2 {
width: 199rpx;
height: 199rpx;
margin-top: -14px;
.mb-tit {
padding: 15rpx 0rpx;
box-sizing: border-box;
font-size: 34rpx;
text-align: center;
font-weight: 600;
border-bottom: 1rpx solid #f5f5f5;
}
.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>
\ 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