APP热更新

This commit is contained in:
cansnow
2026-01-11 13:51:16 +08:00
parent 941464c330
commit c38846f13b
16 changed files with 995 additions and 197 deletions
@@ -119,8 +119,8 @@
},
},
mounted() {
console.log(this.storeCurrentGroup)
console.log(this.storeCurrentMemberInGroup)
//console.log(this.storeCurrentGroup)
//console.log(this.storeCurrentMemberInGroup)
this.setKeyboardListener();
},
beforeDestroy() {
@@ -117,14 +117,14 @@
methods: {
async init(){
const self = this;
//console.log(this.message?.videoElem);
console.log(this.message?.videoElem,this.conversationID);
const snapshotUrl = this.message?.videoElem?.snapshotUrl;
self.coverDownloading = true;
//console.log(snapshotUrl);
util.cacheFile(snapshotUrl,`${this.conversationID}`).then((fn)=>{
self.coverDownloading = false;
self.src = fn;
console.log(fn);
//console.log(fn);
});
},
clickMediaItem() {
@@ -138,20 +138,22 @@
this.loadingWidth = "auto";
},
onOverlayClick() {
const _this = this;
// 点击覆盖层:如果视频已缓存则直接播放,否则开始下载
const url = this.message?.videoElem?.videoUrl || this.message?.videoElem?.videoPath;
const url = _this.message?.videoElem?.videoUrl;
if (!url) {
uni.showToast({ title: '无可下载的视频' });
return;
}
this.videoDownloading = true;
this.videoDownloadProgress = 0;
util.downloadFile(url, `${this.conversationID}`, (prog) => {
//this.videoDownloadProgress = prog;
_this.videoDownloading = true;
_this.videoDownloadProgress = 0;
util.cacheFile(url, `${_this.conversationID}`, (prog) => {
//console.log(prog);
this.videoDownloadProgress = prog;
}).then((fn) => {
this.videoDownloading = false;
this.videoExists = true;
this.playVideo(fn);
_this.videoDownloading = false;
_this.videoExists = true;
_this.playVideo(fn);
});
},
+2 -1
View File
@@ -27,6 +27,7 @@
import SelectFooter from "./components/SelectFooter";
import {markConversationAsRead} from "@/util/imCommon";
import IMSDK, {MessageType,GroupMemberRole} from "openim-uniapp-polyfill";
import util from "@/util/index.js"
export default {
components: {
ChatingHeader,
@@ -110,7 +111,7 @@
return item.serverMsgID != data.serverMsgID;
})
this.$store.commit('message/SET_HISTORY_MESSAGE_LIST',list);
})
});
},
onUnload() {
IMSDK.unsubscribe(IMSDK.IMEvents.OnMsgDeleted);
+21 -20
View File
@@ -4,12 +4,13 @@
<scroll-view class="scroll-view"
scroll-y="true"
refresher-enabled="true"
:refresher-triggered="triggered"
:refresher-triggered="refreshing"
:scroll-top="scrollTop"
:scroll-with-animation="true"
@scroll="scroll"
@refresherrefresh="onRefresh"
@refresherrestore="onRestore"
@refresherabort="onRestore"
@scrolltolower="scrolltolower">
<uni-swipe-action ref="swipe_action">
<uni-swipe-action-item
@@ -66,7 +67,6 @@
}
}
],
triggered: false,
refreshing: false,
};
},
@@ -80,17 +80,18 @@
},
onLoad() {
//console.log(this.storeConversationList);
this._freshing = false;
this.triggered = true;
setTimeout(()=>{
// uni.switchTab({
// url:"/pages/user/index/index"
// })
// uni.navigateTo({
// url:"/pages/user/vip/vip"
// });
prepareConversationState(this.storeConversationList[0]);
},1000)
this.freshing = false;
if(process.env.NODE_ENV == 'development'){
// setTimeout(()=>{
// // uni.switchTab({
// // url:"/pages/user/index/index"
// // })
// // uni.navigateTo({
// // url:"/pages/user/vip/vip"
// // });
// //prepareConversationState(this.storeConversationList[1]);
// },1000)
}
},
methods: {
test(){
@@ -177,23 +178,23 @@
this.old.scrollTop = e.detail.scrollTop;
},
onRefresh() {
if (this._freshing) return;
this._freshing = true;
if (this.refreshing) return;
console.log('onRefresh');
this.refreshing = true;
this.queryList(true);
},
onRestore() {
this.triggered = "restore";
this.refreshing = false;
console.log("onRestore");
},
scrolltolower() {
this.queryList();
},
async queryList(isFirstPage = false) {
//console.log(1);
console.log(1);
await this.$store.dispatch("conversation/getConversationList",isFirstPage);
//console.log(2);
this.triggered = false;
this._freshing = false;
console.log(2);
this.refreshing = false;
},
closeAllSwipe() {
this.$refs.swipeWrapperRef.closeAll();
@@ -63,7 +63,7 @@
<view class="relavivetime" :id="`comment-${'null'}-${index}`">
<view class="time">
<view>{{ item.created_at }}</view>
<view @click="deleteCircle(item,index)" style="color:#36648b;margin-left: 20rpx;" v-if="item.user_id==selfInfo.userID">删除</view>
<view @click="deleteCircle(item,index)" style="color:#36648b;margin-left: 20rpx;" v-if="item.user_id==storeSelfInfo.userID">删除</view>
</view>
<view class="icon-box u-flex u-row-between u-col-center">
@@ -80,22 +80,29 @@
<!-- 点赞人 评论 -->
<view class="msg-box">
<view class="thumbinfo u-border-bottom" v-if="item.likes!=null&&item.likes.length">
<uni-icons size="30" type="heart" color="#36648b" class="u-m-r-10"></uni-icons>
<text class="thumbinfo-name" v-for="(userInfo, pindex) in item.likes" :index="pindex"
:key="pindex" @tap="linkToBusinessCard(userInfo.userId)">
{{ userInfo.nickame }}{{ pindex != item.likes.length - 1 ? '' : '' }}
<uni-icons size="24" type="heart" color="#36648b" class="u-m-r-10"></uni-icons>
<text class="thumbinfo-name" v-for="(ui, pindex) in item.likes" :index="pindex"
:key="pindex" @tap="linkToBusinessCard(ui.user_id)">
{{ ui.nickname }}{{ pindex != item.likes.length - 1 ? '' : '' }}
</text>
</view>
<view class="comment" v-if="item.comments!=null&&item.comments.length">
<view class="comment-box" v-for="(comment, commentIndex) in item.comments" :index="comment.id"
:key="comment.id" hover-class="comment-hover-class"
<view
class="comment-box"
v-for="(comment, commentIndex) in item.comments"
:index="comment.id"
:key="comment.id"
hover-class="comment-hover-class"
:id="`comment-${item.id}-${comment.id}`"
@tap="handleComment(comment, index)">
<text class="comment-box-name">
{{ comment.user.nickname }}
<text class="callback u-m-l-4 u-m-r-4">回复</text>
</text>
<text v-if="comment.reply_user_id" class="comment-box-name">{{ comment.user.nickname }}</text>
<text class="callback u-m-l-4 u-m-r-4" v-if="comment.reply_user_id">回复</text>
<text v-if="comment.reply_user_id" class="comment-box-name">
{{ comment.user.nickname }}
</text>
<text></text>
<text class="comment-box-content">{{ comment.body }}</text>
</view>
</view>
@@ -106,10 +113,10 @@
<script>
import MyAvatar from "@/components/MyAvatar/index.vue";
import videoPlayer from '@/components/videoPlayer.vue';
import util from "@/util/index.js";
import { mapGetters } from "vuex";
export default{
components:{videoPlayer ,MyAvatar},
components:{MyAvatar},
props:{
index:{
type:Number,
@@ -123,12 +130,10 @@
}
},
computed:{
selfInfo() {
return this.$store.getters.storeSelfInfo;
},
...mapGetters(["storeSelfInfo"]),
},
data(){
//console.log(this.item);
console.log(this.item);
return {
girdItemCustomStyle:{
padding: '0',
@@ -138,6 +143,9 @@
}
},
methods:{
log(v){
console.log(v)
},
clickThumb(item,index){
this.$emit('userEvent',{type:'clickThumb',item,index});
},
+73 -103
View File
@@ -2,53 +2,49 @@
<view class="content" id="content">
<u-navbar
@leftClick="leftClick"
bgColor="transparent"
:bgColor="scrollTop>bannarHeight?'#f4f4f4':'transparent'"
title="朋友圈"
title-size="36"
leftIconColor="#fff"
:titleStyle ="{color:'#fff'}"
:leftIconColor="scrollTop>bannarHeight?'#333':'#fff'"
:titleStyle ="{color:scrollTop>bannarHeight?'#333':'#fff'}"
:title-bold="true"
:border-bottom="false">
<view slot="right" class="u-margin-right-20" @click="showTypeSheet"
@longpress="linkToRelease({releaseType:0})">
<u-icon name="camera" color="#fff" size="32"></u-icon>
<u-icon name="camera" :color="scrollTop>bannarHeight?'#333':'#fff'" size="32"></u-icon>
</view>
</u-navbar>
<scroll-view :scroll-x="false" :scroll-y="true" class="scrollView"
:scroll-with-animation="scrollWithAnimation" :scroll-top="scrollTop" @scroll="scrolling"
@scrolltolower="loadMore"
:style="'height:'+scrollViewHeight+'px'">
<!-- 我的朋友圈基本信息 -->
<view class="content-imgbox">
<image class="bgimg" v-if="settings.bg" :src="settings.bg" mode="scaleToFill" @tap="showSheet"></image>
<view class="bgimg" v-else @tap="showSheet"></view>
<MyAvatar class="headimg" :src="selfInfo.faceURL" :desc="selfInfo.nickname || selfInfo.remark"
:isGroup="Boolean(selfInfo.groupID)" size="66" @tap="linkToBusinessCard(selfInfo.userID)" />
<text class="nickname">{{ selfInfo.nickname || selfInfo.remark }}</text>
</view>
<!-- 个性签名 -->
<view class="signature">
<view class="">{{ selfInfo.bio }}</view>
</view>
<!-- 我的朋友圈基本信息 -->
<view class="content-imgbox" :class="{top:scrollTop>bannarHeight}">
<image class="bgimg" v-if="storeCircleSettings.bg" :src="storeCircleSettings.bg" mode="scaleToFill" @tap="showSheet"></image>
<view class="bgimg" v-else @tap="showSheet"></view>
<view v-if="unreadCount>0" style="display: flex;justify-content: center;">
<view @click="clearUnReadCount()"
style="width: 300rpx;height:70rpx;line-height:70rpx;background-color: #333333;color: #ffffff;border-radius:10rpx;display: flex;align-items: center;">
<view style="width:80rpx;padding:0 10rpx;">
<MyAvatar :src="selfInfo.faceURL" class="headimg" desc=" " size="24"/>
</view>
<view style="flex:1;">
{{unreadCount}}条新信息
</view>
<MyAvatar class="headimg" :src="storeSelfInfo.faceURL" :desc="storeSelfInfo.nickname || storeSelfInfo.remark"
:isGroup="Boolean(storeSelfInfo.groupID)" size="66" @tap="linkToBusinessCard(storeSelfInfo.userID)" />
<text class="nickname">{{ storeSelfInfo.nickname || storeSelfInfo.remark }}</text>
</view>
<!-- 个性签名 -->
<view class="signature">
<view class="">{{ storeSelfInfo.bio }}</view>
</view>
<view v-if="storeCircleUnreadCount>0" style="display: flex;justify-content: center;">
<view @click="clearUnReadCount()"
style="width: 300rpx;height:70rpx;line-height:70rpx;background-color: #333333;color: #ffffff;border-radius:10rpx;display: flex;align-items: center;">
<view style="width:80rpx;padding:0 10rpx;">
<MyAvatar :src="storeSelfInfo.faceURL" class="headimg" desc=" " size="24"/>
</view>
<view style="flex:1;">
{{storeCircleUnreadCount}}条新信息
</view>
</view>
<!-- 朋友圈列表 -->
<view class="content-circle">
<!-- circleData是vuex变量不在本页面定义 -->
<template v-if="circleData!=null&&circleData.length>0">
<template v-for="(item, index) in circleData" >
</view>
<!-- 朋友圈列表 -->
<view class="content-circle">
<!-- storeCircleData是vuex变量不在本页面定义 -->
<template v-if="storeCircleData!=null&&storeCircleData.length>0">
<template v-for="(item, index) in storeCircleData" >
<CircleItem :key="index" :index="index" :item="item" @userEvent="onUserEvent"></CircleItem>
</template>
</template>
@@ -58,7 +54,7 @@
</view>
</template>
</view>
</scroll-view>
<u-overlay :show="showInput" @click="showInput = false">
<view class="input-box" style="height: 100rpx;" @tap.stop>
<view class="input-box-flex">
@@ -95,41 +91,19 @@
import MyAvatar from "@/components/MyAvatar/index.vue";
import util from "@/util/index.js";
import CircleItem from "./components/circleItem.vue"
import { mapGetters } from "vuex";
export default {
name: 'firendCircle',
mixins:[UserBase],
components:{videoPlayer ,MyAvatar,CircleItem},
computed: {
selfInfo() {
return this.$store.getters.storeSelfInfo;
},
circleData() {
return this.$store.getters.storeCircleData;
},
unreadCount() {
return this.$store.getters.storeCircleUnreadCount;
},
last_unread_item() {
return this.$store.getters.storeCircleLastUnreadItem;
},
settings() {
return this.$store.getters.storeCircleSettings;
},
computed:{
...mapGetters(["storeSelfInfo",'storeCircleData','storeCircleUnreadCount','storeCircleTopUnreadItems','storeCircleSettings']),
},
data() {
return {
loadMoreFlag:true,//可以分页加载吗
platFrom:'',
girdItemCustomStyle:{
padding: '0',
margin:'0',
border:'1rpx solid #f2f6fc'
},
scrollViewHeight: 0,
bannarHeight:202,
scrollTop: 0,
currentTop: 0,
currentScroll: 0,
scrollWithAnimation: false,
content: '',
placeholder: '',
showInput: false,
@@ -139,7 +113,6 @@
currentItem: {},
previewVideoFlag:false,
previewVideoSrc:'',
videoContext:null,
page:1,
limit:5,
//删除对象参数
@@ -152,37 +125,33 @@
},
//vuex变量
watch:{
circleData:function(val){
storeCircleData:function(val){
console.log("监听到朋友圈内容有变动",val.length);
}
},
onReady() {
console.log(this.selfInfo);
console.log(this.storeSelfInfo);
let that = this;
uni.onKeyboardHeightChange(res => {
if (res.height == 0) {
let windowHeight = this.$u.sys().windowHeight;
this.scrollViewHeight = windowHeight - 90;
//this.scrollViewHeight = windowHeight - 90;
this.showInput = false;
this.currentTop = 0;
return;
} else {
this.currentTop = 999;
let windowHeight = this.$u.sys().windowHeight;
this.scrollViewHeight = (windowHeight - res.height) - 120;
//this.scrollViewHeight = (windowHeight - res.height) - 120;
}
});
},
onShow: function(option) {
let windowHeight = this.$u.sys().windowHeight;
this.scrollViewHeight = windowHeight - 90;
console.log("onshow",this.page);
//let windowHeight = this.$u.sys().windowHeight;
//this.scrollViewHeight = windowHeight - 90;
//console.log("onshow",this.page);
},
onLoad:function(){
let that=this;
this.platFrom= this.$u.os();
console.log("onload",this.platFrom);
let param={
page:1,
limit:this.limit,
@@ -192,11 +161,11 @@
this.getCircleDataList(param);
uni.$on("handleFriendCircle", function(friendCircleMessage) {
console.log("监听到朋友圈动态有更新",friendCircleMessage);
let id= friendCircleMessage.content.id;
let newPraise= friendCircleMessage.content.likes;
const index = that.circleData.findIndex(i => i.id ==id);
that.circleData[index].likes=JSON.parse(newPraise);
if(friendCircleMessage.content.is_liked&&friendCircleMessage.userId!=that.selfInfo.userID){
//let id= friendCircleMessage.content.id;
//let newPraise= friendCircleMessage.content.likes;
//const index = that.storeCircleData.findIndex(i => i.id ==id);
//that.storeCircleData[index].likes=JSON.parse(newPraise);
if(friendCircleMessage.content.is_liked&&friendCircleMessage.userId!=that.storeSelfInfo.userID){
that.$store.dispatch('circle/updateUnreadCount',1);
}
})
@@ -229,16 +198,16 @@
},
//滚动事件
scrolling: function(event) {
scrolling: function(scrollTop) {
//console.log("event",event);
let that = this;
if (that.showInput == true) {
return;
}
let scrollTop = event.detail.scrollTop;
setTimeout(function() {
that.currentScroll = scrollTop;
}, 300);
//let scrollTop = event.detail.scrollTop;
// setTimeout(function() {
// that.currentScroll = scrollTop;
// }, 300);
},
//加载更多
loadMore:function(){
@@ -295,28 +264,20 @@
clickThumb(item,index) {
let that=this;
let flag=true;
item.is_liked = !item.is_liked;
if (item.is_liked) {
item.likes.push({
userId: this.selfInfo.userID,
userName: this.selfInfo.nickname
});
} else {
const index = item.likes.findIndex(i => i.userId == this.selfInfo.userID);
item.likes.splice(index, 1);
flag=false;
}
console.log("当前动态下标",index);
console.log("点赞列表",item);
let param={
id:item.id,
likes:JSON.stringify(item.likes),
user_id: this.storeSelfInfo.userID,
nickname: this.storeSelfInfo.nickname,
avatar: this.storeSelfInfo.avatar,
is_liked:flag
};
this.$store.dispatch('circle/like',param).then(res=>{
console.log("点赞更新成功",res.data);
item.likes=JSON.parse(res.data.likes);
that.circleData[index]=item;
}).catch(e=>{
item.is_liked = !item.is_liked;
console.log("评论失败",e);
@@ -324,7 +285,7 @@
},
//跳转到名片
linkToBusinessCard(userId) {
if(userId==this.selfInfo.userID){
if(userId==this.storeSelfInfo.userID){
return;
}
this.goto('/pages/common/userCard?sourceID='+userId);
@@ -348,9 +309,9 @@
that.delCircleObj.delCircleModelFlag=false;
that.delCircleObj.tempDelCircleId="";
that.delCircleObj.tempDelIndex="";
let tempData=that.circleData;
let tempData=that.storeCircleData;
tempData.splice(delIndex,1);
this.$u.vuex('circleData', tempData);
this.$store.commit('circle/SET_LIST',tempData);
}
});
},
@@ -365,14 +326,13 @@
handleComment(comment, index) {
let that = this;
this.content = '';
that.currentItem = that.circleData[index];
that.currentTop = 0;
that.currentItem = that.storeCircleData[index];
this.id = that.currentItem.id;
this.commentInfo = comment || {};
this.placeholder = '评论:';
if (comment) {
//console.log("评论内容",comment);
if (comment.comment.user_id == this.selfInfo.userID) {
if (comment.comment.user_id == this.storeSelfInfo.userID) {
//如果是回复自己
this.placeholder = `评论:`;
} else {
@@ -420,7 +380,6 @@
//关闭键盘 关闭输入框
closeInputModel() {
this.showInput = false;
this.currentTop = 0;
this.content = '';
this.id = '';
this.commentInfo = {};
@@ -507,6 +466,14 @@
},
cdn:util.cdn
},
onReachBottom() {
this.loadMore();
},
onPageScroll({scrollTop}) {
this.scrollTop = scrollTop;
//console.log(scrollTop)
//this.scrolling(scrollTop);
}
};
</script>
@@ -533,6 +500,9 @@
}
&-imgbox {
position: relative;
&.top{
background: #f4f4f4;
}
.bgimg {
width: 100%;
+16 -10
View File
@@ -11,9 +11,11 @@
:thumbSize="thumbSize"
showArrow
to="/pages/find/friend-circle/friend-circle">
<view slot="footer" v-if="last_unread_item&&last_unread_item.avatar.length>0">
<u-avatar :src="last_unread_item.avatar" mode="square" :size="70"></u-avatar>
<u-badge :is-dot="true" type="error" :offset="[20,60]"></u-badge>
<view slot="footer" v-if="storeCircleTopUnreadItems.length>0">
<view class="avatargroup">
<MyAvatar :src="item.user.avatar" shape="circle" size="32" v-for="(item,index) in storeCircleTopUnreadItems" :key="index"></MyAvatar>
<u-avatar :text="'+'+storeCircleUnreadCount" size="32" bg-color="#353432" shape="circle"></u-avatar>
</view>
</view>
</uni-list-item>
</uni-list>
@@ -31,21 +33,17 @@
<script>
import { mapGetters } from "vuex";
import MyAvatar from "@/components/MyAvatar/index.vue";
import util from "@/util";
export default {
components:{MyAvatar},
data() {
return {
thumbSize:"base"
};
},
computed:{
...mapGetters(["config"]),
circleUnreadCount() {
return this.$store.getters.storeCircleUnreadCount;
},
last_unread_item() {
return this.$store.getters.storeCircleLastUnreadItem;
},
...mapGetters(["config",'storeCircleUnreadCount','storeCircleTopUnreadItems']),
},
onShow: function() {
let unreadCount= 1;
@@ -61,4 +59,12 @@
.workbench_page {
background-color: #ececec !important;
}
.avatargroup{
display: flex;
.u-avatar {
position: relative;
margin-left: -16px;
//border: 1px solid #333;
}
}
</style>
+2 -13
View File
@@ -29,9 +29,9 @@
import CustomNavBar from "@/components/CustomNavBar/index.vue";
import {PageEvents } from "@/constant";
import InfoItem from "../selfInfo/InfoItem.vue";
import {checkUpgrade} from "@/api/login.js"
import { mapGetters } from "vuex";
import util from "@/util/index.js"
import checkUpgrade from "@/util/app_update.js"
export default {
components: {
CustomNavBar,
@@ -111,18 +111,7 @@
},
// 验证是否升级
checkUpdate() {
this.loading = true;
const _this = this;
checkUpgrade().then(res=>{
_this.loading = false;
}).catch(e=>{
console.log(e);
if(e === true){
uni.showToast({title:'已经是最新版本'})
return ;
}
_this.loading = false;
});
checkUpgrade(true);
},
},
};