管理员可以修改项目所属人

This commit is contained in:
sdaduanbilei 2025-12-03 09:41:28 +08:00
parent 5a4051edde
commit 7dbeeeb0c9
8 changed files with 30 additions and 23 deletions

2
app.js
View File

@ -12,7 +12,7 @@ App({
// 发送 res.code 到后台换取 openId, sessionKey, unionId
api("/auth/miniLogin?code=" + res.code).then(res => {
if (res.code === 200) {
wx.setStorageSync('saOpenId', res.data.user.openId)
wx.setStorageSync('openId', res.data.user.miniOpenId)
wx.setStorageSync('sessionKey', res.data.user.sessionKey)
if (res.data.user.id){
wx.setStorageSync('user', res.data.user)

View File

@ -23,13 +23,12 @@ Page({
goAdd(){
const tmp = wx.getStorageSync('user')
// todo
// if (tmp.phone.length === 0){
// wx.navigateTo({
// url: '../login/index',
// })
// return
// }
if (tmp.phone.length === 0){
wx.navigateTo({
url: '../login/index',
})
return
}
wx.navigateTo({
url: '../community/add',
})

View File

@ -15,7 +15,7 @@
<view class="mt-16">
<view wx:if="{{info.imgList.length == 1}}">
<view wx:for="{{info.imgList}}">
<image src="{{info.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 wx:else class="grid">

View File

@ -3,7 +3,8 @@ const { api } = require("../../utils/api")
// index.js
Page({
data: {
list:[]
list:[],
dash:null
},
onLoad(options) {
@ -30,6 +31,14 @@ Page({
this.setData({list:res.data})
}
})
api('/plant/taskProgress','GET').then(res => {
if (res.code == 200){
const dash = res.data
dash.progress = parseFloat((dash.progress * 100).toFixed(2))
this.setData({dash:dash})
}
})
},
goAdd(){
wx.navigateTo({

View File

@ -1,16 +1,16 @@
<!--index.wxml-->
<view class="flex flex-center flex-col">
<view class="full-width white-bg">
<view class="padding">
<view class="padding" wx:if="{{dash}}">
<view class="mb-16 flex flex-center flex-justify-between">
<view>
📅 今日养护(4个任务)
📅 今日养护( {{dash.total}}个任务)
</view>
<view>
已经完成 4 / 5
已经完成 {{dash.complete}} / {{dash.total}}
</view>
</view>
<t-progress theme="plump" color="{{ { from: '#0052D9', to: '#00A870' } }}" percentage="80" status="active" />
<t-progress theme="plump" color="{{ { from: '#0052D9', to: '#00A870' } }}" percentage="{{dash.progress}}" status="active" />
</view>
</view>
@ -31,7 +31,7 @@
<view wx:for="{{list}}" >
<view class="mb-16 bo">{{item.name}}</view>
<view wx:for="{{item.careList}}">
<view class="row padding mb-32" data-id="{{item.id}}" bind:tap="goInfo">
<view class="row padding mb-32" data-id="{{item.plant.id}}" bind:tap="goInfo">
<view class="flex flex-center flex-justify-start">
<image class="pic" mode="aspectFill" wx:if="{{item.plant.imgList[0].url}}" src="{{item.plant.imgList[0].url}}"></image>
<image class="pic" mode="aspectFill" wx:else src="https://res.catter.cn/pub/2025/09/30/20250930143920286.png"></image>

View File

@ -141,12 +141,12 @@ Page({
goAdd() {
const tmp = wx.getStorageSync('user')
// if (tmp.phone.length === 0){
// wx.navigateTo({
// url: '../login/index',
// })
// return
// }
if (tmp.phone.length === 0){
wx.navigateTo({
url: '../login/index',
})
return
}
wx.navigateTo({
url: '../add/index',
})

View File

@ -52,8 +52,6 @@ Page({
api("/auth/getPhone", 'GET', data).then(res => {
wx.hideLoading()
if (res.code === 200) {
wx.setStorageSync('user', res.data.user)
wx.setStorageSync('token', res.data.token)
wx.navigateBack()
} else {
wx.showToast({

View File

@ -60,6 +60,7 @@ Page({
if (data.code === 200) {
const tmps = _this.data.user
tmps.avatar = data.data.file
tmps.avatarId = data.data.file.id
_this.setData({
user:tmps
})