12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- mui.init();
- var initDate,
- initStatus,
- initType;
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
-
- initDate = self.dateVal || '';
- initStatus = self.statusVal || '';
- initType = self.typeVal || '';
-
- setTagActive();
-
- bindEvents();
- })
- function setTagActive(){
- $(".tag").removeClass("active");
- if(initDate){
- $(".date-tag[data-val="+initDate+"]").addClass("active");
- }else{
- $(".date-tag").eq(0).addClass("active");
- }
- if(initStatus){
- $(".status-tag[data-val="+initStatus+"]").addClass("active");
- }else{
- $(".status-tag").eq(0).addClass("active");
- }
- if(initType){
- $(".type-tag[data-val="+initType+"]").addClass("active");
- }else{
- $(".type-tag").eq(0).addClass("active");
- }
- }
- function bindEvents(){
- $(".confirm-btn").on('click', function(){
- var self = plus.webview.currentWebview(),
- opener = self.opener();
-
- var $date = $(".date-tag.active"),
- $status = $(".status-tag.active"),
- $type = $(".type-tag.active");
-
- var date = $date.attr("data-val"),
- dateName = $date.text(),
- status = $status.attr("data-val"),
- statusName = $status.text(),
- type = $type.attr("data-val"),
- typeName = $type.text();
-
- mui.fire(opener, "setFilterData", {
- date: date,
- dateName: dateName,
- status: status,
- statusName: statusName,
- type: type,
- typeName: typeName
- });
-
- mui.fire(opener, "hideShaiXuan");
- });
-
- $(".cancel-btn").on('click', function(){
- var self = plus.webview.currentWebview(),
- opener = self.opener();
-
- mui.fire(opener, "hideShaiXuan");
- });
-
- $(".tag").on('click', function(){
- var $this = $(this),
- value = $this.attr("data-val"),
- name = $this.attr("data-type");
- if($this.hasClass("active")){
- return false;
- }
-
- $("."+name+"-tag").removeClass("active");
- $this.addClass("active");
- });
-
- $(".reset-btn").on('click', function(){
- initDate = '';
- initStatus = '';
- initType = '';
- setTagActive();
- });
-
- window.addEventListener("setTagActive", function(arg){
- initDate = arg.detail.dateVal;
- initStatus = arg.detail.statusVal;
- initType = arg.detail.typeVal;
-
- setTagActive();
- })
- }
|