切换导航条
此项目
正在载入...
登录
潘浩文
/
scoreshop
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
潘浩文
6 years ago
提交
d5b71d4746e68ad571e0ce180bf41483da505766
1 个父辈
2e718f01
1 个管道 的构建
通过
耗费 1 秒
1
变更
2
构建
1
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
149 行增加
和
60 行删除
app/portal/controller/PrizeController.php
public/themes/simpleboot3/portal/prize/getScore.html
app/portal/controller/PrizeController.php
查看文件 @
d5b71d4
...
...
@@ -16,71 +16,17 @@ use think\Db;
class
PrizeController
extends
WeChatBaseController
{
protected
$options
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
checkWeChatUserLogin
();
}
//活动首页
public
function
active
(){
$this
->
checkUser
();
$banner
=
Db
::
name
(
'active'
)
->
where
(
'is_top'
,
1
)
->
field
(
'thumbnail'
)
->
select
();
$this
->
assign
(
'banner'
,
$banner
);
$data
=
Db
::
name
(
'active'
)
->
where
(
'status'
,
1
)
->
select
();
$this
->
assign
(
'list'
,
$data
);
return
$this
->
fetch
();
}
//活动首页ajax
public
function
activeAjax
(){
$this
->
checkUser
();
$status
=
$this
->
request
->
param
(
'status'
);
$data
=
Db
::
name
(
'active'
)
->
where
(
'status'
,
$status
)
->
select
()
->
toArray
();
foreach
(
$data
as
$k
=>
$v
)
{
$data
[
$k
][
'url'
]
=
url
(
'portal/active/activeDetail'
,
array
(
'id'
=>
$data
[
$k
][
'id'
]));
$data
[
$k
][
'image'
]
=
cmf_get_image_preview_url
(
$data
[
$k
][
'thumbnail'
]);
$data
[
$k
][
'active_time'
]
=
date
(
'Y-m-d'
,
$data
[
$k
][
'active_time'
]);
$data
[
$k
][
'end_time'
]
=
date
(
'Y-m-d'
,
$data
[
$k
][
'end_time'
]);
};
return
$data
;
}
//活动详情
public
function
activeDetail
()
{
$re
=
$this
->
checkUser
();
$id
=
$this
->
request
->
param
(
'id'
);
$data
=
Db
::
name
(
'active'
)
->
where
(
'id'
,
$id
)
->
find
();
$data
[
'more'
]
=
json_decode
(
$data
[
'more'
],
true
);
$data
[
'content'
]
=
cmf_replace_content_file_url
(
htmlspecialchars_decode
(
$data
[
'content'
]));
$like
=
Db
::
name
(
'like'
)
->
where
([
'cid'
=>
$id
,
'users_id'
=>
$re
[
'id'
],
'status'
=>
2
])
->
find
();
if
(
$like
){
$like
=
1
;
}
else
{
$like
=
0
;
}
$comment
=
Db
::
name
(
'comment'
)
->
alias
(
'c'
)
->
join
(
'users u'
,
'c.users_id=u.id'
)
->
join
(
'brand b'
,
'c.cid=b.id'
)
->
where
([
'b.id'
=>
$id
,
'c.status'
=>
2
])
->
field
(
'c.*,u.*'
)
->
select
();
$this
->
assign
(
'comment'
,
$comment
);
$this
->
assign
(
'like'
,
$like
);
$this
->
assign
(
'list'
,
$data
);
return
$this
->
fetch
(
'active_detail'
);
$this
->
options
=
[
'app_id'
=>
config
(
'wechat_config.app_id'
),
'secret'
=>
config
(
'wechat_config.secret'
),
'payment'
=>
config
(
'wechat_config.payment'
),
];
}
//兑奖首页
public
function
prize
(){
$re
=
$this
->
checkUser
();
...
...
@@ -189,6 +135,15 @@ class PrizeController extends WeChatBaseController
Db
::
name
(
'prize_order'
)
->
insert
(
$data
);
return
1
;
}
public
function
getScore
(){
$app
=
new
Application
(
$this
->
options
);
$js
=
$app
->
js
;
$this
->
assign
(
'js'
,
$js
);
return
$this
->
fetch
(
'getScore'
);
}
//上传小票
public
function
upload
(){
$options
=
[
...
...
public/themes/simpleboot3/portal/prize/getScore.html
0 → 100644
查看文件 @
d5b71d4
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
/>
<link
rel=
"stylesheet"
href=
"__TMPL__/public/assets/css/base.css"
>
<script
type=
"text/javascript"
src=
"__TMPL__/public/assets/js/base.js"
></script>
<title>
上传小票
</title>
<style>
body
,
html
{
background
:
#fff
;
}
.container
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
#preview
{
width
:
2.59rem
;
height
:
2.59rem
;
font-size
:
0
;
}
#preview
img
{
width
:
100%
;
height
:
100%
;
}
.uploadword
{
width
:
2.59rem
;
text-align
:
center
;
color
:
#252729
;
font-size
:
0.32rem
;
margin-top
:
0.35rem
;
}
.footer
{
width
:
6.86rem
;
text-align
:
center
;
height
:
0.88rem
;
line-height
:
0.88rem
;
position
:
fixed
;
bottom
:
0.55rem
;
left
:
0
;
right
:
0
;
margin
:
0
auto
;
background
:
#CA277B
;
border-radius
:
0.44rem
;
color
:
#fff
;
font-size
:
0.32rem
;
}
</style>
</head>
<body>
<div
class=
"container"
>
<!--<div class="upload">-->
<!--<img src="img/upload.png" alt="">-->
<!--</div>-->
<div
id=
"preview"
>
<img
id=
"imghead"
border=
"0"
src=
"img/upload.png"
style=
"width:100%;height:100%"
onclick=
"$('#previewImg').click();"
>
</div>
<!--<img src="../img/delet.png" alt="" style="position:absolute;bottom:92px;left:46px" class="deleteimg"/>-->
<input
type=
"file"
onchange=
"previewImage(this)"
style=
"display: none;"
id=
"previewImg"
>
<p
class=
"uploadword"
>
上传小票图片
</p>
</div>
<div
class=
"footer"
>
确定
</div>
<script
type=
"text/javascript"
src=
"js/jquery.min.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
;
}
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>"
;
}
}
//确定上传小票
$
(
".footer"
).
click
(
function
(){
window
.
location
.
href
=
'successupload.html'
})
</script>
</body>
</html>
...
...
请
注册
或
登录
后发表评论