Skip to content

Commit 7f8c37b

Browse files
committed
2点多余代码
1 parent 291af4e commit 7f8c37b

File tree

4 files changed

+18
-56
lines changed

4 files changed

+18
-56
lines changed

src/App.vue

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,8 @@
3131
</el-row>
3232
</div>
3333
</template>
34-
<style>
35-
.LeftMain {
36-
width: 100%;
37-
height: auto;
38-
}
39-
40-
.el-row {
41-
margin-bottom: 0px;
42-
}
43-
</style>
4434

4535
<script lang="ts">
46-
4736
export default {
4837
name: 'App',
4938
components: {
@@ -53,23 +42,14 @@ export default {
5342
OSChart,
5443
}
5544
}
56-
5745
</script>
58-
5946
<script setup lang="ts">
6047
import { ref } from 'vue'
6148
import { onMounted } from 'vue'
6249
import WaveGen from './components/WaveGen.vue'
6350
import WaveGenChart from './components/WaveGenChart.vue'
6451
import OSChart from './components/OSChart.vue'
6552
import socket from './script/websocket'
66-
// import {
67-
// ElNotification,
68-
// ElRow,
69-
// ElCol,
70-
// ElSwitch,
71-
// ElFormItem
72-
// } from 'element-plus'
7353
7454
// 自动切换暗黑模式
7555
import { useDark, useToggle } from '@vueuse/core'
@@ -96,7 +76,7 @@ function receiveMessage(message: any) {
9676
if (message.data[0] == '{' && message.data[2] == 'a') {
9777
var data = JSON.parse(message.data);
9878
OSChart.refreshData(data);
99-
} else if(message.data[0] == '{' && message.data[2] == 'p'){
79+
} else if (message.data[0] == '{' && message.data[2] == 'p') {
10080
var data = JSON.parse(message.data);
10181
console.log(data.param);
10282
WaveGen.changeParam(data.param);
@@ -111,5 +91,15 @@ onMounted(() => {
11191
UseDarkMode();
11292
switchVal.value = isDark.value;
11393
});
114-
11594
</script>
95+
96+
<style>
97+
.LeftMain {
98+
width: 100%;
99+
height: auto;
100+
}
101+
102+
.el-row {
103+
margin-bottom: 0px;
104+
}
105+
</style>

src/components/OSChart.vue

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ function OSCStop() {
4141
isRun = false;
4242
sendData("CF");
4343
};
44-
4544
function generateData() {
4645
let data = [];
4746
if (OSCData.length < 10) {
@@ -56,7 +55,6 @@ function generateData() {
5655
}
5756
return data;
5857
}
59-
6058
option = {
6159
backgroundColor: '',
6260
animation: false,
@@ -154,7 +152,6 @@ function darkMode(isDark: boolean) {
154152
]
155153
});
156154
}
157-
158155
const sendData = (data: string) => {
159156
if (socket.socket_open) {
160157
socket.send(data);
@@ -195,10 +192,7 @@ export default {
195192
option: Object
196193
}
197194
}
198-
199195
</script>
200-
201-
202196
<script lang="ts" setup>
203197
import * as echarts from 'echarts/core';
204198
import {
@@ -218,7 +212,6 @@ import { onMounted } from 'vue';
218212
import { EChartsType } from 'echarts/core';
219213
import socket from '../script/websocket'
220214
221-
222215
import {
223216
// ElFormItem,
224217
// ElInputNumber,
@@ -236,7 +229,6 @@ echarts.use([
236229
UniversalTransition
237230
]);
238231
239-
240232
// 2.定义传入的参数
241233
const props = defineProps({
242234
width: {
@@ -259,8 +251,6 @@ const props = defineProps({
259251
},
260252
});
261253
262-
263-
264254
onMounted(() => {
265255
chartDom = document.getElementById(props.container) as HTMLElement
266256
myChart = echarts.init(chartDom);
@@ -269,7 +259,6 @@ onMounted(() => {
269259
270260
</script>
271261

272-
273262
<style>
274263
.OSChart {
275264
margin: 0 auto;

src/components/WaveGen.vue

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
import { ref } from "vue";
4040
const formSize = ref('large')
4141
const labelPosition = ref('right')
42-
4342
const waveType = ref("1")
4443
const freq = ref(100)
4544
const duty = ref(50)
@@ -97,15 +96,16 @@ const freqChange = (value: number) => {
9796
const dutyChange = (value: number) => {
9897
console.log(value);
9998
form.duty = value;
100-
sendData("D"+value);
99+
sendData("D" + value);
101100
}
102101
const uMaxValueChange = (value: number) => {
103102
console.log(value);
104-
sendData("U"+value);
103+
form.uMaxValue = value;
104+
sendData("U" + value);
105105
}
106106
const biasChange = (value: number) => {
107107
console.log(value);
108-
sendData("B"+value);
108+
sendData("B" + value);
109109
}
110110
export default {
111111
name: "WaveGen",
@@ -121,18 +121,7 @@ export default {
121121
}
122122
</script>
123123
<script setup lang="ts">
124-
import {
125-
// ElForm,
126-
// ElFormItem,
127-
// ElButton,
128-
// ElOption,
129-
// ElInputNumber,
130-
ElMessage,
131-
// ElSelect,
132-
// ElSlider,
133-
// ElSwitch,
134-
} from 'element-plus'
135-
124+
import { ElMessage } from 'element-plus'
136125
import { reactive } from 'vue'
137126
import WaveGenChart from './WaveGenChart.vue'
138127
import socket from '../script/websocket'
@@ -141,8 +130,6 @@ defineProps<{ msg: string }>();
141130
142131
</script>
143132

144-
145-
146133
<style>
147134
.waveGen {
148135
width: 55%;

src/components/WaveGenChart.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@ type EChartsOption = echarts.ComposeOption<
2626
var option: EChartsOption;
2727
var myChart: EChartsType;
2828
var chartDom: HTMLElement;
29-
30-
3129
// 绘制预览波形相关变量及函数
3230
var start = true;
3331
let uMaxValue = 3.3; //峰峰值
3432
let offSetValue = 1.65 //偏置电压
3533
let duty = 50; //占空比%(方波)
3634
let wave = 1; //波形种类
3735
let samplePerCycle = 256;
38-
//定义板载8位DAC输出的对应值
36+
// 定义波形预览数组
3937
var waveTab1 = new Array();
4038
var waveTab = new Array();
4139
@@ -205,7 +203,6 @@ option = {
205203
export default {
206204
name: "WaveGenChart",
207205
option,
208-
//myChart,
209206
uMaxValue,
210207
offSetValue,
211208
duty,
@@ -260,7 +257,6 @@ onMounted(() => {
260257
wave_gen(1);
261258
chartDom = document.getElementById(props.container) as HTMLElement
262259
myChart = echarts.init(chartDom);
263-
//option.series[0].data = generateData(); // 搞不明白为啥报错,但能用
264260
option && myChart.setOption(option);
265261
});
266262
</script>

0 commit comments

Comments
 (0)