提交 bd0e31b3 编写于 作者: B baiy 提交者: ninecents

#67 fix

上级 0f7b5306
{
"name": "c-tool",
"version": "1.7.5",
"version": "1.7.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -2150,6 +2150,11 @@
}
}
},
"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": {
"version": "6.26.0",
"resolved": "https://registry.npm.taobao.org/babel-code-frame/download/babel-code-frame-6.26.0.tgz",
......
{
"name": "c-tool",
"version": "1.7.6",
"version": "1.7.7",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --port 8081",
......@@ -9,6 +9,7 @@
},
"dependencies": {
"axios": "^0.21.4",
"axios-jsonp": "^1.0.4",
"babel-runtime": "^6.26.0",
"code-formatter": "0.0.1",
"cron-parser": "^2.16.3",
......
......@@ -11,7 +11,8 @@
</ButtonGroup>
</FormItem>
<FormItem>
<Alert>ip信息来源 <a href="https://ifconfig.co/json" target="_blank">https://ifconfig.co/json</a></Alert>
<Alert v-if="!isWeb">ip信息来源 <a href="https://ifconfig.co/json" target="_blank">https://ifconfig.co/json</a></Alert>
<Alert v-else>ip信息来源 <a href="https://whois.pconline.com.cn/" target="_blank">https://whois.pconline.com.cn/</a></Alert>
</FormItem>
</option-block>
<div style="border: 1px solid #dcdee2;border-radius: 4px;">
......@@ -21,6 +22,7 @@
</template>
<script>
import axios from "axios"
import axiosJsonp from 'axios-jsonp';
import {codemirror} from 'vue-codemirror'
import 'codemirror/lib/codemirror.css'
import 'codemirror/mode/javascript/javascript.js'
......@@ -29,6 +31,7 @@ import 'codemirror/addon/fold/foldgutter.js'
import 'codemirror/addon/fold/brace-fold.js'
import 'codemirror/addon/fold/comment-fold.js'
import 'codemirror/addon/fold/foldgutter.css'
import {isWeb} from "../../helper"
export default {
components: {
......@@ -48,16 +51,30 @@ export default {
methods: {
handle() {
if (this.current.input) {
axios({
url: 'https://ifconfig.co/json',
responseType: 'json',
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);
});
if (!this.isWeb){
axios({
url: 'https://ifconfig.co/json',
responseType: 'json',
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);
});
}
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() {
......@@ -79,7 +96,8 @@ export default {
indentUnit: 4,
gutters: ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
},
isWeb: isWeb
}
},
}
</script>
\ No newline at end of file
</script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册