fix: 圈子权限调试
This commit is contained in:
parent
63c193cd88
commit
7403968e85
@ -80,116 +80,121 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue"
|
||||||
import Nav from "@/components/NavBar.vue";
|
import Nav from "@/components/NavBar.vue"
|
||||||
import ChatFrame from "./components/ChatFrame.vue";
|
import ChatFrame from "./components/ChatFrame.vue"
|
||||||
import { useRouter, useRoute } from "vue-router";
|
import { useRouter, useRoute } from "vue-router"
|
||||||
import { sendMessage } from "@/api/circle";
|
import { sendMessage } from "@/api/circle"
|
||||||
import { getCircleDetail, msgUnreadCount } from "@/api/circle";
|
import { getCircleDetail, msgUnreadCount } from "@/api/circle"
|
||||||
import useWebSocket from "./hooks/useWebSocket";
|
import useWebSocket from "./hooks/useWebSocket"
|
||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex"
|
||||||
|
|
||||||
const active = ref(0);
|
const active = ref(0)
|
||||||
const router = useRouter();
|
const router = useRouter()
|
||||||
const route = useRoute();
|
const route = useRoute()
|
||||||
const sendTextLoading = ref(false);
|
const sendTextLoading = ref(false)
|
||||||
const content = ref("");
|
const content = ref("")
|
||||||
const store = useStore();
|
const store = useStore()
|
||||||
|
|
||||||
const showNotice = ref(false); // 是否展示公告栏,同一个公告栏只展示一次
|
const showNotice = ref(false) // 是否展示公告栏,同一个公告栏只展示一次
|
||||||
const detail = ref({
|
const detail = ref({
|
||||||
advisor: {},
|
advisor: {},
|
||||||
});
|
})
|
||||||
const queryCircleDetail = async () => {
|
const queryCircleDetail = async () => {
|
||||||
const ret = await getCircleDetail({ id: route.query.id });
|
const ret = await getCircleDetail({ id: route.query.id })
|
||||||
if (ret && ret.code === 0) {
|
if (ret && ret.code == 0) {
|
||||||
detail.value = ret.data;
|
detail.value = ret.data
|
||||||
const key = `circleNotice-${detail.value.id}-${store.state.userInfo.userId}`;
|
const key = `circleNotice-${detail.value.id}-${store.state.userInfo.userId}`
|
||||||
const storageCircleNotice = localStorage.getItem(key);
|
const storageCircleNotice = localStorage.getItem(key)
|
||||||
if (!storageCircleNotice || storageCircleNotice !== detail.value.notice) {
|
if (
|
||||||
showNotice.value = true;
|
detail.value.notice &&
|
||||||
localStorage.setItem(key, detail.value.notice);
|
(!storageCircleNotice || storageCircleNotice !== detail.value.notice)
|
||||||
|
) {
|
||||||
|
showNotice.value = true
|
||||||
|
localStorage.setItem(key, detail.value.notice)
|
||||||
} else {
|
} else {
|
||||||
showNotice.value = false;
|
showNotice.value = false
|
||||||
}
|
}
|
||||||
|
} else if (ret && ret.code === 6013) {
|
||||||
|
router.replace(`/circle?id=${route.query.id}`)
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
queryCircleDetail();
|
queryCircleDetail()
|
||||||
|
|
||||||
const privateNewMsg = ref({});
|
const privateNewMsg = ref({})
|
||||||
const privateMessage = (msg) => {
|
const privateMessage = (msg) => {
|
||||||
console.log("privateMessage", msg);
|
console.log("privateMessage", msg)
|
||||||
const body = JSON.parse(msg.body);
|
const body = JSON.parse(msg.body)
|
||||||
const data = body.data;
|
const data = body.data
|
||||||
console.log("data", data);
|
console.log("data", data)
|
||||||
// interactiveType 交互类型:1群聊;2私聊;3会话消息
|
// interactiveType 交互类型:1群聊;2私聊;3会话消息
|
||||||
if ([1].includes(body.type)) {
|
if ([1].includes(body.type)) {
|
||||||
privateNewMsg.value = data;
|
privateNewMsg.value = data
|
||||||
if (active.value !== 2) {
|
if (active.value !== 2) {
|
||||||
privateMsgUnreadCount.value++;
|
privateMsgUnreadCount.value++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
const newMsg = ref({}); // ws最新推送的消息
|
const newMsg = ref({}) // ws最新推送的消息
|
||||||
const chatMessage = (msg) => {
|
const chatMessage = (msg) => {
|
||||||
const body = JSON.parse(msg.body);
|
const body = JSON.parse(msg.body)
|
||||||
const data = body.data;
|
const data = body.data
|
||||||
console.log("data", data);
|
console.log("data", data)
|
||||||
// interactiveType 交互类型:1群聊;2私聊;3会话消息
|
// interactiveType 交互类型:1群聊;2私聊;3会话消息
|
||||||
if ([1].includes(body.type)) {
|
if ([1].includes(body.type)) {
|
||||||
newMsg.value = data;
|
newMsg.value = data
|
||||||
} else if (body.type === 6) {
|
} else if (body.type === 6) {
|
||||||
detail.value.interactiveStatus = data;
|
detail.value.interactiveStatus = data
|
||||||
} else if (body.type === 16) {
|
} else if (body.type === 16) {
|
||||||
// 隐藏用户昵称
|
// 隐藏用户昵称
|
||||||
detail.value.showNickName = data;
|
detail.value.showNickName = data
|
||||||
} else if (body.type === 19) {
|
} else if (body.type === 19) {
|
||||||
// 隐藏圈子人数
|
// 隐藏圈子人数
|
||||||
detail.value.showMemberCount = data;
|
detail.value.showMemberCount = data
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
const { stompClient } = useWebSocket({
|
const { stompClient } = useWebSocket({
|
||||||
id: route.query.id,
|
id: route.query.id,
|
||||||
privateMessage,
|
privateMessage,
|
||||||
chatMessage,
|
chatMessage,
|
||||||
});
|
})
|
||||||
|
|
||||||
const sendMsg = async () => {
|
const sendMsg = async () => {
|
||||||
let ret = await sendMessage({
|
let ret = await sendMessage({
|
||||||
content: content.value,
|
content: content.value,
|
||||||
groupId: route.query.id,
|
groupId: route.query.id,
|
||||||
interactiveType: active.value === 2 ? 2 : 1,
|
interactiveType: active.value === 2 ? 2 : 1,
|
||||||
});
|
})
|
||||||
if (ret && ret.code === 0) {
|
if (ret && ret.code === 0) {
|
||||||
content.value = "";
|
content.value = ""
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
// 获取私聊未读消息
|
// 获取私聊未读消息
|
||||||
const privateMsgUnreadCount = ref();
|
const privateMsgUnreadCount = ref()
|
||||||
const getMsgUnreadCount = async () => {
|
const getMsgUnreadCount = async () => {
|
||||||
const lastId = localStorage.getItem(
|
const lastId = localStorage.getItem(
|
||||||
`privateMsgUnreadCount-${route.query.id}-${store.state.userInfo.userId}`
|
`privateMsgUnreadCount-${route.query.id}-${store.state.userInfo.userId}`
|
||||||
);
|
)
|
||||||
if (!lastId) return;
|
if (!lastId) return
|
||||||
let ret = await msgUnreadCount({
|
let ret = await msgUnreadCount({
|
||||||
groupId: route.query.id,
|
groupId: route.query.id,
|
||||||
type: 5,
|
type: 5,
|
||||||
lastId,
|
lastId,
|
||||||
});
|
})
|
||||||
if (ret && ret.code === 0) {
|
if (ret && ret.code === 0) {
|
||||||
privateMsgUnreadCount.value = ret.data;
|
privateMsgUnreadCount.value = ret.data
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
getMsgUnreadCount();
|
getMsgUnreadCount()
|
||||||
|
|
||||||
const changeTab = (tabName) => {
|
const changeTab = (tabName) => {
|
||||||
if (tabName === 2) {
|
if (tabName === 2) {
|
||||||
privateMsgUnreadCount.value = 0;
|
privateMsgUnreadCount.value = 0
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.set {
|
.set {
|
||||||
|
|||||||
@ -8,72 +8,81 @@
|
|||||||
error-text="加载错误,请点击重新加载"
|
error-text="加载错误,请点击重新加载"
|
||||||
@load="onLoad"
|
@load="onLoad"
|
||||||
>
|
>
|
||||||
<CircleItem
|
<CircleItem
|
||||||
|
class="circle-item"
|
||||||
v-for="(item, index) in list"
|
v-for="(item, index) in list"
|
||||||
:key="index"
|
:key="index"
|
||||||
:item="item"/>
|
:item="item"
|
||||||
|
/>
|
||||||
</van-list>
|
</van-list>
|
||||||
</van-pull-refresh>
|
</van-pull-refresh>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, defineProps } from "vue";
|
import { ref, defineProps } from "vue"
|
||||||
import { getCircleList } from "@/api/circle";
|
import { getCircleList } from "@/api/circle"
|
||||||
import CircleItem from "./components/CircleItem.vue";
|
import CircleItem from "./components/CircleItem.vue"
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
type: String,
|
type: String,
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
|
||||||
console.log(props);
|
console.log(props)
|
||||||
|
|
||||||
const list = ref([]);
|
const list = ref([])
|
||||||
const loading = ref(false);
|
const loading = ref(false)
|
||||||
const loadError = ref(false);
|
const loadError = ref(false)
|
||||||
const finished = ref(false);
|
const finished = ref(false)
|
||||||
const refreshing = ref(false);
|
const refreshing = ref(false)
|
||||||
const current = ref(1);
|
const current = ref(1)
|
||||||
|
|
||||||
const onRefresh = () => {
|
const onRefresh = () => {
|
||||||
current.value = 1;
|
current.value = 1
|
||||||
// 清空列表数据
|
// 清空列表数据
|
||||||
finished.value = false;
|
finished.value = false
|
||||||
|
|
||||||
// 重新加载数据
|
// 重新加载数据
|
||||||
// 将 loading 设置为 true,表示处于加载状态
|
// 将 loading 设置为 true,表示处于加载状态
|
||||||
loading.value = true;
|
loading.value = true
|
||||||
onLoad();
|
onLoad()
|
||||||
};
|
}
|
||||||
const onLoad = async () => {
|
const onLoad = async () => {
|
||||||
// 异步更新数据
|
// 异步更新数据
|
||||||
let ret = await getCircleList({
|
let ret = await getCircleList({
|
||||||
id: props.id,
|
id: props.id,
|
||||||
lastId: refreshing.value || !list.value.length
|
lastId:
|
||||||
|
refreshing.value || !list.value.length
|
||||||
? ""
|
? ""
|
||||||
: list.value[list.value.length - 1].id,
|
: list.value[list.value.length - 1].id,
|
||||||
lastPublishTime: refreshing.value || !list.value.length
|
lastPublishTime:
|
||||||
|
refreshing.value || !list.value.length
|
||||||
? ""
|
? ""
|
||||||
: list.value[list.value.length - 1].auditTime,
|
: list.value[list.value.length - 1].auditTime,
|
||||||
lastWeight: refreshing.value || !list.value.length
|
lastWeight:
|
||||||
|
refreshing.value || !list.value.length
|
||||||
? ""
|
? ""
|
||||||
: list.value[list.value.length - 1].isRecommend,
|
: list.value[list.value.length - 1].isRecommend,
|
||||||
size: 10,
|
size: 10,
|
||||||
});
|
})
|
||||||
if (ret.code === 0) {
|
if (ret.code === 0) {
|
||||||
if (refreshing.value) {
|
if (refreshing.value) {
|
||||||
list.value = [];
|
list.value = []
|
||||||
refreshing.value = false;
|
refreshing.value = false
|
||||||
}
|
}
|
||||||
current.value++;
|
current.value++
|
||||||
list.value = list.value.concat(ret.data.list);
|
list.value = list.value.concat(ret.data.list)
|
||||||
finished.value = !ret.data.hasNext;
|
finished.value = !ret.data.hasNext
|
||||||
} else {
|
} else {
|
||||||
loadError.value = true;
|
loadError.value = true
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss"></style>
|
<style scoped lang="scss">
|
||||||
|
.circle-item {
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -32,17 +32,11 @@ const props = defineProps({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const toCircleDetail = () => {
|
const toCircleDetail = () => {
|
||||||
if (props.item.authorityId) {
|
router.push(
|
||||||
router.push(
|
`/circle/interact?id=${props.item.id}&saleUserId=${
|
||||||
`/circle?id=${props.item.id}&saleUserId=${route.query.saleUserId || ""}`
|
route.query.saleUserId || ""
|
||||||
)
|
}`
|
||||||
} else {
|
)
|
||||||
router.push(
|
|
||||||
`/circle/interact?id=${props.item.id}&saleUserId=${
|
|
||||||
route.query.saleUserId || ""
|
|
||||||
}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
const { defineConfig } = require("@vue/cli-service");
|
const { defineConfig } = require("@vue/cli-service")
|
||||||
const { VantResolver } = require("@vant/auto-import-resolver");
|
const { VantResolver } = require("@vant/auto-import-resolver")
|
||||||
const AutoImport = require("unplugin-auto-import/webpack");
|
const AutoImport = require("unplugin-auto-import/webpack")
|
||||||
const Components = require("unplugin-vue-components/webpack");
|
const Components = require("unplugin-vue-components/webpack")
|
||||||
const fileanagerWebpackPlugin = require("filemanager-webpack-plugin");
|
const fileanagerWebpackPlugin = require("filemanager-webpack-plugin")
|
||||||
const path = require("path");
|
const path = require("path")
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
publicPath: "/h5/",
|
publicPath: "/h5/",
|
||||||
@ -34,13 +34,14 @@ module.exports = defineConfig({
|
|||||||
proxy: {
|
proxy: {
|
||||||
"/app": {
|
"/app": {
|
||||||
target: "http://8.138.144.54:8080",
|
target: "http://8.138.144.54:8080",
|
||||||
|
// target: "https://do.tgsys.sztg.com",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
chainWebpack: (config) => {
|
chainWebpack: (config) => {
|
||||||
// SVG 规则排除 icons 目录
|
// SVG 规则排除 icons 目录
|
||||||
config.module.rule("svg").exclude.add(path.resolve("src/assets/icons"));
|
config.module.rule("svg").exclude.add(path.resolve("src/assets/icons"))
|
||||||
// 添加 icons 目录的 SVG loader
|
// 添加 icons 目录的 SVG loader
|
||||||
config.module
|
config.module
|
||||||
.rule("icons")
|
.rule("icons")
|
||||||
@ -49,6 +50,6 @@ module.exports = defineConfig({
|
|||||||
.end()
|
.end()
|
||||||
.use("svg-sprite-loader")
|
.use("svg-sprite-loader")
|
||||||
.loader("svg-sprite-loader")
|
.loader("svg-sprite-loader")
|
||||||
.options({ symbolId: "icon-[name]" });
|
.options({ symbolId: "icon-[name]" })
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user