|
@@ -1,3 +1,4 @@
|
|
|
|
+<!-- 用户信息 -->
|
|
<template>
|
|
<template>
|
|
<s-layout title="用户信息" class="set-userinfo-wrap">
|
|
<s-layout title="用户信息" class="set-userinfo-wrap">
|
|
<uni-forms
|
|
<uni-forms
|
|
@@ -18,7 +19,7 @@
|
|
:width="160"
|
|
:width="160"
|
|
:radius="80"
|
|
:radius="80"
|
|
mode="scaleToFill"
|
|
mode="scaleToFill"
|
|
- ></su-image>
|
|
|
|
|
|
+ />
|
|
<view class="avatar-action">
|
|
<view class="avatar-action">
|
|
<!-- #ifdef MP -->
|
|
<!-- #ifdef MP -->
|
|
<button
|
|
<button
|
|
@@ -208,7 +209,7 @@
|
|
import { showAuthModal } from '@/sheep/hooks/useModal';
|
|
import { showAuthModal } from '@/sheep/hooks/useModal';
|
|
|
|
|
|
const state = reactive({
|
|
const state = reactive({
|
|
- model: {},
|
|
|
|
|
|
+ model: {}, // 个人信息
|
|
rules: {},
|
|
rules: {},
|
|
thirdOauthInfo: null,
|
|
thirdOauthInfo: null,
|
|
});
|
|
});
|
|
@@ -232,26 +233,28 @@
|
|
|
|
|
|
const userInfo = computed(() => sheep.$store('user').userInfo);
|
|
const userInfo = computed(() => sheep.$store('user').userInfo);
|
|
|
|
|
|
- // 选择性别
|
|
|
|
|
|
+ // 选择性别 TODO
|
|
function onChangeGender(e) {
|
|
function onChangeGender(e) {
|
|
state.model.gender = e.detail.value;
|
|
state.model.gender = e.detail.value;
|
|
}
|
|
}
|
|
- // 修改用户名
|
|
|
|
|
|
+
|
|
|
|
+ // 修改用户名 TODO
|
|
const onChangeUsername = () => {
|
|
const onChangeUsername = () => {
|
|
!state.model.verification?.username && showAuthModal('changeUsername');
|
|
!state.model.verification?.username && showAuthModal('changeUsername');
|
|
};
|
|
};
|
|
|
|
|
|
- // 修改手机号
|
|
|
|
|
|
+ // 修改手机号 TODO
|
|
const onChangeMobile = () => {
|
|
const onChangeMobile = () => {
|
|
showAuthModal('changeMobile');
|
|
showAuthModal('changeMobile');
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ // TODO 芋艿:
|
|
function onChooseAvatar(e) {
|
|
function onChooseAvatar(e) {
|
|
const tempUrl = e.detail.avatarUrl || '';
|
|
const tempUrl = e.detail.avatarUrl || '';
|
|
uploadAvatar(tempUrl);
|
|
uploadAvatar(tempUrl);
|
|
}
|
|
}
|
|
|
|
|
|
- //修改头像
|
|
|
|
|
|
+ // 修改头像 TODO
|
|
function onChangeAvatar() {
|
|
function onChangeAvatar() {
|
|
uni.chooseImage({
|
|
uni.chooseImage({
|
|
success: async (chooseImageRes) => {
|
|
success: async (chooseImageRes) => {
|
|
@@ -261,13 +264,14 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // TODO
|
|
async function uploadAvatar(tempUrl) {
|
|
async function uploadAvatar(tempUrl) {
|
|
if (!tempUrl) return;
|
|
if (!tempUrl) return;
|
|
let { path } = await sheep.$api.app.upload(tempUrl, 'ugc');
|
|
let { path } = await sheep.$api.app.upload(tempUrl, 'ugc');
|
|
state.model.avatar = path;
|
|
state.model.avatar = path;
|
|
}
|
|
}
|
|
|
|
|
|
- // 修改/设置密码
|
|
|
|
|
|
+ // 修改/设置密码 TODO
|
|
function onSetPassword() {
|
|
function onSetPassword() {
|
|
if (state.model.verification.password) {
|
|
if (state.model.verification.password) {
|
|
showAuthModal('changePassword');
|
|
showAuthModal('changePassword');
|
|
@@ -276,7 +280,7 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // 绑定第三方账号
|
|
|
|
|
|
+ // 绑定第三方账号 TODO
|
|
async function bindThirdOauth() {
|
|
async function bindThirdOauth() {
|
|
let result = await sheep.$platform.useProvider('wechat').bind();
|
|
let result = await sheep.$platform.useProvider('wechat').bind();
|
|
if (result) {
|
|
if (result) {
|
|
@@ -284,7 +288,7 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // 解绑第三方账号
|
|
|
|
|
|
+ // 解绑第三方账号 TODO
|
|
function unBindThirdOauth() {
|
|
function unBindThirdOauth() {
|
|
uni.showModal({
|
|
uni.showModal({
|
|
title: '解绑提醒',
|
|
title: '解绑提醒',
|
|
@@ -302,7 +306,7 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- // 保存信息
|
|
|
|
|
|
+ // 保存信息 TODO
|
|
async function onSubmit() {
|
|
async function onSubmit() {
|
|
// const { error, data } = await sheep.$api.user.update({
|
|
// const { error, data } = await sheep.$api.user.update({
|
|
// avatar: state.model.avatar,
|
|
// avatar: state.model.avatar,
|
|
@@ -319,13 +323,14 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // TODO
|
|
const getUserInfo = async () => {
|
|
const getUserInfo = async () => {
|
|
const userInfo = await sheep.$store('user').getInfo();
|
|
const userInfo = await sheep.$store('user').getInfo();
|
|
state.model = clone(userInfo);
|
|
state.model = clone(userInfo);
|
|
|
|
|
|
if (sheep.$platform.name !== 'H5') {
|
|
if (sheep.$platform.name !== 'H5') {
|
|
- return;
|
|
|
|
- // 这个先注释,要不然小程序保存个人信息有问题,
|
|
|
|
|
|
+ return;
|
|
|
|
+ // 这个先注释,要不然小程序保存个人信息有问题,
|
|
let { data, error } = await sheep.$api.user.thirdOauthInfo();
|
|
let { data, error } = await sheep.$api.user.thirdOauthInfo();
|
|
if (error === 0) {
|
|
if (error === 0) {
|
|
state.thirdOauthInfo = data;
|
|
state.thirdOauthInfo = data;
|
|
@@ -333,6 +338,7 @@
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ // TODO
|
|
onBeforeMount(async () => {
|
|
onBeforeMount(async () => {
|
|
getUserInfo();
|
|
getUserInfo();
|
|
});
|
|
});
|