<template>
  <div class="register-page-container">
    <!-- 页面头部 -->
    <div class="page-header">
      <div class="page-title">
        <h1 class="main-title">用户注册</h1>
        <p class="subtitle">您的专属彩票数据助理</p>
      </div>
    </div>

    <!-- 注册表单 -->
    <el-card class="register-form-container" shadow="never">
      <form @submit.prevent="handleRegister" class="register-form">
        <!-- 账号 -->
        <div class="form-group">
          <el-input
              v-model="formData.username"
              placeholder="请输入账号"
            :error="errors.username"
            prefix-icon="User"
            size="large"
              @blur="validateUsername"
            clearable
            />
          <div v-if="errors.username" class="error-text">{{ errors.username }}</div>
        </div>

        <!-- 昵称 -->
        <div class="form-group">
          <el-input
              v-model="formData.nickname"
              placeholder="请输入昵称"
            :error="errors.nickname"
            prefix-icon="Avatar"
            size="large"
              @blur="validateNickname"
            clearable
            />
          <div v-if="errors.nickname" class="error-text">{{ errors.nickname }}</div>
        </div>

        <!-- 手机号和发送验证码按钮 -->
        <div class="form-group">
          <div class="phone-code-row">
            <el-input
                v-model="formData.phone"
                type="tel" 
                placeholder="请输入手机号"
              :error="errors.phone"
              prefix-icon="Iphone"
              size="large"
                maxlength="11"
                @input="validatePhoneInput"
                @blur="validatePhoneOnBlur"
              clearable
              class="phone-input"
              />
            <el-button
              type="primary"
              :disabled="codeBtnDisabled"
              @click="sendVerificationCode"
              class="send-code-btn-inline"
              size="large"
            >
              {{ codeButtonText }}
            </el-button>
          </div>
          <div v-if="errors.phone" class="error-text">{{ errors.phone }}</div>
          <div v-else-if="formData.phone && formData.phone.length > 0 && formData.phone.length < 11" class="tip-text">请输入11位手机号码</div>
        </div>

        <!-- 验证码 -->
        <div class="form-group">
          <el-input
              v-model="formData.code"
              placeholder="请输入验证码"
            prefix-icon="Key"
            size="large"
            maxlength="6"
              @blur="validateCode"
          />
          <div v-if="errors.code" class="error-text">{{ errors.code }}</div>
        </div>

        <!-- 密码 -->
        <div class="form-group">
          <el-input
              v-model="formData.password"
              placeholder="请输入密码"
            :error="errors.password"
            prefix-icon="Lock"
            size="large"
            :type="showPassword ? 'text' : 'password'"
            :show-password="true"
              autocomplete="new-password"
              @blur="validatePassword"
            />
          <div v-if="errors.password" class="error-text">{{ errors.password }}</div>
        </div>

        <!-- 确认密码 -->
        <div class="form-group">
          <el-input
              v-model="formData.confirmPassword"
              placeholder="请确认密码"
            :error="errors.confirmPassword"
            prefix-icon="Lock"
            size="large"
            :type="showConfirmPassword ? 'text' : 'password'"
            :show-password="true"
              autocomplete="new-password"
              @blur="validateConfirmPassword"
            />
          <div v-if="errors.confirmPassword" class="error-text">{{ errors.confirmPassword }}</div>
        </div>

        <!-- 服务条款 -->
        <div class="form-group">
          <el-checkbox v-model="formData.agreeTerms" class="checkbox-custom">
            我已阅读并同意
            <span class="terms-link" @click.stop="showTerms">《会员服务协议》</span>
            <span class="terms-link" @click.stop="showPrivacyPolicy">《个人信息收集与处理规则》</span>
          </el-checkbox>
          <div v-if="errors.agreeTerms" class="error-text">{{ errors.agreeTerms }}</div>
        </div>

        <!-- 注册按钮 -->
        <el-button
          type="primary"
          native-type="submit"
          :loading="loading"
          class="register-btn"
          size="large"
        >
          {{ loading ? '注册中...' : '立即注册' }}
        </el-button>

        <!-- 登录链接 -->
        <div class="login-link">
          <span>已有账号？</span>
          <router-link to="/login" class="link">立即登录</router-link>
        </div>
      </form>
    </el-card>
  </div>
</template>

<script>
import { userStore } from '../store/user'
import { lotteryApi } from '../api/index.js'
import { useToast } from 'vue-toastification'
import { useRouter } from 'vue-router'
import { ElCard, ElInput, ElButton, ElCheckbox } from 'element-plus'
import { User, Lock, Iphone, Key, Avatar } from '@element-plus/icons-vue'

