|
23 | 23 | <tab-pane label="apijson put" name="tab_put"></tab-pane>
|
24 | 24 | <tab-pane label="apijson delete" name="tab_delete"></tab-pane>
|
25 | 25 | </tabs>
|
| 26 | + <layout> |
| 27 | + <sider hide-trigger :style="{height: '80vh', width:'360px', 'min-width': '360px', 'max-width': '380px', overflow: 'auto', background: '#fff'}"> |
| 28 | + <i-menu :active-name="0" @on-select="on_select_get" width="360px" ref='menu_get'> |
| 29 | + <menu-group title="apijson get examples" v-if="tab_current==='tab_get'"> |
| 30 | + <menu-item v-for="(item,index) in request_get" :name="index" :key="index"> |
| 31 | + 📋 {item.label} |
| 32 | + </menu-item> |
| 33 | + </menu-group> |
| 34 | + </i-menu> |
| 35 | + <i-menu :active-name="0" @on-select="on_select_head" width="360px"> |
| 36 | + <menu-group title="apijson head examples" v-if="tab_current==='tab_head'"> |
| 37 | + <menu-item v-for="(item,index) in request_head" :name="index" :key="index"> |
| 38 | + 📋 {item.label} |
| 39 | + </menu-item> |
| 40 | + </menu-group> |
| 41 | + </i-menu> |
| 42 | + <i-menu :active-name="0" @on-select="on_select_post" width="360px"> |
| 43 | + <menu-group title="apijson post examples" v-if="tab_current==='tab_post'"> |
| 44 | + <menu-item v-for="(item,index) in request_post" :name="index" :key="index"> |
| 45 | + 📋 {item.label} |
| 46 | + </menu-item> |
| 47 | + </menu-group> |
| 48 | + </i-menu> |
| 49 | + <i-menu :active-name="0" @on-select="on_select_put" width="360px"> |
| 50 | + <menu-group title="apijson put examples" v-if="tab_current==='tab_put'"> |
| 51 | + <menu-item v-for="(item,index) in request_put" :name="index" :key="index"> |
| 52 | + 📋 {item.label} |
| 53 | + </menu-item> |
| 54 | + </menu-group> |
| 55 | + </i-menu> |
| 56 | + <i-menu :active-name="0" @on-select="on_select_delete" width="360px"> |
| 57 | + <menu-group title="apijson delete examples" v-if="tab_current==='tab_delete'"> |
| 58 | + <menu-item v-for="(item,index) in request_delete" :name="index" :key="index"> |
| 59 | + 📋 {item.label} |
| 60 | + </menu-item> |
| 61 | + </menu-group> |
| 62 | + </i-menu> |
| 63 | + </sider> |
| 64 | + <i-content :style="{padding: '24px', minHeight: '280px', background: '#fff'}"> |
26 | 65 | <Row>
|
27 | 66 | <i-col span="3"><div align="center">login user</div></i-col>
|
28 |
| - <i-col span="8"><i-input value="{{=user_info}}" readonly/></i-col> |
| 67 | + <i-col span="18"><i-input value="{{=user_info}}" readonly/></i-col> |
29 | 68 | {{if request.user:}}
|
30 | 69 | <i-col span="1"><div align="center"><i-button type="warning" size="large" @click="logout">Logout</i-button></div></i-col>
|
31 | 70 | {{else:}}
|
32 | 71 | <i-col span="1"><div align="center"><i-button type="primary" size="large" @click="login">Login</i-button></div></i-col>
|
33 | 72 | {{pass}}
|
34 | 73 | </Row>
|
35 | 74 | <Row v-if="tab_current==='tab_get'">
|
36 |
| - <i-col span="3"><div align="center">HTTP POST URL</div></i-col> |
37 |
| - <i-col span="8"><i-input value="/apijson/get" readonly/></i-col> |
| 75 | + <i-col span="3"><div align="center">HTTP POST URL</div></i-col> |
| 76 | + <i-col span="18"><i-input value="/apijson/get" readonly/></i-col> |
38 | 77 | </Row>
|
39 | 78 | <Row v-if="tab_current==='tab_get'">
|
40 |
| - <i-col span="3"><div align="center"><strong>apijson get</strong> request <span class="notice">{request_get.length}</span> examples</div></i-col> |
41 |
| - <i-col span="8"> |
42 |
| - <i-select v-model="select_current"> |
43 |
| - <i-option v-for="(item,index) in request_get" :value="item.value" :key="item.value">{index+1}. {item.label}</i-option> |
44 |
| - </i-select> |
45 |
| - </i-col> |
| 79 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 80 | + <i-col span="18"><strong><i-input :value="request_get[cmenu_get].label" readonly/></strong></i-col> |
46 | 81 | </Row>
|
47 | 82 |
|
48 | 83 | <Row v-if="tab_current==='tab_head'">
|
49 | 84 | <i-col span="3"><div align="center">HTTP HEAD URL</div></i-col>
|
50 |
| - <i-col span="8"><i-input value="/apijson/head" readonly/></i-col> |
| 85 | + <i-col span="18"><i-input value="/apijson/head" readonly/></i-col> |
51 | 86 | </Row>
|
52 | 87 | <Row v-if="tab_current==='tab_head'">
|
53 |
| - <i-col span="3"><div align="center"><strong>apijson head</strong> request <span class="notice">{request_head.length}</span> examples</div></i-col> |
54 |
| - <i-col span="8"> |
55 |
| - <i-select v-model="select_current"> |
56 |
| - <i-option v-for="(item,index) in request_head" :value="item.value" :key="item.value">{index+1}. {item.label}</i-option> |
57 |
| - </i-select> |
58 |
| - </i-col> |
| 88 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 89 | + <i-col span="18"><strong><i-input :value="request_head[cmenu_head].label" readonly/></strong></i-col> |
59 | 90 | </Row>
|
60 | 91 |
|
61 | 92 | <Row v-if="tab_current==='tab_post'">
|
62 |
| - <i-col span="3"><div align="center">POST URL</div></i-col> |
63 |
| - <i-col span="8"><i-input value="/apijson/post" readonly/></i-col> |
| 93 | + <i-col span="3"><div align="center">POST URL</div></i-col> |
| 94 | + <i-col span="18"><i-input value="/apijson/post" readonly/></i-col> |
64 | 95 | </Row>
|
65 | 96 | <Row v-if="tab_current==='tab_post'">
|
66 |
| - <i-col span="3"><div align="center"><strong>apijson post</strong> request <span class="notice">{request_post.length}</span> examples</div></i-col> |
67 |
| - <i-col span="8"> |
68 |
| - <i-select v-model="select_current"> |
69 |
| - <i-option v-for="(item,index) in request_post" :value="item.value" :key="item.value">{index+1}. {item.label}</i-option> |
70 |
| - </i-select> |
71 |
| - </i-col> |
| 97 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 98 | + <i-col span="18"><strong><i-input :value="request_post[cmenu_post].label" readonly/></strong></i-col> |
72 | 99 | </Row>
|
73 | 100 |
|
74 | 101 | <Row v-if="tab_current==='tab_put'">
|
75 | 102 | <i-col span="3"><div align="center">PUT URL</div></i-col>
|
76 |
| - <i-col span="8"><i-input value="/apijson/put" readonly/></i-col> |
| 103 | + <i-col span="18"><i-input value="/apijson/put" readonly/></i-col> |
77 | 104 | </Row>
|
78 | 105 | <Row v-if="tab_current==='tab_put'">
|
79 |
| - <i-col span="3"><div align="center"><strong>apijson put</strong> request <span class="notice">{request_put.length}</span> examples</div></i-col> |
80 |
| - <i-col span="8"> |
81 |
| - <i-select v-model="select_current"> |
82 |
| - <i-option v-for="(item,index) in request_put" :value="item.value" :key="item.value">{index+1}. {item.label}</i-option> |
83 |
| - </i-select> |
84 |
| - </i-col> |
| 106 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 107 | + <i-col span="18"><strong><i-input :value="request_put[cmenu_put].label" readonly/></strong></i-col> |
85 | 108 | </Row>
|
86 | 109 |
|
87 | 110 | <Row v-if="tab_current==='tab_delete'">
|
88 | 111 | <i-col span="3"><div align="center">DELETE URL</div></i-col>
|
89 |
| - <i-col span="8"><i-input value="/apijson/delete" readonly/></i-col> |
| 112 | + <i-col span="18"><i-input value="/apijson/delete" readonly/></i-col> |
90 | 113 | </Row>
|
91 | 114 | <Row v-if="tab_current==='tab_delete'">
|
92 |
| - <i-col span="3"><div align="center"><strong>apijson delete</strong> request <span class="notice">{request_delete.length}</span> examples</div></i-col> |
93 |
| - <i-col span="8"> |
94 |
| - <i-select v-model="select_current"> |
95 |
| - <i-option v-for="(item,index) in request_delete" :value="item.value" :key="item.value">{index+1}. {item.label}</i-option> |
96 |
| - </i-select> |
97 |
| - </i-col> |
| 115 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 116 | + <i-col span="18"><strong><i-input :value="request_delete[cmenu_delete].label" readonly/></strong></i-col> |
98 | 117 | </Row>
|
99 | 118 |
|
100 | 119 | <Row>
|
101 | 120 | <i-col span="3"><div align="center">request data</div></i-col>
|
102 |
| - <i-col span="8"><i-input v-model="request_data" type="textarea" :autosize="{minRows: 3,maxRows: 15}" placeholder="request data" /></i-col> |
| 121 | + <i-col span="18"><i-input v-model="request_data" type="textarea" :autosize="{minRows: 3,maxRows: 15}" placeholder="request data" /></i-col> |
103 | 122 | <i-col span="1"><div align="center"><i-button type="primary" size="large" @click="post_request_data" v-bind:disabled="!can_post">Post</i-button></div></i-col>
|
104 | 123 | </Row>
|
105 | 124 | <Row>
|
106 | 125 | <i-col span="3"><div align="center">response data</div></i-col>
|
107 |
| - <i-col span="8"><i-input v-model="response_data" type="textarea" readonly :autosize="{minRows: 5,maxRows: 30}" /></i-col> |
| 126 | + <i-col span="18"><i-input v-model="response_data" type="textarea" readonly :autosize="{minRows: 5,maxRows: 30}" /></i-col> |
108 | 127 | </Row>
|
| 128 | + </i-content> |
| 129 | + </layout> |
109 | 130 | </div>
|
110 | 131 | </div>
|
111 | 132 | <script>
|
|
119 | 140 | request_put : {{<<request_put_json}},
|
120 | 141 | request_delete : {{<<request_delete_json}},
|
121 | 142 | request_data : "",
|
122 |
| - select_current : "", |
| 143 | + |
| 144 | + cmenu_get : 0, |
| 145 | + cmenu_head : 0, |
| 146 | + cmenu_post : 0, |
| 147 | + cmenu_put : 0, |
| 148 | + cmenu_delete : 0, |
| 149 | + |
123 | 150 | can_post : true,
|
124 | 151 | response_data : "",
|
125 | 152 | tab_current : "tab_get",
|
|
134 | 161 | methods: {
|
135 | 162 | init_default: function(){
|
136 | 163 | vm.request_data = vm.request_get[0].value
|
137 |
| - vm.select_current = vm.request_data |
| 164 | + }, |
| 165 | + on_select_get: function(name){ |
| 166 | + vm.cmenu_get = parseInt(name) |
| 167 | + vm.request_data = vm.request_get[vm.cmenu_get].value |
| 168 | + vm.response_data = "" |
| 169 | + vm.can_post = true |
| 170 | + }, |
| 171 | + on_select_head: function(name){ |
| 172 | + vm.cmenu_head = parseInt(name) |
| 173 | + vm.request_data = vm.request_head[vm.cmenu_head].value |
| 174 | + vm.response_data = "" |
| 175 | + vm.can_post = true |
| 176 | + }, |
| 177 | + on_select_post: function(name){ |
| 178 | + vm.cmenu_post = parseInt(name) |
| 179 | + vm.request_data = vm.request_post[vm.cmenu_post].value |
| 180 | + vm.response_data = "" |
| 181 | + vm.can_post = true |
| 182 | + }, |
| 183 | + on_select_put: function(name){ |
| 184 | + vm.cmenu_put = parseInt(name) |
| 185 | + vm.request_data = vm.request_put[vm.cmenu_put].value |
| 186 | + vm.response_data = "" |
| 187 | + vm.can_post = true |
| 188 | + }, |
| 189 | + on_select_delete: function(name){ |
| 190 | + vm.cmenu_delete = parseInt(name) |
| 191 | + vm.request_data = vm.request_delete[vm.cmenu_delete].value |
| 192 | + vm.response_data = "" |
| 193 | + vm.can_post = true |
138 | 194 | },
|
139 | 195 | post_request_data: function(){
|
140 | 196 | $.ajax({
|
|
171 | 227 | else if (n=="tab_delete") {
|
172 | 228 | vm.request_data = vm.request_delete[0].value
|
173 | 229 | }
|
174 |
| - vm.select_current = vm.request_data |
175 | 230 | vm.response_data = ""
|
176 |
| - }, |
177 |
| - select_current : function(n,o){ |
178 |
| - if (n!=null && n!="" && n!==vm.request_data) { |
179 |
| - vm.request_data = n |
180 |
| - } |
181 |
| - else { |
182 |
| - vm.select_current = vm.request_data |
183 |
| - } |
184 | 231 | }
|
185 | 232 | }
|
186 | 233 | })
|
|
0 commit comments