Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hls-webapp-cli
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
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
heasy
hls-webapp-cli
Commits
00e1edd5
Commit
00e1edd5
authored
Jul 12, 2019
by
Nature
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web
parent
838a858e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
340 deletions
+23
-340
home.vue
template/src/pages/home.vue
+3
-6
hlsPopup.js
template/src/scripts/hlsPopup.js
+0
-48
hlsUtil.js
template/src/scripts/hlsUtil.js
+20
-286
No files found.
template/src/pages/home.vue
View file @
00e1edd5
...
...
@@ -15,22 +15,19 @@
<img
src=
"@/assets/image/icon.png"
>
</div>
<h3>
Welcome to Your Vue.js App
</h3>
<h-file
:file-list=
"fileList"
v-model=
"fileList"
/>
</h-content>
</h-view>
</
template
>
<
script
>
import
hmapLogin
from
'@/scripts/login'
export
default
{
data
()
{
return
{
fileList
:
[],
}
},
activated
:
function
()
{
// 海马汇桥接获取个人信息
hmapLogin
(
'local'
).
then
(
res
=>
{
})
},
updated
:
function
()
{
...
...
template/src/scripts/hlsPopup.js
View file @
00e1edd5
...
...
@@ -60,7 +60,6 @@ export default {
showLongTop
:
function
(
content
)
{
let
vm
=
this
let
text
=
content
||
'操作失败'
if
(
!
process
.
env
.
isMobilePlatform
)
{
Vue
.
$vux
.
toast
.
show
({
text
:
text
,
type
:
'text'
,
...
...
@@ -68,11 +67,6 @@ export default {
isShowMask
:
vm
.
IS_SHOW_MASK
,
position
:
'top'
,
})
}
else
{
window
.
plugins
.
toast
.
showLongTop
(
content
,
function
(
success
)
{
},
function
(
error
)
{
// eslint-disable-line
})
}
},
/**
...
...
@@ -82,7 +76,6 @@ export default {
showLongCenter
:
function
(
content
)
{
let
vm
=
this
let
text
=
content
||
'操作失败'
if
(
!
process
.
env
.
isMobilePlatform
)
{
Vue
.
$vux
.
toast
.
show
({
text
:
text
,
type
:
'text'
,
...
...
@@ -90,11 +83,6 @@ export default {
isShowMask
:
vm
.
IS_SHOW_MASK
,
position
:
'middle'
,
})
}
else
{
window
.
plugins
.
toast
.
showLongCenter
(
content
,
function
(
success
)
{
},
function
(
error
)
{
// eslint-disable-line
})
}
},
/**
* 长时间中部提示toast
...
...
@@ -103,7 +91,6 @@ export default {
showLongBottom
:
function
(
content
)
{
let
vm
=
this
let
text
=
content
||
'操作失败'
if
(
!
process
.
env
.
isMobilePlatform
)
{
Vue
.
$vux
.
toast
.
show
({
text
:
text
,
time
:
vm
.
SHOW_TIMES
,
...
...
@@ -111,11 +98,6 @@ export default {
isShowMask
:
vm
.
IS_SHOW_MASK
,
position
:
'bottom'
,
})
}
else
{
window
.
plugins
.
toast
.
showLongBottom
(
content
,
function
(
success
)
{
},
function
(
error
)
{
// eslint-disable-line
})
}
},
/**
* 成功提示框
...
...
@@ -152,7 +134,6 @@ export default {
* @param confirmObject.onConfirm 确定函数
*/
showConfirm
:
function
(
confirmObject
)
{
if
(
!
process
.
env
.
isMobilePlatform
)
{
let
def
=
{
title
:
confirmObject
.
title
||
'提示'
,
content
:
confirmObject
.
content
||
''
,
...
...
@@ -166,21 +147,6 @@ export default {
},
}
Vue
.
$vux
.
confirm
.
show
(
def
)
}
else
{
let
message
=
confirmObject
.
content
||
''
let
onConfirm
=
function
(
index
)
{
confirmObject
.
onConfirm
(
index
)
}
let
title
=
confirmObject
.
title
navigator
.
notification
.
confirm
(
message
,
// message
function
(
index
)
{
onConfirm
(
index
-
1
)
},
title
,
// title
[
'取消'
,
'确定'
]
// buttonLabels
)
}
},
/*
* 弹出确认的窗口
...
...
@@ -190,7 +156,6 @@ export default {
*
*/
showPopup
:
function
(
confirmObject
)
{
if
(
!
process
.
env
.
isMobilePlatform
)
{
let
def
=
{
title
:
confirmObject
.
title
||
'提示'
,
content
:
confirmObject
.
content
||
''
,
...
...
@@ -201,19 +166,6 @@ export default {
},
}
Vue
.
$vux
.
confirm
.
show
(
def
)
}
else
{
var
alertDismissed
=
function
(
index
)
{
confirmObject
.
onConfirm
()
}
let
title
=
confirmObject
.
title
||
'提示'
var
message
=
confirmObject
.
content
||
''
navigator
.
notification
.
alert
(
message
,
// message
alertDismissed
,
// callback
title
||
'提示'
,
// title
'确定'
// buttonName
)
}
},
/**
* @param actionObject.titleText 弹出框的标题可空
...
...
template/src/scripts/hlsUtil.js
View file @
00e1edd5
import
axios
from
'axios'
export
default
{
city
:
{
...
...
@@ -257,54 +258,6 @@ export default {
let
pattern
=
/^
([
a-zA-Z0-9_.-
])
+@
([
a-zA-Z0-9_-
])
+
(
.
[
a-zA-Z0-9_-
])
+/
return
pattern
.
test
(
str
)
},
/**
*
* @param cameraoption 对象{quality:质量默认50,allowEdit:true||false,width:宽度,height:高度}
* @param onSuccess 成功回调函数
* @param onFail 失败回调函数
*/
/* eslint-disable */
openCamera
:
function
(
cameraoption
,
onSuccess
,
onFail
)
{
if
(
typeof
onSuccess
===
'function'
&&
typeof
onFail
===
'function'
)
{
let
options
=
{
quality
:
cameraoption
.
quality
||
50
,
destinationType
:
Camera
.
DestinationType
.
FILE_URI
,
sourceType
:
Camera
.
PictureSourceType
.
CAMERA
,
allowEdit
:
cameraoption
.
allowEdit
||
false
,
targetWidth
:
cameraoption
.
width
||
1024
,
targetHeight
:
cameraoption
.
height
||
768
,
encodingType
:
Camera
.
EncodingType
.
JPEG
,
popoverOptions
:
CameraPopoverOptions
,
saveToPhotoAlbum
:
window
.
localStorage
.
savePhoto
||
false
,
correctOrientation
:
true
,
}
navigator
.
camera
.
getPicture
(
onSuccess
,
onFail
,
options
)
}
else
{
window
.
hlsPopup
.
showLongCenter
(
'参数有误!'
)
}
},
/**
* 最多选取10张,返回图片的存储地址数组形式
* @param obj {quality:质量默认50,width:宽度,height:高度}
* @param successFunction 成功回调函数
* @param errorFunction 失败函数
*/
takePicture
:
function
(
obj
,
successFunction
,
errorFunction
)
{
if
(
typeof
successFunction
===
'function'
&&
typeof
errorFunction
===
'function'
)
{
window
.
imagePicker
.
getPictures
(
successFunction
,
errorFunction
,
{
maximumImagesCount
:
obj
.
maxCount
||
10
,
quality
:
obj
.
quality
||
50
,
width
:
obj
.
width
||
1024
,
height
:
obj
.
height
||
768
,
}
)
}
else
{
window
.
hlsPopup
.
showLongBottom
(
'参数有误!'
)
}
},
/**
* 拨打电话仅仅限制于手机
...
...
@@ -320,121 +273,29 @@ export default {
callEmail
:
function
(
email
)
{
window
.
open
(
'mailto:'
+
email
)
},
/**
* 非ftp的上传方式
* @param filePath
* @param success
*/
fileUploadHls
:
function
(
file
,
success
)
{
let
path
=
file
.
filePath
let
name
=
path
.
substr
(
path
.
lastIndexOf
(
'/'
)
+
1
)
let
url
=
encodeURI
(
process
.
env
.
rootPath
+
'/app/fileUploadHls?sysName=HLS_APP&apiName=attment_file_upload'
)
let
options
=
new
FileUploadOptions
()
// eslint-disable-line
options
.
fileKey
=
'file'
options
.
headers
=
{
'Authorization'
:
'Bearer '
+
window
.
localStorage
.
access_token
,
}
options
.
params
=
{
'table_name'
:
file
.
table_name
,
'table_pk_value'
:
file
.
table_pk_value
,
'user_id'
:
window
.
localStorage
.
user_id
,
'access_token'
:
window
.
localStorage
.
access_token
,
'filePath'
:
path
,
}
options
.
fileName
=
name
options
.
mimeType
=
'multipart/form-date'
let
ft
=
new
FileTransfer
()
// eslint-disable-line
ft
.
onprogress
=
function
(
progressEvent
)
{
if
(
progressEvent
.
lengthComputable
)
{
loadingStatus
.
setPercentage
(
progressEvent
.
loaded
/
progressEvent
.
total
)
// eslint-disable-line
}
else
{
loadingStatus
.
increment
()
// eslint-disable-line
}
}
function
uploadSuccess
(
result
)
{
success
(
JSON
.
parse
(
result
.
response
))
}
function
fileError
()
{
window
.
hlsPopup
.
hideLoading
()
console
.
log
(
'upload error source '
+
error
.
source
)
console
.
log
(
'upload error target '
+
error
.
target
)
}
ft
.
upload
(
path
,
url
,
uploadSuccess
,
fileError
,
options
)
},
/**
* 调用系统svc进行上传
* @param filePath
* @param success
* formData的文件上传
* @param file File对象
* @param params 请求额外参数
* @param url 请求url地址
*/
fileUploadSvc
:
function
(
file
,
success
)
{
let
path
=
file
.
filePath
let
name
=
path
.
substr
(
path
.
lastIndexOf
(
'/'
)
+
1
)
let
url
=
encodeURI
(
process
.
env
.
rootPath
+
'/app/fileUploadSvc?sysName=HLS_APP&apiName=attachment_upload'
)
let
options
=
new
FileUploadOptions
()
// eslint-disable-line
options
.
fileKey
=
'file'
options
.
headers
=
{
fileUpload
:
function
(
file
,
params
,
url
)
{
url
=
encodeURI
(
url
)
let
param
=
new
FormData
()
for
(
let
key
in
params
)
{
param
.
append
(
key
,
params
[
key
])
}
param
.
append
(
'fileName'
,
file
.
name
)
param
.
append
(
'file'
,
file
)
return
axios
.
post
(
url
,
param
,
{
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
,
'Authorization'
:
'Bearer '
+
window
.
localStorage
.
access_token
,
}
options
.
params
=
{
'source_type'
:
file
.
table_name
,
'pkvalue'
:
file
.
table_pk_value
,
'user_id'
:
window
.
localStorage
.
user_id
,
'access_token'
:
window
.
localStorage
.
access_token
,
'filePath'
:
path
,
'timestamp'
:
file
.
timestamp
,
'sequence'
:
file
.
sequence
,
}
options
.
fileName
=
name
options
.
mimeType
=
'multipart/form-date'
let
ft
=
new
FileTransfer
()
// eslint-disable-line
function
uploadSuccess
(
result
)
{
success
(
JSON
.
parse
(
result
.
response
))
}
function
fileError
()
{
window
.
hlsPopup
.
hideLoading
()
console
.
log
(
'upload error source '
+
error
.
source
)
console
.
log
(
'upload error target '
+
error
.
target
)
}
ft
.
upload
(
path
,
url
,
uploadSuccess
,
fileError
,
options
)
},
/**
* 汉王识别
* @param file
* @param url
* @param success
*/
hangwan
:
function
(
fileUrl
,
postUrl
,
success
)
{
if
(
!
fileUrl
)
{
return
}
let
path
=
fileUrl
let
name
=
fileUrl
.
substr
(
fileUrl
.
lastIndexOf
(
'/'
)
+
1
)
let
url
=
encodeURI
(
postUrl
)
let
options
=
new
FileUploadOptions
()
// eslint-disable-line
options
.
headers
=
{
'Authorization'
:
'Bearer '
+
window
.
localStorage
.
access_token
,
}
options
.
fileKey
=
'file'
options
.
fileName
=
name
options
.
mimeType
=
'multipart/form-date'
let
ft
=
new
FileTransfer
()
// eslint-disable-line
function
uploadSuccess
(
message
)
{
let
res
=
JSON
.
parse
(
message
.
response
)
success
(
res
)
}
function
error
(
e
)
{
this
.
hlsPopup
.
showLongCenter
(
'汉王识别失败'
)
}
}).
then
(
function
(
result
)
{
ft
.
upload
(
path
,
url
,
uploadSuccess
,
error
,
options
)
}
)
},
/**
*
...
...
@@ -729,133 +590,6 @@ export default {
return
Math
.
round
(
xirr
*
100
)
/
100
},
// 指纹
fingerLogin
:
function
()
{
if
(
vum
.
Platform
.
isIOS
())
{
return
this
.
fingerLoginIos
()
}
else
{
return
this
.
fingerLoginAndroid
()
}
},
// android
fingerLoginAndroid
:
function
()
{
let
isSupportFinger
=
'true'
return
new
Promise
(
function
(
resolve
,
reject
)
{
Fingerprint
.
isAvailable
(
function
(
res
)
{
// eslint-disable-line
if
(
window
.
localStorage
.
isSupportFinger
)
{
window
.
localStorage
.
removeItem
(
'isSupportFinger'
)
}
window
.
localStorage
.
setItem
(
'isSupportFinger'
,
isSupportFinger
)
if
(
window
.
localStorage
.
isOpenFingerLogin
&&
window
.
localStorage
.
username
&&
window
.
localStorage
.
password
)
{
var
successCallback
=
function
(
msg
)
{
resolve
(
msg
)
}
var
errorCallback
=
function
(
err
)
{
reject
(
err
)
}
Fingerprint
.
show
({
// eslint-disable-line
clientId
:
'com.car.rental.easy'
,
clientSecret
:
'a_very_secret_encryption_key'
,
// Only necessary for Android
},
successCallback
,
errorCallback
)
}
else
{
reject
()
// eslint-disable-line
}
},
function
(
error
)
{
isSupportFinger
=
false
window
.
localStorage
.
isSupportFinger
=
isSupportFinger
reject
(
error
)
})
})
},
// ios
fingerLoginIos
:
function
()
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
let
isSupportFinger
=
true
window
.
plugins
.
touchid
.
isAvailable
(
// 支持指纹
function
()
{
isSupportFinger
=
true
if
(
window
.
localStorage
.
isSupportFinger
)
{
window
.
localStorage
.
removeItem
(
'isSupportFinger'
)
}
window
.
localStorage
.
setItem
(
'isSupportFinger'
,
isSupportFinger
)
// window.localStorage.isSupportFinger = true;
// 判断是否开启了指纹登录
if
(
window
.
localStorage
.
isOpenFingerLogin
&&
window
.
localStorage
.
username
&&
window
.
localStorage
.
password
)
{
window
.
plugins
.
touchid
.
verifyFingerprint
(
'通过Home键验证已有的手机指纹!'
,
// this will be shown in the native scanner popup
function
(
msg
)
{
resolve
(
msg
)
},
function
(
msg
)
{
reject
(
msg
)
})
}
else
{
reject
()
// eslint-disable-line
}
}
// 不支持指纹
,
function
(
msg
)
{
isSupportFinger
=
false
window
.
localStorage
.
isSupportFinger
=
isSupportFinger
reject
(
msg
)
}
)
})
},
// 判断是否为首次登录
isFirstTimeLogin
:
function
(
name
)
{
if
(
window
.
localStorage
.
username
)
{
if
(
window
.
localStorage
.
username
!==
name
)
{
return
true
}
else
{
return
false
}
}
else
{
return
true
}
},
// 打开指纹登陆
openFingerLogin
:
function
()
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
if
(
vum
.
Platform
.
isIOS
())
{
window
.
plugins
.
touchid
.
isAvailable
(
function
()
{
window
.
plugins
.
touchid
.
verifyFingerprint
(
'通过Home键验证已有的手机指纹!'
,
function
()
{
resolve
()
},
function
()
{
reject
()
// eslint-disable-line
}
)
},
function
()
{
this
.
hlsPopup
.
showLongCenter
(
'您的设配暂不支持指纹'
)
reject
()
// eslint-disable-line
})
}
else
{
Fingerprint
.
isAvailable
(
function
(
res
)
{
// eslint-disable-line
Fingerprint
.
show
({
// eslint-disable-line
clientId
:
'com.car.rental.easy'
,
clientSecret
:
'a_very_secret_encryption_key'
,
// Only necessary for Android
},
successCallback
,
errorCallback
)
function
successCallback
(
msg
)
{
resolve
(
msg
)
}
function
errorCallback
(
err
)
{
reject
(
err
)
}
},
function
(
error
)
{
this
.
hlsPopup
.
showLongCenter
(
'您的设配暂不支持指纹'
)
reject
(
error
)
})
}
})
},
/**
* 判断平台
* @return {String} 平台
...
...
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