feat:app设置
This commit is contained in:
1 parent
f4f77434e1
commit
ce16eaf82e
6 files changed
+176
-34
No files matched your search
@@ -240,6 +240,13 @@
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "setting",
|
||||
"style": {
|
||||
"navigationBarTitleText": "设置",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "about",
|
||||
"style": {
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<view class="w-full h-600rpx relative">
|
||||
<image
|
||||
class="w-full h-full absolute inset-0"
|
||||
:src="userDetail.coverPic.split(',')[0]"
|
||||
:src="userDetail.coverPic?.split(',')[0]"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view
|
||||
@@ -53,7 +53,7 @@
|
||||
|
||||
<view class="flex flex-wrap justify-center mb-20rpx">
|
||||
<text class="px-2 py-1 rounded-1 mr-2 bg-#222 text-color-theme-dark">
|
||||
{{ getGender(userDetail.member.memberSex) }}·{{ userDetail.member.memberAge }}岁
|
||||
{{ getGender(userDetail.member?.memberSex) }}·{{ userDetail.member?.memberAge }}岁
|
||||
</text>
|
||||
<text class="px-2 py-1 rounded-1 mr-2 bg-#222 text-color-theme-dark">
|
||||
{{ userDetail.member?.memberHeight || '' }}cm
|
||||
@@ -141,6 +141,14 @@
|
||||
import { getGender } from '@/sheep/util/index';
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
// @ts-ignore
|
||||
import useConfigStore from '@/chat-store/configStore.js';
|
||||
// @ts-ignore
|
||||
import useChatStore from '@/chat-store/chatStore.js';
|
||||
// @ts-ignore
|
||||
import useFriendStore from '@/chat-store/friendStore.js';
|
||||
// @ts-ignore
|
||||
import request from '@/common/request';
|
||||
|
||||
const userCity = computed(() => sheep.$store('user').userCity);
|
||||
const params = reactive({
|
||||
@@ -208,8 +216,58 @@
|
||||
};
|
||||
|
||||
// 私聊
|
||||
const goChat = () => {
|
||||
uni.showToast({ title: '功能开发中...' });
|
||||
const goChat = async () => {
|
||||
if (!userDetail.value.memberId) return uni.showToast({ title: '用户不存在' });
|
||||
const { code } = await RecentApi.chatAddFriend({
|
||||
friendUserId: userDetail.value.memberId,
|
||||
});
|
||||
if (code !== 0) return uni.showToast({ title: '好友添加失败', icon: 'error' });
|
||||
|
||||
const friendStore = useFriendStore();
|
||||
const configStore = useConfigStore();
|
||||
const chatStore = useChatStore();
|
||||
let friendInfo: any = {};
|
||||
|
||||
request({
|
||||
url: '/user/find/' + userDetail.value.memberId,
|
||||
method: 'GET',
|
||||
}).then((user: any) => {
|
||||
console.log(user);
|
||||
friendInfo = user;
|
||||
|
||||
const friend = {
|
||||
id: user.id,
|
||||
nickName: user.nickName,
|
||||
headImage: user.headImageThumb,
|
||||
online: user.online,
|
||||
deleted: false,
|
||||
};
|
||||
friendStore.addFriend(friend);
|
||||
});
|
||||
|
||||
let chat: any = {
|
||||
type: 'PRIVATE',
|
||||
targetId: friendInfo.id,
|
||||
showName: friendInfo.nickName,
|
||||
headImage: friendInfo.headImageThumb,
|
||||
};
|
||||
// if (this.isFriend) {
|
||||
// chat.isDnd = this.friendInfo.isDnd;
|
||||
// }
|
||||
chatStore.openChat(chat);
|
||||
let chatIdx = chatStore.findChatIdx(chat);
|
||||
uni.navigateTo({
|
||||
url: '/pages/message/chat-box?chatIdx=' + chatIdx,
|
||||
});
|
||||
|
||||
// 初始化期间进入会话会导致消息不刷新
|
||||
// if (!configStore.appInit || chatStore.loading) {
|
||||
// uni.showToast({
|
||||
// title: '正在初始化页面,请稍后...',
|
||||
// icon: 'none',
|
||||
// });
|
||||
// return;
|
||||
// }
|
||||
};
|
||||
|
||||
// 喜欢
|
||||
|
||||
@@ -91,16 +91,9 @@
|
||||
/>
|
||||
</wd-cell-group>
|
||||
</view>
|
||||
<view
|
||||
class="mt-40rpx rounded-full bg-color-theme-dark text-base text-center py-2 mx-8 active:bg-color-theme"
|
||||
@click="handleLogout"
|
||||
>
|
||||
退 出 登 录
|
||||
</view>
|
||||
<view class="h-100rpx"></view>
|
||||
</scroll-view>
|
||||
|
||||
<wd-message-box />
|
||||
<wd-popup
|
||||
v-model="myEvaluationShow"
|
||||
custom-style="border-radius:32rpx;"
|
||||
@@ -149,13 +142,11 @@
|
||||
import useAblum from './use-ablum';
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
import { useMessage } from '@/uni_modules/wot-design-uni';
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
// @ts-ignore
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
|
||||
const message = useMessage();
|
||||
const { ablumList } = useAblum();
|
||||
|
||||
// 钱包信息
|
||||
@@ -225,31 +216,16 @@
|
||||
});
|
||||
};
|
||||
|
||||
// 退出登录
|
||||
const handleLogout = () => {
|
||||
message
|
||||
.confirm({
|
||||
msg: '',
|
||||
title: '确定退出登录吗?',
|
||||
})
|
||||
.then(() => {
|
||||
sheep.$store('user').logout();
|
||||
uni.redirectTo({ url: '/pages/login/login' });
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
// cell菜单
|
||||
const MenuCellList = [
|
||||
{ title: '我的收益', value: '', icon: 'wallet', to: '' },
|
||||
{ title: '访客记录√', value: '', icon: 'dong', to: '/pages/profile/view-record' },
|
||||
{ title: '访客记录', value: '', icon: 'dong', to: '/pages/profile/view-record' },
|
||||
{ title: '认证中心', value: '', icon: 'user', to: '' },
|
||||
{ title: '我的动态√', value: '', icon: 'star', to: '/pages/profile/my-moment' },
|
||||
{ title: '我的评价√', value: '', icon: 'view-module', to: '', click: lookMyEvaluation },
|
||||
{ title: '问题反馈√', value: '', icon: 'backtop-rectangle', to: '', click: goFeedback },
|
||||
{ title: '我的动态', value: '', icon: 'star', to: '/pages/profile/my-moment' },
|
||||
{ title: '我的评价', value: '', icon: 'view-module', to: '', click: lookMyEvaluation },
|
||||
{ title: '问题反馈', value: '', icon: 'backtop-rectangle', to: '', click: goFeedback },
|
||||
{ title: '客服助手', value: '', icon: 'service', to: '' },
|
||||
{ title: '关注公众号√', value: '获取最新消息', icon: 'qrcode', to: '', click: subOfficial },
|
||||
{ title: '设置', value: '', icon: 'setting1', to: '' },
|
||||
{ title: '关于√', value: '', icon: 'info-circle', to: '/pages/profile/about' },
|
||||
{ title: '设置√', value: '', icon: 'setting1', to: '/pages/profile/setting' },
|
||||
];
|
||||
</script>
|
||||
@@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="设置" safeAreaInsetTop :bordered="false">
|
||||
<template #left>
|
||||
<navigator open-type="navigateBack" hover-class="navigator-hover">
|
||||
<uni-icons type="back" size="30" color="#ffcd32"></uni-icons>
|
||||
</navigator>
|
||||
</template>
|
||||
</wd-navbar>
|
||||
|
||||
<wd-cell title="消息推送" value="消息推送" ellipsis>
|
||||
<wd-switch v-model="params.isPush" inactive-color="#777" @change="change" size="20" />
|
||||
</wd-cell>
|
||||
<wd-cell title="首页隐身" value="首页隐身" ellipsis>
|
||||
<wd-switch v-model="params.homeHide" inactive-color="#777" @change="change" size="20" />
|
||||
</wd-cell>
|
||||
<wd-cell title="隐私保护" value="隐私保护" ellipsis>
|
||||
<wd-switch v-model="params.privacySecure" inactive-color="#777" @change="change" size="20" />
|
||||
</wd-cell>
|
||||
<wd-cell title="短信通知" value="短信通知" ellipsis>
|
||||
<wd-switch v-model="params.shortNote" inactive-color="#777" @change="change" size="20" />
|
||||
</wd-cell>
|
||||
<wd-cell title="关于" value="" is-link ellipsis to="/pages/profile/about" />
|
||||
|
||||
<view
|
||||
class="mt-40rpx rounded-full bg-color-theme-dark text-base text-center py-2 mx-8 active:bg-color-theme"
|
||||
@click="handleLogout"
|
||||
>
|
||||
退 出 登 录
|
||||
</view>
|
||||
<wd-message-box />
|
||||
</wd-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { reactive } from 'vue';
|
||||
import { useMessage } from '@/uni_modules/wot-design-uni';
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const message = useMessage();
|
||||
|
||||
const params = reactive({
|
||||
isPush: true,
|
||||
homeHide: false,
|
||||
privacySecure: true,
|
||||
shortNote: true,
|
||||
});
|
||||
|
||||
onLoad(async () => {
|
||||
const { code, data } = await RecentApi.getSetting();
|
||||
if (code !== 0) return;
|
||||
params.isPush = data.isPush;
|
||||
params.homeHide = data.homeHide;
|
||||
params.privacySecure = data.privacySecure;
|
||||
params.shortNote = data.shortNote;
|
||||
});
|
||||
|
||||
const change = async () => {
|
||||
await RecentApi.updateSetting(params);
|
||||
};
|
||||
|
||||
// 退出登录
|
||||
const handleLogout = () => {
|
||||
message
|
||||
.confirm({
|
||||
msg: '',
|
||||
title: '确定退出登录吗?',
|
||||
})
|
||||
.then(() => {
|
||||
sheep.$store('user').logout();
|
||||
uni.reLaunch({ url: '/pages/login/login' });
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
</script>
|
||||
@@ -267,6 +267,29 @@ const RecentApi = {
|
||||
},
|
||||
});
|
||||
},
|
||||
// 查询用户设置
|
||||
getSetting: () => {
|
||||
return request({
|
||||
url: '/member/recent-cfg/get-or-create',
|
||||
method: 'GET',
|
||||
custom: {
|
||||
showLoading: true,
|
||||
loadingMsg: '加载中',
|
||||
},
|
||||
});
|
||||
},
|
||||
// 更新用户设置
|
||||
updateSetting: (data: any) => {
|
||||
return request({
|
||||
url: '/member/recent-cfg/create-or-update',
|
||||
method: 'POST',
|
||||
data,
|
||||
custom: {
|
||||
showLoading: true,
|
||||
loadingMsg: '加载中',
|
||||
},
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default RecentApi;
|
||||
@@ -34,7 +34,7 @@
|
||||
{{ member.memberOcc }}
|
||||
</text>
|
||||
<text class="bg-#333 text-color-theme-dark text-xs px-2 py-1 rounded-1">
|
||||
{{ data.location.distance }}
|
||||
{{ data.location?.distance }}
|
||||
</text>
|
||||
<text class="bg-#333 text-color-theme-dark text-xs px-2 py-1 rounded-1">
|
||||
{{ member.memberCity || data.issueCity }}
|
||||
|
||||
Reference in new issue
Block a user