工作代码提交

This commit is contained in:
sx 2025-04-16 09:24:09 +08:00
parent 17b259fd3a
commit a10e8353e9
17 changed files with 222 additions and 134 deletions

View File

@ -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 => {

View File

@ -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是否准备完毕

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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" : {

View File

@ -798,7 +798,8 @@
"path" : "pages/shop/gift",
"style" :
{
"navigationBarTitleText" : "礼包专区"
"navigationBarTitleText" : "礼包专区",
"navigationBarBackgroundColor": "#fff"
}
}
],

View File

@ -837,7 +837,7 @@
</view>
<!-- 底部导航 -->
<footerMenu ref="footerMenuRef" page="index" subject="dark" />
<footerMenu page="index" subject="dark" />
</view>
<!-- app版本更新弹窗 -->

View File

@ -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;

View File

@ -1,5 +1,6 @@
.scroll-view {
overflow: hidden;
box-sizing: border-box;
flex: 1;
height: 100%;

View File

@ -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>

View File

@ -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({

View File

@ -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>

View File

@ -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;
}
}

View File

@ -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: {

View File

@ -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()],