@ajaxjs/ui 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/README.md +8 -11
  2. package/dist/api-helper/common/arg.vue +46 -0
  3. package/dist/api-helper/common/http-method.vue +53 -0
  4. package/dist/api-helper/common/input-table.vue +128 -0
  5. package/dist/api-helper/document/document-render.d.ts +10 -0
  6. package/dist/api-helper/document/document-render.js +38 -0
  7. package/dist/api-helper/document/document-render.js.map +1 -0
  8. package/dist/api-helper/document/document-render.ts +35 -0
  9. package/dist/api-helper/document/document-render.vue +155 -0
  10. package/dist/api-helper/document/document.d.ts +31 -0
  11. package/dist/api-helper/document/document.js +55 -0
  12. package/dist/api-helper/document/document.js.map +1 -0
  13. package/dist/api-helper/document/document.ts +55 -0
  14. package/dist/api-helper/document/document.vue +78 -0
  15. package/dist/api-helper/document/perview.vue +0 -0
  16. package/dist/api-helper/index.js +142 -0
  17. package/dist/api-helper/index.vue +108 -0
  18. package/dist/api-helper/request-body.vue +66 -0
  19. package/dist/api-helper/table.d.ts +7 -0
  20. package/dist/api-helper/table.js +13 -0
  21. package/dist/api-helper/table.js.map +1 -0
  22. package/dist/api-helper/table.ts +10 -0
  23. package/dist/api-helper/table.vue +103 -0
  24. package/dist/api-helper/xhr.js +100 -0
  25. package/dist/api-helper2/api-helper.d.ts +194 -0
  26. package/dist/api-helper2/api-helper.vue +144 -0
  27. package/dist/api-helper2/bookmark.vue +168 -0
  28. package/dist/api-helper2/common/arg.vue +46 -0
  29. package/dist/api-helper2/common/http-method.vue +53 -0
  30. package/dist/api-helper2/document/document-render.vue +189 -0
  31. package/dist/api-helper2/document/document.vue +130 -0
  32. package/dist/api-helper2/document/perview.vue +0 -0
  33. package/dist/api-helper2/env.vue +140 -0
  34. package/dist/api-helper2/history.vue +116 -0
  35. package/dist/api-helper2/main.vue +70 -0
  36. package/dist/api-helper2/request-body.vue +68 -0
  37. package/dist/api-helper2/table.vue +116 -0
  38. package/dist/api-selector/api-list-dataservice.d.ts +18 -0
  39. package/dist/api-selector/api-list-dataservice.js +209 -0
  40. package/dist/api-selector/api-list-dataservice.js.map +1 -0
  41. package/dist/api-selector/api-list-dataservice.ts +232 -0
  42. package/dist/api-selector/api-list-swagger.d.ts +28 -0
  43. package/dist/api-selector/api-list-swagger.js +179 -0
  44. package/dist/api-selector/api-list-swagger.js.map +1 -0
  45. package/dist/api-selector/api-list-swagger.ts +206 -0
  46. package/dist/api-selector/api-list.d.ts +80 -0
  47. package/dist/api-selector/api-list.js +129 -0
  48. package/dist/api-selector/api-list.js.map +1 -0
  49. package/dist/api-selector/api-list.ts +135 -0
  50. package/dist/api-selector/index.vue +125 -0
  51. package/dist/api-selector/test-dataservice.d.ts +23 -0
  52. package/dist/api-selector/test-dataservice.js +74 -0
  53. package/dist/api-selector/test-dataservice.js.map +1 -0
  54. package/dist/api-selector/test-swagger.d.ts +901 -0
  55. package/dist/api-selector/test-swagger.js +656 -0
  56. package/dist/api-selector/test-swagger.js.map +1 -0
  57. package/dist/data-source/data-source.css +44 -0
  58. package/dist/data-source/data-source.d.ts +14 -0
  59. package/dist/data-source/data-source.html +59 -0
  60. package/dist/data-source/data-source.js +97 -0
  61. package/dist/data-source/data-source.js.map +1 -0
  62. package/dist/data-source/data-source.less +46 -0
  63. package/dist/data-source/data-source.ts +95 -0
  64. package/dist/data-source/data-source.vue +59 -0
  65. package/dist/iView-ext/fast-iview-table/fast-iview-table.d.ts +37 -0
  66. package/dist/iView-ext/fast-iview-table/fast-iview-table.js +72 -0
  67. package/dist/iView-ext/fast-iview-table/fast-iview-table.js.map +1 -0
  68. package/dist/iView-ext/fast-iview-table/fast-iview-table.ts +75 -0
  69. package/dist/iView-ext/fast-iview-table/fast-iview-table.vue +52 -0
  70. package/dist/iView-ext/fast-iview-table/list.d.ts +44 -0
  71. package/dist/iView-ext/fast-iview-table/list.js +97 -0
  72. package/dist/iView-ext/fast-iview-table/list.js.map +1 -0
  73. package/dist/iView-ext/fast-iview-table/list.ts +109 -0
  74. package/dist/iView-ext/tips.vue +14 -0
  75. package/dist/index.d.ts +33 -31
  76. package/dist/index.js +8 -60
  77. package/dist/index.js.map +1 -1
  78. package/dist/index.ts +15 -0
  79. package/dist/libs/api-helper.d.ts +194 -0
  80. package/dist/libs/api-list.d.ts +15 -0
  81. package/dist/libs/common.d.ts +201 -0
  82. package/dist/libs/entity.d.ts +26 -0
  83. package/dist/libs/entity.js +1 -0
  84. package/dist/libs/entity.js.map +1 -0
  85. package/dist/libs/entity.ts +31 -0
  86. package/dist/libs/iview-widgets.d.ts +59 -0
  87. package/dist/libs/iview-widgets.js +2 -0
  88. package/dist/libs/iview-widgets.js.map +1 -0
  89. package/dist/libs/iview-widgets.ts +73 -0
  90. package/dist/main.d.ts +1 -1
  91. package/dist/main.js +16 -8
  92. package/dist/main.js.map +1 -1
  93. package/dist/main.ts +22 -0
  94. package/dist/table-selector/table-selector.htm +28 -0
  95. package/dist/table-selector/table-selector.js +149 -0
  96. package/package.json +16 -17
  97. package/dist/router/index.d.ts +0 -3
  98. package/dist/router/index.js +0 -44
  99. package/dist/router/index.js.map +0 -1
  100. package/dist/util/cookies.d.ts +0 -18
  101. package/dist/util/cookies.js +0 -46
  102. package/dist/util/cookies.js.map +0 -1
  103. package/dist/util/dom.d.ts +0 -17
  104. package/dist/util/dom.js +0 -44
  105. package/dist/util/dom.js.map +0 -1
  106. package/dist/util/utils.d.ts +0 -51
  107. package/dist/util/utils.js +0 -174
  108. package/dist/util/utils.js.map +0 -1
  109. package/dist/util/xhr-config.d.ts +0 -22
  110. package/dist/util/xhr-config.js +0 -3
  111. package/dist/util/xhr-config.js.map +0 -1
  112. package/dist/util/xhr.d.ts +0 -71
  113. package/dist/util/xhr.js +0 -262
  114. package/dist/util/xhr.js.map +0 -1
  115. package/dist/widget/AccordionMenu.vue +0 -140
  116. package/dist/widget/AdjustFontSize.vue +0 -65
  117. package/dist/widget/Article.vue +0 -59
  118. package/dist/widget/EmptyContent.d.ts +0 -5
  119. package/dist/widget/EmptyContent.js +0 -7
  120. package/dist/widget/EmptyContent.js.map +0 -1
  121. package/dist/widget/Expander.vue +0 -65
  122. package/dist/widget/FileUploader/FileUploader.d.ts +0 -70
  123. package/dist/widget/FileUploader/FileUploader.js +0 -139
  124. package/dist/widget/FileUploader/FileUploader.js.map +0 -1
  125. package/dist/widget/FileUploader/FileUploader.less +0 -68
  126. package/dist/widget/FileUploader/FileUploader.ts +0 -156
  127. package/dist/widget/FileUploader/FileUploader.vue +0 -43
  128. package/dist/widget/HtmlEditor/HtmlEditor.d.ts +0 -70
  129. package/dist/widget/HtmlEditor/HtmlEditor.js +0 -287
  130. package/dist/widget/HtmlEditor/HtmlEditor.js.map +0 -1
  131. package/dist/widget/HtmlEditor/HtmlEditor.less +0 -345
  132. package/dist/widget/HtmlEditor/HtmlEditor.ts +0 -339
  133. package/dist/widget/HtmlEditor/HtmlEditor.vue +0 -70
  134. package/dist/widget/HtmlEditor/html-editor-HtmlSanitizer.js +0 -103
  135. package/dist/widget/ImageEnlarger.vue +0 -105
  136. package/dist/widget/OpacityBanner.vue +0 -125
  137. package/dist/widget/ProcessLine.vue +0 -133
  138. package/dist/widget/Resize.d.ts +0 -51
  139. package/dist/widget/Resize.js +0 -133
  140. package/dist/widget/Resize.js.map +0 -1
  141. package/dist/widget/Resize.ts +0 -152
  142. package/dist/widget/Resize.vue +0 -104
  143. package/dist/widget/TreeSelector.vue +0 -4
  144. package/dist/widget/calendar/BetweenDate.vue +0 -63
  145. package/dist/widget/calendar/Calendar.d.ts +0 -55
  146. package/dist/widget/calendar/Calendar.js +0 -145
  147. package/dist/widget/calendar/Calendar.js.map +0 -1
  148. package/dist/widget/calendar/Calendar.less +0 -210
  149. package/dist/widget/calendar/Calendar.ts +0 -167
  150. package/dist/widget/calendar/Calendar.vue +0 -52
  151. package/dist/widget/calendar/CalendarInput.vue +0 -71
  152. package/dist/widget/form/validator.d.ts +0 -70
  153. package/dist/widget/form/validator.js +0 -220
  154. package/dist/widget/form/validator.js.map +0 -1
  155. package/dist/widget/form/validator.ts +0 -289
  156. package/dist/widget/play-ground/sku.vue +0 -93
