<template>
  <section>
    <header><span class="fxcol">设置</span></header>
    <section class="content">
      <ul class="pwd-manage-content">
        <li>
          <span>lms地址:</span>
          <input type="text" v-model="addrip">
        </li>
        <li>
          <span>acs地址:</span>
          <input type="text" v-model="acsip">
        </li>
        <!-- <li>
          <span>打印地址:</span>
          <input type="text" v-model="printip">
        </li>
        <li>
          <span>刷新时间(s):</span>
          <input type="text" v-model="setTime">
        </li> -->
      </ul>
    </section>
    <section class="submit-bar">
      <button class="btn submit-button" @click="_submit">确认</button>
    </section>
  </section>
</template>

<script>
export default {
  name: 'Setup',
  data () {
    return {
      addrip: this.$store.getters.baseUrl,
      acsip: this.$store.getters.acsip,
      printip: this.$store.getters.printUrl,
      setTime: this.$store.getters.setTime
    }
  },
  methods: {
    _submit () {
      if (this.addrip === '') {
        this.toast('请填写wms地址')
        return
      }
      if (this.acsip === '') {
        this.toast('请填写acs地址')
        return
      }
      // if (this.printip === '') {
      //   this.toast('请填写打印地址')
      //   return
      // }
      // if (this.setTime === '') {
      //   this.toast('请填写刷新时间')
      //   return
      // }
      // 存值
      this.$store.dispatch('setBaseUrl', this.addrip)
      this.$store.dispatch('setAcsIp', this.acsip)
      // this.$store.dispatch('setPrintUrl', this.printip)
      // this.$store.dispatch('setRefreshTime', this.setTime)
      this.$router.push('/login')
    }
  }
}
</script>

<style lang="stylus" scoped>
@import '~@style/mixin'
.pwd-manage-content li
  _fj()
  height: .86rem
  margin: .4rem 0
.pwd-manage-content li span
  flex: 0 0 2rem
  _font(.28rem,.86rem,#464646)
.pwd-manage-content li input, select
  flex 1
  _wh(4.8rem,.86rem)
  _font(.26rem,.86rem,#323232)
  background: #ded3d3
  text-indent 0.16rem
</style>
