123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <title></title>
- <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
- <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
- <link rel="stylesheet" type="text/css" href="../../css/style.css"/>
- <link rel="stylesheet" href="../../css/projeck.css">
- <style media="screen">
- .btn{
- position: absolute;;
- left: 0;
- bottom: 0;
- width: 100%;
- color: #fff;
- display: flex;
- justify-content: space-around;
- height: 50px;
- line-height: 50px;
- background: #000;
- }
- .btn span{
- display: block;
- padding: 0 20px;
- }
- </style>
- </head>
- <body style="background-color:#fff;">
- <div class="btn">
- <span tapmode="hover" onclick="fnClose()">取消</span>
- <span tapmode="hover" onclick="reset()">重置</span>
- <span tapmode="hover" onclick="saveFun()">确认</span>
- </div>
- </body>
- </html>
- <script type="text/javascript" src="../../script/api.js"></script>
- <script type="text/javascript">
- apiready=function () {
- var imgPath = api.pageParam.tailoring;
- openTailor(imgPath)
- };
- function openTailor(url) {
- var FNImageClip = api.require('FNImageClip');
- FNImageClip.open({
- rect: {
- x: 0,
- y: 0,
- w: api.frameWidth,
- h: api.frameHeight - 50 +'px'
- },
- highDefinition:true,
- srcPath: url,
- style: {
- mask: 'rgba(0,0,0,0.6)',
- clip: {
- w: 300,
- h: 300,
- x: 50,
- y: 50,
- borderColor: '#000',
- borderWidth: 1,
- appearance: 'rectangle'
- }
- },
- fixedOn: api.frameName,
- }, function(ret, err) {
- if (ret) {
- } else {
- }
- });
- }
- // 取消
- function fnClose() {
- var FNImageClip = api.require('FNImageClip');
- FNImageClip.close();
- api.closeFrame({
- });
- }
- // 保存
- function saveFun() {
- var FNImageClip = api.require('FNImageClip');
- var timestamp = new Date().getTime();
- FNImageClip.save({
- destPath: 'fs://image/' + timestamp + '.jpg',
- copyToAlbum: true,
- quality: 1
- }, function(ret, err) {
- if (ret) {
- // console.log(JSON.stringify(ret));
- api.execScript({
- frameName: 'frame4',
- script: 'uploadUrl("'+ ret.destPath +'");'
- });
- api.execScript({
- frameName: 'frame4',
- script: 'uploadHead("'+ ret.destPath +'");'
- });
- fnClose();
- } else {
- }
- });
- }
- // 重置
- function reset() {
- var FNImageClip = api.require('FNImageClip');
- FNImageClip.reset();
- }
- </script>
|