提交 352ee666 编写于 作者: B baiy 提交者: ninecents

替换ip查询接口

上级 bd0e31b3
{ {
"name": "c-tool", "name": "c-tool",
"version": "1.7.6", "version": "1.7.7",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
...@@ -2150,11 +2150,6 @@ ...@@ -2150,11 +2150,6 @@
} }
} }
}, },
"axios-jsonp": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/axios-jsonp/-/axios-jsonp-1.0.4.tgz",
"integrity": "sha512-KI5Fc4ery6DR+oneXG09hPZfGuNUW8Lblhe750h53Z0Eh5MRsrHn49YitDU4RsMk0HV+12zcvL2Q51QkOLGdIQ=="
},
"babel-code-frame": { "babel-code-frame": {
"version": "6.26.0", "version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-code-frame/download/babel-code-frame-6.26.0.tgz", "resolved": "https://registry.npm.taobao.org/babel-code-frame/download/babel-code-frame-6.26.0.tgz",
......
{ {
"name": "c-tool", "name": "c-tool",
"version": "1.7.7", "version": "1.7.8",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve --port 8081", "serve": "vue-cli-service serve --port 8081",
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.21.4", "axios": "^0.21.4",
"axios-jsonp": "^1.0.4",
"babel-runtime": "^6.26.0", "babel-runtime": "^6.26.0",
"code-formatter": "0.0.1", "code-formatter": "0.0.1",
"cron-parser": "^2.16.3", "cron-parser": "^2.16.3",
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"clipboardRead" "clipboardRead"
], ],
"host_permissions": [ "host_permissions": [
"*://ifconfig.co/*", "*://get.geojs.io/*",
"*://*.baiy.org/*" "*://*.baiy.org/*"
], ],
"commands": { "commands": {
...@@ -35,4 +35,4 @@ ...@@ -35,4 +35,4 @@
} }
}, },
"update_url": "http://clients2.google.com/service/update2/crx" "update_url": "http://clients2.google.com/service/update2/crx"
} }
\ No newline at end of file
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"clipboardRead" "clipboardRead"
], ],
"host_permissions": [ "host_permissions": [
"*://ifconfig.co/*", "*://get.geojs.io/*",
"*://*.baiy.org/*" "*://*.baiy.org/*"
], ],
"commands": { "commands": {
...@@ -34,4 +34,4 @@ ...@@ -34,4 +34,4 @@
"global": true "global": true
} }
} }
} }
\ No newline at end of file
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
</ButtonGroup> </ButtonGroup>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Alert v-if="!isWeb">ip信息来源 <a href="https://ifconfig.co/json" target="_blank">https://ifconfig.co/json</a></Alert> <Alert>ip信息来源 <a href="https://get.geojs.io/" target="_blank">https://get.geojs.io/</a></Alert>
<Alert v-else>ip信息来源 <a href="https://whois.pconline.com.cn/" target="_blank">https://whois.pconline.com.cn/</a></Alert>
</FormItem> </FormItem>
</option-block> </option-block>
<div style="border: 1px solid #dcdee2;border-radius: 4px;"> <div style="border: 1px solid #dcdee2;border-radius: 4px;">
...@@ -22,7 +21,7 @@ ...@@ -22,7 +21,7 @@
</template> </template>
<script> <script>
import axios from "axios" import axios from "axios"
import axiosJsonp from 'axios-jsonp'; import _ from "lodash"
import {codemirror} from 'vue-codemirror' import {codemirror} from 'vue-codemirror'
import 'codemirror/lib/codemirror.css' import 'codemirror/lib/codemirror.css'
import 'codemirror/mode/javascript/javascript.js' import 'codemirror/mode/javascript/javascript.js'
...@@ -31,7 +30,6 @@ import 'codemirror/addon/fold/foldgutter.js' ...@@ -31,7 +30,6 @@ import 'codemirror/addon/fold/foldgutter.js'
import 'codemirror/addon/fold/brace-fold.js' import 'codemirror/addon/fold/brace-fold.js'
import 'codemirror/addon/fold/comment-fold.js' import 'codemirror/addon/fold/comment-fold.js'
import 'codemirror/addon/fold/foldgutter.css' import 'codemirror/addon/fold/foldgutter.css'
import {isWeb} from "../../helper"
export default { export default {
components: { components: {
...@@ -51,30 +49,15 @@ export default { ...@@ -51,30 +49,15 @@ export default {
methods: { methods: {
handle() { handle() {
if (this.current.input) { if (this.current.input) {
if (!this.isWeb){ axios({
axios({ url: 'https://get.geojs.io/v1/ip/geo.json',
url: 'https://ifconfig.co/json', params: this.current.input !== "localhost" ? {ip: this.current.input} : {}
responseType: 'json', }).then(({data}) => {
params: this.current.input !== "localhost" ? {ip: this.current.input} : {} this.current.output = JSON.stringify(_.isArray(data) && data.length < 2 ? data[0] : data,null, 4);
}).then(({data}) => { this.$saveToolData(this.current);
this.current.output = JSON.stringify(data, null, 4); }).catch((error) => {
this.$saveToolData(this.current); return this.$Message.error("ip地址信息查询错误:" + error);
}).catch((error) => { });
return this.$Message.error("ip地址信息查询错误:" + error);
});
}
else{
axios({
url: 'https://whois.pconline.com.cn/ipJson.jsp',
adapter: axiosJsonp,
params: this.current.input !== "localhost" ? {ip: this.current.input} : {},
}).then(({data}) => {
this.current.output = JSON.stringify(data, null, 4);
this.$saveToolData(this.current);
}).catch((error) => {
return this.$Message.error("ip地址信息查询错误:" + error);
});
}
} }
}, },
local() { local() {
...@@ -95,8 +78,7 @@ export default { ...@@ -95,8 +78,7 @@ export default {
foldGutter: true, foldGutter: true,
indentUnit: 4, indentUnit: 4,
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'], gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
}, }
isWeb: isWeb
} }
}, },
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册