亚洲国产精品成人无码区,公天天吃我奶躁我的比视频,亚洲国产欧美视频亚洲国产精品一区二区成人片不卡,天天躁日日躁狠狠躁视频2021,起视碰看97视频在线少妇久久久久久人妻无码, 芒果乱码一线二线三线新区 ,亚洲熟妇无码AⅤ不卡在线播放,人妻少妇乱子伦无码专区

400-800-9385
網(wǎng)站建設(shè)資訊詳細(xì)

微信小程序:制作星星評(píng)價(jià)代碼分享

發(fā)表日期:2018-04-20 09:38:43   作者來源:方維網(wǎng)絡(luò)   瀏覽:7948   標(biāo)簽:小程序制作    
不管是商城、O2O等類型的小程序都需要用到評(píng)價(jià),而星星評(píng)價(jià)是最常用的類型,方維網(wǎng)絡(luò)今天分享平時(shí)在項(xiàng)目制作中如何實(shí)現(xiàn)星星評(píng)價(jià)。

評(píng)價(jià)結(jié)果

上圖是評(píng)價(jià)后的結(jié)果,主要分為三項(xiàng)評(píng)價(jià),平均得出綜合評(píng)價(jià),那么就需要用戶選擇三項(xiàng)星星評(píng)價(jià),如下圖

提交評(píng)價(jià)

實(shí)現(xiàn)的要點(diǎn)是如何通過點(diǎn)擊星星自動(dòng)實(shí)現(xiàn)評(píng)價(jià)效果,如點(diǎn)擊第三顆星星就自動(dòng)變成3星。

WXML代碼如下

<view class="container">
<view class="comment_box">
<form bindsubmit="add_comment" report-submit="true">
<view class="comment_item">
<view class="comment_item_t">服務(wù)態(tài)度得分view>
<view class="comment_item_star">
<view class="star {{star_1>=1? '': 'star_gray'}}" bindtap="change_star" data-item="star_1" data-star="1" >view>
<view class="star {{star_1>=2? '': 'star_gray'}}" bindtap="change_star" data-item="star_1" data-star="2">view>
<view class="star {{star_1>=3? '': 'star_gray'}}" bindtap="change_star" data-item="star_1" data-star="3">view>
<view class="star {{star_1>=4? '': 'star_gray'}}" bindtap="change_star" data-item="star_1" data-star="4">view>
<view class="star {{star_1>=5? '': 'star_gray'}}" bindtap="change_star" data-item="star_1" data-star="5">view>
view>
view>
<view class="comment_item">
<view class="comment_item_t">服務(wù)質(zhì)量得分view>
<view class="comment_item_star">
<view class="star {{star_2>=1? '': 'star_gray'}}" bindtap="change_star" data-item="star_2" data-star="1">view>
<view class="star {{star_2>=2? '': 'star_gray'}}" bindtap="change_star" data-item="star_2" data-star="2">view>
<view class="star {{star_2>=3? '': 'star_gray'}}" bindtap="change_star" data-item="star_2" data-star="3">view>
<view class="star {{star_2>=4? '': 'star_gray'}}" bindtap="change_star" data-item="star_2" data-star="4">view>
<view class="star {{star_2>=5? '': 'star_gray'}}" bindtap="change_star" data-item="star_2" data-star="5">view>
view>
view>
<view class="comment_item">
<view class="comment_item_t">服務(wù)效率得分view>
<view class="comment_item_star">
<view class="star {{star_3>=1? '': 'star_gray'}}" bindtap="change_star" data-item="star_3" data-star="1">view>
<view class="star {{star_3>=2? '': 'star_gray'}}" bindtap="change_star" data-item="star_3" data-star="2">view>
<view class="star {{star_3>=3? '': 'star_gray'}}" bindtap="change_star" data-item="star_3" data-star="3">view>
<view class="star {{star_3>=4? '': 'star_gray'}}" bindtap="change_star" data-item="star_3" data-star="4">view>
<view class="star {{star_3>=5? '': 'star_gray'}}" bindtap="change_star" data-item="star_3" data-star="5">view>
view>
view>
<view class="comment_text">
<textarea name='detail' placeholder='輸入評(píng)價(jià)內(nèi)容'>textarea>
view>
<view class="btn">
<button form-type="submit">確定提交button>
view>
form>
view>
view>

WXSS代碼如下:

