@ -0,0 +1,63 @@ | |||
// components/eval/eval.js | |||
Component({ | |||
/** | |||
* 组件的属性列表 | |||
*/ | |||
properties: {}, | |||
/** | |||
* 组件的初始数据 | |||
*/ | |||
data: { | |||
id: "洗后提", | |||
num0: 12, | |||
num1: 10, | |||
num2: 8, | |||
wjxscore: 0, | |||
userstars: [], | |||
}, | |||
/** | |||
* 组件的方法列表 | |||
*/ | |||
methods: { | |||
onRet: function () { | |||
wx.reLaunch({ | |||
url: "/Pages/travel/home/home", | |||
}); | |||
}, | |||
//星星点击事件 | |||
starTap: function (e) { | |||
var that = this; | |||
var index = e.currentTarget.dataset.index; //获取当前点击的是第几颗星星 | |||
var tempuserstars = this.data.userstars; //暂存星星数组 | |||
var len = tempuserstars.length; //获取星星数组的长度 | |||
for (var i = 0; i < len; i++) { | |||
if (i <= index) { | |||
//小于等于index的是满心 | |||
tempuserstars[i] = "/asset/img/icon-star.png"; | |||
that.setData({ | |||
wjxscore: i + 1, | |||
}); | |||
} else { | |||
//其他是空心 | |||
tempuserstars[i] = "/asset/img/icon-star0.png"; | |||
} | |||
//重新赋值就可以显示了 | |||
that.setData({ | |||
userstars: tempuserstars, | |||
}); | |||
} | |||
}, | |||
}, | |||
pageLifetimes:{ | |||
show: function () { | |||
const path = '/asset/img/icon-star0.png' | |||
for(var i = 0;i < 5;i++){ | |||
this.setData({ | |||
userstars:this.data.userstars.concat([path]) | |||
}) | |||
} | |||
}, | |||
} | |||
}); |
@ -0,0 +1,4 @@ | |||
{ | |||
"component": true, | |||
"usingComponents": {} | |||
} |
@ -0,0 +1,31 @@ | |||
<!--components/eval/eval.wxml--> | |||
<view style="display: flex;"> | |||
<image class="navi" src="/asset/img/navi.png" bindtap="onRet"></image> | |||
<view style="padding: 0;margin: 0;width: 1px;height:700px;background-color: #7B8B6F;"></view> | |||
<view class="eval"> | |||
<view class="title">行程评测</view> | |||
<view class="content"> | |||
<view>本次行程中,</view> | |||
<view>{{id}}计划去 {{num0}} 个地方</view> | |||
<view>实际一共去了 {{num1}} 个地方</view> | |||
<view>其中和小伙伴一起打卡的有 {{num2}} 个</view> | |||
<view>完成了计划的 {{num1/num0*100|Int}} %</view> | |||
</view> | |||
<view class="evalue"> | |||
<view>你会为本次旅行打几分呢?</view> | |||
</view> | |||
<view class="score"> | |||
<view class="star"> | |||
<view bindtap="starTap" data-index="{{index}}" wx:for="{{userstars}}" wx:key="index"> | |||
<image src="{{item}}" class="starimage"></image> | |||
</view> | |||
</view> | |||
<view style="font-size: 18px;">{{wjxscore+".0 分"}}</view> | |||
</view> | |||
</view> | |||
</view> |
@ -0,0 +1,63 @@ | |||
/* components/eval/eval.wxss */ | |||
.navi { | |||
width: 40px; | |||
height: 30px; | |||
margin: 5px; | |||
padding-top: 10px; | |||
} | |||
.title { | |||
position: relative; | |||
top: 20px; | |||
left: 15px; | |||
font-size: 22px; | |||
font-weight: 900; | |||
color: #000; | |||
} | |||
.eval { | |||
display: block; | |||
padding: 0; | |||
margin: 0; | |||
position: relative; | |||
top: -5px; | |||
} | |||
.content { | |||
position: relative; | |||
padding: 20px; | |||
text-align: center; | |||
font-size: 19px; | |||
top: 60px; | |||
} | |||
.evalue { | |||
position: relative; | |||
text-align: center; | |||
font-size: 20px; | |||
padding: 20px; | |||
top: 100px; | |||
} | |||
.score { | |||
display: block; | |||
position: relative; | |||
text-align: center; | |||
top: 20%; | |||
} | |||
.star { | |||
display: flex; | |||
flex: 2; | |||
} | |||
.starimage { | |||
width: 40px; | |||
height: 40px; | |||
justify-items: center; | |||
align-items: center; | |||
text-align: center; | |||
position: relative; | |||
left: 85rpx; | |||
margin: 5rpx; | |||
padding-bottom: 20rpx; | |||
} |