我的-发布
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<img class="img" :src="item['image']">
|
||||
<div class="title">{{ item['title'] }}</div>
|
||||
<div class="hint">{{ item['propaganda'] }}</div>
|
||||
<div class="tab-box flexflex">
|
||||
<div class="tab-box flexflex" v-if="item['tags']">
|
||||
<div class="tab-item flexcenter" v-for="it in item['tags'].split(',')">{{ it }}</div>
|
||||
</div>
|
||||
<div class="location flexacenter">
|
||||
|
||||
@@ -7,13 +7,15 @@
|
||||
</div>
|
||||
<div class="top-box">
|
||||
<div class="title-text">
|
||||
{{ data && data.subject || '暂无标题' }}
|
||||
<div class="title-hint" v-if="data.verifiedstatus == 1 && !stateData.text">认证审核中</div>
|
||||
<div class="title-hint" v-if="stateData.text">{{ stateData.text }}</div>
|
||||
{{ data.subject || '暂无标题' }}
|
||||
</div>
|
||||
<div class=" dis-f al-item-start jus-bet s-w-100" style="margin-top: 20px;">
|
||||
<div>
|
||||
<div class="dis-f al-item">
|
||||
<div class="tab-item first-tab flexacenter">{{ data && data.gptype }}</div>
|
||||
<div class="tab-item mg-l-8 flexacenter" v-if="data.type">{{ listData.type[data && data.type] }}
|
||||
<div class="tab-item first-tab flexacenter">{{ data.gptype }}</div>
|
||||
<div class="tab-item mg-l-8 flexacenter" v-if="data.type">{{ listData.type[data.type] }}
|
||||
</div>
|
||||
<div class="tab-item mg-l-8 flexacenter" v-if="data.elevator && data.elevator !== -1">{{
|
||||
listData.elevator[data.elevator] }}</div>
|
||||
@@ -32,7 +34,6 @@
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<div class="address-item flexacenter" v-else>
|
||||
<img src="../../assets/homeImage/addMarker.png" class="img" alt="">
|
||||
{{ location[item['location'] >>> 0] + ' > ' + location[item['location']] }}
|
||||
@@ -46,6 +47,30 @@
|
||||
<span class="time" v-show="data.rentalduration">[ 租期{{ data.rentalduration == 0 ? '不限' :
|
||||
listData['rentalduration'][data.rentalduration] }} ]</span>
|
||||
</div>
|
||||
<div class="data-info flexacenter" v-if="ispublish">
|
||||
<div class="info-item" v-if="data['id']">
|
||||
房源ID:{{ data['id'] }}
|
||||
</div>
|
||||
<template v-if="data['timestamp']">
|
||||
<div class="longstring" v-if="data['id']" style="margin: 0 8px;"></div>
|
||||
<div class="info-item">
|
||||
{{ formatDate(data['timestamp']) }}发布
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="data['status'] != 0">
|
||||
<div class="longstring"></div>
|
||||
<div class="info-item flexacenter">
|
||||
<div class="itemm flexacenter">
|
||||
<img class="item-icon" src="@/assets/img/publicImage/eye-icon.svg" alt="">
|
||||
{{ data['count_view'] }}
|
||||
</div>
|
||||
<div class="itemm flexacenter" style="margin-left: 10px;">
|
||||
<img class="item-icon" src="@/assets/img/publicImage/collect-icon.png" alt="">
|
||||
{{ data['count_fav'] }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="img">
|
||||
<div>
|
||||
@@ -61,7 +86,20 @@
|
||||
<img src="../../assets/homeImage/intermediaryCorner.svg" v-if="routePath === '/intermediaryHousing'"
|
||||
class="tab-img" alt="">
|
||||
</div>
|
||||
<div class="btm-box dis-f al-item">
|
||||
<div class="publish-footer flexacenter" v-if="ispublish">
|
||||
<div class="publish-item flexcenter" v-if="stateData.btn >= 0 || stateData.btn == -2" @click="handleDelete">删除
|
||||
</div>
|
||||
<div class="publish-item flexcenter" v-if="stateData.btn >= 0" @click="goEdit">{{ stateData.btn
|
||||
== 1 ? "编辑上架" : "编辑" }}</div>
|
||||
<div class="publish-item flexcenter" v-if="stateData.btn == 2" @click="undercarriage">下架</div>
|
||||
<div class="publish-item flexcenter go-up"
|
||||
:class="{ 'go-up': data.isding == 0, 'already-go-up': data.isding == 1 }" v-if="stateData.btn == 2"
|
||||
@click="goUp">{{
|
||||
data.isding == 0 ? '顶上去' : '今天已顶' }}
|
||||
</div>
|
||||
<!-- <div class="publish-item flexcenter already-go-up" v-if="stateData.btn == 2 && item.isding == 1"></div> -->
|
||||
</div>
|
||||
<div class="btm-box dis-f al-item" v-else>
|
||||
<div class="flex1 flexacenter">
|
||||
<img :src="data.avatar" class="user-img" alt="">
|
||||
<span class="user-name">{{ data.author }}</span>
|
||||
@@ -78,22 +116,32 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, defineProps, reactive, defineEmits, onMounted, getCurrentInstance } from "vue";
|
||||
import { ref, watch, defineProps, reactive, defineEmits, onMounted, getCurrentInstance } from "vue";
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
import store from '../../store/index';
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
let props = defineProps({
|
||||
item: {
|
||||
type: Object
|
||||
type: Object,
|
||||
},
|
||||
index: Number
|
||||
index: Number,
|
||||
ispublish: Boolean,
|
||||
})
|
||||
|
||||
const emit = defineEmits(['cancelCollection'])
|
||||
let data = {}
|
||||
data = props.item
|
||||
|
||||
const emit = defineEmits(['cancelCollection', 'goUp', 'undercarriage'])
|
||||
|
||||
|
||||
// console.log("item", props.item);
|
||||
let data = {}
|
||||
data = props.item
|
||||
|
||||
|
||||
//监听路由
|
||||
const route = useRoute()
|
||||
@@ -138,10 +186,87 @@ const stateObj = { // btn: 0 删除 编辑 1 删除 编辑 上架 2 删除 编
|
||||
}
|
||||
}
|
||||
|
||||
let stateData = ref(stateObj[data.status])
|
||||
// 监听修改的值
|
||||
watch(() => props.item.status, (newValue, oldValue) => {
|
||||
stateData.value = stateObj[data.status]
|
||||
})
|
||||
|
||||
const cancelCollection = token => {
|
||||
emit('cancelCollection', { token, index: props['index'] })
|
||||
}
|
||||
|
||||
|
||||
// 跳转编辑页面
|
||||
const goEdit = () => router.push(`/edit?token=${data.token}`)
|
||||
|
||||
// 点击删除房源
|
||||
const handleDelete = () => {
|
||||
ElMessageBox.confirm(
|
||||
'确定删除吗?',
|
||||
'提示',
|
||||
{
|
||||
cancelButtonText: '取消',
|
||||
confirmButtonText: '确定',
|
||||
center: true,
|
||||
autofocus: false,
|
||||
customClass: "ElMessageBox",
|
||||
width: 260,
|
||||
customStyle: 'width: 260px'
|
||||
},
|
||||
).then(() => {
|
||||
proxy.$post('/tenement/pc/api/user/delete', {
|
||||
token: data['token']
|
||||
}).then(res => {
|
||||
if (res.code != 200) return
|
||||
ElMessage.success(res.message)
|
||||
emit('handleDelete', props['index'], data['status'])
|
||||
})
|
||||
}).catch(() => { })
|
||||
}
|
||||
|
||||
// 点击下架
|
||||
const undercarriage = () => {
|
||||
proxy.$post('/tenement/pc/api/user/status', {
|
||||
status: 2,
|
||||
token: data['token'],
|
||||
uniqid: data['uniqid'],
|
||||
}).then(res => {
|
||||
let data = res.data
|
||||
emit('undercarriage', props['index'], data['status'])
|
||||
})
|
||||
}
|
||||
|
||||
// 点击顶上去
|
||||
const goUp = () => {
|
||||
if (data.isding == 1) ElMessage('今天已顶过啦,明天再来吧!')
|
||||
if (data.isding != 0) return
|
||||
proxy.$post("/tenement/pc/api/user/ding", { token: data['token'] }).then(res => {
|
||||
ElMessage.success(res.message)
|
||||
emit('goUp', props['index'])
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 输出 时间格式 2023年07月04日
|
||||
const formatDate = timestamp => {
|
||||
// 创建一个新的Date对象,将时间戳作为参数传入
|
||||
var date = new Date(timestamp * 1000);
|
||||
// 使用Date对象的get方法获取年、月、日
|
||||
var year = date.getFullYear();
|
||||
|
||||
var month = date.getMonth() + 1;
|
||||
var day = date.getDate();
|
||||
|
||||
// 将月份和日期转为两位数的格式,如果不足两位,前面补0
|
||||
if (month < 10) month = '0' + month;
|
||||
if (day < 10) day = '0' + day;
|
||||
|
||||
// 返回格式化后的日期字符串
|
||||
return year + '年' + month + '月' + day + '日';
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
img {
|
||||
@@ -264,6 +389,17 @@ img {
|
||||
text-align: left;
|
||||
word-wrap: break-word;
|
||||
line-height: 28px;
|
||||
|
||||
.title-hint {
|
||||
border: 1px solid rgba(249, 93, 93, 1);
|
||||
display: inline;
|
||||
height: 24px;
|
||||
font-size: 14px;
|
||||
color: #F95D5D;
|
||||
border-radius: 5px;
|
||||
padding: 0 8px;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.mg-l-8 {
|
||||
@@ -397,5 +533,59 @@ img {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.data-info {
|
||||
color: #555555;
|
||||
font-size: 14px;
|
||||
margin-top: 24px;
|
||||
font-family: 'PingFangSC-Regular', 'PingFang SC', sans-serif;
|
||||
|
||||
.longstring {
|
||||
width: 2px;
|
||||
height: 13px;
|
||||
background-color: #d7d7d7;
|
||||
margin: 0 16px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
.itemm {
|
||||
.item-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.publish-footer {
|
||||
height: 85px;
|
||||
border-top: 1px dotted #d7d7d7;
|
||||
justify-content: flex-end;
|
||||
padding: 0 20px;
|
||||
|
||||
.publish-item {
|
||||
width: 100px;
|
||||
height: 40px;
|
||||
border: 1px solid rgba(170, 170, 170, 1);
|
||||
font-size: 15px;
|
||||
color: #555555;
|
||||
border-radius: 45px;
|
||||
cursor: pointer;
|
||||
margin-left: 10px;
|
||||
|
||||
&.go-up {
|
||||
border: none;
|
||||
color: #fff;
|
||||
background-color: rgba(98, 177, 255, 1);
|
||||
}
|
||||
|
||||
&.already-go-up {
|
||||
border: none;
|
||||
color: #AAAAAA;
|
||||
background-color: rgba(242, 242, 242, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user