Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hel-guide
app
Commits
3933a729
Commit
3933a729
authored
Sep 08, 2017
by
JingChao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates angular/hlsUtil.md
Auto commit by GitBook Editor
parent
8c246bee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
56 deletions
+56
-56
hlsUtil.md
angular/hlsUtil.md
+56
-56
No files found.
angular/hlsUtil.md
View file @
3933a729
...
...
@@ -5,112 +5,112 @@ APP开发会出现很多功能相同的函数和组件,现封装了很多公
-
返回值为
`( 身份证校验结果 )`
,通过返回空,不通过返回具体内容。
-
调用如下
```
javascript
```javascript
function checkIdCard(){
var result =hlsUtil.isCardID(342623198712122312);
if(result){
hlsPopup.showShortCenterToast(result);
}
}
```
```
##### 2.时间格式化函数 `Date.prototype.format`
-
函数参数为
`( 格式字符串 )`
如
`yyyy-MM-dd`
-
返回值为
`( 格式化后的时间 )`
如
`2017-09-08`
-
调用实例如下
```
javascript
function
dataFormat
()
{
```javascript
function dataFormat() {
var date = new Date;
alert(date.format('yyyy-MM-dd'));
}
```
```
##### 3.数组移除函数 `Array.prototype.remove`
-
函数参数为
`( 数组下标 )`
-
返回
`( 新的数组 )`
-
调用实例如下
```
javascript
function
arrayRemove
()
{
```javascript
function arrayRemove() {
var array=['1','2','3'];
alert(angular.toJson(array.remove(1)));
}
```
```
##### 4.对象转成数组 `objToString`
-
函数参数为
`( 对象 )`
-
返回
`( 字符串 )`
-
调用实例如下
```
javascript
function
objToString
(){
```javascript
function objToString(){
var obj={
"apiKey":'123123SFgy',
"apiSecret":'QEZ!$XHFHFTV'
}
hlsUtil.objToString(obj);
}
```
```
##### 5.判断数组中是否含有某个元素 `inArray`
-
函数参数为
`( 数组、元素 )`
-
返回
`true of false`
-
调用实例如下
```
javascript
```javascript
function inArray(){
var array=['1','2','3'];
var ele = 2;
hlsUtil.inArray(array,ele);
}
```
```
##### 6.判断是否为11电话号码 `phoneNumber`
-
参数为
`( 手机号 )`
-
通过正则表达式校验 返回
`true of false`
-
调用实例如下
```
javascript
function
phoneNumber
(){
```javascript
function phoneNumber(){
alert(hlsUtil.phoneNumber(18325379820));
}
```
```
##### 7.判断+86后11位电话号码 `phoneNumber86`
-
参数为
`( 手机号 )`
-
通过正则表达式校验 返回
`true of false`
-
调用实例如下
```
javascript
```javascript
function phoneNumber86(){
alert(hlsUtil.phoneNumber86('+8618325379820'));
}
```
```
##### 7.是否是邮件格式 `isEmailAddress`
-
参数为
`( 邮箱地址 )`
-
通过正则表达式校验 返回
`true of false`
-
调用实例如下
```
javascript
function
isEmailAddress
(){
```javascript
function isEmailAddress(){
alert(hlsUtil.isEmailAddress('jingchao.wu@hand-china.com'));
}
```
```
##### 8.图片转成base64 `getImageToBase64`
-
参数为
`( 图片地址,回调函数 )`
**第二个参数为回调函数 **
-
在回电函数中
`( 返回图片的base64 )`
-
调用实例如下
```
javascript
```javascript
vm.imageTo64 = function () {
hlsUtil.getImageToBase64('build/img/login/icon.png', function (imgdata) {
alert(imgdata);
});
}
```
`
```
`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment