examTeamApp/pages/card/card.vue

133 lines
2.5 KiB
Vue
Raw Normal View History

2024-05-02 15:59:36 +08:00
<template>
<view class="content">
<!-- tabbar -->
<!-- <view class="tabbar">
<view>新建模板</view>
<view>卡片排序</view>
</view> -->
<!-- 已添加的卡片 -->
<view class="box">
<view class="tips">长按拖拽可调整卡片位置</view>
<view class="list">
<view class="item">
<view class="info">
<text></text>
<view>身体数据</view>
</view>
</view>
<view class="item" v-for="(item,index) in selectllist">
<uni-icons type="minus-filled" size="18" color="#FF6D66"
@click="deleteCard(item,index)"></uni-icons>
<view class="info">
<text></text>
<view>{{item.name}}</view>
</view>
</view>
</view>
</view>
<!-- 可添加的卡片 -->
<view class="box">
<view class="tips2 tips">可添加的卡片</view>
<view class="list">
<view class="item" v-for="(item,index) in addlist">
<uni-icons type="plus-filled" size="18" color="#05BD79" @click="addCard(item,index)"></uni-icons>
<view class="info">
<text></text>
<view>{{item.name}}</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
selectllist: [], //已选择
addlist: [], //可添加
}
},
onLoad() {
this.selectllist = this.$json.selectllist
this.addlist = this.$json.addlist
},
methods: {
// 删除已选择卡片
deleteCard(item, index) {
let that = this
that.selectllist.splice(index, 1)
that.addlist.push(item)
},
// 添加已有的卡片
addCard(item, index) {
let that = this
that.addlist.splice(index, 1)
that.selectllist.push(item)
},
}
}
</script>
<style scoped lang="scss">
.content {
padding: 15px;
font-size: 14px;
background-color: #F5F6FA;
min-height: 100vh;
.tips {
font-size: 12px;
color: #999;
width: 100%;
margin-bottom: 15px;
}
.tips2 {
color: #333;
font-size: 16px;
font-weight: bold;
}
.list {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.item {
width: 45%;
background-color: #fff;
margin-bottom: 15px;
position: relative;
height: 60px;
line-height: 60px;
border-radius: 5px;
.uni-icons {
font-size: 16px;
position: absolute;
top: -28px;
left: -5px;
}
.info {
display: flex;
align-items: center;
justify-content: center;
text {
width: 30px;
height: 30px;
background-color: #F2F2F2;
margin-right: 10px;
border-radius: 50%;
}
}
}
}
}
</style>