diff --git a/pagesA/home/device/status/voice.vue b/pagesA/home/device/status/voice.vue
index 75c10d3..7bf1294 100644
--- a/pagesA/home/device/status/voice.vue
+++ b/pagesA/home/device/status/voice.vue
@@ -701,7 +701,7 @@
try {
// 获取当前的 mp3_list 模型
- const mp3ListModel = this.deviceInfo.thingsModels.find(model => model.id === 'mp3_list');
+ const mp3ListModel = this.deviceInfo.thingsModels.find(model => model.id === '103#mp3List');
if (!mp3ListModel) {
throw new Error('未找到 mp3_list 模型');
}
@@ -799,7 +799,7 @@
}
}
- const playListModel = this.deviceInfo.thingsModels.find(model => model.id === 'play_list');
+ const playListModel = this.deviceInfo.thingsModels.find(model => model.id === '103#playList');
if (playListModel) {
try {
const jsonStr = playListModel.shadow.replace('JSON=', '');
@@ -957,7 +957,7 @@
success: async (res) => {
if (res.confirm) {
const playListModel = this.deviceInfo.thingsModels.find(model => model.id ===
- 'play_list');
+ '103#playList');
if (playListModel) {
try {
const jsonStr = playListModel.shadow.replace('JSON=', '');
@@ -1079,19 +1079,19 @@
if (!this.deviceInfo.thingsModels) return;
// 更新音频开关状态
- const playEnModel = this.deviceInfo.thingsModels.find(model => model.id === 'play_en');
+ const playEnModel = this.deviceInfo.thingsModels.find(model => model.id === '103#playEn');
if (playEnModel) {
this.audioEnabled = playEnModel.shadow === '1';
}
// 更新音量设置
- const volumeModel = this.deviceInfo.thingsModels.find(model => model.id === 'volume');
+ const volumeModel = this.deviceInfo.thingsModels.find(model => model.id === '103#volume');
if (volumeModel) {
this.volume = parseInt(volumeModel.shadow) || 50;
}
// 更新音频列表
- const mp3ListModel = this.deviceInfo.thingsModels.find(model => model.id === 'mp3_list');
+ const mp3ListModel = this.deviceInfo.thingsModels.find(model => model.id === '103#mp3_list');
console.log('mp3ListModel:', mp3ListModel);
if (mp3ListModel && mp3ListModel.shadow) {
@@ -1104,11 +1104,11 @@
console.log('parsed data:', data);
// 获取 mp3_list 数组
- if (data.sound_card && data.sound_card.mp3_list) {
- console.log('mp3_list:', data.sound_card.mp3_list);
+ if (data && data.mp3_list) {
+ console.log('mp3_list:', data.mp3_list);
// 更新音频列表
- this.audioList = data.sound_card.mp3_list.map((item, index) => {
+ this.audioList = data.mp3_list.map((item, index) => {
// 从 "1_def" 格式中提取名称
const name = item.split('_')[1] || item;
console.log('item:', item, 'name:', name);
@@ -1130,14 +1130,14 @@
}
// 更新播放列表
- const playListModel = this.deviceInfo.thingsModels.find(model => model.id === 'play_list');
+ const playListModel = this.deviceInfo.thingsModels.find(model => model.id === '103#playList');
if (playListModel && playListModel.shadow) {
try {
const jsonStr = playListModel.shadow.replace('JSON=', '');
const data = JSON.parse(jsonStr);
- if (data.sound_card && data.sound_card.play_list) {
- this.defaultList = data.sound_card.play_list.map((item, index) => {
+ if (data && data.play_list) {
+ this.defaultList = data.play_list.map((item, index) => {
// 转换时间格式
const beginTime = this.formatSecondsToTime(item.time.begin);
const endTime = this.formatSecondsToTime(item.time.end);
@@ -1181,7 +1181,7 @@
return weekdays;
},
async handleStatusChange(index, value) {
- const playListModel = this.deviceInfo.thingsModels.find(model => model.id === 'play_list');
+ const playListModel = this.deviceInfo.thingsModels.find(model => model.id === '103#playList');
if (playListModel) {
try {
const jsonStr = playListModel.shadow.replace('JSON=', '');
diff --git a/pagesB/user/deviceGroup/index.vue b/pagesB/user/deviceGroup/index.vue
index 7d8f62d..d64c707 100644
--- a/pagesB/user/deviceGroup/index.vue
+++ b/pagesB/user/deviceGroup/index.vue
@@ -62,6 +62,9 @@
+
@@ -70,6 +73,122 @@
+
+
+
+
+
@@ -83,12 +202,21 @@
status: 'loadmore', // 加载更多
dataList: [], // 列表数据
total: 0, // 总条数
+ showAreaControlPopup: false, // 区域控制弹窗显示状态
+ currentGroup: {}, // 当前选中的分组
queryParams: {
pageNum: 1,
pageSize: 10,
userId: 0,
groupName: null,
showDevice: true,
+ },
+ groupVolume: 50,
+ groupAudioEnabled: true,
+ selectedScheme: 'welcome',
+ customAudio: {
+ per: '0',
+ text: ''
}
};
},
@@ -153,6 +281,107 @@
item.userId
});
},
+ // 区域控制
+ handleAreaControl(item) {
+ this.currentGroup = item;
+ this.showAreaControlPopup = true;
+ // 初始化设置值
+ this.groupVolume = 50;
+ this.groupAudioEnabled = true;
+ this.selectedScheme = 'welcome';
+ this.customAudio = {
+ per: '0',
+ text: ''
+ };
+ },
+ // 处理控制操作
+ handleControlAction(action) {
+ const groupName = this.currentGroup.groupName;
+ const deviceCount = this.currentGroup.deviceShortV0List ? this.currentGroup.deviceShortV0List.length : 0;
+
+ switch(action) {
+ case 'all_on':
+ uni.showModal({
+ title: '确认操作',
+ content: `确定要开启分组"${groupName}"中的所有设备吗?`,
+ success: (res) => {
+ if (res.confirm) {
+ this.executeControl('all_on');
+ }
+ }
+ });
+ break;
+ case 'all_off':
+ uni.showModal({
+ title: '确认操作',
+ content: `确定要关闭分组"${groupName}"中的所有设备吗?`,
+ success: (res) => {
+ if (res.confirm) {
+ this.executeControl('all_off');
+ }
+ }
+ });
+ break;
+ }
+ },
+ // 执行控制操作
+ executeControl(action) {
+ // 这里可以调用实际的API接口
+ uni.showLoading({
+ title: '执行中...'
+ });
+
+ // 模拟API调用
+ setTimeout(() => {
+ uni.hideLoading();
+ uni.showToast({
+ title: action === 'all_on' ? '已开启所有设备' : '已关闭所有设备',
+ icon: 'success'
+ });
+ }, 1500);
+ },
+ // 音量变化处理
+ volumeChange(value) {
+ this.groupVolume = value;
+ console.log('音量设置为:', value);
+ },
+ // 音频开关变化处理
+ audioSwitchChange(value) {
+ this.groupAudioEnabled = value;
+ console.log('音频开关设置为:', value);
+ },
+ // 选择音频方案
+ selectScheme(scheme) {
+ this.selectedScheme = scheme;
+ console.log('选择音频方案:', scheme);
+ },
+ // 应用设置
+ applySettings() {
+ uni.showLoading({
+ title: '应用设置中...'
+ });
+
+ // 构建设置数据
+ const settings = {
+ groupId: this.currentGroup.groupId,
+ volume: this.groupVolume,
+ audioEnabled: this.groupAudioEnabled,
+ scheme: this.selectedScheme,
+ customAudio: this.selectedScheme === 'custom' ? this.customAudio : null
+ };
+
+ console.log('应用设置:', settings);
+
+ // 模拟API调用
+ setTimeout(() => {
+ uni.hideLoading();
+ uni.showToast({
+ title: '设置应用成功',
+ icon: 'success'
+ });
+ this.showAreaControlPopup = false;
+ }, 1500);
+ },
// 下拉刷新
onPullDownRefresh() {
this.dataList = [];
@@ -260,6 +489,271 @@
flex-direction: row;
align-items: center;
padding: 0 26rpx 22rpx;
+ flex-wrap: wrap;
+ gap: 8rpx;
+ }
+ }
+ }
+ }
+
+ // 区域控制弹窗样式
+ .area-control-popup {
+ background: #fff;
+ border-radius: 20rpx;
+ overflow: hidden;
+
+ .popup-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 30rpx;
+ border-bottom: 1rpx solid #f0f0f0;
+
+ .popup-title {
+ font-size: 32rpx;
+ font-weight: 600;
+ color: #333;
+ }
+ }
+
+ .popup-content {
+ padding: 30rpx;
+
+ .group-info {
+ margin-bottom: 30rpx;
+ padding: 20rpx;
+ background: #f8f9fa;
+ border-radius: 12rpx;
+
+ .group-name {
+ display: block;
+ font-size: 28rpx;
+ font-weight: 600;
+ color: #333;
+ margin-bottom: 10rpx;
+ }
+
+ .device-count {
+ font-size: 24rpx;
+ color: #666;
+ }
+ }
+
+ .basic-settings {
+ margin-bottom: 30rpx;
+
+ .setting-title {
+ font-size: 28rpx;
+ font-weight: 600;
+ color: #333;
+ margin-bottom: 20rpx;
+ }
+
+ .volume-slider {
+ display: flex;
+ align-items: center;
+ margin-bottom: 20rpx;
+ padding: 16rpx 0;
+
+ .volume-icon {
+ margin-right: 20rpx;
+ }
+
+ .slider-container {
+ flex: 1;
+ margin-right: 20rpx;
+
+ .volume-marks {
+ display: flex;
+ justify-content: space-between;
+ margin-top: 10rpx;
+ font-size: 22rpx;
+ color: #999;
+ }
+ }
+
+ .volume-value {
+ min-width: 60rpx;
+ text-align: right;
+ font-size: 24rpx;
+ color: #2979ff;
+ font-weight: 500;
+ }
+ }
+
+ .audio-switch {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 20rpx;
+ padding: 16rpx 0;
+
+ text {
+ font-size: 28rpx;
+ color: #333;
+ }
+ }
+ }
+
+ .audio-scheme {
+ margin-bottom: 30rpx;
+
+ .setting-title {
+ font-size: 28rpx;
+ font-weight: 600;
+ color: #333;
+ margin-bottom: 20rpx;
+ }
+
+ .scheme-options {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 16rpx;
+ margin-bottom: 20rpx;
+
+ .scheme-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 20rpx 16rpx;
+ background: #f8f9fa;
+ border-radius: 12rpx;
+ border: 2rpx solid transparent;
+ transition: all 0.3s;
+
+ &:active {
+ background: #e9ecef;
+ border-color: #839FFF;
+ }
+
+ text {
+ margin-top: 10rpx;
+ font-size: 24rpx;
+ color: #333;
+ }
+
+ &.active {
+ background: #e8f2ff;
+ border-color: #839FFF;
+ }
+ }
+ }
+ }
+
+ .custom-audio {
+ margin-top: 20rpx;
+ padding: 20rpx;
+ background: #f8f9fa;
+ border-radius: 12rpx;
+
+ .custom-form {
+ .form-item {
+ margin-bottom: 20rpx;
+
+ .label {
+ display: block;
+ font-size: 26rpx;
+ font-weight: 600;
+ color: #333;
+ margin-bottom: 12rpx;
+ }
+
+ .radio-group {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: 12rpx;
+
+ .radio-item {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ padding: 12rpx 16rpx;
+ background: #fff;
+ border-radius: 8rpx;
+ border: 2rpx solid transparent;
+ transition: all 0.3s;
+
+ &:active {
+ background: #f0f0f0;
+ }
+
+ text {
+ font-size: 24rpx;
+ color: #333;
+ }
+
+ &.active {
+ background: #e8f2ff;
+ border-color: #839FFF;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ .control-actions {
+ margin-bottom: 30rpx;
+
+ .setting-title {
+ font-size: 28rpx;
+ font-weight: 600;
+ color: #333;
+ margin-bottom: 20rpx;
+ }
+
+ .action-buttons {
+ display: flex;
+ gap: 16rpx;
+
+ .action-btn {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 20rpx 16rpx;
+ border-radius: 12rpx;
+ transition: all 0.3s;
+
+ text {
+ margin-top: 8rpx;
+ font-size: 24rpx;
+ color: #fff;
+ }
+
+ &.primary {
+ background: #0BD800;
+
+ &:active {
+ background: #09b800;
+ }
+ }
+
+ &.danger {
+ background: #FF6B35;
+
+ &:active {
+ background: #e65a25;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ .popup-footer {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 30rpx;
+ border-top: 1rpx solid #f0f0f0;
+
+ .u-button {
+ flex: 1;
+ margin-right: 20rpx;
+
+ &:last-child {
+ margin-right: 0;
}
}
}