fix 任务工单
19
app.json
@ -22,7 +22,8 @@
|
|||||||
"pages/knowlage/index",
|
"pages/knowlage/index",
|
||||||
"pages/knowlage/info",
|
"pages/knowlage/info",
|
||||||
"pages/badge/more",
|
"pages/badge/more",
|
||||||
"pages/badge/info"
|
"pages/badge/info",
|
||||||
|
"pages/garden/record"
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"navigationBarTextStyle": "black",
|
"navigationBarTextStyle": "black",
|
||||||
@ -42,29 +43,29 @@
|
|||||||
"text": "花园"
|
"text": "花园"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"iconPath": "static/img/home.png",
|
"iconPath": "static/img/water.png",
|
||||||
"selectedIconPath": "static/img/home1.png",
|
"selectedIconPath": "static/img/water1.png",
|
||||||
"pagePath": "pages/garden/index",
|
"pagePath": "pages/garden/index",
|
||||||
"iconSize": 48,
|
"iconSize": 48,
|
||||||
"text": "任务"
|
"text": "任务"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"iconPath": "static/img/home.png",
|
"iconPath": "static/img/community.png",
|
||||||
"selectedIconPath": "static/img/home1.png",
|
"selectedIconPath": "static/img/community1.png",
|
||||||
"pagePath": "pages/community/index",
|
"pagePath": "pages/community/index",
|
||||||
"iconSize": 48,
|
"iconSize": 48,
|
||||||
"text": "社区"
|
"text": "社区"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"iconPath": "static/img/home.png",
|
"iconPath": "static/img/badge.png",
|
||||||
"selectedIconPath": "static/img/home1.png",
|
"selectedIconPath": "static/img/badge1.png",
|
||||||
"pagePath": "pages/badge/index",
|
"pagePath": "pages/badge/index",
|
||||||
"iconSize": 48,
|
"iconSize": 48,
|
||||||
"text": "成就"
|
"text": "成就"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"iconPath": "static/img/clock.png",
|
"iconPath": "static/img/user.png",
|
||||||
"selectedIconPath": "static/img/clock1.png",
|
"selectedIconPath": "static/img/user1.png",
|
||||||
"pagePath": "pages/user/index",
|
"pagePath": "pages/user/index",
|
||||||
"iconSize": 48,
|
"iconSize": 48,
|
||||||
"text": "我的"
|
"text": "我的"
|
||||||
|
|||||||
@ -128,6 +128,7 @@ Page({
|
|||||||
var data = JSON.parse(res.data);
|
var data = JSON.parse(res.data);
|
||||||
if (data.code === 200) {
|
if (data.code === 200) {
|
||||||
const ossIds =[data.data.file.id]
|
const ossIds =[data.data.file.id]
|
||||||
|
_this.fetchCheck(data.data.file.id)
|
||||||
_this.data.form.ossIds = ossIds
|
_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){
|
input(e){
|
||||||
const value = e.detail.value
|
const value = e.detail.value
|
||||||
this.data.form.name = value
|
this.data.form.name = value
|
||||||
@ -163,8 +178,9 @@ Page({
|
|||||||
const tmps = res.data
|
const tmps = res.data
|
||||||
if (tmps != null){
|
if (tmps != null){
|
||||||
this.setData({badge: tmps[0],show:true})
|
this.setData({badge: tmps[0],show:true})
|
||||||
|
} else {
|
||||||
|
wx.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wx.showModal({
|
wx.showModal({
|
||||||
content: res.msg
|
content: res.msg
|
||||||
|
|||||||
@ -19,13 +19,12 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="row padding mt-32">
|
<view class="row padding mt-32">
|
||||||
<view>植物信息</view>
|
|
||||||
<view class="mt-32">
|
<view class="mt-32">
|
||||||
<view>
|
<view>
|
||||||
<view class="custom-label font-14 ml-32">植物名称 </view>
|
<view class="custom-label font-14 ml-32">植物名称 </view>
|
||||||
<view></view>
|
<view></view>
|
||||||
</view>
|
</view>
|
||||||
<t-input placeholder="请输入植物名称" bind:change="input" layout="vertical">
|
<t-input placeholder="请输入植物名称" bind:change="input" value="{{form.name}}" layout="vertical">
|
||||||
</t-input>
|
</t-input>
|
||||||
|
|
||||||
<view class="mt-32">
|
<view class="mt-32">
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
<view style="padding: 0 32rpx ;">全部徽章</view>
|
<view style="padding: 0 32rpx ;">全部徽章</view>
|
||||||
<view class="padding">
|
<view class="padding">
|
||||||
<view class="grid">
|
<view class="grid">
|
||||||
<view wx:for="{{list}}" class="row padding">
|
<view wx:for="{{list}}" wx:key="index" class="row padding">
|
||||||
<view>{{item.title}}</view>
|
<view>{{item.title}}</view>
|
||||||
<view>
|
<view>
|
||||||
<view class="flex flex-center mt-32">
|
<view class="flex flex-center mt-32">
|
||||||
|
|||||||
@ -40,6 +40,10 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
goBack(){
|
||||||
|
wx.navigateBack()
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面隐藏
|
* 生命周期函数--监听页面隐藏
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
{{info.desc}}
|
{{info.desc}}
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<t-button shape="round" theme="primary" ghost style="width: 80%; margin-top: 98rpx;">返回</t-button>
|
<t-button shape="round" theme="primary" ghost style="width: 80%; margin-top: 98rpx;" bind:tap="goBack">返回</t-button>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -22,7 +22,9 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
goInfo(e){
|
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({
|
wx.navigateTo({
|
||||||
url: '../badge/info?id='+ id,
|
url: '../badge/info?id='+ id,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<!--pages/badge/more.wxml-->
|
<!--pages/badge/more.wxml-->
|
||||||
<view class="padding">
|
<view class="padding">
|
||||||
<view class="grid mt-32">
|
<view class="grid mt-32">
|
||||||
<view wx:for="{{list}}" class="flex flex-center flex-col" data-id="{{item.badgeId}}" bind:tap="goInfo">
|
<view wx:for="{{list}}" class="flex flex-center flex-col" data-item="{{item}}" bind:tap="goInfo">
|
||||||
<image src="{{item.oss.url}}" class="badge"></image>
|
<image src="{{item.oss.url}}" class="badge"></image>
|
||||||
<view class="white mt-16">{{item.name}}</view>
|
<view class="white mt-16">{{item.name}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -1,28 +1,159 @@
|
|||||||
// pages/garden/components/growth.js
|
// pages/garden/components/growth.js
|
||||||
|
const config = require("../../../config/config");
|
||||||
|
const {
|
||||||
|
api
|
||||||
|
} = require("../../../utils/api");
|
||||||
Component({
|
Component({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件的属性列表
|
* 组件的属性列表
|
||||||
*/
|
*/
|
||||||
properties: {
|
properties: {
|
||||||
|
plantId: {
|
||||||
|
type: String,
|
||||||
|
require: true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
observers: {
|
||||||
|
// 监听 visible 的变化
|
||||||
|
'plantId': function (newVal) {
|
||||||
|
console.log(newVal);
|
||||||
|
this.setData({
|
||||||
|
id: newVal
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件的初始数据
|
* 组件的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
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: {
|
methods: {
|
||||||
change(){
|
change() {
|
||||||
const tmp = !this.data.visible
|
const tmp = !this.data.visible
|
||||||
console.log(tmp);
|
|
||||||
this.setData({visible: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: ""
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -3,6 +3,7 @@
|
|||||||
"styleIsolation": "apply-shared",
|
"styleIsolation": "apply-shared",
|
||||||
"usingComponents": {
|
"usingComponents": {
|
||||||
"t-popup": "tdesign-miniprogram/popup/popup",
|
"t-popup": "tdesign-miniprogram/popup/popup",
|
||||||
|
"t-check-tag": "tdesign-miniprogram/check-tag/check-tag",
|
||||||
"t-textarea": "tdesign-miniprogram/textarea/textarea"
|
"t-textarea": "tdesign-miniprogram/textarea/textarea"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,32 +1,36 @@
|
|||||||
<!--pages/garden/components/growth.wxml-->
|
<!--pages/garden/components/growth.wxml-->
|
||||||
<view>
|
<view>
|
||||||
<t-fab icon="heart" bind:click="change" text="记录成长"></t-fab>
|
<t-fab icon="heart" bind:click="change" text="记录成长"></t-fab>
|
||||||
<t-popup visible="{{visible}}" bind:visible-change="change" placement="bottom">
|
<t-popup visible="{{visible}}" bind:visible-change="change" placement="bottom" >
|
||||||
<view class="padding">
|
<view class="padding">
|
||||||
<view class="text-center">记录生长瞬间</view>
|
<view class="text-center">记录生长瞬间</view>
|
||||||
<view class="border mt-32 flex flex-center flex-col">
|
<view class="border mt-32 flex flex-center flex-col" >
|
||||||
<view class="flex flex-center flex-col">
|
<view class="flex flex-center flex-col" wx:if="{{pic.length === 0}}" bind:tap="upload">
|
||||||
<view class="camera flex flex-center">
|
<view class="camera flex flex-center">
|
||||||
<t-icon name="camera-filled" class="primary" size="24"></t-icon>
|
<t-icon name="camera-filled" class="primary" size="24"></t-icon>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-32">点击上传或拍摄植物照片</view>
|
<view class="mt-32">点击上传或拍摄植物照片</view>
|
||||||
<view class="mt-16 font-12 grey">支持JPG、PNG 格式,最大 5MB</view>
|
<view class="mt-16 font-12 grey">支持JPG、PNG 格式,最大 5MB</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view wx:else class="flex flex-center full-width">
|
||||||
|
<image src="{{pic}}" mode="aspectFill" style="height: 398rpx;padding: 0rpx; border-radius: 16rpx; width: 100%;"></image>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex flex-center flex-justify-around mt-32 mb-16">
|
|
||||||
<t-tag>日常</t-tag>
|
|
||||||
<t-tag>发芽</t-tag>
|
|
||||||
<t-tag>开花</t-tag>
|
|
||||||
<t-tag>结果</t-tag>
|
|
||||||
</view>
|
|
||||||
<view>
|
|
||||||
<t-textarea placeholder="写下此刻的心情…"></t-textarea>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="flex flex-center">
|
|
||||||
<t-button theme="primary" shape="round" style="width: 80%;">保存记录</t-button>
|
|
||||||
</view>
|
|
||||||
|
<view class="flex flex-center flex-justify-around mt-32 mb-16">
|
||||||
|
<t-check-tag shape="round" theme="primary" variant="outline" wx:for="{{tags}}" data-index="{{index}}" bind:tap="check" checked="{{item.checked}}" content="{{item.label}}"></t-check-tag>
|
||||||
|
</view>
|
||||||
|
<view>
|
||||||
|
<t-textarea bind:change="input" value="{{form.content}}" placeholder="写下此刻的心情…"></t-textarea>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="flex flex-center">
|
||||||
|
<t-button theme="primary" shape="round" style="width: 80%;" bind:tap="submit">保存记录</t-button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</t-popup>
|
</t-popup>
|
||||||
</view>
|
</view>
|
||||||
@ -61,9 +61,11 @@ Page({
|
|||||||
changeStatus(data){
|
changeStatus(data){
|
||||||
api('/plant/makeCare','POST',data,'json').then(res => {
|
api('/plant/makeCare','POST',data,'json').then(res => {
|
||||||
if (res.code === 200){
|
if (res.code === 200){
|
||||||
wx.showToast({
|
wx.requestSubscribeMessage({
|
||||||
icon:'success',
|
tmplIds: ['iG5GYMPQAgKxIE9zZNOgKUghR6hP2WKKwws1RfLABuE'],
|
||||||
title: res.msg,
|
success (res) {
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
||||||
this.fetchList()
|
this.fetchList()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
const { api } = require("../../utils/api")
|
const { api } = require("../../utils/api")
|
||||||
|
import { getNavLayout } from '../../utils/util'; // 引入工具函数
|
||||||
// pages/index/info.js
|
// pages/index/info.js
|
||||||
Page({
|
Page({
|
||||||
|
|
||||||
@ -9,7 +9,9 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
id:'',
|
id:'',
|
||||||
farms:[],
|
farms:[],
|
||||||
weather:null
|
weather:null,
|
||||||
|
list:[],
|
||||||
|
backButtonStyle:''
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,6 +27,10 @@ Page({
|
|||||||
if(tmp){
|
if(tmp){
|
||||||
this.setData({weather:tmp})
|
this.setData({weather:tmp})
|
||||||
}
|
}
|
||||||
|
const layout = getNavLayout();
|
||||||
|
this.setData({
|
||||||
|
backButtonStyle: layout.containerStyle
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchInfo(){
|
fetchInfo(){
|
||||||
@ -36,11 +42,29 @@ Page({
|
|||||||
tmp.pic = tmp.imgList[0].url
|
tmp.pic = tmp.imgList[0].url
|
||||||
tmp.picList = tmp.imgList.map(sub => sub.url)
|
tmp.picList = tmp.imgList.map(sub => sub.url)
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp.todayCares.map(e => e.period = tmp.carePlans.find(sub => sub.name === e.name).period)
|
tmp.todayCares.map(e => e.period = tmp.carePlans.find(sub => sub.name === e.name).period)
|
||||||
this.setData({info:res.data})
|
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){
|
goPreview(e){
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- back -->
|
<!-- back -->
|
||||||
<view style="z-index: 999;position: fixed; top: 110rpx; left: 32rpx; background-color: #34343482 ; width: 60rpx ; height: 60rpx; border-radius: 30rpx; " bind:tap="goBack">
|
<view style="z-index: 999;position: fixed; background-color: #34343482 ; width: 60rpx ; height: 60rpx; border-radius: 30rpx; {{backButtonStyle}} " bind:tap="goBack">
|
||||||
<view class="flex flex-center" style="width: 100%;height: 100%;">
|
<view class="flex flex-center" style="width: 100%;height: 100%;">
|
||||||
<t-icon name="chevron-left" size="48rpx" style="color: white;"></t-icon>
|
<t-icon name="chevron-left" size="48rpx" style="color: white;"></t-icon>
|
||||||
</view>
|
</view>
|
||||||
@ -77,8 +77,24 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="row padding mt-32">
|
<view class="row padding mt-32">
|
||||||
<view>成长日记</view>
|
<view>成长日记</view>
|
||||||
<view>
|
<scroll-view scroll-x="{{true}}" class="mt-32" wx:if="{{list.length > 0}}">
|
||||||
|
<view class="flex flex-center flex-justify-start">
|
||||||
|
<view wx:for="{{list}}" data-index="{{index}}" bind:tap="goRecord" class="flex flex-center flex-col mr-32" style="width: 200rpx; background-color: whitesmoke; border-radius: 16rpx;">
|
||||||
|
<image src="{{item.imgList[0].url}}" mode="aspectFill" style="width: 200rpx;height: 200rpx; border-top-left-radius: 16rpx; border-top-right-radius: 16rpx;"></image>
|
||||||
|
<t-tag class="mt-16 mb-16" size="small" variant="outline" shape="round" theme="primary">{{item.tag}}</t-tag>
|
||||||
|
<view class="font-12 font-sub" style="padding-bottom: 16rpx ">
|
||||||
|
<view class="font-black">{{item.createdAtStr}}</view>
|
||||||
|
<view wx:if="{{item.content}}" style="white-space: nowrap; text-overflow: ellipsis; overflow: hidden; width: 180rpx;">
|
||||||
|
{{item.content}}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
<view wx:else class="flex flex-center flex-col mt-32 mb-32">
|
||||||
|
<image src="https://res.catter.cn/pub/2025/12/17/20251217141102941.png" style="width: 300rpx;" mode="widthFix"></image>
|
||||||
|
<view class="grey mt-32 font-14">美好的成长时光等你开启</view>
|
||||||
|
<view class="grey font-12 mt-16">点击右下角 “记录成长” 拍张照片,定格它现在的样子</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="row padding mt-32">
|
<view class="row padding mt-32">
|
||||||
@ -97,7 +113,7 @@
|
|||||||
<view>
|
<view>
|
||||||
<view class="flex flex-center flex-justify-between">
|
<view class="flex flex-center flex-justify-between">
|
||||||
<view>{{item.name}}</view>
|
<view>{{item.name}}</view>
|
||||||
<view class="font-12 grey ml-16">{{item.careTimeStr}}</view>
|
<view class="font-12 grey ml-16">{{item.careTimeStr}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{item.lastPeriod === 0}}" style="background-color: {{item.color}}3c; color: {{item.color}}; padding: 8rpx; border-radius: 30rpx;margin-top: 8rpx;font-size: 12px;">今天</view>
|
<view wx:if="{{item.lastPeriod === 0}}" style="background-color: {{item.color}}3c; color: {{item.color}}; padding: 8rpx; border-radius: 30rpx;margin-top: 8rpx;font-size: 12px;">今天</view>
|
||||||
<view class="mt-16 font-12">{{item.remark}}</view>
|
<view class="mt-16 font-12">{{item.remark}}</view>
|
||||||
@ -111,6 +127,5 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<growth wx:if="{{info}}" plantId="{{info.id}}" bind:ok="fetchInfo" />
|
||||||
<growth/>
|
|
||||||
</view>
|
</view>
|
||||||
157
pages/garden/record.js
Normal file
@ -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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
8
pages/garden/record.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"navigationStyle": "custom",
|
||||||
|
"navigationBarBackgroundColor": "#000",
|
||||||
|
"navigationBarTextStyle":"white",
|
||||||
|
"usingComponents": {
|
||||||
|
"t-swiper": "tdesign-miniprogram/swiper/swiper"
|
||||||
|
}
|
||||||
|
}
|
||||||
23
pages/garden/record.wxml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<!--pages/garden/record.wxml-->
|
||||||
|
<view>
|
||||||
|
<view class="top" style="position: relative; z-index: 2;">
|
||||||
|
<t-swiper style="width: 100vw;border-radius: 0%;" current="{{current}}" bind:change="change" height="100vh" list="{{picList}}" bind:click="goPreview">
|
||||||
|
</t-swiper>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- back -->
|
||||||
|
|
||||||
|
<view style="z-index: 999;position: fixed; background-color: #34343482 ; width: 60rpx ; height: 60rpx; border-radius: 30rpx; {{backButtonStyle}}" bind:tap="goBack">
|
||||||
|
<view class="flex flex-center" style="width: 100%;height: 100%;">
|
||||||
|
<t-icon name="chevron-left" size="48rpx" style="color: white;"></t-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view style="z-index: 999;position: fixed; bottom: 0rpx; width: 100vw;background-color: #0000003c; padding-bottom: 60rpx;">
|
||||||
|
<view class="padding white flex flex-center flex-col">
|
||||||
|
<t-tag shape="round" theme="primary">{{info.tag}}</t-tag>
|
||||||
|
<view class="font-12 mt-16 bold white" >{{info.createdAtStr}}</view>
|
||||||
|
<view class="font-16 mt-16 bold white" >{{info.content}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
1
pages/garden/record.wxss
Normal file
@ -0,0 +1 @@
|
|||||||
|
/* pages/garden/record.wxss */
|
||||||
@ -115,6 +115,7 @@ Page({
|
|||||||
if (res.data === null) {
|
if (res.data === null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.data.list.length === 0) {
|
if (res.data.list.length === 0) {
|
||||||
this.fetchHotList()
|
this.fetchHotList()
|
||||||
return
|
return
|
||||||
@ -139,28 +140,36 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
fetchHotList() {
|
fetchHotList() {
|
||||||
api('/library/list', 'POST', {
|
api('/claim/list', 'POST', {
|
||||||
isHot: 0,
|
|
||||||
current: 0,
|
current: 0,
|
||||||
pageSize: 6
|
pageSize: 10,
|
||||||
|
name: '',
|
||||||
|
keyword: ''
|
||||||
}, 'json').then(res => {
|
}, 'json').then(res => {
|
||||||
if (res.code === 200) {
|
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.pic = e.imgList[0].url
|
||||||
|
e.status = e.points < this.data.points ? 0 : 1
|
||||||
return e
|
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({
|
this.setData({
|
||||||
hotList: data
|
hotList: tmps
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
addItems(newItems) {
|
addItems(newItems) {
|
||||||
let h1 = 0;
|
let h1 = 0;
|
||||||
let h2 = 0;
|
let h2 = 0;
|
||||||
newItems.forEach((item, index) => {
|
newItems.forEach((item, index) => {
|
||||||
// 动态获取图片尺寸
|
|
||||||
if (index % 2 === 0) {
|
if (index % 2 === 0) {
|
||||||
this.data.leftList.push(item);
|
this.data.leftList.push(item);
|
||||||
h1 += item.cover.height / item.cover.width;
|
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) {
|
goInfo(e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
const id = e.currentTarget.dataset.id
|
const id = e.currentTarget.dataset.id
|
||||||
|
|||||||
@ -98,14 +98,13 @@
|
|||||||
<view class="mt-32 white-bg padding row">
|
<view class="mt-32 white-bg padding row">
|
||||||
<view class="flex flex-center font-12 grey">您还可以从以下热门植物中,免费领取</view>
|
<view class="flex flex-center font-12 grey">您还可以从以下热门植物中,免费领取</view>
|
||||||
<view class="grid mt-32">
|
<view class="grid mt-32">
|
||||||
<view wx:for="{{hotList}}">
|
<view wx:for="{{hotList}}" data-id="{{item.id}}" bind:tap="goStore">
|
||||||
<image src="{{item.pic}}" style="width:40vw;height: 40vw; border-top-left-radius: 12rpx;border-top-right-radius: 12rpx;" mode="widthFix"></image>
|
<image src="{{item.pic}}" style="width:40vw;height: 40vw; border-top-left-radius: 12rpx;border-top-right-radius: 12rpx;" mode="aspectFill"></image>
|
||||||
<view>
|
<view>
|
||||||
<view class="flex flex-center flex-justify-start">
|
<view class="flex flex-center flex-justify-start">
|
||||||
<view class="font-16 bold">{{item.name}}</view>
|
<view class="font-16 bold">{{item.name}}</view>
|
||||||
<t-tag theme="primary" class="ml-16" size="small">{{item.genus}}</t-tag>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="font-12 grey">{{item.lifeCycle}} {{item.lightIntensity}}</view>
|
<t-tag theme="primary" size="small">{{item.tag}}</t-tag>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -33,7 +33,7 @@ Page({
|
|||||||
},
|
},
|
||||||
|
|
||||||
fetchList(){
|
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){
|
if (res.code === 200){
|
||||||
const tmps = res.data.list.map(e => {
|
const tmps = res.data.list.map(e => {
|
||||||
e.pic = e.imgList[0].url
|
e.pic = e.imgList[0].url
|
||||||
|
|||||||
@ -28,7 +28,7 @@
|
|||||||
<view>
|
<view>
|
||||||
<view class="font-12 mt-16 white font-sub flex flex-center flex-justify-start" style="background-color: #e6e6e6;width: auto; border-radius: 40rpx; padding: 8rpx 10rpx">
|
<view class="font-12 mt-16 white font-sub flex flex-center flex-justify-start" style="background-color: #e6e6e6;width: auto; border-radius: 40rpx; padding: 8rpx 10rpx">
|
||||||
<view>难度:</view>
|
<view>难度:</view>
|
||||||
<t-rate size="small" value="{{3}}" count="{{3}}" />
|
<t-rate size="small" value="{{item.difficulty}}" count="{{item.difficulty}}" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/* pages/knowlage/index.wxss */
|
/* pages/knowlage/index.wxss */
|
||||||
.grid {
|
.grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: auto auto;
|
grid-template-columns: 49% 49%;
|
||||||
grid-row-gap: 8px;
|
grid-row-gap: 8px;
|
||||||
grid-column-gap: 8px;
|
grid-column-gap: 8px;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
const { api } = require("../../utils/api")
|
const { api } = require("../../utils/api")
|
||||||
|
import {
|
||||||
|
getNavLayout
|
||||||
|
} from '../../utils/util'; // 引入工具函数
|
||||||
|
|
||||||
// pages/knowlage/info.js
|
// pages/knowlage/info.js
|
||||||
Page({
|
Page({
|
||||||
@ -8,7 +11,9 @@ Page({
|
|||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
id:'',
|
id:'',
|
||||||
info:null
|
info:null,
|
||||||
|
backButtonStyle:''
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,6 +21,11 @@ Page({
|
|||||||
*/
|
*/
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.data.id = options.id
|
this.data.id = options.id
|
||||||
|
// 一行代码搞定计算
|
||||||
|
const layout = getNavLayout();
|
||||||
|
this.setData({
|
||||||
|
backButtonStyle: layout.containerStyle
|
||||||
|
});
|
||||||
this.fetchInfo()
|
this.fetchInfo()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
"navigationStyle":"custom",
|
"navigationStyle":"custom",
|
||||||
"usingComponents": {}
|
"usingComponents": {
|
||||||
|
"t-rate": "tdesign-miniprogram/rate/rate"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -5,7 +5,7 @@
|
|||||||
<image src="{{info.pic}}" style="width: 100vw; height: 680rpx;" mode="aspectFill"></image>
|
<image src="{{info.pic}}" style="width: 100vw; height: 680rpx;" mode="aspectFill"></image>
|
||||||
</view>
|
</view>
|
||||||
<!-- back -->
|
<!-- back -->
|
||||||
<view style="z-index: 999;position: fixed; top: 110rpx; left: 32rpx; background-color: #34343482 ; width: 60rpx ; height: 60rpx; border-radius: 30rpx; " bind:tap="goBack">
|
<view style="z-index: 999;position: fixed; background-color: #34343482 ; width: 60rpx ; height: 60rpx; border-radius: 30rpx; {{backButtonStyle}} " bind:tap="goBack">
|
||||||
<view class="flex flex-center" style="width: 100%;height: 100%;">
|
<view class="flex flex-center" style="width: 100%;height: 100%;">
|
||||||
<t-icon name="chevron-left" size="48rpx" style="color: white;"></t-icon>
|
<t-icon name="chevron-left" size="48rpx" style="color: white;"></t-icon>
|
||||||
</view>
|
</view>
|
||||||
@ -23,9 +23,14 @@
|
|||||||
<view class="font-14" style="padding: 0rpx 32rpx 32rpx 32rpx">植物学名称:{{info.latinName}}</view>
|
<view class="font-14" style="padding: 0rpx 32rpx 32rpx 32rpx">植物学名称:{{info.latinName}}</view>
|
||||||
<view style="padding: 0rpx 32rpx 32rpx 32rpx">
|
<view style="padding: 0rpx 32rpx 32rpx 32rpx">
|
||||||
<view class="grid">
|
<view class="grid">
|
||||||
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">🌍 多年生</view>
|
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">🌍 {{info.lifeCycle}}</view>
|
||||||
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">🌞 中光照</view>
|
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">🌞 {{info.lightType}}</view>
|
||||||
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">易养活</view>
|
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;" class="flex flex-center">
|
||||||
|
<view class="mr-32">
|
||||||
|
难易度
|
||||||
|
</view>
|
||||||
|
<t-rate size="small" value="{{info.difficulty}}" count="{{info.difficulty}}" />
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -57,7 +62,7 @@
|
|||||||
适宜温度范围: 15 - 25℃
|
适宜温度范围: 15 - 25℃
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-16 font-sub font-14">{{info.growthHabit}}</view>
|
<view class="mt-16 font-sub font-14">{{info.growthHabit}}</view>
|
||||||
<view class="mt-16 font-sub font-14">{{info.floweringPeriod}}</view>
|
<view class="mt-16 font-14 primary">{{info.stem}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -80,7 +85,7 @@
|
|||||||
<view class="font-sub font-12">花直径</view>
|
<view class="font-sub font-12">花直径</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-32 font-14 font-sub">{{info.floweringPeriod}}</view>
|
<view class="mt-32 font-14 font-sub">开花期:{{info.floweringPeriod}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|||||||
@ -141,6 +141,7 @@ Page({
|
|||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
const tmps = res.data
|
const tmps = res.data
|
||||||
tmps.content = tmps.content.trim()
|
tmps.content = tmps.content.trim()
|
||||||
|
tmps.postage = tmps.postage.toFixed(2)
|
||||||
this.setData({
|
this.setData({
|
||||||
info: tmps
|
info: tmps
|
||||||
})
|
})
|
||||||
|
|||||||
@ -15,38 +15,43 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="font-sub font-14" wx:else>
|
<view class="font-sub font-14" wx:else>
|
||||||
<view class="flex flex-center flex-col">
|
<view class="flex flex-center flex-col">
|
||||||
<view class="mb-16">
|
<view class="mb-16">
|
||||||
暂无收货地址
|
暂无收货地址
|
||||||
</view>
|
</view>
|
||||||
<t-button theme="primary" shape="round" style="width: 50vw;" class="mt-32 mb-32" bind:tap="chooseAddr">新增收获地址</t-button>
|
<t-button theme="primary" shape="round" style="width: 50vw;" class="mt-32 mb-32" bind:tap="chooseAddr">新增收获地址</t-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="row padding white-bg mt-32">
|
<view class="row padding white-bg mt-32">
|
||||||
<view>领养清单</view>
|
<view>领养清单</view>
|
||||||
<t-divider />
|
<t-divider />
|
||||||
<view class="flex flex-center flex-justify-start">
|
<view class="flex flex-center flex-justify-between">
|
||||||
<view>
|
<view class="flex flex-center flex-justify-start">
|
||||||
<image src="{{info.imgList[0].url}}" style="width: 120rpx;height: 120rpx; border-radius: 16rpx;" mode="aspectFill"></image>
|
<view>
|
||||||
|
<image src="{{info.imgList[0].url}}" style="width: 120rpx;height: 120rpx; border-radius: 16rpx;" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view class="ml-16">
|
||||||
|
<view class="font-16 bold">{{info.name}}</view>
|
||||||
|
<t-tag class="mt-16">{{info.tag}}</t-tag>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="ml-16">
|
<view>
|
||||||
<view class="font-16 bold">{{info.name}}</view>
|
x 1
|
||||||
<t-tag class="mt-16">{{info.tag}}</t-tag>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<t-divider />
|
<t-divider />
|
||||||
<view class="flex flex-center flex-justify-between">
|
<view class="flex flex-center flex-justify-between">
|
||||||
<view>快递运费:¥ 12.00</view>
|
<view>快递运费:¥ {{info.postage}}</view>
|
||||||
<view class="bold mt-16">¥ 12.00</view>
|
<view class="bold mt-16">¥ {{info.postage}}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="row padding white-bg mt-32">
|
<view class="row padding white-bg mt-32">
|
||||||
<view class="flex flex-center flex-justify-start " bind:tap="change">
|
<view class="flex flex-center flex-justify-start " bind:tap="change">
|
||||||
<t-icon name="{{checked ? 'check-circle-filled':'check-circle'}}" class="{{checked ?'primary':'black' }}" size="18"></t-icon>
|
<t-icon name="{{checked ? 'check-circle-filled':'check-circle'}}" class="{{checked ?'primary':'black' }}" size="18"></t-icon>
|
||||||
<view slot="label" class="font-14 w400 ml-5" >
|
<view slot="label" class="font-14 w400 ml-5">
|
||||||
我承诺会好好照顾它,不随意丢弃。
|
我承诺会好好照顾它,不随意丢弃。
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -54,7 +59,7 @@
|
|||||||
|
|
||||||
<view class="bottom white-bg">
|
<view class="bottom white-bg">
|
||||||
<view class="flex flex-center flex-justify-between full-width">
|
<view class="flex flex-center flex-justify-between full-width">
|
||||||
<view>合计:¥ 12.00元</view>
|
<view>合计:<p class="bold">¥ {{info.postage}}</p> 元</view>
|
||||||
<view style="width: 400rpx;">
|
<view style="width: 400rpx;">
|
||||||
<t-button theme="primary" shape="round" style="width: 100%;" bind:tap="pay">支付邮费,接它回家</t-button>
|
<t-button theme="primary" shape="round" style="width: 100%;" bind:tap="pay">支付邮费,接它回家</t-button>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@ -9,7 +9,8 @@ Page({
|
|||||||
data: {
|
data: {
|
||||||
id:'',
|
id:'',
|
||||||
info:null,
|
info:null,
|
||||||
points: 0
|
points: 0,
|
||||||
|
libraryInfo:null
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,6 +44,9 @@ Page({
|
|||||||
tmps.content = tmps.content.trim()
|
tmps.content = tmps.content.trim()
|
||||||
this.setData({info:tmps})
|
this.setData({info:tmps})
|
||||||
wx.hideLoading()
|
wx.hideLoading()
|
||||||
|
if(tmps.libraryId != ""){
|
||||||
|
this.fetchLibrary(tmps.libraryId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -50,6 +54,21 @@ Page({
|
|||||||
this.setData({points:points})
|
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){
|
goPreview(e){
|
||||||
const currentUrl = e.currentTarget.dataset.url; // 获取当前点击的图片链接
|
const currentUrl = e.currentTarget.dataset.url; // 获取当前点击的图片链接
|
||||||
const list = this.data.info.imgList.map(e => e.url)
|
const list = this.data.info.imgList.map(e => e.url)
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
{
|
{
|
||||||
"usingComponents": {}
|
"usingComponents": {
|
||||||
|
"t-rate": "tdesign-miniprogram/rate/rate"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -9,26 +9,33 @@
|
|||||||
<t-tag>{{info.tag}}</t-tag>
|
<t-tag>{{info.tag}}</t-tag>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view>
|
||||||
<view class="price-tag-badge">
|
<view class="price-tag-badge">
|
||||||
需 {{info.points}} 阳光值
|
需 {{info.points}} 阳光值
|
||||||
|
</view>
|
||||||
|
<view class="font-12 font-sub" style="text-align: right; padding-right: 16rpx; margin-top: 16rpx;">剩余库存 {{info.stock}} 株</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class=" padding white-bg mt-32" style="margin:32rpx; border-radius: 16rpx;">
|
<view class=" padding white-bg mt-32" style="margin:32rpx; border-radius: 16rpx;">
|
||||||
<view>🌳 植物公民档案</view>
|
<view>💻 植物公民档案</view>
|
||||||
<view class="mt-16 content-text">{{info.content}}
|
<view class="mt-16 content-text">{{info.content}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class=" padding white-bg mt-32" style="margin:32rpx; border-radius: 16rpx;">
|
<view class=" padding white-bg mt-32" style="margin:32rpx; border-radius: 16rpx;">
|
||||||
<view>🌳 植物百科</view>
|
<view class="flex flex-center flex-justify-between" bind:tap="goInfo">
|
||||||
|
<view>🌳 植物百科 {{libraryInfo.name}}</view>
|
||||||
|
<t-icon name="chevron-right"></t-icon>
|
||||||
|
</view>
|
||||||
<view class="mt-16 content-text">
|
<view class="mt-16 content-text">
|
||||||
<view class="grid">
|
<view class="grid">
|
||||||
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">🌍 多年生</view>
|
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">🌍 {{libraryInfo.lifeCycle}}</view>
|
||||||
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">🌞 中光照</view>
|
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">🌞 {{libraryInfo.lightIntensity}}</view>
|
||||||
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;">易养活</view>
|
<view style="width: 100%;background-color: #4B84EE1C;border-radius: 8rpx;text-align: center;padding: 10rpx 0;" class="flex flex-center ">
|
||||||
|
<view>难度 </view>
|
||||||
|
<view><t-rate size="small" value="{{libraryInfo.difficulty}}" count="{{libraryInfo.difficulty}}" /></view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="font-12 mt-16" style="color: #00000099;">
|
<view class="font-12 mt-16" style="color: #00000099;">
|
||||||
<view>自然花期4-6月,人工栽培可全年开花(盛花期12-3月)</view>
|
<view>自然花期4-6月,人工栽培可全年开花(盛花期12-3月)</view>
|
||||||
@ -37,7 +44,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class=" padding white-bg mt-32" style="margin:32rpx; border-radius: 16rpx;" bind:tap="openVideo">
|
<view class=" padding white-bg mt-32" style="margin:32rpx; border-radius: 16rpx;" bind:tap="openVideo">
|
||||||
<view> 🎬 新手种植教程</view>
|
<view> 🎬 新手种植教程</view>
|
||||||
<view>
|
<view>
|
||||||
<image src="https://res.catter.cn/pub/2025/12/09/20251209111759009.png" style="width: 85vw;" mode="widthFix"></image>
|
<image src="https://res.catter.cn/pub/2025/12/09/20251209111759009.png" style="width: 85vw;" mode="widthFix"></image>
|
||||||
|
|||||||
@ -20,24 +20,5 @@
|
|||||||
"bigPackageSizeSupport": false
|
"bigPackageSizeSupport": false
|
||||||
},
|
},
|
||||||
"libVersion": "3.10.1",
|
"libVersion": "3.10.1",
|
||||||
"condition": {
|
"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
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
BIN
static/img/badge.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
static/img/badge1.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
static/img/community.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
static/img/community1.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
static/img/flower.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
static/img/flower1.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
static/img/user.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
static/img/user1.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
static/img/water.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
static/img/water1.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
@ -1,19 +1,28 @@
|
|||||||
const formatTime = date => {
|
// utils/util.js
|
||||||
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()
|
|
||||||
|
|
||||||
return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
|
/**
|
||||||
}
|
* 获取胶囊按钮的布局位置信息
|
||||||
|
* 用于对齐自定义导航栏
|
||||||
|
*/
|
||||||
|
export const getNavLayout = () => {
|
||||||
|
// 1. 获取胶囊位置信息
|
||||||
|
const menu = wx.getMenuButtonBoundingClientRect();
|
||||||
|
|
||||||
const formatNumber = n => {
|
// 2. 获取系统信息(为了计算右侧间距)
|
||||||
n = n.toString()
|
const system = wx.getSystemInfoSync();
|
||||||
return n[1] ? n : `0${n}`
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
// 3. 计算左侧间距(为了和右侧胶囊对称)
|
||||||
formatTime
|
// 屏幕宽度 - 胶囊右边界 = 胶囊距离屏幕右边的距离
|
||||||
|
const gap = system.windowWidth - menu.right;
|
||||||
|
|
||||||
|
return {
|
||||||
|
// 直接生成可用的 style 字符串
|
||||||
|
// 容器 style: 紧贴胶囊顶部,高度一致,左边距对称
|
||||||
|
containerStyle: `top: ${menu.top}px; height: ${menu.height}px; left: ${gap}px;`,
|
||||||
|
|
||||||
|
// 如果你需要单独的数值,也返回出去
|
||||||
|
top: menu.top,
|
||||||
|
height: menu.height,
|
||||||
|
gap: gap
|
||||||
|
};
|
||||||
}
|
}
|
||||||