动态删除等需求,部分bug修复

This commit is contained in:
lanzhihui 2024-11-06 09:40:53 +08:00
parent eb5e1ea0c2
commit 35d128f427
11 changed files with 317 additions and 68 deletions

View File

@ -216,6 +216,7 @@ subPackages: [
'myDynamic',
'logoutDefault',
'ImageCropper',
'myDynamicDetail',
]
},
{

View File

@ -263,11 +263,11 @@
<view class="~font_28 ~white" @tap="copy(item.comment)">复制</view>
<block v-if="item.publish == 1">
<view class="~white" style="margin: -2rpx 20rpx 0 20rpx">|</view>
<view class="~font_28 ~white" @tap="deteleComment(item,index)">删除</view>
<view class="~font_28 ~white" @tap="deleteComment(item,index)">删除</view>
</block>
<block v-else-if="is_owner">
<view class="~white" style="margin: -2rpx 20rpx 0 20rpx">|</view>
<view class="~font_28 ~white" @tap="deteleComment(item,index)">删除</view>
<view class="~font_28 ~white" @tap="deleteComment(item,index)">删除</view>
</block>
</view>
</view>
@ -363,7 +363,8 @@
inputVal: '',
showReplyView: true,
inputBoxH: 86,
modalName: ''
modalName: '',
userInfo: {}
},
mixins: [https, base],
methods: {
@ -503,11 +504,35 @@
},
jumpPath(url) {
wx.navigateTo({url: url})
}
},
// 评论删除
deleteComment(e, index) {
let vm = this
if (vm.throttle) {
vm.throttle = false
vm.$delete({url: `${service.host}/moment/comment/${e.comment_id}/delete`}).then(({code, data}) => {
// const pages = getCurrentPages()
// const prevPage = pages[pages.length - 2] // 上一页// 调用上一个页面的setData 方法,将数据存储
// console.log(prevPage.data, prevPage.data.list, '===')
// prevPage.data.list.splice(index, 1)
vm.$showToast('删除成功')
vm.$emit('deleteComment', index)
// wx.navigateBack({
// delta: 1
// })
wx.hideLoading()
vm.throttle = true
}).catch(() => {
vm.throttle = true
wx.hideLoading()
})
}
}
},
created() {
ready() {
let vm = this
vm.userInfo = wx.getStorageSync('userInfo')
console.log(vm.userInfo, '333')
}
})
</script>

View File

