This commit is contained in:
吴鹏 2026-06-02 10:34:22 +08:00
parent 4e213c55d0
commit 63960ac1d0
2 changed files with 533 additions and 42 deletions

View File

@ -42,6 +42,7 @@
<view <view
hover-class="app-tap-hover" hover-class="app-tap-hover"
class="ability-row" class="ability-row"
:class="{ 'ability-row--active': isAbilitySelected(item) }"
v-for="item in abilityOptions" v-for="item in abilityOptions"
:key="item.id" :key="item.id"
@click="onSelectAbility(item)" @click="onSelectAbility(item)"
@ -60,6 +61,15 @@
</scroll-view> </scroll-view>
</view> </view>
</view> </view>
<view class="page-footer">
<view
hover-class="app-tap-hover"
class="footer-btn"
:class="{ 'footer-btn--disabled': !selectedAbility || submitting }"
@click="confirmAdd"
>确定添加</view>
</view>
</view> </view>
</template> </template>
@ -130,12 +140,29 @@
if (this.submitting) return if (this.submitting) return
this.showPicker = false this.showPicker = false
}, },
isAbilitySelected(item) {
return this.selectedAbility && item && this.selectedAbility.id === item.id
},
onSelectAbility(item) { onSelectAbility(item) {
if (this.submitting || !item || item.id == null) return if (this.submitting || !item || item.id == null) return
this.selectedAbility = item this.selectedAbility = item
this.submitAbility(item) this.showPicker = false
}, },
submitAbility(item) { confirmAdd() {
if (this.submitting) return
if (!this.areaId) {
uni.showToast({ title: '缺少运营区信息', icon: 'none' })
return
}
if (!this.selectedAbility || this.selectedAbility.id == null) {
uni.showToast({ title: '请先选择拓展能力', icon: 'none' })
return
}
this.submitAbility()
},
submitAbility() {
const item = this.selectedAbility
if (!item || item.id == null) return
this.submitting = true this.submitting = true
uni.showLoading({ title: '提交中...', mask: true }) uni.showLoading({ title: '提交中...', mask: true })
this.$u this.$u
@ -145,7 +172,6 @@
}) })
.then((res) => { .then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.showPicker = false
uni.showToast({ title: '新增成功', icon: 'success' }) uni.showToast({ title: '新增成功', icon: 'success' })
const pages = getCurrentPages() const pages = getCurrentPages()
const prev = pages[pages.length - 2] const prev = pages[pages.length - 2]
@ -154,12 +180,10 @@
} }
setTimeout(() => uni.navigateBack(), 500) setTimeout(() => uni.navigateBack(), 500)
} else { } else {
this.selectedAbility = null
uni.showToast({ title: res.msg || '新增失败', icon: 'none' }) uni.showToast({ title: res.msg || '新增失败', icon: 'none' })
} }
}) })
.catch(() => { .catch(() => {
this.selectedAbility = null
uni.showToast({ title: '新增失败', icon: 'none' }) uni.showToast({ title: '新增失败', icon: 'none' })
}) })
.finally(() => { .finally(() => {
@ -177,10 +201,36 @@
} }
.page { .page {
min-height: 100vh; min-height: 100vh;
padding-bottom: calc(140rpx + env(safe-area-inset-bottom));
box-sizing: border-box;
} }
.form-container { .form-container {
padding: 24rpx; padding: 24rpx;
} }
.page-footer {
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 20rpx 24rpx calc(20rpx + env(safe-area-inset-bottom));
background: #fff;
box-shadow: 0 -4rpx 24rpx rgba(0, 0, 0, 0.06);
z-index: 10;
}
.footer-btn {
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 32rpx;
font-weight: 600;
color: #fff;
background: #4297F3;
border-radius: 44rpx;
}
.footer-btn--disabled {
background: #cbd5e1;
color: #f8fafc;
}
.area-tip { .area-tip {
background: #fff; background: #fff;
border-radius: 16rpx; border-radius: 16rpx;
@ -348,6 +398,9 @@
padding: 28rpx 32rpx; padding: 28rpx 32rpx;
border-bottom: 1rpx solid #f3f4f6; border-bottom: 1rpx solid #f3f4f6;
} }
.ability-row--active {
background: #eff6ff;
}
.ability-row-icon { .ability-row-icon {
width: 80rpx; width: 80rpx;
height: 80rpx; height: 80rpx;

View File

@ -42,10 +42,10 @@
<image src="https://api.ccttiot.com/smartmeter/img/static/uP7BOVsjvWaGItgHtoKV" mode=""></image> <image src="https://api.ccttiot.com/smartmeter/img/static/uP7BOVsjvWaGItgHtoKV" mode=""></image>
</view> </view>
<view hover-class="app-tap-hover" class="lypic" v-if="ver_dataflag == 3" @click="btnly"> <view hover-class="app-tap-hover" class="lypic" v-if="ver_dataflag == 3" @click="btnly">
<image src="https://api.ccttiot.com/smartmeter/img/static/uLw46jus4X9fposAvVD7" mode=""></image> <image src="https://api.ccttiot.com/smartmeter/img/static/uLw46jus4X9fposAvVD7" mode="aspectFit"></image>
</view> </view>
<view hover-class="app-tap-hover" class="lypic" v-if="ver_dataflag == 1" @click="btnly"> <view hover-class="app-tap-hover" class="lypic" v-if="ver_dataflag == 1" @click="btnly">
<image class="glow-image" src="https://api.ccttiot.com/smartmeter/img/static/uCdHjNaNfD9aikVg9Cuk" mode="aspectFit" /> <image src="https://api.ccttiot.com/smartmeter/img/static/uCdHjNaNfD9aikVg9Cuk" mode="aspectFit"></image>
</view> </view>
</view> </view>
</view> </view>
@ -354,30 +354,59 @@
</view> </view>
</view> </view>
<u-mask :show="btProcessVisible" :z-index='101' duration='0' /> <u-mask :show="btProcessVisible" :z-index='101' duration='0' />
<view v-if="btProcessVisible" style="position: fixed;left: 50%;top: 50%;transform: translate(-50%, -50%);z-index: 102;width: 620rpx;background: #fff;border-radius: 16rpx;padding: 30rpx;box-sizing: border-box;"> <view v-if="btProcessVisible" class="bt-process-panel" :class="{ 'bt-process-panel--error': !!btErrorMessage }">
<view style="font-size: 30rpx;color: #2E4975;font-weight: 600;text-align: center;">蓝牙自检中</view> <view class="bt-process-panel__accent"></view>
<view style="font-size: 24rpx;color: #666;text-align: center;margin-top: 18rpx;line-height: 1.6;">{{ btStepMessage }}</view> <view class="bt-process-panel__glow"></view>
<view style="margin-top: 22rpx;height: 16rpx;background: #EEF3FA;border-radius: 10rpx;overflow: hidden;"> <view class="bt-process-panel__inner">
<view :style="'height: 100%;background: #4C97E7;width:' + btProgress + '%;transition: width .25s;'"></view> <view class="bt-process-panel__visual" v-if="!btErrorMessage">
</view> <view class="bt-process-panel__orbit">
<view style="display:flex;justify-content: space-between;font-size: 20rpx;color:#7c7c7c;margin-top: 12rpx;"> <view class="bt-process-panel__ring bt-process-panel__ring--a"></view>
<text>进度</text> <view class="bt-process-panel__ring bt-process-panel__ring--b"></view>
<text>{{ btProgress }}%</text> <view class="bt-process-panel__sweep"></view>
</view> <view class="bt-process-panel__core">
<view v-if="btErrorMessage" style="margin-top: 16rpx;font-size: 24rpx;color: #E34D59;line-height: 1.6;">{{ btErrorMessage }}</view> <image class="bt-process-panel__icon" src="https://api.ccttiot.com/smartmeter/img/static/uCdHjNaNfD9aikVg9Cuk" mode="aspectFit" />
<view v-if="btErrorMessage" style="display:flex;justify-content:center;gap:16rpx;margin-top:18rpx;"> </view>
<view v-if="btErrorType === 'phone_bluetooth_off'" @click="goPhoneBluetoothSetting" style="width: 200rpx;height: 60rpx;line-height: 60rpx;text-align: center;border-radius: 30rpx;background: #28A745;color: #fff;font-size: 24rpx;"> </view>
去设置
</view> </view>
<view v-if="btErrorType === 'wechat_auth_denied'" @click="openWechatBluetoothAuthSetting" style="width: 200rpx;height: 60rpx;line-height: 60rpx;text-align: center;border-radius: 30rpx;background: #28A745;color: #fff;font-size: 24rpx;"> <view class="bt-process-panel__visual bt-process-panel__visual--err" v-else>
去授权 <view class="bt-process-panel__core bt-process-panel__core--err">
<image class="bt-process-panel__icon" src="https://api.ccttiot.com/smartmeter/img/static/uCdHjNaNfD9aikVg9Cuk" mode="aspectFit" />
</view>
</view> </view>
<view @click="btProcessVisible = false" style="width: 180rpx;height: 60rpx;line-height: 60rpx;text-align: center;border-radius: 30rpx;background: #4C97E7;color: #fff;font-size: 24rpx;"> <view class="bt-process-panel__head">
我知道了 <text class="bt-process-panel__title">{{ btErrorMessage ? '连接异常' : '蓝牙连接' }}</text>
<view class="bt-process-panel__status-pill">
<view class="bt-process-panel__status-dot"></view>
<text class="bt-process-panel__message">{{ btStepMessage }}</text>
</view>
</view>
<view class="bt-process-panel__progress-card" v-if="!btErrorMessage">
<view class="bt-process-panel__progress-top">
<text class="bt-process-panel__progress-label">连接进度</text>
<view class="bt-process-panel__progress-num-wrap">
<text class="bt-process-panel__progress-num">{{ btProgress }}</text>
<text class="bt-process-panel__progress-unit">%</text>
</view>
</view>
<view class="bt-process-panel__progress-track">
<view class="bt-process-panel__progress-bar" :style="'width:' + btProgress + '%;'">
<view class="bt-process-panel__progress-shine"></view>
</view>
</view>
</view>
<view v-if="btErrorMessage" class="bt-process-panel__alert">
<view class="bt-process-panel__alert-icon">!</view>
<text class="bt-process-panel__alert-text">{{ btErrorMessage }}</text>
</view>
<view v-if="btErrorMessage" class="bt-process-panel__actions">
<view v-if="btErrorType === 'phone_bluetooth_off'" class="bt-process-panel__btn bt-process-panel__btn--accent" @click="goPhoneBluetoothSetting">去设置</view>
<view v-if="btErrorType === 'wechat_auth_denied'" class="bt-process-panel__btn bt-process-panel__btn--accent" @click="openWechatBluetoothAuthSetting">去授权</view>
<view class="bt-process-panel__btn bt-process-panel__btn--main" @click="btProcessVisible = false">我知道了</view>
</view>
<view v-if="btErrorMessage" class="bt-process-panel__hint">
<text class="bt-process-panel__hint-icon"></text>
<text>蓝牙操作中请靠近车辆</text>
</view> </view>
</view>
<view v-if="btErrorMessage" style="text-align: center; margin-top: 18rpx; padding: 0 8rpx; font-size: 22rpx; color: #8A96A8; line-height: 1.5;">
蓝牙操作中请靠近车辆
</view> </view>
</view> </view>
<u-select v-model="showModelList" :list="ModelList" :title="deviceInfos && deviceInfos.modelName ? '修改车型' : '绑定车型'" @confirm="confirm"></u-select> <u-select v-model="showModelList" :list="ModelList" :title="deviceInfos && deviceInfos.modelName ? '修改车型' : '绑定车型'" @confirm="confirm"></u-select>
@ -741,7 +770,7 @@
}, },
async connectMatchedDeviceWithRetry(matchedDevice, maxRetry = 3) { async connectMatchedDeviceWithRetry(matchedDevice, maxRetry = 3) {
for (let attempt = 1; attempt <= maxRetry; attempt++) { for (let attempt = 1; attempt <= maxRetry; attempt++) {
this.btStepMessage = '已搜索到设备,正在建立蓝牙连接...(第' + attempt + '/' + maxRetry + '次)' this.btStepMessage = '已搜索到设备,正在连接...(第' + attempt + '/' + maxRetry + '次)'
this.ver_dataflag = 2 this.ver_dataflag = 2
try { try {
// 线 // 线
@ -2879,25 +2908,15 @@
height: 36rpx; height: 36rpx;
margin-right: 8rpx; margin-right: 8rpx;
} }
.glow-image {
width: 36rpx;
height: 36rpx;
margin-right: 8rpx;
transition: all 1s ease-in-out;
filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.7));
/* 青色外发光 */
}
.visible { .visible {
opacity: 1; opacity: 1;
transform: scale(1); transform: scale(1);
filter: drop-shadow(0 0 5px rgba(255, 50, 50, 1)); filter: drop-shadow(0 0 5px rgba(76, 151, 231, 0.9));
/* 增强发光 */
} }
.hidden { .hidden {
opacity: 0.3; opacity: 0.35;
transform: scale(0.95); transform: scale(0.95);
filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.3)); filter: drop-shadow(0 0 4rpx rgba(76, 151, 231, 0.35));
/* 减弱发光 */
} }
} }
.bikexx { .bikexx {
@ -3159,6 +3178,425 @@
} }
} }
/* ========== 蓝牙连接弹窗(品牌色 #2E4975 / #4C97E7 ========== */
@keyframes bt-orbit-spin {
from { transform: translate(-50%, -50%) rotate(0deg); }
to { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes bt-orbit-spin-rev {
from { transform: translate(-50%, -50%) rotate(360deg); }
to { transform: translate(-50%, -50%) rotate(0deg); }
}
@keyframes bt-sweep-spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
@keyframes bt-core-breathe {
0%, 100% {
box-shadow:
0 0 0 1rpx rgba(255, 255, 255, 0.8),
0 10rpx 32rpx rgba(46, 73, 117, 0.14);
}
50% {
box-shadow:
0 0 0 1rpx rgba(255, 255, 255, 1),
0 14rpx 40rpx rgba(76, 151, 231, 0.22);
}
}
@keyframes bt-progress-shine-move {
0% { left: -55%; }
100% { left: 130%; }
}
@keyframes bt-status-dot-blink {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.5; transform: scale(0.9); }
}
@keyframes bt-panel-enter {
0% {
opacity: 0;
transform: translate(-50%, -48%) scale(0.97);
}
100% {
opacity: 1;
transform: translate(-50%, -50%) scale(1);
}
}
.bt-process-panel {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
z-index: 102;
width: 608rpx;
box-sizing: border-box;
overflow: hidden;
border-radius: 30rpx;
background: #ffffff;
border: 1rpx solid #e8ecf1;
box-shadow:
0 0 0 1rpx rgba(255, 255, 255, 0.6) inset,
0 20rpx 50rpx rgba(46, 73, 117, 0.1),
0 8rpx 24rpx rgba(46, 73, 117, 0.06);
animation: bt-panel-enter 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.bt-process-panel__accent {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 6rpx;
background: linear-gradient(90deg, #2679d1 0%, #4c97e7 50%, #7eb8ff 100%);
pointer-events: none;
z-index: 4;
}
.bt-process-panel__glow {
position: absolute;
left: 50%;
top: 80rpx;
width: 320rpx;
height: 200rpx;
margin-left: -160rpx;
background: radial-gradient(ellipse at 50% 50%, rgba(76, 151, 231, 0.09) 0%, transparent 72%);
pointer-events: none;
}
.bt-process-panel__inner {
position: relative;
z-index: 2;
padding: 56rpx 48rpx 48rpx;
}
.bt-process-panel__visual {
display: flex;
justify-content: center;
margin-bottom: 44rpx;
}
.bt-process-panel__visual--err {
margin-bottom: 36rpx;
}
.bt-process-panel__orbit {
position: relative;
width: 216rpx;
height: 216rpx;
&::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 216rpx;
height: 216rpx;
margin: -108rpx 0 0 -108rpx;
border-radius: 50%;
border: 1rpx solid rgba(46, 73, 117, 0.06);
box-sizing: border-box;
}
}
.bt-process-panel__ring {
position: absolute;
left: 50%;
top: 50%;
border-radius: 50%;
border: 2rpx solid transparent;
transform: translate(-50%, -50%);
}
.bt-process-panel__ring--a {
width: 208rpx;
height: 208rpx;
border-top-color: rgba(76, 151, 231, 0.45);
border-right-color: rgba(76, 151, 231, 0.08);
animation: bt-orbit-spin 4.8s linear infinite;
}
.bt-process-panel__ring--b {
width: 172rpx;
height: 172rpx;
border-top-color: rgba(38, 121, 209, 0.28);
border-left-color: rgba(38, 121, 209, 0.06);
animation: bt-orbit-spin-rev 3.8s linear infinite;
}
.bt-process-panel__sweep {
position: absolute;
left: 50%;
top: 50%;
width: 208rpx;
height: 208rpx;
margin: -104rpx 0 0 -104rpx;
border-radius: 50%;
background: conic-gradient(from 0deg, transparent 0deg, transparent 284deg, rgba(76, 151, 231, 0.05) 300deg, rgba(76, 151, 231, 0.18) 360deg);
animation: bt-sweep-spin 4.2s linear infinite;
}
.bt-process-panel__core {
position: absolute;
left: 50%;
top: 50%;
z-index: 3;
width: 108rpx;
height: 108rpx;
margin: -54rpx 0 0 -54rpx;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(160deg, #ffffff 15%, #e8f2fc 50%, #4c97e7 100%);
animation: bt-core-breathe 3.2s ease-in-out infinite;
}
.bt-process-panel__core--err {
position: relative;
left: auto;
top: auto;
margin: 0 auto;
background: linear-gradient(160deg, #ffffff 15%, #fceeee 55%, #e57373 100%);
animation: none;
box-shadow: 0 10rpx 32rpx rgba(180, 90, 90, 0.14);
}
.bt-process-panel__icon {
width: 48rpx;
height: 48rpx;
}
.bt-process-panel--error {
.bt-process-panel__accent {
background: linear-gradient(90deg, #c75c5c 0%, #e57373 50%, #f0a8a8 100%);
}
.bt-process-panel__glow {
background: radial-gradient(ellipse at 50% 50%, rgba(200, 100, 100, 0.08) 0%, transparent 72%);
}
.bt-process-panel__title {
color: #c75c5c;
}
.bt-process-panel__status-pill {
background: #fdf9f9;
border-color: #f5e0e0;
}
.bt-process-panel__status-dot {
background: #e57373;
}
.bt-process-panel__message {
color: #9a7070;
}
.bt-process-panel__progress-num {
color: #c75c5c;
}
}
.bt-process-panel__head {
text-align: center;
margin-bottom: 0;
}
.bt-process-panel__title {
display: block;
font-size: 34rpx;
font-weight: 600;
color: #2e4975;
line-height: 1.35;
letter-spacing: 1rpx;
}
.bt-process-panel__status-pill {
display: inline-flex;
align-items: center;
justify-content: center;
max-width: 100%;
margin-top: 20rpx;
padding: 14rpx 28rpx;
background: #f7fafe;
border: 1rpx solid #e3ebf5;
border-radius: 999rpx;
box-sizing: border-box;
}
.bt-process-panel__status-dot {
width: 10rpx;
height: 10rpx;
border-radius: 50%;
margin-right: 12rpx;
flex-shrink: 0;
background: #4c97e7;
animation: bt-status-dot-blink 2s ease-in-out infinite;
}
.bt-process-panel__message {
font-size: 26rpx;
font-weight: 400;
color: #7c7c7c;
line-height: 1.55;
}
.bt-process-panel__progress-card {
margin-top: 36rpx;
padding: 32rpx 30rpx 30rpx;
background: linear-gradient(180deg, #f7fafe 0%, #f3f6fa 100%);
border: 1rpx solid #e3ebf5;
border-radius: 20rpx;
}
.bt-process-panel__progress-top {
display: flex;
align-items: flex-end;
justify-content: space-between;
margin-bottom: 24rpx;
}
.bt-process-panel__progress-label {
font-size: 24rpx;
font-weight: 500;
color: #808080;
padding-bottom: 6rpx;
}
.bt-process-panel__progress-num-wrap {
display: flex;
align-items: baseline;
}
.bt-process-panel__progress-num {
font-size: 44rpx;
font-weight: 600;
color: #2e4975;
font-variant-numeric: tabular-nums;
line-height: 1;
}
.bt-process-panel__progress-unit {
margin-left: 6rpx;
font-size: 26rpx;
font-weight: 500;
color: #4c97e7;
}
.bt-process-panel__progress-track {
position: relative;
height: 10rpx;
background: #dce4ee;
border-radius: 999rpx;
overflow: hidden;
box-shadow: inset 0 1rpx 3rpx rgba(46, 73, 117, 0.08);
}
.bt-process-panel__progress-bar {
position: relative;
height: 100%;
min-width: 0;
border-radius: 999rpx;
background: linear-gradient(90deg, #7eb8ff 0%, #4c97e7 100%);
transition: width 0.42s cubic-bezier(0.22, 1, 0.36, 1);
overflow: hidden;
}
.bt-process-panel__progress-shine {
position: absolute;
top: 0;
bottom: 0;
width: 36%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
animation: bt-progress-shine-move 2.6s ease-in-out infinite;
pointer-events: none;
}
.bt-process-panel__alert {
display: flex;
align-items: flex-start;
margin-top: 32rpx;
padding: 24rpx 22rpx;
background: #fdf9f9;
border: 1rpx solid #f5e0e0;
border-radius: 16rpx;
}
.bt-process-panel__alert-icon {
flex-shrink: 0;
width: 38rpx;
height: 38rpx;
margin-right: 14rpx;
border-radius: 50%;
background: #e57373;
color: #fff;
font-size: 24rpx;
font-weight: 600;
line-height: 38rpx;
text-align: center;
}
.bt-process-panel__alert-text {
flex: 1;
font-size: 26rpx;
color: #9a5a5a;
line-height: 1.6;
}
.bt-process-panel__actions {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 20rpx;
margin-top: 32rpx;
}
.bt-process-panel__btn {
min-width: 200rpx;
height: 76rpx;
line-height: 76rpx;
padding: 0 40rpx;
text-align: center;
border-radius: 8rpx;
font-size: 28rpx;
font-weight: 500;
color: #fff;
box-sizing: border-box;
}
.bt-process-panel__btn--accent {
background: #5a9a6b;
box-shadow: 0 6rpx 18rpx rgba(90, 154, 107, 0.22);
}
.bt-process-panel__btn--main {
background: #4c97e7;
box-shadow: 0 8rpx 22rpx rgba(76, 151, 231, 0.28);
}
.bt-process-panel__hint {
display: flex;
align-items: center;
justify-content: center;
margin-top: 24rpx;
padding: 0;
font-size: 22rpx;
color: #ababab;
line-height: 1.5;
}
.bt-process-panel__hint-icon {
margin-right: 8rpx;
font-size: 24rpx;
color: #b0b0b0;
}
/* 添加声音选择组件样式 */ /* 添加声音选择组件样式 */
.sound-select { .sound-select {
position: fixed; position: fixed;