@ajaxjs/ui 1.0.7 → 1.1.2
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.
- package/dist/components/form/FileUploader/FileUploader.js +104 -0
- package/dist/components/form/FileUploader/FileUploader.js.map +1 -0
- package/dist/components/form/FileUploader/FileUploader.less +55 -0
- package/dist/components/form/FileUploader/FileUploader.ts +121 -0
- package/dist/components/form/FileUploader/FileUploader.vue +26 -0
- package/dist/components/form/HtmlEditor/HtmlEditor.js +11 -4
- package/dist/components/form/HtmlEditor/HtmlEditor.js.map +1 -1
- package/dist/components/form/HtmlEditor/HtmlEditor.less +185 -5
- package/dist/components/form/HtmlEditor/HtmlEditor.ts +12 -4
- package/dist/components/form/HtmlEditor/HtmlEditor.vue +19 -19
- package/dist/components/widgets/ImageEnlarger.vue +77 -20
- package/package.json +7 -10
- package/.browserslistrc +0 -3
- package/.eslintrc.js +0 -25
- package/babel.config.js +0 -5
- package/dist/components/list/attachment-picture-list.js +0 -57
- package/dist/components/list/attachment-picture-list.js.map +0 -1
- package/dist/components/list/attachment-picture-list.ts +0 -57
- package/dist/components/list/list.js +0 -227
- package/dist/components/list/list.js.map +0 -1
- package/dist/components/list/list.ts +0 -261
- package/dist/components/widgets/AjAvatar.vue +0 -42
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -24
- package/src/App.vue +0 -32
- package/src/assets/logo.png +0 -0
- package/src/components/form/AjSelect.vue +0 -33
- package/src/components/form/HtmlEditor/HtmlEditor.less +0 -165
- package/src/components/form/HtmlEditor/HtmlEditor.ts +0 -329
- package/src/components/form/HtmlEditor/HtmlEditor.vue +0 -70
- package/src/components/form/HtmlEditor/html-editor-HtmlSanitizer.js +0 -103
- package/src/components/form/TreeLikeSelect.vue +0 -125
- package/src/components/list/attachment-picture-list.ts +0 -57
- package/src/components/list/list.js +0 -227
- package/src/components/list/list.ts +0 -261
- package/src/components/widgets/AccordionMenu.vue +0 -138
- package/src/components/widgets/AdjustFontSize.vue +0 -66
- package/src/components/widgets/AjAvatar.vue +0 -42
- package/src/components/widgets/Article.vue +0 -49
- package/src/components/widgets/BaiduSearch.vue +0 -50
- package/src/components/widgets/Expander.vue +0 -65
- package/src/components/widgets/ImageEnlarger.vue +0 -42
- package/src/components/widgets/OpacityBanner.vue +0 -124
- package/src/components/widgets/ProcessLine.vue +0 -133
- package/src/globalDeclare/shims.d.ts +0 -4
- package/src/index.ts +0 -8
- package/src/main.ts +0 -12
- package/src/pages/Nav.vue +0 -23
- package/src/pages/common.less +0 -10
- package/src/pages/demo/Article.vue +0 -30
- package/src/pages/demo/Form.vue +0 -46
- package/src/pages/demo/Wdigets.vue +0 -168
- package/src/router/index.js +0 -39
- package/src/router/index.js.map +0 -1
- package/src/router/index.ts +0 -39
- package/src/shims-tsx.d.ts +0 -13
- package/src/shims-vue.d.ts +0 -4
- package/src/style/common-functions.less +0 -171
- package/src/style/reset.less +0 -18
- package/src/views/About.vue +0 -5
- package/src/views/Home.vue +0 -49
- package/src/views/desktop/Desktop.vue +0 -251
- package/src/views/desktop/Window.vue +0 -62
- package/src/views/desktop/desktop.md +0 -14
- package/tsconfig.json +0 -30
- package/vue.config.js +0 -17
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// interface AttachmentPictureList extends Ajax {
|
|
2
|
-
// delImgUrl: string;
|
|
3
|
-
// pics: BaseObject[];
|
|
4
|
-
// }
|
|
5
|
-
|
|
6
|
-
// /**
|
|
7
|
-
// * 相册列表
|
|
8
|
-
// */
|
|
9
|
-
// Vue.component('aj-attachment-picture-list', {
|
|
10
|
-
// template: `
|
|
11
|
-
// <table>
|
|
12
|
-
// <tr>
|
|
13
|
-
// <td>
|
|
14
|
-
// <div class="label">相册图:</div>
|
|
15
|
-
// <ul>
|
|
16
|
-
// <li v-for="pic in pics" style="float:left;margin-right:1%;text-align:center;">
|
|
17
|
-
// <a :href="picCtx + pic.path" target="_blank"><img :src="picCtx + pic.path" style="max-width: 100px;max-height: 100px;" /></a><br />
|
|
18
|
-
// <a href="###" @click="delPic(pic.id);">删 除</a>
|
|
19
|
-
// </li>
|
|
20
|
-
// </ul>
|
|
21
|
-
// </td>
|
|
22
|
-
// <td>
|
|
23
|
-
// <aj-xhr-upload ref="attachmentPictureUpload" :action="uploadUrl" :is-img-upload="true" :img-place="blankBg"></aj-xhr-upload>
|
|
24
|
-
// </td>
|
|
25
|
-
// </tr>
|
|
26
|
-
// </table>
|
|
27
|
-
// `,
|
|
28
|
-
// props: {
|
|
29
|
-
// picCtx: String,
|
|
30
|
-
// uploadUrl: String,
|
|
31
|
-
// blankBg: String,
|
|
32
|
-
// delImgUrl: String,
|
|
33
|
-
// apiUrl: String
|
|
34
|
-
// },
|
|
35
|
-
// data() {
|
|
36
|
-
// return {
|
|
37
|
-
// pics: []
|
|
38
|
-
// };
|
|
39
|
-
// },
|
|
40
|
-
// mounted(): void {
|
|
41
|
-
// this.getData();
|
|
42
|
-
// this.$refs.attachmentPictureUpload.uploadOk_callback = this.getData;
|
|
43
|
-
// },
|
|
44
|
-
// methods: {
|
|
45
|
-
// getData(this: AttachmentPictureList): void {
|
|
46
|
-
// aj.xhr.get(this.apiUrl, (j: RepsonseResult) => this.pics = j.result);
|
|
47
|
-
// },
|
|
48
|
-
// delPic(this: AttachmentPictureList, picId: string): void {
|
|
49
|
-
// aj.showConfirm("确定删除相册图片?", () => {
|
|
50
|
-
// aj.xhr.dele(this.delImgUrl + picId + "/", (j: RepsonseResult) => {
|
|
51
|
-
// if (j.isOk)
|
|
52
|
-
// this.getData();// 刷新
|
|
53
|
-
// });
|
|
54
|
-
// });
|
|
55
|
-
// }
|
|
56
|
-
// }
|
|
57
|
-
// });
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
// namespace aj.list {
|
|
2
|
-
// /**
|
|
3
|
-
// * 分页列表专用的结果数据
|
|
4
|
-
// */
|
|
5
|
-
// interface PageListRepsonseResult extends RepsonseResult {
|
|
6
|
-
// /**
|
|
7
|
-
// * 结果总数
|
|
8
|
-
// */
|
|
9
|
-
// total: number;
|
|
10
|
-
// }
|
|
11
|
-
// /**
|
|
12
|
-
// * 列表数据
|
|
13
|
-
// */
|
|
14
|
-
// interface DataStore extends Ajax {
|
|
15
|
-
// /**
|
|
16
|
-
// * 是否分页,false=读取所有数据
|
|
17
|
-
// */
|
|
18
|
-
// isPage: boolean;
|
|
19
|
-
// pageStart: number;
|
|
20
|
-
// pageSize: number;
|
|
21
|
-
// initPageSize: number;
|
|
22
|
-
// total: number;
|
|
23
|
-
// /**
|
|
24
|
-
// * 请求结果
|
|
25
|
-
// */
|
|
26
|
-
// result: BaseObject[];
|
|
27
|
-
// totalPage: number;
|
|
28
|
-
// currentPage: number;
|
|
29
|
-
// /**
|
|
30
|
-
// * 默认的分页参数其名字
|
|
31
|
-
// */
|
|
32
|
-
// pageParamNames: string[];
|
|
33
|
-
// /**
|
|
34
|
-
// * 计算分页
|
|
35
|
-
// */
|
|
36
|
-
// count(): void;
|
|
37
|
-
// }
|
|
38
|
-
// /**
|
|
39
|
-
// * 本地数据仓库
|
|
40
|
-
// * 一般情况下不会单独使用这个组件
|
|
41
|
-
// */
|
|
42
|
-
// export var datastore = {
|
|
43
|
-
// props: {
|
|
44
|
-
// apiUrl: { type: String, required: true }, // JSON 接口地址
|
|
45
|
-
// isPage: { type: Boolean, default: true },
|
|
46
|
-
// initPageSize: { type: Number, required: false, default: 9 },
|
|
47
|
-
// isAutoLoad: { type: Boolean, default: true },
|
|
48
|
-
// baseParam: { type: Object, default() { return {}; } },
|
|
49
|
-
// pageParamNames: { type: Array, default() { return ['start', 'limit']; } }, // 默认的分页参数其名字
|
|
50
|
-
// onLoad: Function
|
|
51
|
-
// },
|
|
52
|
-
// data(this: DataStore) {
|
|
53
|
-
// return {
|
|
54
|
-
// result: [],
|
|
55
|
-
// extraParam: {}, // 与 baseParam 合并后每次请求可发送的,可以修改的
|
|
56
|
-
// pageSize: this.initPageSize,
|
|
57
|
-
// total: 0,
|
|
58
|
-
// totalPage: 0,
|
|
59
|
-
// pageStart: 0,
|
|
60
|
-
// currentPage: 0
|
|
61
|
-
// };
|
|
62
|
-
// },
|
|
63
|
-
// methods: {
|
|
64
|
-
// /**
|
|
65
|
-
// * 分页,跳到第几页,下拉控件传入指定的页码
|
|
66
|
-
// *
|
|
67
|
-
// * @param this
|
|
68
|
-
// * @param ev
|
|
69
|
-
// */
|
|
70
|
-
// jumpPageBySelect(this: DataStore, ev: Event): void {
|
|
71
|
-
// let selectEl: HTMLSelectElement = <HTMLSelectElement>ev.target;
|
|
72
|
-
// let currentPage: string = selectEl.options[selectEl.selectedIndex].value;
|
|
73
|
-
// this.pageStart = (Number(currentPage) - 1) * this.pageSize;
|
|
74
|
-
// this.getData();
|
|
75
|
-
// },
|
|
76
|
-
// /**
|
|
77
|
-
// * PageSize 改变时候重新分页
|
|
78
|
-
// *
|
|
79
|
-
// * @param this
|
|
80
|
-
// * @param ev
|
|
81
|
-
// */
|
|
82
|
-
// onPageSizeChange(this: DataStore, ev: Event): void {
|
|
83
|
-
// this.pageSize = Number((<HTMLInputElement>ev.target).value);
|
|
84
|
-
// this.count();
|
|
85
|
-
// this.getData();
|
|
86
|
-
// },
|
|
87
|
-
// count(this: DataStore): void {
|
|
88
|
-
// let totalPage: number = this.total / this.pageSize, yushu: number = this.total % this.pageSize;
|
|
89
|
-
// this.totalPage = parseInt(String(yushu == 0 ? totalPage : totalPage + 1));
|
|
90
|
-
// //@ts-ignore
|
|
91
|
-
// this.currentPage = parseInt((this.pageStart / this.pageSize) + 1);
|
|
92
|
-
// },
|
|
93
|
-
// /**
|
|
94
|
-
// * 前一页
|
|
95
|
-
// *
|
|
96
|
-
// * @param this
|
|
97
|
-
// */
|
|
98
|
-
// previousPage(this: DataStore): void {
|
|
99
|
-
// this.pageStart -= this.pageSize;
|
|
100
|
-
// //@ts-ignore
|
|
101
|
-
// this.currentPage = parseInt((this.pageStart / this.pageSize) + 1);
|
|
102
|
-
// this.getData();
|
|
103
|
-
// },
|
|
104
|
-
// /**
|
|
105
|
-
// * 下一页
|
|
106
|
-
// *
|
|
107
|
-
// * @param this
|
|
108
|
-
// */
|
|
109
|
-
// nextPage(this: DataStore): void {
|
|
110
|
-
// this.pageStart += this.pageSize;
|
|
111
|
-
// this.currentPage = (this.pageStart / this.pageSize) + 1;
|
|
112
|
-
// this.getData();
|
|
113
|
-
// }
|
|
114
|
-
// }
|
|
115
|
-
// };
|
|
116
|
-
// /**
|
|
117
|
-
// * 列表控件
|
|
118
|
-
// */
|
|
119
|
-
// interface List extends DataStore, Vue {
|
|
120
|
-
// /**
|
|
121
|
-
// * 数据分页是否追加模式,默认不追加 = false。 App 一般采用追加模式
|
|
122
|
-
// */
|
|
123
|
-
// isDataAppend: boolean;
|
|
124
|
-
// /**
|
|
125
|
-
// * 到达底部是否自动加载下一页,通常在 移动端使用,这个应该是元素的 CSS Selector
|
|
126
|
-
// */
|
|
127
|
-
// autoLoadWhenReachedBottom: boolean;
|
|
128
|
-
// }
|
|
129
|
-
// Vue.component('aj-list', {
|
|
130
|
-
// mixins: [datastore],
|
|
131
|
-
// template: html`
|
|
132
|
-
// <div class="aj-list">
|
|
133
|
-
// <slot name="header" v-if="total != 0"></slot>
|
|
134
|
-
// <ul v-if="showDefaultUi && (total != 0)">
|
|
135
|
-
// <li v-for="(item, index) in result">
|
|
136
|
-
// <slot v-bind="item">
|
|
137
|
-
// <a href="#" @click="show(item.id, index, $event)" :id="item.id">{{item.name}}</a>
|
|
138
|
-
// </slot>
|
|
139
|
-
// </li>
|
|
140
|
-
// </ul>
|
|
141
|
-
// <div class="no-data" v-show="isPage && total == 0">未有任何数据</div>
|
|
142
|
-
// <footer v-if="isPage" class="pager">
|
|
143
|
-
// <a v-if="pageStart > 0" href="#" @click="previousPage">上一页</a>
|
|
144
|
-
// <a v-if="(pageStart > 0 ) && (pageStart + pageSize < total)" style="text-decoration: none;"> | </a>
|
|
145
|
-
// <a v-if="pageStart + pageSize < total" href="#" @click="nextPage">下一页</a>
|
|
146
|
-
// <a href="javascript:;" @click="getData"><i class="fa fa-refresh" aria-hidden="true"></i> 刷新</a>
|
|
147
|
-
// <input type="hidden" name="start" :value="pageStart" />
|
|
148
|
-
// 页数:{{currentPage}}/{{totalPage}} 记录数:{{pageStart}}/{{total}}
|
|
149
|
-
// 每页记录数: <input size="2" title="输入一个数字确定每页记录数" type="text" :value="pageSize" @change="onPageSizeChange" />
|
|
150
|
-
// 跳转:
|
|
151
|
-
// <select @change="jumpPageBySelect">
|
|
152
|
-
// <option :value="n" v-for="n in totalPage">{{n}}</option>
|
|
153
|
-
// </select>
|
|
154
|
-
// </footer>
|
|
155
|
-
// <div v-show="!!autoLoadWhenReachedBottom" class="buttom"></div>
|
|
156
|
-
// </div>
|
|
157
|
-
// `,
|
|
158
|
-
// props: {
|
|
159
|
-
// showDefaultUi: { type: Boolean, default: true }, // 如果只是单纯作为分页组件,那么则不需要 UI
|
|
160
|
-
// isShowFooter: { type: Boolean, default: true }, // 是否显示分页 UI
|
|
161
|
-
// hrefStr: { type: String, required: false },
|
|
162
|
-
// autoLoadWhenReachedBottom: { type: String, default: '' },
|
|
163
|
-
// isDataAppend: { type: Boolean, default: false }
|
|
164
|
-
// },
|
|
165
|
-
// mounted(this: List): void {
|
|
166
|
-
// this.isAutoLoad && this.getData();
|
|
167
|
-
// // this.BUS.$on('base-param-change', this.onExtraParamChange.bind(this));
|
|
168
|
-
// if (!!this.autoLoadWhenReachedBottom) {
|
|
169
|
-
// // var scrollSpy = new aj.scrollSpy({ scrollInElement: aj(this.autoLoadWhenReachedBottom), spyOn: thish.$el.$('.buttom') });
|
|
170
|
-
// // scrollSpy.onScrollSpyBackInSight = e => this.nextPage();
|
|
171
|
-
// }
|
|
172
|
-
// },
|
|
173
|
-
// methods: {
|
|
174
|
-
// getData(this: List): void {
|
|
175
|
-
// this.lastRequestParam = {};
|
|
176
|
-
// aj.apply(this.lastRequestParam, this.baseParam);
|
|
177
|
-
// aj.apply(this.lastRequestParam, this.extraParam);
|
|
178
|
-
// initPageParams.call(this);
|
|
179
|
-
// xhr.get(this.apiUrl, this.onLoad || ((j: PageListRepsonseResult) => {
|
|
180
|
-
// if (j.result) {
|
|
181
|
-
// if (this.isPage && j.total === undefined)
|
|
182
|
-
// aj.alert('JSON 缺少 total 字段');
|
|
183
|
-
// if (j.total == 0 || j.result.length == 0)
|
|
184
|
-
// aj.alert('没有找到任何记录');
|
|
185
|
-
// this.result = j.result;
|
|
186
|
-
// if (this.isPage) {
|
|
187
|
-
// this.total = j.total;
|
|
188
|
-
// this.count();
|
|
189
|
-
// }
|
|
190
|
-
// }
|
|
191
|
-
// this.$emit('pager-result', this.result);
|
|
192
|
-
// }), this.lastRequestParam);
|
|
193
|
-
// },
|
|
194
|
-
// /**
|
|
195
|
-
// * 复位
|
|
196
|
-
// *
|
|
197
|
-
// * @param this
|
|
198
|
-
// */
|
|
199
|
-
// reset(this: List): void {
|
|
200
|
-
// this.total = this.totalPage = this.pageStart = this.currentPage = 0;
|
|
201
|
-
// this.pageSize = this.initPageSize;
|
|
202
|
-
// },
|
|
203
|
-
// onExtraParamChange(this: List, params: JsonParam): void {
|
|
204
|
-
// aj.apply(this.extraParam, params);
|
|
205
|
-
// this.pageStart = 0; // 每次 extraParam 被改变,都是从第一笔开始
|
|
206
|
-
// this.getData();
|
|
207
|
-
// }
|
|
208
|
-
// },
|
|
209
|
-
// watch: {
|
|
210
|
-
// extraParam(this: List): void {
|
|
211
|
-
// this.getData();
|
|
212
|
-
// }
|
|
213
|
-
// }
|
|
214
|
-
// });
|
|
215
|
-
// /**
|
|
216
|
-
// * 生成分页参数的名字
|
|
217
|
-
// *
|
|
218
|
-
// * @param this
|
|
219
|
-
// */
|
|
220
|
-
// function initPageParams(this: List) {
|
|
221
|
-
// let params: { [key: string]: number } = {};
|
|
222
|
-
// params[this.pageParamNames[0]] = this.pageStart;
|
|
223
|
-
// params[this.pageParamNames[1]] = this.pageSize;
|
|
224
|
-
// this.isPage && aj.apply(this.lastRequestParam, params);
|
|
225
|
-
// }
|
|
226
|
-
// }
|
|
227
|
-
//# sourceMappingURL=list.js.map
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// namespace aj.list {
|
|
4
|
-
// /**
|
|
5
|
-
// * 分页列表专用的结果数据
|
|
6
|
-
// */
|
|
7
|
-
// interface PageListRepsonseResult extends RepsonseResult {
|
|
8
|
-
// /**
|
|
9
|
-
// * 结果总数
|
|
10
|
-
// */
|
|
11
|
-
// total: number;
|
|
12
|
-
// }
|
|
13
|
-
|
|
14
|
-
// /**
|
|
15
|
-
// * 列表数据
|
|
16
|
-
// */
|
|
17
|
-
// interface DataStore extends Ajax {
|
|
18
|
-
// /**
|
|
19
|
-
// * 是否分页,false=读取所有数据
|
|
20
|
-
// */
|
|
21
|
-
// isPage: boolean;
|
|
22
|
-
|
|
23
|
-
// pageStart: number;
|
|
24
|
-
|
|
25
|
-
// pageSize: number;
|
|
26
|
-
|
|
27
|
-
// initPageSize: number;
|
|
28
|
-
|
|
29
|
-
// total: number;
|
|
30
|
-
|
|
31
|
-
// /**
|
|
32
|
-
// * 请求结果
|
|
33
|
-
// */
|
|
34
|
-
// result: BaseObject[];
|
|
35
|
-
|
|
36
|
-
// totalPage: number;
|
|
37
|
-
|
|
38
|
-
// currentPage: number;
|
|
39
|
-
|
|
40
|
-
// /**
|
|
41
|
-
// * 默认的分页参数其名字
|
|
42
|
-
// */
|
|
43
|
-
// pageParamNames: string[];
|
|
44
|
-
|
|
45
|
-
// /**
|
|
46
|
-
// * 计算分页
|
|
47
|
-
// */
|
|
48
|
-
// count(): void;
|
|
49
|
-
// }
|
|
50
|
-
|
|
51
|
-
// /**
|
|
52
|
-
// * 本地数据仓库
|
|
53
|
-
// * 一般情况下不会单独使用这个组件
|
|
54
|
-
// */
|
|
55
|
-
// export var datastore = {
|
|
56
|
-
// props: {
|
|
57
|
-
// apiUrl: { type: String, required: true }, // JSON 接口地址
|
|
58
|
-
// isPage: { type: Boolean, default: true },
|
|
59
|
-
// initPageSize: { type: Number, required: false, default: 9 },
|
|
60
|
-
// isAutoLoad: { type: Boolean, default: true },
|
|
61
|
-
// baseParam: { type: Object, default() { return {}; } },
|
|
62
|
-
// pageParamNames: { type: Array, default() { return ['start', 'limit']; } }, // 默认的分页参数其名字
|
|
63
|
-
// onLoad: Function
|
|
64
|
-
// },
|
|
65
|
-
// data(this: DataStore) {
|
|
66
|
-
// return {
|
|
67
|
-
// result: [],
|
|
68
|
-
// extraParam: {}, // 与 baseParam 合并后每次请求可发送的,可以修改的
|
|
69
|
-
// pageSize: this.initPageSize,
|
|
70
|
-
// total: 0,
|
|
71
|
-
// totalPage: 0,
|
|
72
|
-
// pageStart: 0,
|
|
73
|
-
// currentPage: 0
|
|
74
|
-
// };
|
|
75
|
-
// },
|
|
76
|
-
|
|
77
|
-
// methods: {
|
|
78
|
-
// /**
|
|
79
|
-
// * 分页,跳到第几页,下拉控件传入指定的页码
|
|
80
|
-
// *
|
|
81
|
-
// * @param this
|
|
82
|
-
// * @param ev
|
|
83
|
-
// */
|
|
84
|
-
// jumpPageBySelect(this: DataStore, ev: Event): void {
|
|
85
|
-
// let selectEl: HTMLSelectElement = <HTMLSelectElement>ev.target;
|
|
86
|
-
// let currentPage: string = selectEl.options[selectEl.selectedIndex].value;
|
|
87
|
-
|
|
88
|
-
// this.pageStart = (Number(currentPage) - 1) * this.pageSize;
|
|
89
|
-
// this.getData();
|
|
90
|
-
// },
|
|
91
|
-
|
|
92
|
-
// /**
|
|
93
|
-
// * PageSize 改变时候重新分页
|
|
94
|
-
// *
|
|
95
|
-
// * @param this
|
|
96
|
-
// * @param ev
|
|
97
|
-
// */
|
|
98
|
-
// onPageSizeChange(this: DataStore, ev: Event): void {
|
|
99
|
-
// this.pageSize = Number((<HTMLInputElement>ev.target).value);
|
|
100
|
-
// this.count();
|
|
101
|
-
// this.getData();
|
|
102
|
-
// },
|
|
103
|
-
|
|
104
|
-
// count(this: DataStore): void {
|
|
105
|
-
// let totalPage: number = this.total / this.pageSize, yushu: number = this.total % this.pageSize;
|
|
106
|
-
// this.totalPage = parseInt(String(yushu == 0 ? totalPage : totalPage + 1));
|
|
107
|
-
// //@ts-ignore
|
|
108
|
-
// this.currentPage = parseInt((this.pageStart / this.pageSize) + 1);
|
|
109
|
-
// },
|
|
110
|
-
|
|
111
|
-
// /**
|
|
112
|
-
// * 前一页
|
|
113
|
-
// *
|
|
114
|
-
// * @param this
|
|
115
|
-
// */
|
|
116
|
-
// previousPage(this: DataStore): void {
|
|
117
|
-
// this.pageStart -= this.pageSize;
|
|
118
|
-
// //@ts-ignore
|
|
119
|
-
// this.currentPage = parseInt((this.pageStart / this.pageSize) + 1);
|
|
120
|
-
|
|
121
|
-
// this.getData();
|
|
122
|
-
// },
|
|
123
|
-
|
|
124
|
-
// /**
|
|
125
|
-
// * 下一页
|
|
126
|
-
// *
|
|
127
|
-
// * @param this
|
|
128
|
-
// */
|
|
129
|
-
// nextPage(this: DataStore): void {
|
|
130
|
-
// this.pageStart += this.pageSize;
|
|
131
|
-
// this.currentPage = (this.pageStart / this.pageSize) + 1;
|
|
132
|
-
|
|
133
|
-
// this.getData();
|
|
134
|
-
// }
|
|
135
|
-
// }
|
|
136
|
-
// };
|
|
137
|
-
|
|
138
|
-
// /**
|
|
139
|
-
// * 列表控件
|
|
140
|
-
// */
|
|
141
|
-
// interface List extends DataStore, Vue {
|
|
142
|
-
// /**
|
|
143
|
-
// * 数据分页是否追加模式,默认不追加 = false。 App 一般采用追加模式
|
|
144
|
-
// */
|
|
145
|
-
// isDataAppend: boolean;
|
|
146
|
-
|
|
147
|
-
// /**
|
|
148
|
-
// * 到达底部是否自动加载下一页,通常在 移动端使用,这个应该是元素的 CSS Selector
|
|
149
|
-
// */
|
|
150
|
-
// autoLoadWhenReachedBottom: boolean;
|
|
151
|
-
// }
|
|
152
|
-
|
|
153
|
-
// Vue.component('aj-list', {
|
|
154
|
-
// mixins: [datastore],
|
|
155
|
-
// template: html`
|
|
156
|
-
// <div class="aj-list">
|
|
157
|
-
// <slot name="header" v-if="total != 0"></slot>
|
|
158
|
-
// <ul v-if="showDefaultUi && (total != 0)">
|
|
159
|
-
// <li v-for="(item, index) in result">
|
|
160
|
-
// <slot v-bind="item">
|
|
161
|
-
// <a href="#" @click="show(item.id, index, $event)" :id="item.id">{{item.name}}</a>
|
|
162
|
-
// </slot>
|
|
163
|
-
// </li>
|
|
164
|
-
// </ul>
|
|
165
|
-
// <div class="no-data" v-show="isPage && total == 0">未有任何数据</div>
|
|
166
|
-
// <footer v-if="isPage" class="pager">
|
|
167
|
-
// <a v-if="pageStart > 0" href="#" @click="previousPage">上一页</a>
|
|
168
|
-
// <a v-if="(pageStart > 0 ) && (pageStart + pageSize < total)" style="text-decoration: none;"> | </a>
|
|
169
|
-
// <a v-if="pageStart + pageSize < total" href="#" @click="nextPage">下一页</a>
|
|
170
|
-
// <a href="javascript:;" @click="getData"><i class="fa fa-refresh" aria-hidden="true"></i> 刷新</a>
|
|
171
|
-
// <input type="hidden" name="start" :value="pageStart" />
|
|
172
|
-
// 页数:{{currentPage}}/{{totalPage}} 记录数:{{pageStart}}/{{total}}
|
|
173
|
-
// 每页记录数: <input size="2" title="输入一个数字确定每页记录数" type="text" :value="pageSize" @change="onPageSizeChange" />
|
|
174
|
-
// 跳转:
|
|
175
|
-
// <select @change="jumpPageBySelect">
|
|
176
|
-
// <option :value="n" v-for="n in totalPage">{{n}}</option>
|
|
177
|
-
// </select>
|
|
178
|
-
// </footer>
|
|
179
|
-
// <div v-show="!!autoLoadWhenReachedBottom" class="buttom"></div>
|
|
180
|
-
// </div>
|
|
181
|
-
// `,
|
|
182
|
-
// props: {
|
|
183
|
-
// showDefaultUi: { type: Boolean, default: true }, // 如果只是单纯作为分页组件,那么则不需要 UI
|
|
184
|
-
// isShowFooter: { type: Boolean, default: true }, // 是否显示分页 UI
|
|
185
|
-
// hrefStr: { type: String, required: false },
|
|
186
|
-
// autoLoadWhenReachedBottom: { type: String, default: '' },
|
|
187
|
-
// isDataAppend: { type: Boolean, default: false }
|
|
188
|
-
// },
|
|
189
|
-
// mounted(this: List): void {
|
|
190
|
-
// this.isAutoLoad && this.getData();
|
|
191
|
-
|
|
192
|
-
// // this.BUS.$on('base-param-change', this.onExtraParamChange.bind(this));
|
|
193
|
-
// if (!!this.autoLoadWhenReachedBottom) {
|
|
194
|
-
// // var scrollSpy = new aj.scrollSpy({ scrollInElement: aj(this.autoLoadWhenReachedBottom), spyOn: thish.$el.$('.buttom') });
|
|
195
|
-
// // scrollSpy.onScrollSpyBackInSight = e => this.nextPage();
|
|
196
|
-
// }
|
|
197
|
-
// },
|
|
198
|
-
// methods: {
|
|
199
|
-
// getData(this: List): void {
|
|
200
|
-
// this.lastRequestParam = {};
|
|
201
|
-
// aj.apply(this.lastRequestParam, this.baseParam);
|
|
202
|
-
// aj.apply(this.lastRequestParam, this.extraParam);
|
|
203
|
-
// initPageParams.call(this);
|
|
204
|
-
|
|
205
|
-
// xhr.get(this.apiUrl, this.onLoad || ((j: PageListRepsonseResult) => {
|
|
206
|
-
// if (j.result) {
|
|
207
|
-
// if (this.isPage && j.total === undefined)
|
|
208
|
-
// aj.alert('JSON 缺少 total 字段');
|
|
209
|
-
|
|
210
|
-
// if (j.total == 0 || j.result.length == 0)
|
|
211
|
-
// aj.alert('没有找到任何记录');
|
|
212
|
-
|
|
213
|
-
// this.result = j.result;
|
|
214
|
-
|
|
215
|
-
// if (this.isPage) {
|
|
216
|
-
// this.total = j.total;
|
|
217
|
-
// this.count();
|
|
218
|
-
// }
|
|
219
|
-
// }
|
|
220
|
-
|
|
221
|
-
// this.$emit('pager-result', this.result);
|
|
222
|
-
// }), this.lastRequestParam);
|
|
223
|
-
// },
|
|
224
|
-
|
|
225
|
-
// /**
|
|
226
|
-
// * 复位
|
|
227
|
-
// *
|
|
228
|
-
// * @param this
|
|
229
|
-
// */
|
|
230
|
-
// reset(this: List): void {
|
|
231
|
-
// this.total = this.totalPage = this.pageStart = this.currentPage = 0;
|
|
232
|
-
// this.pageSize = this.initPageSize;
|
|
233
|
-
// },
|
|
234
|
-
|
|
235
|
-
// onExtraParamChange(this: List, params: JsonParam): void {
|
|
236
|
-
// aj.apply(this.extraParam, params);
|
|
237
|
-
|
|
238
|
-
// this.pageStart = 0; // 每次 extraParam 被改变,都是从第一笔开始
|
|
239
|
-
// this.getData();
|
|
240
|
-
// }
|
|
241
|
-
// },
|
|
242
|
-
// watch: {
|
|
243
|
-
// extraParam(this: List): void {
|
|
244
|
-
// this.getData();
|
|
245
|
-
// }
|
|
246
|
-
// }
|
|
247
|
-
// });
|
|
248
|
-
|
|
249
|
-
// /**
|
|
250
|
-
// * 生成分页参数的名字
|
|
251
|
-
// *
|
|
252
|
-
// * @param this
|
|
253
|
-
// */
|
|
254
|
-
// function initPageParams(this: List) {
|
|
255
|
-
// let params: { [key: string]: number } = {};
|
|
256
|
-
// params[this.pageParamNames[0]] = this.pageStart;
|
|
257
|
-
// params[this.pageParamNames[1]] = this.pageSize;
|
|
258
|
-
|
|
259
|
-
// this.isPage && aj.apply(this.lastRequestParam, params);
|
|
260
|
-
// }
|
|
261
|
-
// }
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ul class="aj-accordion-menu" @click="onClk">
|
|
3
|
-
<slot></slot>
|
|
4
|
-
</ul>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
/**
|
|
9
|
-
* 内部子菜单的高亮
|
|
10
|
-
*
|
|
11
|
-
* @param ev
|
|
12
|
-
*/
|
|
13
|
-
function highlightSubItem(ev: Event) {
|
|
14
|
-
let li: Element,
|
|
15
|
-
el: Element = ev.target as Element;
|
|
16
|
-
|
|
17
|
-
if (el.tagName == "A" && el.getAttribute("target")) {
|
|
18
|
-
li = el.parentNode as Element;
|
|
19
|
-
li.querySelectorAll("li").forEach((_el: Element) => {
|
|
20
|
-
if (_el == li) _el.classList.add("selected");
|
|
21
|
-
else _el.classList.remove("selected");
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default {
|
|
27
|
-
methods: {
|
|
28
|
-
onClk(ev: Event): void {
|
|
29
|
-
let children: HTMLCollection = this.$el.children;
|
|
30
|
-
highlightSubItem(ev);
|
|
31
|
-
let _btn: Element = ev.target as Element;
|
|
32
|
-
|
|
33
|
-
if (
|
|
34
|
-
_btn &&
|
|
35
|
-
_btn.tagName == "H3" &&
|
|
36
|
-
(_btn.parentNode as Element).tagName == "LI"
|
|
37
|
-
) {
|
|
38
|
-
_btn = _btn.parentNode as Element;
|
|
39
|
-
|
|
40
|
-
for (let btn, i = 0, j = children.length; i < j; i++) {
|
|
41
|
-
btn = children[i];
|
|
42
|
-
let ul = btn.querySelector("ul");
|
|
43
|
-
|
|
44
|
-
if (btn == _btn) {
|
|
45
|
-
if (btn.className.indexOf("pressed") != -1) {
|
|
46
|
-
btn.classList.remove("pressed"); // 再次点击,隐藏!
|
|
47
|
-
if (ul) ul.style.height = "0px";
|
|
48
|
-
} else {
|
|
49
|
-
if (ul) ul.style.height = ul.scrollHeight + "px";
|
|
50
|
-
btn.classList.add("pressed");
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
btn.classList.remove("pressed");
|
|
54
|
-
if (ul) ul.style.height = "0px";
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
} else return;
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
</script>
|
|
62
|
-
|
|
63
|
-
<style lang="less" scoped>
|
|
64
|
-
// 折叠菜单 Accordion Menu
|
|
65
|
-
.aj-accordion {
|
|
66
|
-
& > li h3 {
|
|
67
|
-
cursor: pointer;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.pressed {
|
|
71
|
-
& h3 {
|
|
72
|
-
color: black;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
& > li > ul {
|
|
77
|
-
.transition (height .5s cubic-bezier(0, 1, 0.5, 1));;
|
|
78
|
-
overflow: hidden;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
ul {
|
|
82
|
-
height: 0;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.aj-accordion-menu {
|
|
87
|
-
.aj-accordion ();
|
|
88
|
-
overflow: hidden;
|
|
89
|
-
|
|
90
|
-
& > li {
|
|
91
|
-
border-top: 1px solid white;
|
|
92
|
-
border-bottom: 1px solid lightgray;
|
|
93
|
-
|
|
94
|
-
&.pressed {
|
|
95
|
-
border-top: 0;
|
|
96
|
-
border-bottom: 1px solid lightgray;
|
|
97
|
-
box-shadow: inset 0px 10px 15px -15px gray;
|
|
98
|
-
|
|
99
|
-
h3 {
|
|
100
|
-
font-weight: bold;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
ul {
|
|
105
|
-
li {
|
|
106
|
-
// list-style-type: disc;
|
|
107
|
-
padding-left: 15%;
|
|
108
|
-
|
|
109
|
-
a {
|
|
110
|
-
width: 100%;
|
|
111
|
-
display: block;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
&.selected {
|
|
115
|
-
a {
|
|
116
|
-
color: black;
|
|
117
|
-
font-weight: bold;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
h3,
|
|
124
|
-
li {
|
|
125
|
-
padding: 5px 0 5px 15px;
|
|
126
|
-
letter-spacing: 2px;
|
|
127
|
-
line-height: 20px;
|
|
128
|
-
color: #939da8;
|
|
129
|
-
font-size: 12px;
|
|
130
|
-
|
|
131
|
-
&:hover,
|
|
132
|
-
a:hover {
|
|
133
|
-
color: black;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
</style>
|