@ -203,7 +203,7 @@ scroll-view {
</style>
<template>
<block v-for="(item,index) in list" :key="index">
<view class="~f-fl ~ui-pl-30 ~ui-pr-30 ~ui-pt-30 ~ui-relative" @tap="jumpPath(`/pages/dynamic/dynamicDetail?id=${item.id}`)">
<view class="~f-fl ~ui-pl-30 ~ui-pr-30 ~ui-pt-30 ~ui-relative" @tap="jumpPath(from == 'myDynamic' ? `/pages/users/myDynamicDetail?id=${item.id}` : `/pages/dynamic/dynamicDetail?id=${item.id}`)">
<view class="ui-user-pic" style="{{'background-image:url(' + (item.user.photo || 'https://image.fulllinkai.com/202203/09/cc1c73eb1a4941fef25a15cd1ff2f9df.png') + ')'}}" @tap.stop="jumpPath(`/pages/home/information?id=${item.user_id}`)"></view>
<view class="~color999 ~font_24 ui-time">{{ item.create_time }}</view>
<view class="~ui-pl-16">
@ -411,7 +411,7 @@ scroll-view {
return
}
console.log(vm.from, url, type, '7777')
if (vm.from != 'dynamic' && type != 'vote' && vm.from != 'hotTopic') {
if (vm.from != 'dynamic' && vm.from != 'myDynamic' && type != 'vote' && vm.from != 'hotTopic') {
return
}
wx.navigateTo({url: url})

View File

@ -11,7 +11,7 @@ page {
<!--动态操作功能selectData选择的动态数据、selectIndex选中的动态下标、admin是否管理员、from来自哪个父组件-->
<dynamicOperation :selectData="selectData" :chooseShow.sync="chooseShow" :selectIndex="selectIndex" :admin="admin" :from="'home'" @hideModal="hideModal" @changeOperation="changeOperation"></dynamicOperation>
<!--评论数据-->
<dynamicDiscuss :list="list" :detail="detail" @getList="getList" @changLiker="changLiker" :type="'dynamic'"></dynamicDiscuss>
<dynamicDiscuss :list="list" :detail="detail" @getList="getList" @changLiker="changLiker" :type="'dynamic'" @deleteComment="deleteComment"></dynamicDiscuss>
</template>
<script>
@ -72,6 +72,7 @@ wepy.page({
item.created_at = commentTimeHandle(item.created_at)
item.comment = item.comment.split('?')[0]
item.likeGif = 'https://images.ufutx.com/202106/07/b227f3ecf9cbd080fb814450b667b5ce.gif'
item.publish = item.id == wx.getStorageSync('user_id') ? 1 : 0
})
vm.list = data
}
@ -98,6 +99,10 @@ wepy.page({
vm.list[index].liker_count = vm.list[index].liker_count + (vm.list[index].is_liker ? 1 : -1)
vm.list[index].likeGif = `${vm.list[index].likeGif}?${nowTime}`
},
deleteComment(index) {
let vm = this
vm.list.splice(index, 1)
},
// 选择某条动态操作弹框
changeSelect(e, index) {
let vm = this

View File

@ -996,8 +996,12 @@ wepy.page({
vm.uploadState = false
}, 500)
})
}
},
done: sendMsgDone
})
function sendMsgDone(error, file) {
console.log('上传' + (!error ? '成功' : '失败'), file)
}
},
// 发送图片或视频失败
sendFileError() {

View File

@ -316,12 +316,13 @@ wepy.page({
if (res) {
vm.notiTypeData.muteNotiType = muteNotiType
vm.notiTypeData.muteTeam = muteTeam
console.log(vm.notiTypeIndex, e.$wx.detail.value, vm.detail, 'vm.notiTypeIndex')
if (vm.notiTypeIndex !== null) {
vm.notiTypeList[vm.notiTypeIndex].muteNotiType = muteNotiType
vm.notiTypeList[vm.notiTypeIndex].muteTeam = muteTeam
} else {
vm.notiTypeList.push({
teamId: vm.detail.tid,
teamId: vm.detail.team.tid,
muteNotiType: muteNotiType,
muteTeam: muteTeam
})
@ -330,6 +331,7 @@ wepy.page({
if (!e.$wx.detail.value) {
vm.notiTypeList.splice(vm.notiTypeIndex, 1)
}
console.log(vm.notiTypeList, 'vm.notiTypeList')
wx.setStorageSync('muteNotList', vm.notiTypeList)
}
wx.hideLoading()

View File

@ -279,6 +279,10 @@ page {
}
}
}
.ui-refresh{
width: 30rpx;
height: 30rpx;
}
</style>
<template>
<view class="ui-home" v-if="pageLoading">
@ -407,6 +411,10 @@ page {
</view>
</view>
</block>
<view v-if="no_more " class="text-c color-theme f-fcc" @tap="toRefresh">
<image src="https://image.fulllinkai.com/202411/05/97b41d06d255edc1ecfecec71cd15ba1.png" class="ui-refresh ui-mr-8"></image>
<view>更换一批</view>
</view>
<view class="cu-modal {{perfectModal ? 'show' : ''}}">
<view class="perfect_data_box" style="padding: 0;">
<view class="cancel_icon_box" @tap="perfectModal = false">
@ -461,12 +469,14 @@ wepy.page({
topList: [], // 置顶推荐
prefectureList: [], // 专区推荐
squareList: [], // 单身广场
noMoreSquare: false, // 单身广场更多
squarePage: 1,
no_more: false,
cardCur: 0, // 为你推荐轮播下标
referrals: [], // 为你推荐
countdown: {d: '0', h: '00', m: '00', s: '00'},
timer: null
timer: null,
url: 'other/user/square'
},
methods: {
// 获取置顶推荐用户
@ -514,7 +524,7 @@ wepy.page({
// 获取广场
getSquare() {
let vm = this
vm.$get({url: `${service.host}/other/user/square?page=${vm.squarePage}`}).then(({code, data}) => {
vm.$get({url: `${service.host}/${vm.url}?page=${vm.squarePage}`}).then(({code, data}) => {
if (code === 0) {
if (vm.squareList.length === 0 || vm.squarePage === 1) {
vm.squareList = data.data
@ -525,6 +535,7 @@ wepy.page({
}
if (vm.squarePage == data.total_pages) {
vm.no_more = true
vm.noMoreSquare = true
}
vm.squarePage++
}
@ -534,6 +545,18 @@ wepy.page({
console.log(err)
})
},
toRefresh() {
console.log('---9')
let vm = this
vm.squareList = []
vm.squarePage = 1
vm.$showLoading('更新中')
setTimeout(() => {
vm.no_more = false
vm.url = 'other/user/rand/square'
vm.getSquare()
}, 300)
},
// 申请置顶推荐状态
applyTopUpState () {
let vm = this

View File

@ -1,7 +1,7 @@
<template>
<view class="myDynamic" style="height: 100vh;">
<scroll-view scroll-y refresher-enabled="{{true}}" style="height: 100vh;" refresher-triggered="{{triggered}}" bindrefresherpulling="onPulling" bindrefresherrefresh="onRefresh" bindscrolltolower="handleScroll" lower-threshold="50">
<dynamicList :dynamicList="dynamicList" @changeSelect="changeSelect" @changListLiker="changListLiker" :from="'dynamic'"></dynamicList>
<dynamicList :dynamicList="dynamicList" @changeSelect="changeSelect" @changListLiker="changListLiker" :from="'myDynamic'"></dynamicList>
<view v-if="hideMessage" class="text-center">
<view class="font_28 m_empty">
<image src="https://images.ufutx.com/202106/18/c0a2445b889165f29c14ff13a5eaa752.png" mode="aspectFit"></image>
@ -174,6 +174,11 @@
wx.hideLoading()
})
},
feedDelete(index) {
let vm = this
console.log(vm.dynamicList, 'list==')
vm.dynamicList.splice(index, 1)
},
hideModal(e) {
this.modalName = ''
}

View File

@ -0,0 +1,165 @@
<style lang="less" scoped>
@import url(../../styles/theme.less);
page {
background-color: #ffffff;
}
</style>
<template>
<view class="ui-myDynamicDetail"></view>
<!--动态信息-->
<dynamicList :dynamicList="dynamicList" @changeSelect="changeSelect" @changListLiker="changListLiker" :from="'dynamicDetail'"></dynamicList>
<!--动态操作功能selectData选择的动态数据、selectIndex选中的动态下标、admin是否管理员、from来自哪个父组件-->
<dynamicOperation :selectData="selectData" :chooseShow.sync="chooseShow" :selectIndex="selectIndex" :admin="admin" :from="'myDynamic'" @hideModal="hideModal" @changeOperation="changeOperation"></dynamicOperation>
<!--评论数据-->
<dynamicDiscuss :list="list" :detail="detail" @getList="getList" @changLiker="changLiker" :type="'dynamic'" @deleteComment="deleteComment"></dynamicDiscuss>
</template>
<script>
import wepy from '@wepy/core'
import https from '../../mixins/https'
import base from '../../mixins/base'
import {service} from '../../config'
import {commentTimeHandle} from '../../mixins/plugins'
wepy.page({
config: {},
mixins: [https, base],
data: {
id: '',
chooseShow: false,
selectData: {},
selectIndex: null,
detail: {},
dynamicList: [],
list: [] // 评论列表数据
},
methods: {
getDetail() {
let vm = this
vm.$get({url: `${service.host}/moment/${vm.id}`}).then(({code, data}) => {
if (code === 0) {
let result = data
let sty = typeof (result.photos)
if (sty == 'string') {
result.photos = JSON.parse(result.photos)
}
if (result.vote) {
result.v_title = result.vote.title
}
if (result.topic) {
result.mt_name = result.topic.name
}
result.likeGif = 'https://images.ufutx.com/202106/07/b227f3ecf9cbd080fb814450b667b5ce.gif'
result.create_time = commentTimeHandle(result.create_time)
vm.detail = result
vm.dynamicList = JSON.parse(JSON.stringify([result]))
}
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
// 获取评论列表
getList() {
let vm = this
vm.$showLoading('加载中...')
vm.$get({url: `${service.host}/moment/${vm.id}/comment/list?type=moment&nopage=1`}).then(({code, data}) => {
if (code === 0) {
if (data && data.length > 0) {
data.forEach((item) => {
item.created_at = commentTimeHandle(item.created_at)
item.comment = item.comment.split('?')[0]
item.likeGif = 'https://images.ufutx.com/202106/07/b227f3ecf9cbd080fb814450b667b5ce.gif'
item.publish = item.id == wx.getStorageSync('user_id') ? 1 : 0
})
vm.list = data
}
}
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
console.log(err)
})
},
// 列表和详情点赞回调
changListLiker (index) {
let vm = this
let nowTime = new Date()
vm.dynamicList[index].is_like = !vm.dynamicList[index].is_like
vm.dynamicList[index].liker_count = vm.dynamicList[index].liker_count + (vm.dynamicList[index].is_like ? 1 : -1)
vm.dynamicList[index].likeGif = `${vm.dynamicList[index].likeGif}?${nowTime}`
},
// 评论点赞回调
changLiker(index) {
let vm = this
let nowTime = new Date()
vm.list[index].is_liker = !vm.list[index].is_liker
vm.list[index].liker_count = vm.list[index].liker_count + (vm.list[index].is_liker ? 1 : -1)
vm.list[index].likeGif = `${vm.list[index].likeGif}?${nowTime}`
},
deleteComment(index) {
let vm = this
vm.list.splice(index, 1)
},
// 选择某条动态操作弹框
changeSelect(e, index) {
let vm = this
vm.selectData = e
vm.selectIndex = index
vm.chooseShow = true
},
// 取消动态操作弹框
hideModal() {
let vm = this
vm.chooseShow = false
vm.selectData = {}
vm.selectIndex = null
},
// 操作后对原动态列表数据改动
changeOperation(state) {
let vm = this
if (state == 'isTop') {
// 设置动态为置顶
vm.dynamicList[vm.selectIndex].is_top = 1
vm.dynamicList.unshift(vm.dynamicList[vm.selectIndex])
vm.dynamicList.splice(vm.selectIndex + 1, 1)
} else {
// 删除动态 || 隐藏动态 || 设置动态为推荐动态 || 不感兴趣 || 取消置顶
// vm.dynamicList.splice(vm.selectIndex, 1)
const pages = getCurrentPages()
const prevPage = pages[pages.length - 2] // 上一页// 调用上一个页面的setData 方法,将数据存储
console.log(prevPage)
prevPage.data.dynamicList.splice(vm.selectIndex, 1)
wx.navigateBack({
delta: 1
})
// this.setData({
// modalName: ''
// })
}
}
},
onShow() {
},
onLoad(e) {
let vm = this
vm.id = e.id
vm.getDetail()
vm.getList()
}
})
</script>
<config>
{
navigationBarTitleText: '动态详情',
backgroundColorTop: '#ffffff',
backgroundColorBottom: '#ffffff',
usingComponents: {
dynamicList: '~@/components/dynamicList',
dynamicOperation: '~@/components/dynamicOperation',
dynamicDiscuss: '~@/components/dynamicDiscuss',
}
}
</config>

View File

@ -148,7 +148,17 @@
<input type="text" placeholder="请输入不超过八个字的标签" class="u_name_inp_V2" v-model="customName" cursor-spacing="50" maxlength="10" />
<view class="cu-bar bg-white" style="border-top:10rpx solid #f5f5f5;display:flex;">
<view class="action margin-0 flex-sub" style="color:#999999;font-size:32rpx;font-weight:500;border-right:1rpx solid #f5f5f5;" @tap="cancel">取消</view>
<view class="action margin-0 flex-sub solid-left" style="color:#F33B6C;font-size:32rpx;font-weight:500;" @tap="changeOccupation">确认</view>
<view class="action margin-0 flex-sub solid-left" style="color:#F33B6C;font-size:32rpx;font-weight:500;" @tap="changeOccupation('0')">确认</view>
</view>
</view>
</view>
<view :class="{'show': modalName == 'customDel'}" class="cu-modal">
<view class="cu-dialog" style="width:600rpx;">
<view class="bg-img bg-imgs">删除自定义标签</view>
<!-- <input type="text" placeholder="请输入不超过八个字的标签" class="u_name_inp_V2" v-model="customName" cursor-spacing="50" maxlength="10" />-->
<view class="cu-bar bg-white" style="border-top:10rpx solid #f5f5f5;display:flex;">
<view class="action margin-0 flex-sub" style="color:#999999;font-size:32rpx;font-weight:500;border-right:1rpx solid #f5f5f5;" @tap="cancel">取消</view>
<view class="action margin-0 flex-sub solid-left" style="color:#F33B6C;font-size:32rpx;font-weight:500;" @tap="changeOccupation('1')">确认</view>
</view>
</view>
</view>
@ -274,7 +284,13 @@ import base from '../../mixins/base'
for (let i = 140; i < 200; i++) {
this.heightArray[0].push(i)
}
this.GetAddress()
if (e.text == '兴趣标签') {
this.GetAllLabel()
} else if (e.text == '期望对方' || e.text == '编辑资料') {
this.GetAddress()
} else {
this.getuser()
}
if (e.text) {
wx.setNavigationBarTitle({
title: e.text
@ -306,6 +322,22 @@ import base from '../../mixins/base'
this.getuser()
})
},
GetAllLabel() { // 获取所有标签
let that = this
that.$get({url: `${service.host}/interest/labels/list`}).then(({code, data}) => {
that.hobbiesList = data.d_labels
that.customHobbiesList = data.c_labels
// that.provinces = data
// that.provinces.forEach(item => {
// if (item.Name == '中国') {
// item.Children.forEach(sonItem => {
// that.regionArray.push(sonItem.Name)
// })
// }
// })
this.getuser()
})
},
getuser() {
let that = this
that.$get({url: `${service.host}/user/profile`}).then(({code, data}) => {
@ -326,44 +358,20 @@ import base from '../../mixins/base'
that.tscList = []
that.submitList = []
}
that.customHobbiesList = wx.getStorageSync('customHobList') || []
// 兴趣爱好有值
if (data.interest_label && data.interest_label.length > 0) {
that.hobbiesList = that.hobbiesList.map(item => {
return {
title: item.title,
show: data.interest_label.includes(item.title)
}
})
let objectValue = that.hobbiesList.map(item => { return item.title })
let newHobbies = data.interest_label.filter(item => {
console.log(objectValue.includes(item), 'obj===')
return !objectValue.includes(item)
})
console.log(objectValue, newHobbies, 'newHobbies===')
if (newHobbies && newHobbies.length > 0) {
// newHobbies = newHobbies.map(item => {
// return {
// title: item,
// show: true
// }
// })
that.customHobbiesList = [...new Set([...that.customHobbiesList, ...newHobbies])]
that.customHobbiesList = that.customHobbiesList.map(item => {
return {
title: item,
show: data.interest_label.includes(item)
}
})
}
} else {
that.customHobbiesList = that.customHobbiesList.map(item => {
return {
title: item,
show: false
show: data.interest_label.includes(item)
}
})
that.customHobbiesList = that.customHobbiesList.map(item => {
return {
title: item,
show: data.interest_label.includes(item)
}
})
}
try {
@ -397,10 +405,7 @@ import base from '../../mixins/base'
}
this.heightArray = [this.heightArray[0], staturePickerArr]
this.heightArray[1].forEach((item, index) => {
console.log(item, statureArr)
if (item == statureArr[1].replace('cm', '')) {
console.log('----9988')
console.log(index, 'index===')
this.heightIndex = [this.heightIndex[0], index]
}
})
@ -719,28 +724,34 @@ import base from '../../mixins/base'
cancel() {
this.modalName = ''
},
changeOccupation() {
delCustomHob(item, index) { // 删除标签
this.customName = item.title
this.modalName = 'customDel'
},
changeOccupation(type) {
let that = this
let data = {
customName: that.customName
name: that.customName
}
if (type == '0') { // 添加
that.$post({url: `${service.host}/interest/labels/add`, data}).then(({code, data}) => {
// that.getuser()
that.customHobbiesList.push({
title: that.customName,
show: false
})
that.modalName = ''
})
} else { // 删除
that.$post({url: `${service.host}/interest/labels/delete`, data}).then(({code, data}) => {
that.customHobbiesList = that.customHobbiesList.filter(item => {
return item.title != that.customName
})
that.modalName = ''
})
}
},
that.customHobbiesList.push({title: that.customName, show: false})
let list = that.customHobbiesList.map(item => item.title)
wx.setStorageSync('customHobList', list)
that.modalName = ''
// that.$post({url: `${service.host}/addresses/v2`}, data).then(({code, data}) => {
// that.getuser()
// that.modalName = ''
// })
},
delCustomHob(item, index) {
let that = this
that.customHobbiesList.splice(index, 1)
let list = that.customHobbiesList.map(item => item.title)
wx.setStorageSync('customHobList', list)
console.log(that.customHobbiesList, 'that.customHobbiesList==')
},
changeSelectHob(item) {
console.log('22')
return this.selectHobbiesList.includes(item)

View File

@ -123,7 +123,7 @@ const IM = (account, token) => {
return item
})
} else {
teamCount.push({id: e.to, unread: notiTypeData.muteTeam === false ? 0 : 1})
teamCount.push({id: e.to, unread: notiTypeData.muteTeam ? 0 : 1})
}
wx.setStorageSync('teamsSessionsCount', teamCount)
}
@ -170,10 +170,17 @@ const IM = (account, token) => {
})
nim.on('myTeamMembers', function (e) {
let pages = getCurrentPages()
let currentPage = pages[pages.length - 1]
if (currentPage.route == 'pages/news/groupChitchatDetail') {
return
}
let muteNotList = []
console.log(e, 'e===')
if (e && e.length > 0) {
e.forEach((i) => {
if (i.muteTeam) {
console.log(i, 'i====')
muteNotList.push({
teamId: i.teamId,
muteNotiType: i.muteTeam ? 1 : 0,
@ -182,6 +189,7 @@ const IM = (account, token) => {
}
})
setTimeout(() => {
console.log(muteNotList, '99399')
wx.setStorageSync('muteNotList', muteNotList)
})
}