切换导航条
此项目
正在载入...
登录
潘浩文
/
scoreshop
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
潘浩文
6 years ago
提交
33c5f71c3cd8ffc64ef6e23bca0251f39d131683
1 个父辈
77e50b25
1 个管道 的构建
通过
耗费 0 秒
1
变更
2
构建
1
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
90 行增加
和
58 行删除
app/portal/controller/PrizeController.php
public/themes/simpleboot3/portal/prize/getScore.html
app/portal/controller/PrizeController.php
查看文件 @
33c5f71
...
...
@@ -139,7 +139,8 @@ class PrizeController extends WeChatBaseController
public
function
getScore
(){
$app
=
new
Application
(
$this
->
options
);
$js
=
$app
->
js
;
$this
->
assign
(
'js'
,
$js
);
$jss
=
$js
->
config
([
'chooseImage'
,
'uploadImage'
,
'previewImage'
],
$debug
=
false
,
$beta
=
false
,
$json
=
true
);
$this
->
assign
(
'js'
,
$jss
);
return
$this
->
fetch
(
'getScore'
);
}
...
...
public/themes/simpleboot3/portal/prize/getScore.html
查看文件 @
33c5f71
...
...
@@ -66,67 +66,98 @@
</div>
<div
class=
"footer"
>
确定
</div>
<script
type=
"text/javascript"
src=
"__TMPL__/public/assets/js/jquery.min.js"
></script>
<
!--<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>--
>
<
script
src=
"http://res.wx.qq.com/open/js/jweixin-1.2.0.js"
></script
>
<script>
function
clacImgZoomParam
(
maxWidth
,
maxHeight
,
width
,
height
)
{
var
param
=
{
top
:
0
,
left
:
0
,
width
:
width
,
height
:
height
};
if
(
width
>
maxWidth
||
height
>
maxHeight
)
{
rateWidth
=
width
/
maxWidth
;
rateHeight
=
height
/
maxHeight
;
if
(
rateWidth
>
rateHeight
)
{
param
.
width
=
maxWidth
;
param
.
height
=
Math
.
round
(
height
/
rateWidth
);
}
else
{
param
.
width
=
Math
.
round
(
width
/
rateHeight
);
param
.
height
=
maxHeight
;
}
}
param
.
left
=
Math
.
round
((
maxWidth
-
param
.
width
)
/
2
);
param
.
top
=
Math
.
round
((
maxHeight
-
param
.
height
)
/
2
);
return
param
;
}
function
previewImage
(
file
)
{
var
MAXWIDTH
=
50
;
var
MAXHEIGHT
=
50
;
var
div
=
document
.
getElementById
(
'preview'
);
if
(
file
.
files
&&
file
.
files
[
0
])
{
div
.
innerHTML
=
'<img id=imghead onclick=$("#previewImg").click()>'
;
var
img
=
document
.
getElementById
(
'imghead'
);
img
.
onload
=
function
()
{
var
rect
=
clacImgZoomParam
(
MAXWIDTH
,
MAXHEIGHT
,
img
.
offsetWidth
,
img
.
offsetHeight
);
img
.
width
=
rect
.
width
;
img
.
height
=
rect
.
height
;
// img.style.marginLeft = rect.left+'px';
img
.
style
.
marginTop
=
rect
.
top
+
'px'
;
}
var
reader
=
new
FileReader
();
reader
.
onload
=
function
(
evt
)
{
img
.
src
=
evt
.
target
.
result
;
wx
.
config
(
{
$jss
}
);
// function clacImgZoomParam(maxWidth, maxHeight, width, height) {
// var param = {
// top: 0,
// left: 0,
// width: width,
// height: height
// };
// if(width > maxWidth || height > maxHeight) {
// rateWidth = width / maxWidth;
// rateHeight = height / maxHeight;
//
// if(rateWidth > rateHeight) {
// param.width = maxWidth;
// param.height = Math.round(height / rateWidth);
// } else {
// param.width = Math.round(width / rateHeight);
// param.height = maxHeight;
// }
// }
// param.left = Math.round((maxWidth - param.width) / 2);
// param.top = Math.round((maxHeight - param.height) / 2);
// return param;
// }
//
// function previewImage(file) {
// var MAXWIDTH = 50;
// var MAXHEIGHT = 50;
// var div = document.getElementById('preview');
// if(file.files && file.files[0]) {
// div.innerHTML = '<img id=imghead onclick=$("#previewImg").click()>';
// var img = document.getElementById('imghead');
// img.onload = function() {
// var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
// img.width = rect.width;
// img.height = rect.height;
// // img.style.marginLeft = rect.left+'px';
// img.style.marginTop = rect.top + 'px';
// }
// var reader = new FileReader();
// reader.onload = function(evt) {
// img.src = evt.target.result;
// }
// reader.readAsDataURL(file.files[0]);
// } else //兼容IE
// {
// var sFilter = 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
// file.select();
// var src = document.selection.createRange().text;
// div.innerHTML = '<img id=imghead>';
// var img = document.getElementById('imghead');
// img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
// var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
// status = ('rect:' + rect.top + ',' + rect.left + ',' + rect.width + ',' + rect.height);
// div.innerHTML = "<div id=divhead style='width:" + rect.width + "px;height:" + rect.height + "px;margin-top:" + rect.top + "px;" + sFilter + src + "\"'></div>";
// }
//
// }
wx
.
ready
(
function
()
{
$
(
'#previewImg'
).
click
(
function
()
{
// var id = $(this).attr('id');
// if ($(this).find('img').length=="") {
wx
.
chooseImage
({
count
:
1
,
// 默认9
sizeType
:
[
'original'
,
'compressed'
],
// 可以指定是原图还是压缩图,默认二者都有
sourceType
:
[
'album'
,
'camera'
],
// 可以指定来源是相册还是相机,默认二者都有
success
:
function
(
res
)
{
$
(
'#previewImg'
).
html
(
'<img src="'
+
res
.
localIds
+
'" alt="" style="position:absolute;bottom:92px;left:46px" class="deleteimg"/>'
)
uploadImages
(
res
.
localIds
,
id
)
}
reader
.
readAsDataURL
(
file
.
files
[
0
]);
}
else
//兼容IE
{
var
sFilter
=
'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'
;
file
.
select
();
var
src
=
document
.
selection
.
createRange
().
text
;
div
.
innerHTML
=
'<img id=imghead>'
;
var
img
=
document
.
getElementById
(
'imghead'
);
img
.
filters
.
item
(
'DXImageTransform.Microsoft.AlphaImageLoader'
).
src
=
src
;
var
rect
=
clacImgZoomParam
(
MAXWIDTH
,
MAXHEIGHT
,
img
.
offsetWidth
,
img
.
offsetHeight
);
status
=
(
'rect:'
+
rect
.
top
+
','
+
rect
.
left
+
','
+
rect
.
width
+
','
+
rect
.
height
);
div
.
innerHTML
=
"<div id=divhead style='width:"
+
rect
.
width
+
"px;height:"
+
rect
.
height
+
"px;margin-top:"
+
rect
.
top
+
"px;"
+
sFilter
+
src
+
"\"'></div>"
;
alert
(
src
);
});
// }
});
function
uploadImages
(
localIds
,
id
)
{
// var localId = localIds.pop();
wx
.
uploadImage
({
localId
:
localIds
,
isShowProgressTips
:
1
,
success
:
function
(
res
)
{
var
serverId
=
res
.
serverId
;
// 返回图片的服务器端ID
serverIds
+=
id
+
':'
+
serverId
+
','
;
},
fail
:
function
(
res
)
{
$modal
.
toast
(
JSON
.
stringify
(
res
));
}
});
}
});
//确定上传小票
$
(
".footer"
).
click
(
function
(){
window
.
location
.
href
=
'successupload.html'
...
...
请
注册
或
登录
后发表评论