(function (global) {
  new Vue({
    el: '#app',
    data: function () {
      return {
        loginForm: {
          name:'',
          phone:'',
          verifyCode: '',
          verifyCode1: ''
        },
        verifyCodeUrl: '../HXINCLUDE/HX_GetCode1.asp',
        msgCodeButtonText: '获取验证码',
        disabledMsgCode: false,
        dialogVisible: false,
        contact: {
          tel: '4008-919-105'
        },
		tops: [ 'images/top1.jpg','images/top2.jpg','images/top3.jpg','images/top4.jpg'
        ],
		tops2: [ 'images/banner1.jpg','images/banner2.jpg','images/banner3.jpg','images/banner4.jpg'
        ],
        topLinks: [
          { url: '#', title: '登录' },
          { url: '#', title: '注册' },
          { url: '#', title: '我的安装' },
          { url: '#', title: '企业合作' },
          { url: '#', title: '最新动态' }
        ],
        menus: [
          { url: '#', title: '安装师傅' },
          { url: '#', title: 'E安装' },
          { url: '#', title: '合作企业' },
          { url: '#', title: '保险服务' },
          { url: '#', title: '在线下单' }
        ],
        tips: [
          { title: '免费方案', tip: '提供免费安装方案', img: 'images/topan-440.png' },
          { title: '标准报价', tip: '获得标准安装价格', img: 'images/topan-440-1.png' },
          { title: '统一管理', tip: '实施统一安装管理', img: 'images/topan-440-2.png' },
          { title: '标准施工', tip: '标准安装施工流程', img: 'images/topan-440-3.png' },
          { title: '专人审核', tip: '专人审核安装结果', img: 'images/topan-440-4.png' },
        ],
      scopeItems1: [
          { img: 'images/201942523153439889-480.jpg', title: '画面类安装', desc: '海报、灯箱片、灯布', num: '1,000,000' },
          { img: 'images/20194179535643756-480.jpg', title: '橱窗类安装', desc: '橱窗、道具、模特', num: '30,000' },
          { img: 'images/u-3133826083-362421996-fm-26-gp-0-480.jpg', title: '标识类安装', desc: '门头、发光字、标识牌', num: '5,000' },
          { img: 'images/timg-480.jpg', title: '展览类安装', desc: '展位、展台、展示道具', num: '3,000' }

        ],
		  scopeItems2: [
		      { img: 'images/timg-480-1.jpg', title: '照明类安装', desc: '射灯、筒灯、异性灯', num: '1,000' },
          { img: 'images/timg-480-2.jpg', title: '道具类安装', desc: '道具、推头', num: '1,000,000' },
          { img: 'images/timg-480-3.jpg', title: '高空类安装', desc: '楼顶字、高空灯箱', num: '50,000' },
          { img: 'images/timg-480-4.jpg', title: '货架类安装', desc: '货柜、货架', num: '60,000' }
        ],
      scopeItems3: [
          { img: 'images/u-1424473857-2151106843-fm-26-gp-0-240.jpg', title: '墙面翻新', desc: '乳胶漆、腻子、墙面固化', num: '5,000' },
          { img: 'images/u-1937780982-271621602-fm-26-gp-0-240.jpg', title: '地毯更换', desc: '地毯、瓷砖、木地板', num: '1,500' },
          { img: 'images/u-3566709093-2249869030-fm-26-gp-0-240.jpg', title: '新立隔断', desc: '木隔断、石膏板隔断、玻璃隔断', num: '4,000' },
          { img: 'images/u-3491747927-797797827-fm-26-gp-0-240.jpg', title: '顶面翻新', desc: '矿棉板、石膏板、铝扣板', num: '1,200' }

        ],
		  scopeItems4: [
		      { img: 'images/u-188246784-3043754641-fm-26-gp-0-240.jpg', title: '强弱电改造', desc: '强电、弱电、电线', num: '3,000' },
          { img: 'images/u-2721798483-3369670609-fm-26-gp-0-240.jpg', title: '灯具更换', desc: '照明灯具、发光标识', num: '8,000' },
          { img: 'images/u-3919126852-763568086-fm-26-gp-0-240.jpg', title: '踢脚线更换', desc: 'PVC、铝合金、不锈钢、木质', num: '6,000' },
          { img: 'images/u-1043937583-4165418828-fm-26-gp-0-240.jpg', title: '门更换', desc: '玻璃门、电动门、木门、套装门', num: '12,000' }
        ],
        processes: [
          { img: 'images/icons8-c-c-80-120.png', content: '在线或电话预约' },
          { img: 'images/icons8-e-100-120.png', content: '沟通安装需求' },
          { img: 'images/icons8-a-a-a-e-80-120.png', content: '免费安装方案' },
          { img: 'images/icons8-e-c-ae-80-120.png', content: '系统指派工人' },
          { img: 'images/icons8-c-e-a-r-a-ae-ae-80-120.png', content: '平台购买保险' },
          { img: 'images/icons8-a-a-100-120.png', content: '标准安装施工' },
          { img: 'images/icons8-a-a-a-ae-a-80-120.png', content: '审核部专人验收' }
        ],
        processes1: [
          { img: 'images/icons8-c-c-80-120.png', content: '在线或电话预约' },
          { img: 'images/icons8-e-100-120.png', content: '上门测量' },
          { img: 'images/icons8-a-a-a-e-80-120.png', content: '网上报价' },
          { img: 'images/icons8-e-c-ae-80-120.png', content: '网上签约' },
          { img: 'images/icons8-c-e-a-r-a-ae-ae-80-120.png', content: '现场施工' },
          { img: 'images/icons8-a-a-100-120.png', content: '现场验收' },
          { img: 'images/icons8-a-a-a-ae-a-80-120.png', content: '网上评价' }
        ],
        sliders: ['images/123-1200.jpg', 'images/124-1200.jpg'],
        sliders1: ['images/case1-1200.jpg', 'images/case2-1200.jpg', 'images/case3-1200.jpg'],
        brands: [
          { img: 'images/timg1-304.jpg' },
          { img: 'images/logo-400.png' },
          { img: 'images/201411230032412922-202.jpg' },
          { img: 'images/ping-mu-kuai-zhao-2019-06-26-xia-wu12.02.08-400.jpg' },
          { img: 'images/timg44444-400.jpg' },
          { img: 'images/timg3-386.jpg' },
          { img: 'images/timg33-400.jpg' },
          { img: 'images/timg222-400.jpg' },
          { img: 'images/ping-mu-kuai-zhao-2019-06-26-xia-wu12.17.56-400.jpg' },
          { img: 'images/timg555-400.jpg' },
          { img: 'images/timg44-400.jpg' },
          { img: 'images/timg4444-342.jpg' },
          { img: 'images/timg333-204.jpg' },
          { img: 'images/ping-mu-kuai-zhao-2019-06-26-xia-wu12.16.29-310.jpg' },
          { img: 'images/3333-400.jpg' },
          { img: 'images/timg33333-400.jpg' },
          { img: 'images/dsafd-400.jpg' },
          { img: 'images/timg111111-344.jpg' },
          { img: 'images/timg8888-400.jpg' },
          { img: 'images/e-w-q-r-q-r-q-w-400.jpg' }
        ],
        packages: [
          {img: "./images/499-200.png"},
          {img: "./images/699-200.png"},
          {img: "./images/899-200.png"},
          {img: "./images/1099-200.png"},
          {img: "./images/1299-200.png"}
        ],
        stars: [
          { img: 'images/0f9cdc3ff10c592a9b85354d3f20d510-183.jpg', name: '赵师傅', years: 11,type:'海报安装、灯箱安装',brand:'帕拉丁、VM、英菲尼迪',count:1570 },
          { img: 'images/eb11dfcd048dfd733d5fbb59b2a28cb3-183.jpg', name: '李师傅', years: 8,type:'户外广告安装、标识安装',brand:'特步、德芙、广汽',count:3255 },
          { img: 'images/379699fe6ced16d91163bc4bc3a12d85-183.jpg', name: '高师傅', years: 10,type:'海报安装、灯箱安装',brand:'宝马、海蓝之谜、宝姿',count:3010 },
          { img: 'images/8734b6fc4dbbee3ad5e6c206dc878d0c-183.jpg', name: '刘师傅', years: 5,type:'海报安装、灯箱安装',brand:'彪马、思莱德',count:2750 },
          { img: 'images/635e309273219552fbfd71ce84cfefb2-183.jpg', name: '孟师傅', years: 13,type:'海报安装、灯箱安装',brand:'资生堂、潘多拉',count:2950 },
          { img: 'images/167ccde0cb139faff384370d7616634b-183.jpg', name: '温师傅', years: 7,type:'海报安装、橱窗安装',brand:'ONLY、优衣库、李宁',count:2760 },
          { img: 'images/90e88e3c44e0e313e40397ae99a03d60-183.jpg', name: '武师傅', years: 12,type:'海报安装、道具安装',brand:'万达、新百伦',count:3105 },
          { img: 'images/0003cff2fb2e61d966ea63bb68577e45-183.jpg', name: '刘师傅', years: 10,type:'海报安装、灯箱安装',brand:'万宝龙、兰蔻、科颜氏',count:2500 },
          { img: 'images/3a38d2e6a54e828201a90be6e0131b9d-183.jpg', name: '崔师傅', years: 8,type:'海报安装、灯箱安装',brand:'阿迪达斯、戴森',count:2425 },
          { img: 'images/0a17f2229816ff65b3e87f51da2b8181-183.jpg', name: '左师傅', years: 7,type:'海报安装、灯箱安装',brand:'安踏、DK',count:2218 }
        ]
      }
    },
    created() {
      //console.log('hello world')
    },
    methods: {
      login() {
        if (this.loginForm.name.trim() === '') {
          this.$notify.error({
            title: '错误',
            message: '请输入姓名'
          })
          return
        }
        if (this.loginForm.phone === '') {
          this.$notify.error({
            title: '错误',
            message: '请输入您的手机号'
          })
          return
        }
        if (this.loginForm.verifyCode.trim() === '') {
          this.$notify.error({
            title: '错误',
            message: '请输入手机验证码'
          })
          return
        }
        request.post('../EFrockSubmit.asp', this.loginForm, res=> {
        //console.log(this.infoForm)
        if(res.state==0)
        {
          this.$notify({
          title: '成功',
          type: 'success',
          message: unescape(res.message)
          })
        }
        else
        {
        this.$notify({
        title: '提示',
        type: 'success',
        message: unescape(res.message)
        })
          }
        }).catch(e => {
          this.$notify.error({
          title: '错误',
          message: '提交失败: ' + e
          })
        })
      },
      changeVerifyCode() {
        this.verifyCodeUrl = '../HXINCLUDE/HX_GetCode1.asp?' + Math.random()
        this.loginForm.verifyCode = ''
      },
      getMsgCode() {
        if (this.loginForm.phone.trim() === ''||this.loginForm.phone.length!=11) {
          this.$notify.error({
            title: '错误',
            message: '请输入正确手机号码'
          })
          return
        }
        let url = 'Code.asp?phone=' + this.loginForm.phone+'&verifyCode='+this.loginForm.verifyCode1
        fetch(url).then(res => {return res.json()}).then(res=>{
          // 成功获取
		  //console.log(res)
		  if(res.state==0)
		  {
          this.$notify({
            title: '成功',
            type: 'success',
            message: '短信验证码已发送到您的手机'
          })
          this.disabledMsgCode = true
          let start = 60
          this.msgCodeButtonText = start + 's后重试'
          let timer = setInterval(() => {
            start -= 1
            if (start < 0) {
              clearInterval(timer)
              this.disabledMsgCode = false
              this.msgCodeButtonText = '获取验证码'
            } else {
              this.msgCodeButtonText = start + 's后重试'
            }
          }, 1000)
		  }
		  else
		  {
			this.$notify({
            title: '提示',
            type: 'success',
            message:unescape(res.message)
          	})  
			  }
        }).catch(e => {
          this.$notify.error({
            title: '错误',
            message: '获取短信验证码失败'
          })
        })
      },
      showLoginForm() {
        this.dialogVisible = true
        console.log('showLoginForm ')
      }
    }
  })
})(window)