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

@ -195,6 +195,10 @@ page {
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({
@ -23,10 +25,14 @@ Page({
}, },
fetchInfo() { fetchInfo() {
api('/post/detail','GET',{id: this.data.id}).then(res => { api('/post/detail', 'GET', {
id: this.data.id
}).then(res => {
if (res.code == 200) { if (res.code == 200) {
const tmp = res.data const tmp = res.data
this.setData({info:tmp}) this.setData({
info: tmp
})
} }
}) })
}, },
@ -37,7 +43,12 @@ Page({
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) {
@ -47,10 +58,13 @@ Page({
}, },
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

@ -17,14 +17,21 @@ Page({
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
})
}
}, },
/** /**
@ -45,14 +52,56 @@ Page({
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 + ""
} }
const city = wx.getStorageSync('city') api('/auth/getLocation', 'GET', data).then(res => {
api('/auth/getWeather', 'GET', city).then(res => { if (res.code === 200) {
wx.setStorageSync('city', res.data)
api('/auth/getWeather', 'GET', res.data).then(res => {
if (res.code === 200) { if (res.code === 200) {
wx.setStorageSync('weather', res.data) wx.setStorageSync('weather', res.data)
this.setData({info:res.data})
} }
}) })
}
})
},
fail(err) {
console.log(err);
}
})
}
const inviteCode = wx.getStorageSync('inviteCode')
if (inviteCode) {
this.setData({
inviteCode: inviteCode
})
}
api('/plant/needCare', 'GET').then(res => {
if (res.code === 200) {
this.setData({
needCare: res.data
})
}
})
},
goTask() {
wx.switchTab({
url: '../garden/index',
})
}, },
@ -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]
@ -87,13 +139,19 @@ Page({
}, },
fetchHotList() { fetchHotList() {
api('/library/list','POST',{isHot:0,current:0,pageSize:6},'json').then(res => { api('/library/list', 'POST', {
isHot: 0,
current: 0,
pageSize: 6
}, 'json').then(res => {
if (res.code === 200) { 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
})
} }
}) })
}, },
@ -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>

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({
@ -8,7 +10,8 @@ Page({
*/ */
data: { data: {
user: null, user: null,
info:null info: null,
inviteCode: ''
}, },
/** /**
@ -17,8 +20,14 @@ 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
})
}, },
/** /**
@ -38,7 +47,9 @@ Page({
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
})
} }
}) })
}, },
@ -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

@ -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
} }
] ]
} }