连云港陪玩陪聊
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/dashan/index.vue

100 lines
1.9 KiB

<template>
<view class="qingshaonian">
<view class="title">设置搭讪语后无需选择直接发送</view>
<view class="bd">
<view class="item"v-for="(a,i) in list" :key="i">
<view class="txt">{{a.content}}</view>
<view class="btn btn-on" v-if="a.isDefault == 1">默认</view>
<view class="btn" v-else @click="toSet(i)">设为默认</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
tabIndex: 1,
list: []
}
},
onLoad() {
this.getList();
},
methods: {
//获取搭讪列表
async getList() {
const { code, data } = await this.$api.findAccost({
userId: uni.getStorageSync("userInfo").id
})
if(code == 200){
this.list = data;
}
},
//设置默认
async toSet(index) {
const { code, data } = await this.$api.setAccostDefault({
userId: uni.getStorageSync("userInfo").id,
id: this.list[index].id
})
if(code == 200){
uni.showToast({
title: "设置成功"
})
this.getList();
}
},
}
}
</script>
<style scoped lang="scss">
.qingshaonian{
padding: 0 25rpx;
overflow: hidden;
.title{
font-weight: 500;
font-size: 30rpx;
color: #222222;
margin-top: 30rpx;
}
.bd{
.item{
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
width: 100%;
font-weight: 500;
font-size: 26rpx;
color: #222222;
border-radius: 20rpx;
padding: 30rpx 20rpx;
background: #FFFFFF;
margin-top: 20rpx;
.txt{
max-width: 500rpx;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.btn{
width: 130rpx;
line-height: 50rpx;
text-align: center;
border-radius: 50rpx;
font-weight: 500;
font-size: 26rpx;
&-on{
font-size: 24rpx;
color: #FFFFFF;
background: linear-gradient(0deg, #000000, #3D3B38);
}
}
}
}
}
</style>