服务器接口更新

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

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

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