Commit 52a8ea9a authored by 黄奎's avatar 黄奎

页面修改

parent 9e4d0def
<template> <template>
<div class="test"> <div class="CMD">
<table> <table class="cmdTable">
<thead>
<tr> <tr>
<td style="width:100px"> <td colspan="2">
CMD 请求参数
</td> </td>
<td> </tr>
<tr>
<td class="tdLeft">
命令
</td>
<td class="tdRight">
<textarea :rows="1" :cols="50" v-model="ActionStr" placeholder="请输入命令"></textarea>
</td>
</tr>
<tr>
<td class="tdLeft">
参数
</td>
<td class="tdRight">
<textarea :rows="3" :cols="50" v-model="Msg" placeholder="请输入参数"></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input type="button" @click="Test()" value="执行" />
</td>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
返回结果
</td>
</tr>
<tr>
<td class="tdLeft">
请求命令
</td>
<td class="tdRight">
{{ActionStr}} {{ActionStr}}
</td> </td>
</tr> </tr>
<tr> <tr>
<td > <td class="tdLeft">
MSG 请求参数
</td>
<td class="tdRight">
{{ShowMsg}}
</td>
</tr>
<tr>
<td class="tdLeft">
返回结果
</td> </td>
<td> <td class="tdRight">
{{Msg}} {{Result}}
</td> </td>
</tr> </tr>
</tbody>
</table> </table>
</div> </div>
</template> </template>
<script> <script>
import { import {
TestApi TestApi
...@@ -31,15 +78,17 @@ ...@@ -31,15 +78,17 @@
}, },
data() { data() {
return { return {
ActionStr:"", ActionStr: "/Course/GetChapterTree",
Msg:"", Msg: "CourseId:1,School_Id:1",
ShowMsg: "",
Result: "",
}; };
}, },
created() { created() {
}, },
mounted() { mounted() {
this.Test();
}, },
watch: { watch: {
$route: { $route: {
...@@ -51,25 +100,73 @@ ...@@ -51,25 +100,73 @@
}, },
methods: { methods: {
Test() { Test() {
var cmdStr = "/Course"; this.Result = "";
var data = {} this.ShowMsg = "";
cmdStr += "/GetChapterTree" if (this.ActionStr && this.ActionStr != '') {
//SetCourse var data = {};
var dataArray = [];
data = { var tempStr = "";
CourseId: 1 if (this.Msg && this.Msg != '') {
var tempArray = this.Msg.split(',');
if (tempArray && tempArray.length > 0) {
for (var i = 0; i < tempArray.length; i++) {
if (tempArray[i] && tempArray[i] != '') {
var subArray = tempArray[i].split(':');
if (subArray && subArray.length == 2) {
var obj = {}
obj[subArray[0]] = subArray[1];
dataArray.push(obj);
tempStr += ',' + '"' + subArray[0] + '":' + '"' + subArray[1] + '"';
}
}
}
}
}
if (tempStr && tempStr != '') {
tempStr = "{" + tempStr.substring(1, tempStr.length) + "}";
data = JSON.parse(tempStr);
}
var tempMsg = {
Msg: data
}; };
this.ActionStr=cmdStr; this.ShowMsg = JSON.parse(JSON.stringify(tempMsg));
this.Msg=JSON.stringify(data); TestApi(this.ActionStr, data).then(res => {
TestApi(cmdStr, data).then(res => { this.Result = JSON.stringify(res);
console.log(res);
}) })
} }
}
}, },
}; };
</script> </script>
<style scoped> <style scoped>
.CMD {
background: #f5f6f7;
}
.CMD .cmdTable {
width: 100%;
max-width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
.CMD .cmdTable tr td {
border: 1px solid rgba(0, 0, 0, 0.12);
line-height: 40px;
min-height: 40px;
}
.CMD .tdLeft {
width: 20%;
font-size: 14px;
font-weight: 400;
}
.CMD .tdRight {
width: 70%;
font-size: 14px;
font-weight: 400;
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment