加了 点击发布 点赞 评论等打开弹窗

This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-06-23 18:17:16 +08:00
parent 79a2155a1f
commit 8e4a834797
17 changed files with 414 additions and 131 deletions

View File

@@ -5,17 +5,11 @@
<script setup>
import login from "@/components/public/login.vue";
import store from "@/store";
import { onMounted, watch, watchEffect } from "vue";
import { onMounted, watch, watchEffect, ref, provide } from "vue";
import { useRoute } from "vue-router";
import api from "./utils/api";
let socketTask = null;
onMounted(() => {
// useSocket()
document.addEventListener("visibilitychange", () => {
if (document.visibilityState === "visible" && socketTask?.readyState != 1) useSocket();
});
// 创建cnzz统计js //v1.cnzz.com/z_stat.php?id=1281224882&amp;web_id=1281224882
// const script = document.createElement("script")
// script.src = "https://v1.cnzz.com/z_stat.php?id=1281224882&web_id=1281224882"
@@ -23,8 +17,41 @@ onMounted(() => {
// document.body.appendChild(script)
getBannerData();
getUserInfoWin();
});
let realname = ref(0); // 是否已经实名
let userInfoWin = ref({});
const getUserInfoWin = () => {
const checkUser = () => {
const user = window.userInfoWin;
if (!user) {
setTimeout(checkUser, 100);
return;
}
userInfoWin.value = user;
realname.value = user.realname || 0;
};
setTimeout(checkUser, 100);
};
const openAttest = () => {
const handleAttestClose = () => {
document.removeEventListener("closeAttest", handleAttestClose);
realname.value = window.userInfoWin?.realname || 0;
};
// 启动认证流程时添加监听
document.addEventListener("closeAttest", handleAttestClose);
loadAttest(2);
};
provide("realname", realname);
provide("userInfoWin", userInfoWin);
provide("openAttest", openAttest);
const route = useRoute();
watch(route, (newValue, oldValue) => {
@@ -41,41 +68,6 @@ watch(route, (newValue, oldValue) => {
}
});
const useSocketInterval = 50000; // Socket的时间间隔
const useSocket = () => {
let token = getMiucmsSessionCookie() || "";
socketTask = new WebSocket(`wss://app.gter.net/socket?token=${token}`);
socketTask.onopen = () => {
let user = store.state.user || {};
if (user && token) {
socketTask.send(
JSON.stringify({
type: "bind",
data: {
token,
uid: user.uid || 0,
},
})
);
}
setTimeout(() => timedTransmission(), useSocketInterval);
};
socketTask.onclose = () => {
// timedTransmissionState = false
console.log("socket关闭了", new Date());
};
};
// let timedTransmissionState = false // 定时器启动状态
// 定时发送
const timedTransmission = () => {
// if (socketTask.readyState != 1 || timedTransmissionState) return
if (socketTask.readyState != 1) return;
// timedTransmissionState = true
socketTask.send(JSON.stringify({ type: "ping" }));
setTimeout(() => timedTransmission(), useSocketInterval);
};
const getMiucmsSessionCookie = () => {
let cookies = document.cookie.split(";");
for (let i = 0; i < cookies.length; i++) {

View File

@@ -8,8 +8,7 @@
<div class="please-choose">请选择</div>
<div class="choice-box flexflex flex1">
<div v-for="(item, index) in identityList" :key="index">
<div v-if="index == identityList.length - 1 && index % 2 !== 1" class="choice-long-item flexacenter"
@click="choiceItem(item.key)">
<div v-if="index == identityList.length - 1 && index % 2 !== 1" class="choice-long-item flexacenter" @click="choiceItem(item.key)">
<div class="choice-long-left">
<div class="choice-name">{{ item.value }}</div>
<div class="choice-explain">{{ item.desc }}</div>
@@ -31,15 +30,14 @@
<div class="affirm-hint affirm-b-hint" v-else>由于您上架的房源信息中包括了中介房源系统需要确认您是否属于中介身份</div>
<div class="rules-box">
<div class="rules-item flexflex" v-for="(item, index) in showList" :key="index">
<img class="rules-icon" src="@/assets/img/edit/green-arrow.svg" alt="">
<img class="rules-icon" src="@/assets/img/edit/green-arrow.svg" alt="" />
<div class="rules-text" v-html="item"></div>
</div>
</div>
<div class="footer flexcenter">
<div v-if="popType == 'agent'" class="footer-item flexcenter" @click="backChoice">重新选择</div>
<div v-else class="footer-item flexcenter" @click="confirmIntermediary(-1)">我不是中介</div>
<div class="footer-item affirm flexcenter" @click="confirmIntermediary(1)">{{ popType == 'agent' ?
'确认并不再修改' : '我是中介' }}</div>
<div class="footer-item affirm flexcenter" @click="confirmIntermediary(1)">{{ popType == "agent" ? "确认并不再修改" : "我是中介" }}</div>
</div>
</div>
</div>
@@ -48,109 +46,116 @@
<!-- <script> -->
<script setup>
import { ElLoading } from 'element-plus'
import { ElLoading } from "element-plus";
import { ref, reactive, onMounted, getCurrentInstance, defineEmits } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { ref, reactive, onMounted, getCurrentInstance, defineEmits, inject } from "vue";
import { useRouter, useRoute } from "vue-router";
const { proxy } = getCurrentInstance()
const router = useRouter()
const { proxy } = getCurrentInstance();
const router = useRouter();
const route = useRoute();
let identityList = ref([]);
let identityList = ref([])
let popType = ref(""); // choice agent: 确认是否是中介(有个人房源) affirmAgent: 确认是否是中介(有中介房源)
let popType = ref('') // choice agent: 确认是否是中介(有个人房源) affirmAgent: 确认是否是中介(有中介房源)
let agent = ref([`中介账号发布的房源信息,均展示在“<span style="color: #000; font-weight:650;">中介房源</span>”频道中,即不能发布“<span style="color: #000; font-weight:650;">个人房源</span>”、“<span style="color: #000; font-weight:650;">求房源</span>”;如您已上架个人房源或求房源信息,在你确认中介身份后,将会自动下架`]);
let agent = ref([`中介账号发布的房源信息,均展示在“<span style="color: #000; font-weight:650;">中介房源</span>”频道中,即不能发布“<span style="color: #000; font-weight:650;">个人房源</span>”“<span style="color: #000; font-weight:650;">房源</span>”如您已上架个人房源或求房源信息,在你确认中介身份后,将会自动下架`])
let affirmAgent = ref([`个人账号只能发布“<span style="color: #000; font-weight:650;">个人房源</span>”“<span style="color: #000; font-weight:650;">房源</span>”,在您确认不是中介身份后,将会自动下架您的中介房源;`, `中介账号只能发布“<span style="color: #000; font-weight:650;">中介房源</span>”如您已上架个人房源或求房源信息,在你确认中介身份后,将会自动下架`]);
let affirmAgent = ref([`个人账号只能发布“<span style="color: #000; font-weight:650;">个人房源</span>”、“<span style="color: #000; font-weight:650;">求房源</span>”,在您确认不是中介身份后,将会自动下架您的中介房源;`, `中介账号只能发布“<span style="color: #000; font-weight:650;">中介房源</span>”,如您已上架个人房源或求房源信息,在你确认中介身份后,将会自动下架;`])
let rulesList = ref([`中介账号(未认证)最多可同时上架 <span style="color: #000; font-weight:650;">3</span> 条房源信息`, `中介账号(有认证)最多可同时上架 <span style="color: #000; font-weight:650;">20</span> 条房源信息`, `中介帐号(有认证)拥有搜索、过滤“<span style="color: #000; font-weight:650;">房源</span>”信息的功能`]);
let rulesList = ref([`中介账号(未认证)最多可同时上架 <span style="color: #000; font-weight:650;">3</span> 条房源信息`, `中介账号(有认证)最多可同时上架 <span style="color: #000; font-weight:650;">20</span> 条房源信息`, `中介帐号(有认证)拥有搜索、过滤“<span style="color: #000; font-weight:650;">求房源</span>”信息的功能`,])
let showList = ref([]); //展示的规则
let showList = ref([]) //展示的规则
let identityKey = ref(1)
let housingnum = ref(0)
let isintermediary = ref(0)
let loading = ref(null) // 加载
let identityKey = ref(1);
let housingnum = ref(0);
let isintermediary = ref(0);
let loading = ref(null); // 加载
let openAttest = inject("openAttest");
const realname = inject("realname");
const userInfoWin = inject("userInfoWin");
// 点击按钮
const ClickBtn = () => {
if (identityList.value.length == 0) init()
else popType.value = 'choice'
}
console.log(realname.value == 0, userInfoWin.value.uin > 0);
if (route.path == "/choosing-identity") ClickBtn()
if (realname.value == 0 && userInfoWin.value.uin > 0) {
openAttest();
return;
}
if (identityList.value.length == 0) init();
else popType.value = "choice";
};
if (route.path == "/choosing-identity") ClickBtn();
async function init() {
loading = ElLoading.service({
lock: true,
text: 'Loading',
background: 'rgba(0, 0, 0, 0.7)',
})
text: "Loading",
background: "rgba(0, 0, 0, 0.7)",
});
proxy.$post("/tenement/pc/api/publish/checkidentity").then(res => {
if (res.code != 200) return
let data = res.data
identityList.value = data.data
housingnum.value = data.housingnum
// housingnum.value = 10
isintermediary.value = data.isintermediary
// isintermediary.value = 1
proxy
.$post("/tenement/pc/api/publish/checkidentity")
.then((res) => {
if (res.code != 200) return;
let data = res.data;
identityList.value = data.data;
housingnum.value = data.housingnum;
// housingnum.value = 10
isintermediary.value = data.isintermediary;
// isintermediary.value = 1
// if (data['ispopup'] == 0) overallJump()
if (data['ispopup'] == 0) overallJump()
else popType.value = 'choice'
}).finally(() => {
loading.close()
})
// if (data['ispopup'] == 0) overallJump()
if (data["ispopup"] == 0) overallJump();
else popType.value = "choice";
})
.finally(() => {
loading.close();
});
}
// 返回选择 重新选择
let backChoice = () => popType.value = "choice"
let backChoice = () => (popType.value = "choice");
// 选择身份
let choiceItem = (key) => {
identityKey.value = key
identityKey.value = key;
if (key == 1) {
popType.value = "agent"
showList.value = [...agent.value, ...rulesList.value]
popType.value = "agent";
showList.value = [...agent.value, ...rulesList.value];
} else {
showList.value = [...affirmAgent.value, ...rulesList.value]
if (housingnum.value == 0) overallJump()
else popType.value = "affirmAgent"
showList.value = [...affirmAgent.value, ...rulesList.value];
if (housingnum.value == 0) overallJump();
else popType.value = "affirmAgent";
}
}
};
let overallJump = () => {
router.push(`/edit?intermediary=${identityKey.value}`)
popType.value = ''
}
router.push(`/edit?intermediary=${identityKey.value}`);
popType.value = "";
};
let confirmIntermediary = (isintermediary) => {
if (isintermediary == 1) identityKey.value = 1
overallJump()
if (isintermediary == 1) identityKey.value = 1;
overallJump();
// return
proxy.$post("/tenement/pc/api/publish/submitidentity", {
isintermediary
}).then(res => {
popType.value = ''
})
}
proxy
.$post("/tenement/pc/api/publish/submitidentity", {
isintermediary,
})
.then((res) => {
popType.value = "";
});
};
</script>
<style lang="less" scoped>
.btn {
position: absolute;
top: 0;
@@ -243,7 +248,7 @@ let confirmIntermediary = (isintermediary) => {
.choice-arrows {
background-color: #000;
background-image: url('@/assets/img/edit/selectArrow-white.svg');
background-image: url("@/assets/img/edit/selectArrow-white.svg");
}
}
}
@@ -276,7 +281,7 @@ let confirmIntermediary = (isintermediary) => {
background-color: #fddf6d;
border-radius: 50%;
margin: 0 auto;
background-image: url('@/assets/img/edit/selectArrow.png');
background-image: url("@/assets/img/edit/selectArrow.png");
background-size: 24px;
background-repeat: no-repeat;
background-position: center;
@@ -360,7 +365,6 @@ let confirmIntermediary = (isintermediary) => {
color: #ffffff;
font-weight: 650;
}
}
}
</style>
</style>

View File

@@ -7,13 +7,10 @@ import { goTologin } from '@/utils/util';
import { ref, watch, onMounted, getCurrentInstance, nextTick, createApp } from 'vue'
import store from '@/store/index';
watch(() => store.state.showloginmodal, (newValue) => {
if (newValue) init1()
});
store.state.showloginmodal ? init1() : ''
const { proxy } = getCurrentInstance()

View File

@@ -19,8 +19,12 @@ axios.interceptors.request.use(
if (config.url != "/tenement/pc/api/user/operation" && !noMask) showFullScreenLoading()
// 开发时登录用的,可以直接替换小程序的 authorization
if (process.env.NODE_ENV == "development") config["headers"]["authorization"] = "3b68118f285ff5e63842efc74b2f2b28"
if (process.env.NODE_ENV !== "production") {
const miucms_session = "a37009134499cce160254db1bc9ccb94";
document.cookie = "miucms_session=" + miucms_session;
config["headers"]["authorization"] = miucms_session;
}
// 当 noMask == true 和 confing.method == 'get' 时,删除 config.params['noMask']
if (noMask && config.method == "get") delete config.params["noMask"]

View File

@@ -28,7 +28,7 @@
</template>
<script setup>
import { reactive, onMounted, ref, provide, onBeforeUnmount, nextTick, getCurrentInstance } from "vue"
import { reactive, onMounted, ref, provide, onBeforeUnmount, nextTick, getCurrentInstance, inject } from "vue"
import pageTopBar from "../../components/pageTopBar/pageTopBar.vue"
import seachModule from "../../components/seachModule/seachModule1.vue"
import biserialItem from "../../components/biserialListItem/biserialListItem.vue"
@@ -46,6 +46,10 @@ import Masonry from "masonry-layout"
import store from "../../store/index"
import { set } from "nprogress"
let openAttest = inject("openAttest");
const realname = inject("realname");
const userInfoWin = inject("userInfoWin");
//路由
const router = useRouter()