arisu.js 1.0.0 → 1.0.3
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/README.md +3 -1
- package/deprecated/arisu-1.2.js +3307 -0
- package/deprecated/arisu-1.3.js +3718 -0
- package/deprecated/arisu.min.js +1 -0
- package/deprecated/base-2.0.js +948 -0
- package/deprecated/early/base-1.2.js +1090 -0
- package/deprecated/export-method.js +467 -0
- package/deprecated/jquery.module.js +299 -0
- package/deprecated/jquery.template.js +82 -0
- package/deprecated/main-2.0.js +278 -0
- package/deprecated/single-vue.js +47 -0
- package/deprecated/single.js +130 -0
- package/deprecated/utils-1.2.js +2774 -0
- package/dist/arisu.commonjs.min.js +1 -0
- package/dist/arisu.js +43 -5
- package/dist/arisu.min.js +1 -1
- package/dist/arisu.module.min.js +1 -0
- package/dist/arisu.window.min.js +1 -0
- package/package.json +1 -1
- package/src/js/base.js +43 -5
- package/webpack.config.js +44 -7
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* import { meanmenu, owlCarousel } from '../js/jquery.module.js';
|
|
4
|
+
*
|
|
5
|
+
* 方便jQuery插件在module模式下使用
|
|
6
|
+
*
|
|
7
|
+
* **/
|
|
8
|
+
|
|
9
|
+
import $ from 'jquery';
|
|
10
|
+
|
|
11
|
+
/** meanmenu导航菜单,安装好把meanmenu.min.js、meanmenu.min.css复制到szmigiel-meanmenu目录,跟本地版本有偏差,不建议使用npm安装版:npm i szmigiel-meanmenu@1.0.2 **/
|
|
12
|
+
// import 'szmigiel-meanmenu//meanmenu.min';
|
|
13
|
+
import '../js/meanMenu/meanmenu.min';
|
|
14
|
+
|
|
15
|
+
/** owlCarousel滚屏插件:npm i owl.carousel@2.3.4 **/
|
|
16
|
+
import 'owl.carousel/dist/owl.carousel.min';
|
|
17
|
+
|
|
18
|
+
/** textillate文字动画组件依赖animate.css:npm i textillate@0.4.1 **/
|
|
19
|
+
import 'textillate/assets/jquery.fittext.js'
|
|
20
|
+
import 'textillate/assets/jquery.lettering.js'
|
|
21
|
+
import 'textillate/jquery.textillate.js'
|
|
22
|
+
|
|
23
|
+
/** jquery.form表单提交出来工具:npm i jquery-form@4.3.0,可能有点问题还要用npm i jquery-form@3.50.0 **/
|
|
24
|
+
// import 'jquery-form/dist/jquery.form.min';
|
|
25
|
+
import 'jquery-form/jquery.form';
|
|
26
|
+
|
|
27
|
+
/** Messenger消息框
|
|
28
|
+
import 'messenger-hubspot/build/css/messenger.css';
|
|
29
|
+
import 'messenger-hubspot/build/css/messenger-spinner.css';
|
|
30
|
+
import 'messenger-hubspot/build/css/messenger-theme-ice.css';
|
|
31
|
+
import 'messenger-hubspot/build/js/messenger.min';
|
|
32
|
+
import 'messenger-hubspot/build/js/messenger-theme-future.js';
|
|
33
|
+
**/
|
|
34
|
+
|
|
35
|
+
/** 自主研发组件 **/
|
|
36
|
+
import '../js/arisu.min'
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 导入
|
|
40
|
+
* import jm from './js/jquery.module'
|
|
41
|
+
* 使用
|
|
42
|
+
* jm.test();
|
|
43
|
+
* **/
|
|
44
|
+
class JM {
|
|
45
|
+
|
|
46
|
+
constructor() {}
|
|
47
|
+
|
|
48
|
+
/** meanmenu导航菜单,跟本地版本有偏差,不建议使用:npm i szmigiel-meanmenu@1.0.2
|
|
49
|
+
<pre>
|
|
50
|
+
meanmenu(".mean-menu", {
|
|
51
|
+
meanScreenWidth: "991"
|
|
52
|
+
});
|
|
53
|
+
</pre>
|
|
54
|
+
**/
|
|
55
|
+
meanmenu(target, options) {
|
|
56
|
+
$(target).meanmenu(options);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
/** owlCarousel滚屏插件,官方提供的版本在vite上需要在vite.config.js配置:npm i owl.carousel@2.3.4
|
|
61
|
+
<pre>
|
|
62
|
+
plugins: [
|
|
63
|
+
inject({
|
|
64
|
+
$: 'jquery',
|
|
65
|
+
jQuery: 'jquery',
|
|
66
|
+
'windows.jQuery': 'jquery',
|
|
67
|
+
'window.$': 'jquery', //修改添加
|
|
68
|
+
'window.Zepto': 'jquery' //修改添加
|
|
69
|
+
})
|
|
70
|
+
],
|
|
71
|
+
|
|
72
|
+
owlCarousel("#carousel-image", {
|
|
73
|
+
//rtl:true,
|
|
74
|
+
loop:true,
|
|
75
|
+
//animateOut: "animate__animated animate__slideOutDown",
|
|
76
|
+
//animateIn: "animate__animated animate__fadeIn",
|
|
77
|
+
//animateOut: "fadeOut",
|
|
78
|
+
autoplay: true,
|
|
79
|
+
autoplayTimeout: 10000,
|
|
80
|
+
autoplayHoverPause: true,
|
|
81
|
+
items: 1,
|
|
82
|
+
nav: true,
|
|
83
|
+
addClassActive: "active",
|
|
84
|
+
navText : ["<img src='images/ix-left.png' class='img-responsive'></img>", "<img src='images/ix-right.png' class='img-responsive'></img>"],
|
|
85
|
+
onInitialized: function(e) {
|
|
86
|
+
$(".ix-cd-1").textillate({
|
|
87
|
+
in: {effect: "animate__animated animate__fadeInLeftBig", sequence: false, sync: false, shuffle: false, reverse: true}
|
|
88
|
+
});
|
|
89
|
+
$(".ix-cd-2").textillate({in: {effect: "animate__animated animate__fadeInRightBig"}});
|
|
90
|
+
$(".ix-cd-3").textillate({in: {effect: "animate__animated animate__wobble"}});
|
|
91
|
+
$(".ix-cd-4").textillate({in: {effect: "animate__animated animate__fadeInUp"}});
|
|
92
|
+
$(".ix-cd-5").textillate({in: {effect: "animate__animated animate__fadeInDown"}});
|
|
93
|
+
},
|
|
94
|
+
onChanged: function(e) {
|
|
95
|
+
//debug($( ".owl-item:eq(" + this.currentItem +")"));
|
|
96
|
+
//alert($(".mn-cd-1", ".owl-item:eq(" + this.currentItem +")").html());
|
|
97
|
+
//$(".ix-cd-1, .ix-cd-2, .ix-cd-3, .ix-cd-4, .ix-cd-5", ".owl-item:eq(" + this.currentItem +")").textillate("start");
|
|
98
|
+
$(".ix-cd-1, .ix-cd-2, .ix-cd-3, .ix-cd-4, .ix-cd-5", ".owl-item:eq(" + e.item.index +")").textillate("start");
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
</pre>
|
|
102
|
+
**/
|
|
103
|
+
owlCarousel(target, options) {
|
|
104
|
+
// import('../js/plugin/OwlCarousel2-2.3.4/owl.carousel').then(() => {
|
|
105
|
+
// import('owl.carousel/dist/owl.carousel.min').then(() => {
|
|
106
|
+
$(target).owlCarousel(options);
|
|
107
|
+
// }).catch(err => { console.error(err); });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** textillate文字动画组件依赖animate.css:npm i textillate@0.4.1
|
|
111
|
+
<pre>
|
|
112
|
+
textillate(".ix-cd-1",{
|
|
113
|
+
in: {effect: "animate__animated animate__fadeInLeftBig", sequence: false, sync: false, shuffle: false, reverse: true}
|
|
114
|
+
});
|
|
115
|
+
or
|
|
116
|
+
textillate(".ix-cd-1, .ix-cd-2, .ix-cd-3, .ix-cd-4, .ix-cd-5", ".owl-item:eq(" + e.item.index +")", {"start"});
|
|
117
|
+
|
|
118
|
+
</pre>
|
|
119
|
+
**/
|
|
120
|
+
textillate(target, options) {
|
|
121
|
+
$(target).textillate(options);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** jquery.form表单提交出来工具:npm i jquery-form@4.3.0
|
|
125
|
+
<pre>
|
|
126
|
+
formSubmit('#myForm',{
|
|
127
|
+
beforeSubmit: (formData, jqForm, options) => {
|
|
128
|
+
//调用前
|
|
129
|
+
let result = false;
|
|
130
|
+
console.log('调用前');
|
|
131
|
+
console.log(formData);
|
|
132
|
+
console.log(jqForm);
|
|
133
|
+
console.log(options);
|
|
134
|
+
let selector = jqForm.selector;
|
|
135
|
+
if (selector == "#myForm") {
|
|
136
|
+
// var isSuccessed = $("#at-form-4").validationEngine("validate");
|
|
137
|
+
// if (isSuccessed) {
|
|
138
|
+
formData.push({
|
|
139
|
+
name: "title",
|
|
140
|
+
required: false,
|
|
141
|
+
type: "text",
|
|
142
|
+
value: "为了"
|
|
143
|
+
});
|
|
144
|
+
result = true;
|
|
145
|
+
// }
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
},
|
|
149
|
+
success: (responseText, statusText, xhr, $form) => {
|
|
150
|
+
//调用成功
|
|
151
|
+
console.log('调用成功');
|
|
152
|
+
console.log(responseText);
|
|
153
|
+
console.log(statusText);
|
|
154
|
+
console.log(xhr);
|
|
155
|
+
console.log($form);
|
|
156
|
+
if (responseText.result == "200") {
|
|
157
|
+
console.log('数据正常');
|
|
158
|
+
} else {
|
|
159
|
+
console.error('调用异常');
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
error: ()=>{}
|
|
163
|
+
});
|
|
164
|
+
</pre>
|
|
165
|
+
**/
|
|
166
|
+
formSubmit(target, options) {
|
|
167
|
+
let defaults = {
|
|
168
|
+
clearForm: false, //是否清空表单
|
|
169
|
+
resetForm: false, //是否重置表单
|
|
170
|
+
type: "post",
|
|
171
|
+
dataType: "json",
|
|
172
|
+
timeout: 30000,
|
|
173
|
+
};
|
|
174
|
+
let os = $.extend({}, defaults, options);
|
|
175
|
+
$(target).submit(() => {
|
|
176
|
+
try {
|
|
177
|
+
$(target).ajaxSubmit(os);
|
|
178
|
+
} catch (e) {
|
|
179
|
+
console.log(e);
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
/** @描述:Messenger消息框,npm i messenger-hubspot@1.5.0-b2
|
|
187
|
+
<pre>
|
|
188
|
+
import 'messenger-hubspot/build/css/messenger.css';
|
|
189
|
+
import 'messenger-hubspot/build/css/messenger-spinner.css';
|
|
190
|
+
import 'messenger-hubspot/build/css/messenger-theme-air.css';
|
|
191
|
+
import 'messenger-hubspot/build/css/messenger-theme-block.css';
|
|
192
|
+
import 'messenger-hubspot/build/css/messenger-theme-flat.css';
|
|
193
|
+
import 'messenger-hubspot/build/css/messenger-theme-future.css';
|
|
194
|
+
import 'messenger-hubspot/build/css/messenger-theme-ice.css';
|
|
195
|
+
import 'messenger-hubspot/build/js/messenger.min';
|
|
196
|
+
import 'messenger-hubspot/build/js/messenger-theme-flat.js';
|
|
197
|
+
|
|
198
|
+
let msg;
|
|
199
|
+
Messenger.options = {
|
|
200
|
+
extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right',
|
|
201
|
+
theme: 'ice'
|
|
202
|
+
}
|
|
203
|
+
msg = Messenger().post({
|
|
204
|
+
message: 'Launching thermonuclear war...',
|
|
205
|
+
type: 'info',
|
|
206
|
+
actions: {
|
|
207
|
+
cancel: {
|
|
208
|
+
label: 'cancel launch',
|
|
209
|
+
action: function() {
|
|
210
|
+
return msg.update({
|
|
211
|
+
message: 'Thermonuclear war averted',
|
|
212
|
+
type: 'success',
|
|
213
|
+
actions: false
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
</pre>
|
|
220
|
+
|
|
221
|
+
al(message, type, classes, theme) {
|
|
222
|
+
let defaults = {
|
|
223
|
+
message: '',
|
|
224
|
+
type: 'info', //弹出消息类型info、error、success
|
|
225
|
+
classes: 3, //在右上显示
|
|
226
|
+
theme: 'ice', //air、block、flat、future、ice
|
|
227
|
+
hideAfter: 5,
|
|
228
|
+
showCloseButton: true
|
|
229
|
+
};
|
|
230
|
+
let options = {
|
|
231
|
+
message: message,
|
|
232
|
+
type: type,
|
|
233
|
+
classes: classes,
|
|
234
|
+
theme: theme
|
|
235
|
+
}
|
|
236
|
+
let os = $.extend({}, defaults, options);
|
|
237
|
+
let extraClasses;
|
|
238
|
+
if (classes == 1) {
|
|
239
|
+
extraClasses = "messenger-fixed messenger-theme-" + os.theme + " messenger-on-top messenger-on-left";
|
|
240
|
+
} else if (classes == 2) {
|
|
241
|
+
extraClasses = "messenger-fixed messenger-theme-" + os.theme + " messenger-on-top";
|
|
242
|
+
} else if (classes == 3) {
|
|
243
|
+
extraClasses = "messenger-fixed messenger-theme-" + os.theme + " messenger-on-top messenger-on-right";
|
|
244
|
+
} else if (classes == 4) {
|
|
245
|
+
extraClasses = "messenger-fixed messenger-theme-" + os.theme + " messenger-on-bottom messenger-on-right";
|
|
246
|
+
} else if (classes == 5) {
|
|
247
|
+
extraClasses = "messenger-fixed messenger-theme-" + os.theme + " messenger-on-bottom";
|
|
248
|
+
} else if (classes == 6) {
|
|
249
|
+
extraClasses = "messenger-fixed messenger-theme-" + os.theme + " messenger-on-bottom messenger-on-left";
|
|
250
|
+
} else {
|
|
251
|
+
extraClasses = "messenger-fixed messenger-theme-" + os.theme + " messenger-on-top";
|
|
252
|
+
}
|
|
253
|
+
Messenger.options = {
|
|
254
|
+
extraClasses: extraClasses,
|
|
255
|
+
theme: os.theme
|
|
256
|
+
}
|
|
257
|
+
Messenger().post(os);
|
|
258
|
+
}
|
|
259
|
+
**/
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
/** arisu.js 中 numStep数字递增效果方法
|
|
263
|
+
<pre>
|
|
264
|
+
numStep($("#h1"), {
|
|
265
|
+
number: 18298,
|
|
266
|
+
time: 5000
|
|
267
|
+
});
|
|
268
|
+
</pre>
|
|
269
|
+
**/
|
|
270
|
+
numStep(target, options) {
|
|
271
|
+
$(target).numStep(options);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** arisu.js 中 gotop返回页面顶部
|
|
275
|
+
<pre>
|
|
276
|
+
gotop($(".ce-gotop"), {
|
|
277
|
+
position: {
|
|
278
|
+
"bottom": 35,
|
|
279
|
+
"right": 25
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
</pre>
|
|
283
|
+
**/
|
|
284
|
+
gotop(target, options) {
|
|
285
|
+
$(target).gotop(options);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/** arisu.js 中 scrollBackground背景动画
|
|
289
|
+
<pre>
|
|
290
|
+
</pre>
|
|
291
|
+
**/
|
|
292
|
+
scrollBackground(target, options) {
|
|
293
|
+
$(target).scrollBackground(options);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export default new JM();
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
(function ($) {
|
|
2
|
+
|
|
3
|
+
$.fn.template = function (options) {
|
|
4
|
+
// 引用该JS的标签数量
|
|
5
|
+
debug(this);
|
|
6
|
+
|
|
7
|
+
// 设置默认属性和方法 start
|
|
8
|
+
var p = $.extend({
|
|
9
|
+
foreground : '#eee',
|
|
10
|
+
background : '#0000ff',
|
|
11
|
+
dataType : "json",
|
|
12
|
+
onSuccess : false,
|
|
13
|
+
onError : false
|
|
14
|
+
}, options);
|
|
15
|
+
|
|
16
|
+
var f = {
|
|
17
|
+
a: function (data) {
|
|
18
|
+
window.console.log("function a : " + p.onSuccess + " | " + data.status);
|
|
19
|
+
if (p.onSuccess) {
|
|
20
|
+
alert("2. jsp中有定义onSuccess方法才会调用 该方法");
|
|
21
|
+
p.onSuccess(this);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
b: function () {
|
|
25
|
+
window.console.log("function b");
|
|
26
|
+
// 使用ajax,成功调用后触发f.a(data)方法
|
|
27
|
+
$.ajax({
|
|
28
|
+
type: "post",
|
|
29
|
+
url: "http://ipc:8084/ari/json异常测试",
|
|
30
|
+
data: {},
|
|
31
|
+
dataType: p.dataType,
|
|
32
|
+
success: function (data) {
|
|
33
|
+
alert("1. ajax成功请求后的success方法");
|
|
34
|
+
f.a(data);
|
|
35
|
+
},
|
|
36
|
+
error: function (XMLHttpRequest, textStatus, errorThrown) {
|
|
37
|
+
try {
|
|
38
|
+
if (p.onError) p.onError(XMLHttpRequest, textStatus, errorThrown);
|
|
39
|
+
} catch (e) {}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
background : '#0000ff'
|
|
44
|
+
}
|
|
45
|
+
// 设置默认属性和方法 end
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// if(p.onSuccess)
|
|
49
|
+
// f.b();
|
|
50
|
+
|
|
51
|
+
// 方法或者属性未赋值就使用P中的数值
|
|
52
|
+
return this.each(function () {
|
|
53
|
+
$this = $(this);
|
|
54
|
+
var o = $.meta ? $.extend({}, p, $this.data()) : p;
|
|
55
|
+
// 关联自定义默认CSS属性
|
|
56
|
+
$this.css({
|
|
57
|
+
"background-color" : p.background,
|
|
58
|
+
"color" : p.foreground
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// 调用公共方法
|
|
62
|
+
var markup = $this.html();
|
|
63
|
+
markup = $.fn.template.format(markup);
|
|
64
|
+
$this.html(markup);
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
// 私有方法
|
|
70
|
+
function debug($obj) {
|
|
71
|
+
if (window.console && window.console.log)
|
|
72
|
+
window.console.log('obj size: ' + $obj.size());
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// 公共方法
|
|
76
|
+
$.fn.template.format = function (txt) {
|
|
77
|
+
return '<strong><i>' + txt + '</i></strong>';
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// 公共变量,同样是外部可见可调用的
|
|
81
|
+
$.fn.template.version = 1.0;
|
|
82
|
+
})(jQuery);
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/** *
|
|
2
|
+
* @描述:公用方法
|
|
3
|
+
* @作者:林舒涛
|
|
4
|
+
*
|
|
5
|
+
* 项目JS公用方法合集,根据项目情况继续添加,单页模板使用single.js
|
|
6
|
+
*
|
|
7
|
+
* 外部调用:
|
|
8
|
+
* var main = new Main();
|
|
9
|
+
* main.submit();
|
|
10
|
+
*
|
|
11
|
+
* 内部调用:
|
|
12
|
+
* a(name) {alert(name);}
|
|
13
|
+
* b(name) {this.a(name);}
|
|
14
|
+
* **/
|
|
15
|
+
|
|
16
|
+
"use strict";
|
|
17
|
+
export class Main {
|
|
18
|
+
|
|
19
|
+
/** 1. 构造方法 **/
|
|
20
|
+
constructor(base) {this.base = base;}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/******
|
|
24
|
+
* @描述:前后端分离,‘登录’‘获取用户’‘注销’功能,key使用user
|
|
25
|
+
* @脚本:
|
|
26
|
+
* <pre>
|
|
27
|
+
var m = new Main();
|
|
28
|
+
登录成功后执行
|
|
29
|
+
m.login(id, name, token);
|
|
30
|
+
|
|
31
|
+
验证是否登录,参数带上m.getUser().token验证是否为登录状态
|
|
32
|
+
m.getUser();
|
|
33
|
+
|
|
34
|
+
退出登录同时执行
|
|
35
|
+
m.logout();
|
|
36
|
+
* </pre>
|
|
37
|
+
* **/
|
|
38
|
+
login(id, name, token) {
|
|
39
|
+
localStorage.setItem("user", JSON.stringify({id: id, name: name, token: token}));
|
|
40
|
+
}
|
|
41
|
+
getUser() {return JSON.parse(localStorage.getItem("user"));}
|
|
42
|
+
logout() {localStorage.removeItem("user");}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
/******
|
|
46
|
+
* @描述:表单提交配置
|
|
47
|
+
* @脚本:
|
|
48
|
+
* <pre>
|
|
49
|
+
var main = new Main();
|
|
50
|
+
main.submit("#be-import-form");
|
|
51
|
+
* </pre>
|
|
52
|
+
* **/
|
|
53
|
+
submit(id) {
|
|
54
|
+
$(id).submit(function() {
|
|
55
|
+
$(id).ajaxSubmit({
|
|
56
|
+
clearForm: false, //是否清空表单
|
|
57
|
+
resetForm: false, //是否重置表单
|
|
58
|
+
type: "post",
|
|
59
|
+
dataType: "json",
|
|
60
|
+
timeout: 30000,
|
|
61
|
+
beforeSubmit: function(formData, jqForm, options) {
|
|
62
|
+
//调用前
|
|
63
|
+
var result = false;
|
|
64
|
+
var isSuccessed = $(id).validationEngine("validate");
|
|
65
|
+
if (isSuccessed) {
|
|
66
|
+
result = true;
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
},
|
|
70
|
+
success: function(responseText, statusText, xhr, $form) {
|
|
71
|
+
//调用成功
|
|
72
|
+
},
|
|
73
|
+
error: base.error
|
|
74
|
+
});
|
|
75
|
+
return false;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/******
|
|
80
|
+
* @描述:表单验证
|
|
81
|
+
* @脚本:
|
|
82
|
+
* <pre>
|
|
83
|
+
var main = new Main();
|
|
84
|
+
main.validate();
|
|
85
|
+
|
|
86
|
+
表单中input添加的验证class
|
|
87
|
+
validate[required, maxSize[50]] 最大50个字符
|
|
88
|
+
validate[required, max[150]] 最大值为150
|
|
89
|
+
|
|
90
|
+
validate[required,custom[onlyLetterNumber]]
|
|
91
|
+
validate[required,ajax[checkWordContent]]
|
|
92
|
+
validate[required, custom[url]]
|
|
93
|
+
validate[custom[onlyLetterNumber2]]
|
|
94
|
+
validate[required,custom[email]]
|
|
95
|
+
validate[required, custom[number], min[3], max[150]]
|
|
96
|
+
var isSuccessed = $("#be-form").validationEngine("validate");
|
|
97
|
+
if (isSuccessed) {}
|
|
98
|
+
* </pre>
|
|
99
|
+
* **/
|
|
100
|
+
validate() {
|
|
101
|
+
$("#be-add-form, #be-edit-form").validationEngine({
|
|
102
|
+
focusFirstField : false,
|
|
103
|
+
promptPosition: "topRight"
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/******
|
|
108
|
+
* @描述:键盘快捷键绑定
|
|
109
|
+
* @脚本:
|
|
110
|
+
* <pre>
|
|
111
|
+
var main = new Main();
|
|
112
|
+
main.hotkeys("#search");
|
|
113
|
+
* </pre>
|
|
114
|
+
* **/
|
|
115
|
+
hotkeys(target) {
|
|
116
|
+
$(document).bind("keydown", "return", function(e) {
|
|
117
|
+
$(target).click();
|
|
118
|
+
return false;
|
|
119
|
+
});
|
|
120
|
+
$("input").bind("keydown", "return", function(e) {
|
|
121
|
+
$(target).click();
|
|
122
|
+
return false;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/******
|
|
127
|
+
* @描述:自定义滚动条
|
|
128
|
+
* @脚本:
|
|
129
|
+
* <pre>
|
|
130
|
+
var main = new Main();
|
|
131
|
+
main.niceScrollSetup("html");
|
|
132
|
+
main.niceScrollSetup(".ce-modal");
|
|
133
|
+
* </pre>
|
|
134
|
+
* **/
|
|
135
|
+
niceScrollSetup(taregt) {
|
|
136
|
+
$(taregt).niceScroll({
|
|
137
|
+
styler : "fb",
|
|
138
|
+
cursorcolor : "#ccc",
|
|
139
|
+
cursorwidth : "6",
|
|
140
|
+
cursorborderradius : "0px",
|
|
141
|
+
background : "#fff",
|
|
142
|
+
spacebarenabled : false,
|
|
143
|
+
cursorborder : "",
|
|
144
|
+
smoothscroll: true, // ease动画滚动
|
|
145
|
+
// scrollspeed: 100,
|
|
146
|
+
mousescrollstep: 60, //滚轮滚动速度
|
|
147
|
+
zindex : "1000"
|
|
148
|
+
});
|
|
149
|
+
//刷新
|
|
150
|
+
//$("taregt").getNiceScroll().resize();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/******
|
|
154
|
+
* @描述:管理后台用手风琴jquery菜单插件
|
|
155
|
+
* @脚本:
|
|
156
|
+
* <pre>
|
|
157
|
+
var main = new Main();
|
|
158
|
+
|
|
159
|
+
var cookieName = 0;
|
|
160
|
+
if (data.user.id)
|
|
161
|
+
cookieName = "user" + data.user.id;
|
|
162
|
+
main.accordion("#nav-accordion", cookieName);
|
|
163
|
+
* </pre>
|
|
164
|
+
* **/
|
|
165
|
+
accordion(taregt, cookieName) {
|
|
166
|
+
$(".dcjq-parent").unbind("click");
|
|
167
|
+
|
|
168
|
+
$(taregt).dcAccordion({
|
|
169
|
+
eventType: "click",
|
|
170
|
+
autoClose: true,
|
|
171
|
+
saveState: true,
|
|
172
|
+
disableLink: true,
|
|
173
|
+
speed: "fast",
|
|
174
|
+
showCount: false,
|
|
175
|
+
autoExpand: true,
|
|
176
|
+
cookie: cookieName + "-menu",
|
|
177
|
+
classExpand: "dcjq-current-parent"
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/******
|
|
182
|
+
* @描述:提示文字,根据需要在该方法中继续添加需要代码,如下
|
|
183
|
+
* @脚本:
|
|
184
|
+
* <pre>
|
|
185
|
+
var main = new Main();
|
|
186
|
+
main.toolInfo();
|
|
187
|
+
|
|
188
|
+
方法内根据情况追加代码,如下:
|
|
189
|
+
$(".be-config").detail({title: "设置", isReplace: false});
|
|
190
|
+
$(".be-edit").detail({title: "编辑", isReplace: false});
|
|
191
|
+
$(".be-add").detail({title: "添加", isReplace: false});
|
|
192
|
+
$(".be-remove, si-img-del").detail({title: "删除", isReplace: false});
|
|
193
|
+
|
|
194
|
+
$(".be-search").detail({title: "查看", isReplace: false});
|
|
195
|
+
$(".be-psw").detail({title: "模块创建", isReplace: false});
|
|
196
|
+
$(".be-sql").detail({title: "SQL语句创建", isReplace: false});
|
|
197
|
+
|
|
198
|
+
$(".be-plus").detail({title: "到货", isReplace: false});
|
|
199
|
+
$(".be-minus").detail({title: "出货", isReplace: false});
|
|
200
|
+
$(".be-buy").detail({title: "采购", isReplace: false});
|
|
201
|
+
$(".be-single").detail({title: "单页创建", isReplace: false});
|
|
202
|
+
$(".be-power").detail({title: "权限", isReplace: false});
|
|
203
|
+
* </pre>
|
|
204
|
+
* **/
|
|
205
|
+
toolInfo() {
|
|
206
|
+
$(".si-img-cover").detail({title: "设置为封面图", isReplace: false});
|
|
207
|
+
$(".si-img-del").detail({title: "删除", isReplace: false});
|
|
208
|
+
|
|
209
|
+
$(".be-config").detail({title: "设置", isReplace: false});
|
|
210
|
+
$(".be-edit").detail({title: "编辑", isReplace: false});
|
|
211
|
+
$(".be-add").detail({title: "添加", isReplace: false});
|
|
212
|
+
$(".be-remove").detail({title: "删除", isReplace: false});
|
|
213
|
+
$(".be-search").detail({title: "查看", isReplace: false});
|
|
214
|
+
$(".be-psw").detail({title: "模块创建", isReplace: false});
|
|
215
|
+
$(".be-sql").detail({title: "SQL语句创建", isReplace: false});
|
|
216
|
+
|
|
217
|
+
$(".be-plus").detail({title: "到货", isReplace: false});
|
|
218
|
+
$(".be-minus").detail({title: "出货", isReplace: false});
|
|
219
|
+
$(".be-buy").detail({title: "采购", isReplace: false});
|
|
220
|
+
$(".be-default").detail({title: "是否默认", isReplace: false});
|
|
221
|
+
|
|
222
|
+
$(".be-edit-document").detail({title: "文本编辑", isReplace: false});
|
|
223
|
+
$(".be-edit-words").detail({title: "内容背景替换", isReplace: false});
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/******
|
|
227
|
+
* @描述:设置日期时间事件
|
|
228
|
+
* @脚本:
|
|
229
|
+
* <pre>
|
|
230
|
+
var main = new Main();
|
|
231
|
+
main.datePicker("dateJavaSqlDate", "yyyy-MM-dd", 4, 2);
|
|
232
|
+
* </pre>
|
|
233
|
+
* **/
|
|
234
|
+
datePicker(target, format, startView, minView) {
|
|
235
|
+
//datePicker todo
|
|
236
|
+
if (!format)
|
|
237
|
+
format = "yyyy-MM-dd hh:mm:00";
|
|
238
|
+
if (!startView)
|
|
239
|
+
startView = 2;
|
|
240
|
+
if (!minView)
|
|
241
|
+
minView = 0;
|
|
242
|
+
|
|
243
|
+
var $input = $("input[name='" + target + "']", ".be-date");
|
|
244
|
+
$("i[date-flag='" + target + "']", ".be-date").datetimepicker({
|
|
245
|
+
language: "zh-CN",
|
|
246
|
+
format: "yyyy-MM-dd hh:mm:ss",
|
|
247
|
+
weekStart: 0,
|
|
248
|
+
todayBtn: true,
|
|
249
|
+
autoclose: true,
|
|
250
|
+
todayHighlight: true,
|
|
251
|
+
startDate: "00:00",
|
|
252
|
+
startView: startView,
|
|
253
|
+
minView: minView,
|
|
254
|
+
minuteStep: 1
|
|
255
|
+
}).on("changeDate", function(e) {
|
|
256
|
+
if ($input)
|
|
257
|
+
$input.val(new Date(e.date.getTime()).format(format));
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
/******
|
|
263
|
+
* @描述:代码格式显示插件
|
|
264
|
+
* @脚本:
|
|
265
|
+
* <pre>
|
|
266
|
+
var main = new Main();
|
|
267
|
+
main.code();
|
|
268
|
+
* </pre>
|
|
269
|
+
* **/
|
|
270
|
+
code() {
|
|
271
|
+
var style = "ide-eclipse"; //desert emacs golden ide-eclipse
|
|
272
|
+
$("pre.be-css").snippet("css", {style: style});
|
|
273
|
+
$("pre.be-js").snippet("javascript", {style: style});
|
|
274
|
+
$("pre.be-html").snippet("html", {style: style});
|
|
275
|
+
$("pre.be-java").snippet("java", {style: style});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** *
|
|
2
|
+
*
|
|
3
|
+
* @描述:单页JS模板,使用vue
|
|
4
|
+
* @作者:林舒涛
|
|
5
|
+
*
|
|
6
|
+
* 单页JS模板
|
|
7
|
+
*
|
|
8
|
+
* **/
|
|
9
|
+
|
|
10
|
+
$(function() {
|
|
11
|
+
var base = new Base();
|
|
12
|
+
|
|
13
|
+
var app = new Vue({
|
|
14
|
+
el: "#app",
|
|
15
|
+
data: {
|
|
16
|
+
},
|
|
17
|
+
methods: {
|
|
18
|
+
//获取数据
|
|
19
|
+
getData: function(param, fun) {
|
|
20
|
+
},
|
|
21
|
+
reset: function() {
|
|
22
|
+
var param = {};
|
|
23
|
+
getData(param, function() {
|
|
24
|
+
debug("reset");
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
add: function() {
|
|
28
|
+
debug("add");
|
|
29
|
+
},
|
|
30
|
+
del: function() {
|
|
31
|
+
debug("del");
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
watch: {
|
|
35
|
+
initWatch: function() {}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
computed: {
|
|
39
|
+
initComputed: function() {}
|
|
40
|
+
},
|
|
41
|
+
beforeCreate: function() {},
|
|
42
|
+
created: function() {
|
|
43
|
+
this.getData({}, function(fun) {});
|
|
44
|
+
},
|
|
45
|
+
mounted: function() {}
|
|
46
|
+
})
|
|
47
|
+
})
|