160 lines
3.7 KiB
Vue
160 lines
3.7 KiB
Vue
<template>
|
|
<view>
|
|
<view class="body">
|
|
<view class="list">
|
|
<!-- <view class="list_content fa sb">
|
|
<view class="list_title">亲密度提示</view>
|
|
<switch checked color="#CCA2FD" style="transform:scale(0.8)"/>
|
|
</view> -->
|
|
<!-- <view class="list_content fa sb">
|
|
<view class="list_title">主动问候</view>
|
|
<switch checked color="#CCA2FD" style="transform:scale(0.8)"/>
|
|
</view> -->
|
|
<view class="list_content fa sb">
|
|
<view class="list_title">梦中人心声</view>
|
|
<switch :checked="form.enabled" color="#CCA2FD" style="transform:scale(0.8)"
|
|
@change="switchChange" />
|
|
</view>
|
|
<view class="list_content fa sb" @click="toloverMessage">
|
|
<view class="list_title">虚拟恋人信息</view>
|
|
<image src="/static/images/more.png" mode="widthFix"></image>
|
|
</view>
|
|
<view class="list_content fa sb" @click="timbreClick">
|
|
<view class="list_title">虚拟恋人音色</view>
|
|
<image src="/static/images/more.png" mode="widthFix"></image>
|
|
</view>
|
|
<view class="list_content fa sb" @click="backgroundClick">
|
|
<view class="list_title">聊天背景</view>
|
|
<image src="/static/images/more.png" mode="widthFix"></image>
|
|
</view>
|
|
<view class="list_content fa sb" @click="voiceCallClick">
|
|
<view class="list_title">语音通话</view>
|
|
<image src="/static/images/more.png" mode="widthFix"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
ChatConfig,
|
|
ChatInnerVoice
|
|
} from '@/utils/api.js'
|
|
import notHave from '@/components/not-have.vue';
|
|
import topSafety from '@/components/top-safety.vue';
|
|
export default {
|
|
components: {
|
|
notHave,
|
|
topSafety,
|
|
},
|
|
data() {
|
|
return {
|
|
form: {
|
|
session_id: '',
|
|
enabled: false, // 开关状态变量
|
|
},
|
|
chatConfigData: ''
|
|
}
|
|
},
|
|
onLoad(options) {
|
|
this.form.session_id = options.session_id;
|
|
this.chatConfig(this.form.session_id);
|
|
},
|
|
methods: {
|
|
chatConfig(session_id) {
|
|
ChatConfig({ session_id: session_id }).then(res => {
|
|
if (res.code == 1) {
|
|
this.chatConfigData = res.data;
|
|
// 根据返回的数据设置开关状态
|
|
if (res.data && typeof res.data.inner_voice_enabled !== 'undefined') {
|
|
this.form.enabled = res.data.inner_voice_enabled;
|
|
}
|
|
} else {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
position: 'top'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
chatInnerVoice() {
|
|
ChatInnerVoice(this.form).then(res => {
|
|
if (res.code == 1) {
|
|
uni.showToast({
|
|
title: '操作成功',
|
|
icon: 'none',
|
|
position: 'top'
|
|
})
|
|
this.chatConfig(this.form.session_id);
|
|
} else {
|
|
uni.showToast({
|
|
title: res.msg,
|
|
icon: 'none',
|
|
position: 'top'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
switchChange(e) {
|
|
const newEnabled = e.detail.value;
|
|
this.form.enabled = newEnabled;
|
|
console.log(this.form);
|
|
this.chatInnerVoice();
|
|
},
|
|
toloverMessage() {
|
|
uni.navigateTo({
|
|
url: '/pages/chat/loverMessage'
|
|
});
|
|
},
|
|
//
|
|
timbreClick() {
|
|
uni.navigateTo({
|
|
url: '/pages/create/timbre?is_edit=1'
|
|
})
|
|
},
|
|
// 聊天背景
|
|
backgroundClick() {
|
|
uni.navigateTo({
|
|
url: '/pages/chat/background?session_id=' + this.form.session_id
|
|
})
|
|
},
|
|
// 语音通话
|
|
voiceCallClick() {
|
|
uni.navigateTo({
|
|
url: '/pages/chat/voiceCall'
|
|
})
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
<style>
|
|
.body {
|
|
position: relative;
|
|
padding: 30rpx;
|
|
}
|
|
|
|
.list {
|
|
position: relative;
|
|
}
|
|
|
|
.list_content {
|
|
position: relative;
|
|
margin: 0 0 40rpx 0;
|
|
padding: 24rpx 30rpx;
|
|
}
|
|
|
|
.list_title {
|
|
font-weight: 500;
|
|
font-size: 30rpx;
|
|
color: #333333;
|
|
line-height: 40rpx;
|
|
}
|
|
|
|
.list_content image {
|
|
margin: 0 50rpx 0 0;
|
|
width: 8rpx;
|
|
height: 48rpx;
|
|
}
|
|
</style> |