<template>
  <div class="basic-box">
    <el-form ref="formData" :model="formData" label-width="190px">
      <div v-if="formData.zhimeng">
        <div class="basic-title">无字免费小说设置</div>
        <el-form-item label="APP Key:" prop="zhimeng.app_key">
          <el-input v-model="formData.zhimeng.app_key" show-password></el-input>
        </el-form-item>
        <el-form-item label="APP Secret:" prop="zhimeng.app_secret">
          <el-input v-model="formData.zhimeng.app_secret" show-password></el-input>
        </el-form-item>
        <el-form-item label="短信 Key:" prop="zhimeng.zhimeng_msg_key">
          <el-input v-model="formData.zhimeng.zhimeng_msg_key" show-password></el-input>
        </el-form-item>
        <el-form-item label="短信 Secret:" prop="zhimeng.zhimeng_msg_secret">
          <el-input
            v-model="formData.zhimeng.zhimeng_msg_secret"
            show-password
          ></el-input>
        </el-form-item>
        <el-form-item label="网站 ID:" prop="zhimeng.zhimeng_web_id">
          <el-input v-model="formData.zhimeng.zhimeng_web_id" show-password></el-input>
        </el-form-item>
      </div>

      <div v-if="formData.mob">
        <div class="basic-title">MOB设置</div>
        <el-form-item label="Mob Android Scheme:" prop="mob.mob_android_scheme">
          <el-input v-model="formData.mob.mob_android_scheme" show-password></el-input>
        </el-form-item>
        <el-form-item label="Mob IOS Scheme:" prop="mob.mob_ios_scheme">
          <el-input v-model="formData.mob.mob_ios_scheme" show-password></el-input>
        </el-form-item>

        <el-form-item label="Mob APP Key:" prop="mob.mob_app_key">
          <el-input v-model="formData.mob.mob_app_key" show-password></el-input>
        </el-form-item>

        <el-form-item label="Mob Link:" prop="mob.mob_link">
          <el-input v-model="formData.mob.mob_link" show-password></el-input>
        </el-form-item>

        <el-form-item label="Mob App Secret:" prop="mob.mob_app_scheme">
          <el-input v-model="formData.mob.mob_app_scheme" show-password></el-input>
        </el-form-item>
      </div>
      <el-form-item class="ml-100" style="margin-top: 50px">
        <button class="blue-btn" @click.prevent="handleSubmit">提交</button>
        <button class="gray-btn ml-10" @click="resetQuery">重置</button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { getBasicSetting, getBasicCreate } from "@/api/basic-setting";
 


export default {
  data() {
    return {
      formData: {},
    };
  },
  mounted() {
    this.init();
  },
  methods: {
    init() {
      getBasicSetting().then((res) => {
        this.formData = res.data;
      });
    },

    handleSubmit() {
      getBasicCreate( this.formData ).then(res => {

          this.$message.success('保存成功')
          this.init()

      }).catch(err=>{
        return
      })
    },
    resetQuery() {
      this.$refs.formData.resetFields();
    },
  },
};
</script>

<style lang="scss" scoped>
.basic-box {
  width: 80%;
  box-sizing: border-box;
  padding: 63px 0 0px 150px;
  .basic-title {
    color: #333333;
    font-size: 16px;
    padding-left: 10px;
    height: 16px;
    line-height: 16px;
    border-left: #1890ff 5px solid;
    font-weight: bold;
    margin-bottom: 30px;
    margin-left: 50px;
  }
}
</style>
