PageSourceSearch

https://static.to8to.com/gb_js/tender.js?v=20170812

js to8to.com collected 2026-10-02 18:56:49 UTC 46,241 bytes, 975 lines download raw bytes

1
2/*
3 * tender.js
4 * tracy.xu   15/12/14
5 * 依赖comon_new.js,jquery 1.9以上
6 * }
7 */
8var _script = document.createElement('script');
9var _scriptMd5 = document.createElement('script');
10_script.src = "https://static.to8to.com/gb_js/to8torsaszb.min.js";
11_script.type = 'text/javascript';
12_scriptMd5.type = 'text/javascript';
13_scriptMd5.src = "https://static.to8to.com/gb_js/jQuery.md5.min.js";
14document.getElementsByTagName('head')[0].appendChild(_script);
15document.getElementsByTagName('head')[0].appendChild(_scriptMd5);
16(function (_$) {
17    //招标
18    window.tender = function () {
19        /**
20         * 招标入口初始化
21         * @param options 初始化参数
22         * options {
23         *   autoPop:0  1 2
24         *   autoResult 0 1 2
25         *   autoNext  0 走结果块  其他走回调函数
26         *   onFirstStepEnd  回调函数
27         *   onNextStepEnd   回调
28         *   onResultStepEnd  回调
29         *   phoneAgain  防止重复提交
30         *   rsastatus  启用新版加密
31         *   其他字段 自定义 obj 为可能需要提交到服务器的字段名称
32         * }
33         */
34        this.options = {
35            autoPop: 0,
36            autoResult: 0,
37            autoNext: 0,
38            onFirstStepEnd: null,
39            onNextStepEnd: null,
40            onResultStepEnd: null,
41            phoneAgain: 0
42        };
43        //统一招标入口接口
44        this.requestURL = "//m.to8to.com/zb/zb-index-get.php";
45        //提交字段对象集合
46        this.sendData = {};
47        this.nextSendData = {};
48        // 匹配筛选可提交字段
49        this.fields = [
50            'modeltype', 'checkField', 'tyid', 'toid', 'gid', 'ptag', 'rand',
51            'phone', 'rsastr', 'rsastatus', 'rsadata', 'zxxq', 'address', 'qq', 'zbgate', 'yuyue_type', 'square',
52            'chenghu', 'shen', 'city', 'town', 'zxys', 'demo', 'upip', 'cityid', 'zxtype', 'zxtype-gz', 'sourcepage',
53            'landpage', 'app', 'idfa', 'subpage', 'zxbj_ispass', 'userTime', 'zxtime', 'yuyuemobilemsg', 'to8to_from',
54            'to8to_tgid', 'hometype', 'zxtype_two', 'not_send_mobile_msg', 'zxstatus', 'zbymid', 'third_phid', 'fromid',
55            'weixinopenid', 'sourceid', 's_sourceid', 'pro_sourceid', 'pro_s_sourceid', 'forum_sourice', 'operating_type',
56            'demand_type', 'device_src', 'housetype', 'sendmobiletime', 'invite','respond','refurl','shi','ting','fang',
57			      'wei','yangtai','chu','brand','zxjc_ptag','zxbj_ptag','submod1','type','dangci','is_bottom_new','t','nowstep','jcFlag',
58            'module_source','community','born','zxtime_zxjr','not_send_mobile','huxing','sub_demo_zt','demo_zt','i','jftime','fengge',
59            'fitstate','source','verify','id','pos','oldaid','title','demotype','validCode','markCode', 'autoPop','xgtqbj','houses',
60            'a_price','zzcost','method','shuidian','from_type','apply_type', 'deco_time', 'house_rough', 'house_mode', 'dec_type'];
61    };
62
63    tender.prototype = {
64        // 招标入口
65        init: function (options) {
66            this.options = _$.extend(this.options, options);
67            this.sendData = this.filterFields(this.sendData, this.options);
68            if(this.options.modeltype == 1){
69                //普通招标
70                this.sendZbRequest(this.sendData,this.handleResponse);
71            } else if(this.options.modeltype == 2){
72                //装修报价
73                this.sendZbRequest(this.sendData, this.handleResponseBJ)
74            } else if(this.options.modeltype == 3) {
75                //预约工地
76                this.sendZbRequest(this.sendData, this.handleResponseYY)
77            } else if(this.options.modeltype == 4) {
78                //装修吉日
79                this.sendZbRequest(this.sendData, this.handleResponseJR);
80            } else if(this.options.modeltype == 5) {
81                //发送效果图
82                this.sendZbRequest(this.sendData, this.handleResponseXGT);
83            } else if(this.options.modeltype == 8 || this.options.modeltype == 9 || this.options.modeltype == 12) {
84                //新版报价
85                this.sendZbRequest(this.sendData, this.handleResponseBJ);
86            } else if(this.options.modeltype == 11) {
87                //新版预约
88                this.sendZbRequest(this.sendData,this.handleResponseNew,true);
89            }
90        },
91        /*
92         *post 请求统一入口函数
93         */
94        sendZbRequest: function(sendData,func,isNewUrl) {
95			var _this = this, _phone;
96
97            sendData['uuid'] = _this.createGuid();
98            _phone = sendData['phone'] || '';
99            if (!_$.md5) {
100                    _$.getScript('https://static.to8to.com/gb_js/jQuery.md5.js?20210527', function () {
101                        sendData['enc'] = _$.md5(sendData['uuid'] + _phone);
102                    });
103                }
104                else {
105                    sendData['enc'] = _$.md5(sendData['uuid'] + _phone);
106                }
107            _$.ajax({
108                type: "GET",
109                url: isNewUrl?'//www.to8to.com/api/add_qc_apply.php': _this.requestURL,
110                dataType : "jsonp",//数据类型为jsonp
111                jsonpCallback: "jsonpCallback",//服务端用于接收callback调用的function名的参数
112                data: sendData,
113                beforeSend: function() {
114                    if (_this.options.phoneAgain > 0) {
115                        return false;
116                    } else {
117                        _this.options.phoneAgain ++;
118                    }
119                },
120                success: function (res) {
121                    func.call(_this, res);
122                }
123            });
124
125        },
126
127        createGuid: function () {
128            for (var a = "", c = 1; 32 >= c; c++) {
129                var b = Math.floor(16 * Math.random()).toString(16),
130                    a = a + b;
131                if (8 == c || 12 == c || 16 == c || 20 == c) a += ""
132            }
133            return this.guid = a += Math.ceil(1E6 * Math.random())
134        },
135
136        /**
137         * 返回值处理函数
138         * @param res 返回值
139         */
140        //处理普通招标
141        handleResponse: function (res) {
142            var self = this;
143            if (res.nextstep == 2) {
144                //走完善信息模快
145
146                if (res.status == 1) {
147                    //判断是否弹窗
148                    if (self.options.autoPop == 0) {
149                        if (!res.tmpYid) {
150                            tender_overFive();
151                            self.options.phoneAgain = 0;
152                            return;
153                        }
154                        //走完善信息
155                        tender_window_box_close();
156						self.perfectInfor(res);
157                    } else if(self.options.autoPop == 1){
158                        if (!res.tmpYid) {
159                            tender_overFive();
160                            self.options.phoneAgain = 0;
161                            return;
162                        }
163                        //  直接显示结果
164                        self.showResult(res);
165                    } else {
166                        // 回调函数位置。
167                        if (typeof self.options.onFirstStepEnd == 'function') {
168                            setTmpYid(res)
169							self.options.onFirstStepEnd(res);
170                        }
171                    }
172                    self.options.phoneAgain = 0;
173                    return false;
174                } else if (res.status == 5) {
175                    if (typeof self.options.onFirstStepEnd == 'function') {
176                        setTmpYid(res)
177                        self.options.onFirstStepEnd(res);
178                        return;
179                    }
180                    tender_window_box_close();
181                    tender_indexYYFail(res.city);
182                    self.options.phoneAgain = 0;
183                    return false;
184                } else if (res.status == 6){
185					          tender_codeError();
186            } else {
187                        //改版首页全屏弹窗免费设计发标回调
188                        if (typeof self.options.onFirstStepEnd == 'function'&& res.method == "defaltZb") {
189                            setTmpYid(res)
190                            self.options.onFirstStepEnd(res);
191                        } else {
192                            var cityname = encodeURI(res.city);
193                            var tyid = encodeURI(res.tmpid);
194
195                            if (showPopWin) {
196                                showPopWin("//www.to8to.com/zb/frame_global.php?msg=" + cityname + "&tyid=" + tyid, 456, 254, null, true);
197                            } else {
198                                _$.getScript('https://static.to8to.com/gb_js/subModal.js?v=1432043909', function () {
199                                    showPopWin("//www.to8to.com/zb/frame_global.php?msg=" + cityname + "&tyid=" + tyid, 456, 254, null, true);
200                                });
201                            }
202                        }
203
204                        self.options.phoneAgain = 0;
205                    }
206                }
207        },
208        //处理装修报价函数
209        handleResponseBJ: function(res){
210            var self = this;
211            /*
212             * 第一步提交之后的返回数据。
213             */
214            if(res.nextstep == 2) {
215                setTmpYid(res)
216                self.options.onFirstStepEnd(res);
217            } else if(res.nextstep == 3) {
218                self.options.onResultStepEnd(res);
219            }
220        },
221        //处理预约装修工地
222        handleResponseYY: function(res){
223            if(typeof(res.CODE) != 'undefined' && res.CODE == '1'){
224                var self = this;
225                if(self.options.autoPop == 0)
226                {
227                    tender_window_box_close();
228                    tender_freeSuceess(res.DATA);
229                }
230                else
231                {
232                    if (typeof self.options.onFirstStepEnd == 'function') {
233                        setTmpYid(res)
234                        self.options.onFirstStepEnd(res);
235                    }
236                }
237            }
238            else {
239                tender_window_box_close();
240                tender_freeFail();
241            }
242        },
243        //处理装修吉日:
244        handleResponseJR: function(res){
245            var self = this;
246            // 侧边调用回调
247            if (typeof self.options.onFirstStepEnd == 'function') {
248                setTmpYid(res)
249                self.options.onFirstStepEnd(res);
250            }
251        },
252        //处理效果图
253        handleResponseXGT: function(res){
254            if(res.status==1){
255                var self = this;
256                tender_setXgtCookie("to8to_mg",this.sendData.phone,7*24*3600*1000, 'xiaoguotu.to8to.com');
257                if (typeof self.options.onFirstStepEnd == 'function') {
258                    setTmpYid(res)
259                    self.options.onFirstStepEnd(res);
260                } else {
261                    tender_window_box_close();
262                    var str = '<div class="div_two">\
263                                       <div class="two_div" style=" padding-left:50px;">\
264                                             <p class="p1">恭喜您发送成功 !</p>\
265                                           <p class="p2">短信已发送,土巴兔-互联网装修领导者,感谢您的使用。</p>\
266                                       </div>\
267                                </div>';
268                    _$('.window_box').windowBox({
269                        width:480,    //弹框宽度
270                        height:220,
271                        title: '', //标题
272                        wbcStr:str,  //可编辑内容
273                        cancleBtn:false,    //是否显示取消按钮
274                        confirmBtn:false
275                    });
276                }
277
278            }else if(res.status==0){
279                tender_window_box_close();
280                var str = '<div class="freeQuote_box_content freeOffer_box_content clear">\
281                                 <div class="div_one">\
282                                    <div class="one_div">\
283                                        <p class="p2">'+res.msg+'</p>\
284                                    </div>\
285                                </div></div> ';
286                _$('.window_box').windowBox({
287                    width:480,    //弹框宽度
288                    height:150,
289                    title:' <p class="p1">发送失败 !</p>',  //标题
290                    wbcStr:str,  //可编辑内容
291                    cancleBtn:false,    //是否显示取消按钮
292                    confirmBtn:false
293                });
294            }else{
295                alert("验证码错误!");
296                _$(".freeOffer_box_content").find(':text[name="chkYzm"]').focus();
297            }
298        },
299        //处理新版预约
300        handleResponseNew: function (res) {
301            var self = this;
302            if (res.code == 200) {
303                self.options.onFirstStepEnd(res);
304            } else {
305                self.options.error(res);
306            }
307        },
308        /**
309         * 过滤初始参数,组装需要发送的数据
310         */
311        filterFields: function (sendData, options) {
312            for (var i in this.fields) {
313                if (options[this.fields[i]] == 0 || options[this.fields[i]]) {
314                    sendData[this.fields[i]] = options[this.fields[i]];
315                }
316            }
317            //存在电话号码则进行加密处理
318            if (sendData.phone && sendData.phone != '' ) {
319	            //新版电话加密
320	            sendData = this.encryptPhone(sendData);
321            };
322			      return sendData;
323        },
324
325        //完善信息数据处理
326        perfectInfor: function (res) {
327            var _this = this;
328
329            var str = '<form id="subZbForm">\
330                        <input type="hidden" id="User_City_1" value="'+res.city+'" name="User_City">\
331                        <input type="hidden" value="'+res.tmpYid+'" name="tyid" id="tyid">\
332                        <div class="mod_fbbox mod_fbbox_wxserviceV2" style="width:380px;padding-bottom:100px;">';
333                            if (res.homeId) {
334                                str += '<div class="fbbox_s1" style="width:308px;margin: 0 auto;">\
335                                            <div class="s1_hd">感谢您的申请!</div>\
336                                            <div style="text-align: left; color: #f36f20;" class="holiday-text">
336'+ '土巴兔将有装修管家与您电话联系,确认您的具体需求。</div>\
337                                            <div class="s1_hd_sub" style="width:100%;text-align: left;font-size: 12px;">由于近期申请火爆,一个月内整屋装修开工的业主完善以下信息,我们将优先服务。</div>';
338                            } else {
339                                str += '<div class="fbbox_s1" style="width:328px;margin: 0 auto;">\
340                                            <div class="s1_hd">感谢您的申请!</div>\
341                                            <div style="text-align: left;"><span style="color: #f36f20;">本服务由土巴兔集团旗下<a style="color: #f36f20;; text-decoration: underline!important; font-weight: bold;" href="//www.tumanyi.com/company" target="_blank">图满意装修网</a>及具有资质合作的装修公司提供相关服务,图满意将有专属管家与您联系,确认需求!</div>\
342                                            <div class="s1_hd_sub" style="width:100%;text-align: left;font-size: 12px;">由于近期申请火爆,一个月内整屋装修开工的业主完善以下信息,我们将优先服务。</div>';
343                            };
344                            str += ' </div>\
345                            <div class="mod_form" style="width: 308px; margin: 20px auto 0;">';
346                            if (res.city == '' || res.city == 0 || typeof(res.city) == 'undefined') {
347                                str += '<div class="form_line">' +
348                                '<label for="" class="label"><span>*</span>&nbsp;所在省份</label>' +
349                                '<div class="element">' +
350                                '<div class="clear">' +
351                                '<select  class="select select_s" id="User_ShenPop"  name="User_ShenPop" onChange="changeProvince(' + "User_ShenPop" + ',' + "User_CityPop" + ',' + "User_TownPop" + ');"></select>' +
352                                '</div>' +
353                                '<div class="err_tip"  style="display:none"><span class="ico_error"></span>请选择省份名称</div>' +
354                                '</div>' +
355                                '</div>';
356                                str += '<div class="form_line">' +
357                                '<label for="" class="label"><span>*</span>&nbsp;所在城市</label>' +
358                                '<div class="element">' +
359                                '<div class="clear">' +
360                                '<select  class="select select_s" id="User_CityPop" name="User_CityPop" ></select><div style="display:none"><select name="User_TownPop" id="User_TownPop" style="display:none"><option value="">' + '--</option></select></div>' +
361                                '</div>' +
362                                '<div class="err_tip"  style="display:none"><span class="ico_error"></span>请选择城市名称</div>' +
363                                '</div>' +
364                                '</div>';
365                            } else {
366                                str += '<input type="hidden" id="User_Shen_1" value="' + res.shen + '" name="User_Shen"><input type="hidden" id="User_City_1" value="' + res.city + '" name="User_City">';
367                                str += '<input type="hidden" id="User_Shen_1" value="' + res.shen + '" name="User_Shen"><input type="hidden" id="User_City_1" value="' + res.city + '" name="User_City">';
368                            }
369                            if(res.zxtime==''||res.zxtime==0||typeof(res.zxtime)=='undefined'||res.zxtime==null){
370                                str += '<div class="form_line">\
371                                            <label class="label" for=""><span>*</span>装修时间</label>\
372                                            <div class="element">\
373                                                <select id="zxtime" name="zxtime" class="select">\
374                                                    <option value="">请选择您要装修房屋的时间</option>\
375                                                    <option value="1个月内">1个月内</option>\
376                                                    <option value="2个月内">2个月内</option>\
377                                                    <option value="2个月以上">2个月以上</option>\
378                                                </select>\
379                                            </div>\
380                                        </div>';
381                            }
382                            if(res.oarea==''||res.oarea==0||typeof(res.oarea)=='undefined'||res.oarea==null){
383                                str += '<div class="form_line">\
384                                            <label class="label" for=""><span>*</span>装修面积</label>\
385                                            <div class="element">\
386                                                <div class="text_wrap">\
387                                                    <input class="text" t
387ype="text" id="square" name="square" >\
388                                                    <em class="text_lbl">请输入您要装修房屋的建筑面积</em>\
389                                                    <em class="unit">㎡</em>\
390                                                </div>\
391                                            </div>\
392                                        </div>';
393                            }
394                            if(res.hometype==''||res.hometype==0||typeof(res.hometype)=='undefined'||res.hometype==null) {
395                                str += '<div class="form_line">\
396                                    <label class="label" for=""><span>*</span>房屋类型</label>\
397                                    <div class="element">\
398                                        <select id="hometype" class="select" name="">\
399                                            <option value="">请选择您要装修房屋的类型</option>\
400                                            <option value="1">新房装修</option>\
401                                            <option value="1">旧房翻新</option>\
402                                            <option value="3">办公室装修</option>\
403                                            <option value="5">店铺装修</option>\
404                                            <option value="7">餐厅装修</option>\
405                                            <option value="6">酒店装修</option>\
406                                            <option value="21">其他类型</option>\
407                                        </select>\
408                                    </div>\
409                                </div>';
410                            }
411                            // if(res.address==''||res.address==0||typeof(res.address)=='undefined'||res.address==null) {
412                            //     str += '<div class="form_line">\
413                            //                 <label class="label" for="">&nbsp;&nbsp;楼盘名称</label>\
414                            //                 <div class="element">\
415                            //                     <div class="text_wrap">\
416                            //                         <input class="text" type="text" id="zb_areaName" maxlength="24">\
417                            //                         <em class="text_lbl">请输入您要装修房屋的楼盘名称</em>\
418                            //                         <div class="loupan_box"></div>\
419                            //                     </div>\
420                            //                 </div>\
421                            //             </div>';
422                            // }
423                    //完善信息所需字段 暂定为inforType
424                    str += '<div class="from_line" style="float: left;width:100%">\
425        									<div class="element">\
426        										<span class="btn_org mod_fbbox_btn clickstream_tag" style="text-align: center;display:block;width:160px;margin: 0 auto"> 立即提交</span>\
427        									</div>\
428        								</div>\
429        							</div>\
430        						</div></form>';
431            _$('.window_box').windowBox({
432                width: 530,
433                title: "",
434                wbcStr: str
435            });
436            if (res.city == '' || res.city == 0 || typeof(res.city) == 'undefined') {
437                initGp(function() {
438                    var gpmPop = new GlobalProvincesModule();
439                    gpmPop.def_province = ["省/市", ""];
440                    gpmPop.def_city1 = ["市/地区", ""];
441                    gpmPop.initProvince($("User_ShenPop"));
442                })
443            }
444
445            _$('#square, #zb_areaName').placeholder();
446            _$("#zb_areaName").bind('keyup keydown',function(){
447                var loupan = _$(this).val();
448                if(loupan != 'undefined' && loupan != ''){
449                    tender_getLoupan( {'shen':_this.options.shen, 'city':_this.options.city, 'loupan_key': loupan} );
450                }
451            });
452            _$("#zb_areaName").bind('focus click',function(){
453                _$('.loupan_box').hide();
454            });
455
456            _$('.btn_org').click(function() {
457                var chkArr = [{
458                    id: '#User_shenPop',
459                    info: [{reg: [0], tip: '请选择省份'}]
460                },{
461                    id: '#user_cityPop',
462                    info: [{reg: [0], tip: '请选择城市'}]
463                },{
464                    id: '#zxtime',
465                    info: [{reg: [0], tip: '请选择装修时间'}]
466                }, {
467                    id: '#square',
468                    info: [{reg: [0], tip: '请填写装修面积'}, {reg: [/^[\d\.]+$/], tip: '请填写正确的装修面积'}, {reg: [/^[1-9]{1}\d{0,3}(\.\d{1,2})?$/], tip: '面积不能超过10000,支持两位小数'}]
469                }, {
470                    id: '#hometype',
471                    info: [{reg: [0], tip: '请选择房屋类型'}]
472                }];
473                //将该验证函数引入
474                if(tender_simplifyCheck(chkArr)) {
475                    _this.resData = {};
476                    if(_$('#User_City_1').val()){
477                        _this.resData.city   = _$("#User_City_1").val();
478                    } else {
479                        _this.resData.shen = _$('#User_ShenPop').val();
480                        _this.resData.city = _$('#User_CityPop').val();
481                    }
482                    _this.resData.square  = _$("#square").val();
483                    if (_$("#zb_areaName").val() != '') {
484                        _this.resData.address = _$("#zb_areaName").val();
485                    };
486                    _this.resData.zxtime = _$("#zxtime").val();
487                    _this.resData.hometype = _$("#hometype").val();
488                    _this.resData.tyid   = _$("#tyid").val();
489                    //invite 的含义是?
490                    _this.resData.invite = 2;
491                    //通过服务器告诉走那个模块
492                    _this.resData.modeltype  = res.modeltype;
493                    _this.resData.nowstep = res.nextstep;
494
495                    _this.onNextStep(_this.resData);
496                }
497                // 点击提交后所执行的函数
498            });
499
500        },
501        onNextStep: function(options){
502            this.nextSendData = this.filterFields(this.nextSendData,options);
503            this.sendZbRequest(this.nextSendData,this.dealNextStep);
504        },
505        dealNextStep: function(res){
506			      var self = this;
507            if(res.nextstep == 3) {
508                if(self.options.autoNext == 0) {
509                    self.showResult(res);
510                } else {
511                    //回调
512                    if (typeof self.onFirstStepEnd == 'function') {
513                        self.options.onNextStepEnd(res);
514                    }
515                }
516            }
517        },
518        // 普通招标结果显示
519        showResult: function (res) {
520            if (this.options.autoResult == 2) {
521                if (typeof this.options.onResultStepEnd == 'function') {
522                    this.options.onResultStepEnd(res);
523                }
524            } else if (this.options.autoResult == 1) {
525                str = '恭喜预约成功';
526                _$('.window_box').windowBox({
527                    width: 530,
528                    title: "",
529                    wbcStr: str
530                });
531            } else if (this.options.autoResult == 0) {
532                // 根据当前选择流程展示结果
533				        tender_window_box_close();
534                if (res.status == 4) {//显示结果
535                    tender_indexYYFail(res.city);
536                    return false;
537                } else {
538                    var weixin_code = "//img.to8to.com/to8to_img/img_code/code_other.jpg?201611141439";
539                    var app_code = "//img.to8to.com/to8to_img/app_download/qrCode3.png?20190605";
540                    var str = '<div class="mod_fbbox mod_fbbox_wxserviceV2">\
541                                        <div class="fbbox_s1">\
542                                            <div class="s1_hd">恭喜您完善资料成功!</div>\
543                                        </div>\
544                                        <div class="mod_fbbox_code">\
545                                            <div class="mod_fbbox_code_img clear">\
546                                                <p class="code-hint">关注土巴兔公众号</p>\
547                                                <p class="code-hint">
547订阅优质装修干货合集</p>\
548                                                <img src="' + weixin_code + '" id="weixin_img">\
549                                                <p class="code-title">公众号</p>\
550                                            </div>\
551                                            <div class="mod_fbbox_code_img right-code clear">\
552                                                <p class="code-hint">下载土巴兔APP</p>\
553                                                <p class="code-hint">查看业主真实装修日记</p>\
554                                                <img src="' + app_code + '" id="weixin_img">\
555                                                <p class="code-title">土巴兔APP</p>\
556                                            </div>\
557                                        </div>\
558                                        <p>您还可以查看更多精品效果图,或者去家居商城选购优质建材</p>\
559                                    </div>';
560                    _$('.window_box').windowBox({
561                        width: 465,
562                        height: 375,
563                        title: "",
564                        moreClass:'round-box',
565                        wbcStr: str
566                    });
567                }
568            }
569
570        },
571        //电话号码加密
572        encryptPhone: function(sendData){
573            var reg = /^1{1}[3456789]{1}\d{9}$/,
574                isPhone = sendData.phone ? reg.test(sendData.phone) : false;
575        	//旧版加密 rsastr=1存在
576        	if(sendData.rsastr==1){
577            sendData.phone = encodeURIComponent(sendData.phone);
578            setRsadata(sendData.phone)
579            sendData.phoneurlencode = 1;
580          } else if (isPhone) {
581            //新版加密添加当前标识
582            if (!window.RSAUtilszb) {
583                $.getScript('https://static.to8to.com/gb_js/to8torsaszb.js?v=20170511', function () {
584                    sendData.rsadata = RSAUtilszb.encryptfun(sendData.phone+','+(Math.ceil(Math.random()*10))+','+Math.random())
585                    sendData.rsadata = encodeURIComponent(sendData.rsadata);
586                    setRsadata(sendData.rsadata)
587                    sendData.rsastatus = 1;
588                    sendData.phoneurlencode = 1;
589                    sendData.phone = '';
590                });
591                return sendData;
592            }
593            else {
594                sendData.rsadata = RSAUtilszb.encryptfun(sendData.phone+','+(Math.ceil(Math.random()*10))+','+Math.random())
595                sendData.rsadata = encodeURIComponent(sendData.rsadata);
596                setRsadata(sendData.rsadata)
597                sendData.rsastatus = 1;
598                sendData.phoneurlencode = 1;
599                sendData.phone = '';
600                return sendData;
601            }
602          }
603			    return sendData;
604        }
605    };
606    /** Helps function **/
607
608    // 超过5次弹窗
609    function tender_overFive() {
610        var str = '<span style="float:left; width:100%; height:14px;line-height:14px;margin:20px 0;text-align:center;*padding-bottom:20px">申请次数超过五次</span>';
611        _$('.window_box').remove();
612        _$('.translucence_layer').remove();
613        _$('.window_box').windowBox({
614            width: 480,
615            title: "提示",
616            wbcStr: str
617        });
618    }
619
620	function tender_codeError() {
621        var str = '<span style="float:left; width:100%; height:14px;line-height:14px;margin:20px 0;text-align:center;*padding-bottom:20px">验证码错误!</span>';
622        _$('.window_box').remove();
623        _$('.translucence_layer').remove();
624        _$('.window_box').windowBox({
625            width: 480,
626            title: "提示",
627            wbcStr: str
628        });
629    }
630
631    function tender_indexYYFail(cityname, sem) {
632        var failStr = '<div class="apply_fail tender_fail"><span class="as_fail"></span><strong>非常抱歉,您当前的城市' + cityname + '尚未开通装修服务,敬请期待!</strong></div>';
633        if (!sem) {
634            _$('.window_box').windowBox({
635                width: 480,
636                height: 200,
637                title: "提示",
638                wbcStr: failStr,
639                closeTime: 6000
640            });
641        } else {
642            _$('.window_box').windowBox({
643                width: 480,
644                height: 200,
645                title: "提示",
646                wbcStr: failStr,
647                closeFn: 'semYYFailCloseFn'
648            });
649        }
650    }
651    //清楚页面弹窗。
652    function tender_window_box_close(obj) {
653        _$('.window_box').remove();
654        _$('.translucence_layer').remove();
655        var cb = tender_checkBrowser();
656        if (cb.version == "6") {
657            _$("html").css("overflow-y", "scroll");
658            _$("body").css("overflow-y", "visible");
659        } else if (cb.version == "7" && _$('#st_pid').length != 1) {
660            _$("html").css("overflow-y", "scroll");
661            _$("body").css("overflow-y", "visible");
662        } else if (cb.version == "8" && _$('#st_pid').length != 1) {
663            _$("html").css("overflow-y", "scroll");
664            _$('body').css('overflow-y', 'visible');
665        } else {
666            _$("body").css("overflow-y", "inherit");
667        }
668        _$('body').css('margin-right', '0');
669        windowBoxOriginHight = 0;
670    }
671    // 判断浏览器
672    function tender_checkBrowser() {
673        var u = window.navigator.userAgent.toLocaleLowerCase(),
674            msie = /(msie) ([\d.]+)/,
675            chrome = /(chrome)\/([\d.]+)/,
676            firefox = /(firefox)\/([\d.]+)/,
677            safari = /(safari)\/([\d.]+)/,
678            opera = /(opera)\/([\d.]+)/,
679            ie11 = /(trident)\/([\d.]+)/,
680            b = u.match(msie) || u.match(chrome) || u.match(firefox) || u.match(safari) || u.match(opera) || u.match(ie11);
681        return {name: b[1], version: parseInt(b[2])};
682
683    }
684    // 页面城市插件是否引入判断
685    function initGp(callback) {
686        if (!window.GlobalProvinces) {
687            _$.getScript('https://static.to8to.com/gb_js/GlobalProvinces.js?v=143987836', function() {
688                typeof callback === 'function' && callback();
689            })
690        } else {
691            typeof callback === 'function' && callback();
692        }
693    }
694    function tender_simplifyCheck(chkArr) {
695        var defaults = {
696                info: [],
697                parCls: '',//错误加的地方,默认表单元素的父元素
698                require: true,//必填,若是需要满足一定条件检测的需传入condition(true:执行检测,false:不执行检测)
699                className: 'form_error',//错误提示类名
700                labl: 'i',//X的html的标签
701                lablClass: 'ico_error',//X的html的标签的类名
702                callback: '',
703                parentTip: 'form',
704                chkType:''
705            },
706            settings = {},
707            a = 0;
708
709        for(var i = 0, len = chkArr.length;i < len;i++) {
710            settings = {};
711            settings = _$.extend({},defaults,chkArr[i]);
712            if(settings.hasOwnProperty('condition')) {
713                settings.require = false;
714            }
715            if(settings.require || (!settings.require && settings.condition)) {//必须,条件成立
716                a = _$(settings.id).checkForm2({className:settings.className, info:settings.info, labl:settings.labl, lablClass: settings.lablClass, parCls: settings.parCls, callback: settings.callback, parentTip: settings.parentTip, chkType: settings.chkType});
717            }
718            // if(!a && settings.condition) {
719            //     break;
720            // }
721            if(!a) {
722                break;
723            }
724        }
725
726        if(a) {
727            return true;
728        } else {
729            return false;
730        }
731
732    }
733    // 预约申请成功
734    function tender_freeSuceess(obj){
735        var obj = obj?obj:"24小时";
736        var successStr = '<div class="apply_success"><span class="as_true"></span><strong>恭喜您,申请成功!</strong><em>土巴兔客服将于'+obj+'内与您联系!</em></div>';
737        jq('.window_box').windowBox({
738            width:480,
739            height:200,
740            title:"提示",
741            wbcStr:successStr,
742            closeTime:3000
743        })
744    }
745    //预约申请失败
746    function tender_freeFail(obj){
747        var failStr = '<div class="apply_fail"><span class="as_fail"></span><strong>非常抱歉,您当前的申请失败,请稍候再试!</strong></div>';
748        jq('.window_box').windowBox({
749            width:480,
750            height:257,
751            title:"提示",
752            wbcStr:failStr,
753            closeTime:3000
754        })
755    }
756    // form 表单提交数据转成JSON格式
757})(jQuery);
758
759(function(_$){
760    _$.fn.checkForm2 = function(settings){
761        var defaults = {
762            calssName:"add_wrong", //报错字符串的class
763            content:[], //报错内容数组
764            checkType:"text",//检测类型
765            labl:'i',//错误提示的标签
766            lablClass:'ico_error',//错误提示的标签的类名
767            parCls: '',//错误提示所加父元素的标示
768            callback: '',//检测成功后执行的函数
769            info: [],
770            displayNum: true,//单个提示
771            parentTip: 'div',//单个提示范围
772            blurChk: false,//blur时检测提示错误
773            chkType: '',//检测类型,radio单独处理
774            callback: false//验证成功后执行的函数,必须是全局变量
775        };
776
777
778        var settings = _$.extend({}, defaults, settings),
779            cf = {};
780        cf.fn = {};
781        if(settings.info.length == 0 ) {
782            return false;
783        }
784        cf.fn.regType = [/\S/];//0:非空字符串
785
786        _$(this).focus(function() {//获取焦点是移除错误
787            removeWrongText2(_$(this), settings.parCls, settings);
788        });
789        if(settings.blurChk){//blur时检测提示错误
790            _$(this).blur(function() {
791                _check2(cf, settings, _$(this));
792            });
793        }else if(!settings.blurChk) {//提交时检测提示错误
794            var g = _check2(cf, settings, _$(this));
795            return g;
796        }
797
798
799        function _check2(cf, settings, blurObj) {
800            var strTip = '<div class="'+settings.className+'"><'+settings.labl+' class="'+settings.lablClass+'"></'+settings.labl+'>',//错误提示字符串
801                myVal = '',//待验证的value值
802                info = '',//验证规则及提示对象
803                chkFlag = true,//验证的状态
804                reg = [];//验证规则数组
805            if(settings.displayNum  && blurObj.parents(settings.parentTip).find('div.'+settings.className+'').length >= 1) {
806                return;
807            }
808            //获取value
809            if(settings.checkType =="text") {//text,textarea...
810                myVal = blurObj.val();
811            } else {//select
812                myVal = blurObj.find('option:selected').attr('value');
813            }
814            //处理radio
815            if(settings.chkType == 'radio' && blurObj.filter(':checked').length == 0) {
816                strTip += ""+settings.info[0]['tip']+'</div>';
817                addWrongText2(blurObj, settings.parCls, strTip, settings.checkType);
818                chkFlag = false;
819            }
820
821            for(var i = 0; i < settings.info.length; i++){
822                info = _$.extend({}, {negate: false}, settings.info[i]);
823                reg = [];
824                if(!chkFlag) {//验证失败不做以后的验证
825                    break;
826                }
827                if(info.reg && info.tip) {
828                    //获取reg
829                    for(var j = 0, len = info.reg.length;j < len;j++) {
830                        if(typeof info.reg[j] == 'number') {
831                            reg.push(cf.fn.regType[info.reg[j]]);
832                        } else {
833                            reg.push(info.reg[j]);
834                        }
835                    }
836
837                    //验证
838                    for(var k = 0;k < reg.length;k++) {
839                        var regRslt = reg[k].test(myVal);
840                        if(!regRslt && !info.negate) {//匹配不成功,添加错误提示
841                            strTip += ""+info.tip+'</div>';
842                            addWrongText2(blurObj, settings.parCls, strTip, settings.checkType);
843                            chkFlag = false;
844                            break;
845                        } else if(regRslt && info.negate) {
846                            strTip += ""+info.tip+'</div>';
847                            addWrongText2(blurObj, settings.parCls, strTip, settings.checkType);
848                            chkFlag = false;
849                            break;
850                        }
851                    }
852                }
853
854            }
855            if(chkFlag) {
856                if(settings.callback) {
857                    chkFlag = settings.callback();
858                }
859                return chkFlag;//成功
860            }
861        }
862
863        function checkWordLen2(maxLen, range, val) {
864            var len = val.length;
865            if(!range) {
866                if(maxLen < len) {
867                    return false;
868                }
869            } else {
870                if(len >
870 range.dmax || len < range.dmin) {
871                    return false;
872                }
873            }
874
875            return true;
876        }
877
878
879        function addWrongText2(obj, cls, str, chkType) {
880            if(!cls) { //未传class
881                obj.parent().addClass('height_auto');
882                obj.parent().append(str);
883            } else {
884                obj.parents(cls).addClass('height_auto');
885                obj.parents(cls).append(str);
886            }
887
888            if(chkType != 'select') {
889                obj.css('border-color','#ff6767');
890            }
891        }
892
893
894        function removeWrongText2(obj, cls, settings) {
895            if(!cls) { //未传class
896                obj.parent().removeClass('height_auto');
897                obj.parent().find('div.'+settings.className+'').remove();
898            } else {
899                obj.parents(cls).removeClass('height_auto');
900                obj.parents(cls).find('div.'+settings.className+'').remove();
901            }
902            obj.css('border-color','#ccc');
903        }
904
905    };
906})(jQuery);
907function tender_formToJSON (formEle){
908    var data = formEle.serializeArray();
909    var dataObj = {};
910    for(var i in data) {
911        dataObj[data[i].name] = data[i].value;
912    }
913    return dataObj;
914}
915
916function showAddressList(){
917    // jq("#User_Town_c").on('change',function(){
918    //        jq("#user_location").val('');
919    //         var shen = jq("#User_Shen_c").val();
920    //         var city = jq("#User_City_c").val();
921    //         var town = jq("#User_Town_c").val();
922    //         getLoupan( {'shen':shen, 'city':city, 'town':town, 'loupan_key': ''} );
923
924    // });
925}
926//根据选中的县地区,展示小区列表
927function tender_getLoupan(option){
928    if(option.loupan_key == '请输入项目小区名称') option.loupan_key = '';
929    jq.get('/api/loupan_search.php?rand='+~(-new Date()/36e5), option, function(data){
930        if(data == '0'){
931            jq(".loupan_box").hide();
932        } else {
933            data += '<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;filter:alpha(opacity=0);opacity:0;z-index:-1;"></iframe>';
934            jq(".loupan_box").html( data ).slideDown();
935            jq(".lbl_in").text('');
936            jq(".loupan_box").find("ul li").click(function(){
937                jq("#zb_areaName").val( jq(this).text() ).removeClass('height_auto').css('border-color','#d8d8d8').next('em').hide().siblings('.add_wrong').remove();
938                jq(".loupan_box").hide();
939            });
940        }
941    });
942}
943
944function tender_getCookie(name, pre) {
945    if (pre)
946    name = 'to8to_' + name;
947    var r = new RegExp("(\\b)" + name + "=([^;]*)(;|$)");
948    var m = document.cookie.match(r);
949    var res = !m ? "": decodeURIComponent(m[2]);
950    var result = stripscript(res);
951    return result;
952
953};
954
955//设置cookie值
956function tender_setXgtCookie(name, value, expire) {
957  if (!expire){
958      expire = 5000;
959  }
960  var expiry = new Date();
961  expiry.setTime(expiry.getTime() + expire);
962  document.cookie = name + '=' + value + ';expires=' + expiry.toGMTString() + ';path=/;';
963}
964
965// 在回调函数之前存中转库id,供智齿客服回传数据使用
966function setTmpYid(res) {
967  // 存智齿客服所需要的用户信息
968  if (res.tmpYid) {
969    tender_setXgtCookie('tmpYid',res.tmpYid,1000*24*3600*1000)
970  }
971}
972// 存加密后的手机号,供智齿客服回传数据使用
973function setRsadata(rsadata) {
974  tender_setXgtCookie("encryptNumber",rsadata,1000*24*3600*1000)
975}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.