服务器接口更新

master
吴治霖 1 year ago
parent 8aef6cdc7a
commit d9f7bd3ff3

@ -50,7 +50,7 @@
"quickapp" : {}, "quickapp" : {},
/* */ /* */
"mp-weixin" : { "mp-weixin" : {
"appid" : "wxcfebd67cf993c6f3", "appid" : "航大菜品圈",
"setting" : { "setting" : {
"urlCheck" : false, "urlCheck" : false,
"es6" : true "es6" : true

@ -7,15 +7,17 @@
<view> <view>
<text>{{"菜品名称:" + dish_name + '\n'}}</text> <text>{{"菜品名称:" + dish_name + '\n'}}</text>
<text>{{"菜品位置:" + dish_location + dish_window_name + '\n'}}</text> <text>{{"菜品位置:" + dish_location + dish_window_name + '\n'}}</text>
<text>{{"菜品类别:" + dish_label + '\n'}}</text>
<text>{{"菜品评分:" + dish_avg_score + '\n'}}</text>
</view> </view>
<view class="evaluete"> <view class="evaluete">
<hb-comment ref="hbComment" @add="add" @del="del" @like="like" :deleteTip="'确认删除?'" <hb-comment ref="hbComment" @add="add" @del="del" @like="like" :deleteTip="'确认删除?'" :cmData="commentData"
:cmData="commentData" v-if="commentData"></hb-comment> v-if="commentData"></hb-comment>
</view> </view>
<view> <view>
<text>{{"分:\n"}}</text> <text>{{"菜品打分:\n"}}</text>
<uni-rate v-model="value" @change="onChange(e.value)" allow-half="true" size="75" /> <uni-rate v-model="value" @change="onChange" allow-half="true" size="75" />
</view> </view>
</view> </view>
@ -32,8 +34,9 @@
dish_location: '', dish_location: '',
dish_window_name: '', dish_window_name: '',
value: 4, value: 4,
comentData:[], comentData: [],
dish_id:'' dish_id: '',
dish_avg_score: 5.0
}; };
}, },
onLoad(option) { onLoad(option) {
@ -41,7 +44,7 @@
//this.getLabels() //this.getLabels()
this.dish_id = JSON.parse(decodeURIComponent(option._id)) this.dish_id = JSON.parse(decodeURIComponent(option._id))
this.getImage() this.getImage()
console.log(this.dish_id ) console.log(this.dish_id)
}, },
methods: { methods: {
getImage() { getImage() {
@ -55,8 +58,9 @@
success: function(res) { success: function(res) {
that.dish_image_src = res.result.data[0].dish_src that.dish_image_src = res.result.data[0].dish_src
that.dish_name = res.result.data[0].dish_name that.dish_name = res.result.data[0].dish_name
that.dish_location =res.result.data[0].location that.dish_location = res.result.data[0].location
that.dish_window_name =res.result.data[0].window_name that.dish_window_name = res.result.data[0].window_name
that.dish_avg_score = res.result.data[0].avg_score
console.log(res) console.log(res)
} }
}) })
@ -75,25 +79,23 @@
} }
}) })
}, },
onChange() { onChange(e) {
this.value = e.value let that = this
},
updateScore() {
uniCloud.callFunction({ uniCloud.callFunction({
name: 'scoreUpdate', name: 'scoreUpdate',
data: { data: {
// score: that.value,
dish_id: that.dish_id
} }
}) })
}, },
add(commentReq){ add(commentReq) {
console.log(commentReq) console.log(commentReq)
}, },
del(commentid){ del(commentid) {
console.log(commentid) console.log(commentid)
}, },
like(commentid){ like(commentid) {
console.log(commentid) console.log(commentid)
} }
} }
@ -117,6 +119,5 @@
} }
.evaluete{ .evaluete {}
}
</style> </style>

@ -0,0 +1,7 @@
'use strict';
exports.main = async (event, context) => {
const db = uniCloud.database()
db.collection('dish-score').add({dish_id:event.dish_id,score:event.score})
//返回数据给客户端
return event
};

@ -0,0 +1,7 @@
{
"name": "scoreUpdate",
"dependencies": {},
"extensions": {
"uni-cloud-jql": {}
}
}
Loading…
Cancel
Save