作者 dl

时间模块 回家写写定位功能

@@ -40,6 +40,7 @@ @@ -40,6 +40,7 @@
40 padding: 0 0.4rem; 40 padding: 0 0.4rem;
41 /*height: 0.88rem;*/ 41 /*height: 0.88rem;*/
42 line-height: 100%; 42 line-height: 100%;
  43 + position: relative;
43 } 44 }
44 45
45 .service_icon { 46 .service_icon {
  1 +
  2 +//datePicker日期控件 v1.0
  3 +
  4 +//var calendar = new datePicker();
  5 +//calendar.init({
  6 +// 'trigger': '#demo1', /*选择器,触发弹出插件*/
  7 +// 'type': 'date',/*date 调出日期选择 datetime 调出日期时间选择 time 调出时间选择 ym 调出年月选择*/
  8 +// 'minDate':'1900-1-1',/*最小日期*/
  9 +// 'maxDate':new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate(),/*最大日期*/
  10 +// 'onSubmit':function(){/*确认时触发事件*/
  11 +// var theSelectData=calendar.value;
  12 +// },
  13 +// 'onClose':function(){/*取消时触发事件*/
  14 +// }
  15 +//});
  16 +
  17 +window.datePicker = (function() {
  18 + var MobileCalendar = function() {
  19 + this.gearDate;
  20 + this.minY = 1900;
  21 + this.minM = 1;
  22 + this.minD = 1;
  23 + this.maxY = 2099;
  24 + this.maxM = 12;
  25 + this.maxD = 31;
  26 + this.value="";
  27 + };
  28 +
  29 + var cssHtm='.gearYM,.gearDate,.gearDatetime,.gearTime{font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:10px;background-color:rgba(0,0,0,0.2);display:block;position:fixed;top:0;left:0;width:100%;height:100%;z-index:9900;overflow:hidden;-webkit-animation-fill-mode:both;animation-fill-mode:both}.date_ctrl{vertical-align:middle;background-color:#d5d8df;color:#000;margin:0;height:auto;width:100%;position:absolute;left:0;bottom:0;z-index:9901;overflow:hidden;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.slideInUp{animation:slideInUp .3s ease;-webkit-animation:slideInUp .3s ease;}@-webkit-keyframes slideInUp{from{-webkit-transform:translate3d(0,100%,0);transform:translate3d(0,100%,0)}to{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.ym_roll,.date_roll,.datetime_roll,.time_roll{display:-webkit-box;width:100%;height:auto;overflow:hidden;font-weight:bold;background-color:transparent;-webkit-mask:-webkit-gradient(linear,0% 50%,0% 100%,from(#debb47),to(rgba(36,142,36,0)));-webkit-mask:-webkit-linear-gradient(top,#debb47 50%,rgba(36,142,36,0))}.ym_roll>div,.date_roll>div,.datetime_roll>div,.time_roll>div{font-size:2.3em;height:6em;float:left;background-color:transparent;position:relative;overflow:hidden;-webkit-box-flex:4}.ym_roll>div .gear,.date_roll>div .gear,.datetime_roll>div .gear,.time_roll>div .gear{width:100%;float:left;position:absolute;z-index:9902;margin-top:-6em}.date_roll_mask{-webkit-mask:-webkit-gradient(linear,0% 40%,0% 0%,from(#debb47),to(rgba(36,142,36,0)));-webkit-mask:-webkit-linear-gradient(bottom,#debb47 50%,rgba(36,142,36,0));padding:0 0 3em 0}.date_roll>div:nth-child(2){-webkit-box-flex:2}.date_roll>div:nth-child(1),.datetime_roll>div:nth-child(1){-webkit-box-flex:4}.datetime_roll>div:first-child{-webkit-box-flex:6}.datetime_roll>div:last-child{-webkit-box-flex:6}.date_grid{position:relative;top:2em;width:100%;height:2em;margin:0;box-sizing:border-box;z-index:0;border-top:1px solid #abaeb5;border-bottom:1px solid #abaeb5}.date_grid>div{color:#000;position:absolute;right:0;top:0;font-size:.8em;line-height:2.5em}.date_roll>div:nth-child(3) .date_grid>div{left:42%}.datetime_roll>div .date_grid>div{right:0}.datetime_roll>div:first-child .date_grid>div{left:auto;right:0%}.datetime_roll>div:last-child .date_grid>div{left:50%}.time_roll>div:nth-child(1) .date_grid>div{right:1em}.ym_roll>div:nth-child(1) .date_grid>div{right:.1em}.ym_roll>div .date_grid>div,.time_roll>div .date_grid>div{right:5em}.date_btn{color:#0575f2;font-size:1.6em;font-weight:bold;line-height:1em;text-align:center;padding:.8em 1em}.date_btn_box:before,.date_btn_box:after{content:"";position:absolute;height:1px;width:100%;display:block;background-color:#96979b;z-index:15;-webkit-transform:scaleY(0.33);transform:scaleY(0.33)}.date_btn_box{display:-webkit-box;-webkit-box-pack:justify;-webkit-box-align:stretch;background-color:#f1f2f4;position:relative}.date_btn_box:before{left:0;top:0;-webkit-transform-origin:50% 20%;transform-origin:50% 20%}.date_btn_box:after{left:0;bottom:0;-webkit-transform-origin:50% 70%;transform-origin:50% 70%}.date_roll>div:nth-child(1) .gear{text-indent:20%}.date_roll>div:nth-child(2) .gear{text-indent:-20%}.date_roll>div:nth-child(3) .gear{text-indent:-55%}.datetime_roll>div .gear{width:100%;text-indent:-25%}.datetime_roll>div:first-child .gear{text-indent:-10%}.datetime_roll>div:last-child .gear{text-indent:-50%}.ym_roll>div .gear,.time_roll>div .gear{width:100%;text-indent:-70%}.ym_roll>div:nth-child(1) .gear,.time_roll>div:nth-child(1) .gear{width:100%;text-indent:10%}.tooth{height:2em;line-height:2em;text-align:center}';
  30 + var cssEle = document.createElement("style");
  31 + cssEle.type = "text/css";
  32 + cssEle.appendChild(document.createTextNode(cssHtm));
  33 + document.getElementsByTagName("head")[0].appendChild(cssEle);
  34 +
  35 + MobileCalendar.prototype = {
  36 + init: function(params) {
  37 + this.type = params.type;
  38 + this.trigger = document.querySelector(params.trigger);
  39 + if (this.trigger.getAttribute("data-lcalendar") != null) {
  40 + var arr = this.trigger.getAttribute("data-lcalendar").split(',');
  41 + var minArr = arr[0].split('-');
  42 + this.minY = ~~minArr[0];
  43 + this.minM = ~~minArr[1];
  44 + this.minD = ~~minArr[2];
  45 + var maxArr = arr[1].split('-');
  46 + this.maxY = ~~maxArr[0];
  47 + this.maxM = ~~maxArr[1];
  48 + this.maxD = ~~maxArr[2];
  49 + };
  50 + if (params.minDate) {
  51 + var minArr = params.minDate.split('-');
  52 + this.minY = ~~minArr[0];
  53 + this.minM = ~~minArr[1];
  54 + this.minD = ~~minArr[2];
  55 + };
  56 + if (params.maxDate) {
  57 + var maxArr = params.maxDate.split('-');
  58 + this.maxY = ~~maxArr[0];
  59 + this.maxM = ~~maxArr[1];
  60 + this.maxD = ~~maxArr[2];
  61 + };
  62 + this.onClose= params.onClose;
  63 + this.onSubmit= params.onSubmit;
  64 + this.onChange= params.onChange;
  65 + this.bindEvent(this.type);
  66 + },
  67 + bindEvent: function(type) {
  68 + var _self = this;
  69 + var isTouched = false , isMoved = false;
  70 + var pree;
  71 + //呼出日期插件
  72 + function popupDate(e) {
  73 + _self.gearDate = document.createElement("div");
  74 + _self.gearDate.className = "gearDate";
  75 + _self.gearDate.innerHTML = '<div class="date_ctrl slideInUp">' +
  76 + '<div class="date_btn_box">' +
  77 + '<div class="date_btn lcalendar_cancel">取消</div>' +
  78 + '<div class="date_btn lcalendar_finish">确定</div>' +
  79 + '</div>' +
  80 + '<div class="date_roll_mask">' +
  81 + '<div class="date_roll">' +
  82 + '<div>' +
  83 + '<div class="gear date_yy" data-datetype="date_yy"></div>' +
  84 + '<div class="date_grid">' +
  85 + '<div>年</div>' +
  86 + '</div>' +
  87 + '</div>' +
  88 + '<div>' +
  89 + '<div class="gear date_mm" data-datetype="date_mm"></div>' +
  90 + '<div class="date_grid">' +
  91 + '<div>月</div>' +
  92 + '</div>' +
  93 + '</div>' +
  94 + '<div>' +
  95 + '<div class="gear date_dd" data-datetype="date_dd"></div>' +
  96 + '<div class="date_grid">' +
  97 + '<div>日</div>' +
  98 + '</div>' +
  99 + '</div>' +
  100 + '</div>' +
  101 + '</div>' +
  102 + '</div><div class="date_bg" style="width:100%;height:100%;"></div>';
  103 + document.body.appendChild(_self.gearDate);
  104 + dateCtrlInit();
  105 + var lcalendar_cancel = _self.gearDate.querySelector(".lcalendar_cancel");
  106 + lcalendar_cancel.addEventListener('touchstart', closeMobileCalendar);
  107 + var lcalendar_finish = _self.gearDate.querySelector(".lcalendar_finish");
  108 + lcalendar_finish.addEventListener('touchstart', finishMobileDate);
  109 + var lcalendar_bg = _self.gearDate.querySelector(".date_bg");
  110 + lcalendar_bg.addEventListener('click', closeMobileCalendar);
  111 + var date_yy = _self.gearDate.querySelector(".date_yy");
  112 + var date_mm = _self.gearDate.querySelector(".date_mm");
  113 + var date_dd = _self.gearDate.querySelector(".date_dd");
  114 + date_yy.addEventListener('touchstart', gearTouchStart);
  115 + date_mm.addEventListener('touchstart', gearTouchStart);
  116 + date_dd.addEventListener('touchstart', gearTouchStart);
  117 + date_yy.addEventListener('touchmove', gearTouchMove);
  118 + date_mm.addEventListener('touchmove', gearTouchMove);
  119 + date_dd.addEventListener('touchmove', gearTouchMove);
  120 + date_yy.addEventListener('touchend', gearTouchEnd);
  121 + date_mm.addEventListener('touchend', gearTouchEnd);
  122 + date_dd.addEventListener('touchend', gearTouchEnd);
  123 + //-------------------------------------------------------------
  124 + lcalendar_cancel.addEventListener('click', closeMobileCalendar);
  125 + lcalendar_finish.addEventListener('click', finishMobileDate);
  126 + date_yy.addEventListener('mousedown', gearTouchStart);
  127 + date_mm.addEventListener('mousedown', gearTouchStart);
  128 + date_dd.addEventListener('mousedown', gearTouchStart);
  129 + date_yy.addEventListener('mousemove', gearTouchMove);
  130 + date_mm.addEventListener('mousemove', gearTouchMove);
  131 + date_dd.addEventListener('mousemove', gearTouchMove);
  132 + date_yy.addEventListener('mouseup', gearTouchEnd);
  133 + date_mm.addEventListener('mouseup', gearTouchEnd);
  134 + date_dd.addEventListener('mouseup', gearTouchEnd);
  135 + _self.gearDate.querySelector(".date_roll_mask").addEventListener('mouseleave', gearTouchOut);
  136 + _self.gearDate.querySelector(".date_roll_mask").addEventListener('mouseup', gearTouchOut);
  137 + }
  138 + //初始化年月日插件默认值
  139 + function dateCtrlInit() {
  140 + var date = new Date();
  141 + var dateArr = {
  142 + yy: date.getYear(),
  143 + mm: date.getMonth(),
  144 + dd: date.getDate() - 1
  145 + };
  146 + if (/^\d{4}-\d{1,2}-\d{1,2}$/.test(_self.trigger.value)) {
  147 + rs = _self.trigger.value.match(/(^|-)\d{1,4}/g);
  148 + dateArr.yy = rs[0] - _self.minY;
  149 + dateArr.mm = rs[1].replace(/-/g, "") - 1;
  150 + dateArr.dd = rs[2].replace(/-/g, "") - 1;
  151 + } else {
  152 + dateArr.yy = dateArr.yy + 1900 - _self.minY;
  153 + }
  154 + _self.gearDate.querySelector(".date_yy").setAttribute("val", dateArr.yy);
  155 + _self.gearDate.querySelector(".date_mm").setAttribute("val", dateArr.mm);
  156 + _self.gearDate.querySelector(".date_dd").setAttribute("val", dateArr.dd);
  157 + setDateGearTooth();
  158 + }
  159 + //呼出年月插件
  160 + function popupYM(e) {
  161 + _self.gearDate = document.createElement("div");
  162 + _self.gearDate.className = "gearDate";
  163 + _self.gearDate.innerHTML = '<div class="date_ctrl slideInUp">' +
  164 + '<div class="date_btn_box">' +
  165 + '<div class="date_btn lcalendar_cancel">取消</div>' +
  166 + '<div class="date_btn lcalendar_finish">确定</div>' +
  167 + '</div>' +
  168 + '<div class="date_roll_mask">' +
  169 + '<div class="ym_roll">' +
  170 + '<div>' +
  171 + '<div class="gear date_yy" data-datetype="date_yy"></div>' +
  172 + '<div class="date_grid">' +
  173 + '<div>年</div>' +
  174 + '</div>' +
  175 + '</div>' +
  176 + '<div>' +
  177 + '<div class="gear date_mm" data-datetype="date_mm"></div>' +
  178 + '<div class="date_grid">' +
  179 + '<div>月</div>' +
  180 + '</div>' +
  181 + '</div>' +
  182 + '</div>' +
  183 + '</div>' +
  184 + '</div><div class="date_bg" style="width:100%;height:100%;"></div>';
  185 + document.body.appendChild(_self.gearDate);
  186 + ymCtrlInit();
  187 + var lcalendar_cancel = _self.gearDate.querySelector(".lcalendar_cancel");
  188 + lcalendar_cancel.addEventListener('touchstart', closeMobileCalendar);
  189 + var lcalendar_finish = _self.gearDate.querySelector(".lcalendar_finish");
  190 + lcalendar_finish.addEventListener('touchstart', finishMobileYM);
  191 + var lcalendar_bg = _self.gearDate.querySelector(".date_bg");
  192 + lcalendar_bg.addEventListener('click', closeMobileCalendar);
  193 + var date_yy = _self.gearDate.querySelector(".date_yy");
  194 + var date_mm = _self.gearDate.querySelector(".date_mm");
  195 + date_yy.addEventListener('touchstart', gearTouchStart);
  196 + date_mm.addEventListener('touchstart', gearTouchStart);
  197 + date_yy.addEventListener('touchmove', gearTouchMove);
  198 + date_mm.addEventListener('touchmove', gearTouchMove);
  199 + date_yy.addEventListener('touchend', gearTouchEnd);
  200 + date_mm.addEventListener('touchend', gearTouchEnd);
  201 + //-------------------------------------------------------------
  202 + lcalendar_cancel.addEventListener('click', closeMobileCalendar);
  203 + lcalendar_finish.addEventListener('click', finishMobileYM);
  204 + date_yy.addEventListener('mousedown', gearTouchStart);
  205 + date_mm.addEventListener('mousedown', gearTouchStart);
  206 + date_yy.addEventListener('mousemove', gearTouchMove);
  207 + date_mm.addEventListener('mousemove', gearTouchMove);
  208 + date_yy.addEventListener('mouseup', gearTouchEnd);
  209 + date_mm.addEventListener('mouseup', gearTouchEnd);
  210 + _self.gearDate.querySelector(".date_roll_mask").addEventListener('mouseleave', gearTouchOut);
  211 + _self.gearDate.querySelector(".date_roll_mask").addEventListener('mouseup', gearTouchOut);
  212 + }
  213 + //初始化年月插件默认值
  214 + function ymCtrlInit() {
  215 + var date = new Date();
  216 + var dateArr = {
  217 + yy: date.getYear(),
  218 + mm: date.getMonth()
  219 + };
  220 + if (/^\d{4}-\d{1,2}$/.test(_self.trigger.value)) {
  221 + rs = _self.trigger.value.match(/(^|-)\d{1,4}/g);
  222 + dateArr.yy = rs[0] - _self.minY;
  223 + dateArr.mm = rs[1].replace(/-/g, "") - 1;
  224 + } else {
  225 + dateArr.yy = dateArr.yy + 1900 - _self.minY;
  226 + }
  227 + _self.gearDate.querySelector(".date_yy").setAttribute("val", dateArr.yy);
  228 + _self.gearDate.querySelector(".date_mm").setAttribute("val", dateArr.mm);
  229 + setDateGearTooth();
  230 + }
  231 + //呼出日期+时间插件
  232 + function popupDateTime(e) {
  233 + _self.gearDate = document.createElement("div");
  234 + _self.gearDate.className = "gearDatetime";
  235 + _self.gearDate.innerHTML = '<div class="date_ctrl slideInUp">' +
  236 + '<div class="date_btn_box">' +
  237 + '<div class="date_btn lcalendar_cancel">取消</div>' +
  238 + '<div class="date_btn lcalendar_finish">确定</div>' +
  239 + '</div>' +
  240 + '<div class="date_roll_mask">' +
  241 + '<div class="datetime_roll">' +
  242 + '<div>' +
  243 + '<div class="gear date_yy" data-datetype="date_yy"></div>' +
  244 + '<div class="date_grid">' +
  245 + '<div>年</div>' +
  246 + '</div>' +
  247 + '</div>' +
  248 + '<div>' +
  249 + '<div class="gear date_mm" data-datetype="date_mm"></div>' +
  250 + '<div class="date_grid">' +
  251 + '<div>月</div>' +
  252 + '</div>' +
  253 + '</div>' +
  254 + '<div>' +
  255 + '<div class="gear date_dd" data-datetype="date_dd"></div>' +
  256 + '<div class="date_grid">' +
  257 + '<div>日</div>' +
  258 + '</div>' +
  259 + '</div>' +
  260 + '<div>' +
  261 + '<div class="gear time_hh" data-datetype="time_hh"></div>' +
  262 + '<div class="date_grid">' +
  263 + '<div>时</div>' +
  264 + '</div>' +
  265 + '</div>' +
  266 + '<div>' +
  267 + '<div class="gear time_mm" data-datetype="time_mm"></div>' +
  268 + '<div class="date_grid">' +
  269 + '<div>分</div>' +
  270 + '</div>' +
  271 + '</div>' +
  272 + '</div>' + //date_roll
  273 + '</div>' + //date_roll_mask
  274 + '</div><div class="date_bg" style="width:100%;height:100%;"></div>';
  275 + document.body.appendChild(_self.gearDate);
  276 + dateTimeCtrlInit();
  277 + var lcalendar_cancel = _self.gearDate.querySelector(".lcalendar_cancel");
  278 + lcalendar_cancel.addEventListener('touchstart', closeMobileCalendar);
  279 + var lcalendar_finish = _self.gearDate.querySelector(".lcalendar_finish");
  280 + lcalendar_finish.addEventListener('touchstart', finishMobileDateTime);
  281 + var lcalendar_bg = _self.gearDate.querySelector(".date_bg");
  282 + lcalendar_bg.addEventListener('click', closeMobileCalendar);
  283 + var date_yy = _self.gearDate.querySelector(".date_yy");
  284 + var date_mm = _self.gearDate.querySelector(".date_mm");
  285 + var date_dd = _self.gearDate.querySelector(".date_dd");
  286 + var time_hh = _self.gearDate.querySelector(".time_hh");
  287 + var time_mm = _self.gearDate.querySelector(".time_mm");
  288 + date_yy.addEventListener('touchstart', gearTouchStart);
  289 + date_mm.addEventListener('touchstart', gearTouchStart);
  290 + date_dd.addEventListener('touchstart', gearTouchStart);
  291 + time_hh.addEventListener('touchstart', gearTouchStart);
  292 + time_mm.addEventListener('touchstart', gearTouchStart);
  293 + date_yy.addEventListener('touchmove', gearTouchMove);
  294 + date_mm.addEventListener('touchmove', gearTouchMove);
  295 + date_dd.addEventListener('touchmove', gearTouchMove);
  296 + time_hh.addEventListener('touchmove', gearTouchMove);
  297 + time_mm.addEventListener('touchmove', gearTouchMove);
  298 + date_yy.addEventListener('touchend', gearTouchEnd);
  299 + date_mm.addEventListener('touchend', gearTouchEnd);
  300 + date_dd.addEventListener('touchend', gearTouchEnd);
  301 + time_hh.addEventListener('touchend', gearTouchEnd);
  302 + time_mm.addEventListener('touchend', gearTouchEnd);
  303 + //-------------------------------------------------------------
  304 + lcalendar_cancel.addEventListener('click', closeMobileCalendar);
  305 + lcalendar_finish.addEventListener('click', finishMobileDateTime);
  306 + date_yy.addEventListener('mousedown', gearTouchStart);
  307 + date_mm.addEventListener('mousedown', gearTouchStart);
  308 + date_dd.addEventListener('mousedown', gearTouchStart);
  309 + time_hh.addEventListener('mousedown', gearTouchStart);
  310 + time_mm.addEventListener('mousedown', gearTouchStart);
  311 + date_yy.addEventListener('mousemove', gearTouchMove);
  312 + date_mm.addEventListener('mousemove', gearTouchMove);
  313 + date_dd.addEventListener('mousemove', gearTouchMove);
  314 + time_hh.addEventListener('mousemove', gearTouchMove);
  315 + time_mm.addEventListener('mousemove', gearTouchMove);
  316 + date_yy.addEventListener('mouseup', gearTouchEnd);
  317 + date_mm.addEventListener('mouseup', gearTouchEnd);
  318 + date_dd.addEventListener('mouseup', gearTouchEnd);
  319 + time_hh.addEventListener('mouseup', gearTouchEnd);
  320 + time_mm.addEventListener('mouseup', gearTouchEnd);
  321 + _self.gearDate.querySelector(".date_roll_mask").addEventListener('mouseleave', gearTouchOut);
  322 + _self.gearDate.querySelector(".date_roll_mask").addEventListener('mouseup', gearTouchOut);
  323 + }
  324 + //初始化年月日时分插件默认值
  325 + function dateTimeCtrlInit() {
  326 + var date = new Date();
  327 + var dateArr = {
  328 + yy: date.getYear(),
  329 + mm: date.getMonth(),
  330 + dd: date.getDate() - 1,
  331 + hh: date.getHours(),
  332 + mi: date.getMinutes()
  333 + };
  334 + if (/^\d{4}-\d{1,2}-\d{1,2}\s\d{2}:\d{2}$/.test(_self.trigger.value)) {
  335 + rs = _self.trigger.value.match(/(^|-|\s|:)\d{1,4}/g);
  336 + dateArr.yy = rs[0] - _self.minY;
  337 + dateArr.mm = rs[1].replace(/-/g, "") - 1;
  338 + dateArr.dd = rs[2].replace(/-/g, "") - 1;
  339 + dateArr.hh = parseInt(rs[3].replace(/\s0?/g, ""));
  340 + dateArr.mi = parseInt(rs[4].replace(/:0?/g, ""));
  341 + } else {
  342 + dateArr.yy = dateArr.yy + 1900 - _self.minY;
  343 + }
  344 + _self.gearDate.querySelector(".date_yy").setAttribute("val", dateArr.yy);
  345 + _self.gearDate.querySelector(".date_mm").setAttribute("val", dateArr.mm);
  346 + _self.gearDate.querySelector(".date_dd").setAttribute("val", dateArr.dd);
  347 + setDateGearTooth();
  348 + _self.gearDate.querySelector(".time_hh").setAttribute("val", dateArr.hh);
  349 + _self.gearDate.querySelector(".time_mm").setAttribute("val", dateArr.mi);
  350 + setTimeGearTooth();
  351 + }
  352 + //呼出时间插件
  353 + function popupTime(e) {
  354 + _self.gearDate = document.createElement("div");
  355 + _self.gearDate.className = "gearDate";
  356 + _self.gearDate.innerHTML = '<div class="date_ctrl slideInUp">' +
  357 + '<div class="date_btn_box">' +
  358 + '<div class="date_btn lcalendar_cancel">取消</div>' +
  359 + '<div class="date_btn lcalendar_finish">确定</div>' +
  360 + '</div>' +
  361 + '<div class="date_roll_mask">' +
  362 + '<div class="time_roll">' +
  363 + '<div>' +
  364 + '<div class="gear time_hh" data-datetype="time_hh"></div>' +
  365 + '<div class="date_grid">' +
  366 + '<div>时</div>' +
  367 + '</div>' +
  368 + '</div>' +
  369 + '<div>' +
  370 + '<div class="gear time_mm" data-datetype="time_mm"></div>' +
  371 + '<div class="date_grid">' +
  372 + '<div>分</div>' +
  373 + '</div>' +
  374 + '</div>' +
  375 + '</div>' + //time_roll
  376 + '</div>' +
  377 + '</div><div class="date_bg" style="width:100%;height:100%;"></div>';
  378 + document.body.appendChild(_self.gearDate);
  379 + timeCtrlInit();
  380 + var lcalendar_cancel = _self.gearDate.querySelector(".lcalendar_cancel");
  381 + lcalendar_cancel.addEventListener('touchstart', closeMobileCalendar);
  382 + var lcalendar_finish = _self.gearDate.querySelector(".lcalendar_finish");
  383 + lcalendar_finish.addEventListener('touchstart', finishMobileTime);
  384 + var lcalendar_bg = _self.gearDate.querySelector(".date_bg");
  385 + lcalendar_bg.addEventListener('click', closeMobileCalendar);
  386 + var time_hh = _self.gearDate.querySelector(".time_hh");
  387 + var time_mm = _self.gearDate.querySelector(".time_mm");
  388 + time_hh.addEventListener('touchstart', gearTouchStart);
  389 + time_mm.addEventListener('touchstart', gearTouchStart);
  390 + time_hh.addEventListener('touchmove', gearTouchMove);
  391 + time_mm.addEventListener('touchmove', gearTouchMove);
  392 + time_hh.addEventListener('touchend', gearTouchEnd);
  393 + time_mm.addEventListener('touchend', gearTouchEnd);
  394 + //-------------------------------------------------------------
  395 + lcalendar_cancel.addEventListener('click', closeMobileCalendar);
  396 + lcalendar_finish.addEventListener('click', finishMobileTime);
  397 + time_hh.addEventListener('mousedown', gearTouchStart);
  398 + time_mm.addEventListener('mousedown', gearTouchStart);
  399 + time_hh.addEventListener('mousemove', gearTouchMove);
  400 + time_mm.addEventListener('mousemove', gearTouchMove);
  401 + time_hh.addEventListener('mouseup', gearTouchEnd);
  402 + time_mm.addEventListener('mouseup', gearTouchEnd);
  403 + _self.gearDate.querySelector(".date_roll_mask").addEventListener('mouseleave', gearTouchOut);
  404 + _self.gearDate.querySelector(".date_roll_mask").addEventListener('mouseup', gearTouchOut);
  405 + }
  406 + //初始化时分插件默认值
  407 + function timeCtrlInit() {
  408 + var d = new Date();
  409 + var e = {
  410 + hh: d.getHours(),
  411 + mm: d.getMinutes()
  412 + };
  413 + if (/^\d{2}:\d{2}$/.test(_self.trigger.value)) {
  414 + rs = _self.trigger.value.match(/(^|:)\d{2}/g);
  415 + e.hh = parseInt(rs[0].replace(/^0?/g, ""));
  416 + e.mm = parseInt(rs[1].replace(/:0?/g, ""))
  417 + }
  418 + _self.gearDate.querySelector(".time_hh").setAttribute("val", e.hh);
  419 + _self.gearDate.querySelector(".time_mm").setAttribute("val", e.mm);
  420 + setTimeGearTooth();
  421 + }
  422 + //重置日期节点个数
  423 + function setDateGearTooth() {
  424 + var passY = _self.maxY - _self.minY + 1;
  425 + var date_yy = _self.gearDate.querySelector(".date_yy");
  426 + var itemStr = "";
  427 + if (date_yy && date_yy.getAttribute("val")) {
  428 + //得到年份的值
  429 + var yyVal = parseInt(date_yy.getAttribute("val"));
  430 + //p 当前节点前后需要展示的节点个数
  431 + for (var p = 0; p <= passY - 1; p++) {
  432 + itemStr += "<div class='tooth'>" + (_self.minY + p) + "</div>";
  433 + }
  434 + date_yy.innerHTML = itemStr;
  435 + var top = Math.floor(parseFloat(date_yy.getAttribute('top')));
  436 + if (!isNaN(top)) {
  437 + top % 2 == 0 ? (top = top) : (top = top + 1);
  438 + top > 8 && (top = 8);
  439 + var minTop = 8 - (passY - 1) * 2;
  440 + top < minTop && (top = minTop);
  441 + date_yy.style["-webkit-transform"] = 'translate3d(0,' + top + 'em,0)';
  442 + date_yy.setAttribute('top', top + 'em');
  443 + yyVal = Math.abs(top - 8) / 2;
  444 + date_yy.setAttribute("val", yyVal);
  445 + } else {
  446 + date_yy.style["-webkit-transform"] = 'translate3d(0,' + (8 - yyVal * 2) + 'em,0)';
  447 + date_yy.setAttribute('top', 8 - yyVal * 2 + 'em');
  448 + }
  449 + } else {
  450 + return;
  451 + }
  452 + var date_mm = _self.gearDate.querySelector(".date_mm");
  453 + if (date_mm && date_mm.getAttribute("val")) {
  454 + itemStr = "";
  455 + //得到月份的值
  456 + var mmVal = parseInt(date_mm.getAttribute("val"));
  457 + var maxM = 11;
  458 + var minM = 0;
  459 + //当年份到达最大值
  460 + if (yyVal == passY - 1) {
  461 + maxM = _self.maxM - 1;
  462 + }
  463 + //当年份到达最小值
  464 + if (yyVal == 0) {
  465 + minM = _self.minM - 1;
  466 + }
  467 + //p 当前节点前后需要展示的节点个数
  468 + for (var p = 0; p < maxM - minM + 1; p++) {
  469 + itemStr += "<div class='tooth'>" + (minM + p + 1) + "</div>";
  470 + }
  471 + date_mm.innerHTML = itemStr;
  472 + if (mmVal > maxM) {
  473 + mmVal = maxM;
  474 + date_mm.setAttribute("val", mmVal);
  475 + } else if (mmVal < minM) {
  476 + mmVal = maxM;
  477 + date_mm.setAttribute("val", mmVal);
  478 + }
  479 + date_mm.style["-webkit-transform"] = 'translate3d(0,' + (8 - (mmVal - minM) * 2) + 'em,0)';
  480 + date_mm.setAttribute('top', 8 - (mmVal - minM) * 2 + 'em');
  481 + } else {
  482 + return;
  483 + }
  484 + var date_dd = _self.gearDate.querySelector(".date_dd");
  485 + if (date_dd && date_dd.getAttribute("val")) {
  486 + itemStr = "";
  487 + //得到日期的值
  488 + var ddVal = parseInt(date_dd.getAttribute("val"));
  489 + //返回月份的天数
  490 + var maxMonthDays = calcDays(yyVal, mmVal);
  491 + //p 当前节点前后需要展示的节点个数
  492 + var maxD = maxMonthDays - 1;
  493 + var minD = 0;
  494 + //当年份月份到达最大值
  495 + if (yyVal == passY - 1 && _self.maxM == mmVal + 1) {
  496 + maxD = _self.maxD - 1;
  497 + }
  498 + //当年、月到达最小值
  499 + if (yyVal == 0 && _self.minM == mmVal + 1) {
  500 + minD = _self.minD - 1;
  501 + }
  502 + for (var p = 0; p < maxD - minD + 1; p++) {
  503 + itemStr += "<div class='tooth'>" + (minD + p + 1) + "</div>";
  504 + }
  505 + date_dd.innerHTML = itemStr;
  506 + if (ddVal > maxD) {
  507 + ddVal = maxD;
  508 + date_dd.setAttribute("val", ddVal);
  509 + } else if (ddVal < minD) {
  510 + ddVal = minD;
  511 + date_dd.setAttribute("val", ddVal);
  512 + }
  513 + date_dd.style["-webkit-transform"] = 'translate3d(0,' + (8 - (ddVal - minD) * 2) + 'em,0)';
  514 + date_dd.setAttribute('top', 8 - (ddVal - minD) * 2 + 'em');
  515 + } else {
  516 + return;
  517 + }
  518 + }
  519 + //重置时间节点个数
  520 + function setTimeGearTooth() {
  521 + var time_hh = _self.gearDate.querySelector(".time_hh");
  522 + if (time_hh && time_hh.getAttribute("val")) {
  523 + var i = "";
  524 + var hhVal = parseInt(time_hh.getAttribute("val"));
  525 + for (var g = 0; g <= 23; g++) {
  526 + i += "<div class='tooth'>" + g + "</div>";
  527 + }
  528 + time_hh.innerHTML = i;
  529 + time_hh.style["-webkit-transform"] = 'translate3d(0,' + (8 - hhVal * 2) + 'em,0)';
  530 + time_hh.setAttribute('top', 8 - hhVal * 2 + 'em');
  531 + } else {
  532 + return
  533 + }
  534 + var time_mm = _self.gearDate.querySelector(".time_mm");
  535 + if (time_mm && time_mm.getAttribute("val")) {
  536 + var i = "";
  537 + var mmVal = parseInt(time_mm.getAttribute("val"));
  538 + for (var g = 0; g <= 59; g++) {
  539 + i += "<div class='tooth'>" + g + "</div>";
  540 + }
  541 + time_mm.innerHTML = i;
  542 + time_mm.style["-webkit-transform"] = 'translate3d(0,' + (8 - mmVal * 2) + 'em,0)';
  543 + time_mm.setAttribute('top', 8 - mmVal * 2 + 'em');
  544 + } else {
  545 + return
  546 + }
  547 + }
  548 + //求月份最大天数
  549 + function calcDays(year, month) {
  550 + if (month == 1) {
  551 + year += _self.minY;
  552 + if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0 && year % 4000 != 0)) {
  553 + return 29;
  554 + } else {
  555 + return 28;
  556 + }
  557 + } else {
  558 + if (month == 3 || month == 5 || month == 8 || month == 10) {
  559 + return 30;
  560 + } else {
  561 + return 31;
  562 + }
  563 + }
  564 + }
  565 + //触摸开始
  566 + function gearTouchStart(e) {
  567 + if (isMoved || isTouched) return;
  568 + isTouched = true;
  569 + e.preventDefault();
  570 + var target = e.target;
  571 + while (true) {
  572 + if (!target.classList.contains("gear")) {
  573 + target = target.parentElement;
  574 + } else {
  575 + break
  576 + }
  577 + }
  578 + clearInterval(target["int_" + target.id]);
  579 + target["old_" + target.id] = e.targetTouches ? e.targetTouches[0].screenY : e.pageY;
  580 + target["o_t_" + target.id] = (new Date()).getTime();
  581 + var top = target.getAttribute('top');
  582 + if (top) {
  583 + target["o_d_" + target.id] = parseFloat(top.replace(/em/g, ""));
  584 + } else {
  585 + target["o_d_" + target.id] = 0;
  586 + };
  587 + pree=e;
  588 + }
  589 + //手指移动
  590 + function gearTouchMove(e) {
  591 + if (!isTouched) return;
  592 + isMoved = true;
  593 + e.preventDefault();
  594 + if(pree) var target = pree.target; else
  595 + var target = e.target;
  596 + while (true) {
  597 + if (!target.classList.contains("gear")) {
  598 + target = target.parentElement;
  599 + } else {
  600 + break
  601 + }
  602 + }
  603 + target["new_" + target.id] = e.targetTouches ? e.targetTouches[0].screenY : e.pageY;
  604 + target["n_t_" + target.id] = (new Date()).getTime();
  605 + //var f = (target["new_" + target.id] - target["old_" + target.id]) * 18 / target.clientHeight;
  606 + var f = (target["new_" + target.id] - target["old_" + target.id]) * 18 / 370;
  607 + target["pos_" + target.id] = target["o_d_" + target.id] + f;
  608 + target.style["-webkit-transform"] = 'translate3d(0,' + target["pos_" + target.id] + 'em,0)';
  609 + target.setAttribute('top', target["pos_" + target.id] + 'em');
  610 + }
  611 + //离开屏幕
  612 + function gearTouchEnd(e) {
  613 + if (!isTouched || !isMoved) {
  614 + isTouched = isMoved = false;
  615 + return;
  616 + }
  617 + isTouched = isMoved = false;
  618 + e.preventDefault();
  619 + if(pree) var target = pree.target; else
  620 + var target = e.target;
  621 + while (true) {
  622 + if (!target.classList.contains("gear")) {
  623 + target = target.parentElement;
  624 + } else {
  625 + break;
  626 + }
  627 + }
  628 + var flag = (target["new_" + target.id] - target["old_" + target.id]) / (target["n_t_" + target.id] - target["o_t_" + target.id]);
  629 + if (Math.abs(flag) <= 0.2) {
  630 + target["spd_" + target.id] = (flag < 0 ? -0.08 : 0.08);
  631 + } else {
  632 + if (Math.abs(flag) <= 0.5) {
  633 + target["spd_" + target.id] = (flag < 0 ? -0.16 : 0.16);
  634 + } else {
  635 + target["spd_" + target.id] = flag / 2;
  636 + }
  637 + }
  638 + if (!target["pos_" + target.id]) {
  639 + target["pos_" + target.id] = 0;
  640 + }
  641 + rollGear(target);
  642 + pree=null;
  643 + };
  644 + //离开区域
  645 + function gearTouchOut(e) {
  646 + gearTouchEnd(pree);
  647 + };
  648 + //缓动效果
  649 + function rollGear(target) {
  650 + var d = 0;
  651 + var stopGear = false;
  652 + var passY = _self.maxY - _self.minY + 1;
  653 + clearInterval(target["int_" + target.id]);
  654 + target["int_" + target.id] = setInterval(function() {
  655 + var pos = target["pos_" + target.id];
  656 + var speed = target["spd_" + target.id] * Math.exp(-0.1 * d);
  657 + pos += speed;
  658 + if (Math.abs(speed) > 0.1) {} else {
  659 + speed = 0.1;
  660 + var b = Math.round(pos / 2) * 2;
  661 + if (Math.abs(pos - b) < 0.05) {
  662 + stopGear = true;
  663 + } else {
  664 + if (pos > b) {
  665 + pos -= speed
  666 + } else {
  667 + pos += speed
  668 + }
  669 + }
  670 + }
  671 + if (pos > 8) {
  672 + pos = 8;
  673 + stopGear = true;
  674 + }
  675 + switch (target.dataset.datetype) {
  676 + case "date_yy":
  677 + var minTop = 8 - (passY - 1) * 2;
  678 + if (pos < minTop) {
  679 + pos = minTop;
  680 + stopGear = true;
  681 + }
  682 + if (stopGear) {
  683 + var gearVal = Math.abs(pos - 8) / 2;
  684 + setGear(target, gearVal);
  685 + clearInterval(target["int_" + target.id]);
  686 + }
  687 + break;
  688 + case "date_mm":
  689 + var date_yy = _self.gearDate.querySelector(".date_yy");
  690 + //得到年份的值
  691 + var yyVal = parseInt(date_yy.getAttribute("val"));
  692 + var maxM = 11;
  693 + var minM = 0;
  694 + //当年份到达最大值
  695 + if (yyVal == passY - 1) {
  696 + maxM = _self.maxM - 1;
  697 + }
  698 + //当年份到达最小值
  699 + if (yyVal == 0) {
  700 + minM = _self.minM - 1;
  701 + }
  702 + var minTop = 8 - (maxM - minM) * 2;
  703 + if (pos < minTop) {
  704 + pos = minTop;
  705 + stopGear = true;
  706 + }
  707 + if (stopGear) {
  708 + var gearVal = Math.abs(pos - 8) / 2 + minM;
  709 + setGear(target, gearVal);
  710 + clearInterval(target["int_" + target.id]);
  711 + }
  712 + break;
  713 + case "date_dd":
  714 + var date_yy = _self.gearDate.querySelector(".date_yy");
  715 + var date_mm = _self.gearDate.querySelector(".date_mm");
  716 + //得到年份的值
  717 + var yyVal = parseInt(date_yy.getAttribute("val"));
  718 + //得到月份的值
  719 + var mmVal = parseInt(date_mm.getAttribute("val"));
  720 + //返回月份的天数
  721 + var maxMonthDays = calcDays(yyVal, mmVal);
  722 + var maxD = maxMonthDays - 1;
  723 + var minD = 0;
  724 + //当年份月份到达最大值
  725 + if (yyVal == passY - 1 && _self.maxM == mmVal + 1) {
  726 + maxD = _self.maxD - 1;
  727 + }
  728 + //当年、月到达最小值
  729 + if (yyVal == 0 && _self.minM == mmVal + 1) {
  730 + minD = _self.minD - 1;
  731 + }
  732 + var minTop = 8 - (maxD - minD) * 2;
  733 + if (pos < minTop) {
  734 + pos = minTop;
  735 + stopGear = true;
  736 + }
  737 + if (stopGear) {
  738 + var gearVal = Math.abs(pos - 8) / 2 + minD;
  739 + setGear(target, gearVal);
  740 + clearInterval(target["int_" + target.id]);
  741 + }
  742 + break;
  743 + case "time_hh":
  744 + if (pos < -38) {
  745 + pos = -38;
  746 + stopGear = true;
  747 + }
  748 + if (stopGear) {
  749 + var gearVal = Math.abs(pos - 8) / 2;
  750 + setGear(target, gearVal);
  751 + clearInterval(target["int_" + target.id]);
  752 + }
  753 + break;
  754 + case "time_mm":
  755 + if (pos < -110) {
  756 + pos = -110;
  757 + stopGear = true;
  758 + }
  759 + if (stopGear) {
  760 + var gearVal = Math.abs(pos - 8) / 2;
  761 + setGear(target, gearVal);
  762 + clearInterval(target["int_" + target.id]);
  763 + }
  764 + break;
  765 + default:
  766 + }
  767 + target["pos_" + target.id] = pos;
  768 + target.style["-webkit-transform"] = 'translate3d(0,' + pos + 'em,0)';
  769 + target.setAttribute('top', pos + 'em');
  770 + d++;
  771 + }, 30);
  772 + }
  773 + //控制插件滚动后停留的值
  774 + function setGear(target, val) {
  775 + val = Math.round(val);
  776 + target.setAttribute("val", val);
  777 + if (/date/.test(target.dataset.datetype)) {
  778 + setDateGearTooth();
  779 + } else {
  780 + setTimeGearTooth();
  781 + }
  782 + }
  783 + //取消
  784 + function closeMobileCalendar(e) {
  785 + e.preventDefault();
  786 + isTouched = isMoved = false;
  787 + if(_self.onClose) _self.onClose();
  788 + var evt = new CustomEvent('input');
  789 + _self.trigger.dispatchEvent(evt);
  790 + document.body.removeChild(_self.gearDate);
  791 + }
  792 + //日期确认
  793 + function finishMobileDate(e) {
  794 + var passY = _self.maxY - _self.minY + 1;
  795 + var date_yy = parseInt(Math.round(_self.gearDate.querySelector(".date_yy").getAttribute("val")));
  796 + var date_mm = parseInt(Math.round(_self.gearDate.querySelector(".date_mm").getAttribute("val"))) + 1;
  797 + date_mm = date_mm > 9 ? date_mm : '0' + date_mm;
  798 + var date_dd = parseInt(Math.round(_self.gearDate.querySelector(".date_dd").getAttribute("val"))) + 1;
  799 + date_dd = date_dd > 9 ? date_dd : '0' + date_dd;
  800 + _self.trigger.value = (date_yy % passY + _self.minY) + "-" + date_mm + "-" + date_dd;
  801 + _self.value = _self.trigger.value;
  802 + if(_self.onSubmit) _self.onSubmit();
  803 + closeMobileCalendar(e);
  804 + }
  805 + //年月确认
  806 + function finishMobileYM(e) {
  807 + var passY = _self.maxY - _self.minY + 1;
  808 + var date_yy = parseInt(Math.round(_self.gearDate.querySelector(".date_yy").getAttribute("val")));
  809 + var date_mm = parseInt(Math.round(_self.gearDate.querySelector(".date_mm").getAttribute("val"))) + 1;
  810 + date_mm = date_mm > 9 ? date_mm : '0' + date_mm;
  811 + _self.trigger.value = (date_yy % passY + _self.minY) + "-" + date_mm;
  812 + _self.value = _self.trigger.value;
  813 + if(_self.onSubmit) _self.onSubmit();
  814 + closeMobileCalendar(e);
  815 + }
  816 + //日期时间确认
  817 + function finishMobileDateTime(e) {
  818 + var passY = _self.maxY - _self.minY + 1;
  819 + var date_yy = parseInt(Math.round(_self.gearDate.querySelector(".date_yy").getAttribute("val")));
  820 + var date_mm = parseInt(Math.round(_self.gearDate.querySelector(".date_mm").getAttribute("val"))) + 1;
  821 + date_mm = date_mm > 9 ? date_mm : '0' + date_mm;
  822 + var date_dd = parseInt(Math.round(_self.gearDate.querySelector(".date_dd").getAttribute("val"))) + 1;
  823 + date_dd = date_dd > 9 ? date_dd : '0' + date_dd;
  824 + var time_hh = parseInt(Math.round(_self.gearDate.querySelector(".time_hh").getAttribute("val")));
  825 + time_hh = time_hh > 9 ? time_hh : '0' + time_hh;
  826 + var time_mm = parseInt(Math.round(_self.gearDate.querySelector(".time_mm").getAttribute("val")));
  827 + time_mm = time_mm > 9 ? time_mm : '0' + time_mm;
  828 + _self.trigger.value = (date_yy % passY + _self.minY) + "-" + date_mm + "-" + date_dd + " " + (time_hh.length < 2 ? "0" : "") + time_hh + (time_mm.length < 2 ? ":0" : ":") + time_mm;
  829 + _self.value = _self.trigger.value;
  830 + if(_self.onSubmit) _self.onSubmit();
  831 + closeMobileCalendar(e);
  832 + }
  833 + //时间确认
  834 + function finishMobileTime(e) {
  835 + var time_hh = parseInt(Math.round(_self.gearDate.querySelector(".time_hh").getAttribute("val")));
  836 + time_hh = time_hh > 9 ? time_hh : '0' + time_hh;
  837 + var time_mm = parseInt(Math.round(_self.gearDate.querySelector(".time_mm").getAttribute("val")));
  838 + time_mm = time_mm > 9 ? time_mm : '0' + time_mm;
  839 + _self.trigger.value = (time_hh.length < 2 ? "0" : "") + time_hh + (time_mm.length < 2 ? ":0" : ":") + time_mm;
  840 + _self.value = _self.trigger.value;
  841 + if(_self.onSubmit) _self.onSubmit();
  842 + closeMobileCalendar(e);
  843 + }
  844 + _self.trigger.addEventListener('click', {
  845 + "ym": popupYM,
  846 + "date": popupDate,
  847 + "datetime": popupDateTime,
  848 + "time": popupTime
  849 + }[type]);
  850 + }
  851 + }
  852 + return MobileCalendar;
  853 +})();
