Przeglądaj źródła

1.修改后台序列化对象为字符串后在输出

2.完善web功能界面
3.修改文档
pull/3/head
smallchi 5 lat temu
rodzic
commit
ee0b9321b8
5 zmienionych plików z 106 dodań i 82 usunięć
  1. +1
    -1
      README.md
  2. +10
    -3
      src/JTTools/Controllers/JTToolsController.cs
  3. +1
    -1
      src/JTTools/Dtos/JTResultDto.cs
  4. +1
    -0
      src/JTTools/Program.cs
  5. +93
    -77
      src/ui/index.html

+ 1
- 1
README.md Wyświetl plik

@@ -2,7 +2,7 @@

JT808、JT809、JT1078、JTNE解析工具

[在线解析工具](http://jttools.smallchi.cn)
<a href="http://jttools.smallchi.cn" target="_blank">在线解析工具</a>

使用nodejs的PM2托管应用程序



+ 10
- 3
src/JTTools/Controllers/JTToolsController.cs Wyświetl plik

@@ -14,6 +14,7 @@ using JT808.Protocol.Interfaces;
using JT808.Protocol.Extensions;
using JT808.Protocol.Exceptions;
using Microsoft.AspNetCore.Cors;
using Newtonsoft.Json;

namespace JTTools.Controllers
{
@@ -26,6 +27,12 @@ namespace JTTools.Controllers
private readonly IJT808Config jT808Config;
private readonly JT808Serializer jT808Serializer;
private readonly JT809Serializer jT809Serializer;
private static Newtonsoft.Json.JsonSerializerSettings setting = new Newtonsoft.Json.JsonSerializerSettings();
static JTToolsController()
{
setting.Formatting = Formatting.Indented;
setting.Converters.Add(new ByteArrayHexConverter());
}
public JTToolsController(
IJT809Config jT809Config,
IJT808Config jT808Config)
@@ -44,7 +51,7 @@ namespace JTTools.Controllers
try
{
jTResultDto.Code = 200;
jTResultDto.Data = jT808Serializer.Deserialize(parameter.HexData.ToHexBytes());
jTResultDto.Data =JsonConvert.SerializeObject(jT808Serializer.Deserialize(parameter.HexData.ToHexBytes()), setting);
}
catch(JT808Exception ex)
{
@@ -67,7 +74,7 @@ namespace JTTools.Controllers
try
{
jTResultDto.Code = 200;
jTResultDto.Data = jT809Serializer.Deserialize(parameter.HexData.ToHexBytes());
jTResultDto.Data = JsonConvert.SerializeObject(jT809Serializer.Deserialize(parameter.HexData.ToHexBytes()), setting);
}
catch (JT809Exception ex)
{
@@ -90,7 +97,7 @@ namespace JTTools.Controllers
try
{
jTResultDto.Code = 200;
jTResultDto.Data = JT1078Serializer.Deserialize(parameter.HexData.ToHexBytes());
jTResultDto.Data = JsonConvert.SerializeObject(JT1078Serializer.Deserialize(parameter.HexData.ToHexBytes()), setting);
}
catch (Exception ex)
{


+ 1
- 1
src/JTTools/Dtos/JTResultDto.cs Wyświetl plik

@@ -9,6 +9,6 @@ namespace JTTools.Dtos
{
public int Code { get; set; }
public string Message { get; set; }
public object Data { get; set; }
public string Data { get; set; }
}
}

+ 1
- 0
src/JTTools/Program.cs Wyświetl plik

@@ -48,6 +48,7 @@ namespace JTTools
{
jsonOptions.SerializerSettings.Converters.Add(new ByteArrayHexConverter());
jsonOptions.SerializerSettings.ContractResolver = new DefaultContractResolver();
//jsonOptions.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;
})
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddCors(options =>


+ 93
- 77
src/ui/index.html Wyświetl plik

@@ -1,8 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JTTools解析工具</title>
<meta charset="utf-8">
<meta name="keywords" content="JT808|gb808|JT809|gb809|JT1078|JTT1078|在线解析工具">
<meta name=”description” content="道路运输车辆卫星定位协议在线解析工具">
<!-- import Vue.js -->
<script src="//vuejs.org/js/vue.min.js"></script>
<!-- import stylesheet -->
@@ -15,81 +17,87 @@
.pane-content{
width: 100%;
display: flex;
display: -webkit-flex;
align-items:center;
justify-content:center;
height: calc(100vh - 60px);
padding: 10px 20px;
display: -webkit-flex;
align-items:center;
justify-content:center;
height: calc(100vh - 60px);
padding: 10px 20px;
}
.left,.right{
width: 45%;
height: 100%;
display: inline-block;
height: 100%;
display: inline-block;
}
.center{
width: 10%;
display: flex;
display: -webkit-flex;
align-items: center;
justify-content: center;
display: -webkit-flex;
align-items: center;
justify-content: center;
}
textarea.ivu-input {
max-height: 100%;
min-height: 32px;
height: 100%;
}
.ivu-input-wrapper{
height: 100%;
}
@media (max-width:1024px){
.left,.right{
width: 40%;
}
.center{
width: 20%;
max-height: 100%;
min-height: 32px;
height: 100%;
}
}
.ivu-input-wrapper{
height: 100%;
}
@media (max-width:1024px){
.left,.right{
width: 40%;
}
.center{
width: 20%;
}
}
</style>
</head>
<body>
<div id="app">
<tabs value="name1">
<tab-pane label="JT808解析工具" name="name1" >
<div class="pane-content" >
<div class="left" >
<i-input type="textarea" placeholder="Enter something..." />
<div class="pane-content">
<div class="left">
<i-input v-model="parse808Parameter.HexData" type="textarea" placeholder="Enter Hex Data..." />
</div>
<div class="center" >
<i-button type="primary">Primary</i-button>
<div class="center">
<i-button @click="parse808Click" type="primary">
<Icon type="ios-arrow-forward"/>
</i-button>
</div>
<div class="right" >
<i-input type="textarea" placeholder="Enter something..." />
<div class="right">
<i-input v-model="parse808Result" type="textarea"/>
</div>
</div>
</tab-pane>
<tab-pane label="JT809解析工具" name="name2">
<div class="pane-content" >
<div class="left" >
<i-input type="textarea" placeholder="Enter something..." />
<i-input v-model="parse809Parameter.HexData" type="textarea" placeholder="Enter Hex Data..." />
</div>
<div class="center" >
<i-button type="primary">Primary2</i-button>
<i-button @click="parse809Click" type="primary">
<Icon type="ios-arrow-forward"/>
</i-button>
</div>
<div class="right" >
<i-input type="textarea" placeholder="Enter something..." />
<i-input v-model="parse809Result" type="textarea"/>
</div>
</div>
</tab-pane>
<tab-pane label="JT1078解析工具" name="name3">
<div class="pane-content" >
<div class="left" >
<i-input type="textarea" placeholder="Enter something..." />
<i-input v-model="parse1078Parameter.HexData" type="textarea" placeholder="Enter Hex Data..." />
</div>
<div class="center" >
<i-button type="primary">Primary3</i-button>
<i-button @click="parse1078Click" type="primary">
<Icon type="ios-arrow-forward"/>
</i-button>
</div>
<div class="right" >
<i-input type="textarea" placeholder="Enter something..." />
<i-input v-model="parse1078Result" type="textarea"/>
</div>
</div>
</tab-pane>
@@ -99,65 +107,73 @@
new Vue({
el: '#app',
data: {
loading: false,
parse808Parameter:{
HexData:"",
},
parse809Parameter:{
HexData:"",
},
parse1078Parameter:{
HexData:"",
},
parse808Result:"",
parse809Result:"",
parse1078Result:"",
},
mounted:function(){

},
methods: {
Api:{
parse808:function(){
this.loading=true;
axios.post('http://jttools.smallchi.cn/api/JTTools/Parse808',this.queryParameter)
parse808Click:function(){
if(!this.parse808Parameter) return;
this.$Loading.start();
axios.post('http://jttools.smallchi.cn/api/JTTools/Parse808',this.parse808Parameter)
.then((response)=>{
if(response.data=="" || response.data==null){
this.queryData=[];
this.loading=false;
return;
if(response.data.Code===200){
this.parse808Result=response.data.Data;
}else{
this.parse808Result=response.data.Message;
}
this.queryData=response.data;
this.loading=false;
this.$Loading.finish();
})
.catch((error)=>{
this.queryError=error;
this.loading=false;
this.parse808Result=JSON.stringify(error);
this.$Loading.error();
});
},
parse809:function(){
this.loading=true;
axios.post('http://jttools.smallchi.cn/api/JTTools/Parse809',this.queryParameter)
},
parse809Click:function(){
if(!this.parse809Parameter) return;
this.$Loading.start();
axios.post('http://jttools.smallchi.cn/api/JTTools/Parse809',this.parse809Parameter)
.then((response)=>{
if(response.data=="" || response.data==null){
this.queryData=[];
this.loading=false;
return;
if(response.data.Code===200){
this.parse809Result=response.data.Data;
}else{
this.parse809Result=response.data.Message;
}
this.queryData=response.data;
this.loading=false;
this.$Loading.finish();
})
.catch((error)=>{
this.queryError=error;
this.loading=false;
this.parse809Result=JSON.stringify(error);
this.$Loading.error();
});
},
parse1078:function(){
this.loading=true;
axios.post('http://jttools.smallchi.cn/api/JTTools/Parse1078',this.queryParameter)
},
parse1078Click:function(){
if(!this.parse1078Parameter) return;
this.$Loading.start();
axios.post('http://jttools.smallchi.cn/api/JTTools/Parse1078',this.parse1078Parameter)
.then((response)=>{
if(response.data=="" || response.data==null){
this.queryData=[];
this.loading=false;
return;
if(response.data.Code===200){
this.parse1078Result=response.data.Data;
}else{
this.parse1078Result=response.data.Message;
}
this.queryData=response.data;
this.loading=false;
this.$Loading.finish();
})
.catch((error)=>{
this.queryError=error;
this.loading=false;
this.parse1078Result=JSON.stringify(error);
this.$Loading.error();
});
}
}
}
})


Ładowanie…
Anuluj
Zapisz