fix:OTA弹窗新增更新中状态弹窗
This commit is contained in:
@@ -8,12 +8,16 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "new_version", // new_version | update_success | update_failure
|
default: "new_version", // new_version | update_progress | update_success | update_failure
|
||||||
},
|
},
|
||||||
version: {
|
version: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "",
|
default: "",
|
||||||
},
|
},
|
||||||
|
progress: {
|
||||||
|
type: Number,
|
||||||
|
default: 40,
|
||||||
|
},
|
||||||
// 副标题:如“新版本将优化智能弓体验”
|
// 副标题:如“新版本将优化智能弓体验”
|
||||||
description: {
|
description: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -33,8 +37,11 @@ const props = defineProps({
|
|||||||
const emit = defineEmits(["update", "skip", "close", "done", "retry"]);
|
const emit = defineEmits(["update", "skip", "close", "done", "retry"]);
|
||||||
|
|
||||||
const isNewVersion = computed(() => props.state === "new_version");
|
const isNewVersion = computed(() => props.state === "new_version");
|
||||||
|
const isProgress = computed(() => props.state === "update_progress");
|
||||||
const isSuccess = computed(() => props.state === "update_success");
|
const isSuccess = computed(() => props.state === "update_success");
|
||||||
const isFailure = computed(() => props.state === "update_failure");
|
const isFailure = computed(() => props.state === "update_failure");
|
||||||
|
// Clamp progress to keep the progress bar width within its container.
|
||||||
|
const progressValue = computed(() => Math.min(100, Math.max(0, Number(props.progress) || 0)));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -63,6 +70,12 @@ const isFailure = computed(() => props.state === "update_failure");
|
|||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
class="float-icon float-close"
|
class="float-icon float-close"
|
||||||
/>
|
/>
|
||||||
|
<image
|
||||||
|
v-else-if="isProgress"
|
||||||
|
src="../static/ota/target-char.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
class="float-icon float-target"
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- 弹窗卡片:overflow:visible 允许按钮溢出底部,背景图通过 ota-bg-clip 独立裁剪保持圆角 -->
|
<!-- 弹窗卡片:overflow:visible 允许按钮溢出底部,背景图通过 ota-bg-clip 独立裁剪保持圆角 -->
|
||||||
<view class="ota-dialog">
|
<view class="ota-dialog">
|
||||||
@@ -71,7 +84,7 @@ const isFailure = computed(() => props.state === "update_failure");
|
|||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="ota-content"
|
class="ota-content"
|
||||||
:class="{ 'content-new': isNewVersion, 'content-result': isSuccess || isFailure }"
|
:class="{ 'content-new': isNewVersion, 'content-result': isProgress || isSuccess || isFailure }"
|
||||||
>
|
>
|
||||||
|
|
||||||
<!-- 发现新版本:new-ver.png 已包含标题图,不再重复文字;版本号使用 ota-ver.png 胶囊背景 -->
|
<!-- 发现新版本:new-ver.png 已包含标题图,不再重复文字;版本号使用 ota-ver.png 胶囊背景 -->
|
||||||
@@ -104,6 +117,16 @@ const isFailure = computed(() => props.state === "update_failure");
|
|||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
|
<!-- 更新中:复用成功标题图,正文区域展示进度条,无底部按钮 -->
|
||||||
|
<block v-else-if="isProgress">
|
||||||
|
<image src="../static/ota/update-ok.png" mode="aspectFit" class="result-title-img" style="width: 220rpx; height: 62rpx;" />
|
||||||
|
<view class="progress-wrap">
|
||||||
|
<view class="progress-track">
|
||||||
|
<view class="progress-fill" :style="{ width: `${progressValue}%` }"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
<!-- 更新失败:图片左边距 34rpx,文案左对齐 44rpx,按钮浮动底部居中 -->
|
<!-- 更新失败:图片左边距 34rpx,文案左对齐 44rpx,按钮浮动底部居中 -->
|
||||||
<block v-else-if="isFailure">
|
<block v-else-if="isFailure">
|
||||||
<image src="../static/ota/update-fail.png" mode="aspectFit" class="result-title-img" style="width: 222rpx; height: 62rpx;" />
|
<image src="../static/ota/update-fail.png" mode="aspectFit" class="result-title-img" style="width: 222rpx; height: 62rpx;" />
|
||||||
@@ -185,6 +208,12 @@ const isFailure = computed(() => props.state === "update_failure");
|
|||||||
top: 20px;
|
top: 20px;
|
||||||
right: 30rpx;
|
right: 30rpx;
|
||||||
}
|
}
|
||||||
|
.float-target {
|
||||||
|
width: 194rpx;
|
||||||
|
height: 166rpx;
|
||||||
|
top: 20px;
|
||||||
|
right: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
/* 弹窗卡片:overflow:visible 允许按钮溢出底部,背景通过 ota-bg-clip 独立裁剪 */
|
/* 弹窗卡片:overflow:visible 允许按钮溢出底部,背景通过 ota-bg-clip 独立裁剪 */
|
||||||
.ota-dialog {
|
.ota-dialog {
|
||||||
@@ -340,6 +369,23 @@ const isFailure = computed(() => props.state === "update_failure");
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
margin-left: 44rpx;
|
margin-left: 44rpx;
|
||||||
}
|
}
|
||||||
|
.progress-wrap {
|
||||||
|
width: 394rpx;
|
||||||
|
margin-top: 40rpx;
|
||||||
|
margin-left: 44rpx;
|
||||||
|
}
|
||||||
|
.progress-track {
|
||||||
|
width: 100%;
|
||||||
|
height: 18rpx;
|
||||||
|
background-color: rgba(255, 255, 255, 0.28);
|
||||||
|
border-radius: 999rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.progress-fill {
|
||||||
|
height: 100%;
|
||||||
|
background-color: #FED847;
|
||||||
|
border-radius: 999rpx;
|
||||||
|
}
|
||||||
|
|
||||||
/* 关闭按钮(位于弹窗下方) */
|
/* 关闭按钮(位于弹窗下方) */
|
||||||
.ota-close-below {
|
.ota-close-below {
|
||||||
|
|||||||
Reference in New Issue
Block a user