This commit is contained in:
lanzhihui 2024-09-26 17:06:29 +08:00
parent b0775fc8bd
commit 807b1b7b87

View File

@ -102,36 +102,12 @@
showUpLoad: false,
stopMusic: false,
innerAudioContext: null,
StateList: [{
title: '单身',
active: true,
type: 'single'
},
{
title: '恋爱',
active: false,
type: 'loveing'
},
{
title: '已婚',
active: false,
type: 'marriage'
}
],
StateText: ''
},
watch: {
user() {
console.log('user----------------------------', this.user)
console.log(this.user.is_peofile)
for (let item of this.StateList) {
if (item.type == this.user.type) {
item.active = true
this.StateText = item.title
} else {
item.active = false
}
}
this.user.deadline = this.user.deadline ? this.user.deadline.split(' ')[0] : ''
console.log(this.user.deadline)
this.Image = this.user.photo
@ -140,9 +116,6 @@
} else {
this.deadline = ''
}
},
pic() {
console.log(this.pic)
}
},
onLoad() {
@ -150,26 +123,6 @@
},
methods: {
upDataAvatar() {
let data = {
photo: this.Image
}
this.$put({
url: `${service.user}/photo`,
data
}).then(({
code,
data
}) => {
this.$Toast_success('更换成功')
}).finally(() => {
wx.hideLoading()
})
},
photoCity(e) {
this.Image = e
this.$parent.initPageData()
},
longPress() {
wx.showModal({ // 使用模态框提示用户进行操作
title: '警告',
@ -184,217 +137,15 @@
}
})
},
// moreTask() {
// if (!wx.getStorageSync('token')) {
// console.log('运行')
// var pages = getCurrentPages()
// var currentPage = pages[pages.length - 1]
// currentPage.handleAPPly()
// return
// }
// wx.navigateTo({
// url: '/pages/users/calendarSignIn'
// })
// this.$apply()
// },
gotoPage(url) {
if (!this.token) {
this.$emit('modalValue', '')
return
}
this.$goto(url)
},
gotoTab() {
if (!this.token) {
this.$emit('modalValue', '')
}
// this.$goto('/pages/userInfo/typeSelect?from_openid=' + wx.getStorageSync('from_openid'))
// this.$goto('/pages/tabBar/welcome?from_openid=' + wx.getStorageSync('from_openid'))
},
previewImage(item, list) {
this.$previewImage(item, list)
},
hide() {
this.stopMusic = !this.stopMusic
this.onPauseMusic()
},
chooseimage() {
if (!this.token) {
this.$emit('modalValue', '')
return
}
this.onPauseMusic()
this.$goto(`/pages/users/ImageCropper?src=${this.Image}`)
// this.$invoke('uploadImage', 'chooseimage')
},
quitMusic() { // 停止音乐
this.stopMusic = !this.stopMusic
if (!this.stopMusic) {
this.onPlayMusic()
} else {
this.onPauseMusic()
}
},
userMessage() { // 打开浮层 播放音乐
// this.$invoke('modalUp', 'showModal')
// this.$invoke('modal', 'showModal')
this.onPlayMusic()
},
openData() { // 打开资料
let vm = this
vm.$put({
url: `${service.host}/change/hidden/profile`,
data: {
type: 'NONE'
}
}, {
success: ({
code,
res
}) => {
vm.$showToast('已打开')
vm.$get({
url: service.user
}, {
success: ({
code,
data
}) => {
vm.user = data
}
})
}
})
},
gotoH5(item) {
console.log(encodeURIComponent(item))
wx.navigateTo({
url: '/pages/books/bookDetail?url=' + encodeURIComponent(item)
})
},
ChangeState() {
if (this.showChangeState) {
this.showChangeState = false
} else {
this.showChangeState = true
}
console.log(this.showChangeState)
},
hiddenChange() { // 隐身处理
this.$put({
url: `${service.host}/users/hidden`
}, {
success: ({
code,
data
}) => {
this.$showToast('设置成功')
}
})
},
StateActive(index) {
let data = {
type: this.StateList[index].type
}
this.$put({
url: `${service.host}/change/users/type`,
data
}, {
success: ({
code,
data
}) => {
this.$get({
url: service.user
}, {
success: ({
code,
data
}) => {
this.user = data
wx.setStorageSync('type', data.type)
}
})
for (let idx in this.StateList) {
if (idx == index) {
this.StateList[idx].active = true
} else {
this.StateList[idx].active = false
}
}
console.log('更改成功')
}
})
},
// 注销账号
logout() {
let that = this
wx.showModal({ // 使用模态框提示用户进行操作
title: '警告',
content: '本操作将会注销您的账户,可能会导致您错过精心为您配对的另一半,是否继续?',
cancelText: '确定',
confirmText: '取消',
success: function(res) {
if (res.confirm) {
console.log('用户点击取消')
} else if (res.cancel) {
that.$delete({
url: `${service.host}/admin/users/${that.user.id}`
}, {
success: ({
code,
data
}) => {
wx.clearStorageSync()
wx.showModal({ // 使用模态框提示用户进行操作
title: 'Sorry!',
content: '很抱歉!我们的产品没有留住你,希望我们能够再次见面!!!',
showCancel: false,
confirmText: '确定',
success: function(res) {
if (res.confirm) {
that.$goto('/pages/tabBar/welcome')
}
}
})
}
})
}
}
})
},
// 显示对话框
showModal() {
// 显示遮罩层
var animation = wx.createAnimation({
duration: 200,
timingFunction: 'linear',
delay: 0
})
this.animation = animation
animation.translateY(300).step()
this.animationData = animation.export()
this.showModalStatus = true
setTimeout(function() {
animation.translateY(0).step()
this.animationData = animation.export()
}.bind(this), 200)
},
gotofriends(item) {
this.modalName = ''
let url = ''
if (item.type == 'single') {
url = '/pages/home/information?id=' + item.id
} else {
url = '/pages/home/informationV2?id=' + item.id
}
wx.navigateTo({
url: url
})
},
hideModal() {
this.modalName = ''
},
goto(url) {
console.log(this.token, '----0000')
if (!this.token) {
@ -416,18 +167,6 @@
wx.navigateTo({
url: url
})
},
gotoUser(type) {
this.onPauseMusic()
let url = ''
if (type == 'single') {
url = '/pages/users/unmarriV2'
} else {
url = '/pages/users/intro'
}
wx.navigateTo({
url: url
})
}
}