export default {
  name: 'Register',
  components: {
    ElCard,
    ElInput,
    ElButton,
    ElCheckbox,
    User,
    Lock,
    Iphone,
    Key,
    Avatar
  },
  setup() {
    const toast = useToast()
    const router = useRouter()
    return { toast, router }
  },
  data() {
    return {
      showPassword: false,
      showConfirmPassword: false,
      loading: false,

      codeCountdown: 0,
      timer: null,
      saveTimer: null, // 用于防抖保存的定时器
      showPhoneError: false,
      phoneValid: false,
      
      formData: {
        username: '',
        nickname: '',
        password: '',
        confirmPassword: '',
        phone: '',
        code: '',
        agreeTerms: false
      },
      
      errors: {}
    }
  },
  computed: {
    codeButtonText() {
      return this.codeCountdown > 0 ? `${this.codeCountdown}秒后重试` : '获取验证码';
    },
    codeBtnDisabled() {
      return this.codeCountdown > 0 || !this.isValidPhone(this.formData.phone);
    }
  },
  methods: {
    // 手机号格式验证
    isValidPhone(phone) {
      return /^1[3-9]\d{9}$/.test(phone);
    },
    
    // 手机号输入时验证
    validatePhoneInput() {
      // 清除之前的错误
      this.errors.phone = '';
      this.showPhoneError = false;
      this.phoneValid = false;
      
      const phone = this.formData.phone;
      
      // 如果输入不是数字，替换非数字字符
      if (!/^\d*$/.test(phone)) {
        this.formData.phone = phone.replace(/\D/g, '');
      }
      
      // 如果长度达到11位，验证格式
      if (phone.length === 11) {
        if (this.isValidPhone(phone)) {
          this.phoneValid = true;
        } else {
          this.errors.phone = '手机号格式不正确';
          this.showPhoneError = true;
        }
      }
    },
    
    // 手机号失焦时验证
    validatePhoneOnBlur() {
      const phone = this.formData.phone;
      
      if (phone && phone.length > 0) {
        if (phone.length !== 11) {
          this.errors.phone = '手机号应为11位数字';
          this.showPhoneError = true;
          this.phoneValid = false;
        } else if (!this.isValidPhone(phone)) {
          this.errors.phone = '请输入正确的手机号码';
          this.showPhoneError = true;
          this.phoneValid = false;
        } else {
          this.phoneValid = true;
        }
      }
    },
    
    // 发送验证码
    async sendVerificationCode() {
      if (!this.formData.phone) {
        this.errors.phone = '请输入手机号';
        this.showPhoneError = true;
        this.phoneValid = false;
        return;
      }
      
      if (!this.isValidPhone(this.formData.phone)) {
        this.errors.phone = '请输入正确的手机号码';
        this.showPhoneError = true;
        this.phoneValid = false;
        return;
      }
      
      this.phoneValid = true;
      
      try {
        // 开始倒计时 (先启动倒计时，避免API延迟导致用户体验不佳)
        this.codeCountdown = 60;
        this.startCodeCountdown();
        
        const response = await lotteryApi.sendSmsCode(this.formData.phone);
        
        if (!response.success) {
          // 如果发送失败，停止倒计时
          this.codeCountdown = 0;
          clearInterval(this.timer);
          this.toast.error(response.message || '发送验证码失败，请稍后重试');
        }
      } catch (error) {
        // 如果发送出错，停止倒计时
        this.codeCountdown = 0;
        clearInterval(this.timer);
        console.error('发送验证码失败:', error);
        this.toast.error('发送验证码失败，请稍后重试');
      }
    },
    
    // 开始倒计时
    startCodeCountdown() {
      if (this.timer) {
        clearInterval(this.timer);
      }
      
      this.timer = setInterval(() => {
        if (this.codeCountdown > 0) {
          this.codeCountdown--;
        } else {
          clearInterval(this.timer);
          this.timer = null;
        }
      }, 1000);
    },
    
    // 验证账号
    validateUsername() {
      if (!this.formData.username) {
        this.errors.username = '请输入账号';
      } else if (this.formData.username.length < 3 || this.formData.username.length > 20) {
        this.errors.username = '账号长度为3-20个字符';
      } else if (!/^[a-zA-Z0-9_]+$/.test(this.formData.username)) {
        this.errors.username = '账号只能包含字母、数字和下划线';
      } else {
        delete this.errors.username;
      }
    },

    // 验证昵称
    validateNickname() {
      if (!this.formData.nickname) {
        this.errors.nickname = '请输入昵称';
      } else if (this.formData.nickname.length < 2 || this.formData.nickname.length > 20) {
        this.errors.nickname = '昵称长度为2-20个字符';
      } else {
        delete this.errors.nickname;
      }
    },

    // 验证验证码
    validateCode() {
      if (!this.formData.code) {
        this.errors.code = '请输入验证码';
      } else if (this.formData.code.length < 4 || this.formData.code.length > 6) {
        this.errors.code = '验证码格式不正确';
      } else {
        delete this.errors.code;
      }
    },

    // 验证密码
    validatePassword() {
      if (!this.formData.password) {
        this.errors.password = '请输入密码';
      } else if (this.formData.password.length < 8 || this.formData.password.length > 20) {
        this.errors.password = '密码长度不小于8位';
      } else {
        delete this.errors.password;
      }
      // 如果确认密码有值，则重新校验
      if (this.formData.confirmPassword) {
        this.validateConfirmPassword();
      }
    },

    // 验证确认密码
    validateConfirmPassword() {
      if (!this.formData.confirmPassword) {
        this.errors.confirmPassword = '请确认密码';
      } else if (this.formData.password !== this.formData.confirmPassword) {
        this.errors.confirmPassword = '两次输入的密码不一致';
      } else {
        delete this.errors.confirmPassword;
      }
    },

    // 表单验证
    validateForm() {
      this.errors = {};
      
      this.validateUsername();
      this.validateNickname();
      this.validatePhoneOnBlur();
      this.validateCode();
      this.validatePassword();
      this.validateConfirmPassword();
      
      // 服务条款验证
      if (!this.formData.agreeTerms) {
        this.errors.agreeTerms = '请同意会员服务协议';
      }
      
      return Object.keys(this.errors).length === 0;
    },
    
    // 处理注册
    async handleRegister() {
      if (!this.validateForm()) {
        return;
      }
      
      this.loading = true;
      
      try {
        // 调用手机号注册接口
        const response = await lotteryApi.userPhoneRegister(
          this.formData.username,
          this.formData.password,
          this.formData.confirmPassword,
          this.formData.phone,
          this.formData.code,
          this.formData.nickname
        );
        
        if (response.success === true) {
          // 注册成功
          this.clearSavedFormData(); // 清除保存的表单数据
          this.toast.success('注册成功！请登录您的账号');
          this.router.push('/login');
        } else {
          // 注册失败
          this.toast.error(response.message || '注册失败，请稍后重试');
        }
        
      } catch (error) {
        console.error('注册失败:', error);
        if (error.response && error.response.data) {
          this.toast.error(error.response.data.message || '注册失败，请稍后重试');
        } else {
          this.toast.error('网络错误，请重试');
        }
      } finally {
        this.loading = false;
      }
    },
    
    // 保存表单数据到临时存储（带防抖）
    saveFormData(immediate = false) {
      // 如果不是立即保存，使用防抖
      if (!immediate) {
        if (this.saveTimer) {
          clearTimeout(this.saveTimer);
        }
        this.saveTimer = setTimeout(() => {
          this.doSaveFormData();
        }, 1000); // 1秒防抖
      } else {
        this.doSaveFormData();
      }
    },

    // 实际执行保存操作
    doSaveFormData() {
      const formData = {
        username: this.formData.username,
        nickname: this.formData.nickname,
        password: this.formData.password,
        confirmPassword: this.formData.confirmPassword,
        phone: this.formData.phone,
        code: this.formData.code,
        agreeTerms: this.formData.agreeTerms
      };
      sessionStorage.setItem('register_form_data', JSON.stringify(formData));
    },

    // 从临时存储恢复表单数据
    restoreFormData() {
      const savedData = sessionStorage.getItem('register_form_data');
      if (savedData) {
        try {
          const formData = JSON.parse(savedData);
          this.formData = { ...this.formData, ...formData };
          // 恢复手机号验证状态
          if (formData.phone && this.isValidPhone(formData.phone)) {
            this.phoneValid = true;
          }
        } catch (error) {
          console.warn('恢复表单数据失败:', error);
        }
      }
    },

    // 清除临时存储的表单数据
    clearSavedFormData() {
      sessionStorage.removeItem('register_form_data');
    },

    // 显示服务条款
    showTerms() {
      // 跳转前立即保存当前表单数据
      this.saveFormData(true);
      this.$router.push('/member-agreement');
    },

    // 显示隐私政策
    showPrivacyPolicy() {
      // 跳转前立即保存当前表单数据
      this.saveFormData(true);
      this.$router.push('/privacy-policy');
    }
  },
  // 监听表单数据变化，自动保存
  watch: {
    'formData': {
      handler(newFormData) {
        // 只有当表单有实际内容时才保存，避免保存空数据
        if (newFormData.username || newFormData.nickname || newFormData.phone || 
            newFormData.password || newFormData.code) {
          this.saveFormData();
        }
      },
      deep: true,
      // 延迟保存，避免频繁操作
      immediate: false
    }
  },
  // 组件挂载时恢复表单数据
  mounted() {
    this.restoreFormData();
  },
  // 组件销毁时清除定时器
  beforeUnmount() {
    if (this.timer) {
      clearInterval(this.timer);
      this.timer = null;
    }
    // 清除保存定时器
    if (this.saveTimer) {
      clearTimeout(this.saveTimer);
      this.saveTimer = null;
    }
  }
}
</script>

