fix 任务工单

This commit is contained in:
sdaduanbilei 2025-12-16 16:05:48 +08:00
parent a5782aba7c
commit 71b261d1d6
23 changed files with 393 additions and 99 deletions

View File

@ -20,7 +20,9 @@
"pages/store/info",
"pages/order/index",
"pages/knowlage/index",
"pages/knowlage/info"
"pages/knowlage/info",
"pages/badge/more",
"pages/badge/info"
],
"window": {
"navigationBarTextStyle": "black",

View File

@ -1,3 +1,5 @@
const { api } = require("../../utils/api")
// pages/badge/index.js
Page({
@ -5,44 +7,15 @@ Page({
* 页面的初始数据
*/
data: {
pics: [
'https://tdesign.gtimg.com/mobile/demos/avatar1.png',
'https://tdesign.gtimg.com/mobile/demos/avatar2.png',
'https://tdesign.gtimg.com/mobile/demos/avatar3.png',
'https://tdesign.gtimg.com/mobile/demos/avatar4.png',
'https://tdesign.gtimg.com/mobile/demos/avatar5.png',
'https://tdesign.gtimg.com/mobile/demos/avatar1.png',
],
list:[
{
title:'养护徽章',
badge:'勤劳小园丁',
tips:'累计浇水 10 次'
},
{
title:'成长徽章',
badge:'花开有时',
tips:'第一次开花'
},
{
title:'收藏徽章',
badge:'花园掌柜',
tips:'添加 20 株'
},
{
title:'挑战徽章',
badge:'人气花匠',
tips:'帖子获得 10 个赞'
}
]
myList: [],
list:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
@ -56,9 +29,31 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.fetchList()
},
fetchList(){
api('/badge/my/list','POST',{current:0, pageSize:999},'json').then(res => {
if (res.code === 200) {
const tmps = res.data.list
this.setData({myList:tmps})
}
})
api('/badge/all','GET',{current:0, pageSize:999},'json').then(res => {
if (res.code === 200) {
const tmps = res.data
this.setData({list:tmps})
}
})
},
goMore(e){
const list = e.currentTarget.dataset.list
wx.setStorageSync('badges', JSON.stringify(list))
wx.navigateTo({
url: '../badge/more',
})
},
/**
* 生命周期函数--监听页面隐藏
*/

View File

@ -1,62 +1,51 @@
<!--pages/badge/index.wxml-->
<view>
<view class="padding">
<view class="bg">
<view class="padding flex flex-center flex-justify-between">
<view class="card flex flex-center flex-aligin-start flex-justify-start flex-col">
<view class="month flex flex-center white bold">
Nov
</view>
<view style="width: 100%;font-size: 24px;font-weight: bold; text-align: center;">
1
</view>
</view>
<view>
<view>
<t-avatar-group max="3" collapseAvatar="+5" size="small">
<t-avatar wx:for="{{pics}}" wx:for-item="pic" wx:key="index" image="{{pic}}" />
<view class="white-bg row padding">
<view>我的徽章</view>
<view wx:if="{{myList.length > 0}}">
<view class="flex flex-center flex-col">
<image src="{{myList[0].oss.url}}" style="width: 200rpx; height: 200rpx;"></image>
<view class="mt-16 font-16 bold">{{myList[0].name}}</view>
<view class="font-14 font-sub mt-16">{{myList[0].desc}}</view>
<view class="font-14 font-sub mt-16">{{myList[0].createdAtStr}}</view>
<view class="flex flex-center flex-justify-between full-width mt-32">
<t-avatar-group max="10" collapseAvatar="+5" size="small">
<t-avatar wx:for="{{myList}}" wx:key="index" style="width: 60rpx;" image="{{item.oss.url}}" />
</t-avatar-group>
<view data-list="{{myList}}" bind:tap="goMore">
<view class="font-14 font-sub">已经获取{{myList.length}} 个</view>
<view class="font-12 primary">查看全部</view>
</view>
</view>
<view class="white font-12">已有100名参与月度挑战</view>
</view>
</view>
<view class="padding mt-32 flex flex-center flex-justify-start white bold">
<view class="badge">
<image mode="widthFix" style="width: 100rpx; height: 100rpx;" src="https://res.catter.cn/pub/2025/09/30/20250930143142508.png"></image>
</view>
<view class="ml-16 bold">
<view>多肉收割者挑战赛</view>
</view>
</view>
</view>
</view>
<view class="padding">
<view>我的徽章</view>
</view>
<view style="padding: 0 32rpx ;">全部徽章</view>
<view class="padding">
<view class="grid">
<view wx:for="{{list}}" class="row padding">
<view>{{item.title}}</view>
<view>
<view class="flex flex-center mt-32">
<image style="width: 200rpx; height: 200rpx;" mode="widthFix" src="https://res.catter.cn/pub/2025/09/30/20250930143142508.png"></image>
<image style="width: 200rpx; height: 200rpx;" mode="widthFix" src="{{item.badgeList[0].oss.url}}"></image>
</view>
<view class="flex flex-center bold mt-16 mb-16">
{{item.badge}}
{{item.categoryName}}
</view>
<view class="flex flex-center grey font-12">
{{item.tips}}
</view>
<view class="flex flex-center flex-justify-between mt-32">
<view>
<t-avatar-group max="2" collapseAvatar="+5" size="small" >
<t-avatar wx:for="{{2}}" wx:for-item="pic" wx:key="index" style="width: 60rpx;" image="https://res.catter.cn/pub/2025/09/30/20250930143142508.png" />
</t-avatar-group>
<t-avatar-group max="2" collapseAvatar="{{item.badgeList.length}}" size="small">
<t-avatar wx:for="{{item.badgeList}}" wx:for-item="sub" wx:key="index" style="width: 60rpx;" image="{{sub.oss.url}}" />
</t-avatar-group>
</view>
<view class="grey font-12">查看更多</view>
<view class="grey font-12 primary" data-list="{{item.badgeList}}" bind:tap="goMore">查看更多</view>
</view>
</view>
</view>

View File

@ -3,7 +3,7 @@
height: 380rpx;
width: 100%;
border-radius: 16rpx;
background-image: url("https://res.catter.cn/pub/2025/11/18/20251118170102998.jpeg");
background-repeat: no-repeat;
background-position: center center;

77
pages/badge/info.js Normal file
View File

@ -0,0 +1,77 @@
const { api } = require("../../utils/api")
// pages/badge/info.js
Page({
/**
* 页面的初始数据
*/
data: {
id:'',
info:null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.data.id = options.id
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
this.fetchInfo()
},
fetchInfo(){
api("/badge/detail",'GET',{id:this.data.id}).then(res => {
if (res.code === 200){
this.setData({info:res.data})
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

6
pages/badge/info.json Normal file
View File

@ -0,0 +1,6 @@
{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle":"white",
"navigationBarTitleText": "徽章",
"usingComponents": {}
}

15
pages/badge/info.wxml Normal file
View File

@ -0,0 +1,15 @@
<!--pages/badge/info.wxml-->
<view style="padding-top: 228rpx;">
<view class="flex flex-col flex-center white">
<image src="{{info.oss.url}}" class="pic"></image>
<view class="mt-32 font-16 bold">
{{info.name}}
</view>
<view class="font-14 mt-32" style="color:#7c7c7c">
{{info.desc}}
</view>
<t-button shape="round" theme="primary" ghost style="width: 80%; margin-top: 98rpx;">返回</t-button>
</view>
</view>

9
pages/badge/info.wxss Normal file
View File

@ -0,0 +1,9 @@
/* pages/badge/info.wxss */
page {
background-color: black;
}
.pic {
width: 320rpx;
height: 320rpx;
}

81
pages/badge/more.js Normal file
View File

@ -0,0 +1,81 @@
// pages/badge/more.js
Page({
/**
* 页面的初始数据
*/
data: {
list:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.init()
},
init(){
const tmps = wx.getStorageSync('badges')
if (tmps){
this.setData({list: JSON.parse(tmps)})
}
},
goInfo(e){
const id = e.currentTarget.dataset.id
wx.navigateTo({
url: '../badge/info?id='+ id,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

6
pages/badge/more.json Normal file
View File

@ -0,0 +1,6 @@
{
"navigationBarBackgroundColor": "#000",
"navigationBarTextStyle":"white",
"navigationBarTitleText": "徽章",
"usingComponents": {}
}

9
pages/badge/more.wxml Normal file
View File

@ -0,0 +1,9 @@
<!--pages/badge/more.wxml-->
<view class="padding">
<view class="grid mt-32">
<view wx:for="{{list}}" class="flex flex-center flex-col" data-id="{{item.badgeId}}" bind:tap="goInfo">
<image src="{{item.oss.url}}" class="badge"></image>
<view class="white mt-16">{{item.name}}</view>
</view>
</view>
</view>

16
pages/badge/more.wxss Normal file
View File

@ -0,0 +1,16 @@
/* pages/badge/more.wxss */
page {
background-color: black;
}
.grid {
display: grid;
grid-template-columns: auto auto auto;
grid-row-gap: 38px;
grid-column-gap: 38px;
}
.badge {
width: 150rpx;
height: 150rpx;
border-radius: 150rpx;
}

View File

@ -12,7 +12,7 @@
<image src="{{item.user.avatar.url}}" class="avatar"></image>
<view class="ml-16">
<view class="bold">{{item.user.name}}</view>
<view class="font-12 grey">{{item.createdAt}}</view>
<view class="font-12 grey">{{item.createdAtStr}}</view>
</view>
</view>
<view class="mt-16">

View File

@ -6,7 +6,7 @@
<image src="{{info.user.avatar.url}}" class="avatar"></image>
<view class="ml-16">
<view class="bold">{{info.user.name}}</view>
<view class="font-12 grey">{{info.createdAt}}</view>
<view class="font-12 grey">{{info.createdAtStr}}</view>
</view>
</view>
<view class="mt-16">
@ -45,7 +45,7 @@
{{item.user.name}}
</view>
<view class="font-12 grey">
{{item.createdAt}}
{{item.createdAtStr}}
</view>
</view>
<view class="mt-16 ml-16 font-12">

View File

@ -0,0 +1,28 @@
// pages/garden/components/growth.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
visible:false
},
/**
* 组件的方法列表
*/
methods: {
change(){
const tmp = !this.data.visible
console.log(tmp);
this.setData({visible:tmp})
}
}
})

View File

@ -0,0 +1,8 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"t-popup": "tdesign-miniprogram/popup/popup",
"t-textarea": "tdesign-miniprogram/textarea/textarea"
}
}

View File

@ -0,0 +1,32 @@
<!--pages/garden/components/growth.wxml-->
<view>
<t-fab icon="heart" bind:click="change" text="记录成长"></t-fab>
<t-popup visible="{{visible}}" bind:visible-change="change" placement="bottom">
<view class="padding">
<view class="text-center">记录生长瞬间</view>
<view class="border mt-32 flex flex-center flex-col">
<view class="flex flex-center flex-col">
<view class="camera flex flex-center">
<t-icon name="camera-filled" class="primary" size="24"></t-icon>
</view>
<view class="mt-32">点击上传或拍摄植物照片</view>
<view class="mt-16 font-12 grey">支持JPG、PNG 格式,最大 5MB</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>
</t-popup>
</view>

View File

@ -0,0 +1,24 @@
/* pages/garden/components/growth.wxss */
.camera{
background-color: #4fab5e3d;
width: 100rpx;
height: 100rpx;
border-radius: 50rpx;
}
.border {
border: #4fab5e 1rpx dotted;
border-radius: 16rpx;
height: 400rpx;
}
.custom-label {
display: inline-flex;
}
.custom-label::after {
content: '*';
color: red;
font-size: 32rpx;
margin-left: 4rpx;
}

View File

@ -38,16 +38,18 @@ Page({
}
tmp.todayCares.map(e => e.period = tmp.carePlans.find(sub => sub.name === e.name).period)
this.setData({info:res.data})
console.log(this.data.info.todayCares);
}
})
},
goPreview(e){
const url = e.currentTarget.dataset.url
wx.navigateTo({
url: '../preview/index?url=' + url,
const index = e.detail.index
const currentUrl = this.data.info.picList[index]
const list = this.data.info.picList
wx.previewImage({
current: currentUrl, // 当前显示图片的http链接
urls: list// 需要预览的图片http链接列表
})
},

View File

@ -2,6 +2,7 @@
"navigationStyle": "custom",
"usingComponents": {
"t-swiper": "tdesign-miniprogram/swiper/swiper",
"t-swiper-nav": "tdesign-miniprogram/swiper-nav/swiper-nav"
"t-swiper-nav": "tdesign-miniprogram/swiper-nav/swiper-nav",
"growth":"./components/growth"
}
}

View File

@ -2,7 +2,7 @@
<view>
<!-- top -->
<view class="top" style="position: relative; z-index: 2;">
<t-swiper style="width: 100vw;" height="640rpx" wx:if="{{info.pic}}" list="{{info.picList}}">
<t-swiper style="width: 100vw;" height="640rpx" wx:if="{{info.pic}}" list="{{info.picList}}" bind:click="goPreview">
</t-swiper>
<image wx:else="" src="https://res.catter.cn/pub/2025/09/30/20250930150006852.png" style="width: 100vw; height: 680rpx;" mode="aspectFill"></image>
</view>
@ -20,7 +20,7 @@
<view class="flex flex-center flex-justify-between" style="padding: 52rpx 32rpx 32rpx 32rpx">
<view>
<view class="font-16 bold ">{{info.name}}</view>
<view class="font-12 grey mt-16">陪伴你第 {{info.plantDays}} · 种植于 {{info.plantTimeStr}}</view>
<view class="font-12 grey mt-16">陪伴你第 {{info.plantDays}} 日夜 · 种植于 {{info.plantTimeStr}}</view>
</view>
<view style="width: 100rpx;" class="flex flex-center flex-justify-end" bind:tap="goEdit">
<t-icon name="setting"></t-icon>
@ -40,7 +40,7 @@
</view>
</view>
<view>
<t-tag theme="primary" shape="round" variant="outline">记录此刻</t-tag>
<!-- <t-tag theme="primary" shape="round" variant="outline">记录此刻</t-tag> -->
</view>
</view>
<view class="padding">
@ -75,7 +75,12 @@
</view>
</view>
</view>
<view class="row padding mt-32">
<view>成长日记</view>
<view>
</view>
</view>
<view class="row padding mt-32">
<view>养护记录</view>
<view class="flex flex-center flex-justify-between mt-16">
@ -106,4 +111,6 @@
</view>
</view>
</view>
<growth/>
</view>

View File

@ -19,12 +19,6 @@
</view>
</view>
<view class="white flex flex-center flex-justify-start mt-16">我的徽章 已解锁 {{badgeList.length}} 个</view>
<view class="mt-32 flex flex-center flex-justify-start">
<t-avatar-group max="5" collapseAvatar="+5">
<t-avatar wx:for="{{badgeList}}" image="{{item.oss.url}}" size="small"/>
</t-avatar-group>
</view>
</view>
</view>
<view class="padding">

View File

@ -24,23 +24,16 @@
"miniprogram": {
"list": [
{
"name": "pages/order/index",
"pathName": "pages/order/index",
"query": "id=355fad80-d403-11f0-883c-bc2411e64a23",
"name": "pages/badge/info",
"pathName": "pages/badge/info",
"query": "id=49a35d4a-d70c-11f0-b37c-bc2411e64a23",
"scene": null,
"launchMode": "default"
},
{
"name": "pages/store/info",
"pathName": "pages/store/info",
"query": "id=355fad80-d403-11f0-883c-bc2411e64a23",
"launchMode": "default",
"scene": null
},
{
"name": "pages/knowlage/info",
"pathName": "pages/knowlage/info",
"query": "id=8e3af6f8-ce61-11f0-bb28-bc2411e64a23",
"name": "pages/badge/more",
"pathName": "pages/badge/more",
"query": "",
"launchMode": "default",
"scene": null
}