zouyanyan 2 weeks ago
parent c874217268
commit 4d7596dd18

@ -161,9 +161,9 @@
this.init(this.userId);
}else {
// 跳转到登录页
uni.navigateTo({
url: "/pages/login/login"
})
// uni.navigateTo({
// url: "/pages/login/login"
// })
}
// 未读消息总数(用于角标)

@ -0,0 +1,117 @@
<template>
<uni-popup ref="privacyDialog" type="dialog">
<uni-popup-dialog :before-close="true" type="info" mode="base" cancelText="暂不同意并退出APP" confirmText="同意并接受" title="隐私政策"
@confirm="agreeEnter"
@close="exitapply">
<view class="privacy_con">
<!-- <view class="title">隐私政策</view> -->
<view class="content_privacy">
<text>欢迎使用瑜伽汇APP!本应用尊重并保护所有用户的个人隐私权。为了给您提供更准确、更有个性化的服务,本应用会按照隐私政策的规定使用和披露您的个人信息。可阅读</text>
<navigator url="/pages/user/infofw" class="navigator">《用户服务协议》</navigator>
<text>和</text>
<navigator url="/pages/user/infoys" class="navigator">《隐私政策条款》</navigator>
<text>了解详细信息。如果您同意,请点击下面按钮开始接受我们的服务。</text>
</view>
<!-- <view class="btn">
<button class="no_btn" @click="exitapply">暂不同意并退出APP</button>
<button class="yes_btn" @click="agreeEnter">同意并接受</button>
</view> -->
</view>
</uni-popup-dialog>
</uni-popup>
</template>
<script>
export default {
data() {
return {
};
},
methods: {
open(){
this.$refs.privacyDialog.open();
},
close(){
this.$refs.privacyDialog.close();
},
// 退出应用
exitapply(){
if (plus.os.name.toLowerCase() === 'android') {
plus.runtime.quit(); // 安卓退出应用
console.log('安卓');
} else {
console.log('ios');
plus.ios.import('UIApplication').sharedApplication().performSelector('exit'); // iOS退出应用
}
},
// 同意并进入应用
agreeEnter(){
uni.setStorageSync("firstLaunchFlag", true)
plus.runtime.agreePrivacy()
this.close();
}
},
};
</script>
<style lang="scss" scoped>
.privacy_con{
width: 630rpx;
background: linear-gradient(to bottom, #f5f5f5, #f5f5f5);
border-radius: 32rpx;
.title{
width: 630rpx;
height: 100rpx;
color: #422206;
font-size: 34rpx;
font-weight: 600;
line-height: 100rpx;
text-align: center;
}
.content_privacy{
width: 100%;
padding: 0 32rpx;
color: #232323;
font-size: 28rpx;
margin-top: 30rpx;
margin-bottom: 20rpx;
line-height: 42rpx;
.navigator {
color: #00a89b;
font-weight: 500;
display: inline-block;
}
}
.btn{
height: 100rpx;
display: flex;
align-items: center;
justify-content: space-evenly;
button{
width: 262rpx;
height: 88rpx;
border-radius: 78rpx 78rpx 78rpx 78rpx;
font-weight: bold;
font-size: 28rpx;
line-height: 88rpx;
text-align: center;
}
.no_btn{
background: #FAFAF9;
color: #898B96;
}
.yes_btn{
background-color: #00a89b;
color: #FFFFFF;
}
}
}
</style>

@ -206,7 +206,7 @@
},
onShow() {
//判断登录,跳转去登录
logindo();
// logindo();
console.log('onShow');
this.openId = myCache('openId');

@ -310,7 +310,7 @@
},
onShow(){
// 判断登录,跳转去登录
logindo();
// logindo();
this.openId = myCache('openId');
var user = myCache('user');
@ -351,7 +351,7 @@
},
mounted() {
if(this.userid==""||this.userid=="0"){
this.$refs.loginId.open();
// this.$refs.loginId.open();
}
},
onPullDownRefresh() {

@ -12,13 +12,15 @@
<!-- 列表 -->
<view class="listcell">
<u-swipe-action
ref="swipeRef"
:options="options"
<uni-swipe-action ref="swipeAction">
<uni-swipe-action-item
v-for="(chat, index) in chats"
:key="chat.id || index"
style="min-width: 600rpx;"
@click="actionClick(chat, index)"
:right-options="options"
:key="chat.targetId"
:show="activeSwipeId === chat.targetId ? 'right' : 'none'"
@change="swipeChange($event, index)"
@click="swipeClick($event, index)"
>
<view class="lcon" @click="gotoChat(chat, index)" @longpress="handleLongPress(index)">
<view class="limg">
@ -39,7 +41,9 @@
</view>
</view>
</view>
</u-swipe-action>
</uni-swipe-action-item>
</uni-swipe-action>
</view>
<!-- 加载状态 -->
@ -62,6 +66,7 @@ export default {
data() {
return {
loadStatus: 'loadmore',
activeSwipeId:-1,
options: [
{
text: '删除',
@ -100,7 +105,7 @@ export default {
},
onShow() {
//判断登录,跳转去登录
logindo();
// logindo();
console.log("this.chats列表.......",this.chats)
this.loadStatus = 'nomore'
this.setBadge(this.unreadCount)
@ -138,24 +143,31 @@ export default {
}
},
// 长按打开滑动菜单
handleLongPress(index) {
this.$refs.swipeRef[index].open()
swipeChange(e, index) {
console.log('返回:', e);
console.log('当前索引:', index);
},
// 滑动菜单点击(删除)
actionClick(chat, index) {
swipeClick(e, index) {
let { content } = e;
if (content.text === '删除') {
const that = this
uni.showModal({
title: '提示',
content: '确定要删除此聊天记录吗?',
success: res => {
if (res.confirm) {
that.$refs.swipeRef[index].close()
that.removeChat(index) // 调用 Vuex action
}
}
})
});
}
},
// 长按打开滑动菜单
handleLongPress(index) {
console.log("handleLongPress",index)
this.activeSwipeId=this.chats[index].targetId;
this.$forceUpdate();
},
// 跳转到聊天页面

@ -0,0 +1,356 @@
<template>
<view class="page">
<!-- 页面头部 -->
<view class="page-header" :style="{ paddingTop: geStatusBarHeight() }">
<view class="text-center">消息</view>
<uni-icons type="staff-filled" size="32" color="#ffffff" @click="gotoContacts"></uni-icons>
</view>
<view class="wrapcon">
<!-- 暂无消息 -->
<view v-if="chats.length === 0 && loadStatus === 'nomore'" class="nodata">暂无消息~</view>
<!-- 列表 -->
<view class="listcell">
<u-swipe-action
ref="swipeRef"
:options="options"
v-for="(chat, index) in chats"
:key="chat.targetId"
:index="index"
style="min-width: 600rpx;"
@click="actionClick"
>
<view class="lcon" @click="gotoChat(chat, index)" @longpress="handleLongPress(index)">
<view class="limg">
<image class="img" :src="chat.headImage || '/static/image/girl.png'" mode="aspectFill"></image>
</view>
<view class="lright">
<view class="lrow">
<view class="pname">{{ chat.showName || '未知' }}</view>
<view class="ptime">{{ changeTime(chat.lastSendTime) }}</view>
</view>
<view class="lrow">
<view class="pnr">
{{ chat.lastContent || '' }}
</view>
<view class="lnum" v-if="chat.unreadCount > 0">
{{ chat.unreadCount }}
</view>
</view>
</view>
</view>
</u-swipe-action>
</view>
<!-- 加载状态 -->
<u-loadmore v-if="chats.length === 0 && loadStatus === 'loading'" :status="loadStatus" :marginTop="20"></u-loadmore>
</view>
<!-- 提示信息弹窗 -->
<uni-popup ref="message" type="message">
<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
</uni-popup>
</view>
</template>
<script>
import { mapState, mapActions, mapGetters } from 'vuex'
import dateTime from '@/common/dateTime.js'
import {myCache,logindo,clearBadgeNumber} from "../../utils/utils";
export default {
data() {
return {
loadStatus: 'loadmore',
options: [
{
text: '删除',
style: {
backgroundColor: '#ed2a28'
}
}
],
messageText: '',
msgType: 'error'
}
},
computed: {
...mapState('chatStore', ['chats']),
...mapGetters('chatStore', ['isLoading']),
// 未读消息总数(用于角标)
unreadCount() {
let count = 0
this.chats.forEach(chat => {
if (!chat.delete) {
count += chat.unreadCount
}
})
return count
},
// 是否正在加载(用于显示loading状态)
loading() {
return this.isLoading()
}
},
watch: {
unreadCount(newVal) {
this.setBadge(newVal)
}
},
onShow() {
//判断登录,跳转去登录
logindo();
console.log("this.chats列表.......",this.chats)
this.loadStatus = 'nomore'
this.setBadge(this.unreadCount)
},
onPullDownRefresh() {
// 下拉刷新仅刷新角标,数据由全局WebSocket维护
this.setBadge(this.unreadCount)
setTimeout(() => {
uni.stopPullDownRefresh()
}, 500)
},
methods: {
...mapActions('chatStore', ['removeChat', 'moveTop','loadFriend']),
// 设置底部角标
setBadge(count) {
myCache("massageCount",count);
if (count > 0) {
uni.setTabBarBadge({
index: 3, // 根据实际tabBar索引调整
text: count + ''
});
// app清除角标的数量
//#ifdef APP-PLUS
plus.runtime.setBadgeNumber(count);
//#endif
} else {
uni.removeTabBarBadge({
index: 3
});
// app清除角标的数量
clearBadgeNumber();
}
},
// 长按打开滑动菜单
handleLongPress(index) {
this.$refs.swipeRef[index].open()
},
// 滑动菜单点击(删除)
actionClick(index) {
const that = this
uni.showModal({
title: '提示',
content: '确定要删除此聊天记录吗?',
success: res => {
if (res.confirm) {
that.removeChat(index) // 调用 Vuex action
that.$refs.swipeRef[index].close()
}
}
})
},
// 跳转到聊天页面
gotoChat(chat, index) {
// 清除该会话的未读(由chat页面处理)
// 构造跳转参数(与原有逻辑兼容)
let info = {}
if (chat.type === 'PRIVATE') {
info = {
chatId: chat.id || `privatechat-${chat.targetId}`,
chatName: chat.showName,
chatAvatar: chat.headImage,
friendId: chat.targetId,
minId: chat.hotMinIdx || 0,
sort: 'privatechat',
from: 'message'
}
} else if (chat.type === 'GROUP') {
info = {
chatId: chat.id || `groupchat-${chat.targetId}`,
groupId: chat.targetId,
chatName: chat.showName,
chatAvatar: chat.headImage,
minId: chat.hotMinIdx || 0,
sort: 'groupchat',
from: 'message'
}
}
const data = encodeURIComponent(JSON.stringify(info))
uni.navigateTo({ url: `/pages/chatbox/chat-box?chatIdx=${index}` });
},
// 跳转到通讯录
gotoContacts() {
uni.navigateTo({
url: '/pages/message/contact'
})
},
// 时间格式化
changeTime(time) {
return dateTime.dateTime(time)
},
// 获取状态栏高度
geStatusBarHeight() {
return uni.getSystemInfoSync().statusBarHeight
}
}
}
</script>
<style lang="scss" scoped>
.page {
padding: 0;
position: relative;
background-image: url('@/static/image/bg.jpg');
background-attachment: fixed;
background-size: cover;
background-position: center center;
min-height: calc(100vh - var(--window-top) - var(--window-bottom));
}
.page-header {
position: fixed;
width: 100%;
height: 150rpx;
/* #ifdef H5 */
height: 100rpx;
/* #endif */
padding: 0 30rpx 16rpx;
z-index: 999;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: flex-end;
color: #fff;
font-size: 36rpx;
background-color: #00a89b;
.text-center {
width: 100%;
display: flex;
flex: 1;
font-weight: 600;
}
.edit {
font-size: 32rpx;
}
}
.wrapcon {
padding: 0;
width: 100%;
position: relative;
margin: 180rpx 0 0 0;
min-height: calc(100vh - 180rpx);
overflow-y: auto;
/* #ifdef H5 */
margin: calc(100rpx + var(--window-top)) 0 0 0;
min-height: calc(100vh - var(--window-top) - var(--window-bottom) - 100rpx);
/* #endif */
}
.listcell {
background: #fff;
margin: 0;
width: 100%;
min-width: 750rpx;
.lcon {
border-bottom: 1rpx solid #eee;
padding-top: 20rpx;
padding-bottom: 20rpx;
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
min-width: 750rpx;
.limg {
width: 100rpx;
height: 100rpx;
margin-right: 20rpx;
margin-left: 20rpx;
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
justify-content: center;
border-radius: 50%;
.img {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
}
.lright {
display: flex;
flex: 1;
flex-direction: column;
}
.lrow {
display: flex;
flex-direction: row;
margin-bottom: 20rpx;
margin-right: 20rpx;
}
.pname {
display: flex;
flex: 1;
line-height: 50rpx;
font-size: 32rpx;
font-weight: 600;
color: #000000;
}
.ptime {
line-height: 50rpx;
font-size: 24rpx;
font-weight: 500;
color: #595959;
}
.pnr {
display: flex;
flex: 1;
font-size: 24rpx;
font-weight: 400;
color: #595959;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 40rpx;
max-height: 40rpx;
}
.lnum {
background-color: #de0000;
padding: 0 10rpx;
min-width: 32rpx;
height: 32rpx;
line-height: 32rpx;
color: #fff;
font-size: 24rpx;
border-radius: 28rpx;
text-align: center;
}
}
}
.nodata {
background-image: url('../../static/image/nomsg.png');
background-repeat: no-repeat;
background-position: center center;
background-size: 100%;
height: 376rpx;
width: 256rpx;
color: #00a89b;
display: flex;
align-items: center;
justify-content: flex-end;
flex-direction: column;
padding-bottom: 40rpx;
margin: 100rpx auto;
}
</style>

@ -333,15 +333,46 @@ export default {
});
if (res.data.success ) {
uni.hideLoading();
uni.showToast({ title: '投诉已提交,我们会尽快处理', icon: 'success' });
setTimeout(() => uni.navigateBack(), 1500);
// uni.showToast({ title: '投诉已提交,我们会尽快处理', icon: 'success' });
// setTimeout(() => uni.navigateBack(), 1500);
uni.showModal({
title: '提示',
content: '投诉已提交,我们会尽快处理!',
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
}
uni.navigateBack();
}
});
} else {
uni.hideLoading();
uni.showToast({ title: res.data.msg || '提交失败', icon: 'none' });
// uni.showToast({ title: res.data.msg || '提交失败', icon: 'none' });
uni.showModal({
title: '提示',
content: res.data.msg|| '提交失败',
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
}
}
});
}
} catch (e) {
uni.hideLoading();
uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' });
// uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' });
uni.showModal({
title: '提示',
content: '网络异常,请稍后重试',
cancelText: '取消',
confirmText: '确定',
success: ress => {
if (ress.confirm) {
}
}
});
console.error('举报提交失败', e);
}
}

