Authored by 2586703@qq.com

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohood into develop

... ... @@ -159,13 +159,6 @@ define('mobile', function(require, exports) {
$('.scene-content').find('.layout-item').each(function() {
$(this).imgZoom();
});
//获取手机屏幕高宽
/*var width = $(window).width();
//
$("img.lazy").each(function() {
$(this).attr("data-original", $(this).attr("data-original") + "?imageView/2/w/" + width);
});
$("img.lazy").lazyload();*/
};
exports.detail = function() {
... ... @@ -175,7 +168,7 @@ define('mobile', function(require, exports) {
detailSubtitle = $('.detail-title').find('.subtitle'),
slideSwiper;
mlellipsis.init();
//多图滑动
if ($('.slide-box').find('.box').size() > 1) {
slideSwiper = new swiper('.slide-box', {
... ... @@ -188,11 +181,9 @@ define('mobile', function(require, exports) {
autoplayDisableOnInteraction: false
});
}
if ($('.slide-navigator .dib').find('a').size() <= 1) {
$('.slide-navigator').hide();
}
//截字
$('.related-post').find('.content').each(function() {
$(this)[0].mlellipsis(2);
... ... @@ -244,11 +235,75 @@ define('mobile', function(require, exports) {
exports.news = function() {
$('select').on('change', function() {
/* var nowIndex = $('option').not(function() {
return !this.selected
}).index();
$('.news-main').removeClass('current').eq(nowIndex).addClass('current');*/
window.location.href = $(this).val();
})
});
var current_tag = $(".main-layout").attr("current_tag");
var url = current_tag == "" ? "/news/index": "/news/index/tag/"+current_tag;
var prevPage = '<a href="{url}"><span class="iconfont">&#xe60f;</span>&nbsp;PREV</a>';
var lastPage = '<a href="{url}" class="next">NEXT&nbsp;<span class="iconfont">&#xe610;</span></a>';
var pageHtml = '<div id="pageContent" style="text-align: center;" class="pagination">'+
'<div class="pagination-inner clearfix" id="img_page" model="default" rel="">{prevPage}{lastPage}</div></div>';
var getPagination = function(page, totalPage) {
if($("#pageContent").size() >0 ) {
return ""
}
if( page - 1 >= 1 ) {
prevPage = prevPage.replace("{url}", url + "/page/" + ((page - 1 ) * 4 - 3));
pageHtml = pageHtml.replace("{prevPage}", prevPage);
}
if(page < totalPage) {
lastPage = lastPage.replace("{url}", url + "/page/"+ (page * 4 + 1) );
pageHtml = pageHtml.replace("{lastPage}", lastPage);
}
if(page < 1) {
pageHtml = '';
}
pageHtml = pageHtml.replace("{prevPage}","").replace("{lastPage}","");
return pageHtml;
}
$(window).bind("scroll",function()
{
var total = $(".main-layout").attr("total");
var ajaxPage = $(".main-layout").attr("page");//ajax请求的page
var total_times = parseInt($(".main-layout").attr("total_times"));
var limit = parseInt($(".main-layout").attr("limit"));
var times = $(".main-layout").attr("times") ? $(".main-layout").attr("times") : 0;
var page = Math.ceil(parseInt(ajaxPage) / (total_times+1));
var totalPage = Math.ceil(total / (limit * (total_times + 1)));
if($(window).scrollTop() >= $(document).height() - $(window).height()- 50 ) {
if(total > limit && times < total_times && page <= totalPage) {
$.ajax
({
type:"get",
url: url +"/page/"+(parseInt(ajaxPage)+1),
success:function(data)
{
var news_page = $(data);
if($(".main-layout").attr("page") != news_page.attr("page") && news_page.html() != "")
{
$(".main-layout").append(news_page.html());
$(".main-layout").attr({
"total":news_page.attr("total"),
"page":news_page.attr("page"),
"times":++times
});
// console.log(news_page.attr("page"));
// console.log("times:" + times);
}
page = Math.ceil(parseInt(news_page.attr("page")) / (total_times+1));//实现页码
// console.log("page:" + page);
// console.log("totalPage:" + totalPage);
if(times == total_times || news_page.html() == "" || page == totalPage)
{
$(".main-layout").append(getPagination(page, totalPage));
}
}
});
} else if(page == totalPage) {
$(".main-layout").append(getPagination(page, totalPage));
}
return false;
}
});
};
});
\ No newline at end of file
});
... ...
... ... @@ -12,7 +12,7 @@ define('yohood', function(require, exports) {
require("plugins/pagination");
//图片转换
var imgTransform = function(obj) {
$(obj).bind("mousemove", function() {
obj.bind("mousemove", function() {
if ($(this).attr("disopen") == 1) { //禁止
return false;
}
... ... @@ -32,8 +32,9 @@ define('yohood', function(require, exports) {
});
$(this).attr("isopen", 1);
}
return false;
});
$(obj).bind("mouseout", function() {
obj.bind("mouseout", function() {
if ($(this).attr("isopen") == 1) {
//图片还原
$(this).css({
... ... @@ -51,6 +52,7 @@ define('yohood', function(require, exports) {
$(this).attr("isopen", 0);
}
});
return false;
}
//设置瀑布流
exports.setFlowLayout = setFlowLayout = function() {
... ... @@ -58,7 +60,7 @@ define('yohood', function(require, exports) {
animate: false,
elementDelay: 0
});
imgTransform(".image-box img");
imgTransform($(".image-box img"));
}
//设置商品滚动条
function setGoodsSwiper() {
... ... @@ -709,6 +711,6 @@ define('yohood', function(require, exports) {
//视频
exports.video = function() {
//图片转换
imgTransform(".image-box img");
imgTransform($(".image-box img"));
}
});
\ No newline at end of file
... ...
... ... @@ -2,5 +2,5 @@
yohood.username = yohodb
yohood.password = yohonj_9646_mysql
yohood.writers = 182.92.158.172:3310
yohood.readers = 182.92.158.172:3310
yohood.writers = 123.56.138.21:3310
yohood.readers = 123.56.138.21:3310
... ...
... ... @@ -71,10 +71,6 @@ class Controller_Abstract extends Framework_YController
$callback = $cookieUrl;
}
}
if($this->_request->isAjax())
{
$this->_platform = 'web';
}
//yohobuy.com连接,自动跳转到客户端
if(strpos($callback, 'yohobuy.com') !== false)
{
... ... @@ -97,7 +93,7 @@ class Controller_Abstract extends Framework_YController
{
$action .= 'Mobile';
}
else
else if(!$this->existsAction($action))
{
if(!file_exists($this->getViewBasePath().$this->getViewScriptPath().'/'.$_REQUEST['controller'].'/'.$this->_viewname.'.php'))
{
... ...
... ... @@ -61,6 +61,48 @@ class Controller_News extends Controller_Abstract
}
/**
* 手机端最新资讯
*
*/
public function indexMobileAction()
{
$requestTag = $tag = trim($this->_request->tag);//标签
$exceptTags = array('视频');
$limit = 8;
$total = Facade_News::getTotal($tag, $exceptTags);
$page = new Lib_Helper_Pagination($total, $limit);
$tagKeys = Facade_News::$types;
$list = Facade_News::getList($tag, $page->getOffset(), $limit, $exceptTags);
$this->_view['list'] = $list;
$newTags = Facade_News::getTags();
$this->_view['total'] = 0;
$tags = $temp = array();
foreach($newTags as $tag)
{
$temp[$tag['tag']] = $tag;
}
foreach($tagKeys as $tagKey)
{
$tags[$tagKey] = array('tag' => $tagKey, 'num'=> 0);
if(isset($temp[$tagKey]))
{
$tags[$tagKey] = $temp[$tagKey];
}
}
$tags['视频'] = $temp['手机视频'];
$this->_view['tags'] = $tags;
foreach($this->_view['tags'] as $val)
{
$this->_view['total'] += $val['num'];
}
$this->_view['current_tag'] = $requestTag;
$this->_view['isAjax'] = $this->_request->isAjax();
$this->_view['total'] = $total;
$this->_view['limit'] = $limit;
$this->_view['page'] = $page->getCurrentPage();
}
/**
* 发布资讯
*/
public function publishAction()
... ...
... ... @@ -128,9 +128,7 @@ class Controller_Admin_News extends Controller_Admin_Base
$times = 0;
while($width <= 0 && $height <= 0 && $times++<=5)
{
$info = Lib_Images::getImageInfo($data['thumb'], 'fragmentimg');
$width = intval($info['width']);
$height = intval($info['height']);
list($width, $height, $type, $attr) = getimagesize(Lib_Images::getImageUrl($data['thumb'], 'source','fragmentimg'));
}
$data['thumb_size'] = json_encode(array('width'=> $width, 'height'=> $height));
if ($id)
... ...
... ... @@ -78,14 +78,14 @@ class Service_News extends Lib_Service
$exceptTags = implode("','", $exceptTags);
$exceptWhere = "`tag` NOT IN ('$exceptTags') ";
}
if ($tag)
if (!empty($tag))
{
$tag = strip_tags($tag);
$tag = addslashes($tag);
$where = '`tag` like ("'.$tag.'%")' ;
}
$where = ' WHERE '.$where .' AND '.$exceptWhere;
return self::service(self::ROUTER)->tag(self::$_tag)->fetchAssoc('getList', array('offset' => $offset, 'limit' => $limit), array('where' => $where));
return self::service(self::ROUTER)->tag(self::$_tag)->fetchAssoc('getList', array('offset' => intval($offset), 'limit' => intval($limit)), array('where' => $where));
}
/**
... ...
... ... @@ -55,4 +55,4 @@ seajs.use('mobile',function(mobile){
<?php $this->_block('js');?>
<?php $this->_endblock();?>
</body>
</html>
\ No newline at end of file
</html>
... ...
... ... @@ -85,7 +85,7 @@
<tbody>
<tr>
<td>名称 <span class="text-error"> * </span></td>
<td><input type="text" id="name" name="name"/>
<td><input type="text" id="name" name="name" maxLength="20"/>
<input type="hidden" id="id" name="id"/>
</td>
<td>LOGO(300x198)<span class="text-error"> * </span></td>
... ...
... ... @@ -14,7 +14,7 @@ a.btn
<tr>
<td style="width:200px;">标题</td>
<td colspan="2">
<input type="text" id="title" name="title" value="<?php echo $this->view->info['title'] ;?>" maxLength="50"/>
<input type="text" id="title" name="title" value="<?php echo $this->view->info['title'] ;?>" maxLength="40"/>
<select id="main_title_type" name="main_title_type">
<option value="0" <?php echo $this->view->info['main_title_type'] == 0 ? 'selected':''; ?>>中文</option>
<option value="1" <?php echo $this->view->info['main_title_type'] == 1 ? 'selected':''; ?>>英文</option>
... ...
... ... @@ -43,7 +43,7 @@
if(!empty($videoMatches[2]))
{
$video = current($videoMatches[2]);
$videoHtml = '<video controls="controls" preload="auto" poster="'.Lib_Images::getImageUrl($this->view->info['thumb'],'0300x0300','fragmentimg','autoCrop').'" width="300" height="300"><source src="'.$video.'" type="video/mp4" /></video>';
$videoHtml = '<video controls="controls" preload="auto" poster="'.Lib_Images::getImageUrl($this->view->info['thumb'],'0300x0300','fragmentimg','autoCrop').'" width="300" height="300" style="width:300px;height:300px;display:block;margin:auto;"><source src="'.$video.'" type="video/mp4" /></video>';
$this->view->info['content'] = preg_replace('@<(object.*?)>(.*?)<(\/object.*?)>@si',$videoHtml, $this->view->info['content']);
$this->view->info['content'] = preg_replace('@<(embed.*?)>@si', $videoHtml, $this->view->info['content']);
}
... ...
<?php if($this->view->isAjax):?>
<div id="news_page" total="<?php echo $this->view->total;?>" page="<?php echo $this->view->page;?>">
<?php $this->_widget('news_listmobile', array('list'=> $this->view->list));?>
</div>
<?php else:?>
<?php $this->_extends('layout/default_layout_mobile');?>
<?php $this->_block('main');?>
<div class="news-select">
... ... @@ -14,18 +19,11 @@
</div>
<div class="news-main content-main current">
<div class="news-content">
<div class="main-layout clearfix">
<?php $this->_widget('news_listmobile', array('list'=> $this->view->list));?>
<div class="main-layout clearfix" total="<?php echo $this->view->total;?>" page="<?php echo $this->view->page;?>"
total_times="3" current_tag="<?php echo $this->view->current_tag;?>" limit="<?php echo $this->view->limit;?>">
<?php $this->_widget('news_listmobile', array('list'=> $this->view->list));?>
</div>
</div>
<div id="pageContent" style="text-align: center;" class="pagination">
<?php $this->_component('Common_Pagination',array(
'pagination' => $this->view->pagination,'next_label' => 'NEXT&nbsp;<span class="iconfont">&#xe610;</span>',
'prev_label' => '<span class="iconfont">&#xe60f;</span>&nbsp;PREV',
'is_mobile' => true,'prev_class'=>'iconfont','prev_class'=>'iconfont',
'next_class'=>'next','page_class'=>'pagination-inner clearfix', 'id'=>'img_page'
));?>
</div>
</div>
<?php $this->_endblock();?>
<?php $this->_block('js');?>
... ... @@ -35,5 +33,6 @@ seajs.use("mobile", function(mobile)
mobile.news();
});
</script>
<?php $this->_endblock();?>
<?php $this->_endblock();?>
<?php endif;?>
 
\ No newline at end of file
... ...