1 var baseurl = 'http://kindapp.w.bronet.cn/api/';//测试地址 1 var baseurl = 'http://kindapp.w.bronet.cn/api/';//测试地址
2 -var imgurl='http://kindapp.w.bronet.cn/' 2 +var imgurl = 'http://kindapp.w.bronet.cn/'
3 // var baseurl = 'http://192.168.1.3/api/';//本地测试 3 // var baseurl = 'http://192.168.1.3/api/';//本地测试
4 var mobileReg = /^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\d{8}$/; //手机正则 4 var mobileReg = /^1(3[0-9]|4[57]|5[0-35-9]|7[0135678]|8[0-9])\d{8}$/; //手机正则
5 var id_card = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;//身份证正则 5 var id_card = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;//身份证正则
@@ -221,7 +221,6 @@ refreshDone = function (mess) { @@ -221,7 +221,6 @@ refreshDone = function (mess) {
221 }; 221 };
222 222
223 223
224 -  
225 function add0(num) { 224 function add0(num) {
226 if (num) { 225 if (num) {
227 num = parseInt(num); 226 num = parseInt(num);
@@ -236,6 +235,20 @@ function add0(num) { @@ -236,6 +235,20 @@ function add0(num) {
236 } 235 }
237 } 236 }
238 237
  238 +function formatTen(num) {
  239 + return num > 9 ? (num + "") : ("0" + num);
  240 +}
  241 +
  242 +function formatDate(date) {
  243 + var year = date.getFullYear();
  244 + var month = date.getMonth() + 1;
  245 + var day = date.getDate();
  246 + var hour = date.getHours();
  247 + var minute = date.getMinutes();
  248 + var second = date.getSeconds();
  249 + return year + "-" + formatTen(month) + "-" + formatTen(day)
  250 +}
  251 +
239 function timestampToTime(timestamp) { 252 function timestampToTime(timestamp) {
240 var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 253 var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
241 var Y = date.getFullYear() + '-'; 254 var Y = date.getFullYear() + '-';
@@ -38,8 +38,8 @@ @@ -38,8 +38,8 @@
38 customerServiceId = api.pageParam.userId; 38 customerServiceId = api.pageParam.userId;
39 RCS.init({ 39 RCS.init({
40 appKey: "c9kqb3rdkh4jj", 40 appKey: "c9kqb3rdkh4jj",
41 - token: "qjxXwJizd7Y62DTmUEluw5lzpNwuJBCkPrRErVG12EKi1UP6giNGqszv6IQX0IndGKwjoGwevVmUVSN0x458KOqK0LwxTuhy",  
42 - // token:rongYunToken , 41 + // token: "qjxXwJizd7Y62DTmUEluw5lzpNwuJBCkPrRErVG12EKi1UP6giNGqszv6IQX0IndGKwjoGwevVmUVSN0x458KOqK0LwxTuhy",
  42 + token:rongYunToken ,
43 target: document.getElementById('rcs-app'), 43 target: document.getElementById('rcs-app'),
44 customerServiceId: "KEFU150535341165880", // 客服Id 44 customerServiceId: "KEFU150535341165880", // 客服Id
45 userIcon: 'http://7xo1cb.com1.z0.glb.clouddn.com/rongcloudkefu2.png',//用户默认头像,在用户没有头像的时候显示 45 userIcon: 'http://7xo1cb.com1.z0.glb.clouddn.com/rongcloudkefu2.png',//用户默认头像,在用户没有头像的时候显示
@@ -48,8 +48,8 @@ @@ -48,8 +48,8 @@
48 h: 'auto' 48 h: 'auto'
49 }, 49 },
50 pageParam: { 50 pageParam: {
51 - // rongYunToken: app.rongYunToken,  
52 - rongYunToken: '122344545', 51 + rongYunToken: app.rongYunToken,
  52 + // rongYunToken: '122344545',
53 userId: app.userId 53 userId: app.userId
54 } 54 }
55 }); 55 });
  1 +<!doctype html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <meta name="viewport"
  6 + content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7 + <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8 + <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  9 + <title></title>
  10 + <script src="../../assets/js/fontsize.js"></script>
  11 + <!--<link rel="stylesheet" href="../../assets/css/weui.min.css">-->
  12 + <link rel="stylesheet" href="../../assets/css/api.css"/>
  13 + <link rel="stylesheet" href="../../assets/css/style.css">
  14 + <link rel="stylesheet" href="../../assets/icon/iconfont.css">
  15 + <style>
  16 +
  17 + html {
  18 + font-family: sans-serif;
  19 + }
  20 +
  21 + html, body, header, section, footer, div, ul, ol, li, img, a, span, em, del, legend, center, strong, var, fieldset, form, label, dl, dt, dd, cite, input, hr, time, mark, code, figcaption, figure, textarea, h1, h2, h3, h4, h5, h6, p {
  22 + margin: 0;
  23 + border: 0;
  24 + padding: 0;
  25 + font-style: normal;
  26 + /*touch-action: none;*/
  27 + touch-action: manipulation
  28 + }
  29 +
  30 + html, body {
  31 + -webkit-touch-callout: none;
  32 + -webkit-text-size-adjust: none;
  33 + -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  34 + -webkit-user-select: none;
  35 + background: none;
  36 + height: 100%;
  37 + }
  38 +
  39 + .v-modal {
  40 + background: none;
  41 + }
  42 +
  43 + .meal {
  44 + display: flex;
  45 + flex-direction: column;
  46 + justify-content: flex-end;
  47 + position: fixed;
  48 + top: 0;
  49 + left: 0;
  50 + width: 100%;
  51 + height: 100%;
  52 + z-index: 100;
  53 + background: none;
  54 + }
  55 +
  56 + .mint-datetime-action {
  57 + color: #fff;
  58 + background-color: #dbb25f;
  59 + }
  60 +
  61 + .mint-datetime-cancel {
  62 + background-color: #fff;
  63 + color: #424242;
  64 + }
  65 +
  66 + .picker-slot {
  67 + font-size: 12px;
  68 + }
  69 + </style>
  70 +</head>
  71 +<body>
  72 +<div id="app" v-cloak>
  73 + <div @click="close" class="meal">
  74 + <mt-datetime-picker
  75 + ref="picker"
  76 + :endDate="endDate"
  77 + :startDate="startDate"
  78 + type="date"
  79 + v-model="pickerValue"
  80 + year-format="{value}年"
  81 + month-format="{value}月"
  82 + date-format="{value}日"
  83 + @confirm="choose_bro"
  84 + >
  85 + </mt-datetime-picker>
  86 + </div>
  87 +</div>
  88 +</body>
  89 +</html>
  90 +<script type="text/javascript" src="../../assets/js/api.js"></script>
  91 +<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
  92 +<script type="text/javascript" src="../../assets/js/public.js"></script>
  93 +<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
  94 +<script>
  95 + new FastClick(document.body);
  96 +</script>
  97 +<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
  98 +<script>
  99 + var app = new Vue({
  100 + el: '#app',
  101 + data: {
  102 + pickerValue: '',
  103 + endDate: new Date(),
  104 + startDate: new Date()
  105 + },
  106 + created: function () {
  107 + apiready = function () {
  108 + app.$refs.picker.open();
  109 + }
  110 + },
  111 + methods: {
  112 + close: function () {
  113 + api.closeWin();
  114 + },
  115 + choose_bro: function () {
  116 + console.log(app.pickerValue)
  117 + },
  118 + }
  119 + })
  120 +</script>
  1 +<!doctype html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <meta name="viewport"
  6 + content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7 + <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8 + <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  9 + <title></title>
  10 + <script src="../../assets/js/fontsize.js"></script>
  11 + <!--<link rel="stylesheet" href="../../assets/css/api.css"/>-->
  12 + <link rel="stylesheet" href="../../assets/icon/iconfont.css">
  13 + <style>
  14 + header {
  15 + width: 100%;
  16 + height: auto;
  17 + font-size: 15px;
  18 + }
  19 +
  20 + .index_header {
  21 + line-height: 0.44rem;
  22 + color: #424242;
  23 + display: flex;
  24 + align-items: center;
  25 + justify-content: space-between;
  26 + padding: 0.24rem 0.42rem;
  27 + }
  28 +
  29 + .close_left {
  30 + position: relative;
  31 + }
  32 +
  33 + .close_left::before {
  34 + position: absolute;
  35 + left: -0.1rem;
  36 + right: -0.1rem;
  37 + top: -0.1rem;
  38 + bottom: -0.1rem;
  39 + content: '';
  40 + }
  41 + </style>
  42 +</head>
  43 +<body>
  44 +<div id="app">
  45 +
  46 +</div>
  47 +</body>
  48 +</html>
  49 +<script type="text/javascript" src="../../assets/js/api.js"></script>
  50 +<script type="text/javascript" src="../../assets/js/public.js"></script>
  51 +<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
  52 +<script>
  53 + new FastClick(document.body);
  54 +</script>
  55 +<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
  56 +<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
  57 +<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
  58 +<script>
  59 + var app = new Vue({
  60 + el: '#app',
  61 + data: {
  62 +
  63 + },
  64 + created: function () {
  65 + apiready = function () {
  66 + app.attribute = api.pageParam.attribute;
  67 + app.id = api.pageParam.id;
  68 + app.unit = api.pageParam.unit;
  69 + api.openFrame({
  70 + bgColor: 'rgba(0,0,0,0.02)',
  71 + name: 'getBro_f',
  72 + url: './getBro_f.html',
  73 + bounces: false,
  74 + animation: {
  75 + type: "push",
  76 + subType: "from_bottom",
  77 + duration: 300
  78 + },
  79 + rect: {
  80 + x: 0,
  81 + y: 0,
  82 + w: 'auto',
  83 + h: 'auto'
  84 + },
  85 + pageParam: {
  86 +
  87 + }
  88 + });
  89 + }
  90 + },
  91 + methods: {}
  92 + })
  93 +</script>
  1 +<!doctype html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <meta name="viewport"
  6 + content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7 + <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8 + <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  9 + <title></title>
  10 + <script src="../../assets/js/fontsize.js"></script>
  11 + <!--<link rel="stylesheet" href="../../assets/css/weui.min.css">-->
  12 + <link rel="stylesheet" href="../../assets/icon/iconfont.css">
  13 + <style>
  14 +
  15 + html {
  16 + font-family: sans-serif;
  17 + }
  18 +
  19 + html, body, header, section, footer, div, ul, ol, li, img, a, span, em, del, legend, center, strong, var, fieldset, form, label, dl, dt, dd, cite, input, hr, time, mark, code, figcaption, figure, textarea, h1, h2, h3, h4, h5, h6, p {
  20 + margin: 0;
  21 + border: 0;
  22 + padding: 0;
  23 + font-style: normal;
  24 + /*touch-action: none;*/
  25 + touch-action: manipulation
  26 + }
  27 +
  28 + html, body {
  29 + -webkit-touch-callout: none;
  30 + -webkit-text-size-adjust: none;
  31 + -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  32 + -webkit-user-select: none;
  33 + background: none;
  34 + height: 100%;
  35 + }
  36 +
  37 + .meal {
  38 + display: flex;
  39 + flex-direction: column;
  40 + justify-content: flex-end;
  41 + position: fixed;
  42 + top: 0;
  43 + left: 0;
  44 + width: 100%;
  45 + height: 100%;
  46 + z-index: 100;
  47 + background: none;
  48 + }
  49 +
  50 + </style>
  51 +</head>
  52 +<body>
  53 +<div id="app" v-cloak>
  54 + <div class="meal" @click="close">
  55 + <div id="sever" >1</div>
  56 + </div>
  57 +</div>
  58 +</body>
  59 +</html>
  60 +<script type="text/javascript" src="../../assets/js/api.js"></script>
  61 +<script type="text/javascript" src="../../assets/js/public.js"></script>
  62 +<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
  63 +<script>
  64 + new FastClick(document.body);
  65 +</script>
  66 +<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
  67 +<script type="text/javascript" src="../../assets/js/datePicker.js"></script>
  68 +<script>
  69 + document.getElementById("sever").click();
  70 + var app = new Vue({
  71 + el: '#app',
  72 + data: {
  73 + pickerValue_sev: '',
  74 + endDate_sev: new Date(),
  75 + startDate_sev: new Date('2019-01-22')
  76 + },
  77 + created: function () {
  78 + apiready = function () {
  79 + api.addEventListener({
  80 + name: 'choose_sev'
  81 + }, function(ret, err) {
  82 + if(ret){
  83 + app.choose_sev()
  84 + }
  85 + });
  86 + }
  87 + },
  88 + methods: {
  89 + close: function () {
  90 + // api.closeWin({
  91 + // name: 'choose_meal_w'
  92 + // });
  93 + api.closeWin();
  94 + },
  95 + choose_sev: function () {
  96 + var calendar = new datePicker();
  97 + calendar.init({
  98 + 'trigger': '#sever', /*按钮选择器,用于触发弹出插件*/
  99 + 'type': 'datetime', /*模式:date日期;datetime日期时间;time时间;ym年月;*/
  100 + 'minDate': '1900-1-1', /*最小日期*/
  101 + 'maxDate': formatDate(new Date()), /*最大日期*/
  102 + 'onSubmit': function () {/*确认时触发事件*/
  103 + console.log(calendar.value);
  104 + },
  105 + 'onClose': function () {/*取消时触发事件*/
  106 + }
  107 + });
  108 + },
  109 + }
  110 + })
  111 +</script>
  1 +<!doctype html>
  2 +<html lang="en">
  3 +<head>
  4 + <meta charset="UTF-8">
  5 + <meta name="viewport"
  6 + content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  7 + <meta http-equiv="X-UA-Compatible" content="ie=edge">
  8 + <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  9 + <title></title>
  10 + <script src="../../assets/js/fontsize.js"></script>
  11 + <!--<link rel="stylesheet" href="../../assets/css/api.css"/>-->
  12 + <link rel="stylesheet" href="../../assets/icon/iconfont.css">
  13 + <style>
  14 + header {
  15 + width: 100%;
  16 + height: auto;
  17 + font-size: 15px;
  18 + }
  19 +
  20 + .index_header {
  21 + line-height: 0.44rem;
  22 + color: #424242;
  23 + display: flex;
  24 + align-items: center;
  25 + justify-content: space-between;
  26 + padding: 0.24rem 0.42rem;
  27 + }
  28 +
  29 + .close_left {
  30 + position: relative;
  31 + }
  32 +
  33 + .close_left::before {
  34 + position: absolute;
  35 + left: -0.1rem;
  36 + right: -0.1rem;
  37 + top: -0.1rem;
  38 + bottom: -0.1rem;
  39 + content: '';
  40 + }
  41 + </style>
  42 +</head>
  43 +<body>
  44 +<div id="app">
  45 +
  46 +</div>
  47 +</body>
  48 +</html>
  49 +<script type="text/javascript" src="../../assets/js/api.js"></script>
  50 +<script type="text/javascript" src="../../assets/js/public.js"></script>
  51 +<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
  52 +<script>
  53 + new FastClick(document.body);
  54 +</script>
  55 +<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
  56 +<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
  57 +<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
  58 +<script>
  59 + var app = new Vue({
  60 + el: '#app',
  61 + data: {
  62 +
  63 + },
  64 + created: function () {
  65 + apiready = function () {
  66 + app.attribute = api.pageParam.attribute;
  67 + app.id = api.pageParam.id;
  68 + app.unit = api.pageParam.unit;
  69 + api.openFrame({
  70 + bgColor: 'rgba(0,0,0,0.02)',
  71 + name: 'getSev_f',
  72 + url: './getSev_f.html',
  73 + bounces: false,
  74 + animation: {
  75 + type: "push",
  76 + subType: "from_bottom",
  77 + duration: 300
  78 + },
  79 + rect: {
  80 + x: 0,
  81 + y: 0,
  82 + w: 'auto',
  83 + h: 'auto'
  84 + },
  85 + pageParam: {
  86 +
  87 + }
  88 + });
  89 + }
  90 + },
  91 + methods: {}
  92 + })
  93 +</script>
@@ -82,11 +82,10 @@ @@ -82,11 +82,10 @@
82 .pinganbox .icon-wenhao { 82 .pinganbox .icon-wenhao {
83 color: #59b6fd; 83 color: #59b6fd;
84 } 84 }
85 - .doc_footer{ 85 +
  86 + .doc_footer {
86 z-index: 0; 87 z-index: 0;
87 } 88 }
88 -  
89 -  
90 </style> 89 </style>
91 <body> 90 <body>
92 <div id="loadStart"></div> 91 <div id="loadStart"></div>
@@ -116,7 +115,7 @@ @@ -116,7 +115,7 @@
116 <div class="service_icon"><span class="iconfont icon-yonghu"></span><span>服务对象</span></div> 115 <div class="service_icon"><span class="iconfont icon-yonghu"></span><span>服务对象</span></div>
117 <div class="service_input"><input type="text" placeholder="请输入姓名" v-model.trim="user_name"></div> 116 <div class="service_input"><input type="text" placeholder="请输入姓名" v-model.trim="user_name"></div>
118 </div> 117 </div>
119 - <div class="service_input_box" @click="dateSelect"> 118 + <div class="service_input_box" @click.stop="dateSelect">
120 <div class="service_icon"><span class="iconfont icon-shijian1"></span><span>服务时间</span></div> 119 <div class="service_icon"><span class="iconfont icon-shijian1"></span><span>服务时间</span></div>
121 <div class="service_input"><span v-if="date_info" class="date_info">{{date_info}}</span><span v-else>{{default_date}}</span> 120 <div class="service_input"><span v-if="date_info" class="date_info">{{date_info}}</span><span v-else>{{default_date}}</span>
122 </div> 121 </div>
@@ -142,7 +141,8 @@ @@ -142,7 +141,8 @@
142 </div> 141 </div>
143 </div> 142 </div>
144 <div class="service_input_box" @click="broSelect"> 143 <div class="service_input_box" @click="broSelect">
145 - <div class="service_icon"><span class="iconfont icon-baoyuefuwux"></span><span>出生日期</span></div> 144 + <div class="service_icon"><span
  145 + class="iconfont icon-baoyuefuwux"></span><span>出生日期</span></div>
146 <div class="service_input"><span v-if="broth_info" class="date_info">{{broth_info}}</span><span v-else>{{default_bro}}</span> 146 <div class="service_input"><span v-if="broth_info" class="date_info">{{broth_info}}</span><span v-else>{{default_bro}}</span>
147 </div> 147 </div>
148 </div> 148 </div>
@@ -269,6 +269,7 @@ @@ -269,6 +269,7 @@
269 </script> 269 </script>
270 <script type="text/javascript" src="../../assets/js/axios.min.js"></script> 270 <script type="text/javascript" src="../../assets/js/axios.min.js"></script>
271 <script type="text/javascript" src="../../assets/icon/iconfont.js"></script> 271 <script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
  272 +<script type="text/javascript" src="../../assets/js/datePicker.js"></script>
272 <script> 273 <script>
273 var app = new Vue({ 274 var app = new Vue({
274 el: '#app', 275 el: '#app',
@@ -323,7 +324,8 @@ @@ -323,7 +324,8 @@
323 drug: '', 324 drug: '',
324 ill_case: '', 325 ill_case: '',
325 unit: '', 326 unit: '',
326 - pos: 'fixed' 327 + pos: 'fixed',
  328 +
327 }, 329 },
328 created: function () { 330 created: function () {
329 apiready = function () { 331 apiready = function () {
@@ -383,98 +385,35 @@ @@ -383,98 +385,35 @@
383 app.pos = 'fixed' 385 app.pos = 'fixed'
384 } 386 }
385 }, false); 387 }, false);
  388 +
386 // app.name=api.pageParam.name; 389 // app.name=api.pageParam.name;
387 } 390 }
388 }, 391 },
389 methods: { 392 methods: {
390 // 选择服务日期 393 // 选择服务日期
391 dateSelect: function () { 394 dateSelect: function () {
392 -// alert(getTimeDetil(3))  
393 - if (api.systemType == 'ios') {  
394 - api.openPicker({  
395 - type: 'date_time',  
396 - date: new Date(),  
397 - minDate: getTimeDetil(3),  
398 - maxDate: getTimeDetil(171),  
399 - title: '服务时间'  
400 - }, function (ret, err) {  
401 - if (ret) {  
402 - app.year = ret.year;  
403 - app.month = ret.month;  
404 - app.day = ret.day;  
405 - app.hour = ret.hour;  
406 - app.minute = ret.minute;  
407 - app.date_info = app.year + '-' + add0(app.month) + '-' + add0(app.day) + ' ' + add0(app.hour) + ':' + add0(app.minute);  
408 - if (checkDate(app.date_info, 1)) {  
409 - return app.date_info  
410 - } else {  
411 - toastMsg('请选择3小时之后到7天之内的服务时间');  
412 - return app.date_info = ''  
413 - }  
414 - } else {  
415 - console.log(err)  
416 - }  
417 - });  
418 - }  
419 - else {  
420 - api.openPicker({  
421 - type: 'date',  
422 - title: '服务日期',  
423 - }, function (ret, err) {  
424 - if (ret) {  
425 - app.year = ret.year;  
426 - app.month = ret.month;  
427 - app.day = ret.day;  
428 - api.openPicker({  
429 - type: 'time',  
430 - title: '服务时间'  
431 - }, function (rets, errs) {  
432 - if (rets) {  
433 - app.hour = rets.hour;  
434 - app.minute = rets.minute;  
435 - app.date_info = app.year + '-' + add0(app.month) + '-' + add0(app.day) + ' ' + add0(app.hour) + ':' + add0(app.minute);  
436 - if (checkDate(app.date_info, 1)) {  
437 - return app.date_info  
438 - } else {  
439 - toastMsg('请选择3小时之后到7天之内的服务时间');  
440 - return app.date_info = ''  
441 - }  
442 - } else {  
443 - console.log(errs)  
444 - } 395 + api.openWin({
  396 + name: 'getSev_w',
  397 + url: '../common/getSev_w.html'
445 }); 398 });
446 - } else {  
447 - console.log(err)  
448 - } 399 + api.sendEvent({
  400 + name: 'choose_sev'
449 }); 401 });
450 - }  
451 }, 402 },
452 // 选择生日 403 // 选择生日
453 broSelect: function () { 404 broSelect: function () {
454 - api.openPicker({  
455 - type: 'date',  
456 - title: '选择出生日期',  
457 - }, function (ret, err) {  
458 - if (ret) {  
459 - app.bro_year = ret.year;  
460 - app.bro_month = ret.month;  
461 - app.bro_day = ret.day;  
462 - app.broth_info = app.bro_year + '-' + add0(app.bro_month) + '-' + add0(app.bro_day);  
463 - if (checkDate(app.broth_info, 2)) {  
464 - return app.broth_info  
465 - } else {  
466 - toastMsg('出生日期不能比今天晚');  
467 - return app.broth_info = ''  
468 - }  
469 - } else {  
470 - console.log(JSON.stringify(err)); 405 + api.openWin({
  406 + name: 'getBro_w',
  407 + url: '../common/getBro_w.html'
  408 + })
471 } 409 }
472 - });  
473 - }, 410 +
  411 + ,
474 // 上传证明 412 // 上传证明
475 openProve: function () { 413 openProve: function () {
476 openView('prove', 'index/prove', '上传就医证明') 414 openView('prove', 'index/prove', '上传就医证明')
477 - }, 415 + }
  416 + ,
478 // 获取订单详情 417 // 获取订单详情
479 applyInfo: function () { 418 applyInfo: function () {
480 var post = { 419 var post = {
@@ -502,7 +441,8 @@ @@ -502,7 +441,8 @@
502 toastMsg(res.msg) 441 toastMsg(res.msg)
503 } 442 }
504 }) 443 })
505 - }, 444 + }
  445 + ,
