作者 sgj

display the illness pages

... ... @@ -105,8 +105,18 @@ class ArticleController extends WeChatBaseController
return $this->fetch();
}
/**
* 疾病信息页
* @return mixed
*/
public function illInfo(){
$illid=input('id');
$Article=new PortalPostModel();
$portalCategoryModel = new PortalCategoryModel();
$cat=$portalCategoryModel->getCategoryById($illid);
$article=$Article->getArticleByCategory($illid);
$this->assign('cat',$cat);
$this->assign('article',$article);
return $this->fetch();
}
... ...
... ... @@ -230,5 +230,17 @@ class PortalCategoryModel extends Model
return $ill;
}
/**
* 通过id获取相应的分类
* @param $cat_id
* @return array|false|\PDOStatement|string|Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getCategoryById($cat_id){
$map['id']=$cat_id;
$cat=$this->where($map)->find();
return $cat;
}
}
\ No newline at end of file
... ...
... ... @@ -379,4 +379,44 @@ class PortalPostModel extends Model
->select();
return $result;
}
/**
* 通过疾病类型获取文章id
* @param $illId
* @param string $article_type
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getArticleByCategory($illId,$article_type=''){
$map['category_id']=$illId;
if ($article_type!=''){
$map['article_type']=$article_type;
}
$article_id=db('portal_category_post')->where($map)->column('post_id');
$article_id=implode(',',$article_id);
$where['id']=['in',$article_id];
$where['delete_time']='0';
$article_all=$this->where($where)->select()->toArray();
foreach ($article_all as $k=>$v){
$article[$v['article_type']][]=$v;
}
for ($i=1;$i<5;$i++){
if (empty($article[$i])){
$article[$i]='';
}
}
ksort($article);
return $article;
}
/**
* 通过id获取文章内容
* @param $article
*/
public function getArticleById($article){
}
}
... ...
... ... @@ -18,7 +18,7 @@
</div>
</div>
<!--弹窗-->
<div class="public_popup_box">
<div class="public_popup_box suc">
<text>评论成功!</text>
<text>内容稍后展示出来</text>
</div>
... ... @@ -55,9 +55,8 @@
post:postData,
},
success:function(res) {
if (res.code==1){
$('.public_popup_box').show().delay(2000).hide(2)
$('.suc').show().delay(2000).hide(2)
}else {
$('.fial').show().delay(2000).hide(2)
}
... ...
... ... @@ -55,6 +55,12 @@
<th width="100">文章类别<span class="form-required">*</span></th>
<td>
<select name="post[article_type]" class="form-control">
<switch name="post.article_type">
<case value="1"> <option value="1" >基础知识</option></case>
<case value="2"> <option value="2" >指南知识</option></case>
<case value="3"> <option value="3" >经典案例</option></case>
<case value="4"> <option value="4" >质控文件</option></case>
</switch>
<option value="1" >基础知识</option>
<option value="2" >指南知识</option>
<option value="3" >经典案例</option>
... ...
... ... @@ -57,6 +57,5 @@
</if>
{$comment}
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -11,7 +11,7 @@
</head>
<body>
<header class="banner_box">
<img src="__TMPL__/public/assets/images/abg01@2x.png" alt="">
<img src="{:cmf_get_image_url($cat.more.thumbnail)}" alt="">
</header>
<!--内容部分-->
<div class="content_box">
... ... @@ -22,36 +22,27 @@
<div class="tab_title">质控文件</div>
</div>
<div>
<div class="tab_content1" >
<volist name="article" id="v" key="key1">
<div class="tab_content1 <if condition="$key1!=1">item </if>" >
<volist name="v" id="vo" key="key2" empty="内容为空">
<a href="{:url('portal/article/index',['id'=>$vo.id])}">
<div class="item_box">
<div>
<div class="item_title">人参一斤 不如糙米一升1</div>
<div class="item_content">精致,是一种对生活热爱且认真负责的态度。如今人们在选择食物的时候...精致,是一种对生活热爱且认真负责的态度。如今人们在选择食物的时候...</div>
<div>2018.08.15</div>
<div class="item_title">{$vo.post_title}</div>
<div class="item_content">{:getDescirpe($vo.post_content)}...</div>
<div>{:date('Y.m.d',$vo.create_time)}</div>
</div>
<div>
<img src="__TMPL__/public/assets/images/dpic06@2x.png" alt="">
</div>
</div>
<div class="item_box">
<div>
<div class="item_title">人参一斤 不如糙米一升1</div>
<div class="item_content">精致,是一种对生活热爱且认真负责的态度。如今人们在选择食物的时候...精致,是一种对生活热爱且认真负责的态度。如今人们在选择食物的时候...</div>
<div>2018.08.15</div>
</div>
<div>
<img src="__TMPL__/public/assets/images/dpic06@2x.png" alt="">
</div>
</div>
</div>
<div class="tab_content1 item">
<img src="{:cmf_get_image_preview_url($vo.more.thumbnail)}" alt="">
</div>
<div class="tab_content1 item">
</div>
</a>
</volist>
</div>
</volist>
</div>
</div>
... ...