连云港陪玩陪聊
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chunwan/pages/users/task/index.vue

142 lines
3.5 KiB

3 months ago
<template>
<view class="task">
<view class="task-navbar">
<u-navbar title="任务中心" back-icon-color="#333333" title-color="#333333" :background="background"></u-navbar>
</view>
<view class="task-content">
2 months ago
<view class="title" v-if="info.noviceList && info.noviceList.length > 0">新手任务</view>
<view class="content" v-if="info.noviceList && info.noviceList.length > 0">
<view class="item" v-for="(a,i) in info.noviceList" :key="i">
<view class="a">{{a.name}}<view class="num">金币<text>+{{a.coins}}</text></view></view>
1 month ago
<view class="b" v-if="a.isFinish == 0" @click="openPage(a)">去完成</view>
2 months ago
<view class="b b-on" v-else>已完成</view>
3 months ago
</view>
</view>
2 months ago
<view class="title" v-if="info.dayList && info.dayList.length > 0">每日任务</view>
<view class="content" v-if="info.dayList && info.dayList.length > 0">
<view class="item" v-for="(a,i) in info.dayList" :key="i">
<view class="a">{{a.name}}<view class="num">金币<text>+{{a.coins}}</text></view></view>
1 month ago
<view class="b" v-if="a.isFinish == 0" @click="openPage(a)">去完成</view>
2 months ago
<view class="b b-on" v-else>已完成</view>
3 months ago
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
background: {
// 导航栏背景图
2 months ago
background: 'url(https://api.lyiyuan.cn/profile/upload/static/task-bg.png) center top no-repeat',
3 months ago
// 还可以设置背景图size属性
backgroundSize: '100 auto',
},
2 months ago
info: {}
3 months ago
};
2 months ago
},
onShow() {
this.getList();
},
methods: {
1 month ago
openPage(a) {
if(a.id==1002 || a.id==1003|| a.id==1004){
uni.switchTab({
url: "/pages/index/index"
})
}else if(a.id==1000){
uni.switchTab({
url: "/pages/user/index"
})
}else if(a.id==1001){
uni.navigateTo({
url: "/pages/dongtai/add"
})
}else if(a.id==1||a.id==2||a.id==4){
uni.navigateTo({
url: "/pages/users/edit/index"
})
}else if(a.id==3){
uni.navigateTo({
url: "/pages/users/renzheng/index"
})
}
2 months ago
},
async getList() {
const { code, data } = await this.$api.taskList({
userId: uni.getStorageSync("userInfo").id
})
if(code == 200){
this.info = data
}
},
3 months ago
}
}
</script>
<style scoped lang="scss">
.task{
2 months ago
background: url(https://api.lyiyuan.cn/profile/upload/static/task-bg.png) center top no-repeat;
3 months ago
background-size: 100% auto;
overflow: hidden;
min-height: 100vh;
&-content{
padding: 0 25rpx;
.title{
font-weight: 500;
font-size: 32rpx;
color: #222222;
margin-top: 40rpx;
}
.content{
padding-bottom: 20rpx;
overflow: hidden;
.item{
width: 100%;
height: 100rpx;
background: #FFFFFF;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 20rpx;
padding: 0 20rpx;
box-sizing: border-box;
.a{
flex: 1;
font-weight: 500;
font-size: 30rpx;
color: #222222;
display: flex;
align-items: center;
.num{
margin-left: 40rpx;
font-size: 24rpx;
text{
font-size: 36rpx;
}
}
}
.b{
width: 130rpx;
line-height: 60rpx;
border-radius: 60rpx;
text-align: center;
font-weight: 500;
font-size: 24rpx;
background: linear-gradient(0deg, #000000, #3D3B38);
// box-shadow: 0px 4rpx 18rpx 0px rgba(42,41,39,0.34);
color: #FFFFFF;
&-on{
background: #EDEDED;
color: #222222;
}
}
}
}
}
}
</style>