工作代码提交
This commit is contained in:
parent
17b259fd3a
commit
a10e8353e9
|
@ -9,6 +9,8 @@
|
|||
import api from '@/api/index.js'
|
||||
// vuex
|
||||
import store from '@/store/index.js'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
// #ifdef APP
|
||||
// 引入各种权限配置
|
||||
import {
|
||||
|
@ -40,6 +42,9 @@
|
|||
// #ifdef APP
|
||||
unregisterRequestPermissionTipsListener(null)
|
||||
// #endif
|
||||
|
||||
// 关闭未读消息提示
|
||||
removeListenerUnreadCount()
|
||||
})
|
||||
|
||||
/**
|
||||
|
@ -58,7 +63,6 @@
|
|||
onConfirm: (e) => {
|
||||
console.log(e)
|
||||
},
|
||||
// onComplete
|
||||
onComplete: (e) => {
|
||||
// 华为手机在权限禁止之后,再次申请权限不会出现权限申请框。此时应该引导用户去系统设置开启此权限,不应该频繁申请。
|
||||
if (brand.toLowerCase() == "huawei") {
|
||||
|
@ -103,9 +107,29 @@
|
|||
util.loginTencent(userinfo)
|
||||
}
|
||||
})
|
||||
|
||||
// 开启未读消息监听
|
||||
addListenerUnreadCount()
|
||||
}
|
||||
}
|
||||
|
||||
// 开启未读消息监听
|
||||
function addListenerUnreadCount() {
|
||||
let onTotalUnreadMessageCountUpdated = function(event) {
|
||||
// 设置未读消息条数
|
||||
store.commit('setUnreadCount', event.data)
|
||||
};
|
||||
|
||||
uni.$chat.on(TencentCloudChat.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED, onTotalUnreadMessageCountUpdated);
|
||||
}
|
||||
|
||||
// 关闭未读消息更新
|
||||
function removeListenerUnreadCount() {
|
||||
let onTotalUnreadMessageCountUpdated = (event) => {};
|
||||
//
|
||||
uni.$chat.off(TencentCloudChat.EVENT.TOTAL_UNREAD_MESSAGE_COUNT_UPDATED, onTotalUnreadMessageCountUpdated);
|
||||
}
|
||||
|
||||
// 获取系统配置
|
||||
function getConfig() {
|
||||
api.getConfig().then(rs => {
|
||||
|
|
|
@ -1220,11 +1220,31 @@ const util = {
|
|||
userSig: imSig,
|
||||
}).then(rs => {
|
||||
util.updateMyProfile(userinfo)
|
||||
// 获取未读消息条数
|
||||
util.getUnread(userinfo)
|
||||
console.log('im login success', rs)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 获取未读消息条数
|
||||
getUnread(userinfo) {
|
||||
if (userinfo.isRealName) {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
if (!isReady) {
|
||||
setTimeout(function() {
|
||||
util.getUnread(userinfo)
|
||||
}, 800);
|
||||
return
|
||||
}
|
||||
// 未读条数
|
||||
let unreadCount = uni.$chat.getTotalUnreadMessageCount();
|
||||
// 设置未读消息条数
|
||||
store.commit('setUnreadCount', unreadCount)
|
||||
}
|
||||
},
|
||||
|
||||
// 更新im个人资料
|
||||
updateMyProfile(userinfo) {
|
||||
// 验证sdk是否准备完毕
|
||||
|
|
|
@ -112,14 +112,6 @@
|
|||
url: '/pages/release/video',
|
||||
})
|
||||
}
|
||||
// 1是商家
|
||||
// if(userinfo.value.isShop == 1) {
|
||||
// result.push({
|
||||
// name: '发布商品',
|
||||
// img: '/static/footerMenu1.png',
|
||||
// url: '/pages/release/commodity',
|
||||
// })
|
||||
// }
|
||||
// 追加
|
||||
// result.push({
|
||||
// name: '打车',
|
||||
|
@ -134,13 +126,8 @@
|
|||
// })
|
||||
return result
|
||||
})
|
||||
|
||||
// 未读数量
|
||||
const noReadNum = ref(0)
|
||||
|
||||
const getReadNum = () => {
|
||||
getNoReadNum()
|
||||
}
|
||||
const noReadNum = computed(() => uni.$store.state.unreadCount)
|
||||
|
||||
// 加载完成之后
|
||||
onMounted(() => {
|
||||
|
@ -152,8 +139,6 @@
|
|||
uni.getSystemInfo().then(rs => {
|
||||
safeHeight.value = rs.safeArea + 'px'
|
||||
})
|
||||
// 获取未读消息数量
|
||||
getNoReadNum()
|
||||
|
||||
//
|
||||
// proxy.$refs.alert.open()
|
||||
|
@ -189,7 +174,6 @@
|
|||
else uni.navigateTo({
|
||||
url: `/${item.pagePath}`,
|
||||
})
|
||||
getNoReadNum()
|
||||
return
|
||||
}
|
||||
//
|
||||
|
@ -217,29 +201,6 @@
|
|||
//
|
||||
proxy.$refs.alert.close()
|
||||
}
|
||||
|
||||
// 获取未读消息数量
|
||||
function getNoReadNum() {
|
||||
if (userinfo.value.isRealName) {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
if (!isReady) {
|
||||
setTimeout(function() {
|
||||
getNoReadNum();
|
||||
}, 800);
|
||||
return
|
||||
}
|
||||
|
||||
// #ifdef APP
|
||||
const unreadCount = uni.$chat.getTotalUnreadMessageCount();
|
||||
noReadNum.value = +unreadCount > 99 ? '99+' : unreadCount;
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
getReadNum
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
</view>
|
||||
|
||||
<view class="btn cancel bar f1" v-if="versionCloud.isForce == 1">
|
||||
<text class="tac c333 f28" @click="handleQuit">关闭</text>
|
||||
<text class="tac c333 f28" @click="handleQuit">退出程序</text>
|
||||
</view>
|
||||
|
||||
<view class="btn cancel bar f1" v-else>
|
||||
|
|
|
@ -242,7 +242,7 @@
|
|||
<text class="c333 f34">{{detail.name}}</text>
|
||||
</view>
|
||||
|
||||
<view class="history mtb20 df fdr jcsb aic">
|
||||
<view class="history mtb20 df fdr jcsb aic" v-if="!giftPack">
|
||||
<text class="c666 f28">商品修改历史</text>
|
||||
<uni-icons type="right" color="#999" size="30rpx" />
|
||||
</view>
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
<text class="txt f36">{{item.price}}</text>
|
||||
</view>
|
||||
<!-- 销量 -->
|
||||
<view class="sales fs0 thd wsn ml10 c999 f26">销量:{{item.sales}}</view>
|
||||
<view class="sales fs0 thd wsn ml10 c999 f26" v-if="item.categoryCode !== 'GIFT_PACK'">销量:{{item.sales}}</view>
|
||||
<view class="f1"></view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"name" : "九亿",
|
||||
"appid" : "__UNI__08B31BC",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.18",
|
||||
"versionCode" : 1018,
|
||||
"versionName" : "1.0.20",
|
||||
"versionCode" : 1020,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
|
|
@ -798,7 +798,8 @@
|
|||
"path" : "pages/shop/gift",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "礼包专区"
|
||||
"navigationBarTitleText" : "礼包专区",
|
||||
"navigationBarBackgroundColor": "#fff"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
@ -837,7 +837,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 底部导航 -->
|
||||
<footerMenu ref="footerMenuRef" page="index" subject="dark" />
|
||||
<footerMenu page="index" subject="dark" />
|
||||
</view>
|
||||
|
||||
<!-- app版本更新弹窗 -->
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
addListener()
|
||||
// 获取历史消息
|
||||
getHistory({
|
||||
callback: scrollToBottom
|
||||
callback: scrollToBottom()
|
||||
})
|
||||
// #ifdef APP
|
||||
uni.onKeyboardHeightChange((rs) => {
|
||||
|
@ -351,10 +351,7 @@
|
|||
// 是否拉取完毕
|
||||
list.isCompleted = result.isCompleted
|
||||
// 消息体
|
||||
list.messageList = result.messageList.map(item => {
|
||||
console.log('msg item', item)
|
||||
return item
|
||||
})
|
||||
list.messageList = result.messageList
|
||||
|
||||
nextTick(() => {
|
||||
param.callback && param.callback()
|
||||
|
@ -375,12 +372,13 @@
|
|||
// 滚动至底部
|
||||
function scrollToBottom() {
|
||||
uni.createSelectorQuery().in(proxy).select('#scroll-content').boundingClientRect((res) => {
|
||||
top.value = res.height
|
||||
top.value = res.bottom
|
||||
console.log('scrollToBottom', res)
|
||||
|
||||
uni.pageScrollTo({
|
||||
scrollTop: top.value,
|
||||
duration: 0
|
||||
})
|
||||
// uni.pageScrollTo({
|
||||
// scrollTop: top.value,
|
||||
// duration: 0
|
||||
// })
|
||||
// console.log('top.value', top.value)
|
||||
}).exec();
|
||||
}
|
||||
|
@ -468,6 +466,7 @@
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<view class="chatPage">
|
||||
<apex :title="pageTitle">
|
||||
<template #right>
|
||||
<view>
|
||||
|
@ -476,10 +475,9 @@
|
|||
</template>
|
||||
</apex>
|
||||
|
||||
<view class="app">
|
||||
<scroll-view class="scroll-view" scroll-y :scroll-with-animation="true" :scroll-top="top"
|
||||
@scroll="onContentScroll" @scrolltoupper="getMoreHistroy">
|
||||
<view id="scroll-content" style="padding: 30rpx 30rpx">
|
||||
<view id="scroll-content" style="padding: 30rpx">
|
||||
<view v-for="(item, index) in list.messageList" :key="index">
|
||||
<!-- 系统消息 -->
|
||||
<template v-if="item.from == 'administrator'"></template>
|
||||
|
@ -555,10 +553,10 @@
|
|||
</view>
|
||||
<view v-if="showGhost" :style="{ height: `${ghostBox.height}px`, transition: `${ghostBox.duration}s` }">
|
||||
</view>
|
||||
<view class="ghost" :style="{ height: toolHeight + 'px' }"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<view class="ghost" :style="{ height: toolHeight + 'px' }"></view>
|
||||
|
||||
<view class="tool bfff" id="tool">
|
||||
<view class="tool-group">
|
||||
|
@ -585,7 +583,8 @@
|
|||
<view class="send" @click="handleSend">发送</view>
|
||||
</template>
|
||||
</view>
|
||||
<view v-if="showGhost" :style="{ height: `${ghostBox.height}px`, transition: `${ghostBox.duration}s` }"></view>
|
||||
<view v-if="showGhost" :style="{ height: `${ghostBox.height}px`, transition: `${ghostBox.duration}s` }">
|
||||
</view>
|
||||
<!-- 表情 -->
|
||||
<template v-if="toolStatus == 'emoji'">
|
||||
<emoji @setEmoj="emojiTap"></emoji>
|
||||
|
@ -595,6 +594,7 @@
|
|||
<JyPlus @send="handlePlusSend" :msg="msg"></JyPlus>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 视频 -->
|
||||
<video :src="videoUrl" id="video" @fullscreenchange="onScreenChange" />
|
||||
|
@ -639,6 +639,15 @@
|
|||
<style lang="scss" scoped>
|
||||
@import './index.scss';
|
||||
|
||||
// 聊天
|
||||
.chatPage {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
height: 100vh;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
//
|
||||
#video {
|
||||
position: fixed;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
.scroll-view {
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
|
|
|
@ -177,7 +177,7 @@
|
|||
<noLogin class="f1" />
|
||||
|
||||
<!-- 底部导航 -->
|
||||
<footerMenu ref="footerMneuRef" page="news" />
|
||||
<footerMenu page="news" />
|
||||
</template>
|
||||
|
||||
<!-- 未实名 -->
|
||||
|
@ -185,7 +185,7 @@
|
|||
<noAuth class="f1" />
|
||||
|
||||
<!-- 底部导航 -->
|
||||
<footerMenu ref="footerMneuRef" page="news" />
|
||||
<footerMenu page="news" />
|
||||
</template>
|
||||
|
||||
<template class="page" v-else>
|
||||
|
@ -246,7 +246,7 @@
|
|||
</swiper>
|
||||
|
||||
<!-- 底部导航 -->
|
||||
<footerMenu ref="footerMneuRef" page="news" />
|
||||
<footerMenu page="news" />
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
|
|
@ -249,6 +249,8 @@
|
|||
data.sliderImage = data.sliderImage.join(',')
|
||||
// 商品详情
|
||||
if (data.infoRichText) data.infoRichText = btoa(unescape(encodeURIComponent(data.infoRichText)))
|
||||
// 判断如果是礼包商品
|
||||
if (cateCurrent.value.categoryCode.startsWith('GIFT_PACK')) data.categoryCode = 'GIFT_PACK'
|
||||
|
||||
//
|
||||
api.shop.saveProduct({
|
||||
|
|
|
@ -101,9 +101,19 @@
|
|||
</swiper-item>
|
||||
</swiper> -->
|
||||
|
||||
<view class="gift mt30 bfff">
|
||||
<view class="item fdc fmid" :class="{'big': item.categoryCode == 'GIFT_PACK'}"
|
||||
v-for="(item,index) in tab" :key="index">
|
||||
<view class="icon">
|
||||
<image class="image" :src="item.image" mode="widthFix" />
|
||||
</view>
|
||||
<view class="mt10 c333 f28">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 礼包专区 -->
|
||||
<view class="tab bfff">
|
||||
<view class="item ver ptb20" v-for="(item,index) in tab" :key="index" @click="handleTab(index)"
|
||||
<view class="tab pt20 bfff">
|
||||
<view class="item ver ptb30" v-for="(item,index) in tab" :key="index" @click="handleTab(index)"
|
||||
:class="{'active': index === tabIndex}">
|
||||
<view class="">
|
||||
<image class="icon" :src="item.icon" mode="aspectFill" />
|
||||
|
@ -140,7 +150,7 @@
|
|||
.item {
|
||||
.icon {
|
||||
width: 160rpx;
|
||||
height: 40rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
.line {
|
||||
|
@ -158,4 +168,34 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 礼包专区
|
||||
.gift {
|
||||
display: flex;
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.item.big {
|
||||
width: 400rpx;
|
||||
|
||||
.icon {
|
||||
width: 240rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -135,7 +135,7 @@
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<view class="appbw">
|
||||
<view class="app">
|
||||
<!-- 轮播图 -->
|
||||
<!-- <swiper class="banner oh" autoplay="true">
|
||||
<swiper-item v-for="(item, index) in 3" :key="index">
|
||||
|
@ -147,13 +147,17 @@
|
|||
</swiper-item>
|
||||
</swiper> -->
|
||||
|
||||
<view class="gift mtb30">
|
||||
<view class="item fdc fmid" v-for="(item,index) in giftCateList" :key="index" @click="handleGiftCate(item)">
|
||||
<image class="icon" :src="item.image" mode="aspectFill" />
|
||||
<view class="gift mt30 bfff">
|
||||
<view class="item fdc fmid" :class="{'big': item.categoryCode == 'GIFT_PACK'}"
|
||||
v-for="(item,index) in giftCateList" :key="index" @click="handleGiftCate(item)">
|
||||
<view class="icon">
|
||||
<image class="image" :src="item.image" mode="widthFix" />
|
||||
</view>
|
||||
<view class="mt10 c333 f28">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="oh bfff">
|
||||
<!-- 功能区 -->
|
||||
<view class="fn rows mtb30 mlr30">
|
||||
<!-- <uni-icons type="scan" class="mr20" size="48rpx" color="#FF7F37" /> -->
|
||||
|
@ -173,6 +177,7 @@
|
|||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品卡片组 加载更多 -->
|
||||
<view class="product oh ptb30 plr30">
|
||||
|
@ -201,12 +206,31 @@
|
|||
|
||||
// 礼包专区
|
||||
.gift {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
display: flex;
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.item.big {
|
||||
width: 400rpx;
|
||||
|
||||
.icon {
|
||||
width: 120rpx;
|
||||
height: 90rpx;
|
||||
width: 240rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-end;
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ export default createStore({
|
|||
"updateContent": "",
|
||||
"isForce": 0
|
||||
},
|
||||
// 未读消息条数
|
||||
unreadCount: 0,
|
||||
},
|
||||
|
||||
mutations: {
|
||||
|
@ -62,6 +64,10 @@ export default createStore({
|
|||
setTabbarMode(state, mode) {
|
||||
state.tabbarMode = mode
|
||||
},
|
||||
// 设置未读消息
|
||||
setUnreadCount(state, result) {
|
||||
state.unreadCount = +result > 99 ? '99+' : result
|
||||
},
|
||||
},
|
||||
|
||||
getters: {
|
||||
|
|
|
@ -5,7 +5,7 @@ import uni from '@dcloudio/vite-plugin-uni';
|
|||
|
||||
let target = 'http://91f.xyz:8080'
|
||||
// let target = 'http://liuyd.cpolar.top'
|
||||
// let target = 'http://7vs3pa.natappfree.cc'
|
||||
// let target = 'http://z7jchv.natappfree.cc'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
|
|
Loading…
Reference in New Issue