提交 4a3ac424 编写于 作者: 0 052004122温宸杰

后台管理系统优化

上级 e587be01
......@@ -5,7 +5,7 @@ const validator = {
"start_date": {
"rules": [
{
"format": "string"
"format": "datetime"
}
],
"title": "开始时间",
......
......@@ -2,22 +2,30 @@
<view class="uni-container">
<uni-forms ref="form" :model="formData" validateTrigger="bind">
<uni-forms-item name="start_date" label="开始时间">
<uni-easyinput placeholder="运动开始时间" v-model="formData.start_date"></uni-easyinput>
<uni-datetime-picker
type="datetime"
v-model="formData.start_date"
/>
</uni-forms-item>
<uni-forms-item name="duration" label="持续时间">
<uni-easyinput placeholder="运动持续时间" type="number" v-model="formData.duration"></uni-easyinput>
<!-- <uni-easyinput placeholder="运动持续时间" type="number" v-model="formData.duration"></uni-easyinput> -->
<uni-number-box :value="0" :step="1" max="100000" value="100000" v-model="formData.duration" />
</uni-forms-item>
<uni-forms-item name="feelings" label="感受">
<uni-easyinput placeholder="运动感受(good/normal/bad)" v-model="formData.feelings"/>
<uni-data-select v-model="formData.feelings"
:localdata="feelings" >
</uni-data-select>
</uni-forms-item>
<uni-forms-item name="owner_id" label="用户id">
<uni-easyinput placeholder="用户id" v-model="formData.owner_id"></uni-easyinput>
<uni-forms-item name="owner_id" label="用户">
<uni-easyinput placeholder="用户id" v-model="formData.owner_id" disabled></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="distance" label="距离">
<uni-easyinput placeholder="运动距离" type="number" v-model="formData.distance"></uni-easyinput>
<!-- <uni-easyinput placeholder="运动距离" type="number" v-model="formData.distance"></uni-easyinput> -->
<uni-number-box :value="0.0" :step="0.01" max="100000.00" value="100000.00" v-model="formData.distance"/>
</uni-forms-item>
<uni-forms-item name="pace" label="配速">
<uni-easyinput placeholder="运动配速" type="number" v-model="formData.pace"></uni-easyinput>
<!-- <uni-easyinput placeholder="运动配速" type="number" v-model="formData.pace"></uni-easyinput> -->
<uni-number-box :value="0.0" :step="0.01" max="100000.00" value="100000.00" v-model="formData.pace" />
</uni-forms-item>
<!-- <uni-forms-item name="path_line" label="路线">
<uni-data-checkbox :multiple="true" v-model="formData.path_line"></uni-data-checkbox>
......@@ -74,15 +82,22 @@
formData,
formOptions: {},
feelings: [
"good",
"normal",
"bad"
{value:'good',text:'good'},
{value:'normal',text:'normal'},
{value:'bad',text:'bad'},
],
rules: {
...getValidator(Object.keys(formData))
}
}
},
methods: {
change(e) {
console.log("e:",e);
}
},
onLoad(e) {
if (e.id) {
const id = e.id
......
......@@ -2,22 +2,31 @@
<view class="uni-container">
<uni-forms ref="form" :model="formData" validateTrigger="bind">
<uni-forms-item name="start_date" label="开始时间">
<uni-easyinput placeholder="运动开始时间" v-model="formData.start_date"></uni-easyinput>
<!-- <uni-easyinput placeholder="运动开始时间" v-model="formData.start_date"></uni-easyinput> -->
<uni-datetime-picker
type="datetime"
v-model="formData.start_date"
/>
</uni-forms-item>
<uni-forms-item name="duration" label="持续时间">
<uni-easyinput placeholder="运动持续时间" type="number" v-model="formData.duration"></uni-easyinput>
<!-- <uni-easyinput placeholder="运动持续时间" type="number" v-model="formData.duration"></uni-easyinput> -->
<uni-number-box :value="0" :step="1" max="100000" value="100000" v-model="formData.duration" />
</uni-forms-item>
<uni-forms-item name="feelings" label="感受">
<uni-easyinput placeholder="运动感受(good/normal/bad)" v-model="formData.feelings"></uni-easyinput>
<uni-data-select v-model="formData.feelings"
:localdata="feelings" >
</uni-data-select>
</uni-forms-item>
<uni-forms-item name="owner_id" label="用户id">
<uni-easyinput placeholder="用户id" v-model="formData.owner_id"></uni-easyinput>
<uni-easyinput placeholder="用户id" v-model="formData.owner_id" disabled></uni-easyinput>
</uni-forms-item>
<uni-forms-item name="distance" label="距离">
<uni-easyinput placeholder="运动距离" type="number" v-model="formData.distance"></uni-easyinput>
<!-- <uni-easyinput placeholder="运动距离" type="number" v-model="formData.distance"></uni-easyinput> -->
<uni-number-box :value="0.0" :step="0.01" max="100000.00" value="100000.00" v-model="formData.distance"/>
</uni-forms-item>
<uni-forms-item name="pace" label="配速">
<uni-easyinput placeholder="运动配速" type="number" v-model="formData.pace"></uni-easyinput>
<!-- <uni-easyinput placeholder="运动配速" type="number" v-model="formData.pace"></uni-easyinput> -->
<uni-number-box :value="0.0" :step="0.01" max="100000.00" value="100000.00" v-model="formData.pace" />
</uni-forms-item>
<!-- <uni-forms-item name="start_point" label="起始地点">
<undefined v-model="formData.start_point"></undefined>
......@@ -73,6 +82,11 @@
return {
formData,
formOptions: {},
feelings: [
{value:'good',text:'good'},
{value:'normal',text:'normal'},
{value:'bad',text:'bad'},
],
rules: {
...getValidator(Object.keys(formData))
}
......
......@@ -28,11 +28,11 @@
<!-- <uni-easyinput v-model="formData.type"></uni-easyinput> -->
</uni-forms-item>
<uni-forms-item name="total_running_distance" label="跑步总距离">
<uni-number-box :value="0.0" :step="0.1" v-model="formData.total_running_distance" />
<uni-number-box :value="0.0" :step="0.01" v-model="formData.total_running_distance" />
<!-- <uni-easyinput type="number" v-model="formData.total_running_distance"></uni-easyinput> -->
</uni-forms-item>
<uni-forms-item name="total_walking_distance" label="健走总距离">
<uni-number-box :value="0.0" :step="0.1" v-model="formData.total_walking_distance" />
<uni-number-box :value="0.0" :step="0.01" v-model="formData.total_walking_distance" />
<!-- <uni-easyinput type="number" v-model="formData.total_walking_distance"></uni-easyinput> -->
</uni-forms-item>
<view class="uni-button-group">
......
......@@ -2,7 +2,7 @@
exports.main = async (event, context) => {
const db = uniCloud.database()
const collection = db.collection('mustgo-user')
let res1 = await collection.where({
_id: event.userId
}).get()
......@@ -17,24 +17,49 @@ exports.main = async (event, context) => {
if (res1.affectedDocs == 1) {
teamid = res1.data[0]["team_id"]
}
if(teamid == "") {
if (teamid == "") {
return {
"code": 400,
"message": "退出小队失败",
"data": {}
}
}
let res = await collection.where({
_id: event.userId,
team_id: teamid
}).get()
if (res.affectedDocs == 1) {
let tmp = await collection.where({
team_id: teamid
}).get()
if (tmp.affectedDocs == 1) {
const collection1 = db.collection('mustgo-team')
const res1 = await collection1.doc(teamid).remove()
}
const res = await collection.doc(event.userId).update({
team_id: ""
})
if (res.updated === 1) {
const activity = db.collection('mustgo-team-activity')
let res2 = await activity.where({
team_id: teamid
}).get()
var arr = new Array;
arr = res2.data
const registration = db.collection('mustgo-registration')
for (var i = 0; i < arr.length; i++) {
const tmp = await registration.where({
team_activity_id: arr[i]["_id"]
}).remove()
// doc(`${id}`).update({team_activity_id:{name:dbCmd.remove()}})
}
return {
"code": 200,
"message": "退出小队成功",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册