diff --git a/.DS_Store b/.DS_Store
index 9295f12..807a438 100644
Binary files a/.DS_Store and b/.DS_Store differ
diff --git a/app.json b/app.json
index d6658cb..11818c6 100644
--- a/app.json
+++ b/app.json
@@ -22,7 +22,8 @@
"pages/knowlage/index",
"pages/knowlage/info",
"pages/badge/more",
- "pages/badge/info"
+ "pages/badge/info",
+ "pages/garden/record"
],
"window": {
"navigationBarTextStyle": "black",
@@ -42,29 +43,29 @@
"text": "花园"
},
{
- "iconPath": "static/img/home.png",
- "selectedIconPath": "static/img/home1.png",
+ "iconPath": "static/img/water.png",
+ "selectedIconPath": "static/img/water1.png",
"pagePath": "pages/garden/index",
"iconSize": 48,
"text": "任务"
},
{
- "iconPath": "static/img/home.png",
- "selectedIconPath": "static/img/home1.png",
+ "iconPath": "static/img/community.png",
+ "selectedIconPath": "static/img/community1.png",
"pagePath": "pages/community/index",
"iconSize": 48,
"text": "社区"
},
{
- "iconPath": "static/img/home.png",
- "selectedIconPath": "static/img/home1.png",
+ "iconPath": "static/img/badge.png",
+ "selectedIconPath": "static/img/badge1.png",
"pagePath": "pages/badge/index",
"iconSize": 48,
"text": "成就"
},
{
- "iconPath": "static/img/clock.png",
- "selectedIconPath": "static/img/clock1.png",
+ "iconPath": "static/img/user.png",
+ "selectedIconPath": "static/img/user1.png",
"pagePath": "pages/user/index",
"iconSize": 48,
"text": "我的"
diff --git a/pages/add/index.js b/pages/add/index.js
index 37bac1c..4b42c00 100644
--- a/pages/add/index.js
+++ b/pages/add/index.js
@@ -128,6 +128,7 @@ Page({
var data = JSON.parse(res.data);
if (data.code === 200) {
const ossIds =[data.data.file.id]
+ _this.fetchCheck(data.data.file.id)
_this.data.form.ossIds = ossIds
}
}
@@ -135,6 +136,20 @@ Page({
}
})
},
+
+ fetchCheck(id){
+ api("/ocr/url",'GET',{id:id}).then(res => {
+ if (res.code == 200){
+
+ const tmp = res.data.result[0]
+ if ( tmp.score > 0.5){
+ const tmps = this.data.form
+ tmps.name = tmp.name
+ this.setData({form: tmps})
+ }
+ }
+ })
+ },
input(e){
const value = e.detail.value
this.data.form.name = value
@@ -163,8 +178,9 @@ Page({
const tmps = res.data
if (tmps != null){
this.setData({badge: tmps[0],show:true})
+ } else {
+ wx.navigateBack()
}
-
} else {
wx.showModal({
content: res.msg
diff --git a/pages/add/index.wxml b/pages/add/index.wxml
index 07d8ff1..3f94822 100644
--- a/pages/add/index.wxml
+++ b/pages/add/index.wxml
@@ -19,13 +19,12 @@
- 植物信息
植物名称
-
+
diff --git a/pages/badge/index.wxml b/pages/badge/index.wxml
index 1d1ea23..1fae6ee 100644
--- a/pages/badge/index.wxml
+++ b/pages/badge/index.wxml
@@ -27,7 +27,7 @@
全部徽章
-
+
{{item.title}}
diff --git a/pages/badge/info.js b/pages/badge/info.js
index 8b865d7..898c6bd 100644
--- a/pages/badge/info.js
+++ b/pages/badge/info.js
@@ -40,6 +40,10 @@ Page({
})
},
+ goBack(){
+ wx.navigateBack()
+ },
+
/**
* 生命周期函数--监听页面隐藏
*/
diff --git a/pages/badge/info.wxml b/pages/badge/info.wxml
index fc98f3c..145c38b 100644
--- a/pages/badge/info.wxml
+++ b/pages/badge/info.wxml
@@ -9,7 +9,7 @@
{{info.desc}}
- 返回
+ 返回
\ No newline at end of file
diff --git a/pages/badge/more.js b/pages/badge/more.js
index 799e8f3..0a6bbe1 100644
--- a/pages/badge/more.js
+++ b/pages/badge/more.js
@@ -22,7 +22,9 @@ Page({
},
goInfo(e){
- const id = e.currentTarget.dataset.id
+ const item = e.currentTarget.dataset.item
+ console.log(item.badgeId === undefined ? item.id: item.badgeId);
+ const id = item.badgeId === undefined ? item.id: item.badgeId
wx.navigateTo({
url: '../badge/info?id='+ id,
})
diff --git a/pages/badge/more.wxml b/pages/badge/more.wxml
index 9e8ed30..d922036 100644
--- a/pages/badge/more.wxml
+++ b/pages/badge/more.wxml
@@ -1,7 +1,7 @@
-
+
{{item.name}}
diff --git a/pages/garden/components/growth.js b/pages/garden/components/growth.js
index 883975b..81ff691 100644
--- a/pages/garden/components/growth.js
+++ b/pages/garden/components/growth.js
@@ -1,28 +1,159 @@
// pages/garden/components/growth.js
+const config = require("../../../config/config");
+const {
+ api
+} = require("../../../utils/api");
Component({
/**
* 组件的属性列表
*/
properties: {
-
+ plantId: {
+ type: String,
+ require: true
+ },
+ },
+ observers: {
+ // 监听 visible 的变化
+ 'plantId': function (newVal) {
+ console.log(newVal);
+ this.setData({
+ id: newVal
+ })
+ }
},
-
/**
* 组件的初始数据
*/
data: {
- visible:false
+ visible: false,
+ tags: [{
+ label: '日常记录',
+ checked: true
+ },
+ {
+ label: '🌱 发芽',
+ checked: false
+ },
+ {
+ label: '🌼 开花',
+ checked: false
+ },
+ {
+ label: '🍒 结果',
+ checked: false
+ }
+ ],
+ id: '',
+ pic: '',
+ form: {
+ name: '',
+ desc: '',
+ content: '',
+ ossIds: [],
+ tag: '日常记录'
+ }
},
/**
* 组件的方法列表
*/
methods: {
- change(){
+ change() {
const tmp = !this.data.visible
- console.log(tmp);
this.setData({visible:tmp})
+ if (tmp === false) {
+ this.setData({
+ pic:'',
+ form:{}
+ })
+ }
+
+ },
+ check(e) {
+ const index = e.currentTarget.dataset.index
+ const tmps = this.data.tags.map(e => {
+ e.checked = false
+ return e
+ })
+ tmps[index].checked = true
+ this.setData({
+ tags: tmps
+ })
+ this.data.form.tag = tmps[index].label
+ },
+ input(e) {
+ const value = e.detail.value
+ this.data.form.content = value
+ },
+ upload() {
+ const _this = this
+ wx.chooseMedia({
+ count: 1,
+ mediaType: ['image'],
+ sourceType: ['album', 'camera'],
+ success(res) {
+ const avatarUrl = res.tempFiles[0].tempFilePath
+ wx.showLoading({
+ title: '请稍后...',
+ })
+ _this.setData({
+ pic: avatarUrl
+ })
+ wx.uploadFile({
+ filePath: avatarUrl,
+ name: 'file',
+ header: {
+ 'Authorization': 'Bearer ' + wx.getStorageSync('token'),
+ },
+ url: config.baseUrl + '/oss/upload',
+ success: res => {
+ wx.hideLoading()
+ var data = JSON.parse(res.data);
+ if (data.code === 200) {
+ const ossIds = [data.data.file.id]
+ _this.data.form.ossIds = ossIds
+ }
+ }
+ })
+ }
+ })
+ },
+ submit() {
+ this.data.form.plantId = this.data.id
+ if (this.data.form.ossIds.length === 0) {
+ wx.showModal({
+ content: '请添加照片'
+ })
+ return
+ }
+ wx.showToast({
+ icon: 'loading',
+ })
+ api('/plant/grow/addRecord', 'POST', this.data.form, 'json').then(res => {
+ if (res.code === 200) {
+ const reset = {
+ name: '',
+ desc: '',
+ content: '',
+ ossIds: [],
+ tag: '日常记录'
+ }
+ this.setData({
+ visible: false,
+ form: reset
+ })
+ wx.showToast({
+ icon: 'success',
+ title: res.msg,
+ })
+
+ this.triggerEvent('ok', {
+ value: ""
+ });
+ }
+ })
}
}
})
\ No newline at end of file
diff --git a/pages/garden/components/growth.json b/pages/garden/components/growth.json
index f070a60..f7810bf 100644
--- a/pages/garden/components/growth.json
+++ b/pages/garden/components/growth.json
@@ -3,6 +3,7 @@
"styleIsolation": "apply-shared",
"usingComponents": {
"t-popup": "tdesign-miniprogram/popup/popup",
+ "t-check-tag": "tdesign-miniprogram/check-tag/check-tag",
"t-textarea": "tdesign-miniprogram/textarea/textarea"
}
}
\ No newline at end of file
diff --git a/pages/garden/components/growth.wxml b/pages/garden/components/growth.wxml
index 27f9df3..9f2caae 100644
--- a/pages/garden/components/growth.wxml
+++ b/pages/garden/components/growth.wxml
@@ -1,32 +1,36 @@
-
+
记录生长瞬间
-
-
+
+
点击上传或拍摄植物照片
支持JPG、PNG 格式,最大 5MB
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
- 日常
- 发芽
- 开花
- 结果
-
-
-
-
-
-
- 保存记录
-
+
+ 保存记录
+
\ No newline at end of file
diff --git a/pages/garden/index.js b/pages/garden/index.js
index 000b15a..40716ec 100644
--- a/pages/garden/index.js
+++ b/pages/garden/index.js
@@ -61,9 +61,11 @@ Page({
changeStatus(data){
api('/plant/makeCare','POST',data,'json').then(res => {
if (res.code === 200){
- wx.showToast({
- icon:'success',
- title: res.msg,
+ wx.requestSubscribeMessage({
+ tmplIds: ['iG5GYMPQAgKxIE9zZNOgKUghR6hP2WKKwws1RfLABuE'],
+ success (res) {
+
+ }
})
this.fetchList()
}
diff --git a/pages/garden/info.js b/pages/garden/info.js
index 050bf73..c0d4778 100644
--- a/pages/garden/info.js
+++ b/pages/garden/info.js
@@ -1,5 +1,5 @@
const { api } = require("../../utils/api")
-
+import { getNavLayout } from '../../utils/util'; // 引入工具函数
// pages/index/info.js
Page({
@@ -9,7 +9,9 @@ Page({
data: {
id:'',
farms:[],
- weather:null
+ weather:null,
+ list:[],
+ backButtonStyle:''
},
/**
@@ -25,6 +27,10 @@ Page({
if(tmp){
this.setData({weather:tmp})
}
+ const layout = getNavLayout();
+ this.setData({
+ backButtonStyle: layout.containerStyle
+ });
},
fetchInfo(){
@@ -36,11 +42,29 @@ Page({
tmp.pic = tmp.imgList[0].url
tmp.picList = tmp.imgList.map(sub => sub.url)
}
+
tmp.todayCares.map(e => e.period = tmp.carePlans.find(sub => sub.name === e.name).period)
this.setData({info:res.data})
}
})
+ const params = {current:1,pageSize:999,id:this.data.id,keyword:''}
+ api('/plant/grow/recordList','POST',params,'json').then(res => {
+ if (res.code === 200){
+ const tmps =res.data.list.map(e => {
+ e.createdAtStr = e.createdAtStr.substring(0,10)
+ return e
+ })
+ this.setData({list:tmps})
+ }
+ })
+ },
+
+ goRecord(e){
+ const index = e.currentTarget.dataset.index
+ wx.navigateTo({
+ url: '../garden/record?id='+this.data.id +"¤t="+index,
+ })
},
goPreview(e){
diff --git a/pages/garden/info.wxml b/pages/garden/info.wxml
index 0e14c5f..15d3816 100644
--- a/pages/garden/info.wxml
+++ b/pages/garden/info.wxml
@@ -9,7 +9,7 @@
-
+
@@ -77,8 +77,24 @@
成长日记
-
-
+
+
+
+
+ {{item.tag}}
+
+ {{item.createdAtStr}}
+
+ {{item.content}}
+
+
+
+
+
+
+
+ 美好的成长时光等你开启
+ 点击右下角 “记录成长” 拍张照片,定格它现在的样子
@@ -97,7 +113,7 @@
{{item.name}}
- {{item.careTimeStr}}
+ {{item.careTimeStr}}
今天
{{item.remark}}
@@ -111,6 +127,5 @@
-
-
+
\ No newline at end of file
diff --git a/pages/garden/record.js b/pages/garden/record.js
new file mode 100644
index 0000000..5b1343f
--- /dev/null
+++ b/pages/garden/record.js
@@ -0,0 +1,157 @@
+// pages/garden/record.js
+const {
+ api
+} = require("../../utils/api")
+import {
+ getNavLayout
+} from '../../utils/util'; // 引入工具函数
+
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ id: '',
+ list: [],
+ picList: [],
+ current: 0,
+ info: null,
+ innerAudioContext: null,
+ backButtonStyle: ''
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ current: options.current,
+ id: options.id
+ })
+ this.fetchList()
+ this.playMusic()
+ // 一行代码搞定计算
+ const layout = getNavLayout();
+ this.setData({
+ backButtonStyle: layout.containerStyle
+ });
+
+ },
+
+ playMusic() {
+ this.data.innerAudioContext = wx.createInnerAudioContext({
+ useWebAudioImplement: true,
+ loop: true,
+ volume: 0.2
+ })
+ const list = [
+ 'https://res.catter.cn/pub/2025/12/17/20251217113514284.mp3',
+ 'https://res.catter.cn/pub/2025/12/17/20251217151719823.mp3',
+ 'https://res.catter.cn/pub/2025/12/17/20251217151806179.mp3',
+ 'https://res.catter.cn/pub/2025/12/17/20251217152125210.mp3',
+ 'https://res.catter.cn/pub/2025/12/17/20251217152206612.mp3'
+ ]
+ const randomIndex = Math.floor(Math.random() * list.length);
+
+ // 3. 赋值给 src
+ this.data.innerAudioContext.src = list[randomIndex];
+
+ },
+
+ fetchList() {
+ const params = {
+ current: 1,
+ pageSize: 999,
+ id: this.data.id,
+ keyword: ''
+ }
+ api('/plant/grow/recordList', 'POST', params, 'json').then(res => {
+ if (res.code === 200) {
+ const tmps = res.data.list.map(e => {
+ e.createdAtStr = e.createdAtStr.substring(0, 10)
+ e.pic = e.imgList[0].url
+ return e
+ })
+ const picList = tmps.map(e => e.pic)
+ this.setData({
+ list: tmps,
+ picList: picList,
+ info: tmps[0]
+ })
+ }
+ })
+ },
+
+ goPreview(e) {
+ const index = e.detail.index
+ const currentUrl = this.data.picList[index]
+ const list = this.data.picList
+ wx.previewImage({
+ current: currentUrl, // 当前显示图片的http链接
+ urls: list // 需要预览的图片http链接列表
+ })
+ },
+
+ goBack() {
+ wx.navigateBack()
+ },
+
+ change(e) {
+ const current = e.detail.current
+ const info = this.data.list[current]
+ this.setData({
+ current: current,
+ info: info
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+ this.data.innerAudioContext.play()
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload() {
+ this.data.innerAudioContext.destroy() // 释放音频资源
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh() {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/garden/record.json b/pages/garden/record.json
new file mode 100644
index 0000000..71c15a2
--- /dev/null
+++ b/pages/garden/record.json
@@ -0,0 +1,8 @@
+{
+ "navigationStyle": "custom",
+ "navigationBarBackgroundColor": "#000",
+ "navigationBarTextStyle":"white",
+ "usingComponents": {
+ "t-swiper": "tdesign-miniprogram/swiper/swiper"
+ }
+}
\ No newline at end of file
diff --git a/pages/garden/record.wxml b/pages/garden/record.wxml
new file mode 100644
index 0000000..0d77b5c
--- /dev/null
+++ b/pages/garden/record.wxml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{info.tag}}
+ {{info.createdAtStr}}
+ {{info.content}}
+
+
+
\ No newline at end of file
diff --git a/pages/garden/record.wxss b/pages/garden/record.wxss
new file mode 100644
index 0000000..32e4f57
--- /dev/null
+++ b/pages/garden/record.wxss
@@ -0,0 +1 @@
+/* pages/garden/record.wxss */
\ No newline at end of file
diff --git a/pages/index/index.js b/pages/index/index.js
index c831ba6..830d142 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -115,6 +115,7 @@ Page({
if (res.data === null) {
return
}
+
if (res.data.list.length === 0) {
this.fetchHotList()
return
@@ -139,28 +140,36 @@ Page({
},
fetchHotList() {
- api('/library/list', 'POST', {
- isHot: 0,
+ api('/claim/list', 'POST', {
current: 0,
- pageSize: 6
+ pageSize: 10,
+ name: '',
+ keyword: ''
}, 'json').then(res => {
if (res.code === 200) {
- const data = res.data.list.map(e => {
+ const tmps = res.data.list.map(e => {
e.pic = e.imgList[0].url
+ e.status = e.points < this.data.points ? 0 : 1
return e
+ }).sort((a, b) => {
+ // 1. 优先比较 status,0 在前,1 在后
+ if (a.status !== b.status) {
+ return a.status - b.status;
+ }
+ // 2. status 相同的情况下,比较 points,从小到大排序
+ return a.points - b.points;
})
this.setData({
- hotList: data
+ hotList: tmps
})
}
})
},
-
addItems(newItems) {
let h1 = 0;
let h2 = 0;
newItems.forEach((item, index) => {
- // 动态获取图片尺寸
+
if (index % 2 === 0) {
this.data.leftList.push(item);
h1 += item.cover.height / item.cover.width;
@@ -176,6 +185,13 @@ Page({
});
},
+ goStore(e){
+ console.log(e);
+ const id = e.currentTarget.dataset.id
+ wx.navigateTo({
+ url: '../store/info?id='+ id,
+ })
+ },
goInfo(e) {
console.log(e);
const id = e.currentTarget.dataset.id
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 31d6f70..42b7f9f 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -98,14 +98,13 @@
您还可以从以下热门植物中,免费领取
-
-
+
+
{{item.name}}
- {{item.genus}}
- {{item.lifeCycle}} {{item.lightIntensity}}
+ {{item.tag}}
diff --git a/pages/knowlage/index.js b/pages/knowlage/index.js
index 51ef9a1..3fb0ecd 100644
--- a/pages/knowlage/index.js
+++ b/pages/knowlage/index.js
@@ -33,7 +33,7 @@ Page({
},
fetchList(){
- api('/library/list','POST',{current:0,pageSize:10},'json').then(res => {
+ api('/library/page','POST',{current:1,pageSize:10,name:"",classId:"",isHot:1},'json').then(res => {
if (res.code === 200){
const tmps = res.data.list.map(e => {
e.pic = e.imgList[0].url
diff --git a/pages/knowlage/index.wxml b/pages/knowlage/index.wxml
index ae68251..d33d628 100644
--- a/pages/knowlage/index.wxml
+++ b/pages/knowlage/index.wxml
@@ -28,7 +28,7 @@
难度:
-
+
diff --git a/pages/knowlage/index.wxss b/pages/knowlage/index.wxss
index 1452372..05cdae2 100644
--- a/pages/knowlage/index.wxss
+++ b/pages/knowlage/index.wxss
@@ -1,7 +1,7 @@
/* pages/knowlage/index.wxss */
.grid {
display: grid;
- grid-template-columns: auto auto;
+ grid-template-columns: 49% 49%;
grid-row-gap: 8px;
grid-column-gap: 8px;
}
diff --git a/pages/knowlage/info.js b/pages/knowlage/info.js
index 4eb47ae..4893625 100644
--- a/pages/knowlage/info.js
+++ b/pages/knowlage/info.js
@@ -1,4 +1,7 @@
const { api } = require("../../utils/api")
+import {
+ getNavLayout
+} from '../../utils/util'; // 引入工具函数
// pages/knowlage/info.js
Page({
@@ -8,7 +11,9 @@ Page({
*/
data: {
id:'',
- info:null
+ info:null,
+ backButtonStyle:''
+
},
/**
@@ -16,6 +21,11 @@ Page({
*/
onLoad(options) {
this.data.id = options.id
+ // 一行代码搞定计算
+ const layout = getNavLayout();
+ this.setData({
+ backButtonStyle: layout.containerStyle
+ });
this.fetchInfo()
},
diff --git a/pages/knowlage/info.json b/pages/knowlage/info.json
index f08cbea..49efbcc 100644
--- a/pages/knowlage/info.json
+++ b/pages/knowlage/info.json
@@ -1,4 +1,6 @@
{
"navigationStyle":"custom",
- "usingComponents": {}
+ "usingComponents": {
+ "t-rate": "tdesign-miniprogram/rate/rate"
+ }
}
\ No newline at end of file
diff --git a/pages/knowlage/info.wxml b/pages/knowlage/info.wxml
index 32798ae..23050c0 100644
--- a/pages/knowlage/info.wxml
+++ b/pages/knowlage/info.wxml
@@ -5,7 +5,7 @@
-
+
@@ -23,9 +23,14 @@
植物学名称:{{info.latinName}}
- 🌍 多年生
- 🌞 中光照
- 易养活
+ 🌍 {{info.lifeCycle}}
+ 🌞 {{info.lightType}}
+
+
+ 难易度
+
+
+
@@ -57,7 +62,7 @@
适宜温度范围: 15 - 25℃
{{info.growthHabit}}
- {{info.floweringPeriod}}
+ {{info.stem}}
@@ -80,7 +85,7 @@
花直径
- {{info.floweringPeriod}}
+ 开花期:{{info.floweringPeriod}}
diff --git a/pages/order/index.js b/pages/order/index.js
index 115a45a..40a4d83 100644
--- a/pages/order/index.js
+++ b/pages/order/index.js
@@ -141,6 +141,7 @@ Page({
if (res.code === 200) {
const tmps = res.data
tmps.content = tmps.content.trim()
+ tmps.postage = tmps.postage.toFixed(2)
this.setData({
info: tmps
})
diff --git a/pages/order/index.wxml b/pages/order/index.wxml
index cfc9040..e38bf5d 100644
--- a/pages/order/index.wxml
+++ b/pages/order/index.wxml
@@ -15,38 +15,43 @@
-
+
暂无收货地址
新增收获地址
-
+
领养清单
-
-
-
+
+
+
+
+
+
+ {{info.name}}
+ {{info.tag}}
+
-
- {{info.name}}
- {{info.tag}}
+
+ x 1
- 快递运费:¥ 12.00
- ¥ 12.00
+ 快递运费:¥ {{info.postage}}
+ ¥ {{info.postage}}
-
+
我承诺会好好照顾它,不随意丢弃。
@@ -54,7 +59,7 @@
- 合计:¥ 12.00元
+ 合计:¥ {{info.postage}}
元
支付邮费,接它回家
diff --git a/pages/store/info.js b/pages/store/info.js
index 8bfb070..e420b7b 100644
--- a/pages/store/info.js
+++ b/pages/store/info.js
@@ -9,7 +9,8 @@ Page({
data: {
id:'',
info:null,
- points: 0
+ points: 0,
+ libraryInfo:null
},
/**
@@ -43,6 +44,9 @@ Page({
tmps.content = tmps.content.trim()
this.setData({info:tmps})
wx.hideLoading()
+ if(tmps.libraryId != ""){
+ this.fetchLibrary(tmps.libraryId)
+ }
}
})
@@ -50,6 +54,21 @@ Page({
this.setData({points:points})
},
+ fetchLibrary(id){
+ api('/library/detail','GET',{id:id}).then(res => {
+ if (res.code === 200){
+ this.setData({libraryInfo:res.data})
+ }
+ })
+ },
+
+ goInfo(){
+ if (this.data.libraryInfo){
+ wx.navigateTo({
+ url: '../knowlage/info?id=' + this.data.libraryInfo.id,
+ })
+ }
+ },
goPreview(e){
const currentUrl = e.currentTarget.dataset.url; // 获取当前点击的图片链接
const list = this.data.info.imgList.map(e => e.url)
diff --git a/pages/store/info.json b/pages/store/info.json
index 8835af0..ab7bbae 100644
--- a/pages/store/info.json
+++ b/pages/store/info.json
@@ -1,3 +1,5 @@
{
- "usingComponents": {}
+ "usingComponents": {
+ "t-rate": "tdesign-miniprogram/rate/rate"
+ }
}
\ No newline at end of file
diff --git a/pages/store/info.wxml b/pages/store/info.wxml
index 9c6740d..aaa16ac 100644
--- a/pages/store/info.wxml
+++ b/pages/store/info.wxml
@@ -9,26 +9,33 @@
{{info.tag}}
-
-
- 需 {{info.points}} 阳光值
+
+
+ 需 {{info.points}} 阳光值
+
+ 剩余库存 {{info.stock}} 株
-
- 🌳 植物公民档案
+ 💻 植物公民档案
{{info.content}}
- 🌳 植物百科
+
+ 🌳 植物百科 {{libraryInfo.name}}
+
+
- 🌍 多年生
- 🌞 中光照
- 易养活
+ 🌍 {{libraryInfo.lifeCycle}}
+ 🌞 {{libraryInfo.lightIntensity}}
+
+ 难度
+
+
自然花期4-6月,人工栽培可全年开花(盛花期12-3月)
@@ -37,7 +44,7 @@
-
+
🎬 新手种植教程
diff --git a/project.private.config.json b/project.private.config.json
index 2feefa4..0c9a4af 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -20,24 +20,5 @@
"bigPackageSizeSupport": false
},
"libVersion": "3.10.1",
- "condition": {
- "miniprogram": {
- "list": [
- {
- "name": "pages/badge/info",
- "pathName": "pages/badge/info",
- "query": "id=49a35d4a-d70c-11f0-b37c-bc2411e64a23",
- "scene": null,
- "launchMode": "default"
- },
- {
- "name": "pages/badge/more",
- "pathName": "pages/badge/more",
- "query": "",
- "launchMode": "default",
- "scene": null
- }
- ]
- }
- }
+ "condition": {}
}
\ No newline at end of file
diff --git a/static/img/badge.png b/static/img/badge.png
new file mode 100644
index 0000000..20de74d
Binary files /dev/null and b/static/img/badge.png differ
diff --git a/static/img/badge1.png b/static/img/badge1.png
new file mode 100644
index 0000000..10e755e
Binary files /dev/null and b/static/img/badge1.png differ
diff --git a/static/img/community.png b/static/img/community.png
new file mode 100644
index 0000000..a8b087a
Binary files /dev/null and b/static/img/community.png differ
diff --git a/static/img/community1.png b/static/img/community1.png
new file mode 100644
index 0000000..c786b34
Binary files /dev/null and b/static/img/community1.png differ
diff --git a/static/img/flower.png b/static/img/flower.png
new file mode 100644
index 0000000..886b2d0
Binary files /dev/null and b/static/img/flower.png differ
diff --git a/static/img/flower1.png b/static/img/flower1.png
new file mode 100644
index 0000000..d8dac31
Binary files /dev/null and b/static/img/flower1.png differ
diff --git a/static/img/user.png b/static/img/user.png
new file mode 100644
index 0000000..6055875
Binary files /dev/null and b/static/img/user.png differ
diff --git a/static/img/user1.png b/static/img/user1.png
new file mode 100644
index 0000000..ba4b4d3
Binary files /dev/null and b/static/img/user1.png differ
diff --git a/static/img/water.png b/static/img/water.png
new file mode 100644
index 0000000..fdc4c71
Binary files /dev/null and b/static/img/water.png differ
diff --git a/static/img/water1.png b/static/img/water1.png
new file mode 100644
index 0000000..383db28
Binary files /dev/null and b/static/img/water1.png differ
diff --git a/utils/util.js b/utils/util.js
index 764bc2c..8702754 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -1,19 +1,28 @@
-const formatTime = date => {
- const year = date.getFullYear()
- const month = date.getMonth() + 1
- const day = date.getDate()
- const hour = date.getHours()
- const minute = date.getMinutes()
- const second = date.getSeconds()
+// utils/util.js
- return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
-}
+/**
+ * 获取胶囊按钮的布局位置信息
+ * 用于对齐自定义导航栏
+ */
+export const getNavLayout = () => {
+ // 1. 获取胶囊位置信息
+ const menu = wx.getMenuButtonBoundingClientRect();
+
+ // 2. 获取系统信息(为了计算右侧间距)
+ const system = wx.getSystemInfoSync();
+
+ // 3. 计算左侧间距(为了和右侧胶囊对称)
+ // 屏幕宽度 - 胶囊右边界 = 胶囊距离屏幕右边的距离
+ const gap = system.windowWidth - menu.right;
-const formatNumber = n => {
- n = n.toString()
- return n[1] ? n : `0${n}`
-}
-
-module.exports = {
- formatTime
-}
+ return {
+ // 直接生成可用的 style 字符串
+ // 容器 style: 紧贴胶囊顶部,高度一致,左边距对称
+ containerStyle: `top: ${menu.top}px; height: ${menu.height}px; left: ${gap}px;`,
+
+ // 如果你需要单独的数值,也返回出去
+ top: menu.top,
+ height: menu.height,
+ gap: gap
+ };
+}
\ No newline at end of file