Merge branch 'lr' of http://1.94.221.165:3000/sx/jiuyiUniapp
# Conflicts: # jiuyi2/common/js/config.js # jiuyi2/pages/mine/setting/usePay.vue # jiuyi2/pages/mine/switch-accounts/index.vue # jiuyi2/pages/news/news.vue # jiuyi2/vite.config.js
This commit is contained in:
commit
409f137e89
|
@ -14,8 +14,6 @@ onLaunch(() => {
|
|||
getUserinfo()
|
||||
// 获取系统配置
|
||||
getConfig()
|
||||
// 获取未读消息数量
|
||||
getNoReadNum()
|
||||
})
|
||||
|
||||
// 获取用户信息
|
||||
|
@ -53,41 +51,6 @@ function getConfig() {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 获取未读消息数量
|
||||
async function getNoReadNum() {
|
||||
// uni.removeTabBarBadge({
|
||||
// index: 2,
|
||||
// text: "",
|
||||
// });
|
||||
// api.getNoReadNum().then(rs => {
|
||||
// if (rs.code == 200) {
|
||||
// uni.setTabBarBadge({
|
||||
// index: 0,
|
||||
// text: "11",
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
|
||||
// uni.setTabBarBadge({
|
||||
// index: 2,
|
||||
// text: "11",
|
||||
// });
|
||||
|
||||
// const res = await uni.request({ url: 'API_URL' });
|
||||
// const count = res.data.unread;
|
||||
|
||||
|
||||
// setTimeout(() => {
|
||||
// uni.setTabBarBadge({
|
||||
// index: 1,
|
||||
// text: '10',
|
||||
// success: function () {
|
||||
// console.log(11111);
|
||||
// },
|
||||
// })
|
||||
// }, 1000)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
|
@ -1427,6 +1427,7 @@ const util = {
|
|||
uni.$emit('login')
|
||||
|
||||
setTimeout(() => {
|
||||
util.loginTencent(userinfo)
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
|
|
|
@ -138,6 +138,12 @@ const showMenu = computed(() => {
|
|||
// 未读数量
|
||||
const noReadNum = ref(0)
|
||||
|
||||
const getReadNum = () => {
|
||||
getNoReadNum()
|
||||
}
|
||||
|
||||
defineExpose({ getReadNum })
|
||||
|
||||
// 加载完成之后
|
||||
onMounted(() => {
|
||||
// 开启监听
|
||||
|
@ -153,7 +159,7 @@ onMounted(() => {
|
|||
// proxy.$refs.alert.open()
|
||||
|
||||
})
|
||||
onLoad(()=>{
|
||||
onLoad(() => {
|
||||
// 获取未读消息数量
|
||||
getNoReadNum()
|
||||
})
|
||||
|
@ -245,7 +251,7 @@ function getNoReadNum() {
|
|||
|
||||
<view class="option" :class="{ active: item.page === page }" v-if="item.type == 'option'">
|
||||
<text class="text">{{ item.name }}</text>
|
||||
<span class="pot" v-if="item.page == 'news' && noReadNum != 0">{{ noReadNum }}</span>
|
||||
<view class="pot" v-if="item.page == 'news' && noReadNum != 0">{{ noReadNum }}</view>
|
||||
</view>
|
||||
|
||||
<view class="middle" v-else-if="item.type === 'middle'">
|
||||
|
@ -351,15 +357,20 @@ $boderSize: 2rpx;
|
|||
color: #999;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.option {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
.pot {
|
||||
position: absolute;
|
||||
top: -16rpx;
|
||||
right: -30rpx;
|
||||
height: 24rpx;
|
||||
/* #ifndef APP-NVUE */
|
||||
min-width: 24rpx;
|
||||
/* #endif */
|
||||
line-height: 24rpx;
|
||||
border-radius: 24rpx;
|
||||
background: #FF6B17;
|
||||
|
@ -367,7 +378,7 @@ $boderSize: 2rpx;
|
|||
font-size: 20rpx;
|
||||
padding: 4rpx;
|
||||
text-align: center;
|
||||
}
|
||||
z-index: 11;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
// 移除监听
|
||||
function removeListener() {
|
||||
uni.$chat.off(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED);
|
||||
uni.$chat.off(TencentCloudChat.EVENT.FRIEND_LIST_UPDATED,()=>{});
|
||||
}
|
||||
|
||||
// 获取群组列表
|
||||
|
|
|
@ -93,28 +93,66 @@ function addListener() {
|
|||
|
||||
// 移除监听
|
||||
function removeListener() {
|
||||
// #ifdef APP
|
||||
uni.$chat.off(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED);
|
||||
// #endif
|
||||
uni.$chat.off(TencentCloudChat.EVENT.CONVERSATION_LIST_UPDATED, () => { });
|
||||
}
|
||||
|
||||
// 获取消息列表
|
||||
function getList() {
|
||||
api.news.getMessageList({
|
||||
query: {
|
||||
userId: userinfo.value.id,
|
||||
}
|
||||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
// list.data = handleList(rs.data);
|
||||
list.data = handleList(JSON.parse(rs.msg).SessionItem);
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
if (!isReady) {
|
||||
setTimeout(function () {
|
||||
getList();
|
||||
}, 800);
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
|
||||
uni.$emit('updateNum', {})
|
||||
|
||||
uni.$chat.getConversationList().then(rs => {
|
||||
let res = rs.data.conversationList
|
||||
let arr = []
|
||||
res.forEach(item => {
|
||||
let obj = {}
|
||||
obj.type = item.type;
|
||||
obj.chatText = item.lastMessage.messageForShow;
|
||||
obj.MsgTime = handleDate(item.lastMessage.lastTime);
|
||||
obj.unreadCount = item.unreadCount;
|
||||
|
||||
if (item.type == 'C2C') {
|
||||
obj.avatar = item.userProfile.avatar;
|
||||
obj.name = item.userProfile.nick;
|
||||
obj.userID = item.userProfile.userID;
|
||||
} else if (item.type == 'GROUP') {
|
||||
obj.avatar = item.groupProfile.avatar;
|
||||
obj.name = item.groupProfile.name;
|
||||
obj.num = item.groupProfile.memberCount;
|
||||
obj.groupID = item.groupProfile.groupID;
|
||||
}
|
||||
arr.push(obj)
|
||||
})
|
||||
|
||||
list.data = arr;
|
||||
|
||||
})
|
||||
|
||||
// api.news.getMessageList({
|
||||
// query: {
|
||||
// userId: userinfo.value.id,
|
||||
// }
|
||||
// }).then(rs => {
|
||||
// if (rs.code == 200) {
|
||||
// let msg = JSON.parse(rs.msg);
|
||||
|
||||
// list.data = handleList(msg.SessionItem);
|
||||
|
||||
// return
|
||||
// }
|
||||
// util.alert({
|
||||
// content: rs.msg,
|
||||
// showCancel: false,
|
||||
// })
|
||||
// })
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,7 +168,7 @@ function handleList(list) {
|
|||
}, 800);
|
||||
return
|
||||
}
|
||||
|
||||
if (list) {
|
||||
list.forEach(item => {
|
||||
item.MsgTime = handleDate(item.MsgTime)
|
||||
|
||||
|
@ -151,6 +189,7 @@ function handleList(list) {
|
|||
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
@ -178,15 +217,15 @@ function handleList(list) {
|
|||
function handleChat(item) {
|
||||
let param = {};
|
||||
// 单聊
|
||||
if (item.groupId == null) {
|
||||
if (item.type == 'C2C') {
|
||||
param.type = 'C2C'
|
||||
param.name = `${item.name}`
|
||||
param.msgId = `${item.To_Account}`
|
||||
param.msgId = `${item.userID}`
|
||||
} else {
|
||||
// 群聊
|
||||
param.type = 'GROUP'
|
||||
param.name = `${item.name}`
|
||||
param.msgId = `${item.GroupId}`
|
||||
param.msgId = `${item.groupID}`
|
||||
param.num = `${item.num}`
|
||||
}
|
||||
|
||||
|
@ -216,7 +255,7 @@ function delMsg(item) {
|
|||
return
|
||||
}
|
||||
|
||||
let conversationId = item.Type == 1 ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
|
||||
let conversationId = item.Type == 1 ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
||||
|
||||
uni.$chat.deleteConversation(conversationId).then(rs => {
|
||||
getList()
|
||||
|
@ -234,7 +273,7 @@ function setRead(item) {
|
|||
return
|
||||
}
|
||||
|
||||
let conversationId = item.Type == 1 ? `C2C${item.To_Account}` : `GROUP${item.GroupId}`;
|
||||
let conversationId = item.Type == 1 ? `C2C${item.userID}` : `GROUP${item.groupID}`;
|
||||
uni.$chat.setMessageRead({
|
||||
conversationID: conversationId,
|
||||
}).then(rs => {
|
||||
|
|
|
@ -226,7 +226,7 @@
|
|||
color: #333;
|
||||
background-color: #F7F7F7;
|
||||
border-radius: 10rpx;
|
||||
transition: .3s;
|
||||
// transition: .3s;
|
||||
border: 2rpx solid #F7F7F7;
|
||||
|
||||
.text {}
|
||||
|
@ -244,7 +244,7 @@
|
|||
|
||||
// 不能选
|
||||
&.disabled {
|
||||
background-color: F7F7F7;
|
||||
background-color: #F7F7F7;
|
||||
|
||||
.txt {
|
||||
color: #999;
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<!-- 商品管理 -->
|
||||
<template>
|
||||
<view class="jy-business-operator-order">
|
||||
<JyCommonHead title="商品管理" isRight>
|
||||
<template v-slot:right>
|
||||
<view @click="right">添加</view>
|
||||
</template>
|
||||
</JyCommonHead>
|
||||
<view class="p16">
|
||||
<JyOrderCard v-for="(item, index) in 10" type="merchandise_control"></JyOrderCard>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad,
|
||||
onReachBottom
|
||||
} from "@dcloudio/uni-app"
|
||||
import JyCommonHead from '@/components/public/jy-common-head'
|
||||
//顶部条件栏
|
||||
import JyOrderCard from '@/components/public/jy-order-card'
|
||||
|
||||
onReachBottom(() => {
|
||||
//
|
||||
})
|
||||
</script>
|
|
@ -1,155 +0,0 @@
|
|||
<!-- 商品发布 -->
|
||||
<template>
|
||||
<view class="jy-commodity_release">
|
||||
<!-- 商品图片多选 -->
|
||||
<uni-forms :modelValue="paramsData">
|
||||
<uni-forms-item class="vertical-label margins" label="商品图片" name="name">
|
||||
<uni-file-picker :imageStyles="{
|
||||
width: '150rpx',
|
||||
height: '150rpx'
|
||||
}" limit="9">
|
||||
<view>
|
||||
<image class="wh120" src="/static/shop-upload-image.png"></image>
|
||||
</view>
|
||||
</uni-file-picker>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item class="vertical-label margins" labelPosition="top" label="商品标题" name="name">
|
||||
<uni-easyinput type="textarea" autoHeight :inputBorder="false" maxlength="30"
|
||||
placeholder="最多输入60字符(30个汉字)" />
|
||||
</uni-forms-item>
|
||||
<view class="margins mb20">
|
||||
<uni-forms-item label="类目" name="name">
|
||||
<view class="df jcsb aic hohp" @click="category.open()">
|
||||
<text class="click_select">点击选择</text>
|
||||
<uni-icons color="#d8d8d8" type="arrowright" size="18" />
|
||||
</view>
|
||||
<JyPopup ref="category" title="请选择申请原因" :showSave="false">
|
||||
<view class="reason-list" v-for="item in 10" @click="selectReason(item)">
|
||||
<text class="label">{{ item }}</text>
|
||||
</view>
|
||||
</JyPopup>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="规格" name="name">
|
||||
<text class="click_select hohp df aic" @click="addSpecifications">添加规格</text>
|
||||
<!-- <uni-easyinput class="hohp df aic" type="text" :inputBorder="false" placeholder="" /> -->
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="价格" name="name">
|
||||
<uni-easyinput class="hohp df aic" type="number" :inputBorder="false" placeholder="¥0.00" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="库存" name="name">
|
||||
<uni-easyinput class="hohp df aic" type="number" :inputBorder="false" placeholder="输入库存" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-forms-item class="margins" label="发货" name="name">
|
||||
<view class="df jcsb aic hohp">
|
||||
<text class="click_select">点击选择</text>
|
||||
<uni-icons color="#d8d8d8" type="arrowright" size="18" />
|
||||
</view>
|
||||
<JyPopup ref="category" title="发货" :showSave="false">
|
||||
<uni-forms :modelValue="paramsDeliveryData">
|
||||
<uni-forms-item label="发货时间" name="name">
|
||||
<uni-easyinput class="hohp df aic" type="text" :inputBorder="false" placeholder="输入时间" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="运费" name="name">
|
||||
<uni-easyinput class="hohp df aic" type="text" :inputBorder="false" placeholder="输入运费" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="所在地" name="name">
|
||||
<uni-easyinput class="hohp df aic" type="text" :inputBorder="false" placeholder="输入省,市,区" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</JyPopup>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item class="margins" name="name">
|
||||
<view class="df jcsb aic hohp">
|
||||
<view class="df aic hohp">
|
||||
<image class="wh50 mr40" src="/static/commodity-release-video.png" mode="aspectFit" />
|
||||
<text>添加链接到视频</text>
|
||||
</view>
|
||||
<uni-icons color="#d8d8d8" type="arrowright" size="18" />
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
<!-- 立即发布 -->
|
||||
<JyBottomBtn @click="postApi">立即发布</JyBottomBtn>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, inject, onMounted, onUnmounted } from 'vue'
|
||||
import JyBottomBtn from '@/components/public/jy-bottom-button'
|
||||
import JyPopup from '@/components/public/jy-popup'
|
||||
const { checkLink } = inject('util');
|
||||
import { eventBus } from '@/components/public/event-bus'
|
||||
onMounted(() => {
|
||||
eventBus.on('business-operator', businessOperator)
|
||||
})
|
||||
onUnmounted(() => {
|
||||
eventBus.off('business-operator')
|
||||
});
|
||||
const businessOperator = (value) => {
|
||||
console.log('====================================');
|
||||
console.log(value);
|
||||
console.log('====================================');
|
||||
}
|
||||
|
||||
const category = ref(null)
|
||||
const paramsData = reactive({
|
||||
name: ''
|
||||
})
|
||||
const paramsDeliveryData = reactive({
|
||||
name: ''
|
||||
})
|
||||
const postApi = () => {
|
||||
uni.showToast({
|
||||
title: '发布成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
const addSpecifications = () => {
|
||||
checkLink('pages/merchant/specifications/index')
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.jy-commodity_release {
|
||||
padding: 26rpx;
|
||||
|
||||
.vertical-label {
|
||||
display: flex;
|
||||
flex-direction: column !important;
|
||||
}
|
||||
|
||||
.uni-forms-item {
|
||||
margin-bottom: 20rpx !important;
|
||||
}
|
||||
|
||||
::v-deep .file-picker__box-content {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
::v-deep .uni-easyinput {
|
||||
.uni-easyinput__content-input {
|
||||
padding: 0px !important;
|
||||
|
||||
}
|
||||
|
||||
.uni-input-placeholder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
color: #c9c9c9 !important;
|
||||
font-size: 28rpx !important;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.margins {
|
||||
padding: 16rpx 24rpx;
|
||||
border-radius: 20rpx;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.click_select {
|
||||
color: #C9C9C9;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,68 +0,0 @@
|
|||
<!-- 我的订单 -->
|
||||
<template>
|
||||
<view class="jy-business-operator-order">
|
||||
<JyCommonHead>
|
||||
<template v-slot:center>
|
||||
<uni-easyinput prefixIcon="search" v-model="value" placeholder="搜索内容" />
|
||||
</template>
|
||||
</JyCommonHead>
|
||||
<JyShopNavigation :current="params.currentTab" :list="tabs" @tabItemClick="itemClick" marright="25px"
|
||||
activeWeight='600' activeColor="#333333" activeBarColor="initial" />
|
||||
<view class="p16">
|
||||
<JyOrderCard v-for="(item, index) in 10" type="business_order"></JyOrderCard>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onLoad } from "@dcloudio/uni-app"
|
||||
import JyCommonHead from '@/components/public/jy-common-head'
|
||||
//顶部条件栏
|
||||
import JyShopNavigation from '@/components/public/jy-shop-navigation'
|
||||
import JyOrderCard from '@/components/public/jy-order-card'
|
||||
import { onReachBottom } from '@dcloudio/uni-app';
|
||||
onReachBottom(() => {
|
||||
console.log('====================================');
|
||||
console.log("加载到底了通知刷新");
|
||||
console.log('====================================');
|
||||
})
|
||||
const itemClick = (item, index) => {
|
||||
}
|
||||
const tabs = ref([{
|
||||
id: 1,
|
||||
name: '全部'
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: '待付款'
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: '待发货'
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
name: '待收货'
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
name: '售后/退款'
|
||||
}])
|
||||
const value = ref('')
|
||||
const params = ref({
|
||||
currentTab: 0
|
||||
})
|
||||
// 获取路由传的参数
|
||||
onLoad(options => {
|
||||
params.value.currentTab = options.currentTab / 1
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.jy-order {
|
||||
::v-deep .uni-easyinput__content {
|
||||
border-radius: 18rpx;
|
||||
width: 542rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,33 +0,0 @@
|
|||
<!-- 规格 -->
|
||||
<template>
|
||||
<view class="jy-specifications p25">
|
||||
<JyCommonHead title="商品管理" @back="sendCommodity">
|
||||
<template v-slot:right>
|
||||
<text @click="add">添加</text>
|
||||
</template>
|
||||
</JyCommonHead>
|
||||
<view v-if="list.length > 0">
|
||||
<JySpecificationsCard class="mt20" v-for="(item, index) in list" :key="index" :item="item">
|
||||
</JySpecificationsCard>
|
||||
</view>
|
||||
</view>
|
||||
<JyBottomBtn @click="postApi">确定</JyBottomBtn>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import JyCommonHead from '@/components/public/jy-common-head'
|
||||
import JySpecificationsCard from './jy-specifications-card'
|
||||
import { eventBus } from '@/components/public/event-bus.js'
|
||||
import JyBottomBtn from '@/components/public/jy-bottom-button'
|
||||
|
||||
const list = ref([{}])
|
||||
const sendCommodity = () => {
|
||||
eventBus.emit('business-operator', list.value)
|
||||
uni.navigateBack();
|
||||
}
|
||||
const add = () => {
|
||||
list.value.push({})
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss"></style>
|
|
@ -1,51 +0,0 @@
|
|||
<!-- 规格卡片 -->
|
||||
<template>
|
||||
<view class="jy-specifications-card bfff p25 br25">
|
||||
<uni-forms :modelValue="paramsData">
|
||||
<uni-forms-item label="商品图片" name="name">
|
||||
<uni-file-picker :imageStyles="{
|
||||
width: '150rpx',
|
||||
height: '150rpx'
|
||||
}" limit="9">
|
||||
<uni-icons type="camera" color="#B2B2B2" size="60"></uni-icons>
|
||||
</uni-file-picker>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="规格" name="name">
|
||||
<uni-easyinput class="hohp df aic" type="text" :inputBorder="false" placeholder="输入规格" />
|
||||
</uni-forms-item>
|
||||
<view class="df">
|
||||
<uni-forms-item label="价格" name="name">
|
||||
<uni-easyinput class="hohp df aic" type="number" :inputBorder="false" placeholder="¥0.00" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="库存" name="name">
|
||||
<uni-easyinput class="hohp df aic" type="number" :inputBorder="false" placeholder="输入库存" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const paramsData = ref({})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.jy-specifications-card {
|
||||
::v-deep .uni-forms-item {
|
||||
margin-bottom: 16rpx !important;
|
||||
|
||||
.uni-forms-item__content {
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</style>
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
// 移除监听
|
||||
function removeListener() {
|
||||
uni.$chat.off(TencentCloudChat.EVENT.GROUP_LIST_UPDATED);
|
||||
uni.$chat.off(TencentCloudChat.EVENT.GROUP_LIST_UPDATED,()=>{});
|
||||
}
|
||||
|
||||
// 获取群组列表
|
||||
|
|
|
@ -1,42 +1,43 @@
|
|||
<script setup>
|
||||
// 消息
|
||||
// 消息
|
||||
|
||||
import {
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
} from 'vue'
|
||||
import {
|
||||
} from 'vue'
|
||||
import {
|
||||
useStore,
|
||||
} from 'vuex'
|
||||
import {
|
||||
} from 'vuex'
|
||||
import {
|
||||
onLoad,
|
||||
onUnload,
|
||||
} from '@dcloudio/uni-app'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
} from '@dcloudio/uni-app'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
|
||||
// 头部导航栏
|
||||
import apex from '@/components/header/apex'
|
||||
// 未登录
|
||||
import noLogin from '@/components/login/noLogin.vue'
|
||||
// 通讯录
|
||||
import book from '@/components/news/book'
|
||||
// 群聊列表
|
||||
import groupList from '@/components/news/groupList'
|
||||
// 消息列表
|
||||
import msgList from '@/components/news/msgList'
|
||||
// 底部菜单
|
||||
import footerMneu from '@/components/footerMenu/footerMenu'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// vuex
|
||||
const store = useStore()
|
||||
// 菜单列表
|
||||
const menuList = reactive([{
|
||||
// 头部导航栏
|
||||
import apex from '@/components/header/apex'
|
||||
// 未登录
|
||||
import noLogin from '@/components/login/noLogin.vue'
|
||||
// 通讯录
|
||||
import book from '@/components/news/book'
|
||||
// 群聊列表
|
||||
import groupList from '@/components/news/groupList'
|
||||
// 消息列表
|
||||
import msgList from '@/components/news/msgList'
|
||||
// 底部菜单
|
||||
import footerMneu from '@/components/footerMenu/footerMenu'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// vuex
|
||||
const store = useStore()
|
||||
// 菜单列表
|
||||
const menuList = reactive([
|
||||
{
|
||||
key: 'group',
|
||||
name: '即时消息',
|
||||
load: true,
|
||||
load: false,
|
||||
}, {
|
||||
key: 'friend',
|
||||
name: '通讯录',
|
||||
|
@ -52,65 +53,79 @@
|
|||
name: '商城消息',
|
||||
load: false,
|
||||
},
|
||||
])
|
||||
// 菜单下标
|
||||
const menuIndex = ref('')
|
||||
// 是否显示搜索菜单
|
||||
const showSearch = ref(false)
|
||||
// im加载
|
||||
const imLoad = ref(false)
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
])
|
||||
// 菜单下标
|
||||
const menuIndex = ref('')
|
||||
// 是否显示搜索菜单
|
||||
const showSearch = ref(false)
|
||||
// im加载
|
||||
const imLoad = ref(false)
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
return store.state.userinfo
|
||||
})
|
||||
// 当前选中的菜单
|
||||
const menuCurrent = computed(() => {
|
||||
})
|
||||
// 当前选中的菜单
|
||||
const menuCurrent = computed(() => {
|
||||
return menuList[menuIndex.value]
|
||||
})
|
||||
})
|
||||
const footerMneuRef = ref()
|
||||
|
||||
onLoad(() => {
|
||||
onLoad(() => {
|
||||
// 初始化菜单
|
||||
handleMenuIndex(0)
|
||||
|
||||
// 开启监听
|
||||
addListener()
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
// 更新未读数量
|
||||
uni.$on('updateNum', (val) => {
|
||||
getNoRead()
|
||||
})
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
// 移除监听
|
||||
removeListener()
|
||||
})
|
||||
})
|
||||
|
||||
// 开启监听
|
||||
function addListener() {
|
||||
function getNoRead() {
|
||||
setTimeout(() => {
|
||||
footerMneuRef.value.getReadNum();
|
||||
}, 200)
|
||||
}
|
||||
|
||||
// 开启监听
|
||||
function addListener() {
|
||||
uni.$chat.on(TencentCloudChat.EVENT.SDK_READY, imLoading);
|
||||
}
|
||||
}
|
||||
|
||||
// im加载完成
|
||||
function imLoading() {
|
||||
// im加载完成
|
||||
function imLoading() {
|
||||
imLoad.value = true
|
||||
}
|
||||
}
|
||||
|
||||
// 移除监听
|
||||
function removeListener() {
|
||||
uni.$chat.off(TencentCloudChat.EVENT.SDK_READY, () => {});
|
||||
}
|
||||
// 移除监听
|
||||
function removeListener() {
|
||||
// #ifdef APP
|
||||
uni.$chat.off(TencentCloudChat.EVENT.SDK_READY,()=>{});
|
||||
// #endif
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 切换下标
|
||||
* @param {Number} index
|
||||
*/
|
||||
function handleMenuIndex(index) {
|
||||
function handleMenuIndex(index) {
|
||||
if (menuIndex.value === index) return
|
||||
menuList.forEach(item => {
|
||||
item.load = false;
|
||||
});
|
||||
menuList[index].load = true;
|
||||
menuIndex.value = index
|
||||
}
|
||||
}
|
||||
|
||||
// 打开菜单
|
||||
function showActionSheet() {
|
||||
// 打开菜单
|
||||
function showActionSheet() {
|
||||
uni.showActionSheet({
|
||||
itemList: ['扫一扫', '添加好友', '发起群聊', '我的二维码'],
|
||||
success: rs => {
|
||||
|
@ -139,9 +154,9 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function getUserInfos(userRecommend) {
|
||||
function getUserInfos(userRecommend) {
|
||||
videoApi.getUserInfo({
|
||||
query: {
|
||||
userRecommend: userRecommend,
|
||||
|
@ -155,7 +170,7 @@
|
|||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -198,7 +213,7 @@
|
|||
<swiper class="swiper" :current="menuIndex" disable-touch="true">
|
||||
<!-- 群组 -->
|
||||
<swiper-item>
|
||||
<msgList v-if="menuList[0].load" :type="menuIndex" />
|
||||
<msgList v-if="menuList[0].load" :type="menuIndex" @updateNum="updateNum" />
|
||||
<view class="loading" v-else>正在加载</view>
|
||||
</swiper-item>
|
||||
|
||||
|
@ -210,13 +225,13 @@
|
|||
|
||||
<!-- 视频消息 -->
|
||||
<swiper-item>
|
||||
<msgList v-if="menuList[2].load" :type="menuIndex" />
|
||||
<msgList v-if="menuList[2].load" :type="menuIndex" @updateNum="updateNum" />
|
||||
<view class="loading" v-else>正在加载</view>
|
||||
</swiper-item>
|
||||
|
||||
<!-- 商城消息 -->
|
||||
<swiper-item>
|
||||
<msgList v-if="menuList[3].load" :type="menuIndex" />
|
||||
<msgList v-if="menuList[3].load" :type="menuIndex" @updateNum="updateNum" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
@ -226,8 +241,8 @@
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
//
|
||||
.headMenu {
|
||||
//
|
||||
.headMenu {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
grid-gap: 25rpx;
|
||||
|
@ -266,10 +281,10 @@
|
|||
height: 175rpx;
|
||||
transform: rotate(-5deg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 搜索条
|
||||
.searchBox {
|
||||
// 搜索条
|
||||
.searchBox {
|
||||
overflow: hidden;
|
||||
height: 0;
|
||||
transition: .3s;
|
||||
|
@ -277,19 +292,19 @@
|
|||
&.active {
|
||||
height: 80rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 容器
|
||||
.swiper {
|
||||
// 容器
|
||||
.swiper {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
// 正在加载
|
||||
.loading {
|
||||
// 正在加载
|
||||
.loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -43,7 +43,6 @@ import {
|
|||
statusBarHeight,
|
||||
goBack
|
||||
} from '@/components/public/Mixins.js'
|
||||
import JyCommonHead from '@/components/public/jy-common-head'
|
||||
import { shareToPlatform } from '@/components/public/share.js'
|
||||
const share_more = ref(null)
|
||||
const more_share_data = ref([])
|
||||
|
|
Loading…
Reference in New Issue