|
1 | 1 | {{extend "layout_demo.html"}}
|
2 | 2 |
|
3 |
| -{{block content_header_title}}<h1>uliweb-apijson api examples</h1>{{end content_header_title}} |
| 3 | +{{block title}}uliweb-apijson demo: requests{{end title}} |
4 | 4 |
|
5 |
| -{{block content_main}} |
6 |
| -{{use "ui.vue"}} |
7 |
| -{{use "ui.iview"}} |
| 5 | +{{block content_wrapper}} |
| 6 | +<card> |
| 7 | + <div style="min-height: 600px;"> |
| 8 | + <tabs v-model:value="tab_current" type="card" :animated="false"> |
| 9 | + <tab-pane label="apijson get" name="tab_get"></tab-pane> |
| 10 | + <tab-pane label="apijson head" name="tab_head"></tab-pane> |
| 11 | + <tab-pane label="apijson post" name="tab_post"></tab-pane> |
| 12 | + <tab-pane label="apijson put" name="tab_put"></tab-pane> |
| 13 | + <tab-pane label="apijson delete" name="tab_delete"></tab-pane> |
| 14 | + </tabs> |
| 15 | + <layout> |
| 16 | + <sider hide-trigger :style="{height: '80vh', width:'360px', 'min-width': '360px', 'max-width': '380px', overflow: 'auto', background: '#fff'}"> |
| 17 | + <i-menu :active-name="0" @on-select="on_select_get" width="360px" ref='menu_get'> |
| 18 | + <menu-group title="apijson get examples" v-if="tab_current==='tab_get'"> |
| 19 | + <menu-item v-for="(item,index) in request_get" :name="index" :key="index"> |
| 20 | + <i class="fa fa-fw fa-file-code-o"></i> {item.label} |
| 21 | + </menu-item> |
| 22 | + </menu-group> |
| 23 | + </i-menu> |
| 24 | + <i-menu :active-name="0" @on-select="on_select_head" width="360px"> |
| 25 | + <menu-group title="apijson head examples" v-if="tab_current==='tab_head'"> |
| 26 | + <menu-item v-for="(item,index) in request_head" :name="index" :key="index"> |
| 27 | + <i class="fa fa-fw fa-file-code-o"></i> {item.label} |
| 28 | + </menu-item> |
| 29 | + </menu-group> |
| 30 | + </i-menu> |
| 31 | + <i-menu :active-name="0" @on-select="on_select_post" width="360px"> |
| 32 | + <menu-group title="apijson post examples" v-if="tab_current==='tab_post'"> |
| 33 | + <menu-item v-for="(item,index) in request_post" :name="index" :key="index"> |
| 34 | + <i class="fa fa-fw fa-file-code-o"></i> {item.label} |
| 35 | + </menu-item> |
| 36 | + </menu-group> |
| 37 | + </i-menu> |
| 38 | + <i-menu :active-name="0" @on-select="on_select_put" width="360px"> |
| 39 | + <menu-group title="apijson put examples" v-if="tab_current==='tab_put'"> |
| 40 | + <menu-item v-for="(item,index) in request_put" :name="index" :key="index"> |
| 41 | + <i class="fa fa-fw fa-file-code-o"></i> {item.label} |
| 42 | + </menu-item> |
| 43 | + </menu-group> |
| 44 | + </i-menu> |
| 45 | + <i-menu :active-name="0" @on-select="on_select_delete" width="360px"> |
| 46 | + <menu-group title="apijson delete examples" v-if="tab_current==='tab_delete'"> |
| 47 | + <menu-item v-for="(item,index) in request_delete" :name="index" :key="index"> |
| 48 | + <i class="fa fa-fw fa-file-code-o"></i> {item.label} |
| 49 | + </menu-item> |
| 50 | + </menu-group> |
| 51 | + </i-menu> |
| 52 | + </sider> |
| 53 | + <i-content :style="{padding: '24px', minHeight: '280px', background: '#fff'}"> |
| 54 | + <Row> |
| 55 | + <i-col span="3"><div align="center">login user</div></i-col> |
| 56 | + <i-col span="18"><i-input value="{{=user_info}}" readonly/></i-col> |
| 57 | + {{if request.user:}} |
| 58 | + <i-col span="1"><div align="center"><i-button type="warning" size="large" @click="logout">Logout</i-button></div></i-col> |
| 59 | + {{else:}} |
| 60 | + <i-col span="1"><div align="center"><i-button type="primary" size="large" @click="login">Login</i-button></div></i-col> |
| 61 | + {{pass}} |
| 62 | + </Row> |
| 63 | + <Row v-if="tab_current==='tab_get'"> |
| 64 | + <i-col span="3"><div align="center">HTTP POST URL</div></i-col> |
| 65 | + <i-col span="18"><i-input value="/apijson/get" readonly/></i-col> |
| 66 | + </Row> |
| 67 | + <Row v-if="tab_current==='tab_get'"> |
| 68 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 69 | + <i-col span="18"><strong><i-input :value="request_get[cmenu_get].label" readonly/></strong></i-col> |
| 70 | + </Row> |
| 71 | + |
| 72 | + <Row v-if="tab_current==='tab_head'"> |
| 73 | + <i-col span="3"><div align="center">HTTP HEAD URL</div></i-col> |
| 74 | + <i-col span="18"><i-input value="/apijson/head" readonly/></i-col> |
| 75 | + </Row> |
| 76 | + <Row v-if="tab_current==='tab_head'"> |
| 77 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 78 | + <i-col span="18"><strong><i-input :value="request_head[cmenu_head].label" readonly/></strong></i-col> |
| 79 | + </Row> |
| 80 | + |
| 81 | + <Row v-if="tab_current==='tab_post'"> |
| 82 | + <i-col span="3"><div align="center">POST URL</div></i-col> |
| 83 | + <i-col span="18"><i-input value="/apijson/post" readonly/></i-col> |
| 84 | + </Row> |
| 85 | + <Row v-if="tab_current==='tab_post'"> |
| 86 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 87 | + <i-col span="18"><strong><i-input :value="request_post[cmenu_post].label" readonly/></strong></i-col> |
| 88 | + </Row> |
| 89 | + |
| 90 | + <Row v-if="tab_current==='tab_put'"> |
| 91 | + <i-col span="3"><div align="center">PUT URL</div></i-col> |
| 92 | + <i-col span="18"><i-input value="/apijson/put" readonly/></i-col> |
| 93 | + </Row> |
| 94 | + <Row v-if="tab_current==='tab_put'"> |
| 95 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 96 | + <i-col span="18"><strong><i-input :value="request_put[cmenu_put].label" readonly/></strong></i-col> |
| 97 | + </Row> |
| 98 | + |
| 99 | + <Row v-if="tab_current==='tab_delete'"> |
| 100 | + <i-col span="3"><div align="center">DELETE URL</div></i-col> |
| 101 | + <i-col span="18"><i-input value="/apijson/delete" readonly/></i-col> |
| 102 | + </Row> |
| 103 | + <Row v-if="tab_current==='tab_delete'"> |
| 104 | + <i-col span="3"><div align="center">example name</div></i-col> |
| 105 | + <i-col span="18"><strong><i-input :value="request_delete[cmenu_delete].label" readonly/></strong></i-col> |
| 106 | + </Row> |
| 107 | + |
| 108 | + <Row> |
| 109 | + <i-col span="3"><div align="center">request data</div></i-col> |
| 110 | + <i-col span="18"><i-input v-model="request_data" type="textarea" :autosize="{minRows: 3,maxRows: 15}" placeholder="request data" /></i-col> |
| 111 | + <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> |
| 112 | + </Row> |
| 113 | + <Row> |
| 114 | + <i-col span="3"><div align="center">response data</div></i-col> |
| 115 | + <i-col span="18"><i-input v-model="response_data" type="textarea" readonly :autosize="{minRows: 5,maxRows: 30}" /></i-col> |
| 116 | + </Row> |
| 117 | + </i-content> |
| 118 | + </layout> |
| 119 | + </div> |
| 120 | +</card> |
| 121 | +{{end content_wrapper}} |
8 | 122 |
|
9 |
| -<style> |
10 |
| - .notice |
11 |
| - { |
12 |
| - color:red; |
13 |
| - font-size:150%; |
14 |
| - } |
15 |
| -</style> |
16 |
| - |
17 |
| -<div id="app" class='box'> |
18 |
| -<div class="box-body"> |
19 |
| - <tabs v-model:value="tab_current" type="card" :animated="false"> |
20 |
| - <tab-pane label="apijson get" name="tab_get"></tab-pane> |
21 |
| - <tab-pane label="apijson head" name="tab_head"></tab-pane> |
22 |
| - <tab-pane label="apijson post" name="tab_post"></tab-pane> |
23 |
| - <tab-pane label="apijson put" name="tab_put"></tab-pane> |
24 |
| - <tab-pane label="apijson delete" name="tab_delete"></tab-pane> |
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 |
| - <i class="fa fa-fw fa-file-code-o"></i> {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 |
| - <i class="fa fa-fw fa-file-code-o"></i> {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 |
| - <i class="fa fa-fw fa-file-code-o"></i> {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 |
| - <i class="fa fa-fw fa-file-code-o"></i> {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 |
| - <i class="fa fa-fw fa-file-code-o"></i> {item.label} |
60 |
| - </menu-item> |
61 |
| - </menu-group> |
62 |
| - </i-menu> |
63 |
| - </sider> |
64 |
| - <i-content :style="{padding: '24px', minHeight: '280px', background: '#fff'}"> |
65 |
| - <Row> |
66 |
| - <i-col span="3"><div align="center">login user</div></i-col> |
67 |
| - <i-col span="18"><i-input value="{{=user_info}}" readonly/></i-col> |
68 |
| - {{if request.user:}} |
69 |
| - <i-col span="1"><div align="center"><i-button type="warning" size="large" @click="logout">Logout</i-button></div></i-col> |
70 |
| - {{else:}} |
71 |
| - <i-col span="1"><div align="center"><i-button type="primary" size="large" @click="login">Login</i-button></div></i-col> |
72 |
| - {{pass}} |
73 |
| - </Row> |
74 |
| - <Row v-if="tab_current==='tab_get'"> |
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> |
77 |
| - </Row> |
78 |
| - <Row v-if="tab_current==='tab_get'"> |
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> |
81 |
| - </Row> |
82 |
| - |
83 |
| - <Row v-if="tab_current==='tab_head'"> |
84 |
| - <i-col span="3"><div align="center">HTTP HEAD URL</div></i-col> |
85 |
| - <i-col span="18"><i-input value="/apijson/head" readonly/></i-col> |
86 |
| - </Row> |
87 |
| - <Row v-if="tab_current==='tab_head'"> |
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> |
90 |
| - </Row> |
91 |
| - |
92 |
| - <Row v-if="tab_current==='tab_post'"> |
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> |
95 |
| - </Row> |
96 |
| - <Row v-if="tab_current==='tab_post'"> |
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> |
99 |
| - </Row> |
100 |
| - |
101 |
| - <Row v-if="tab_current==='tab_put'"> |
102 |
| - <i-col span="3"><div align="center">PUT URL</div></i-col> |
103 |
| - <i-col span="18"><i-input value="/apijson/put" readonly/></i-col> |
104 |
| - </Row> |
105 |
| - <Row v-if="tab_current==='tab_put'"> |
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> |
108 |
| - </Row> |
109 |
| - |
110 |
| - <Row v-if="tab_current==='tab_delete'"> |
111 |
| - <i-col span="3"><div align="center">DELETE URL</div></i-col> |
112 |
| - <i-col span="18"><i-input value="/apijson/delete" readonly/></i-col> |
113 |
| - </Row> |
114 |
| - <Row v-if="tab_current==='tab_delete'"> |
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> |
117 |
| - </Row> |
118 |
| - |
119 |
| - <Row> |
120 |
| - <i-col span="3"><div align="center">request data</div></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> |
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> |
123 |
| - </Row> |
124 |
| - <Row> |
125 |
| - <i-col span="3"><div align="center">response data</div></i-col> |
126 |
| - <i-col span="18"><i-input v-model="response_data" type="textarea" readonly :autosize="{minRows: 5,maxRows: 30}" /></i-col> |
127 |
| - </Row> |
128 |
| - </i-content> |
129 |
| - </layout> |
130 |
| -</div> |
131 |
| -</div> |
| 123 | +{{block mainapp_vue}} |
132 | 124 | <script>
|
133 | 125 | var vm = new Vue({
|
134 |
| - el: '#app', |
| 126 | + el: '#mainapp', |
135 | 127 | delimiters: ['{', '}'],
|
136 | 128 | data: {
|
137 | 129 | request_get : {{<<request_get_json}},
|
|
204 | 196 | }
|
205 | 197 | })
|
206 | 198 | },
|
207 |
| - login: function(){window.location.href="{{=url_for('uliweb_apps.login.views.login')}}"}, |
208 |
| - logout: function(){window.location.href="{{=url_for('uliweb_apps.login.views.logout')}}"} |
| 199 | + login: function(){window.location.href="{{=url_for('uliweb_comapps.auth.login.views.login')}}"}, |
| 200 | + logout: function(){window.location.href="{{=url_for('uliweb_comapps.auth.login.views.logout')}}"} |
209 | 201 | },
|
210 | 202 | watch: {
|
211 | 203 | request_data : function(n,o){
|
|
233 | 225 | })
|
234 | 226 | vm.init_default()
|
235 | 227 | </script>
|
236 |
| -{{end content_main}} |
| 228 | +{{end mainapp_vue}} |
0 commit comments