<style scoped>
/* 注册页面容器 */
.register-page-container {
  min-height: calc(100vh - 70px);
  background: #f0f2f5;
  padding: 20px 20px 8px 20px;
}

/* 页面头部 */
.page-header {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
  padding: 35px 20px 25px;
  text-align: center;
  position: relative;
  margin-bottom: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(238, 90, 82, 0.3);
}

.page-title {
  margin: 0;
  text-align: center;
}

.main-title {
  font-size: 32px;
  margin: 0 auto 4px;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 20px rgba(0,0,0,0.3);
  letter-spacing: 1px;
  text-align: center;
  width: 100%;
}

.subtitle {
  font-size: 16px;
  margin: 0;
  color: white;
  opacity: 0.95;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
  text-align: center;
  width: 100%;
  font-weight: 400;
}

/* 桌面端样式 */
@media (min-width: 1024px) {
  .page-header {
    padding: 30px 20px 25px;
  }
}

.register-form-container {
  padding: 0;
  background: white;
  margin: 0 0 20px 0;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.register-form {
  background: white;
  border-radius: 0;
  padding: 28px 24px 20px;
  box-shadow: none;
}

/* 表单组 */
.form-group {
  margin-bottom: 16px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  background: #f8f9fa;
  transition: all 0.3s ease;
  min-height: 56px;
  overflow: hidden;
}

.input-wrapper:focus-within {
  border-color: #e9ecef;
  background: white;
  box-shadow: none;
  outline: none;
}

.input-wrapper.error {
  border-color: #dc3545;
  background: #fff5f5;
}

.input-wrapper.success {
  border-color: #4caf50;
  background: #f8fff8;
}

.validation-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
}


