//mysql js
export default{
  data(){
    return {
      mydata:{},
      error:0
    };
  },
  mounted(){
    var mydata=onez.install_get().user||{};
    mydata.username=mydata.username||'admin';
    mydata.password=mydata.password||'';
    mydata.password2=mydata.password2||'';
    
    this.mydata=JSON.parse(JSON.stringify(mydata));
    //onez.data(this,['items']);
  },
  methods:{
    onSubmit(o){
      if(!o.username || o.username.length<1){
        onez.alert('超级管理账号不能为空');
        return;
      }
      if(!o.password || o.password.length<1){
        onez.alert('超级管理密码不能为空');
        return;
      }
      if(!o.password2 || o.password!=o.password2){
        onez.alert('两次密码不一致');
        return;
      }
      onez.install_save({user:{
        username:o.username,
        password:o.password,
        password2:o.password2
      }});
      this.$emit('next');
    },
    prev(){
      this.$emit('prev');
    },
    next(){
      this.$emit('next');
    }
  }
}