| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 | 
							- var d = dialog({contentType: 'load',skin: 'bk-popup'})
 
- var Request = GetRequest();
 
- var doctor = Request["docCode"];
 
- var firstLevelCategoryId = ""
 
- var hospital = "" // 医生所属社区Code
 
- var pageData = {}
 
- function toast(msg){
 
- 	dialog({contentType:'tipsbox',bottom:true, skin:'bk-popup' , content:msg}).show()
 
- }
 
- function getCategoryByNamePromise(){
 
- 	return new Promise(function(resolve, reject) {
 
- 		sendPost("third/jkEdu/Article/getCategoryByName",{name:'健康文章'},"JSON","GET",function(){
 
- 			toast('请求失败')
 
- 		},function(res){
 
- 			resolve(res)
 
- 		})
 
- 	})
 
- }
 
- function jimeiHomepagePromise(){
 
- 	return new Promise(function(resolve, reject) {
 
- 		sendPost("patient/family_contract/jimeiHomepage",{doctor:doctor,pageIndex:1,pageSize:3},"JSON","GET",function(){
 
- 			toast('请求失败')
 
- 		},function(res){
 
- 			resolve(res)
 
- 		})
 
- 	})
 
- }
 
- function queryArticleAPPListPromise(){
 
- 	return new Promise(function(resolve, reject) {
 
- 		sendPost("patient/jkEdu/article/queryArticlePcList",{
 
- 			doctor: doctor,
 
- 			firstLevelCategoryId: firstLevelCategoryId, // 文章一级分类
 
- 			isMyArticle: true,
 
- 			currentUserRole: hospital,
 
- 			currentUserRoleLevel: 4,
 
- 			iDisplayStart: 0,
 
- 			iDisplayLength: 3
 
- 		},"JSON","GET",function(){
 
- 			toast('请求失败')
 
- 		},function(res){
 
- 			resolve(res)
 
- 		})
 
- 	})
 
- }
 
- function bindEvents(){
 
-     	$('.j-open').on('tap',function(){
 
-     		var $this = $(this)
 
-     		$this.addClass('c-hide')
 
-     		$('.di-down').removeClass('c-hide')
 
-     	})
 
-     	$('.j-close').on('tap',function(){
 
-     		var $this = $(this)
 
-     		$this.closest('.di-down').addClass('c-hide');
 
-     		$('.j-open').removeClass('c-hide')
 
-     	})
 
-     	$('.xj-li').on('tap',function(){
 
-     		d.show()
 
-     		var articleId = $(this).attr('data-id')
 
-     		window.location.href="../../jkjy/html/article2.html?dataId="+articleId+'&articleId='+articleId+'&type='+'1';
 
-     	})
 
-     	$("#more_art").on('tap',function(){
 
-     		window.location.href="health-article-list.html?docCode="+$(this).attr('data-id')
 
-     	})
 
-     }
 
- $(function(){
 
- 	d.show()
 
- 	
 
- 	Promise.all([getCategoryByNamePromise(),jimeiHomepagePromise()]).then(function(responses) {
 
- 		var res0 = responses[0]
 
- 		var res1 = responses[1]
 
- 		if(res0.status == 200 && res1.status == 200) {
 
- 			firstLevelCategoryId = res0.data.cid
 
- 			hospital = res1.data.hospital
 
- 			pageData = res1.data
 
- 		} else {
 
- 			d.close()
 
- 			toast('获取数据失败')
 
- 			return Promise.reject()
 
- 		}
 
- 	}).then(function() {
 
- 		return queryArticleAPPListPromise().then(function(res) {
 
- 			d.close()
 
- 			var list = res.data.aaData
 
- 			var data = $.extend({},pageData, {
 
- 				healthEduArticles: list
 
- 			})
 
- 			var html = template('list_tmp',{data: data})
 
- 			$('#main_contain').html(html)
 
- 			bindEvents()
 
- 		})
 
- 	}).catch(function(e) {
 
- 		d.close()
 
- 		console && console.error(e)
 
- 	})
 
- })
 
- template.helper("setPhoto", function(p) {
 
- 	return getImgUrl(p);
 
- })
 
- template.helper("setTime", function(p) {
 
- 	if(p && p.length>0){
 
- 		return p.substr(0,16)
 
- 	}else{
 
- 		return ''
 
- 	}
 
- })
 
 
  |