.input-icon {
  padding: 12px 25px;
  color: #6c757d;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

.icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.form-input {
  flex: 1;
  padding: 16px 8px;
  border: none;
  outline: none;
  font-size: 16px;
  background: transparent;
  color: #212529;
  box-shadow: none;
  -webkit-appearance: none;
}

.form-input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

/* 控制浏览器自动填充的样式 */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px white inset !important;
  -webkit-text-fill-color: #212529 !important;
  transition: background-color 5000s ease-in-out 0s;
  border: none !important;
  outline: none !important;
}

/* 手机号和验证码按钮同行布局 */
.phone-code-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.phone-input {
  flex: 1;
}

/* 内联发送验证码按钮样式 */
.send-code-btn-inline {
  background: linear-gradient(135deg, #e53e3e, #ff6b6b);
  border: none;
  border-radius: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
  min-width: 120px;
  flex-shrink: 0;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.send-code-btn-inline:hover:not(.is-disabled) {
  background: linear-gradient(135deg, #d43030, #ff5a5a);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(229, 62, 62, 0.3);
}

.send-code-btn-inline:active:not(.is-disabled) {
  transform: translateY(0);
}

.send-code-btn-inline.is-disabled {
  background: #cccccc !important;
  border-color: #cccccc !important;
  color: #888 !important;
  transform: none !important;
  box-shadow: none !important;
}

/* 隐藏浏览器自带的密码控件 */
input::-ms-reveal,
input::-ms-clear {
  display: none;
}

input::-webkit-credentials-auto-fill-button {
  visibility: hidden;
  position: absolute;
  right: 0;
}

.form-input::placeholder {
  color: #9ca3af;
}

.password-toggle {
  padding: 0 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.error-text {
  color: #ff4444;
  font-size: 12px;
  margin-top: 5px;
  margin-left: 8px;
}

.tip-text {
  color: #888888;
  font-size: 12px;
  margin-top: 5px;
  margin-left: 8px;
}

/* 复选框 */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  color: #666;
}

.checkbox-wrapper input {
  display: none;
}

.checkmark {
  width: 16px;
  height: 16px;
  border: 1px solid #ddd;
  border-radius: 3px;
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  transition: all 0.3s;
  flex-shrink: 0;
}

.checkbox-wrapper input:checked + .checkmark {
  background: #e53e3e;
  border-color: #e53e3e;
  color: white;
}

.terms-link {
  color: #e53e3e;
  text-decoration: none;
  margin-left: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -khtml-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  outline: none !important;
  background-color: transparent !important;
  display: inline;
}

.terms-link:hover {
  text-decoration: underline;
}

.terms-link:active {
  background-color: transparent !important;
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* 注册按钮 */
.register-btn {
  width: 100%;
  margin: 8px 0 24px 0;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  height: 52px;
  background: linear-gradient(135deg, #e53e3e, #ff6b6b);
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(229, 62, 62, 0.25);
  transition: all 0.3s ease;
}

.register-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 30px rgba(229, 62, 62, 0.35);
  background: linear-gradient(135deg, #d43030, #ff5a5a);
  border: none;
}

.register-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(229, 62, 62, 0.3);
}

/* Element UI 组件自定义样式 */
:deep(.el-input__wrapper) {
  padding: 6px 16px;
  box-shadow: none !important;
  background-color: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 12px;
  transition: all 0.3s ease;
}

:deep(.el-input__wrapper.is-focus) {
  background-color: #fff;
  border-color: #e53e3e;
  box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.1);
}

:deep(.el-input__prefix) {
  margin-right: 12px;
  color: #999;
}

:deep(.el-input__inner) {
  height: 44px;
  font-size: 15px;
  color: #333;
}

:deep(.el-checkbox__label) {
  font-size: 14px;
  color: #666;
}

:deep(.el-checkbox__inner) {
  border-color: #ddd;
}

:deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
  background-color: #e53e3e;
  border-color: #e53e3e;
}


:deep(.el-button.is-disabled) {
  background: #cccccc;
  border-color: #cccccc;
}

/* 处理用户协议链接 */
.checkbox-custom {
  align-items: flex-start !important;
}

.checkbox-custom :deep(.el-checkbox__input) {
  margin-top: 4px;
}

.checkbox-custom :deep(.el-checkbox__label) {
  display: block;
  line-height: 1.8;
  white-space: normal;
  word-break: break-word;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  padding-top: 0;
}

.checkbox-custom :deep(.el-checkbox__label) * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none;
  background-color: transparent !important;
}

/* 登录链接 */
.login-link {
  text-align: center;
  font-size: 14px;
  color: #666;
}

.login-link .link {
  color: #e53e3e;
  text-decoration: none;
  margin-left: 5px;
}

.login-link .link:hover {
  text-decoration: underline;
}



/* 响应式设计 */
@media (max-width: 768px) {
  .register-page-container {
    padding: 10px 10px 5px 10px;
  }
  
  .page-header {
    padding: 30px 15px 25px;
  }
  
  .page-title {
    margin: 0;
  }

}

@media (max-width: 480px) {
  .register-page-container {
    padding: 5px 5px 3px 5px;
  }
  
  .page-header {
    padding: 30px 20px 25px;
    margin-bottom: 12px;
  }
  
  .page-title {
    margin: 0;
  }
  
  .main-title {
    font-size: 28px;
    margin-bottom: 3px;
    letter-spacing: 0.5px;
  }
  
  .subtitle {
    font-size: 14px;
  }
  
  .register-form {
    padding: 24px 20px 18px;
  }
  
  :deep(.el-input__inner) {
    height: 42px;
    font-size: 14px;
  }
  
  .register-btn {
    height: 48px;
    font-size: 15px;
    margin: 8px 0 20px 0;
  }
  
  .send-code-btn-inline {
    font-size: 12px;
    height: 42px;
    min-width: 90px;
    padding: 0 10px;
  }

  .phone-code-row {
    gap: 8px;
  }

  .checkbox-custom :deep(.el-checkbox__label) {
    font-size: 13px;
  }

  .terms-link {
    display: inline;
    margin: 0 2px;
  }
}

/* 桌面端样式 - 这部分已在上面定义，这里移除重复定义 */
</style>