feat: 样式修改
This commit is contained in:
+83
-91
@@ -5,117 +5,109 @@ Page({
|
||||
data: {
|
||||
plant: null,
|
||||
activeImageIndex: 0,
|
||||
swiperList: []
|
||||
swiperList: [],
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const eventChannel = this.getOpenerEventChannel();
|
||||
let loadedFromEvent = false;
|
||||
|
||||
if (eventChannel && eventChannel.on) {
|
||||
eventChannel.on('acceptDataFromOpenerPage', (res) => {
|
||||
if (res.data) {
|
||||
this.setPlantData(res.data);
|
||||
loadedFromEvent = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (options.id) {
|
||||
this.loadPlantDetail(options.id);
|
||||
// Give event channel a chance to fire
|
||||
setTimeout(() => {
|
||||
if (!loadedFromEvent && !this.data.plant) {
|
||||
this.loadPlantDetail(options.id);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
|
||||
loadPlantDetail(id) {
|
||||
// Fetch detail via wiki/page with specific ID
|
||||
// Since there's no /wiki/detail endpoint, we use /wiki/page to get it
|
||||
request.post('/wiki/page', {
|
||||
current: 1,
|
||||
pageSize: 1,
|
||||
id: id
|
||||
}).then(res => {
|
||||
const data = res || {};
|
||||
const list = data.list || [];
|
||||
const item = list.length > 0 ? list[0] : null;
|
||||
request.get('/wiki/detail', { id: id }).then(res => {
|
||||
const item = res || null;
|
||||
|
||||
if (!item) {
|
||||
wx.showToast({ title: '未找到该植物', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
// Set Page Title
|
||||
wx.setNavigationBarTitle({ title: item.name });
|
||||
|
||||
// Prepare swiper list from imgList
|
||||
const swiperList = (item.imgList || []).map(img => img.url);
|
||||
|
||||
// Parse pest/disease list
|
||||
const commonPests = item.pestsDiseases
|
||||
? item.pestsDiseases.split(',').map(s => s.trim()).filter(Boolean)
|
||||
: [];
|
||||
|
||||
// Parse aliases
|
||||
const aliasesList = item.aliases
|
||||
? item.aliases.split(/[,,、]/).map(s => s.trim()).filter(Boolean)
|
||||
: [];
|
||||
|
||||
// Parse reproduction methods
|
||||
const reproductionList = item.reproductionMethod
|
||||
? item.reproductionMethod.split(/[,,、]/).map(s => s.trim()).filter(Boolean)
|
||||
: [];
|
||||
|
||||
// Difficulty label
|
||||
const diffLabels = { 1: '简单', 2: '中等', 3: '较难', 4: '困难', 5: '专家' };
|
||||
|
||||
// Map API data to display model
|
||||
const plant = {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
latinName: item.latinName || '',
|
||||
aliases: item.aliases || '',
|
||||
aliasesList: aliasesList,
|
||||
genus: item.genus || '',
|
||||
distributionArea: item.distributionArea || '',
|
||||
difficulty: item.difficulty || 0,
|
||||
difficultyLabel: diffLabels[item.difficulty] || '未知',
|
||||
isHot: item.isHot === 1,
|
||||
lifeCycle: item.lifeCycle || '',
|
||||
growthHabit: item.growthHabit || '',
|
||||
reproductionMethod: item.reproductionMethod || '',
|
||||
reproductionList: reproductionList,
|
||||
|
||||
// Light
|
||||
lightIntensity: item.lightIntensity || '',
|
||||
lightType: item.lightType || '',
|
||||
|
||||
// Temperature
|
||||
optimalTempPeriod: item.optimalTempPeriod || '',
|
||||
|
||||
// Morphology
|
||||
stem: item.stem || '',
|
||||
foliageType: item.foliageType || '',
|
||||
foliageColor: item.foliageColor || '',
|
||||
foliageShape: item.foliageShape || '',
|
||||
height: item.height || 0,
|
||||
|
||||
// Flowering
|
||||
floweringPeriod: item.floweringPeriod || '',
|
||||
floweringColor: item.floweringColor || '',
|
||||
floweringShape: item.floweringShape || '',
|
||||
flowerDiameter: item.flowerDiameter || 0,
|
||||
|
||||
// Fruit
|
||||
fruit: item.fruit || '',
|
||||
|
||||
// Pests
|
||||
pestsDiseases: item.pestsDiseases || '',
|
||||
commonPests: commonPests,
|
||||
|
||||
// Classes
|
||||
classes: (item.classes || []).map(c => c.name),
|
||||
|
||||
// Images
|
||||
imgList: item.imgList || []
|
||||
};
|
||||
|
||||
this.setData({
|
||||
plant: plant,
|
||||
swiperList: swiperList
|
||||
});
|
||||
this.setPlantData(item);
|
||||
}).catch(err => {
|
||||
console.error('Load plant detail failed', err);
|
||||
wx.showToast({ title: '加载失败', icon: 'none' });
|
||||
});
|
||||
},
|
||||
|
||||
setPlantData(item) {
|
||||
if (!item) return;
|
||||
|
||||
wx.setNavigationBarTitle({ title: item.name });
|
||||
|
||||
// Prepare swiper list
|
||||
const swiperList = (item.imgList || []).map(img => img.url);
|
||||
|
||||
// Parse lists
|
||||
const commonPests = item.pestsDiseases
|
||||
? item.pestsDiseases.split(',').map(s => s.trim()).filter(Boolean)
|
||||
: [];
|
||||
const aliasesList = item.aliases
|
||||
? item.aliases.split(/[,,、]/).map(s => s.trim()).filter(Boolean)
|
||||
: [];
|
||||
const reproductionList = item.reproductionMethod
|
||||
? item.reproductionMethod.split(/[,,、]/).map(s => s.trim()).filter(Boolean)
|
||||
: [];
|
||||
|
||||
const diffLabels = { 1: '简单', 2: '中等', 3: '较难', 4: '困难', 5: '专家' };
|
||||
|
||||
const plant = {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
latinName: item.latinName || '',
|
||||
aliases: item.aliases || '',
|
||||
aliasesList,
|
||||
genus: item.genus || '',
|
||||
distributionArea: item.distributionArea || '',
|
||||
difficulty: item.difficulty || 0,
|
||||
difficultyLabel: diffLabels[item.difficulty] || '未知',
|
||||
isHot: item.isHot === 1,
|
||||
lifeCycle: item.lifeCycle || '',
|
||||
growthHabit: item.growthHabit || '',
|
||||
reproductionMethod: item.reproductionMethod || '',
|
||||
reproductionList,
|
||||
lightIntensity: item.lightIntensity || '',
|
||||
lightType: item.lightType || '',
|
||||
optimalTempPeriod: item.optimalTempPeriod || '',
|
||||
stem: item.stem || '',
|
||||
foliageType: item.foliageType || '',
|
||||
foliageColor: item.foliageColor || '',
|
||||
foliageShape: item.foliageShape || '',
|
||||
height: item.height || 0,
|
||||
floweringPeriod: item.floweringPeriod || '',
|
||||
floweringColor: item.floweringColor || '',
|
||||
floweringShape: item.floweringShape || '',
|
||||
flowerDiameter: item.flowerDiameter || 0,
|
||||
fruit: item.fruit || '',
|
||||
pestsDiseases: item.pestsDiseases || '',
|
||||
commonPests,
|
||||
classes: (item.classes || []).map(c => c.name),
|
||||
imgList: item.imgList || []
|
||||
};
|
||||
|
||||
this.setData({
|
||||
plant,
|
||||
swiperList
|
||||
});
|
||||
},
|
||||
|
||||
onSwiperChange(e) {
|
||||
this.setData({
|
||||
activeImageIndex: e.detail.current
|
||||
|
||||
+181
-198
@@ -1,210 +1,193 @@
|
||||
<!--pages/wiki/detail/index.wxml-->
|
||||
<view class="wiki-detail" wx:if="{{plant}}">
|
||||
<!-- Header Area -->
|
||||
<!-- Image Carousel -->
|
||||
<view class="wd-header">
|
||||
<view class="wd-gallery-container">
|
||||
<t-swiper
|
||||
t-class="custom-swiper"
|
||||
current="{{activeImageIndex}}"
|
||||
bind:change="onSwiperChange"
|
||||
height="500rpx"
|
||||
list="{{swiperList}}"
|
||||
navigation="{{ { type: '' } }}"
|
||||
/>
|
||||
<view class="wd-gradient-overlay"></view>
|
||||
</view>
|
||||
|
||||
<!-- Custom Indicators -->
|
||||
<view class="wd-indicators" wx:if="{{swiperList.length > 1}}">
|
||||
<view
|
||||
wx:for="{{swiperList}}"
|
||||
wx:key="index"
|
||||
class="wd-dot {{index === activeImageIndex ? 'active' : ''}}"
|
||||
></view>
|
||||
</view>
|
||||
|
||||
<!-- Header Overlay Info -->
|
||||
<view class="wd-overlay">
|
||||
<view class="wd-title">
|
||||
<text class="wd-name">{{plant.name}}</text>
|
||||
<text class="wd-scientific">{{plant.latinName}}</text>
|
||||
</view>
|
||||
<view class="wd-badges">
|
||||
<text class="wd-badge" wx:if="{{plant.genus}}">{{plant.genus}}</text>
|
||||
<text class="wd-badge" wx:for="{{plant.classes}}" wx:key="*this">{{item}}</text>
|
||||
<text class="wd-badge">难度: {{plant.difficultyLabel}}</text>
|
||||
</view>
|
||||
<t-swiper
|
||||
t-class="custom-swiper"
|
||||
current="{{activeImageIndex}}"
|
||||
bind:change="onSwiperChange"
|
||||
height="480rpx"
|
||||
list="{{swiperList}}"
|
||||
navigation="{{ { type: '' } }}"
|
||||
/>
|
||||
<view class="wd-counter" wx:if="{{swiperList.length > 0}}">
|
||||
<text>{{activeImageIndex + 1}} / {{swiperList.length}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Content Area -->
|
||||
<view class="wd-content-wrapper">
|
||||
<scroll-view class="wd-content" scroll-y enhanced show-scrollbar="{{false}}">
|
||||
|
||||
<!-- Growth Habit Section -->
|
||||
<section class="wd-section" wx:if="{{plant.growthHabit}}">
|
||||
<view class="wd-card">
|
||||
<text class="wd-text">{{plant.growthHabit}}</text>
|
||||
</view>
|
||||
</section>
|
||||
|
||||
<!-- Basic Info Section -->
|
||||
<section class="wd-section">
|
||||
<view class="section-title">
|
||||
<t-icon name="info-circle" size="40rpx" color="#558B2F" />
|
||||
<text>基础档案</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<view class="wd-grid">
|
||||
<view class="wd-stat-item" wx:if="{{plant.distributionArea}}">
|
||||
<text class="wd-label">分布区域</text>
|
||||
<text class="wd-value">{{plant.distributionArea}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.aliases}}">
|
||||
<text class="wd-label">别名</text>
|
||||
<text class="wd-value">{{plant.aliases}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.lifeCycle}}">
|
||||
<text class="wd-label">生命周期</text>
|
||||
<text class="wd-value">{{plant.lifeCycle === 'perennial' ? '多年生' : (plant.lifeCycle === 'annual' ? '一年生' : plant.lifeCycle)}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.height}}">
|
||||
<text class="wd-label">株高</text>
|
||||
<text class="wd-value">约 {{plant.height}} cm</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</section>
|
||||
|
||||
<!-- Care Guide Section -->
|
||||
<section class="wd-section">
|
||||
<view class="section-title">
|
||||
<t-icon name="sunny" size="40rpx" color="#558B2F" />
|
||||
<text>养护指南</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<!-- Light -->
|
||||
<view class="requirement-item" wx:if="{{plant.lightIntensity}}">
|
||||
<view class="req-icon">
|
||||
<t-icon name="sunny" size="40rpx" color="#558B2F" />
|
||||
</view>
|
||||
<view class="req-content">
|
||||
<text class="req-title">光照</text>
|
||||
<text class="req-desc">{{plant.lightIntensity}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Temperature -->
|
||||
<view class="requirement-item" wx:if="{{plant.optimalTempPeriod}}">
|
||||
<view class="req-icon">
|
||||
<t-icon name="pin" size="40rpx" color="#558B2F" />
|
||||
</view>
|
||||
<view class="req-content">
|
||||
<text class="req-title">适宜温度</text>
|
||||
<text class="req-desc">{{plant.optimalTempPeriod}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Reproduction -->
|
||||
<view class="requirement-item" wx:if="{{plant.reproductionMethod}}">
|
||||
<view class="req-icon">
|
||||
<t-icon name="fork-node" size="40rpx" color="#558B2F" />
|
||||
</view>
|
||||
<view class="req-content">
|
||||
<text class="req-title">繁殖方式</text>
|
||||
<text class="req-desc">{{plant.reproductionMethod}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</section>
|
||||
|
||||
<!-- Morphology Section -->
|
||||
<section class="wd-section" wx:if="{{plant.stem || plant.foliageShape || plant.foliageColor}}">
|
||||
<view class="section-title">
|
||||
<t-icon name="tree-round-dot" size="40rpx" color="#558B2F" />
|
||||
<text>形态特征</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<view class="wd-grid">
|
||||
<view class="wd-stat-item" wx:if="{{plant.stem}}">
|
||||
<text class="wd-label">茎</text>
|
||||
<text class="wd-value">{{plant.stem}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.foliageShape}}">
|
||||
<text class="wd-label">叶形</text>
|
||||
<text class="wd-value">{{plant.foliageShape}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.foliageColor}}">
|
||||
<text class="wd-label">叶色</text>
|
||||
<text class="wd-value">{{plant.foliageColor}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.foliageType}}">
|
||||
<text class="wd-label">叶质</text>
|
||||
<text class="wd-value">{{plant.foliageType}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</section>
|
||||
|
||||
<!-- Flowering Section -->
|
||||
<section class="wd-section" wx:if="{{plant.floweringPeriod || plant.floweringColor}}">
|
||||
<view class="section-title">
|
||||
<t-icon name="flower" size="40rpx" color="#558B2F" />
|
||||
<text>开花信息</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<view class="wd-grid">
|
||||
<view class="wd-stat-item" wx:if="{{plant.floweringPeriod}}">
|
||||
<text class="wd-label">花期</text>
|
||||
<text class="wd-value">{{plant.floweringPeriod}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.floweringColor}}">
|
||||
<text class="wd-label">花色</text>
|
||||
<text class="wd-value">{{plant.floweringColor}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.floweringShape}}">
|
||||
<text class="wd-label">花型</text>
|
||||
<text class="wd-value">{{plant.floweringShape}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.flowerDiameter}}">
|
||||
<text class="wd-label">花径</text>
|
||||
<text class="wd-value">约 {{plant.flowerDiameter}} mm</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</section>
|
||||
|
||||
<!-- Fruit Section -->
|
||||
<section class="wd-section" wx:if="{{plant.fruit}}">
|
||||
<view class="section-title">
|
||||
<t-icon name="apple" size="40rpx" color="#558B2F" />
|
||||
<text>果实</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<text class="wd-text">{{plant.fruit}}</text>
|
||||
</view>
|
||||
</section>
|
||||
|
||||
<!-- Pests & Diseases Section -->
|
||||
<section class="wd-section" wx:if="{{plant.commonPests.length > 0}}">
|
||||
<view class="section-title">
|
||||
<t-icon name="error-circle" size="40rpx" color="#558B2F" />
|
||||
<text>常见病虫害</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<view class="pest-tags">
|
||||
<text wx:for="{{plant.commonPests}}" wx:key="*this" class="pest-tag">{{item}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</section>
|
||||
|
||||
<!-- Bottom Spacer -->
|
||||
<view style="height: 100rpx;"></view>
|
||||
</scroll-view>
|
||||
<!-- Plant Name Card -->
|
||||
<view class="wd-name-card">
|
||||
<view class="wd-name-row">
|
||||
<text class="wd-name">{{plant.name}}</text>
|
||||
<text class="wd-scientific" wx:if="{{plant.latinName}}">{{plant.latinName}}</text>
|
||||
</view>
|
||||
<view class="wd-badges" wx:if="{{plant.genus || plant.classes.length > 0}}">
|
||||
<text class="wd-badge" wx:if="{{plant.genus}}">{{plant.genus}}</text>
|
||||
<text class="wd-badge" wx:for="{{plant.classes}}" wx:key="*this">{{item}}</text>
|
||||
<text class="wd-badge difficulty">难度: {{plant.difficultyLabel}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Content Scroll -->
|
||||
<scroll-view class="wd-content" scroll-y enhanced show-scrollbar="{{false}}">
|
||||
|
||||
<!-- Growth Habit -->
|
||||
<view class="wd-section" wx:if="{{plant.growthHabit}}">
|
||||
<view class="wd-card">
|
||||
<text class="wd-text">{{plant.growthHabit}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Basic Info -->
|
||||
<view class="wd-section">
|
||||
<view class="section-title">
|
||||
<t-icon name="info-circle" size="40rpx" color="#558B2F" />
|
||||
<text>基础档案</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<view class="wd-grid">
|
||||
<view class="wd-stat-item" wx:if="{{plant.distributionArea}}">
|
||||
<text class="wd-label">分布区域</text>
|
||||
<text class="wd-value">{{plant.distributionArea}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.aliases}}">
|
||||
<text class="wd-label">别名</text>
|
||||
<text class="wd-value">{{plant.aliases}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.lifeCycle}}">
|
||||
<text class="wd-label">生命周期</text>
|
||||
<text class="wd-value">{{plant.lifeCycle === 'perennial' ? '多年生' : (plant.lifeCycle === 'annual' ? '一年生' : plant.lifeCycle)}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.height}}">
|
||||
<text class="wd-label">株高</text>
|
||||
<text class="wd-value">约 {{plant.height}} cm</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Care Guide -->
|
||||
<view class="wd-section">
|
||||
<view class="section-title">
|
||||
<t-icon name="sunny" size="40rpx" color="#558B2F" />
|
||||
<text>养护指南</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<view class="requirement-item" wx:if="{{plant.lightIntensity}}">
|
||||
<view class="req-icon light">
|
||||
<t-icon name="sunny" size="40rpx" color="#F59E0B" />
|
||||
</view>
|
||||
<view class="req-content">
|
||||
<text class="req-title">光照</text>
|
||||
<text class="req-desc">{{plant.lightIntensity}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="requirement-item" wx:if="{{plant.optimalTempPeriod}}">
|
||||
<view class="req-icon temp">
|
||||
<t-icon name="pin" size="40rpx" color="#EF4444" />
|
||||
</view>
|
||||
<view class="req-content">
|
||||
<text class="req-title">适宜温度</text>
|
||||
<text class="req-desc">{{plant.optimalTempPeriod}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="requirement-item" wx:if="{{plant.reproductionMethod}}">
|
||||
<view class="req-icon repro">
|
||||
<t-icon name="fork-node" size="40rpx" color="#558B2F" />
|
||||
</view>
|
||||
<view class="req-content">
|
||||
<text class="req-title">繁殖方式</text>
|
||||
<text class="req-desc">{{plant.reproductionMethod}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Morphology -->
|
||||
<view class="wd-section" wx:if="{{plant.stem || plant.foliageShape || plant.foliageColor}}">
|
||||
<view class="section-title">
|
||||
<t-icon name="tree-round-dot" size="40rpx" color="#558B2F" />
|
||||
<text>形态特征</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<view class="wd-grid">
|
||||
<view class="wd-stat-item" wx:if="{{plant.stem}}">
|
||||
<text class="wd-label">茎</text>
|
||||
<text class="wd-value">{{plant.stem}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.foliageShape}}">
|
||||
<text class="wd-label">叶形</text>
|
||||
<text class="wd-value">{{plant.foliageShape}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.foliageColor}}">
|
||||
<text class="wd-label">叶色</text>
|
||||
<text class="wd-value">{{plant.foliageColor}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.foliageType}}">
|
||||
<text class="wd-label">叶质</text>
|
||||
<text class="wd-value">{{plant.foliageType}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Flowering -->
|
||||
<view class="wd-section" wx:if="{{plant.floweringPeriod || plant.floweringColor}}">
|
||||
<view class="section-title">
|
||||
<t-icon name="flower" size="40rpx" color="#558B2F" />
|
||||
<text>开花信息</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<view class="wd-grid">
|
||||
<view class="wd-stat-item" wx:if="{{plant.floweringPeriod}}">
|
||||
<text class="wd-label">花期</text>
|
||||
<text class="wd-value">{{plant.floweringPeriod}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.floweringColor}}">
|
||||
<text class="wd-label">花色</text>
|
||||
<text class="wd-value">{{plant.floweringColor}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.floweringShape}}">
|
||||
<text class="wd-label">花型</text>
|
||||
<text class="wd-value">{{plant.floweringShape}}</text>
|
||||
</view>
|
||||
<view class="wd-stat-item" wx:if="{{plant.flowerDiameter}}">
|
||||
<text class="wd-label">花径</text>
|
||||
<text class="wd-value">约 {{plant.flowerDiameter}} mm</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Fruit -->
|
||||
<view class="wd-section" wx:if="{{plant.fruit}}">
|
||||
<view class="section-title">
|
||||
<t-icon name="apple" size="40rpx" color="#558B2F" />
|
||||
<text>果实</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<text class="wd-text">{{plant.fruit}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- Pests -->
|
||||
<view class="wd-section" wx:if="{{plant.commonPests.length > 0}}">
|
||||
<view class="section-title">
|
||||
<t-icon name="error-circle" size="40rpx" color="#EF4444" />
|
||||
<text>常见病虫害</text>
|
||||
</view>
|
||||
<view class="wd-card">
|
||||
<view class="pest-tags">
|
||||
<text wx:for="{{plant.commonPests}}" wx:key="*this" class="pest-tag">{{item}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="height: 120rpx;"></view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- Loading State -->
|
||||
<!-- Loading -->
|
||||
<view wx:if="{{!plant}}" class="wiki-detail-loading">
|
||||
<t-loading theme="circular" size="64rpx" text="加载中..." />
|
||||
</view>
|
||||
|
||||
+110
-188
@@ -3,201 +3,139 @@
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #F9FAFB;
|
||||
background: #F4F6F0;
|
||||
}
|
||||
|
||||
/* Page Layout */
|
||||
page {
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Hide Scrollbar Globally */
|
||||
::-webkit-scrollbar {
|
||||
display: none !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
scroll-view ::-webkit-scrollbar {
|
||||
display: none !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
color: transparent !important;
|
||||
}
|
||||
|
||||
/* Header Area */
|
||||
/* ======== Image Carousel ======== */
|
||||
.wd-header {
|
||||
height: 500rpx;
|
||||
position: relative;
|
||||
background: #000;
|
||||
flex-shrink: 0;
|
||||
background: #E8E8E8;
|
||||
}
|
||||
|
||||
/* Content Wrapper handles the flex growth and positioning overlap */
|
||||
.wd-content-wrapper {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
margin-top: -32rpx;
|
||||
z-index: 20;
|
||||
overflow: hidden; /* Ensure scroll-view is contained */
|
||||
}
|
||||
|
||||
/* Content Scroll View fills the wrapper */
|
||||
.wd-content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Force override TDesign swiper radius */
|
||||
.custom-swiper {
|
||||
border-radius: 0 !important;
|
||||
overflow: hidden;
|
||||
--td-swiper-radius: 0px !important;
|
||||
}
|
||||
|
||||
.custom-swiper .t-swiper {
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
|
||||
t-swiper {
|
||||
border-radius: 0 !important;
|
||||
}
|
||||
|
||||
.wd-gallery-container {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.wd-gradient-overlay {
|
||||
.wd-counter {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 240rpx;
|
||||
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
|
||||
pointer-events: none;
|
||||
bottom: 20rpx;
|
||||
right: 24rpx;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
backdrop-filter: blur(6px);
|
||||
-webkit-backdrop-filter: blur(6px);
|
||||
color: white;
|
||||
font-size: 22rpx;
|
||||
font-weight: 600;
|
||||
padding: 6rpx 18rpx;
|
||||
border-radius: 12rpx;
|
||||
z-index: 20;
|
||||
letter-spacing: 2rpx;
|
||||
}
|
||||
|
||||
/* ======== Name Card ======== */
|
||||
.wd-name-card {
|
||||
background: white;
|
||||
padding: 32rpx 36rpx 28rpx;
|
||||
margin: 0 0 24rpx;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.wd-indicators {
|
||||
position: absolute;
|
||||
bottom: 24rpx;
|
||||
right: 24rpx;
|
||||
display: flex;
|
||||
gap: 12rpx;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.wd-dot {
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.wd-dot.active {
|
||||
background: white;
|
||||
width: 24rpx;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.wd-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 32rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
pointer-events: none;
|
||||
z-index: 20;
|
||||
.wd-name-row {
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.wd-name {
|
||||
font-size: 56rpx;
|
||||
color: #FFFFFF;
|
||||
display: block;
|
||||
font-size: 48rpx;
|
||||
font-weight: 800;
|
||||
margin-bottom: 8rpx;
|
||||
color: #1F2937;
|
||||
line-height: 1.3;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.wd-scientific {
|
||||
font-size: 32rpx;
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: #9CA3AF;
|
||||
font-style: italic;
|
||||
font-family: serif;
|
||||
margin-bottom: 24rpx;
|
||||
font-family: Georgia, 'Times New Roman', serif;
|
||||
}
|
||||
|
||||
.wd-badges {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
gap: 12rpx;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.wd-badge {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
backdrop-filter: blur(4px);
|
||||
background: #F0F7EB;
|
||||
color: #558B2F;
|
||||
padding: 8rpx 20rpx;
|
||||
border-radius: 24rpx;
|
||||
font-size: 24rpx;
|
||||
color: #FFFFFF;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
border-radius: 20rpx;
|
||||
font-size: 22rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.wd-badge.difficulty {
|
||||
background: #FFF8E1;
|
||||
color: #F57F17;
|
||||
}
|
||||
|
||||
/* ======== Scrollable Content ======== */
|
||||
.wd-content {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/* ======== Sections ======== */
|
||||
.wd-section {
|
||||
margin-bottom: 32rpx;
|
||||
animation: fadeIn 0.5s ease-out;
|
||||
padding: 0 32rpx;
|
||||
}
|
||||
|
||||
/* First section specific override: Adjust padding and background to create the seamless rounded look */
|
||||
.wd-section:first-child {
|
||||
padding: 0;
|
||||
margin-bottom: 48rpx;
|
||||
}
|
||||
|
||||
.wd-section:first-child .wd-card {
|
||||
border-top-left-radius: 40rpx;
|
||||
border-top-right-radius: 40rpx;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
padding: 48rpx 32rpx;
|
||||
box-shadow: none; /* Seamless blend */
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(20rpx); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
margin-bottom: 28rpx;
|
||||
padding: 0 28rpx;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 24rpx;
|
||||
padding-left: 8rpx;
|
||||
gap: 14rpx;
|
||||
margin-bottom: 20rpx;
|
||||
padding-left: 4rpx;
|
||||
}
|
||||
|
||||
.section-title text {
|
||||
font-size: 34rpx;
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #111827;
|
||||
color: #1F2937;
|
||||
}
|
||||
|
||||
/* ======== Cards ======== */
|
||||
.wd-card {
|
||||
background: white;
|
||||
border-radius: 24rpx;
|
||||
padding: 28rpx 32rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
|
||||
}
|
||||
|
||||
.wd-text {
|
||||
font-size: 30rpx;
|
||||
line-height: 1.6;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.7;
|
||||
color: #4B5563;
|
||||
}
|
||||
|
||||
/* ======== Info Grid ======== */
|
||||
.wd-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 32rpx;
|
||||
gap: 28rpx 32rpx;
|
||||
}
|
||||
|
||||
.wd-stat-item {
|
||||
@@ -207,62 +145,72 @@ t-swiper {
|
||||
}
|
||||
|
||||
.wd-label {
|
||||
font-size: 24rpx;
|
||||
font-size: 22rpx;
|
||||
color: #9CA3AF;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.wd-value {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #1F2937;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.wd-card {
|
||||
background: white;
|
||||
border-radius: 24rpx;
|
||||
padding: 24rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.02);
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
/* Requirement Items (Compact) */
|
||||
/* ======== Requirement Items ======== */
|
||||
.requirement-item {
|
||||
display: flex;
|
||||
gap: 24rpx;
|
||||
margin-bottom: 24rpx;
|
||||
padding-bottom: 24rpx;
|
||||
padding: 24rpx 0;
|
||||
border-bottom: 2rpx solid #F3F4F6;
|
||||
}
|
||||
|
||||
.requirement-item:first-child {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.requirement-item:last-child {
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.req-icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
background: #F1F8E9;
|
||||
border-radius: 20rpx;
|
||||
width: 84rpx;
|
||||
height: 84rpx;
|
||||
border-radius: 22rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.req-icon.light {
|
||||
background: #FFFBEB;
|
||||
}
|
||||
|
||||
.req-icon.temp {
|
||||
background: #FEF2F2;
|
||||
}
|
||||
|
||||
.req-icon.repro {
|
||||
background: #F0FDF4;
|
||||
}
|
||||
|
||||
.req-content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.req-title {
|
||||
display: block;
|
||||
font-size: 30rpx;
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
color: #1F2937;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.req-desc {
|
||||
@@ -271,7 +219,7 @@ t-swiper {
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* FAQ / Pests */
|
||||
/* ======== Pest Tags ======== */
|
||||
.pest-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -283,41 +231,15 @@ t-swiper {
|
||||
color: #DC2626;
|
||||
padding: 12rpx 24rpx;
|
||||
border-radius: 16rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.care-tips-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.tip-item {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.tip-dot {
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
background: #558B2F;
|
||||
margin-top: 14rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tip-text {
|
||||
font-size: 28rpx;
|
||||
color: #4B5563;
|
||||
line-height: 1.5;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ======== Loading ======== */
|
||||
.wiki-detail-loading {
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: #F9FAFB;
|
||||
background: #F4F6F0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user