@ -80,6 +80,9 @@
<u-toast ref="uToast" />
<!-- 首次进入app 隐私协议弹框 -->
<privacyAgreement ref="privacyPop"></privacyAgreement>
</view>
</template>
@ -90,13 +93,15 @@
import top from "../components/top.vue";
import service from "../components/service.vue";
import selShop from "../components/selShop.vue";
import privacyAgreement from "../../components/privacy-agreement.vue";
export default {
components: {
openlogin,
top,
service,
selShop
selShop,
privacyAgreement
},
data() {
return {
@ -108,8 +113,7 @@
shop: myCache('myshop'),
// banner
swiperList:[
"../../static/image/b1.jpg",
"../../static/image/b2.png"
"../../static/image/b.png"
],// myCache('swiperCache'),
colors:[
"#f9d1c8","#c7d7bd","#c4dfe4","#efdddd","#c4ccdf","#fceaac","#d5e7c1",
@ -200,10 +204,12 @@
};
},
onLoad() {
var shop=myCache('shop');
var banner=shop&&shop.banner?shop.banner:"";
banner=banner.split(',');
if(banner.length>0){
console.log(banner)
if(banner.length>0&&banner[0]!==''){
this.swiperList=banner;
this.$forceUpdate();
}
@ -224,7 +230,7 @@
},
onShow() {
//判断登录,跳转去登录
logindo();
// logindo();
this.shopid = myCache('myshopid')?myCache('myshopid'):null;
this.shop = myCache('myshop')?myCache('myshop'):'';
@ -304,7 +310,7 @@
// 版本更新
checkupdate();
console.log(this.swiperList)
},
onPullDownRefresh() {
console.log('onPullDownRefresh');
@ -316,6 +322,27 @@
//调用子组件方法
this.$refs.topId.topData(e.scrollTop);
},
mounted() {
uni.setStorageSync("firstLaunchFlag", false)
let firstLaunchFlag = uni.getStorageSync("firstLaunchFlag");
// #ifdef APP-PLUS | H5
console.log("firstLaunchFlag", firstLaunchFlag);
if (firstLaunchFlag) {
return
}else{
uni.showLoading({
mask: true
});
this.$refs.privacyPop.open();
}
// #endif
if(firstLaunchFlag){
if(this.userid==""||this.userid=="0"){
this.$refs.loginId.open();
}
}
},
methods: {
getCurrentActivity() {

@ -314,7 +314,7 @@
},
mounted() {
if(this.userid==""||this.userid=="0"){
this.$refs.loginId.open();
// this.$refs.loginId.open();
}
else{
this.getcollect();

@ -266,7 +266,7 @@ import { mapState, mapGetters, mapActions } from 'vuex';
},
mounted() {
if(this.userid==""||this.userid=="0"){
this.$refs.loginId.open();
// this.$refs.loginId.open();
}
else{
this.getcollect();

@ -195,7 +195,7 @@
onShow() {
//判断登录,跳转去登录
logindo();
// logindo();
this.openId = myCache('openId');
var user = myCache('user');

@ -325,7 +325,7 @@
},
onShow() {
//判断登录,跳转去登录
logindo();
// logindo();
this.openId = myCache('openId');

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

@ -228,8 +228,8 @@
<style lang="scss">
.uni-popup-dialog {
width: 300px;
border-radius: 11px;
width: 630rpx;
border-radius: 20rpx;
background-color: #fff;
}
@ -239,11 +239,11 @@
/* #endif */
flex-direction: row;
justify-content: center;
padding-top: 25px;
padding-top: 40rpx;
}
.uni-dialog-title-text {
font-size: 16px;
font-size: 32rpx;
font-weight: 500;
}
@ -254,11 +254,11 @@
flex-direction: row;
justify-content: center;
align-items: center;
padding: 20px;
padding: 40rpx;
}
.uni-dialog-content-text {
font-size: 14px;
font-size: 28rpx;
color: #6C6C6C;
}
@ -281,7 +281,7 @@
flex-direction: row;
justify-content: center;
align-items: center;
height: 45px;
height: 90rpx;
}
.uni-border-left {
@ -292,11 +292,11 @@
.uni-dialog-button-text {
font-size: 16px;
color: #333;
color: #909399;
}
.uni-button-color {
color: #007aff;
color: #00a89b;
}
.uni-dialog-input {
@ -322,6 +322,6 @@
}
.uni-popup__info {
color: #909399;
color: #005737;
}
</style>

Loading…
Cancel
Save