12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- var type,
- page = 1,
- pagesize = 15,
- hasMore = true;
- var surveyId, questionId, optionId;
- mui.init();
- mui.plusReady(function(){
- var self = plus.webview.currentWebview();
- type = self.type;
- surveyId = self.survey_id;
- questionId = self.question_id;
- optionId = self.option_id;
- var title = "";
- if(type == "question"){
- $("#op").hide();
- title = "填空题结果";
- }else{
- $("#op").show();
- title = "选项结果";
- }
- $(".demo-comtop").find("h1").text(title);
- getResponse(true);
- initScroll();
- });
- function initScroll(){
- //阻尼系数
- var deceleration = mui.os.ios?0.003:0.0009;
- mui('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: true, //是否显示滚动条
- deceleration:deceleration
- });
-
- mui('.mui-scroll-wrapper').pullRefresh({
- up:{
- contentrefresh: '正在加载...',
- callback: function(){
- var self = this;
- setTimeout(function() {
- getResponse(false);
- mui('.mui-scroll-wrapper').pullRefresh().endPullupToRefresh(!hasMore);
- }, 1000);
- }
- }
- });
- }
- function getResponse(isInit){
- page = isInit ? 1 : page;
- var url = "/doctor/questionnaire/getOptionsComment",
- params = {id: surveyId, questionId: questionId, pageNo: page, pageSize: pagesize};
-
- if(type == "option"){
- params.optionId = optionId;
- }
- sendGet(url, params, null, function(res){
- if(res.status == 200){
- if(isInit){
- $("#q_title").text(res.data.title);
- $("#count").text(res.data.amount+"人");
- if(type == "option"){
- $("#op_name").text(res.data.option);
- }
- }
- var html = template("response_temp", {list: res.data.content});
- $("#result_list").append(html);
- if(res.data.content.length < pagesize){
- hasMore = false;
- isInit && mui('.mui-scroll-wrapper').pullRefresh().endPullupToRefresh(!hasMore);
- }
- }else{
- mui.toast(res.msg);
- }
- }, true);
- }
- template.helper("setIndex", function(k){
- return (page - 1)*pagesize + k +1;
- });
|