Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhu_wap_bridge
Project
Project
Details
Activity
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
千变科技开源组件
zhu_wap_bridge
Commits
4530409f
Commit
4530409f
authored
Jan 27, 2021
by
westzmg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加图片处理的接口
parent
d0399f87
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
489 additions
and
4 deletions
+489
-4
_Bridge.js
lib/_Bridge.js
+489
-4
No files found.
lib/_Bridge.js
View file @
4530409f
...
...
@@ -60,7 +60,6 @@ export var takePhoto = /*#__PURE__*/function () {
switch
(
_context2
.
prev
=
_context2
.
next
)
{
case
0
:
// invoke.define('takePhoto', async (data) => {resolve(data)});
alert
(
"adsfasdfasdf"
);
invoke
.
define
(
'takePhotoCompleted'
,
/*#__PURE__*/
function
()
{
var
_ref3
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee
(
result
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee$
(
_context
)
{
...
...
@@ -81,10 +80,10 @@ export var takePhoto = /*#__PURE__*/function () {
return
_ref3
.
apply
(
this
,
arguments
);
};
}());
_context2
.
next
=
4
;
_context2
.
next
=
3
;
return
invoke
.
bind
(
"takePhoto"
)(
opt
);
case
4
:
case
3
:
case
"end"
:
return
_context2
.
stop
();
}
...
...
@@ -664,6 +663,484 @@ export var getToken = /*#__PURE__*/function () {
return
_ref26
.
apply
(
this
,
arguments
);
};
}();
export
var
previewImage
=
/*#__PURE__*/
function
()
{
var
_ref29
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee30
(
opt
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee30$
(
_context30
)
{
while
(
1
)
{
switch
(
_context30
.
prev
=
_context30
.
next
)
{
case
0
:
return
_context30
.
abrupt
(
"return"
,
new
Promise
(
/*#__PURE__*/
function
()
{
var
_ref30
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee29
(
resolve
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee29$
(
_context29
)
{
while
(
1
)
{
switch
(
_context29
.
prev
=
_context29
.
next
)
{
case
0
:
_context29
.
next
=
2
;
return
invoke
.
bind
(
"previewImage"
)(
opt
);
case
2
:
case
"end"
:
return
_context29
.
stop
();
}
}
},
_callee29
);
}));
return
function
(
_x29
)
{
return
_ref30
.
apply
(
this
,
arguments
);
};
}()));
case
1
:
case
"end"
:
return
_context30
.
stop
();
}
}
},
_callee30
);
}));
return
function
previewImage
(
_x28
)
{
return
_ref29
.
apply
(
this
,
arguments
);
};
}();
/*
* 获取上传图片以及文件的token
* options: {
* id, --必输项,如果是项目级应用则设置project_id,否则设置user_id
* app_id="common", --逻辑必输项,设置为应用的code,如果没有设置系统默认为common,
* signature=true, --是否需要签名访问
* rename=true, --文件是否重命名
* maxSize=1024*1024*10 --文件尺寸限制,默认为10M
* }
*/
export
var
getUpToken
=
/*#__PURE__*/
function
()
{
var
_ref31
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee33
(
opt
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee33$
(
_context33
)
{
while
(
1
)
{
switch
(
_context33
.
prev
=
_context33
.
next
)
{
case
0
:
return
_context33
.
abrupt
(
"return"
,
new
Promise
(
/*#__PURE__*/
function
()
{
var
_ref32
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee32
(
resolve
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee32$
(
_context32
)
{
while
(
1
)
{
switch
(
_context32
.
prev
=
_context32
.
next
)
{
case
0
:
invoke
.
define
(
'getUpTokenCompleted'
,
/*#__PURE__*/
function
()
{
var
_ref33
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee31
(
result
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee31$
(
_context31
)
{
while
(
1
)
{
switch
(
_context31
.
prev
=
_context31
.
next
)
{
case
0
:
resolve
(
result
);
case
1
:
case
"end"
:
return
_context31
.
stop
();
}
}
},
_callee31
);
}));
return
function
(
_x32
)
{
return
_ref33
.
apply
(
this
,
arguments
);
};
}());
_context32
.
next
=
3
;
return
invoke
.
bind
(
"getUpToken"
)(
opt
);
case
3
:
case
"end"
:
return
_context32
.
stop
();
}
}
},
_callee32
);
}));
return
function
(
_x31
)
{
return
_ref32
.
apply
(
this
,
arguments
);
};
}()));
case
1
:
case
"end"
:
return
_context33
.
stop
();
}
}
},
_callee33
);
}));
return
function
getUpToken
(
_x30
)
{
return
_ref31
.
apply
(
this
,
arguments
);
};
}();
/*
* @name uploadImage 上传图片
* options {
* token: object, --从getUpToken中获取
* photo: object, --选择或拍照的结果,主要会用到fileName,type,fileName,多数情况直接拿结果直接用就行了
* onProgress: func, --图片上传的进度回调
* }
*/
export
var
uploadImage
=
/*#__PURE__*/
function
()
{
var
_ref34
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee36
(
opt
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee36$
(
_context36
)
{
while
(
1
)
{
switch
(
_context36
.
prev
=
_context36
.
next
)
{
case
0
:
return
_context36
.
abrupt
(
"return"
,
new
Promise
(
/*#__PURE__*/
function
()
{
var
_ref35
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee35
(
resolve
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee35$
(
_context35
)
{
while
(
1
)
{
switch
(
_context35
.
prev
=
_context35
.
next
)
{
case
0
:
invoke
.
define
(
'uploadImageCompleted'
,
/*#__PURE__*/
function
()
{
var
_ref36
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee34
(
result
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee34$
(
_context34
)
{
while
(
1
)
{
switch
(
_context34
.
prev
=
_context34
.
next
)
{
case
0
:
resolve
(
result
);
case
1
:
case
"end"
:
return
_context34
.
stop
();
}
}
},
_callee34
);
}));
return
function
(
_x35
)
{
return
_ref36
.
apply
(
this
,
arguments
);
};
}());
_context35
.
next
=
3
;
return
invoke
.
bind
(
"uploadImage"
)(
opt
);
case
3
:
case
"end"
:
return
_context35
.
stop
();
}
}
},
_callee35
);
}));
return
function
(
_x34
)
{
return
_ref35
.
apply
(
this
,
arguments
);
};
}()));
case
1
:
case
"end"
:
return
_context36
.
stop
();
}
}
},
_callee36
);
}));
return
function
uploadImage
(
_x33
)
{
return
_ref34
.
apply
(
this
,
arguments
);
};
}();
/*
* @name uploadImageThrough 图片直传,获取token和上传操作合并
* options {
* photo: object, --选择或拍照的结果,主要会用到fileName,type,fileName,多数情况直接拿结果直接用就行了
* tokenMode: string, --必输项,project or user
* appId: string, --所属的app代码,默认为common
* signature: false, --是否需要签名上传
* rename=true, --是否重命名
* maxSize=1024*10000 --最大尺寸
* }
*/
export
var
uploadImageThrough
=
/*#__PURE__*/
function
()
{
var
_ref37
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee39
(
opt
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee39$
(
_context39
)
{
while
(
1
)
{
switch
(
_context39
.
prev
=
_context39
.
next
)
{
case
0
:
return
_context39
.
abrupt
(
"return"
,
new
Promise
(
/*#__PURE__*/
function
()
{
var
_ref38
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee38
(
resolve
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee38$
(
_context38
)
{
while
(
1
)
{
switch
(
_context38
.
prev
=
_context38
.
next
)
{
case
0
:
invoke
.
define
(
'uploadImageThroughCompleted'
,
/*#__PURE__*/
function
()
{
var
_ref39
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee37
(
result
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee37$
(
_context37
)
{
while
(
1
)
{
switch
(
_context37
.
prev
=
_context37
.
next
)
{
case
0
:
resolve
(
result
);
case
1
:
case
"end"
:
return
_context37
.
stop
();
}
}
},
_callee37
);
}));
return
function
(
_x38
)
{
return
_ref39
.
apply
(
this
,
arguments
);
};
}());
_context38
.
next
=
3
;
return
invoke
.
bind
(
"uploadImageThrough"
)(
opt
);
case
3
:
case
"end"
:
return
_context38
.
stop
();
}
}
},
_callee38
);
}));
return
function
(
_x37
)
{
return
_ref38
.
apply
(
this
,
arguments
);
};
}()));
case
1
:
case
"end"
:
return
_context39
.
stop
();
}
}
},
_callee39
);
}));
return
function
uploadImageThrough
(
_x36
)
{
return
_ref37
.
apply
(
this
,
arguments
);
};
}();
/*
* @name takePhotoAndUpload 拍照后直接上传
* options {
* quality: 0.6,
* includeBase64: true,
* saveToPhotos: false,
* uploadOptions: {
* tokenMode: string, --必输项,project or user,默认为project
* appId: string, --所属的app代码,默认为common
* signature: false, --是否需要签名上传
* } --图片上传的options
* }
*/
export
var
takePhotoAndUpload
=
/*#__PURE__*/
function
()
{
var
_ref40
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee42
(
opt
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee42$
(
_context42
)
{
while
(
1
)
{
switch
(
_context42
.
prev
=
_context42
.
next
)
{
case
0
:
return
_context42
.
abrupt
(
"return"
,
new
Promise
(
/*#__PURE__*/
function
()
{
var
_ref41
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee41
(
resolve
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee41$
(
_context41
)
{
while
(
1
)
{
switch
(
_context41
.
prev
=
_context41
.
next
)
{
case
0
:
invoke
.
define
(
'takePhotoAndUploadCompleted'
,
/*#__PURE__*/
function
()
{
var
_ref42
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee40
(
result
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee40$
(
_context40
)
{
while
(
1
)
{
switch
(
_context40
.
prev
=
_context40
.
next
)
{
case
0
:
resolve
(
result
);
case
1
:
case
"end"
:
return
_context40
.
stop
();
}
}
},
_callee40
);
}));
return
function
(
_x41
)
{
return
_ref42
.
apply
(
this
,
arguments
);
};
}());
_context41
.
next
=
3
;
return
invoke
.
bind
(
"takePhotoAndUpload"
)(
opt
);
case
3
:
case
"end"
:
return
_context41
.
stop
();
}
}
},
_callee41
);
}));
return
function
(
_x40
)
{
return
_ref41
.
apply
(
this
,
arguments
);
};
}()));
case
1
:
case
"end"
:
return
_context42
.
stop
();
}
}
},
_callee42
);
}));
return
function
takePhotoAndUpload
(
_x39
)
{
return
_ref40
.
apply
(
this
,
arguments
);
};
}();
/*
* @name choosePhotoAndUpload 选择文件后上传
* options {
* includeBase64: false,
* uploadOptions: {
* tokenMode: string, --必输项,project or user
* appId: string, --所属的app代码,默认为common
* signature: false, --是否需要签名上传
* } --图片上传的options
* }
*/
export
var
choosePhotoAndUpload
=
/*#__PURE__*/
function
()
{
var
_ref43
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee45
(
opt
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee45$
(
_context45
)
{
while
(
1
)
{
switch
(
_context45
.
prev
=
_context45
.
next
)
{
case
0
:
return
_context45
.
abrupt
(
"return"
,
new
Promise
(
/*#__PURE__*/
function
()
{
var
_ref44
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee44
(
resolve
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee44$
(
_context44
)
{
while
(
1
)
{
switch
(
_context44
.
prev
=
_context44
.
next
)
{
case
0
:
invoke
.
define
(
'choosePhotoAndUploadCompleted'
,
/*#__PURE__*/
function
()
{
var
_ref45
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee43
(
result
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee43$
(
_context43
)
{
while
(
1
)
{
switch
(
_context43
.
prev
=
_context43
.
next
)
{
case
0
:
resolve
(
result
);
case
1
:
case
"end"
:
return
_context43
.
stop
();
}
}
},
_callee43
);
}));
return
function
(
_x44
)
{
return
_ref45
.
apply
(
this
,
arguments
);
};
}());
_context44
.
next
=
3
;
return
invoke
.
bind
(
"choosePhotoAndUpload"
)(
opt
);
case
3
:
case
"end"
:
return
_context44
.
stop
();
}
}
},
_callee44
);
}));
return
function
(
_x43
)
{
return
_ref44
.
apply
(
this
,
arguments
);
};
}()));
case
1
:
case
"end"
:
return
_context45
.
stop
();
}
}
},
_callee45
);
}));
return
function
choosePhotoAndUpload
(
_x42
)
{
return
_ref43
.
apply
(
this
,
arguments
);
};
}();
/*
* @name getPhotoAndUpload 拍照或选择文件后上传
* options {
* sourceType --['album', 'camera']相册选择和摄像头的选择,可二者同时
* takeOptions: {
* quality: 0.6,
* includeBase64: true,
* saveToPhotos: false,
* } --拍照的options,无特殊情况几乎不用设置
* chooseOptions:{
* includeBase64: true,
* } --拍照的options,无特殊情况几乎不用设置
* uploadOptions: {
* tokenMode: string, --归类方式 project or user,默认project
* appId: string, --所属的app代码,默认为common,建议输入
* signature: true, --是否需要签名上传,默认为true
* } --图片上传的options
* }
*/
export
var
getPhotoAndUpload
=
/*#__PURE__*/
function
()
{
var
_ref46
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee48
(
opt
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee48$
(
_context48
)
{
while
(
1
)
{
switch
(
_context48
.
prev
=
_context48
.
next
)
{
case
0
:
return
_context48
.
abrupt
(
"return"
,
new
Promise
(
/*#__PURE__*/
function
()
{
var
_ref47
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee47
(
resolve
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee47$
(
_context47
)
{
while
(
1
)
{
switch
(
_context47
.
prev
=
_context47
.
next
)
{
case
0
:
invoke
.
define
(
'getPhotoAndUploadCompleted'
,
/*#__PURE__*/
function
()
{
var
_ref48
=
_asyncToGenerator
(
/*#__PURE__*/
_regeneratorRuntime
.
mark
(
function
_callee46
(
result
)
{
return
_regeneratorRuntime
.
wrap
(
function
_callee46$
(
_context46
)
{
while
(
1
)
{
switch
(
_context46
.
prev
=
_context46
.
next
)
{
case
0
:
resolve
(
result
);
case
1
:
case
"end"
:
return
_context46
.
stop
();
}
}
},
_callee46
);
}));
return
function
(
_x47
)
{
return
_ref48
.
apply
(
this
,
arguments
);
};
}());
_context47
.
next
=
3
;
return
invoke
.
bind
(
"getPhotoAndUpload"
)(
opt
);
case
3
:
case
"end"
:
return
_context47
.
stop
();
}
}
},
_callee47
);
}));
return
function
(
_x46
)
{
return
_ref47
.
apply
(
this
,
arguments
);
};
}()));
case
1
:
case
"end"
:
return
_context48
.
stop
();
}
}
},
_callee48
);
}));
return
function
getPhotoAndUpload
(
_x45
)
{
return
_ref46
.
apply
(
this
,
arguments
);
};
}();
export
var
EVENTS_TYPE
=
{
keyboardWillShow
:
'keyboardWillShow'
,
// 键盘即将出现
...
...
@@ -689,5 +1166,12 @@ export default {
launchCQDigitalSign
:
launchCQDigitalSign
,
launchFingerSign
:
launchFingerSign
,
launchShare
:
launchShare
,
getToken
:
getToken
getToken
:
getToken
,
previewImage
:
previewImage
,
getUpToken
:
getUpToken
,
uploadImage
:
uploadImage
,
uploadImageThrough
:
uploadImageThrough
,
takePhotoAndUpload
:
takePhotoAndUpload
,
choosePhotoAndUpload
:
choosePhotoAndUpload
,
getPhotoAndUpload
:
getPhotoAndUpload
};
\ No newline at end of file
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