Skip to content

Commit 07e81cb

Browse files
committed
v2.04
1 parent 409c308 commit 07e81cb

8 files changed

Lines changed: 110 additions & 200 deletions

File tree

js/background.js

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -34,54 +34,3 @@ chrome.alarms.onAlarm.addListener(() => {
3434
const minute = date.getMinutes();
3535
noticeAlert(hour, minute);
3636
});
37-
38-
function request_proxy({ url, method, data }) {
39-
const XHR = new XMLHttpRequest();
40-
XHR.open(method, url);
41-
XHR.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
42-
XHR.send(data);
43-
XHR.onreadystatechange = function () {
44-
if (XHR.readyState === 4) {
45-
console.log(XHR.responseText);
46-
}
47-
};
48-
}
49-
50-
const wbSpiderConfig = {};
51-
52-
chrome.storage.onChanged.addListener((changes, namespace) => {
53-
console.log("change ======");
54-
for (const [key, { oldValue, newValue }] of Object.entries(changes)) {
55-
console.log("change key", key, newValue);
56-
if (key === "wbSpider" || key === "wbSpiderStart") {
57-
if (key === "wbSpider") {
58-
wbSpiderConfig.url = newValue;
59-
} else if (key === "wbSpiderStart") {
60-
wbSpiderConfig.start = newValue;
61-
}
62-
}
63-
console.log(wbSpiderConfig);
64-
}
65-
});
66-
67-
chrome.runtime.onMessage.addListener((data, sender, sendResponse) => {
68-
console.log(data, wbSpiderConfig);
69-
if (wbSpiderConfig.url !== "" && wbSpiderConfig.start) {
70-
fetch(wbSpiderConfig.url, {
71-
method: "POST",
72-
body: JSON.stringify(data),
73-
headers: {
74-
"Content-Type": "application/json;charset=UTF-8",
75-
},
76-
})
77-
.then((resp) => {
78-
console.log(resp);
79-
sendResponse({ code: 200 });
80-
})
81-
.catch((err) => {
82-
console.log(err);
83-
sendResponse({ code: 500 });
84-
});
85-
}
86-
sendResponse({ code: 200 });
87-
});

manifest.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
{
22
"name": "dev-tool",
33
"description": "a dev-tool for chrome extension",
4-
"version": "2.0.3",
4+
"version": "2.0.4",
55
"manifest_version": 3,
66
"permissions": [
77
"alarms",
88
"notifications",
99
"webRequest",
1010
"storage",
11-
"nativeMessaging",
12-
"http://*/"
11+
"nativeMessaging"
1312
],
1413
"background": {
1514
"service_worker": "js/background.js"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dev-tool",
3-
"version": "0.0.0",
3+
"version": "2.0.4",
44
"scripts": {
55
"dev": "vite",
66
"build": "vite build",

src/App.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
<el-tab-pane label="HtmlShow" v-if="isFull" name="HtmlShow"
3838
><HtmlShow
3939
/></el-tab-pane>
40-
<el-tab-pane label="设置" name="setting"><Setting /></el-tab-pane>
4140
</el-tabs>
4241
</div>
4342
</template>
@@ -51,8 +50,8 @@ import HtmlShow from "./components/Html.vue";
5150
import Link from "./components/Link.vue";
5251
import SqlToModel from "./components/SqlToModel.vue";
5352
import Notice from "./components/Notice.vue";
54-
import Setting from "./components/Setting.vue";
5553
import JsonStuff from "./components/JsonStuff.vue";
54+
5655
const lastClickTabStorage = "last:click";
5756
5857
export default {
@@ -89,7 +88,6 @@ export default {
8988
SqlToModel,
9089
Notice,
9190
JsonStuff,
92-
Setting,
9391
},
9492
};
9593
</script>
@@ -103,7 +101,7 @@ export default {
103101
color: #2c3e50;
104102
}
105103
.fixedWidth {
106-
width: 700px;
104+
width: 800px;
107105
}
108106
.fullWidth {
109107
width: 100%;

src/components/Cal.vue

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,18 @@
99
placeholder="请输入值1"
1010
>
1111
</el-input>
12-
<el-select
13-
@change="calResult"
14-
size="mini"
15-
class="cal-type"
12+
<el-radio-group
1613
v-model="cal_type"
17-
placeholder="请选择"
14+
size="small"
15+
style="width: 200px"
16+
@input="calResult"
1817
>
19-
<el-option
20-
v-for="item in cal_options"
21-
:key="item.value"
22-
:label="item.label"
23-
:value="item.value"
24-
>
25-
</el-option>
26-
</el-select>
18+
<el-radio-button
19+
:label="value.label"
20+
v-for="(value, index) in cal_options"
21+
:key="index"
22+
></el-radio-button>
23+
</el-radio-group>
2724
<el-input
2825
@input="calResult"
2926
size="mini"
@@ -53,7 +50,7 @@ export default {
5350
result: "",
5451
value1: "",
5552
value2: "",
56-
cal_type: 1,
53+
cal_type: "/",
5754
cal_options: [
5855
{
5956
label: "+",
@@ -80,15 +77,15 @@ export default {
8077
},
8178
methods: {
8279
calResult() {
83-
if (this.cal_type === 1) {
80+
if (this.cal_type === "+") {
8481
this.result = Number(this.value1) + Number(this.value2);
85-
} else if (this.cal_type === 2) {
82+
} else if (this.cal_type === "-") {
8683
this.result = Number(this.value1) - Number(this.value2);
87-
} else if (this.cal_type === 3) {
84+
} else if (this.cal_type === "x") {
8885
this.result = Number(this.value1) * Number(this.value2);
89-
} else if (this.cal_type === 4) {
86+
} else if (this.cal_type === "/") {
9087
this.result = Number(this.value1) / Number(this.value2);
91-
} else if (this.cal_type === 5) {
88+
} else if (this.cal_type === "%") {
9289
this.result = Number(this.value1) % Number(this.value2);
9390
}
9491
},

src/components/JsonStuff.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<script>
4545
import jsonFormate from "../utils/json-format";
4646
import { jsonToGo } from "../utils/json-to-go";
47-
47+
import { structStrToJson } from "../utils/go/structToJson";
4848
export default {
4949
props: {
5050
isFull: Boolean,
@@ -68,6 +68,10 @@ export default {
6868
type: 3,
6969
name: "json转table (输入json数组)",
7070
},
71+
// {
72+
// type: 4,
73+
// name: "go struct to json",
74+
// },
7175
],
7276
};
7377
},
@@ -83,9 +87,16 @@ export default {
8387
} else if (mode === 3) {
8488
this.nowMode = 3;
8589
this.doJsonToTable();
90+
} else if (mode === 4) {
91+
this.nowMode = 4;
92+
this.doGoStructToJson();
8693
}
8794
}
8895
},
96+
doGoStructToJson() {
97+
const goObj = structStrToJson(this.userInputJson);
98+
this.showJson = goObj.go;
99+
},
89100
doJsonFormat(type) {
90101
let obj;
91102
try {

src/components/Setting.vue

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)