Showing
1 changed file
with
11 additions
and
12 deletions
@@ -62,7 +62,7 @@ | @@ -62,7 +62,7 @@ | ||
62 | <u-radio activeColor="#3388FF" label="双向" name="TwoWay"></u-radio> | 62 | <u-radio activeColor="#3388FF" label="双向" name="TwoWay"></u-radio> |
63 | </u-radio-group> | 63 | </u-radio-group> |
64 | </view> | 64 | </view> |
65 | - <view style="margin-top: 28rpx;width: 100%;"><u--textarea placeholder="请输入下发内容" v-model="commandValue" /></view> | 65 | + <view style="margin-top: 28rpx;width: 100%;"><u--textarea placeholder="请输入下发内容(json格式)" v-model="inputCommandVal" /></view> |
66 | 66 | ||
67 | <view class="button-group"> | 67 | <view class="button-group"> |
68 | <view><u-button :customStyle="{ color: '#333' }" color="#e3e3e5" shape="circle" text="取消" @click="cancelCommand"></u-button></view> | 68 | <view><u-button :customStyle="{ color: '#333' }" color="#e3e3e5" shape="circle" text="取消" @click="cancelCommand"></u-button></view> |
@@ -87,13 +87,8 @@ export default { | @@ -87,13 +87,8 @@ export default { | ||
87 | return { | 87 | return { |
88 | showModel: false, | 88 | showModel: false, |
89 | commandType: 'OneWay', | 89 | commandType: 'OneWay', |
90 | - commandValue: JSON.stringify({ | ||
91 | - method: 'methodThingskit', | ||
92 | - params: { | ||
93 | - method: 'methodThingskit', | ||
94 | - params: { pin: 7, value: 1 } | ||
95 | - } | ||
96 | - }) | 90 | + commandValue: {}, |
91 | + inputCommandVal: '' | ||
97 | }; | 92 | }; |
98 | }, | 93 | }, |
99 | computed: { | 94 | computed: { |
@@ -139,12 +134,16 @@ export default { | @@ -139,12 +134,16 @@ export default { | ||
139 | }, | 134 | }, |
140 | async confirmCommand() { | 135 | async confirmCommand() { |
141 | try { | 136 | try { |
142 | - const commandValue = JSON.parse(this.commandValue); | ||
143 | - commandValue.persistent = true; | ||
144 | - commandValue.additionalInfo = { | 137 | + const commandJsonValue = JSON.parse(this.inputCommandVal); |
138 | + this.commandValue.persistent = true; | ||
139 | + this.commandValue.additionalInfo = { | ||
145 | cmdType: 'API' | 140 | cmdType: 'API' |
146 | }; | 141 | }; |
147 | - await issueCommand(this.commandType, this.deviceDetail.tbDeviceId, commandValue); | 142 | + this.commandValue.method = 'methodThingskit'; |
143 | + this.commandValue.params = { | ||
144 | + params: commandJsonValue | ||
145 | + }; | ||
146 | + await issueCommand(this.commandType, this.deviceDetail.tbDeviceId, this.commandValue); | ||
148 | this.hiddenModal(); | 147 | this.hiddenModal(); |
149 | uni.$u.toast('下发成功~'); | 148 | uni.$u.toast('下发成功~'); |
150 | } catch (e) { | 149 | } catch (e) { |