506 // 切换亲友信息 446 // 切换亲友信息
507 tab_person: function (index, rid) { 447 tab_person: function (index, rid) {
508 if (app.ind == index) { 448 if (app.ind == index) {
@@ -536,7 +476,8 @@ @@ -536,7 +476,8 @@
536 } 476 }
537 }) 477 })
538 } 478 }
539 - }, 479 + }
  480 + ,
540 // 选择套餐 481 // 选择套餐
541 chooseMeal: function () { 482 chooseMeal: function () {
542 if (app.attribute_type == 1) { 483 if (app.attribute_type == 1) {
@@ -573,11 +514,13 @@ @@ -573,11 +514,13 @@
573 } 514 }
574 }); 515 });
575 } 516 }
576 - }, 517 + }
  518 + ,
577 // 选择服务地址 519 // 选择服务地址
578 openMap: function () { 520 openMap: function () {
579 openView('choose_address', 'common/choose_address', '选择服务地址', 'choose_address', false, {cityname: app.cityname}); 521 openView('choose_address', 'common/choose_address', '选择服务地址', 'choose_address', false, {cityname: app.cityname});
580 - }, 522 + }
  523 + ,
581 // 获取协议 524 // 获取协议
582 openIsPro: function () { 525 openIsPro: function () {
583 app.isPro = !app.isPro; 526 app.isPro = !app.isPro;
@@ -598,11 +541,13 @@ @@ -598,11 +541,13 @@
598 h: 'auto' 541 h: 'auto'
599 }, 542 },
600 }) 543 })
601 - }, 544 + }
  545 + ,
