<template>
  <div class="login_bg">
    <div class="login_wrap">
      <div class="login-form-logo">
        <div class="login-logo-text login-logo-text1">欢迎来到</div>
        <div class="login-logo-text login-logo-text2">辽宁奥美手持系统！</div>
      </div>
      <div class="login_cnt">
        <div class="login_card">
          <div class="card_wrap">
            <div class="inputOuter">
              <div class="input_label">acs地址</div>
              <input type="text" v-model="acsip" class="inputStyle">
            </div>
            <div class="inputOuter">
              <div class="input_label">刷新时间(s)</div>
              <input type="text" v-model="setTime" class="inputStyle">
            </div>
          </div>
          <div class="fxrow check-setup-box">
            <div class="setup-box" @click="toLogin">返回登录</div>
          </div>
          <div class="submit">
            <button class="btn submit-button" @click="_submit">确&nbsp;&nbsp;认</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Setup',
  data () {
    return {
      //   addrip: this.$store.getters.baseUrl,
      acsip: this.$store.getters.acsUrl,
      //   imgip: this.$store.getters.imgip,
      //   printip: this.$store.getters.printUrl || 'http://10.5.29.104:8000',
      //   billPrintip: this.$store.getters.billPrintUrl || 'http://10.5.29.191:8000',
      setTime: this.$store.getters.setTime / 1000
    }
  },
  methods: {
    toLogin () {
      this.$router.push('/login')
    },
    _submit () {
    //   if (this.addrip === '') {
    //     this.toast('请填写wms地址')
    //     return
    //   }
      if (this.acsip === '') {
        this.toast('请填写acs地址')
        return
      }
      // if (this.addrip === '') {
      //   this.toast('请填写服务器地址')
      //   return
      // }
      // if (this.imgip === '') {
      //   this.toast('请填写图片域名地址')
      //   return
      // }
      // if (this.printip === '') {
      //   this.toast('请填写标签打印地址')
      //   return
      // }
      // if (this.billPrintip === '') {
      //   this.toast('请填写单据打印地址')
      //   return
      // }
      if (this.setTime === '') {
        this.toast('请填写刷新时间')
        return
      }
      // 删除id为printid的DOM节点
      // var printid = document.getElementById('printid')
      // if (printid) {
      //   printid.parentNode.removeChild(printid)
      // }
      // 动态添加script
      // var script = document.createElement('script')
      // script.setAttribute('id', 'printid')
      // script.src = this.printip + '/CLodopfuncs.js'
      // document.getElementsByTagName('head')[0].appendChild(script)

      // 2
      // 删除id为billPrintid的DOM节点
      // var billPrintid = document.getElementById('billPrintid')
      // if (billPrintid) {
      //   billPrintid.parentNode.removeChild(billPrintid)
      // }
      // 动态添加script
      // var script2 = document.createElement('script')
      // script2.setAttribute('id', 'billPrintid')
      // script2.src = this.billPrintip + '/CLodopfuncs.js'
      // document.getElementsByTagName('head')[0].appendChild(script2)

      // 存值
      //   this.$store.dispatch('setBaseUrl', this.addrip)
      this.$store.dispatch('setAcsUrl', this.acsip)
      //   this.$store.dispatch('setImgIp', this.imgip)
      //   this.$store.dispatch('setPrintUrl', this.printip)
      //   this.$store.dispatch('setBillPrintUrl', this.billPrintip)
      this.$store.dispatch('setRefreshTime', this.setTime * 1000)
      this.$router.push('/login')
    }
  }
}
</script>

<style lang="stylus" scoped>
.check-setup-box
  display flex
  align-items center
  justify-content center
  margin-top 24px
.setup-box
  line-height 40px
  font-size 16px
  color #4A54FF
.check-box
  display flex
  align-items center
  justify-content flex-start
.icon-name-check
  width 22px
  height 22px
  margin-right 6px
  border 1px solid #e2e2e2
  border-radius 50%
.icon-name-checked
  border none
  background center / 100% auto url(../../images/select.png) no-repeat
  background-size 22px 22px
  border 1px solid #e2e2e2
.meber-desc
  line-height 40px
  font-size 16px
  color #4A54FF
.login_bg
  width 100%
  height 100%
  // background center bottom / 100% auto url(../../images/bg_01.png) no-repeat
.login_wrap
  position fixed
  left 50%
  top 50%
  width 472px
  min-height 460px
  transform translate3d(-50%, -50%, 0)
  border-radius 12px
  overflow hidden
  box-shadow 0 0 6px 0 rgb(0 0 0 / 20%)
  background #fff center bottom / 100% auto url(../../images/bg.png) no-repeat
.login-form-logo
  width 100%
  height 180px
  display flex
  flex-direction column
  align-items center
  justify-content center
  background-color #e74f1a
  background-image linear-gradient(180deg, #f77130 0, #c64602 100%), linear-gradient(126deg, #f7874e 15%, #c04103 100%)
  border-radius 12px 12px 0 0
  box-shadow 0 2px 7px 0 #e84f1a
.login-logo-text
  font-size 20px
  line-height 30px
  color #fff
.login-logo-text2
  font-sise 22px
  font-weight bold
.login_cnt
  position relative
  width 100%
  overflow hidden
.login_card
  width 400px
  margin 0 auto
.card_wrap
  overflow hidden
.inputOuter
  position relative
  display flex
  align-items center
  justify-content space-between
  width 100%
  margin-top 24px
label
  display block
  font-size .16rem
  line-height .3rem
  color #333
.inputStyle, select
  width 100%
  line-height 40px
  height 40px
  color #595959
  padding 0 12px
  font-size 16px
  border 1px solid #dfdfdf
  box-sizing border-box
  border-radius 4px
select
  appearance auto
  outline none
.submit
  width 100%
  margin 24px auto
  text-align center
.btn
  background-color #2778f3
  font-size 16px
  line-height 40px
  color #fff
  width 100%
  border-radius 999px
  margin 0
  padding 0
.submit-button
  background center center #e74f1a
  background-image linear-gradient(315deg,#D7592F 0,#E2663C 100%)
.scan_icon
  width .4rem
  font-size .3rem
  line-height .4rem
  color #D7592F
  text-align center
  border 1px solid #D7592F
  border-radius 100%
  margin .1rem auto
  &::before
    content: '\e607'
.san_text
  font-size .16rem
  color #D7592F
  text-align center
.input_label
    width 150px
    font-size 16px
    line-height 40px
    color #595959
</style>