@@ -0,0 +1,189 @@
1
+ <template>
2
+ <div class="document-rendered">
3
+ <h3>{{documnetObj.name}}</h3>
4
+ <p>{{documnetObj.description}}</p>
5
+
6
+ <div>
7
+ <h3 style="margin-top:0;">对应 UI:</h3>
8
+ <img class="ui small" @click="enlagrn($event)" src="https://tcs-devops.aliyuncs.com/storage/112h785d5d59567281da7b2b5f67ee7ec6b5?Signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBcHBJRCI6IjVlNzQ4MmQ2MjE1MjJiZDVjN2Y5YjMzNSIsIl9hcHBJZCI6IjVlNzQ4MmQ2MjE1MjJiZDVjN2Y5YjMzNSIsIl9vcmdhbml6YXRpb25JZCI6IiIsImV4cCI6MTY1NjI0MTAzNywiaWF0IjoxNjU1NjM2MjM3LCJyZXNvdXJjZSI6Ii9zdG9yYWdlLzExMmg3ODVkNWQ1OTU2NzI4MWRhN2IyYjVmNjdlZTdlYzZiNSJ9.zKVBc_WpZmoNV2XdzQOpKRSe4Etm5w2o2HH2afZrHOg" />
9
+ </div>
10
+
11
+ <p style="padding-top:3px">请求 <span class=" code-font">{{documnetObj.httpMethod}}</span> <span class="code code-font">{{documnetObj.url}}</span></p>
12
+
13
+ <h3>请求参数:</h3>
14
+ <table class="request-arg aj-table">
15
+ <thead>
16
+ <th>参数说明</th>
17
+ <th>变量</th>
18
+ <th>类型</th>
19
+ <th>参数位置</th>
20
+ <th>必填</th>
21
+ <th>描述</th>
22
+ </thead>
23
+ <tbody>
24
+ <tr v-for="arg in args" :key="arg.name">
25
+ <td>{{arg.desc}}</td>
26
+ <td>{{arg.name}}</td>
27
+ <td>{{arg.dataType}}</td>
28
+ <td>{{arg.type}}</td>
29
+ <td>{{arg.isRequired?'Yes': 'No'}}</td>
30
+ <td>{{arg.comment}}
31
+
32
+ <ul v-if="arg.values && arg.values.length">
33
+ <li v-for="enu in arg.values" :key="enu.value">
34
+ {{enu.value}} : {{enu.comment}}
35
+ </li>
36
+ </ul>
37
+ </td>
38
+ </tr>
39
+ </tbody>
40
+ </table>
41
+
42
+ <h3>请求示例:</h3>
43
+ <div class="note">
44
+ <a :href="documnetObj.demoUrl" target="_blank">{{documnetObj.demoUrl}}</a>
45
+ </div>
46
+ <h3>返回结果:</h3>
47
+
48
+ <pre class="note">
49
+ {
50
+ "status": int, // 调用接口是否成功,0:失败,1:成功
51
+ "errorCode": string, // 错误码,当 status=0 时,必须返回错误码
52
+ "message": string, // 错误具体信息
53
+ "data": { // 飞机状态信息
54
+ "airSpeed": 52.0,
55
+ "altitude": 55.5,
56
+ "ammeterState": "OK",
57
+ "compassState": "OK",
58
+ "flightState": "UNLOCKED",
59
+ "gpsState": "OK",
60
+ "gpsTime": "2022-06-07 14:36:14",
61
+ "groundSpeed": 5.0,
62
+ "heading": 55.0,
63
+ "ip": "192.168.0.22",
64
+ "latitude": 39.9352,
65
+ "longitude": 116.354,
66
+ "netSignal": 98.0,
67
+ "netState": "OK",
68
+ "power": 8.0,
69
+ "satelliteMod": "98",
70
+ "satelliteNum": 98,
71
+ "satellitePrecision": 98.0,
72
+ "uavId": "10001",
73
+ "voltage": 5.0
74
+ }
75
+ }</pre>
76
+ </div>
77
+ </template>
78
+
79
+ <script lang="ts">
80
+ export default {
81
+ data() {
82
+ return {
83
+ documnetObj: {
84
+ name: "解锁任务中所有的飞机",
85
+ description: "把 空闲、解锁失败的进行解锁",
86
+ httpMethod: "GET",
87
+ url: "/uav/{uav_id}/check_status",
88
+ demoUrl: "http://test.ajaxjs.com:8081/drone/uav/10001/check_status",
89
+ isShow: true
90
+ } as API_HELPER_DOCUMENT,
91
+ args: [
92
+ {
93
+ desc: "任务 id",
94
+ name: "task_id",
95
+ type: "FORM",
96
+ dataType: "string",
97
+ comment: "执行任务 execute | 立即返航 return | 结束任务 close 任选一",
98
+ isRequired: true,
99
+ values: [
100
+ { value: "execute", comment: "执行任务" },
101
+ { value: "return", comment: "立即返航" },
102
+ { value: "close", comment: "结束任务" },
103
+ ],
104
+ },
105
+ ] as API_HELPER_ARGUMENT[],
106
+ };
107
+ },
108
+ methods: {
109
+ enlagrn(e: Event): void {
110
+ let img: HTMLElement = <HTMLElement>e.target;
111
+ img.classList.toggle("small");
112
+ },
113
+ },
114
+ };
115
+ </script>
116
+
117
+ <style lang="less" scoped>
118
+ .document-rendered {
119
+ h3 {
120
+ font-weight: bold;
121
+ font-size: 1.2rem;
122
+ margin: 8px 0;
123
+ }
124
+
125
+ img.ui {
126
+ cursor: pointer;
127
+ max-width: 360px;
128
+ &.small {
129
+ max-width: 260px;
130
+ }
131
+ }
132
+ }
133
+
134
+ .code {
135
+ padding: 3px 4px;
136
+ // border: 1px solid rgb(250, 167, 59);
137
+ background-color: rgb(253, 222, 222);
138
+ color: rgb(255, 35, 35);
139
+ }
140
+
141
+ .code-font {
142
+ font-family: "Courier New";
143
+ }
144
+
145
+ .note {
146
+ padding-left: 10px;
147
+ border-left: 4px solid lightgray;
148
+ }
149
+
150
+ .request-arg {
151
+ width: 98%;
152
+ td {
153
+ text-align: center;
154
+ }
155
+ }
156
+
157
+ // 快速制作1px 表格边框,为需要设置的 table 元素加上 border 的class即可
158
+ .aj-table {
159
+ border: 1px lightgray solid;
160
+ border-collapse: collapse;
161
+ border-spacing: 0;
162
+
163
+ th {
164
+ // background-color: #efefef;
165
+ letter-spacing: 3px;
166
+ }
167
+
168
+ td,
169
+ th {
170
+ border: 1px lightgray solid;
171
+ line-height: 160%;
172
+ height: 120%;
173
+ padding: 6px;
174
+ }
175
+
176
+ tr {
177
+ // .transition (background-color 400ms ease-out);
178
+
179
+ &:nth-child(odd) {
180
+ // background: #f5f5f5;
181
+ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
182
+ }
183
+
184
+ &:hover {
185
+ background-color: #fbf8e9;
186
+ }
187
+ }
188
+ }
189
+ </style>
@@ -0,0 +1,130 @@
1
+ <template>
2
+ <!-- 渲染文档内容 -->
3
+ <div>
4
+ <Button @click="value3 = true" type="primary">编辑文档</Button>
5
+ <Drawer title="编辑文档" v-model="value3" width="1090" :mask-closable="false" :styles="styles">
6
+ <Form :model="documnetObj">
7
+ <Row :gutter="32">
8
+ <Col span="16">
9
+ <FormItem label="接口名称" label-position="top">
10
+ <Input v-model="documnetObj.name" placeholder="请输入接口名称" />
11
+ </FormItem>
12
+ </Col>
13
+ <Col span="8">
14
+ <FormItem label="分类" label-position="top">
15
+ <Select v-model="documnetObj.catalogId" placeholder="接口分类">
16
+ <Option value="private">Private</Option>
17
+ <Option value="public">Public</Option>
18
+ </Select>
19
+ </FormItem>
20
+ </Col>
21
+ </Row>
22
+
23
+ <FormItem label="接口说明" label-position="top">
24
+ <Input type="textarea" v-model="documnetObj.description" :rows="4" placeholder="接口说明" />
25
+ </FormItem>
26
+
27
+ <Row :gutter="32">
28
+ <Col span="15">
29
+ <FormItem label="对应 UI" label-position="top">
30
+ <!-- <FileUploader :is-img-upload="true" :is-show-btn="false" ref="imgUploader" /> -->
31
+ </FormItem>
32
+
33
+ </Col>
34
+ <Col span="6">
35
+
36
+ <FormItem label="接口编码状态" label-position="top">
37
+ <Select v-model="documnetObj.codeState" placeholder="请选择接口状态">
38
+ <Option value="INITED">初始化</Option>
39
+ <Option value="DEFINED">已定义</Option>
40
+ <Option value="DONE">已完成</Option>
41
+ </Select>
42
+ </FormItem>
43
+
44
+ <FormItem label="是否在文档汇总中展示" label-position="right">
45
+ <i-Switch v-model="documnetObj.isShow" />
46
+ </FormItem>
47
+ </Col>
48
+ </Row>
49
+ </Form>
50
+ <div class="demo-drawer-footer">
51
+ <Button type="success" style="margin-right: 8px" @click="perview = true" icon="ios-eye">预览文档</Button>
52
+ <Button type="primary" style="margin-right: 8px" @click="save" icon="md-create">保存</Button>
53
+ <Button @click="value3 = false">关闭</Button>
54
+ </div>
55
+ </Drawer>
56
+
57
+ <Modal v-model="perview" title="预览文档" width="1200" ok-text="关闭" cancel-text="">
58
+ <div style="max-height: 600px;overflow-y:scroll;">
59
+ <Render />
60
+ </div>
61
+ </Modal>
62
+ </div>
63
+ </template>
64
+
65
+ <script lang="ts">
66
+ import Render from "./document-render.vue";
67
+ import { xhr_post_upload } from "../../../util/xhr";
68
+ //@ts-ignore
69
+ // import FileUploader from "./../../../widget/FileUploader/FileUploader.vue";
70
+
71
+ export default {
72
+ // components: { Render, FileUploader },
73
+ components: { Render },
74
+ data() {
75
+ return {
76
+ perview: false,
77
+ value3: true,
78
+
79
+ documnetObj: {
80
+ name: "解锁任务中所有的飞机",
81
+ description: "把 空闲、解锁失败的进行解锁",
82
+ httpMethod: "GET",
83
+ url: "/uav/{uav_id}/check_status",
84
+ demoUrl: "http://test.ajaxjs.com:8081/drone/uav/10001/check_status",
85
+ codeState: "DEFINED",
86
+ isShow: true,
87
+ } as API_HELPER_DOCUMENT,
88
+
89
+ styles: {
90
+ height: "calc(100% - 55px)",
91
+ overflow: "auto",
92
+ paddingBottom: "53px",
93
+ position: "static",
94
+ },
95
+ formData: {
96
+ name: "",
97
+ url: "",
98
+ owner: "",
99
+ type: "",
100
+ approver: "",
101
+ date: "",
102
+ desc: "",
103
+ },
104
+ };
105
+ },
106
+ methods: {
107
+ enlagrn(e: Event): void {
108
+ let img: HTMLElement = <HTMLElement>e.target;
109
+ img.classList.toggle("small");
110
+ },
111
+
112
+ save(): void {
113
+ // xhr_post_upload("", (j) => {}, {}, { contentType: null });
114
+ },
115
+ },
116
+ };
117
+ </script>
118
+
119
+ <style lang="less" scoped>
120
+ .demo-drawer-footer {
121
+ width: 100%;
122
+ position: absolute;
123
+ bottom: 0;
124
+ left: 0;
125
+ border-top: 1px solid #e8e8e8;
126
+ padding: 10px 16px;
127
+ text-align: right;
128
+ background: #fff;
129
+ }
130
+ </style>
File without changes
@@ -0,0 +1,140 @@
1
+ <template>
2
+ <div style="overflow: hidden">
3
+ <div class="left">
4
+ <ul>
5
+ <li v-for="env in envs" :key="env.id" @click="active(env.id)" :class="{ actived: env.actived }">
6
+ <Icon type="md-trash" style="float: right; margin-top: 3px" @click="del(env.id, $event)" />
7
+ {{env.name}}
8
+ </li>
9
+ </ul>
10
+ <a class="add" @click="add">+ 新建……</a>
11
+ </div>
12
+ <div class="right">
13
+ <Input v-model="editing.name" ref="inputName">
14
+ <span slot="prepend">环境名称</span>
15
+ </Input>
16
+ <br />
17
+ <Input v-model="editing.urlPrefix">
18
+ <span slot="prepend">URL前缀</span>
19
+ </Input>
20
+
21
+ <br />
22
+ <br />
23
+ <p>
24
+ 环境变量:在接口文档或测试的过程中,使用 ${变量名} 即可引用该环境变量
25
+ </p>
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <script lang="ts">
31
+ import { xhr_get } from "../../util/xhr";
32
+
33
+ export default {
34
+ props: {},
35
+ data() {
36
+ return {
37
+ envs: [
38
+ {
39
+ id: 1,
40
+ name: "本地测试",
41
+ urlPrefix: "https://dd.com",
42
+ actived: true,
43
+ } as API_HELPER_ENV,
44
+ {
45
+ id: 2,
46
+ name: "生产环境",
47
+ urlPrefix: "http://foo.com",
48
+ actived: false,
49
+ } as API_HELPER_ENV,
50
+ ],
51
+ editing: {} as API_HELPER_ENV,
52
+ isCreate: false,
53
+ };
54
+ },
55
+ mounted() {
56
+ xhr_get("http://127.0.0.1:8080/cms/api/ApiHelper/env/list", (j: RepsonseResult) => {
57
+ if (j.status)
58
+ this.envs = j.data;
59
+ else this.$Message.warning(j.message);
60
+ }
61
+ );
62
+ },
63
+ methods: {
64
+ add(): void {
65
+ this.isCreate = true;
66
+ this.editing = {};
67
+ this.$refs.inputName.focus();
68
+ },
69
+ /**
70
+ * 点击某个环境,激活之
71
+ */
72
+ active(id: number): void {
73
+ for (let i = 0; i < this.envs.length; i++) {
74
+ let env: API_HELPER_ENV = this.envs[i];
75
+
76
+ if (env.id == id) {
77
+ this.editing = env;
78
+ env.actived = true;
79
+ } else env.actived = false;
80
+ }
81
+ },
82
+
83
+ /**
84
+ * 删除某个环境
85
+ */
86
+ del(id: number, e: Event): void {
87
+ e.stopPropagation();
88
+ let index: number;
89
+
90
+ for (let i = 0; i < this.envs.length; i++) {
91
+ let env: API_HELPER_ENV = this.envs[i];
92
+
93
+ if (env.id == id) {
94
+ index = i;
95
+ break;
96
+ }
97
+ }
98
+
99
+ if (index == 0 || index) {
100
+ this.envs.splice(index, 1);
101
+ this.editing = {};
102
+ }
103
+ },
104
+ },
105
+ };
106
+ </script>
107
+
108
+ <style lang="less" scoped>
109
+ .left {
110
+ float: left;
111
+ width: 28%;
112
+ height: 300px;
113
+ border-right: 1px solid #f5f5f5;
114
+ }
115
+
116
+ .right {
117
+ float: right;
118
+ width: 70%;
119
+ padding-left: 10px;
120
+ }
121
+
122
+ ul {
123
+ margin: 0 2%;
124
+ }
125
+
126
+ li {
127
+ border-bottom: 1px solid #f5f5f5;
128
+ padding: 5px 8px;
129
+ cursor: pointer;
130
+ &.actived {
131
+ font-weight: bold;
132
+ }
133
+ }
134
+
135
+ .add {
136
+ // color: #2d8cf0;
137
+ display: block;
138
+ padding: 5px 10px;
139
+ }
140
+ </style>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div>
3
+ <div class="toolbar">
4
+ <Button size="small" type="error" style="float:right;" :disabled="!historyList.length" @click="historyList=[];">清空历史记录</Button>
5
+ <span v-if="historyList.length">共 {{historyList.length}} 笔记录</span>
6
+ </div>
7
+
8
+ <ul style="max-height:500px">
9
+ <li v-for="history in historyList" :key="history.id" @click="select(history)">
10
+ <span v-if="history.name">{{history.name}}
11
+ <br /></span>
12
+ <span style="font-family:Courier New">
13
+ <HttpMethod :type="history.httpMethod" />{{history.url}}
14
+ </span>
15
+ <br />
16
+ <div style="font-family:Arial;font-size:3px;color:gray;float:right;margin-top:4px;">{{history.time}}ms</div>
17
+ <span style="font-family:Courier New;font-size:5px;color:lightgray">{{history.date}}</span>
18
+ </li>
19
+ </ul>
20
+ </div>
21
+ </template>
22
+
23
+ <script lang="ts">
24
+ import HttpMethod from "./common/http-method.vue";
25
+
26
+ export default {
27
+ components: { HttpMethod },
28
+ data() {
29
+ return {
30
+ historyList: [
31
+ {
32
+ id: 1,
33
+ httpMethod: "GET",
34
+ name: "fgfgf",
35
+ url: "http://qq.com",
36
+ time: 203,
37
+ date: "2022-3-3 3:23",
38
+ stateCode: 200,
39
+ },
40
+ {
41
+ id: 2,
42
+ httpMethod: "POST",
43
+ url: "http://qq.com/gggggggggggggggggggggggggggggggggggggggggggggggggggggggggg",
44
+ time: 203,
45
+ date: "2022-3-3 3:23",
46
+ stateCode: 200,
47
+ },
48
+ {
49
+ id: 3,
50
+ httpMethod: "PUT",
51
+ name: "fgfgf",
52
+ url: "http://qq.com",
53
+ time: 203,
54
+ date: "2022-3-3 3:23",
55
+ stateCode: 200,
56
+ },
57
+ {
58
+ id: 4,
59
+ httpMethod: "DELETE",
60
+ name: "获取新闻详情",
61
+ url: "http://qq.com",
62
+ time: 203,
63
+ date: "2022-3-3 3:23",
64
+ stateCode: 200,
65
+ },
66
+ ] as API_HELPER_HISTORY[],
67
+ };
68
+ },
69
+
70
+ methods: {
71
+ select(h: any): void {
72
+ alert(h);
73
+ },
74
+ },
75
+ };
76
+ </script>
77
+
78
+ <style lang="less" scoped>
79
+ .toolbar {
80
+ padding: 0 6px 5px 6px;
81
+ border-bottom: 1px solid #f0f0f0;
82
+ box-sizing: content-box;
83
+ overflow: hidden;
84
+ margin: 0 8px;
85
+ }
86
+ ul {
87
+ overflow-y: auto;
88
+ &::-webkit-scrollbar {
89
+ width: 6px;
90
+ }
91
+ &::-webkit-scrollbar-thumb {
92
+ border-radius: 8px;
93
+ background: rgba(23, 35, 61, 0.15);
94
+ }
95
+ &::-webkit-scrollbar-track {
96
+ background-color: transparent;
97
+ border-radius: 8px;
98
+ }
99
+ }
100
+
101
+ li {
102
+ padding: 10px 5px;
103
+ margin: 10px 5px;
104
+ border: 1px solid #f0f0f0;
105
+ border-radius: 5px;
106
+ overflow: hidden;
107
+ max-width: 290px;
108
+ text-overflow: ellipsis; //溢出用省略号显示
109
+ white-space: nowrap; //溢出不换行
110
+ transition: border-color ease-in 400ms;
111
+ cursor: pointer;
112
+ &:hover {
113
+ border-color: lightgray;
114
+ }
115
+ }
116
+ </style>
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div style="clear: both">
3
+ <section class="url-bar">
4
+ <Input v-model="url.main" style="width: 70%">
5
+ <span slot="prepend">
6
+ <Select v-model="httpMethod" style="width: 80px">
7
+ <Option value="GET">GET</Option>
8
+ <Option value="POST">POST</Option>
9
+ <Option value="PUT">PUT</Option>
10
+ <Option value="DELETE">DELETE</Option>
11
+ <Option value="PATCH">PATCH</Option>
12
+ <Option value="HEAD">HEAD</Option>
13
+ <Option value="OPTION">OPTION</Option>
14
+ </Select>
15
+ <Divider type="vertical" />{{ url.prefix }}
16
+ </span>
17
+ </Input>
18
+ <Button style="width: 8%" type="primary">发送</Button>
19
+ <Button style="width: 8%">保存</Button>
20
+ </section>
21
+
22
+ <Document />
23
+
24
+ <Tabs name="request" class="request" value="name2" :animated="false">
25
+ <TabPane label="头部参数" name="name1" tab="request">标签一的内容</TabPane>
26
+ <TabPane label="请求体" name="name2" tab="request">
27
+ <RequestBody />
28
+ </TabPane>
29
+ <TabPane tab="request" label="查询参数" name="name3">标签三的内容</TabPane>
30
+ <TabPane tab="request" label="路径参数" name="name4">标签三的内容</TabPane>
31
+ </Tabs>
32
+
33
+ <Tabs class="response" name="response" value="requestHead" :animated="false">
34
+ <TabPane tab="response" label="请求头部" name="requestHead">标签一的内容</TabPane>
35
+ <TabPane tab="response" label="请求内容" name="requestBody">标签二的内容</TabPane>
36
+ <TabPane tab="response" label="返回头部" name="responseHead">标签三的内容</TabPane>
37
+ <TabPane tab="response" label="返回内容" name="responseContent">标签三的内容</TabPane>
38
+ </Tabs>
39
+ </div>
40
+ </template>
41
+
42
+ <script>
43
+ import RequestBody from "./request-body.vue";
44
+ import Document from "./document/document.vue";
45
+
46
+ export default {
47
+ components: { RequestBody, Document },
48
+ data() {
49
+ return {
50
+ url: {
51
+ prefix: "https://dd.com",
52
+ main: "/dfdf",
53
+ },
54
+ httpMethod: "GET",
55
+ };
56
+ },
57
+ };
58
+ </script>
59
+
60
+
61
+ <style lang="less" scoped>
62
+ .request {
63
+ clear: both;
64
+ }
65
+
66
+ .url-bar > * {
67
+ float: left;
68
+ margin-right: 10px;
69
+ }
70
+ </style>