602 // 去协议 546 // 去协议
603 getAgreement: function (name, id) { 547 getAgreement: function (name, id) {
604 openView('agree_content', 'common/agree_content', name, 'agree_content', false, {id: id}) 548 openView('agree_content', 'common/agree_content', name, 'agree_content', false, {id: id})
605 - }, 549 + }
  550 + ,
606 // 去预约 551 // 去预约
607 appointment: function () { 552 appointment: function () {
608 // alert(app.date_info); 553 // alert(app.date_info);
@@ -661,8 +606,7 @@ @@ -661,8 +606,7 @@
661 "XX-Device-Type": getDevice(), 606 "XX-Device-Type": getDevice(),
662 'XX-Token': getToken() 607 'XX-Token': getToken()
663 }; 608 };
664 - getRequest('post', 'portal/Goods/applyOrder', post, header).then((res) => {  
665 - // alert(JSON.stringify(res)); 609 + getRequest('post', 'portal/Goods/applyOrder', post, header).then(function (res) {
666 if (res.data.code == 1) { 610 if (res.data.code == 1) {
667 app.order_id = res.data.data.oid; 611 app.order_id = res.data.data.oid;
668 openView('my_pay', 'my/my_pay', '支付', 'my_pay', false, {order_id: app.order_id}); 612 openView('my_pay', 'my/my_pay', '支付', 'my_pay', false, {order_id: app.order_id});
@@ -671,72 +615,19 @@ @@ -671,72 +615,19 @@
671 $api.rmStorage('img2'); 615 $api.rmStorage('img2');
672 $api.rmStorage('img3'); 616 $api.rmStorage('img3');
673 $api.rmStorage('img4'); 617 $api.rmStorage('img4');
674 - } else { 618 + }
  619 + else {
675 toastMsg(res.data.msg) 620 toastMsg(res.data.msg)
676 } 621 }
677 - }).catch(function (err) {  
678 - // alert(JSON.stringify(err))  
679 }) 622 })
680 } 623 }
681 - }, 624 + }
  625 + ,
