fix 任务工单

This commit is contained in:
sdaduanbilei 2025-12-08 15:09:41 +08:00
parent 98af0c8d3e
commit 0fd5d81f09
14 changed files with 265 additions and 94 deletions

13
app.js
View File

@ -17,6 +17,13 @@ App({
if (res.data.user.id) { if (res.data.user.id) {
wx.setStorageSync('user', res.data.user) wx.setStorageSync('user', res.data.user)
wx.setStorageSync('token', res.data.token) wx.setStorageSync('token', res.data.token)
publisher.emit("login");
// 生成邀请码
api('/personal/inviteCode/code','GET').then(res => {
if (res.code === 200){
wx.setStorageSync('inviteCode', res.data)
}
})
} else { } else {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
@ -52,7 +59,7 @@ App({
wx.setStorageSync('city', res.data) wx.setStorageSync('city', res.data)
const tmp = wx.getStorageSync('weather') const tmp = wx.getStorageSync('weather')
if (tmp) { if (tmp) {
publisher.emit("login"); console.log("succ");
} else { } else {
api('/auth/getWeather', 'GET', res.data).then(res => { api('/auth/getWeather', 'GET', res.data).then(res => {
if (res.code === 200) { if (res.code === 200) {
@ -67,10 +74,14 @@ App({
console.log(err); console.log(err);
} }
}) })
}, },
fail: err => { fail: err => {
console.log(err); console.log(err);
} }
}) })
} }
}) })

View File

