123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- mui.init();
- var isAdmin,
- patient = null, //从居民页面或IM页面跳转过来的时候,需要传递居民信息
- patientName ="",
- teamCode = "",
- pCodes, //从慢病管理页面中跳转过来的多个居民的code
- referrer;
-
- var subPages = ["article-list.html", "article-sent.html"];
- var subStyles = {
- top: "45px",
- bottom: "40px",
- scorllIndicator: "none",
- bounceBackground: "#17b3ec"
- };
- var selectedTab = 0;
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- isAdmin = self.isAdmin;
- patient = self.patient;
- patientName = self.patientName;
- teamCode = self.teamCode;
- pCodes = self.pCodes;
- referrer = self.referrer;
-
- getFirstLevelCategory();
- bindEvents();
- });
- function getFirstLevelCategory(){
- var url = "/third/jkEdu/Article/getCategoryList",
- params = {categoryLevel: 1};
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- var list = res.data.reverse();
- var html = template("cat-tmp", {list: list});
- $("footer").empty().append(html);
-
- var wv = mui.openWindow({
- url: subPages[0],
- id: subPages[0]+selectedTab,
- styles:subStyles,
- waiting:{
- autoShow:true,//自动显示等待框,默认为true
- title:'正在加载...'//等待对话框上显示的提示内容
- },
- extras:{
- firstLevelId: list[0].categoryid,
- isAdmin: isAdmin,
- patient: patient,
- patientName: patientName,
- teamCode: teamCode,
- pCodes: pCodes,
- referrer: referrer
- }
- });
- var self = plus.webview.currentWebview();
- self.append(wv);
- }else{
- mui.toast(res.msg);
- }
- }, true)
- }
- function bindEvents(){
- $(".header-link").on("click",'.shoucang-btn',function(){
- openWebview("my-store2.html", {
- isAdmin: isAdmin,
- patient: patient,
- patientName: patientName,
- pCodes: pCodes,
- referrer: referrer
- });
- }).on("click",'.search-btn',function(){
- var $tab = $(".cat-level-1.active"),
- categoryId = $tab.attr("data-id"),
- isSent = false;
-
- if(categoryId == 'sent'){
- isSent = true;
- }
- openWebviewExtras("search_article.html",{
- type:0,
- isAdmin: isAdmin,
- patient: patient,
- patientName: patientName,
- isSent: isSent,
- firstCatId: categoryId,
- pCodes: pCodes,
- referrer: referrer
- });
- });
-
- $("footer").on('click', '.cat-level-1', function(){
- if($(this).hasClass("active")){
- return false;
- }
- selectedTab = $(this).index();
- $(".cat-level-1").removeClass("active");
- $(this).addClass("active");
- var categoryId = $(this).attr("data-id");
-
- if(categoryId == "sent"){
- var wv1 = plus.webview.getWebviewById(subPages[1]);
- if(wv1){
- wv1.show();
- }else{
- var wv = mui.openWindow({
- url: subPages[1],
- id: subPages[1],
- styles:subStyles,
- waiting:{
- autoShow:true,//自动显示等待框,默认为true
- title:'正在加载...'//等待对话框上显示的提示内容
- },
- extras:{
- isAdmin: isAdmin,
- patient: patient,
- patientName: patientName,
- pCodes: pCodes,
- referrer: referrer
- }
- });
- var self = plus.webview.currentWebview();
- self.append(wv);
- }
- }else{
- var wv2 = plus.webview.getWebviewById(subPages[0]+selectedTab);
- if(wv2){
- wv2.show();
- }else{
- var wv = mui.openWindow({
- url: subPages[0],
- id: subPages[0]+selectedTab,
- styles:subStyles,
- waiting:{
- autoShow:true,//自动显示等待框,默认为true
- title:'正在加载...'//等待对话框上显示的提示内容
- },
- extras:{
- firstLevelId: categoryId,
- isAdmin: isAdmin,
- patient: patient,
- patientName: patientName,
- pCodes: pCodes,
- referrer: referrer
- }
- });
- var self = plus.webview.currentWebview();
- self.append(wv);
- }
- }
- });
-
- window.addEventListener('reload', function(){
- var $activeWv = $(".cat-level-1.active"),
- categoryId = $activeWv.attr("data-id"),
- selectedTab = $activeWv.index();
-
- if(categoryId == "sent"){
- var wv1 = plus.webview.getWebviewById(subPages[1]);
- mui.fire(wv1, 'reload');
- }else{
- var wv2 = plus.webview.getWebviewById(subPages[0] + selectedTab);
- mui.fire(wv2, 'reload');
- }
- })
- }
|