feat: add animated choice modes and bracket editor
Verify mini program and deploy preview / verify-deploy (push) Successful in 50s
Verify mini program and deploy preview / verify-deploy (push) Successful in 50s
This commit is contained in:
+27
-22
@@ -1,23 +1,28 @@
|
||||
.home { padding-bottom: 70rpx; }
|
||||
.hero { position: relative; overflow: hidden; background: #ff6b35; color: #fff; border-radius: 36rpx; padding: 40rpx 34rpx 34rpx; box-shadow: 0 18rpx 50rpx rgba(168, 65, 25, .18); }
|
||||
.hero-row { display: flex; justify-content: space-between; align-items: flex-start; }
|
||||
.eyebrow { font-size: 21rpx; letter-spacing: 4rpx; opacity: .8; }
|
||||
.title { width: 480rpx; margin-top: 18rpx; font-size: 58rpx; line-height: 1.05; font-weight: 900; }
|
||||
.hero-copy { margin-top: 42rpx; width: 480rpx; font-size: 27rpx; line-height: 1.6; opacity: .92; }
|
||||
.me-button { margin: 0; padding: 0 24rpx; min-width: 0; height: 64rpx; line-height: 64rpx; font-size: 25rpx; border-radius: 999rpx; background: rgba(255,255,255,.2); color: #fff; }
|
||||
.hero-stickers { margin-top: 30rpx; display: flex; justify-content: space-between; font-size: 30rpx; font-weight: 800; }
|
||||
.section-head { display: flex; justify-content: space-between; margin: 48rpx 6rpx 24rpx; font-size: 30rpx; font-weight: 800; }
|
||||
.section-head .muted { font-size: 24rpx; font-weight: 500; }
|
||||
.waterfall { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-gap: 22rpx; align-items: start; }
|
||||
.test-card { overflow: hidden; background: #fff; border-radius: 28rpx; box-shadow: 0 9rpx 30rpx rgba(62, 42, 30, .08); }
|
||||
.test-card:active { transform: scale(.98); }
|
||||
.card-art { position: relative; height: 250rpx; overflow: hidden; }
|
||||
.card-1 .card-art { height: 310rpx; }
|
||||
.card-number { position: absolute; left: 20rpx; top: 18rpx; color: rgba(255,255,255,.8); font-size: 22rpx; font-weight: 800; }
|
||||
.card-emoji { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%) rotate(-8deg); font-size: 112rpx; }
|
||||
.card-body { padding: 24rpx; }
|
||||
.card-title { font-size: 30rpx; font-weight: 900; }
|
||||
.card-copy { margin-top: 12rpx; color: #746a63; font-size: 23rpx; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
|
||||
.card-meta { margin-top: 22rpx; display: flex; justify-content: space-between; color: #9a8e86; font-size: 20rpx; }
|
||||
.home { padding: 22rpx 18rpx 180rpx; background: #fff; }
|
||||
.mast { display: flex; align-items: center; gap: 16rpx; padding: 8rpx 4rpx 22rpx; }
|
||||
.logo-mark { position: relative; display: grid; place-items: center; width: 72rpx; height: 58rpx; overflow: hidden; background: #111; color: #fff; font-size: 24rpx; font-weight: 950; letter-spacing: -2rpx; }
|
||||
.logo-cut { position: absolute; left: 25rpx; top: -18rpx; width: 28rpx; height: 28rpx; border: 8rpx solid #fff; border-radius: 50%; }
|
||||
.logo-word { font-size: 31rpx; font-weight: 950; letter-spacing: 2rpx; }
|
||||
.search { display: flex; align-items: center; height: 72rpx; margin-bottom: 20rpx; padding: 0 24rpx; background: #f3f3f3; border-radius: 8rpx; }
|
||||
.search-icon { margin-right: 14rpx; font-size: 38rpx; transform: rotate(-20deg); }
|
||||
.search input { flex: 1; font-size: 27rpx; }
|
||||
.waterfall { column-count: 2; column-gap: 10rpx; }
|
||||
.test-card { display: inline-block; width: 100%; margin: 0 0 18rpx; overflow: hidden; break-inside: avoid; background: #fff; }
|
||||
.test-card:active { opacity: .78; transform: scale(.985); }
|
||||
.card-art { display: block; width: 100%; height: 360rpx; background: #eee; }
|
||||
.card-1 .card-art { height: 430rpx; }
|
||||
.card-2 .card-art { height: 390rpx; }
|
||||
.card-body { padding: 16rpx 8rpx 10rpx; }
|
||||
.card-title { font-size: 28rpx; font-weight: 850; }
|
||||
.card-copy { margin-top: 8rpx; color: #555; font-size: 22rpx; line-height: 1.42; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
|
||||
.card-meta { margin-top: 12rpx; display: flex; justify-content: space-between; color: #999; font-size: 19rpx; }
|
||||
.retry { margin-top: 24rpx; width: 240rpx; font-size: 24rpx; }
|
||||
|
||||
.bottom-nav { position: fixed; z-index: 20; left: 28rpx; right: 28rpx; bottom: calc(24rpx + env(safe-area-inset-bottom)); display: flex; height: 104rpx; padding: 0 18rpx; border-radius: 20rpx; background: #080808; box-shadow: 0 18rpx 50rpx rgba(0,0,0,.22); }
|
||||
.nav-item { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #888; font-size: 18rpx; }
|
||||
.nav-item.active { color: #fff; }
|
||||
.nav-item.active:before { content: ''; position: absolute; top: -25rpx; width: 94rpx; height: 94rpx; border: 14rpx solid #fff; border-radius: 50%; background: #080808; }
|
||||
.nav-icon { z-index: 1; width: 26rpx; height: 26rpx; margin-bottom: 7rpx; border: 5rpx solid currentColor; }
|
||||
.home-icon { transform: rotate(45deg); border-radius: 5rpx; }
|
||||
.discover-icon { border-radius: 50%; border-width: 6rpx 2rpx; }
|
||||
.me-icon { border-radius: 50%; }
|
||||
.nav-item text { z-index: 1; }
|
||||
|
||||
+10
-2
@@ -1,13 +1,13 @@
|
||||
var api = require('../../utils/api');
|
||||
|
||||
Page({
|
||||
data: { tests: [], loading: true, error: '' },
|
||||
data: { tests: [], visibleTests: [], keyword: '', loading: true, error: '' },
|
||||
onLoad: function () { this.loadTests(); },
|
||||
onPullDownRefresh: function () { this.loadTests(true); },
|
||||
loadTests: function (refreshing) {
|
||||
var self = this;
|
||||
api.request('/api/v1/tests').then(function (tests) {
|
||||
self.setData({ tests: tests, loading: false, error: '' });
|
||||
self.setData({ tests: tests, visibleTests: tests, loading: false, error: '' });
|
||||
}).catch(function (error) {
|
||||
self.setData({ loading: false, error: error.message || '加载失败' });
|
||||
}).then(function () {
|
||||
@@ -19,5 +19,13 @@ Page({
|
||||
openTest: function (event) {
|
||||
xhs.navigateTo({ url: '/pages/test/test?slug=' + event.currentTarget.dataset.slug });
|
||||
},
|
||||
search: function (event) {
|
||||
var keyword = (event.detail.value || '').trim().toLowerCase();
|
||||
var visible = this.data.tests.filter(function (item) {
|
||||
return (item.title + ' ' + item.subtitle).toLowerCase().indexOf(keyword) >= 0;
|
||||
});
|
||||
this.setData({ keyword: keyword, visibleTests: visible });
|
||||
},
|
||||
openDiscover: function () { xhs.navigateTo({ url: '/pages/discover/discover' }); },
|
||||
openMe: function () { xhs.navigateTo({ url: '/pages/me/me' }); }
|
||||
});
|
||||
|
||||
+10
-18
@@ -1,29 +1,21 @@
|
||||
<view class="page home">
|
||||
<view class="hero">
|
||||
<view class="hero-row">
|
||||
<view>
|
||||
<view class="eyebrow">TASTE LAB · 01</view>
|
||||
<view class="title">今天,认真选一个。</view>
|
||||
</view>
|
||||
<button class="me-button" bindtap="openMe">我的</button>
|
||||
</view>
|
||||
<view class="hero-copy">没有“都可以”。每轮只选一个,让你的偏爱一路赢到底。</view>
|
||||
<view class="hero-stickers"><text>✦</text><text>二选一</text><text>↗</text></view>
|
||||
</view>
|
||||
<view class="section-head"><text>全部测试</text><text class="muted">{{tests.length}} 个题库</text></view>
|
||||
<view class="mast"><view class="logo-mark"><view class="logo-cut"></view><text>PK</text></view><view class="logo-word">偏爱研究所</view></view>
|
||||
<view class="search"><text class="search-icon">⌕</text><input placeholder="搜索测试" bindinput="search" value="{{keyword}}" /></view>
|
||||
<view xhs:if="{{loading}}" class="empty">正在摆好擂台…</view>
|
||||
<view xhs:elif="{{error}}" class="empty">{{error}}<button class="retry" bindtap="loadTests">再试一次</button></view>
|
||||
<view xhs:else class="waterfall">
|
||||
<view xhs:for="{{tests}}" xhs:key="slug" class="test-card card-{{index % 3}}" data-slug="{{item.slug}}" bindtap="openTest">
|
||||
<view class="card-art" style="background: {{item.accent}}">
|
||||
<text class="card-number">0{{index + 1}}</text><text class="card-emoji">{{item.emoji}}</text>
|
||||
</view>
|
||||
<view xhs:for="{{visibleTests}}" xhs:key="slug" class="test-card card-{{index % 3}}" data-slug="{{item.slug}}" bindtap="openTest">
|
||||
<image class="card-art" src="/assets/test-covers/{{item.slug}}.jpg" mode="aspectFill" />
|
||||
<view class="card-body">
|
||||
<view class="card-title">{{item.title}}</view>
|
||||
<view class="card-copy">{{item.subtitle}}</view>
|
||||
<view class="card-meta"><text>{{item.candidate_count}} 强</text><text>{{item.run_count}} 人完成 →</text></view>
|
||||
<view class="card-meta"><text>{{item.candidate_count}} 强</text><text>{{item.run_count}} 人完成</text></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-nav">
|
||||
<view class="nav-item active"><view class="nav-icon home-icon"></view><text>测试</text></view>
|
||||
<view class="nav-item" bindtap="openDiscover"><view class="nav-icon discover-icon"></view><text>发现</text></view>
|
||||
<view class="nav-item" bindtap="openMe"><view class="nav-icon me-icon"></view><text>我的</text></view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user