Commit 00e1edd5 authored by Nature's avatar Nature

web

parent 838a858e
...@@ -15,22 +15,19 @@ ...@@ -15,22 +15,19 @@
<img src="@/assets/image/icon.png"> <img src="@/assets/image/icon.png">
</div> </div>
<h3>Welcome to Your Vue.js App</h3> <h3>Welcome to Your Vue.js App</h3>
<h-file :file-list="fileList" v-model="fileList"/>
</h-content> </h-content>
</h-view> </h-view>
</template> </template>
<script> <script>
import hmapLogin from '@/scripts/login'
export default { export default {
data () { data () {
return { return {
fileList: [],
} }
}, },
activated: function () { activated: function () {
// 海马汇桥接获取个人信息
hmapLogin('local').then(res => {
})
}, },
updated: function () { updated: function () {
......
...@@ -60,7 +60,6 @@ export default { ...@@ -60,7 +60,6 @@ export default {
showLongTop: function (content) { showLongTop: function (content) {
let vm = this let vm = this
let text = content || '操作失败' let text = content || '操作失败'
if (!process.env.isMobilePlatform) {
Vue.$vux.toast.show({ Vue.$vux.toast.show({
text: text, text: text,
type: 'text', type: 'text',
...@@ -68,11 +67,6 @@ export default { ...@@ -68,11 +67,6 @@ export default {
isShowMask: vm.IS_SHOW_MASK, isShowMask: vm.IS_SHOW_MASK,
position: 'top', position: 'top',
}) })
} else {
window.plugins.toast.showLongTop(content, function (success) {
}, function (error) { // eslint-disable-line
})
}
}, },
/** /**
...@@ -82,7 +76,6 @@ export default { ...@@ -82,7 +76,6 @@ export default {
showLongCenter: function (content) { showLongCenter: function (content) {
let vm = this let vm = this
let text = content || '操作失败' let text = content || '操作失败'
if (!process.env.isMobilePlatform) {
Vue.$vux.toast.show({ Vue.$vux.toast.show({
text: text, text: text,
type: 'text', type: 'text',
...@@ -90,11 +83,6 @@ export default { ...@@ -90,11 +83,6 @@ export default {
isShowMask: vm.IS_SHOW_MASK, isShowMask: vm.IS_SHOW_MASK,
position: 'middle', position: 'middle',
}) })
} else {
window.plugins.toast.showLongCenter(content, function (success) {
}, function (error) { // eslint-disable-line
})
}
}, },
/** /**
* 长时间中部提示toast * 长时间中部提示toast
...@@ -103,7 +91,6 @@ export default { ...@@ -103,7 +91,6 @@ export default {
showLongBottom: function (content) { showLongBottom: function (content) {
let vm = this let vm = this
let text = content || '操作失败' let text = content || '操作失败'
if (!process.env.isMobilePlatform) {
Vue.$vux.toast.show({ Vue.$vux.toast.show({
text: text, text: text,
time: vm.SHOW_TIMES, time: vm.SHOW_TIMES,
...@@ -111,11 +98,6 @@ export default { ...@@ -111,11 +98,6 @@ export default {
isShowMask: vm.IS_SHOW_MASK, isShowMask: vm.IS_SHOW_MASK,
position: 'bottom', position: 'bottom',
}) })
} else {
window.plugins.toast.showLongBottom(content, function (success) {
}, function (error) { // eslint-disable-line
})
}
}, },
/** /**
* 成功提示框 * 成功提示框
...@@ -152,7 +134,6 @@ export default { ...@@ -152,7 +134,6 @@ export default {
* @param confirmObject.onConfirm 确定函数 * @param confirmObject.onConfirm 确定函数
*/ */
showConfirm: function (confirmObject) { showConfirm: function (confirmObject) {
if (!process.env.isMobilePlatform) {
let def = { let def = {
title: confirmObject.title || '提示', title: confirmObject.title || '提示',
content: confirmObject.content || '', content: confirmObject.content || '',
...@@ -166,21 +147,6 @@ export default { ...@@ -166,21 +147,6 @@ export default {
}, },
} }
Vue.$vux.confirm.show(def) 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 { ...@@ -190,7 +156,6 @@ export default {
* *
*/ */
showPopup: function (confirmObject) { showPopup: function (confirmObject) {
if (!process.env.isMobilePlatform) {
let def = { let def = {
title: confirmObject.title || '提示', title: confirmObject.title || '提示',
content: confirmObject.content || '', content: confirmObject.content || '',
...@@ -201,19 +166,6 @@ export default { ...@@ -201,19 +166,6 @@ export default {
}, },
} }
Vue.$vux.confirm.show(def) 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 弹出框的标题可空 * @param actionObject.titleText 弹出框的标题可空
......
import axios from 'axios'
export default { export default {
city: { city: {
...@@ -257,54 +258,6 @@ export default { ...@@ -257,54 +258,6 @@ export default {
let pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/ let pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/
return pattern.test(str) 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 { ...@@ -320,121 +273,29 @@ export default {
callEmail: function (email) { callEmail: function (email) {
window.open('mailto:' + 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进行上传 * formData的文件上传
* @param filePath * @param file File对象
* @param success * @param params 请求额外参数
* @param url 请求url地址
*/ */
fileUploadSvc: function (file, success) { fileUpload: function (file,params,url) {
let path = file.filePath url = encodeURI(url)
let name = path.substr(path.lastIndexOf('/') + 1) let param = new FormData()
let url = encodeURI(process.env.rootPath + '/app/fileUploadSvc?sysName=HLS_APP&apiName=attachment_upload') for (let key in params) {
let options = new FileUploadOptions() // eslint-disable-line param.append(key, params[key])
options.fileKey = 'file' }
options.headers = { 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, '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)
}, },
/** }).then(function (result) {
* 汉王识别
* @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('汉王识别失败')
}
ft.upload(path, url, uploadSuccess, error, options) })
}, },
/** /**
* *
...@@ -729,133 +590,6 @@ export default { ...@@ -729,133 +590,6 @@ export default {
return Math.round(xirr * 100) / 100 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} 平台 * @return {String} 平台
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment