js+css实现移动端相亲交友app的ui原型图代码

代码语言:html

所属分类:其他

代码描述:js+css实现移动端相亲交友app的ui原型图代码

代码标签: js css 移动端 相亲 交友 app ui 原型图 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>缘遇 - 相亲交友App</title>
    <style>
        /* --- 全局样式 --- */
        :root {
            --primary-color: #FF6B6B;
            --secondary-color: #4ECDC4;
            --text-color: #333;
            --bg-color: #f4f4f9;
            --light-gray: #e0e0e0;
            --white: #fff;
            --dark-gray: #555;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background-color: var(--bg-color);
            color: var(--text-color);
            overscroll-behavior-y: contain; /* 防止在移动设备上过度滚动 */
        }

        .page {
            display: none;
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100vh;
            overflow-y: auto;
            background-color: var(--bg-color);
            flex-direction: column;
        }

        .page.active {
            display: flex;
        }
        
        .main-content {
            flex-grow: 1;
            padding-bottom: 70px; /* 为底部导航栏留出空间 */
        }

        /* --- 登录/注册页样式 --- */
        .auth-container {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100%;
            padding: 20px;
        }

        .auth-container h1 {
            font-size: 2.5em;
            color: var(--primary-color);
            margin-bottom: 40px;
        }

        .form-group {
            margin-bottom: 20px;
            width: 100%;
            max-width: 320px;
        }

        .form-group input {
            width: 100%;
            padding: 15px;
            border: 1px solid var(--light-gray);
            border-radius: 8px;
            font-size: 1em;
        }

        .btn {
            width: 100%;
            max-width: 320px;
            padding: 15px;
            border: none;
            border-radius: 8px;
            background-color: var(--primary-color);
            color: var(--white);
            font-size: 1.1em;
            font-weight: bold;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .btn:hover {
            background-color: #e55a5a;
        }

        .auth-link {
            margin-top: 20px;
            color: var(--secondary-color);
            text-decoration: none;
            font-weight: bold;
        }
        
        /* --- 底部导航栏 --- */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 60px;
            background-color: var(--white);
            border-top: 1px solid var(--light-gray);
            display: flex;
            justify-content: space-around;
            align-items: center;
            z-index: 1000;
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            cursor: pointer;
            color: var(--dark-gray);
            position: relative;
        }
        
        .nav-item.active {
            color: var(--primary-color);
        }

        .nav-item svg {
            width: 24px;
            height: 24px;
            margin-bottom: 2px;
        }

        .nav-item span {
            font-size: 0.75em;
        }

        /* --- 发现页样式 --- */
        .discover-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 20px;
            height: 100%;
        }

        .card-stack {
            position: relative;
            width: 100%;
            max-width: 350px;
            height: 70vh;
            max-height: 500px;
            flex-grow: 1;
        }

        .user-card {
            position: absolute;
            width: 100%;
            height: 100%;
            background-color: var(--white);
            border-radius: 15px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.1);
            overflow: hidden;
            display: flex;
            flex-direction: column;
            user-select: none;
            cursor: pointer;
        }

        .user-card img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .card-info {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            padding: 20px;
            background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
            color: var(--white);
        }

        .card-info h2 {
            font-size: 1.8em;
            margin-bottom: 5px;
        }

        .card-info p {
            font-size: 1.1em;
        }

        .discover-actions {
            display: flex;
            justify-content: space-around;
            width: 100%;
            max-width: 300px;
            margin-top: 20px;
        }

        .action-btn {
            width: 70px;
            height: 70px;
            border-radius: 50%;
            border: 2px solid var(--light-gray);
            background-color: var(--white);
            display: flex;
            justify-content: center;
            align-items: center;
            cursor: pointer;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        .action-btn.dislike svg { color: #F44336; }
        .action-btn.like svg { color: #4CAF50; }
        .action-btn svg { width: 32px; height: 32px; }

        .no-more-cards {
            text-align: center;
            color: var(--dark-gray);
            font-size: 1.2em;
        }

        /* --- 消息列表页 --- */
        .header {
            background-color: var(--white);
            padding: 15px;
            font-size: 1.2em;
            font-weight: bold;
            text-align: center;
            border-bottom: 1px solid var(--light-gray);
            position: relative;
        }
        
        .back-btn {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            cursor: pointer;
            width: 24px;
            height: 24px;
        }

        .message-list {
            padding: 10px 0;
        }

        .message-item {
            display: flex;
            align-items: center;
            padding: 10px 15px;
            background-color: var(--white);
            border-bottom: 1px solid var(--light-gray);
            cursor: pointer;
        }
        
        .message-item:hover {
            background-color: #f9f9f9;
        }

        .message-item img {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            object-fit: cover;
            margin-right: 15px;
        }

        .message-content {
            flex-grow: 1;
            overflow: hidden;
        }

        .message-content h3 {
            font-size: 1.1em;
            margin-bottom: 4px;
        }

        .message-preview {
            color: var(--dark-gray);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        
        .no-messages {
            text-align: center;
            padding-top: 50px;
            color: var(--dark-gray);
        }

        /* --- 聊天详情页 --- */
        #chat-page .main-content {
            display: flex;
            flex-direction: column;
            height: calc(100vh - 51px); /* 100vh - header height */
            padding-bottom: 0;
        }
        
        .chat-container {
            flex-grow: 1;
            padding: 10px;
            overflow-y: auto;
            display: flex;
            flex-direction: column-reverse; /* 新消息在下面 */
        }
        
        .chat-bubbles-wrapper {
             display: flex;
             flex-direction: column;
        }

        .chat-bubble {
            max-width: 70%;
            padding: 10px 15px;
            border-radius: 18px;
            margin-bottom: 10px;
            word-wrap: break-word;
        }

        .chat-bubble.sent {
            background-color: var(--primary-color);
            color: var(--white);
          .........完整代码请登录后点击上方下载按钮下载查看

网友评论0