123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- var docInfo,
- page1 = 0,
- pagesize = 10,
- page2 = 0;
- mui.init();
- mui.plusReady(function(){
- docInfo = plus.storage.getItem('docInfo');
- docInfo = JSON.parse(docInfo);
- getAccountBackData(true);
- getFeedbackData(true);
- initScroller();
- bindEvents();
- });
- //获取账号申诉列表
- function getAccountBackData(isInit){
- if(isInit){
- page1 = 0;
- }
- var url = "/doctorFeedback/feedback/findByIdcard",
- params = {
- idcard: docInfo.idcard,
- page: page1,
- pagesize: pagesize
- };
- plus.nativeUI.showWaiting();
- sendGet(url ,params, null, function(res){
- if(res.status == 200){
- if(res.list.length == 0){
- if(isInit){
- $("#no_result_wrap1").show();
- $("#result_wraper1").hide();
- }else{
- mui('#result_wraper1').pullRefresh().disablePullupToRefresh();
- }
- }else{
- $("#no_result_wrap1").hide();
- $("#result_wraper1").show();
- var html = template("list_tmp", {list: res.list, type: 1});
- if(isInit){
- $("#listPanel1").empty().append(html);
- }else{
- $("#listPanel1").append(html);
- }
-
- if(res.list.length < pagesize){
- mui('#result_wraper1').pullRefresh().disablePullupToRefresh();
- }else{
- page1 ++;
- mui('#result_wraper1').pullRefresh().enablePullupToRefresh();
- }
- }
- }else{
- mui.toast(res.msg);
- }
- plus.nativeUI.closeWaiting();
- }, true)
- }
- //获得意见反馈列表
- function getFeedbackData(isInit){
- if(isInit){
- page2 = 0;
- }
- var url = "/doctor/feedback/findByCreater",
- params = {
- page: page2,
- pagesize: pagesize
- };
- plus.nativeUI.showWaiting();
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- if(res.list.length == 0){
- if(isInit){
- $("#no_result_wrap2").show();
- $("#result_wraper2").hide();
- }else{
- mui('#result_wraper2').pullRefresh().disablePullupToRefresh();
- }
- }else{
- $("#no_result_wrap2").hide();
- $("#result_wraper2").show();
-
- var html = template("list_tmp", {list: res.list, type: 2});
- if(isInit){
- $("#listPanel2").empty().append(html);
- }else{
- $("#listPanel2").append(html);
- }
-
- if(res.list.length < pagesize){
- mui('#result_wraper2').pullRefresh().disablePullupToRefresh();
- }else{
- page2 ++;
- mui('#result_wraper2').pullRefresh().enablePullupToRefresh();
- }
- }
- }else{
- mui.toast(res.msg);
- }
- plus.nativeUI.closeWaiting();
- }, true);
- }
- function initScroller(){
- //阻尼系数
- var deceleration = mui.os.ios?0.003:0.0009;
- mui('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: true, //是否显示滚动条
- deceleration:deceleration
- });
- $.each(document.querySelectorAll('.mui-slider-group .mui-scroll-wrapper'), function(index, pullRefreshEl) {
- mui(pullRefreshEl).pullRefresh({
- down:{
- callback: function(){
- var self = this;
- setTimeout(function(){
- if(index == 0){
- getAccountBackData(true);
- }else{
- getFeedbackData(true);
- }
- self.endPulldownToRefresh();
- }, 1000)
- }
- },
- up: {
- callback: function() {
- var self = this;
- setTimeout(function() {
- if(index == 0){
- getAccountBackData(false);
- }else{
- getFeedbackData(false);
- }
- self.endPullupToRefresh();
- }, 1000);
- }
- }
- });
- });
- }
- function bindEvents(){
- $(".mui-control-item").on('tap', function(){
- var $this = $(this);
- if($this.hasClass("mui-active")){
- return false;
- }
-
- var index = $this.data("index");
- if(index == 1){
- getAccountBackData(true);
- }else{
- getFeedbackData(true);
- }
- });
-
- $(".mui-scroll-wrapper").on('tap', '.list-item', function(){
- var $this = $(this),
- type = $this.data('type'), // 1-账号申诉,2-意见反馈
- code = $this.data('code');
- openWebview("feedback-detail.html", {
- type: type,
- code: code
- });
- });
-
- template.helper('formatDate', function(time){
- if(time){
- return time.substr(0,16);
- }
- return "";
- });
-
- template.helper('getTypeValue', function(type, fkType){
- if(fkType == 1){
- switch(type){
- case 1:
- return "手机号变更";
- break;
- case 2:
- return "重置密码";
- break;
- case 3:
- return "其他";
- break;
- default:
- return "";
- break;
- }
- }else if(fkType == 2){
- switch(type){
- case 1:
- return "优化建议";
- break;
- case 2:
- return "提交bug";
- break;
- case 3:
- return "新功能建议";
- break;
- case 4:
- return "其他";
- break;
- default:
- return "";
- break;
- }
- }
-
- });
-
- template.helper("getStatus", function(status){
- switch(status){
- case 0:
- return "未读";
- break;
- case 1:
- return "待处理";
- break;
- case 2:
- return "已处理";
- break;
- }
- })
- }
|