682 // 客服 626 // 客服
683 openSever: function () { 627 openSever: function () {
684 - app.img_active = false;  
685 - app.getRongYunToken();  
686 628
687 - function callBack(ret, err) {  
688 - // alert("ret.type="+ret.type+"value="+ret.value+"ret.desc="+ret.desc);  
689 - if (ret.type == 1) {  
690 - // api.closeWin();  
691 } 629 }
692 - }  
693 -  
694 - var param = {  
695 - appkey: "1da38c74bc3746cea6b767727683ca83",  
696 - titleImgId: '#dbb25f',  
697 - themeColor: '#dbb25f',  
698 - backgroundColor: '#f8f9f8',  
699 - userId: app.userId,  
700 - customBannerColor: '#dbb25f',  
701 - nickName: "",  
702 - phone: "",  
703 - email: "",  
704 - customInfo: {"uname": app.user_info.name, 'avatarUrl': app.user_info.avatar},  
705 - transferKeyWord: '人工服务,人工,电话',  
706 - isShowEvaluate: true,  
707 - isSettingSkillSet: false,  
708 - skillSetId: "",  
709 - customUserOutWord: '欢迎再次咨询',  
710 - customAdminTipWord: '请稍等... 正在查询资料',  
711 - customAdminNonelineTitle: '人工客服忙~',  
712 - isShowTansfer: true,  
713 - titleFont: 18.0,  
714 - bottomLineColor: '#dbb25f',  
715 - goodsTitle: app.goods.post_title,  
716 - goodsLabel: app.goods.other_title,  
717 - goodsImage: app.goods.icon,  
718 - goodsFromUrl: 'http://www.baidu.com',  
719 - isDebugMode: 'YES'  
720 - };  
721 - var zhichi = api.require('zhiChiSobot');  
722 - zhichi.startZhiChiSobot(param, callBack);  
723 - },  
724 - // 获取客服token  
725 - getRongYunToken: function () {  
726 - var header = {  
727 - "XX-Device-Type": getDevice(),  
728 - 'XX-Token': getToken()  
729 - };  
730 - getRequest('post', 'portal/RongYun/index', null, header).then(function (res) {  
731 - if (res.data.code == 1) {  
732 - app.rongYunToken = res.data.data.token;  
733 - app.userId = res.data.data.userId;  
734 - // app.rongyunInit();  
735 - } else {  
736 - toastMsg(res.data.msg)  
737 - }  
738 - })  
739 - }, 630 + ,
740 // 获取个人信息 631 // 获取个人信息
741 getUserIndexInfo: function () { 632 getUserIndexInfo: function () {
742 var header = { 633 var header = {
@@ -750,7 +641,8 @@ @@ -750,7 +641,8 @@
750 toastMsg(res.data.msg) 641 toastMsg(res.data.msg)
751 } 642 }
752 }) 643 })
753 - }, 644 + }
  645 + ,
754 646
755 } 647 }
756 }) 648 })