工作代码提交

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' import api from '@/api/index.js'
// vuex // vuex
import store from '@/store/index.js' import store from '@/store/index.js'
//
import TencentCloudChat from '@tencentcloud/chat';
// #ifdef APP // #ifdef APP
// //
import { import {
@ -40,6 +42,9 @@
// #ifdef APP // #ifdef APP
unregisterRequestPermissionTipsListener(null) unregisterRequestPermissionTipsListener(null)
// #endif // #endif
//
removeListenerUnreadCount()
}) })
/** /**
@ -58,7 +63,6 @@
onConfirm: (e) => { onConfirm: (e) => {
console.log(e) console.log(e)
}, },
// onComplete
onComplete: (e) => { onComplete: (e) => {
// //
if (brand.toLowerCase() == "huawei") { if (brand.toLowerCase() == "huawei") {
@ -103,9 +107,29 @@
util.loginTencent(userinfo) 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() { function getConfig() {
api.getConfig().then(rs => { api.getConfig().then(rs => {

View File

@ -1220,11 +1220,31 @@ const util = {
userSig: imSig, userSig: imSig,
}).then(rs => { }).then(rs => {
util.updateMyProfile(userinfo) util.updateMyProfile(userinfo)
// 获取未读消息条数
util.getUnread(userinfo)
console.log('im login success', rs) 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个人资料 // 更新im个人资料
updateMyProfile(userinfo) { updateMyProfile(userinfo) {
// 验证sdk是否准备完毕 // 验证sdk是否准备完毕

View File

@ -112,14 +112,6 @@
url: '/pages/release/video', url: '/pages/release/video',
}) })
} }
// 1
// if(userinfo.value.isShop == 1) {
// result.push({
// name: '',
// img: '/static/footerMenu1.png',
// url: '/pages/release/commodity',
// })
// }
// //
// result.push({ // result.push({
// name: '', // name: '',
@ -134,13 +126,8 @@
// }) // })
return result return result
}) })
// //
const noReadNum = ref(0) const noReadNum = computed(() => uni.$store.state.unreadCount)
const getReadNum = () => {
getNoReadNum()
}
// //
onMounted(() => { onMounted(() => {
@ -152,8 +139,6 @@
uni.getSystemInfo().then(rs => { uni.getSystemInfo().then(rs => {
safeHeight.value = rs.safeArea + 'px' safeHeight.value = rs.safeArea + 'px'
}) })
//
getNoReadNum()
// //
// proxy.$refs.alert.open() // proxy.$refs.alert.open()
@ -189,7 +174,6 @@
else uni.navigateTo({ else uni.navigateTo({
url: `/${item.pagePath}`, url: `/${item.pagePath}`,
}) })
getNoReadNum()
return return
} }
// //
@ -217,29 +201,6 @@
// //
proxy.$refs.alert.close() 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> </script>
<template> <template>

View File

@ -96,7 +96,7 @@
</view> </view>
<view class="btn cancel bar f1" v-if="versionCloud.isForce == 1"> <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>
<view class="btn cancel bar f1" v-else> <view class="btn cancel bar f1" v-else>

View File

@ -242,7 +242,7 @@
<text class="c333 f34">{{detail.name}}</text> <text class="c333 f34">{{detail.name}}</text>
</view> </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> <text class="c666 f28">商品修改历史</text>
<uni-icons type="right" color="#999" size="30rpx" /> <uni-icons type="right" color="#999" size="30rpx" />
</view> </view>

View File

@ -117,7 +117,7 @@
<text class="txt f36">{{item.price}}</text> <text class="txt f36">{{item.price}}</text>
</view> </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 class="f1"></view>
</view> </view>
</view> </view>

View File

@ -2,8 +2,8 @@
"name" : "九亿", "name" : "九亿",
"appid" : "__UNI__08B31BC", "appid" : "__UNI__08B31BC",
"description" : "", "description" : "",
"versionName" : "1.0.18", "versionName" : "1.0.20",
"versionCode" : 1018, "versionCode" : 1020,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {

View File

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

View File

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

View File

@ -120,7 +120,7 @@
addListener() addListener()
// //
getHistory({ getHistory({
callback: scrollToBottom callback: scrollToBottom()
}) })
// #ifdef APP // #ifdef APP
uni.onKeyboardHeightChange((rs) => { uni.onKeyboardHeightChange((rs) => {
@ -133,9 +133,9 @@
}) })
onReady(() => { onReady(() => {
uni.createSelectorQuery().in(proxy).select('#tool').boundingClientRect((rect) => { uni.createSelectorQuery().in(proxy).select('#tool').boundingClientRect((rect) => {
toolHeight.value = rect.height toolHeight.value = rect.height
}).exec(); }).exec();
// //
videoContext.value = uni.createVideoContext('video') videoContext.value = uni.createVideoContext('video')
}) })
@ -351,10 +351,7 @@
// //
list.isCompleted = result.isCompleted list.isCompleted = result.isCompleted
// //
list.messageList = result.messageList.map(item => { list.messageList = result.messageList
console.log('msg item', item)
return item
})
nextTick(() => { nextTick(() => {
param.callback && param.callback() param.callback && param.callback()
@ -375,12 +372,13 @@
// //
function scrollToBottom() { function scrollToBottom() {
uni.createSelectorQuery().in(proxy).select('#scroll-content').boundingClientRect((res) => { uni.createSelectorQuery().in(proxy).select('#scroll-content').boundingClientRect((res) => {
top.value = res.height top.value = res.bottom
console.log('scrollToBottom', res)
uni.pageScrollTo({ // uni.pageScrollTo({
scrollTop: top.value, // scrollTop: top.value,
duration: 0 // duration: 0
}) // })
// console.log('top.value', top.value) // console.log('top.value', top.value)
}).exec(); }).exec();
} }
@ -468,18 +466,18 @@
</script> </script>
<template> <template>
<apex :title="pageTitle"> <view class="chatPage">
<template #right> <apex :title="pageTitle">
<view> <template #right>
<uni-icons type="more-filled" size="40rpx" @click="handleMore" /> <view>
</view> <uni-icons type="more-filled" size="40rpx" @click="handleMore" />
</template> </view>
</apex> </template>
</apex>
<view class="app">
<scroll-view class="scroll-view" scroll-y :scroll-with-animation="true" :scroll-top="top" <scroll-view class="scroll-view" scroll-y :scroll-with-animation="true" :scroll-top="top"
@scroll="onContentScroll" @scrolltoupper="getMoreHistroy"> @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"> <view v-for="(item, index) in list.messageList" :key="index">
<!-- 系统消息 --> <!-- 系统消息 -->
<template v-if="item.from == 'administrator'"></template> <template v-if="item.from == 'administrator'"></template>
@ -555,45 +553,47 @@
</view> </view>
<view v-if="showGhost" :style="{ height: `${ghostBox.height}px`, transition: `${ghostBox.duration}s` }"> <view v-if="showGhost" :style="{ height: `${ghostBox.height}px`, transition: `${ghostBox.duration}s` }">
</view> </view>
<view class="ghost" :style="{ height: toolHeight + 'px' }"></view>
</view> </view>
</scroll-view> </scroll-view>
</view>
<view class="tool bfff" id="tool"> <view class="ghost" :style="{ height: toolHeight + 'px' }"></view>
<view class="tool-group">
<!-- 摁住说话 --> <view class="tool bfff" id="tool">
<!-- 语音 --> <view class="tool-group">
<image src="/static/news-voice.png" mode="widthFix" class="thumb" @click="handleTool('voice')"></image> <!-- 摁住说话 -->
<template v-if="toolStatus == 'voice'"> <!-- 语音 -->
<JyVoice @send="voiceSend" :msg="msg" /> <image src="/static/news-voice.png" mode="widthFix" class="thumb" @click="handleTool('voice')"></image>
</template> <template v-if="toolStatus == 'voice'">
<!-- 输入框 --> <JyVoice @send="voiceSend" :msg="msg" />
<template v-if="toolStatus != 'voice'"> </template>
<uni-easyinput @focus="onFocus" type="text" v-model.trim="content" :clearable="false" class="input" <!-- 输入框 -->
:adjust-position="false" @keyboardheightchange="keyboardheightchange" placeholder="请输入你的问题" <template v-if="toolStatus != 'voice'">
confirmType="发送" :focus="inputFocus" /> <uni-easyinput @focus="onFocus" type="text" v-model.trim="content" :clearable="false" class="input"
</template> :adjust-position="false" @keyboardheightchange="keyboardheightchange" placeholder="请输入你的问题"
confirmType="发送" :focus="inputFocus" />
</template>
<!-- 表情 -->
<image src="/static/news-emoji.png" mode="widthFix" class="thumb" @click="handleTool('emoji')"></image>
<!-- 加号 -->
<template v-if="!content">
<image src="/static/news-plus.png" mode="widthFix" class="thumb" @click="handleTool('plus')" />
</template>
<!-- 文本发送按钮 -->
<template v-else>
<view class="send" @click="handleSend">发送</view>
</template>
</view>
<view v-if="showGhost" :style="{ height: `${ghostBox.height}px`, transition: `${ghostBox.duration}s` }">
</view>
<!-- 表情 --> <!-- 表情 -->
<image src="/static/news-emoji.png" mode="widthFix" class="thumb" @click="handleTool('emoji')"></image> <template v-if="toolStatus == 'emoji'">
<!-- 加号 --> <emoji @setEmoj="emojiTap"></emoji>
<template v-if="!content">
<image src="/static/news-plus.png" mode="widthFix" class="thumb" @click="handleTool('plus')" />
</template> </template>
<!-- 文本发送按钮 --> <!-- 加号 -->
<template v-else> <template v-if="toolStatus == 'plus'">
<view class="send" @click="handleSend">发送</view> <JyPlus @send="handlePlusSend" :msg="msg"></JyPlus>
</template> </template>
</view> </view>
<view v-if="showGhost" :style="{ height: `${ghostBox.height}px`, transition: `${ghostBox.duration}s` }"></view>
<!-- 表情 -->
<template v-if="toolStatus == 'emoji'">
<emoji @setEmoj="emojiTap"></emoji>
</template>
<!-- 加号 -->
<template v-if="toolStatus == 'plus'">
<JyPlus @send="handlePlusSend" :msg="msg"></JyPlus>
</template>
</view> </view>
<!-- 视频 --> <!-- 视频 -->
@ -639,6 +639,15 @@
<style lang="scss" scoped> <style lang="scss" scoped>
@import './index.scss'; @import './index.scss';
//
.chatPage {
display: flex;
flex-direction: column;
overflow: hidden;
height: 100vh;
background-color: #f8f8f8;
}
// //
#video { #video {
position: fixed; position: fixed;

View File

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

View File

@ -177,7 +177,7 @@
<noLogin class="f1" /> <noLogin class="f1" />
<!-- 底部导航 --> <!-- 底部导航 -->
<footerMenu ref="footerMneuRef" page="news" /> <footerMenu page="news" />
</template> </template>
<!-- 未实名 --> <!-- 未实名 -->
@ -185,7 +185,7 @@
<noAuth class="f1" /> <noAuth class="f1" />
<!-- 底部导航 --> <!-- 底部导航 -->
<footerMenu ref="footerMneuRef" page="news" /> <footerMenu page="news" />
</template> </template>
<template class="page" v-else> <template class="page" v-else>
@ -246,7 +246,7 @@
</swiper> </swiper>
<!-- 底部导航 --> <!-- 底部导航 -->
<footerMenu ref="footerMneuRef" page="news" /> <footerMenu page="news" />
</template> </template>
</view> </view>
</template> </template>

View File

@ -249,6 +249,8 @@
data.sliderImage = data.sliderImage.join(',') data.sliderImage = data.sliderImage.join(',')
// //
if (data.infoRichText) data.infoRichText = btoa(unescape(encodeURIComponent(data.infoRichText))) if (data.infoRichText) data.infoRichText = btoa(unescape(encodeURIComponent(data.infoRichText)))
//
if (cateCurrent.value.categoryCode.startsWith('GIFT_PACK')) data.categoryCode = 'GIFT_PACK'
// //
api.shop.saveProduct({ api.shop.saveProduct({

View File

@ -101,9 +101,19 @@
</swiper-item> </swiper-item>
</swiper> --> </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="tab pt20 bfff">
<view class="item ver ptb20" v-for="(item,index) in tab" :key="index" @click="handleTab(index)" <view class="item ver ptb30" v-for="(item,index) in tab" :key="index" @click="handleTab(index)"
:class="{'active': index === tabIndex}"> :class="{'active': index === tabIndex}">
<view class=""> <view class="">
<image class="icon" :src="item.icon" mode="aspectFill" /> <image class="icon" :src="item.icon" mode="aspectFill" />
@ -140,7 +150,7 @@
.item { .item {
.icon { .icon {
width: 160rpx; width: 160rpx;
height: 40rpx; height: 60rpx;
} }
.line { .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> </style>

View File

@ -135,7 +135,7 @@
</script> </script>
<template> <template>
<view class="appbw"> <view class="app">
<!-- 轮播图 --> <!-- 轮播图 -->
<!-- <swiper class="banner oh" autoplay="true"> <!-- <swiper class="banner oh" autoplay="true">
<swiper-item v-for="(item, index) in 3" :key="index"> <swiper-item v-for="(item, index) in 3" :key="index">
@ -147,31 +147,36 @@
</swiper-item> </swiper-item>
</swiper> --> </swiper> -->
<view class="gift mtb30"> <view class="gift mt30 bfff">
<view class="item fdc fmid" v-for="(item,index) in giftCateList" :key="index" @click="handleGiftCate(item)"> <view class="item fdc fmid" :class="{'big': item.categoryCode == 'GIFT_PACK'}"
<image class="icon" :src="item.image" mode="aspectFill" /> 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 class="mt10 c333 f28">{{item.name}}</view>
</view> </view>
</view> </view>
<!-- 功能区 --> <view class="oh bfff">
<view class="fn rows mtb30 mlr30"> <!-- 功能区 -->
<!-- <uni-icons type="scan" class="mr20" size="48rpx" color="#FF7F37" /> --> <view class="fn rows mtb30 mlr30">
<view class="searchBox rows f1 ptb10 plr20 bar"> <!-- <uni-icons type="scan" class="mr20" size="48rpx" color="#FF7F37" /> -->
<input type="text" v-model="keyword" class="f1" placeholder="请输入关键字" @blur="handleSearch" /> <view class="searchBox rows f1 ptb10 plr20 bar">
<uni-icons type="search" size="30rpx" color="#999" /> <input type="text" v-model="keyword" class="f1" placeholder="请输入关键字" @blur="handleSearch" />
</view> <uni-icons type="search" size="30rpx" color="#999" />
</view>
<!-- 滚动条 -->
<view class="cate">
<scroll-view scroll-x="true" class="scroll f30">
<view class="item" v-for="(item,index) in cateList" :key="index"
:class="{'active': index === cateIndex}" @click="handleCateIndex(index)">
<view class="name ptb20 plr40">{{item.name}}</view>
<view class="line"></view>
</view> </view>
</scroll-view> </view>
<!-- 滚动条 -->
<view class="cate">
<scroll-view scroll-x="true" class="scroll f30">
<view class="item" v-for="(item,index) in cateList" :key="index"
:class="{'active': index === cateIndex}" @click="handleCateIndex(index)">
<view class="name ptb20 plr40">{{item.name}}</view>
<view class="line"></view>
</view>
</scroll-view>
</view>
</view> </view>
<!-- 商品卡片组 加载更多 --> <!-- 商品卡片组 加载更多 -->
@ -201,12 +206,31 @@
// //
.gift { .gift {
display: grid; display: flex;
grid-template-columns: repeat(4, 1fr);
.image {
width: 100%;
height: 100%;
}
.item.big {
width: 400rpx;
.icon {
width: 240rpx;
}
}
.item {
flex: 1;
}
.icon { .icon {
width: 120rpx; display: flex;
height: 90rpx; justify-content: center;
align-items: flex-end;
width: 100%;
height: 200rpx;
} }
} }

View File

@ -41,6 +41,8 @@ export default createStore({
"updateContent": "", "updateContent": "",
"isForce": 0 "isForce": 0
}, },
// 未读消息条数
unreadCount: 0,
}, },
mutations: { mutations: {
@ -62,6 +64,10 @@ export default createStore({
setTabbarMode(state, mode) { setTabbarMode(state, mode) {
state.tabbarMode = mode state.tabbarMode = mode
}, },
// 设置未读消息
setUnreadCount(state, result) {
state.unreadCount = +result > 99 ? '99+' : result
},
}, },
getters: { getters: {

View File

@ -5,7 +5,7 @@ import uni from '@dcloudio/vite-plugin-uni';
let target = 'http://91f.xyz:8080' let target = 'http://91f.xyz:8080'
// let target = 'http://liuyd.cpolar.top' // let target = 'http://liuyd.cpolar.top'
// let target = 'http://7vs3pa.natappfree.cc' // let target = 'http://z7jchv.natappfree.cc'
export default defineConfig({ export default defineConfig({
plugins: [uni()], plugins: [uni()],