Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIHugging Face LMArena Human Preference 140K

请写一个邮件前端界面,实现发邮件收邮件功能(这个功能可以不体现,我会适配后端接口)要求只包括html,你的设计应该有美感

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-3-7-sonnet-20250219-thinking-32k’s answer.
  1. User

    请写一个邮件前端界面,实现发邮件收邮件功能(这个功能可以不体现,我会适配后端接口)要求只包括html,你的设计应该有美感

  2. Assistant

    当然可以!下面是一个简洁且美观的邮件前端界面示例,包含“发邮件”和“收邮件”两个主要模块。功能按钮和输入框都设计得简洁现代,方便你后续接入后端接口。

    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>邮件系统</title>
    <style>
      @import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
    
      * {
        box-sizing: border-box;
      }
    
      body {
        margin: 0;
        font-family: 'Roboto', sans-serif;
        background: #f5f7fa;
        color: #333;
      }
    
      header {
        background: #4a90e2;
        color: white;
        padding: 1.5rem 2rem;
        text-align: center;
        font-size: 1.8rem;
        font-weight: 700;
        letter-spacing: 1px;
      }
    
      main {
        max-width: 900px;
        margin: 2rem auto;
        background: white;
        border-radius: 8px;
        box-shadow: 0 8px 20px rgb(0 0 0 / 0.1);
        display: flex;
        gap: 2rem;
        padding: 2rem;
      }
    
      section {
        flex: 1;
        display: flex;
        flex-direction: column;
      }
    
      h2 {
        margin-bottom: 1rem;
        color: #4a90e2;
        border-bottom: 2px solid #4a90e2;
        padding-bottom: 0.3rem;
      }
    
      label {
        font-weight: 600;
        margin-top: 1rem;
        margin-bottom: 0.3rem;
      }
    
      input[type="text"],
      input[type="email"],
      textarea {
        width: 100%;
        padding: 0.6rem 0.8rem;
        border: 1.5px solid #ccc;
        border-radius: 5px;
        font-size: 1rem;
        transition: border-color 0.3s ease;
      }
    
      input[type="text"]:focus,
      input[type="email"]:focus,
      textarea:focus {
        border-color: #4a90e2;
        outline: none;
      }
    
      textarea {
        resize: vertical;
        min-height: 120px;
      }
    
      button {
        margin-top: 1.5rem;
        background: #4a90e2;
        color: white;
        border: none;
        padding: 0.8rem 1.5rem;
        font-size: 1.1rem;
        border-radius: 5px;
        cursor: pointer;
        align-self: flex-start;
        transition: background-color 0.3s ease;
      }
    
      button:hover {
        background: #357abd;
      }
    
      /* 收邮件列表 */
      .email-list {
        flex: 1;
        overflow-y: auto;
        border: 1px solid #ddd;
        border-radius: 5px;
        padding: 1rem;
        background: #fafafa;
      }
    
      .email-item {
        padding: 0.8rem 1rem;
        border-bottom: 1px solid #ddd;
        cursor: pointer;
        transition: background-color 0.2s ease;
      }
    
      .email-item:last-child {
        border-bottom: none;
      }
    
      .email-item:hover {
        background-color: #e6f0ff;
      }
    
      .email-subject {
        font-weight: 600;
        color: #333;
      }
    
      .email-sender {
        font-size: 0.9rem;
        color: #666;
      }
    
      .email-snippet {
        font-size: 0.85rem;
        color: #999;
        margin-top: 0.2rem;
      }
    
      /* 邮件详情 */
      .email-detail {
        margin-top: 1rem;
        padding: 1rem;
        border: 1px solid #ddd;
        border-radius: 5px;
        background: white;
        max-height: 300px;
        overflow-y: auto;
      }
    
      .email-detail h3 {
        margin-top: 0;
        color: #4a90e2;
      }
    
      /* 响应式 */
      @media (max-width: 768px) {
        main {
          flex-direction: column;
        }
      }
    </style>
    </head>
    <body>
    
    <header>邮件系统</header>
    
    <main>
      <!-- 发邮件 -->
      <section aria-label="发邮件">
        <h2>发邮件</h2>
        <form id="sendEmailForm" onsubmit="return false;">
          <label for="to">收件人</label>
          <input type="email" id="to" name="to" placeholder="example@domain.com" required />
    
          <label for="subject">主题</label>
          <input type="text" id="subject" name="subject" placeholder="邮件主题" required />
    
          <label for="body">内容</label>
          <textarea id="body" name="body" placeholder="请输入邮件内容..." required></textarea>
    
          <button type="submit">发送</button>
        </form>
      </section>
    
      <!-- 收邮件 -->
      <section aria-label="收邮件">
        <h2>收邮件</h2>
        <div class="email-list" id="emailList" tabindex="0" aria-live="polite" aria-relevant="additions">
          <!-- 邮件列表示例 -->
          <div class="email-item" tabindex="0" role="button" aria-pressed="false" onclick="showEmailDetail(0)">
            <div class="email-subject">欢迎使用邮件系统</div>
            <div class="email-sender">support@domain.com</div>
            <div class="email-snippet">感谢您注册我们的邮件系统,祝您使用愉快!</div>
          </div>
          <div class="email-item" tabindex="0" role="button" aria-pressed="false" onclick="showEmailDetail(1)">
            <div class="email-subject">系统通知</div>
            <div class="email-sender">no-reply@domain.com</div>
            <div class="email-snippet">您的密码已成功修改。</div>
          </div>
        </div>
    
        <div class="email-detail" id="emailDetail" aria-live="polite" aria-atomic="true" hidden>
          <!-- 邮件详情显示区域 -->
        </div>
      </section>
    </main>
    
    <script>
      // 模拟邮件数据
      const emails = [
        {
          subject: "欢迎使用邮件系统",
          sender: "support@domain.com",
          body: "感谢您注册我们的邮件系统,祝您使用愉快!"
        },
        {
          subject: "系统通知",
          sender: "no-reply@domain.com",
          body: "您的密码已成功修改。"
        }
      ];
    
      const emailDetailEl = document.getElementById('emailDetail');
    
      function showEmailDetail(index) {
        const email = emails[index];
        emailDetailEl.hidden = false;
        emailDetailEl.innerHTML = `
          <h3>${email.subject}</h3>
          <p><strong>发件人:</strong>${email.sender}</p>
          <p>${email.body.replace(/\n/g, '<br>')}</p>
        `;
      }
    
      // 发送邮件按钮事件示例(你可以替换为实际接口调用)
      document.getElementById('sendEmailForm').addEventListener('submit', () => {
        const to = document.getElementById('to').value.trim();
        const subject = document.getElementById('subject').value.trim();
        const body = document.getElementById('body').value.trim();
    
        if (!to || !subject || !body) {
          alert('请填写完整的邮件信息');
          return;
        }
    
        // 这里调用后端接口发送邮件
        alert(`邮件已发送给 ${to},主题:${subject}`);
    
        // 清空表单
        document.getElementById('sendEmailForm').reset();
      });
    </script>
    
    </body>
    </html>
    

    说明:

    • 整体布局:左右两栏,左边是发邮件表单,右边是收邮件列表和邮件详情。
    • 样式设计:使用蓝色主色调,简洁现代,输入框和按钮有交互反馈。
    • 无后端依赖:邮件列表用模拟数据展示,点击邮件显示详情。
    • 无功能实现:发送邮件按钮只是弹窗提示,方便你后续接入真实接口。
    • 响应式:在窄屏设备下自动垂直排列。

    你可以直接保存为 .html 文件打开查看效果,后续只需替换 JS 部分调用你的后端接口即可。需要我帮你写接口调用示例也可以告诉我!

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.