.container {
background: #f0f0f0;
}
.comment_box{
width:100%;
}
.comment_item{
width:100%;
padding:0 20rpx;
height:100rpx;
line-height:100rpx;
display:flex;
flex-direction:row;
justify-content:space-between;
box-sizing:border-box;
border-bottom:1px dotted #eee;
background-color:#fff;
}
.comment_item_t{
font-size:32rpx;
height:100rpx;
line-height:100rpx;
color: #333333;
}
.comment_item_star{
display:flex;
flex-direction:row;
}
.comment_item_star .star{
z-index: 1;
width:80rpx;
height:100rpx;
background-image: url("亮色星星圖片");
background-size:20px 19px;
background-position:center center;
background-repeat:no-repeat;
}
.comment_item_star .star_gray{
background-image: url("灰色星星圖片");
}
.comment_text textarea{
width:100%;
height:256rpx;
font-size:32rpx;
line-height:64rpx;
color: #333333;
background: #fff;
padding:20rpx;
box-sizing:border-box;
}
.btn button{
width: 670rpx;
height: 90rpx;
line-height:90rpx;
background: #ffda44;
border-radius: 45rpx;
font-size: 32rpx;
margin: 40rpx 40rpx 60rpx 40rpx;
color: #333;
}
 

JS代碼如下
 

var util = require('../../utils/util.js')
var app = getApp()//獲取應(yīng)用實(shí)例
Page({
data: {
star_1: 0,
star_2: 0,
star_3: 0,
order_id:0
},
onLoad:function(e) {
var that = this
var order_id = e.order_id
that.setData({
order_id:order_id
})
},
change_star:function(e) {
var that = this
var star_item = e.currentTarget.dataset.item
var star = e.currentTarget.dataset.star
if (star_item == 'star_1') {
that.setData({
star_1: star
});
}else if(star_item == 'star_2') {
that.setData({
star_2: star
});
} else if (star_item == 'star_3') {
that.setData({
star_3: star
});
}
},
add_comment:function(e) {
var that = this
var star_1 = that.data.star_1
var star_2 = that.data.star_2
var star_3 = that.data.star_3
var detail = e.detail.value.detail
if(star_1 == 0) {
util.showNotice("請(qǐng)針對(duì)服務(wù)態(tài)度打分!")
} else if (star_2 == 0) {
util.showNotice("請(qǐng)針對(duì)服務(wù)質(zhì)量打分!")
} else if (star_3 == 0) {
util.showNotice("請(qǐng)針對(duì)服務(wù)效率打分!")
} else if (detail == "") {
util.showNotice("請(qǐng)?zhí)顚懺u(píng)價(jià)內(nèi)容!")
} else {
var order_id = that.data.order_id
var session3rd = wx.getStorageSync('session3rd')
var post_data = {
"session3rd": session3rd,
"order_id": order_id,
"star_1": star_1,
"star_2": star_2,
"star_3": star_3,
"detail": detail,
"ctype": 1
}
var url_comment = util.getApiUrl(app, "/Comment/add", "")
util._post_from(url_comment, post_data, function (res) {
console.log('評(píng)價(jià)俠客返回')
console.log(res)
if (res.data.code = '200') {
wx.showModal({
content: '提交評(píng)論成功',
showCancel:false,
success:function(val) {
app.globalData.is_need_update_post_info = true
wx.navigateBack()
}
})
} else {
util.showNotice(res.data.msg)
}
})
}
}
})
 

以上基本就實(shí)現(xiàn)了星星評(píng)價(jià)效果。

 
如沒特殊注明,文章均為方維網(wǎng)絡(luò)原創(chuàng),轉(zhuǎn)載請(qǐng)注明來自http://www.oulysa.com/news/4268.html
相關(guān)網(wǎng)站設(shè)計(jì)案例
最新无码专区视频在线| 一区二区三区无码| 亚洲老熟女激情亚洲| 美女脱光衣亚洲国产精品不卡高清在线| 99国产欧美另娄久久久精品| 国产丝袜无码一区二区三区| 久久综合伊人77777麻豆| 亚洲中文字幕无码久久精品1| 亚洲区欧美中文字幕久久| 欧美影院a∨天堂| 国产精品自在线拍国产手青青机版| 日本三级做a全过程在线观看互動交流| 国产在线看片免费人成视频| 大屁股av系列在线 哟男哟女视频八区 | 亚洲国产中文成人无码影片在线| 欧美内射AAAAAAXXXXX,男人的JJ| 国产成人精品无码片区在线观看| 情侣国产一二三区视频观看| 久久精品国产精品亚洲艾草| 中文字幕精品一区二区精品| 国产又黄又粗又色又爽| 亚洲AV综合一区二区在线观看| 国产精品无码专区AV在线播放| 色综合啪啪67194亚洲精品国产AV成拍色拍| 丰满人妻一区二区三区视频53| 色噜噜狠狠色综合网| 日本乱偷互换人妻中文字幕| 久久无码人妻一区二区三区午夜| 日韩欧美国产高清在线观看| 欧美一级大片在线观看| 亚洲国产aⅴ成人精品无码| 国产精品自产拍高潮在线观看| 粗大黑人巨精大战欧美成人| 免费能直接看黄的网站在线观看| 亚洲成AV人无码不卡影片| 亚洲AV无码之日韩精品| 成人午夜a级毛片免费| 亚洲国产精品专区久久综合播放网站| 国产一区二区三区观看| 欧美成人三级网站在线播放| 国产乱人伦中文无无码视频试看|