@ -194,6 +194,10 @@ page {
.blue { .blue {
color: blue; color: blue;
} }
.font-black {
color: #000000E6 !important;
}
.font-12{ .font-12{
font-size: 12px; font-size: 12px;

View File

@ -33,7 +33,7 @@
</view> </view>
</view> </view>
<view class="mt-32 flex flex-center flex-justify-end"> <view class="mt-32 flex flex-center flex-justify-end">
<view class="flex flex-center" data-item="{{item}}" bind:tap="like"> <view class="flex flex-center" data-item="{{item}}" catch:tap="like">
<t-icon name="{{item.hasLiked === 1 ?'thumb-up-filled':'thumb-up'}}" style="color: {{item.hasLiked === 1 ?'red':''}};" ></t-icon> <t-icon name="{{item.hasLiked === 1 ?'thumb-up-filled':'thumb-up'}}" style="color: {{item.hasLiked === 1 ?'red':''}};" ></t-icon>
<view class="ml-16">{{item.likeCount}}</view> <view class="ml-16">{{item.likeCount}}</view>
</view> </view>

View File

@ -1,4 +1,6 @@
const { api } = require("../../utils/api") const {
api
} = require("../../utils/api")
// pages/community/info.js // pages/community/info.js
Page({ Page({
@ -7,9 +9,9 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
id : '', id: '',
info:null, info: null,
content:'', content: '',
}, },
@ -22,38 +24,50 @@ Page({
this.fetchInfo() this.fetchInfo()
}, },
fetchInfo(){ fetchInfo() {
api('/post/detail','GET',{id: this.data.id}).then(res => { api('/post/detail', 'GET', {
if (res.code== 200){ id: this.data.id
}).then(res => {
if (res.code == 200) {
const tmp = res.data const tmp = res.data
this.setData({info:tmp}) this.setData({
info: tmp
})
} }
}) })
}, },
input(e){ input(e) {
const value = e.detail.value const value = e.detail.value
console.log(value); console.log(value);
this.data.content = value this.data.content = value
}, },
add(){ add() {
const data = {content: this.data.content, postId: this.data.id,parentId: this.data.id,rootId:this.data.id} const data = {
content: this.data.content,
postId: this.data.id,
parentId: this.data.id,
rootId: this.data.id
}
console.log(data); console.log(data);
api('/comment/add','POST',data,'json').then(res => { api('/comment/add', 'POST', data, 'json').then(res => {
if (res.code === 200){ if (res.code === 200) {
this.fetchInfo() this.fetchInfo()
} }
}) })
}, },
goPreview(e){ goPreview(e) {
console.log(e);
const url = e.currentTarget.dataset.url // 在上一页的 js 文件中
wx.navigateTo({ const currentUrl = e.currentTarget.dataset.url; // 获取当前点击的图片链接
url: '../preview/index?url=' + url, const list = this.data.info.imgList.map(e => e.url)
wx.previewImage({
current: currentUrl, // 当前显示图片的http链接
urls: list// 需要预览的图片http链接列表
}) })
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成

View File

@ -13,10 +13,10 @@
<view>{{info.content}}</view> <view>{{info.content}}</view>
</view> </view>
<view class="mt-16"> <view class="mt-16">
<view wx:if="{{info.imgList.length == 1}}"> <view wx:if="{{info.imgList.length == 1}}" data-url="{{info.imgList[0].url}}" bind:tap="goPreview">
<view wx:for="{{info.imgList}}">
<image src="{{info.imgList[0].url}}" style="border-radius: 16rpx; height: 50vw; width: 100%;" mode="aspectFill"></image> <image src="{{info.imgList[0].url}}" style="border-radius: 16rpx; height: 50vw; width: 100%;" mode="aspectFill"></image>
</view>
</view> </view>
<view wx:else class="grid"> <view wx:else class="grid">
<view class="item" wx:for="{{info.imgList}}" data-url="{{item.url}}" bind:tap="goPreview"> <view class="item" wx:for="{{info.imgList}}" data-url="{{item.url}}" bind:tap="goPreview">

View File

@ -16,15 +16,22 @@ Page({
rightList: [], rightList: [],
leftHeight: 0, leftHeight: 0,
rightHeight: 0, rightHeight: 0,
hotList:[], hotList: [],
info:null info: null,
needCare: 0,
inviteCode: ''
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
const code = options.inviteCode
if (code) {
api('/personal/inviteCode/accept', 'GET', {
inviteCode: code
})
}
}, },
/** /**
@ -42,20 +49,62 @@ Page({
this.init() this.init()
}, },
init(){ init() {
const tmp = wx.getStorageSync('weather') const tmp = wx.getStorageSync('weather')
if(tmp){ if (tmp) {
this.setData({info:tmp}) this.setData({
info: tmp
})
} else {
wx.getFuzzyLocation({
type: 'wgs84',
success(res) {
const data = {
latitude: res.latitude + "",
longitude: res.longitude + ""
}
api('/auth/getLocation', 'GET', data).then(res => {
if (res.code === 200) {
wx.setStorageSync('city', res.data)
api('/auth/getWeather', 'GET', res.data).then(res => {
if (res.code === 200) {
wx.setStorageSync('weather', res.data)
this.setData({info:res.data})
}
})
}
})
},
fail(err) {
console.log(err);
}
})
} }
const city = wx.getStorageSync('city') const inviteCode = wx.getStorageSync('inviteCode')
api('/auth/getWeather', 'GET', city).then(res => { if (inviteCode) {
this.setData({
inviteCode: inviteCode
})
}
api('/plant/needCare', 'GET').then(res => {
if (res.code === 200) { if (res.code === 200) {
wx.setStorageSync('weather', res.data) this.setData({
needCare: res.data
})
} }
}) })
}, },
goTask() {
wx.switchTab({
url: '../garden/index',
})
},
fetchList() { fetchList() {
api('/plant/page', 'POST', { api('/plant/page', 'POST', {
current: 0, current: 0,
@ -70,7 +119,10 @@ Page({
this.fetchHotList() this.fetchHotList()
return return
} }
this.setData({leftList:[],rightList:[]}) this.setData({
leftList: [],
rightList: []
})
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
e.cover = e.imgList[0] e.cover = e.imgList[0]
@ -78,7 +130,7 @@ Page({
}) })
this.addItems(tmps) this.addItems(tmps)
this.setData({ this.setData({
list: tmps list: tmps
}) })
@ -86,14 +138,20 @@ Page({
}) })
}, },
fetchHotList(){ fetchHotList() {
api('/library/list','POST',{isHot:0,current:0,pageSize:6},'json').then(res => { api('/library/list', 'POST', {
if (res.code === 200){ isHot: 0,
current: 0,
pageSize: 6
}, 'json').then(res => {
if (res.code === 200) {
const data = res.data.list.map(e => { const data = res.data.list.map(e => {
e.pic = e.imgList[0].url e.pic = e.imgList[0].url
return e return e
}) })
this.setData({hotList:data}) this.setData({
hotList: data
})
} }
}) })
}, },
@ -101,26 +159,26 @@ Page({
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;
} else { } else {
this.data.rightList.push(item); this.data.rightList.push(item);
h2 += item.cover.height / item.cover.width; h2 += item.cover.height / item.cover.width;
} }
this.setData({ this.setData({
leftList: this.data.leftList, leftList: this.data.leftList,
rightList: this.data.rightList, rightList: this.data.rightList,
}); });
}); });
}, },
goInfo(e){ goInfo(e) {
console.log(e); console.log(e);
const id = e.currentTarget.dataset.id const id = e.currentTarget.dataset.id
wx.navigateTo({ wx.navigateTo({
url: '../garden/info?id=' + id, url: '../garden/info?id=' + id,
}) })
@ -142,7 +200,7 @@ Page({
goAdd() { goAdd() {
const tmp = wx.getStorageSync('user') const tmp = wx.getStorageSync('user')
if (tmp.phone.length === 0){ if (tmp.phone.length === 0) {
wx.navigateTo({ wx.navigateTo({
url: '../login/index', url: '../login/index',
}) })
@ -184,6 +242,18 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage() {
return {
title: '发现一个宝藏养花神器',
imageUrl: "https://res.catter.cn/pub/2025/12/08/20251208112039694.png",
path: '/pages/index/index?inviteCode=' + this.data.inviteCode
};
},
onShareTimeline() {
return {
title: '发现一个宝藏养花神器',
imageUrl: "https://res.catter.cn/pub/2025/12/08/20251208112039694.png",
path: '/pages/index/index?inviteCode=' + this.data.inviteCode
};
} }
}) })

View File

@ -2,16 +2,17 @@
<view> <view>
<!-- top --> <!-- top -->
<view class="top primary-bg"> <view class="top primary-bg">
<view style="padding-top: 128rpx; padding-left: 32rpx;" class="white" wx:if="{{info}}"> <view style="padding-top: 128rpx; min-height: 200rpx; padding-left: 32rpx;" class="white">
<view class="bold font-16">{{info.weather}} {{info.windDirection}}风{{info.windPower}}级</view> <view class="bold font-16" wx:if="{{info}}">{{info.weather}} {{info.windDirection}}风{{info.windPower}}级</view>
<view> <view wx:if="{{info}}">
<view class="flex flex-center flex-justify-start"> <view class="flex flex-center flex-justify-start flex-aligin-center mt-16">
<t-icon wx:if="{{info.weather === '雾'}}" name="fog" size="34"></t-icon> <t-icon wx:if="{{info.weather === '雾'}}" name="fog" size="34"></t-icon>
<view class="bold mt-16 ml-16" style="font-size: 40px;">{{info.temperature}} ℃</view> <t-icon wx:if="{{info.weather === '多云'}}" name="cloud" size="34"></t-icon>
<view class="bold ml-16" style="font-size: 40px;" >{{info.temperature}} ℃</view>
</view> </view>
<view wx:if="{{leftList.length > 0}}"> <view wx:if="{{leftList.length > 0}}" bind:tap="goTask" class="flex flex-center flex-justify-start">
<view> 今日需养护 2 株植物</view> <view> 今日需养护 {{needCare}} 株植物</view>
<view class="mt-16 font-12" style="color: #E2B43F;">龟背竹长期未更新照片</view> <t-icon name="chevron-right" class="ml-5"></t-icon>
</view> </view>
</view> </view>
</view> </view>
@ -19,9 +20,9 @@
<view style="height: 89vh;" wx:if="{{list.length > 0}}"> <view style="height: 89vh;" wx:if="{{list.length > 0}}">
<view class="waterfall" scroll-y="{{true}}"> <view class="waterfall" scroll-y="{{true}}">
<view class="column"> <view class="column">
<block wx:for="{{leftList}}" wx:key="id" > <block wx:for="{{leftList}}" wx:key="id">
<view class="card mb-16" data-id="{{item.id}}" bind:tap="goInfo"> <view class="card mb-16" data-id="{{item.id}}" bind:tap="goInfo">
<view class="img-wrapper" > <view class="img-wrapper">
<image src="{{item.pic}}" mode="widthFix" class="img"></image> <image src="{{item.pic}}" mode="widthFix" class="img"></image>
<view class="overlay" style="margin-bottom: 26rpx;"> <view class="overlay" style="margin-bottom: 26rpx;">
<view class="font-14 bold">{{item.name}}</view> <view class="font-14 bold">{{item.name}}</view>
@ -51,9 +52,9 @@
</view> </view>
<view class="column"> <view class="column">
<block wx:for="{{rightList}}" wx:key="id" > <block wx:for="{{rightList}}" wx:key="id">
<view class="card mb-16" data-id="{{item.id}}" bind:tap="goInfo"> <view class="card mb-16" data-id="{{item.id}}" bind:tap="goInfo">
<view class="img-wrapper" > <view class="img-wrapper">
<image src="{{item.pic}}" mode="widthFix" class="img"></image> <image src="{{item.pic}}" mode="widthFix" class="img"></image>
<view class="overlay" style="margin-bottom: 26rpx;"> <view class="overlay" style="margin-bottom: 26rpx;">
<view class="font-14 bold">{{item.name}}</view> <view class="font-14 bold">{{item.name}}</view>

View File

@ -1,6 +1,26 @@
<!--pages/preview/index.wxml--> <!--pages/preview/index.wxml-->
<view class="flex flex-center"> <view class="flex flex-center">
<view style="height: 80vh;" class="flex flex-center"> <view style="height: 80vh; width: 100vw;" class="flex flex-center">
<image src=" {{url}}" style="width: 100vw;height: 50vh;" mode="aspectFill" show-menu-by-longpress></image>
<movable-area style="width: 100%; height: 100%;">
<movable-view
direction="all"
scale="{{true}}"
min-scale="0.5"
max-scale="5"
scale-value="{{scale}}"
style="width: 100%; height: 100%; display:flex; align-items:center; justify-content:center;"
>
<image
src="{{url}}"
style="width: 100%; height: 100%;"
mode="aspectFit"
show-menu-by-longpress
></image>
</movable-view>
</movable-area>
</view> </view>
</view> </view>

View File

@ -1,3 +1,5 @@
const { api } = require("../../utils/api")
// pages/store/index.js // pages/store/index.js
Page({ Page({
@ -41,7 +43,15 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow() { onShow() {
this.fetchList()
},
fetchList(){
api('/claim/list','POST',{current:0,pageSize:10,name:'',keyword:''},'json').then(res => {
if (res.code === 200){
console.log(res);
}
})
}, },
/** /**

View File

@ -2,7 +2,7 @@
<view> <view>
<view class="flex flex-center primary-bg padding"> <view class="flex flex-center primary-bg padding">
<view class="white"> <view class="white">
我的兑换币 1 枚 我的阳光值 1 枚
</view> </view>
<view class="ml-16" style="color: orange;"> <view class="ml-16" style="color: orange;">
邀请好友获取更多兑换币 邀请好友获取更多兑换币

View File

@ -1,4 +1,6 @@
const { api } = require("../../utils/api") const {
api
} = require("../../utils/api")
const config = require("../../config/config") const config = require("../../config/config")
// pages/user/index.js // pages/user/index.js
Page({ Page({
@ -7,8 +9,9 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
user:null, user: null,
info:null info: null,
inviteCode: ''
}, },
/** /**
@ -16,9 +19,15 @@ Page({
*/ */
onLoad(options) { onLoad(options) {
const tmp = wx.getStorageSync('user') const tmp = wx.getStorageSync('user')
if (tmp){ if (tmp) {
this.setData({user:tmp}) this.setData({
user: tmp
})
} }
const inviteCode = wx.getStorageSync('inviteCode')
this.setData({
inviteCode: inviteCode
})
}, },
/** /**
@ -34,11 +43,13 @@ Page({
onShow() { onShow() {
this.fetchInfo() this.fetchInfo()
}, },
fetchInfo(){ fetchInfo() {
api('/personal/personal','GET').then(res => { api('/personal/personal', 'GET').then(res => {
if (res.code === 200){ if (res.code === 200) {
const tmps = res.data const tmps = res.data
this.setData({info:res.data}) this.setData({
info: tmps
})
} }
}) })
}, },
@ -62,7 +73,7 @@ Page({
tmps.avatar = data.data.file tmps.avatar = data.data.file
tmps.avatarId = data.data.file.id tmps.avatarId = data.data.file.id
_this.setData({ _this.setData({
user:tmps user: tmps
}) })
_this.update() _this.update()
} }
@ -70,27 +81,27 @@ Page({
}) })
}, },
update(){ update() {
api('/user/update','POST',this.data.user,"json").then(res => { api('/user/update', 'POST', this.data.user, "json").then(res => {
if (res.code === 200){ if (res.code === 200) {
} }
}) })
}, },
goStore(){ goStore() {
wx.navigateTo({ wx.navigateTo({
url: '../store/index', url: '../store/index',
}) })
}, },
goAbout(){ goAbout() {
wx.navigateTo({ wx.navigateTo({
url: '../user/about', url: '../user/about',
}) })
}, },
goPrivate(){ goPrivate() {
wx.openPrivacyContract() wx.openPrivacyContract()
}, },
@ -127,6 +138,18 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage() { onShareAppMessage() {
return {
title: '发现一个宝藏养花神器',
imageUrl: "https://res.catter.cn/pub/2025/12/08/20251208112039694.png",
path: '/pages/index/index?inviteCode=' + this.data.inviteCode
};
},
onShareTimeline() {
return {
title: '发现一个宝藏养花神器',
imageUrl: "https://res.catter.cn/pub/2025/12/08/20251208112039694.png",
path: '/pages/index/index?inviteCode=' + this.data.inviteCode
};
} }
}) })

View File

@ -2,7 +2,7 @@
<view> <view>
<!-- top --> <!-- top -->
<view class="bg"> <view class="bg">
<view wx:if="{{info}}" > <view wx:if="{{info}}">
<view class="flex flex-center flex-justify-start" style="margin-top:128rpx;"> <view class="flex flex-center flex-justify-start" style="margin-top:128rpx;">
<view style="width: 140rpx;height:140rpx;" class="flex flex-center flex-justify-start full-width "> <view style="width: 140rpx;height:140rpx;" class="flex flex-center flex-justify-start full-width ">
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar" style="background-color: red;"> <button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar" style="background-color: red;">
@ -29,6 +29,11 @@
<view class="white-bg padding mt-16 row"> <view class="white-bg padding mt-16 row">
<!-- dash --> <!-- dash -->
<view class=" flex flex-center flex-justify-around mt-32"> <view class=" flex flex-center flex-justify-around mt-32">
<view class="flex flex-center flex-col">
<view class="font-16 bold" style="font-size: 20px;">{{info.pointsCount}}</view>
<view class="font-12">我的阳光值</view>
</view>
<view class="flex flex-center flex-col"> <view class="flex flex-center flex-col">
<view class="font-16 bold" style="font-size: 20px;">{{info.plantCount}}</view> <view class="font-16 bold" style="font-size: 20px;">{{info.plantCount}}</view>
<view class="font-12">我的植物</view> <view class="font-12">我的植物</view>
@ -85,7 +90,13 @@
<t-cell title="提醒设置" hover arrow /> <t-cell title="提醒设置" hover arrow />
<t-cell title="加入微信群" hover arrow bind:tap="goAbout" /> <t-cell title="加入微信群" hover arrow bind:tap="goAbout" />
<t-cell title="用户协议" hover arrow bind:tap="goPrivate" /> <t-cell title="用户协议" hover arrow bind:tap="goPrivate" />
<t-cell title="邀请好友" hover arrow bordered="{{false}}" description="成功邀请可以获得稀有种子" /> <button class="avatar-wrapper " style="width: 100%;" open-type="share">
<view class="flex flex-center flex-justify-between">
<view class="font-16 font-black " style="width: 100%; text-align: left; padding: 0 32rpx;">邀请好友</view>
<t-icon name="chevron-right" size="24" style="padding-right: 36rpx; color:#00000069;"></t-icon>
</view>
<view class="font-14 " style="color: #00000099; text-align: left; padding: 0 32rpx;">成功邀请可以免费兑换植物</view>
</button>
</view> </view>
</view> </view>
<view class="padding"></view> <view class="padding"></view>

View File

@ -20,7 +20,7 @@ button::after {
.avatar-wrapper { .avatar-wrapper {
padding: 0; padding: 0;
color: #000000E6 !important;
background-color: rebeccapurple !important; background-color: rebeccapurple !important;
width: 280rpx; width: 280rpx;
} }

View File

@ -23,12 +23,19 @@
"condition": { "condition": {
"miniprogram": { "miniprogram": {
"list": [ "list": [
{
"name": "pages/index/index",
"pathName": "pages/index/index",
"query": "inviteCode=7NQJHCKT",
"scene": null,
"launchMode": "default"
},
{ {
"name": "pages/store/index", "name": "pages/store/index",
"pathName": "pages/store/index", "pathName": "pages/store/index",
"query": "", "query": "",
"scene": null, "launchMode": "default",
"launchMode": "default" "scene": null
} }
] ]
} }