作者 潘浩文
1 个管道 的构建 通过 耗费 0 秒

1

<?php
// +----------------------------------------------------------------------
// | bronet [ 以客户为中心 以奋斗者为本 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.bronet.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
namespace app\portal\controller;
use app\portal\service\LikeService;
use cmf\controller\HomeBaseController;
use cmf\controller\WeChatBaseController;
use EasyWeChat\Foundation\Application;
use think\Db;
class BrandController extends WeChatBaseController
{
public function _initialize()
{
parent::_initialize();
$this->checkWeChatUserLogin();
$this->checkUser();
}
//品牌首页接口
public function brand()
{
// $param=$this->request->param();
$where['b.status']=1;
// if (!empty($param['category'])){
// $where['b.category_id']=$param['category'];
// }
// if (!empty($param['floor'])){
// $where['b.floor_id']=$param['floor'];
// }
// if (!empty($param['order'])){
// $order['like']='desc';
// }else{
// $order['create_time']='desc';
// }
$category=Db::name('brand_category')->where('status',1)->select();
$floor=Db::name('brand_category')->where('status',2)->select();
$data=Db::name('brand')
->alias('b')
->join('brand_category bc1','b.category_id=bc1.id')
->join('brand_category bc2','b.floor_id=bc2.id')
->where($where)
->order('b.create_time','desc')
->field('b.*,bc1.name as cname,bc2.name as fname')
->select();
$this->assign('category',$category);
$this->assign('floor',$floor);
$this->assign('list',$data);
return $this->fetch();
}
//品牌ajax
public function brandAjax()
{
$param=$this->request->param();
$where['b.status']=1;
if (!empty($param['category'])){
$where['b.category_id']=$param['category'];
}
if (!empty($param['floor'])){
$where['b.floor_id']=$param['floor'];
}
if (!empty($param['search'])){
$where['b.name']=['like','%'.$param['search'].'%'];
}
if (!empty($param['order'])){
$order['b.like']='desc';
}else{
$order['b.create_time']='desc';
}
$data=Db::name('brand')
->alias('b')
->join('brand_category bc1','b.category_id=bc1.id')
->join('brand_category bc2','b.floor_id=bc2.id')
->where($where)
->order($order)
->field('b.*,bc1.name as cname,bc2.name as fname')
->select();
return $data;
}
//品牌详情
public function brandDetail()
{
$id=$this->request->param('id');
$data=Db::name('brand')
->alias('b')
->join('brand_category bc1','b.category_id=bc1.id')
->join('brand_category bc2','b.floor_id=bc2.id')
->where('b.id',$id)
->field('b.*,bc1.name as cname,bc2.name as fname')
->find();
$data['content']=cmf_replace_content_file_url(htmlspecialchars_decode($data['content']));
$like=Db::name('like')->where(['cid'=>$id,'users_id'=>session('wechat_user')['users_id'],'status'=>1])->find();
if ($like){
$like=1;
}else{
$like=0;
}
$this->assign('like',$like);
$this->assign('list',$data);
return $this->fetch();
}
//品牌评论详情
public function brandComment(){
$id=$this->request->param('id');
$data=Db::name('brand')
->alias('b')
->join('brand_category bc1','b.category_id=bc1.id')
->join('brand_category bc2','b.floor_id=bc2.id')
->where('id',$id)
->order('b.create_time','desc')
->field('b.*,bc1.name as cname,bc2.name as fname')
->find();
$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'=>1])
->field('c.*,u.*')
->select();
$like=Db::name('like')->where(['cid'=>$id,'users_id'=>session('wechat_user')['users_id'],'status'=>1])->find();
if ($like){
$like=1;
}else{
$like=0;
}
$this->assign('like',$like);
$this->assign('list',$data);
$this->assign('comment',$comment);
return $this->fetch();
}
//品牌评论页面
public function comment(){
$id=$this->request->param('id');
$this->assign('id',$id);
return $this->fetch();
}
public function commentPost(){
$param=$this->request->param();
$param['users_id']=session('wechat_user')['users_id'];
Db::name('comment')->insert($param);
Db::name('brand')->where('id',$param['cid'])->setInc('comment',1);
$this->redirect('portal/brand/brandComment',['id'=>$param['cid']]);
}
//点赞ajax接口
public function like(){
$param=$this->request->param();
$like=new LikeService();
return $like->like($param['id'],1,session('wechat_user')['users_id']);
}
//活动首页
public function active(){
$where['status']=1;
if (!empty($this->request->param('status'))) {
$where['status'] =$this->request->param('status');
}
$banner=Db::name('active')->where('is_top',1)->field('thumbnail')->select();
$this->assign('banner',$banner);
$data=Db::name('active')->where($where)->select();
$this->assign('list',$data);
return $this->fetch();
}
//活动详情
public function activeDetail()
{
$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'=>session('wechat_user')['users_id'],'status'=>2])->find();
if ($like){
$like=1;
}else{
$like=0;
}
$this->assign('like',$like);
$this->assign('list',$data);
return $this->fetch();
}
//兑奖首页
public function prize(){
$user=Db::name('users')->where('id',session('wechat_user')['users_id'])->find();
$prize=Db::name('prize')->where('status',1)->select();
$category=Db::name('prize_category')->select();
$this->assign('user',$user);
$this->assign('prize',$prize);
$this->assign('category',$category);
return $this->fetch();
}
//兑奖首页ajax
public function prizeAjax(){
$category=$this->request->param('category');
$where['status']=1;
if (!empty($category)){
$where['category_id']=$category;
}
$prize=Db::name('prize')->where($where)->select();
return $prize;
}
//兑奖详情页
public function prizeDetail(){
$id=$this->request->param('id');
$data=Db::name('prize')
->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'=>session('wechat_user')['users_id'],'status'=>3])->find();
if ($like){
$like=1;
}else{
$like=0;
}
$order=Db::name('prize_order')->where(['prize_id'=>$id,'users_id'=>session('wechat_user')['users_id'],'status'=>1])->find();
if ($order){
$order=1;
}else{
$order=0;
}
$this->assign('order',$order);
$this->assign('like',$like);
$this->assign('list',$data);
return $this->fetch();
}
public function getPrize(){
$id=$this->request->param('id');
$data['prize_id']=$id;
$data['users_id']=session('wechat_user')['users_id'];
$data['create_time']=time();
Db::name('prize_order')->insert($data);
return 1;
}
//上传小票
public function upload(){
$options = [
'app_id' => config('wechat_config.app_id'),
'secret' => config('wechat_config.secret'),
'payment' => config('wechat_config.payment'),
];
$app = new Application($options);
$js = $app->js;
$jss = $js->config(['chooseImage', 'uploadImage', 'previewImage'], $debug = false, $beta = false, $json = true);
$this->assign('js', $jss);
return $this->fetch();
}
//上传小票提交
public function uploadPost(){
$param = $this->request->param();
$options = [
'app_id' => config('wechat_config.app_id'),
'secret' => config('wechat_config.secret'),
'payment' => config('wechat_config.payment'),
];
$app = new Application($options);
// 获取 access token 实例
$access_token = $app->access_token;
return $this->getmedia($access_token, $param['media'], date('Ymd'));
}
private function getmedia($access_token, $media_id, $foldername)
{
$url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=" . $access_token . "&media_id=" . $media_id;
if (!file_exists("./upload/" . $foldername)) {
mkdir("./upload/" . $foldername, 0777, true);
}
$file_name = date('YmdHis') . rand(1000, 9999) . '.jpg';
$targetName = './upload/' . $foldername . '/' . $file_name;
$saveName = $foldername . '/' . $file_name;
$ch = curl_init($url); // 初始化
$fp = fopen($targetName, 'wb'); // 打开写入
curl_setopt($ch, CURLOPT_FILE, $fp); // 设置输出文件的位置,值是一个资源类型
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
return $saveName;
}
//兑奖记录
public function prizeRecord(){
$status=$this->request->param('status');
$where['p.status']=!empty($status)?$status:0;
$data=Db::name('prize_order')
->alias('po')
->join('prize p'.'po.prize_id=p.id')
->where($where)
->select();
$this->assign('list',$data);
return $this->fetch();
}
//个人首页
public function userIndex(){
$last = Db::name('users_score_log')->where(['users_id' => session('wechat_user')['users_id'], 'action' => '签到'])->max('create_time');
if (date('Ymd', time()) > date('Ymd', $last)) {
$is_qiandao=0;
}else{
$is_qiandao=1;
}
$data=Db::name('users')->where('id',session('wechat_user')['users_id'])->find();
$this->assign('list',$data);
$this->assign('qiandao',$is_qiandao);
return $this->fetch();
}
public function scoreRecord(){
$score=Db::name('users')->where('id',session('wechat_user')['users_id'])->find()['score'];
$data=Db::name('users_score_log')->where('users_id',session('wechat_user')['users_id'])->select();
$this->assign('score',$score);
$this->assign('list',$data);
return $this->fetch();
}
//每日签到功能
public function qiandao(){
$last = Db::name('users_score_log')->where(['users_id' => session('wechat_user')['users_id'], 'action' => '签到'])->max('create_time');
if (date('Ymd', time()) > date('Ymd', $last)) {
$data['score'] = 10;
$data['users_id'] = session('users_id');
$data['create_time'] = time();
$data['action'] = '签到';
Db::name('users_score_log')->insert($data);
Db::name('users')->where('id', session('wechat_user')['users_id'])->setInc('score', 10);
return 1;
} else {
return 0;
}
}
}
... ...
... ... @@ -23,7 +23,7 @@ class IndexController extends WeChatBaseController
$this->checkUser();
}
//首页接口1111111111
//首页接口
public function index()
{
$re=Db::name('config')->where('id',1)->find();
... ... @@ -35,329 +35,4 @@ class IndexController extends WeChatBaseController
$this->assign('list',$data);
return $this->fetch(':index');
}
//品牌首页接口
public function brand()
{
// $param=$this->request->param();
$where['b.status']=1;
// if (!empty($param['category'])){
// $where['b.category_id']=$param['category'];
// }
// if (!empty($param['floor'])){
// $where['b.floor_id']=$param['floor'];
// }
// if (!empty($param['order'])){
// $order['like']='desc';
// }else{
// $order['create_time']='desc';
// }
$category=Db::name('brand_category')->where('status',1)->select();
$floor=Db::name('brand_category')->where('status',2)->select();
$data=Db::name('brand')
->alias('b')
->join('brand_category bc1','b.category_id=bc1.id')
->join('brand_category bc2','b.floor_id=bc2.id')
->where($where)
->order('b.create_time','desc')
->field('b.*,bc1.name as cname,bc2.name as fname')
->select();
$this->assign('category',$category);
$this->assign('floor',$floor);
$this->assign('list',$data);
return $this->fetch();
}
//品牌ajax
public function brandAjax()
{
$param=$this->request->param();
$where['b.status']=1;
if (!empty($param['category'])){
$where['b.category_id']=$param['category'];
}
if (!empty($param['floor'])){
$where['b.floor_id']=$param['floor'];
}
if (!empty($param['search'])){
$where['b.name']=['like','%'.$param['search'].'%'];
}
if (!empty($param['order'])){
$order['b.like']='desc';
}else{
$order['b.create_time']='desc';
}
$data=Db::name('brand')
->alias('b')
->join('brand_category bc1','b.category_id=bc1.id')
->join('brand_category bc2','b.floor_id=bc2.id')
->where($where)
->order($order)
->field('b.*,bc1.name as cname,bc2.name as fname')
->select();
return $data;
}
//品牌详情
public function brandDetail()
{
$id=$this->request->param('id');
$data=Db::name('brand')
->alias('b')
->join('brand_category bc1','b.category_id=bc1.id')
->join('brand_category bc2','b.floor_id=bc2.id')
->where('b.id',$id)
->field('b.*,bc1.name as cname,bc2.name as fname')
->find();
$data['content']=cmf_replace_content_file_url(htmlspecialchars_decode($data['content']));
$like=Db::name('like')->where(['cid'=>$id,'users_id'=>session('wechat_user')['users_id'],'status'=>1])->find();
if ($like){
$like=1;
}else{
$like=0;
}
$this->assign('like',$like);
$this->assign('list',$data);
return $this->fetch();
}
//品牌评论详情
public function brandComment(){
$id=$this->request->param('id');
$data=Db::name('brand')
->alias('b')
->join('brand_category bc1','b.category_id=bc1.id')
->join('brand_category bc2','b.floor_id=bc2.id')
->where('id',$id)
->order('b.create_time','desc')
->field('b.*,bc1.name as cname,bc2.name as fname')
->find();
$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'=>1])
->field('c.*,u.*')
->select();
$like=Db::name('like')->where(['cid'=>$id,'users_id'=>session('wechat_user')['users_id'],'status'=>1])->find();
if ($like){
$like=1;
}else{
$like=0;
}
$this->assign('like',$like);
$this->assign('list',$data);
$this->assign('comment',$comment);
return $this->fetch();
}
//品牌评论页面
public function comment(){
$id=$this->request->param('id');
$this->assign('id',$id);
return $this->fetch();
}
public function commentPost(){
$param=$this->request->param();
$param['users_id']=session('wechat_user')['users_id'];
Db::name('comment')->insert($param);
Db::name('brand')->where('id',$param['cid'])->setInc('comment',1);
$this->redirect('portal/brand/brandComment',['id'=>$param['cid']]);
}
//点赞ajax接口
public function like(){
$param=$this->request->param();
$like=new LikeService();
return $like->like($param['id'],1,session('wechat_user')['users_id']);
}
//活动首页
public function active(){
$where['status']=1;
if (!empty($this->request->param('status'))) {
$where['status'] =$this->request->param('status');
}
$banner=Db::name('active')->where('is_top',1)->field('thumbnail')->select();
$this->assign('banner',$banner);
$data=Db::name('active')->where($where)->select();
$this->assign('list',$data);
return $this->fetch();
}
//活动详情
public function activeDetail()
{
$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'=>session('wechat_user')['users_id'],'status'=>2])->find();
if ($like){
$like=1;
}else{
$like=0;
}
$this->assign('like',$like);
$this->assign('list',$data);
return $this->fetch();
}
//兑奖首页
public function prize(){
$user=Db::name('users')->where('id',session('wechat_user')['users_id'])->find();
$prize=Db::name('prize')->where('status',1)->select();
$category=Db::name('prize_category')->select();
$this->assign('user',$user);
$this->assign('prize',$prize);
$this->assign('category',$category);
return $this->fetch();
}
//兑奖首页ajax
public function prizeAjax(){
$category=$this->request->param('category');
$where['status']=1;
if (!empty($category)){
$where['category_id']=$category;
}
$prize=Db::name('prize')->where($where)->select();
return $prize;
}
//兑奖详情页
public function prizeDetail(){
$id=$this->request->param('id');
$data=Db::name('prize')
->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'=>session('wechat_user')['users_id'],'status'=>3])->find();
if ($like){
$like=1;
}else{
$like=0;
}
$order=Db::name('prize_order')->where(['prize_id'=>$id,'users_id'=>session('wechat_user')['users_id'],'status'=>1])->find();
if ($order){
$order=1;
}else{
$order=0;
}
$this->assign('order',$order);
$this->assign('like',$like);
$this->assign('list',$data);
return $this->fetch();
}
public function getPrize(){
$id=$this->request->param('id');
$data['prize_id']=$id;
$data['users_id']=session('wechat_user')['users_id'];
$data['create_time']=time();
Db::name('prize_order')->insert($data);
return 1;
}
//上传小票
public function upload(){
$options = [
'app_id' => config('wechat_config.app_id'),
'secret' => config('wechat_config.secret'),
'payment' => config('wechat_config.payment'),
];
$app = new Application($options);
$js = $app->js;
$jss = $js->config(['chooseImage', 'uploadImage', 'previewImage'], $debug = false, $beta = false, $json = true);
$this->assign('js', $jss);
return $this->fetch();
}
//上传小票提交
public function uploadPost(){
$param = $this->request->param();
$options = [
'app_id' => config('wechat_config.app_id'),
'secret' => config('wechat_config.secret'),
'payment' => config('wechat_config.payment'),
];
$app = new Application($options);
// 获取 access token 实例
$access_token = $app->access_token;
return $this->getmedia($access_token, $param['media'], date('Ymd'));
}
private function getmedia($access_token, $media_id, $foldername)
{
$url = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=" . $access_token . "&media_id=" . $media_id;
if (!file_exists("./upload/" . $foldername)) {
mkdir("./upload/" . $foldername, 0777, true);
}
$file_name = date('YmdHis') . rand(1000, 9999) . '.jpg';
$targetName = './upload/' . $foldername . '/' . $file_name;
$saveName = $foldername . '/' . $file_name;
$ch = curl_init($url); // 初始化
$fp = fopen($targetName, 'wb'); // 打开写入
curl_setopt($ch, CURLOPT_FILE, $fp); // 设置输出文件的位置,值是一个资源类型
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_exec($ch);
curl_close($ch);
fclose($fp);
return $saveName;
}
//兑奖记录
public function prizeRecord(){
$status=$this->request->param('status');
$where['p.status']=!empty($status)?$status:0;
$data=Db::name('prize_order')
->alias('po')
->join('prize p'.'po.prize_id=p.id')
->where($where)
->select();
$this->assign('list',$data);
return $this->fetch();
}
//个人首页
public function userIndex(){
$last = Db::name('users_score_log')->where(['users_id' => session('wechat_user')['users_id'], 'action' => '签到'])->max('create_time');
if (date('Ymd', time()) > date('Ymd', $last)) {
$is_qiandao=0;
}else{
$is_qiandao=1;
}
$data=Db::name('users')->where('id',session('wechat_user')['users_id'])->find();
$this->assign('list',$data);
$this->assign('qiandao',$is_qiandao);
return $this->fetch();
}
public function scoreRecord(){
$score=Db::name('users')->where('id',session('wechat_user')['users_id'])->find()['score'];
$data=Db::name('users_score_log')->where('users_id',session('wechat_user')['users_id'])->select();
$this->assign('score',$score);
$this->assign('list',$data);
return $this->fetch();
}
//每日签到功能
public function qiandao(){
$last = Db::name('users_score_log')->where(['users_id' => session('wechat_user')['users_id'], 'action' => '签到'])->max('create_time');
if (date('Ymd', time()) > date('Ymd', $last)) {
$data['score'] = 10;
$data['users_id'] = session('users_id');
$data['create_time'] = time();
$data['action'] = '签到';
Db::name('users_score_log')->insert($data);
Db::name('users')->where('id', session('wechat_user')['users_id'])->setInc('score', 10);
return 1;
} else {
return 0;
}
}
}
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<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:#F5F6FA;
}
.head{
width:7.5rem;
height:0.88rem;
background: #000000;
display:flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid #f5f5f5;
}
.searchtext{
box-sizing: border-box;
width:6rem;
height:0.64rem;
background:#FFFFFF ;
border-radius: 0.05rem;
margin-left: 0.32rem;
display:flex;
align-items: center;
}
.search_img{
width:0.24rem;
height:0.24rem;
font-size: 0;
margin-left: 0.24rem;
}
.search_img img{
width:100%;
height:100%;
}
.search_input{
width:4.6rem;
height:0.64rem;
border:none;
outline:none;
color:#B2B2B2;
font-size: 0.26rem;
margin-left: 0.21rem;
}
.map{
color:#FFFFFF;
font-size: 0.26rem;
margin-right: 0.34rem;
}
.kind{
box-sizing: border-box;
width:7.5rem;
height:1rem;
background: #fff;
display:flex;
justify-content: space-between;
align-items: center;
}
.kind_type{
display:flex;
justify-content: center;
width:33.333%;
height:1rem;
vertical-align: middle;
/*border-top:4px solid #D71E98;*/
border-right: 1px solid #f5f5f5;
align-items: center;
padding: 0 0.4rem;
}
/*.active{*/
/*height:1rem;*/
/*border-top:4px solid #D6D600;*/
/*}*/
.kind_img{
width:0.28rem;
height:0.28rem;
font-size:0;
}
.kind_img img{
width:100%;
height:100%;
}
.kind_name{
font-size: 0.3rem;
color:#252729;
height:0.28rem;
line-height: 0.28rem;
margin-left: 0.15rem;
}
.item_img{
width:1.8rem;
height:1.8rem;
}
.item_img{
width:1.8rem;
height:1.8rem;
}
.item_img img{
width:100%;
height:100%;
}
.list_item{
display:flex;
padding: 0.35rem 0.39rem;
background: #fff;
margin-top: 0.16rem;
}
.item_name{
color:#000000;
font-size: 0.32rem;
margin-top: 0.1rem;
width:4.3rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.list_name{
color:#666666;
font-size:0.26rem;
margin-top: 0.26rem;
width:4.3rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item_floor{
color:#252729;
font-size: 0.26rem;
margin-top: 0.26rem;
}
.flooritem{
margin-left: 0.44rem;
}
.title{
width:7.5rem;
height:0.2rem;
font-size: 0;
}
.title img{
width:100%;
height:100%;
}
.kindwrapper{
position:fixed;
top:2.1rem;
left:0;
right:0;
width:7.5rem;
height:100%;
background-color: rgba(0,0,0,0.5);
color:#fff;
font-size: 0.36rem;
text-align: center;
}
.kindlist{
overflow: hidden;
background: #fff;
}
.kindlist li{
width:33.33%;
float:left;
list-style: none;
font-size: 0;
height:0.88rem;
text-align: center;
border-bottom: 1px solid #f5f5f5;
}
.kindlist li p{
margin-top: 0.24rem;
color:#252729;
font-size: 0.3rem;
width:100%;
border-right: 1px solid #f5f5f5;
}
.floorwrapper{
position:fixed;
top:2.1rem;
left:0;
right:0;
width:7.5rem;
height:100%;
background-color: rgba(0,0,0,0.5);
color:#fff;
font-size: 0.36rem;
text-align: center;
}
.floorlist{
overflow: hidden;
background: #fff;
}
.floorlist li{
width:33.33%;
float:left;
list-style: none;
font-size: 0;
height:0.88rem;
text-align: center;
border-bottom: 1px solid #f5f5f5;
}
.floorlist li p{
margin-top: 0.24rem;
color:#252729;
font-size: 0.3rem;
width:100%;
border-right: 1px solid #f5f5f5;
}
</style>
</head>
<body>
<div class="floorwrapper" style="display:none">
<ul class="floorlist">
<li>
<p>1L</p>
</li>
<li>
<p>2L</p>
</li>
<li>
<p>3L</p>
</li>
<li>
<p>4L</p>
</li>
<li>
<p>5L</p>
</li>
<li>
<p>6L</p>
</li>
</ul>
</div>
<div class="kindwrapper" style="display:none">
<ul class="kindlist">
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li> <li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
<li>
<p>分类1</p>
</li>
</ul>
</div>
<div class="container">
<div class="head">
<div class="searchtext">
<p class="search_img">
<img src="img/search.png" alt="">
</p>
<input type="text" placeholder="请输入商户名或品牌名" class="search_input">
</div>
<p class="map">地图</p>
</div>
<div class="title">
<img src="img/line.png" alt="">
</div>
<div class="kind">
<div class="kind_type floortype">
<p class="kind_img">
<img src="img/floor.png" alt="">
</p>
<p class="kind_name">楼层</p>
</div>
<div class="kind_type kindtype">
<p class="kind_img">
<img src="img/classfiy.png" alt="">
</p>
<p class="kind_name">分类</p>
</div>
<div class="kind_type">
<p class="kind_img">
<img src="img/default.png" alt="">
</p>
<p class="kind_name">默认排序</p>
</div>
</div>
<div class="list">
<foreach name="list" item="vo">
<div class="list_item">
<div class="item_img">
<img src="{:cmf_get_image_preview_url($vo.thumbnail)}" alt="">
</div>
<div class="flooritem">
<p class="item_name">{$vo.name}</p>
<p class="list_name">{$vo.cname}</p>
<p class="item_floor">{$vo.fname}</p>
</div>
</div>
</foreach>
<!--<div class="list_item">-->
<!--<div class="item_img">-->
<!--<img src="img/listitem.png" alt="">-->
<!--</div>-->
<!--<div class="flooritem">-->
<!--<p class="item_name">Hard Rock Cafe</p>-->
<!--<p class="list_name">西式餐厅</p>-->
<!--<p class="item_floor">1楼</p>-->
<!--</div>-->
<!--</div>-->
<!--<div class="list_item">-->
<!--<div class="item_img">-->
<!--<img src="img/listitem.png" alt="">-->
<!--</div>-->
<!--<div class="flooritem">-->
<!--<p class="item_name">Hard Rock Cafe</p>-->
<!--<p class="list_name">西式餐厅</p>-->
<!--<p class="item_floor">1楼</p>-->
<!--</div>-->
<!--</div>-->
<!--<div class="list_item">-->
<!--<div class="item_img">-->
<!--<img src="img/listitem.png" alt="">-->
<!--</div>-->
<!--<div class="flooritem">-->
<!--<p class="item_name">Hard Rock Cafe</p>-->
<!--<p class="list_name">西式餐厅</p>-->
<!--<p class="item_floor">1楼</p>-->
<!--</div>-->
<!--</div>-->
<!--<div class="list_item">-->
<!--<div class="item_img">-->
<!--<img src="img/listitem.png" alt="">-->
<!--</div>-->
<!--<div class="flooritem">-->
<!--<p class="item_name">Hard Rock Cafe</p>-->
<!--<p class="list_name">西式餐厅</p>-->
<!--<p class="item_floor">1楼</p>-->
<!--</div>-->
<!--</div>-->
<!--<div class="list_item">-->
<!--<div class="item_img">-->
<!--<img src="img/listitem.png" alt="">-->
<!--</div>-->
<!--<div class="flooritem">-->
<!--<p class="item_name">Hard Rock Cafe</p>-->
<!--<p class="list_name">西式餐厅</p>-->
<!--<p class="item_floor">1楼</p>-->
<!--</div>-->
<!--</div>-->
</div>
</div>
<script type="text/javascript" src="__TMPL__/public/assets/js/jquery.min.js"></script>
<script>
$(".kind_type").click(function(){
$(this).addClass("active");
$(this).siblings(".kind_type").removeClass("active")
})
//进入商家详情页
$(".list_item").click(function(){
window.location.href='shopdetail.html';
})
//楼层显示
$(".floortype").click(function(){
$(".floorwrapper").css("display","block");
$(".kindwrapper").css("display","none")
$("html,body").css("position","fixed")
})
$(".floorwrapper").click(function(){
$(this).css("display","none");
$("html,body").css("position","relative")
})
//分类显示
$(".kindtype").click(function(){
$(".floorwrapper").css("display","none");
$(".kindwrapper").css("display","block");
$("html,body").css("position","fixed")
})
$(".kindwrapper").click(function(){
$(this).css("display","none");
$("html,body").css("position","relative")
})
var InterValObj; //timer变量,控制时间
var count = 10; //间隔函数,1秒执行
var curCount='';//当前剩余秒数
var t=localStorage.getItem("time");
InterValObj = window.setInterval(SetRemainTime,1000);
if(t!=null){
curCount=t;
$(".enterindex").attr("disabled",true);
}else{
curCount=60;
window.clearInterval(InterValObj);
$(".passwordcode").html("获取验证码");
}
//启动计时器,1秒执行一次
$(".passwordcode").click(function(){
curCount = count;
//设置button效果,开始计时
$(".passwordcode").attr("disabled",true);
$(".enterindex").attr("disabled",true);
// $(".sendcode").unbind()
$(".passwordcode").html( curCount + "秒");
InterValObj = window.setInterval(SetRemainTime,1000); //启动计时器,1秒执行一次
});
//timer处理函数
function SetRemainTime() {
if (curCount == 0) {
window.clearInterval(InterValObj);//停止计时器
$(".passwordcode").removeAttr("disabled");//启用按钮
$(".enterindex").removeAttr("disabled");
$(".passwordcode").html("重新获取证码");
localStorage.clear();
}
else {
curCount--;
localStorage.setItem("time",curCount);
$(".passwordcode").html(curCount + "秒");
}
}
//地图
$(".map").click(function(){
alert('敬请期待');
});
</script>
</body>
</html>
... ...