ufutx_love_mp/src/pages/users/setTing.wpy
2024-09-29 11:01:17 +08:00

388 lines
13 KiB
Plaintext

<template>
<view class="setTing">
<view class="m_lst" >
<block v-if="phoneNumber">
<view class="u_lst f-fbc" >
<view class="u_lst f-fbc">
<view class="f-fc">
<view class="font_30 " >手机号绑定</view>
</view>
</view>
<view class="color-999 font_28">{{phoneNumber}}</view>
</view>
</block>
<block v-else>
<button class="u_lst f-fbc btn" open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber">
<view class="u_lst f-fbc">
<view class="f-fc">
<view class="font_30 " >手机号绑定</view>
</view>
</view>
<image class="u_lst_you" mode="widthFix" src="https://images.ufutx.com/202012/23/f9713dc39b5d236067834ea0f1a6edaf.png"></image>
</button>
</block>
</view>
<view class="m_lst" v-for="(itemV1,indexV1) in lists" :key="indexV1">
<block v-for="(item,index) in itemV1" :key="index">
<block v-if="item.title == '团契VIP'">
<view class="u_lst f-fbc" v-if="user.id == '616'" @tap="goto(item.path,item.title)">
<view class="f-fc">
<view class="font_30 color-333" >{{item.title}}</view>
</view>
<image class="u_lst_you" mode="widthFix" src="https://images.ufutx.com/202012/23/f9713dc39b5d236067834ea0f1a6edaf.png"></image>
</view>
</block>
<block v-else>
<view class="u_lst f-fbc" @tap="goto(item.path,item.title)">
<view class="f-fc">
<view class="font_30 color-333" v-if="item.title == '资料'">{{user.hidden_profile == 'ALLSEX'?'打开资料':'关闭资料'}}</view>
<view class="font_30 color-333" v-else>{{item.title}}</view>
<image v-if="item.title == '隐身访问' || item.title == '访客通知'" class="u_lst_vipImg" src="https://images.ufutx.com/202107/06/1ea086f5a6001752fa6efd55eabbe8d6.png" mode="scaleToFill" lazy-load="false"></image>
</view>
<switch v-if="item.title == '聊天消息提醒'" checked="{{user.notice_chat}}" disabled="{{switchDisabled}}" color="#d92553" class="flo_r" style="margin-right: -2rpx;margin-top: -6rpx;"/>
<switch v-if="item.title == '营销消息'" checked="{{user.notice_market}}" disabled="{{switchDisabled}}" color="#d92553" class="flo_r" style="margin-right: -2rpx;margin-top: -6rpx;"/>
<switch v-if="item.title == '隐身访问'" checked="{{user.hidden_preview}}" disabled="{{switchDisabled}}" color="#d92553" class="flo_r" style="margin-right: -2rpx;margin-top: -6rpx;"/>
<switch v-if="item.title == '访客通知'" checked="{{user.notice_preview}}" disabled="{{switchDisabled}}" color="#d92553" class="flo_r" style="margin-right: -2rpx;margin-top: -6rpx;"/>
<image v-if="item.title !== '隐身访问' && item.title !== '访客通知' && item.title !== '每日推荐提醒' && item.title !== '夸夸我' && item.title !== '聊天消息提醒'&& item.title !== '营销消息' && item.title !== '关于福恋'" class="u_lst_you" mode="widthFix" src="https://images.ufutx.com/202012/23/f9713dc39b5d236067834ea0f1a6edaf.png"></image>
<view v-if="item.title == '关于福恋'">
<span class="color-666 font_28 d_versions" >{{ versions }}</span>
<image class="u_lst_you" mode="widthFix" src="https://images.ufutx.com/202012/23/f9713dc39b5d236067834ea0f1a6edaf.png"></image>
</view>
</view>
</block>
</block>
</view>
</view>
<UnlockingDialog :modalName="unlockIngModalName" @unlockingCut="unlockingCut"></UnlockingDialog>
</template>
<script>
import wepy from '@wepy/core'
import base from '../../mixins/base'
import {service} from '../../config.js'
import https from '../../mixins/https'
import {getPhoneNumber} from '../../utils/util'
const app = getApp().$wepy.$options
wepy.page({
mixins: [base, https],
data: {
user: {
name: '获取中...'
},
rankData: {
rank_id: 0
},
deadline: '',
title: '',
phoneNumber: '',
invite_pic: '',
hide: true,
showModalStatus: false,
showChangeState: false,
animationData: {},
pic: [],
Image: 'http://images.ufutx.com/201902/25/542cc218e40cbc8a8e3a9ce23d7f4789.gif',
files: '',
ShowUpload: false,
border: 0,
BookImage: '',
showUpLoad: false,
stopMusic: false,
shareCanvasImg: '',
innerAudioContext: null,
StateList: [
{title: '单身', active: true, type: 'single'},
{title: '恋爱', active: false, type: 'loveing'},
{title: '已婚', active: false, type: 'marriage'}
],
StateText: '',
unlockIngModalName: '',
switchDisabled: false,
system: '',
versions: '',
lists: [
[
{
title: '团契VIP',
type: 'navigateTo',
path: '/pages/users/groupList'
},
{
title: '授权设置',
type: 'navigateTo',
path: '/pages/users/groupList'
},
{
title: '隐身访问',
type: 'navigateTo',
path: ''
},
{
title: '访客通知',
type: 'navigateTo',
path: ''
},
{
title: '屏蔽管理',
type: 'navigateTo',
path: '/pages/users/blacklist'
}
],
[
{
title: '聊天消息提醒',
type: 'navigateTo',
path: ''
},
{
title: '营销消息',
type: 'navigateTo',
path: ''
}
],
[
{
title: '资料',
type: 'navigateTo',
path: '/pages/users/logout'
}
],
[
{
title: '帮助中心',
type: 'navigateTo',
path: 'https://love.ufutx.com/h5/#/guide'
},
{
title: '关于福恋',
type: 'navigateTo',
path: '/pages/users/aboutLove'
}
]
]
},
watch: {
},
onShow() {
this.versions = app.globalData.versions
this.initPageData()
},
onLoad() {
this.system = app.globalData.systemInfo.system.split(' ')[0]
},
methods: {
vipData() {
this.$get({url: service.host + '/user/center'}).then(({code, data}) => {
this.rankData = data.rank_profile
})
},
// 初始化页面数据
initPageData() {
this.$get({url: service.host + '/setting/list'}).then(({code, data}) => {
this.init = true
this.user = data
this.phoneNumber = wx.getStorageSync('mobile')
let vm = this
vm.vipData()
wx.setStorageSync('type', data.type)
})
},
hiddenChange() { // 隐身处理
console.log(this.user, this.user.hidden_preview, '000330')
if (this.rankData.rank_id <= 0 && this.user.hidden_preview == 0) {
if (this.system == 'iOS') {
console.log('ios====')
this.unlockIngModalName = 'iosTipsModal'
} else {
this.unlockIngModalName = 'purchaseModal'
}
this.switchDisabled = true
this.user.hidden_preview = false
return
}
this.$post({url: `${service.host}/setting/hidden/preview`}).then(({code, data}) => {
this.$showToast('设置成功')
this.user.hidden_preview = !this.user.hidden_preview
})
},
visitorChange() { // 访客通知设置
if (this.rankData.rank_id <= 0 && this.user.notice_preview == 0) {
if (this.system == 'iOS') {
this.unlockIngModalName = 'iosTipsModal'
} else {
this.unlockIngModalName = 'purchaseModal'
}
this.switchDisabled = true
this.user.notice_preview = false
return
}
this.$post({url: `${service.host}/setting/preview/notice`}).then(({code, data}) => {
this.$showToast('设置成功')
this.user.notice_preview = !this.user.notice_preview
})
},
newMsgChange() { // 聊天消息提醒
this.$post({url: `${service.host}/setting/chat/notice`}).then(({code, data}) => {
this.$showToast('设置成功')
this.user.notice_chat = !this.user.notice_chat
})
},
marketingMsgChange() { // 营销消息
this.$post({url: `${service.host}/setting/market/notice`}).then(({code, data}) => {
this.$showToast('设置成功')
this.user.notice_market = !this.user.notice_market
})
},
openData() { // 打开资料
let vm = this
vm.$put({
url: `${service.host}/change/hidden/profile`,
data: {type: 'NONE'}
}).then(({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)})
},
onPosterSuccess(e) { // 分享海报
let vm = this
vm.invite_pic = e.detail
console.log(e.detail, '海报')
wx.hideLoading()
},
onPosterSuccessWx(e) { // 分享微信
let vm = this
vm.shareCanvasImg = e.detail
console.log(e.detail, 'wx')
wx.hideLoading()
},
getPhoneNumber({$wx: e}) { // 获取手机号
let vm = this
if (e.detail.iv) {
getPhoneNumber(e).then((data) => {
console.log(data, 'phone====')
if (data.phone) {
vm.phoneNumber = data.phone
vm.$showToast('绑定成功')
let pages = getCurrentPages()
let prevPage = pages[pages.length - 2] // 上一个页面
if (prevPage && prevPage.route == 'pages/users/myCertification') {
vm.$gotoBack(1)
}
}
})
} else {
}
},
goto(url, title) {
console.log(this.hide, 'url====')
// if (title == '分享我的卡片') {
// this.hide = false
// return
// }
if (title == '授权设置') {
wx.openSetting({
success(res) {
console.log('成功', res)
},
fail(err) {
console.log('失败', err)
}
})
return
}
if (title == '隐身访问') {
this.hiddenChange()
return
}
if (title == '访客通知') {
this.visitorChange()
return
}
if (title == '聊天消息提醒') {
this.newMsgChange()
return
}
if (title == '营销消息') {
this.marketingMsgChange()
return
}
if (title == '帮助中心') {
this.gotoH5(url)
return
}
if (title == '资料' && this.user.hidden_profile == 'ALLSEX') {
this.openData()
return
}
wx.navigateTo({url: url})
},
unlockingCut(e) {
console.log(e, '---')
this.unlockIngModalName = e
}
}
})
</script>
<style lang="less" scoped>
page{
height: 100vh;
}
.setTing {
background: #f8f8f8;
min-height: 100vh;
button::after {
border: none;
}
.m_lst {
padding: 0 30rpx;
margin-top: 12rpx;
background-color: white;
.u_lst {
height: 90rpx;
border-bottom: 2rpx solid #F5F5F5;
.u_lst_you {
width: 12rpx;
height: auto;
vertical-align: center;
margin-bottom: -4rpx;
margin-left: 12rpx;
}
.u_lst_vipImg {
width: 48rpx;
height: 30rpx;
margin-left: 10rpx;
}
}
}
}
</style>
<config>
{
navigationBarTitleText: '设置',
enablePullDownRefresh: false,
backgroundColorTop: '#f2f2f2',
backgroundColorBottom: '#f2f2f2',
usingComponents: {
UnlockingDialog: '~@/components/UnlockingDialog',
shareComponent: '~@/components/shareComponent',
}
}
</config>