1
This commit is contained in:
parent
cf9ea4751a
commit
e92f7e00da
@ -90,7 +90,7 @@
|
||||
</view>
|
||||
|
||||
<view class="service-grid">
|
||||
<view class="service-card card-1" @click="goDetail('neighborList')" hover-class="card-hover">
|
||||
<!-- <view class="service-card card-1" @click="goDetail('neighborList')" hover-class="card-hover">
|
||||
<view class="card-content">
|
||||
<text class="card-title">邻里互助</text>
|
||||
<text class="card-desc">近邻互帮互助</text>
|
||||
@ -107,6 +107,15 @@
|
||||
<view class="card-bg"></view>
|
||||
</view>
|
||||
<image class="card-icon" src="/static/imgs/index/weixiu.png" style="width: 80rpx;height: 80rpx;bottom: 32rpx;"></image>
|
||||
</view> -->
|
||||
<view class="service-card card-1" @click="goDetail('meetingList')" hover-class="card-hover">
|
||||
<view class="card-content">
|
||||
<text class="card-title">会客厅预约</text>
|
||||
<text class="card-desc">社区服务功能</text>
|
||||
<view class="card-bg"></view>
|
||||
</view>
|
||||
<image class="card-icon" src="/static/imgs/index/bangzhu.png"
|
||||
style="width: 68rpx;height: 68rpx; bottom: 48rpx;"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -160,6 +169,8 @@ export default {
|
||||
goDetail(page) {
|
||||
if(page==='neighbor'){
|
||||
navigateTo({url: `/pages/${page}/index`})
|
||||
}else if( page == 'serviceTickets'){
|
||||
uni.showToast({ title: '此功能暂未开放', icon: 'error' });
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url: `/pages/${page}/index`
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
<template>
|
||||
<view class="profile-page">
|
||||
<!-- 用户信息区域 -->
|
||||
<view class="user-info-card">
|
||||
<view class="user-info-card" @click="handleUserInfoClick">
|
||||
<view class="user-info">
|
||||
<view class="avatar-section">
|
||||
<view class="avatar-wrapper">
|
||||
<image class="avatar" :src="userInfo.avatarUrl || '/static/imgs/index/nav.png'"
|
||||
mode="aspectFill" @click="onAvatarClick"></image>
|
||||
<view class="edit-icon" @click="handleEditClick">
|
||||
mode="aspectFill"></image>
|
||||
<view class="edit-icon" v-if="isLogin" @click.stop="handleEditClick">
|
||||
<u-icon name="edit-pen" color="#fff" size="24"></u-icon>
|
||||
</view>
|
||||
<u-loading-icon v-if="uploading" mode="circle" color="#2979ff" size="28"></u-loading-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="name-section" @click="handleEditClick">
|
||||
<view class="name">{{userInfo.nickName || '未登录用户'}}</view>
|
||||
<view class="phone">{{userInfo.phone || ''}}</view>
|
||||
<view class="name-section">
|
||||
<view class="name">{{userInfo.nickName || '点击登录/注册'}}</view>
|
||||
<view class="phone">{{userInfo.phone || '登录后体验更多功能'}}</view>
|
||||
</view>
|
||||
<view class="description-card">
|
||||
<text class="title">个人简介</text>
|
||||
<text class="content">{{userInfo.bio || '这家伙很懒,什么都没有写~'}}</text>
|
||||
<text class="content">{{userInfo.bio || (isLogin ? '这家伙很懒,什么都没有写~' : '登录后可查看完整信息')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 功能按钮区域 -->
|
||||
<view class="function-card">
|
||||
<view class="button-item" v-for="(item, index) in choseList" :key="index" @click="goPage(item)">
|
||||
@ -33,42 +33,81 @@
|
||||
<u-icon name="arrow-right" color="#c8c9cc" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 修改用户信息弹窗 -->
|
||||
<u-modal :show="showEditModal" :title="isLogin ? '修改用户信息' : '手机号快捷登录'" :show-confirm-button="isLogin"
|
||||
:show-cancel-button="isLogin" @confirm="handleSubmit" @cancel="handleCancel" confirm-color="#2979ff"
|
||||
cancel-color="#606266">
|
||||
|
||||
<!-- 登录弹窗 - 仅在用户主动点击后显示 -->
|
||||
<u-modal :show="showLoginModal" title="手机号快捷登录" :show-confirm-button="false" :show-cancel-button="true"
|
||||
@cancel="showLoginModal = false" cancel-text="暂不登录" :closeOnClickOverlay="true">
|
||||
<view class="modal-content">
|
||||
<!-- 未登录时显示授权按钮 -->
|
||||
<view v-if="!isLogin" class="auth-section">
|
||||
<view class="auth-title">请先授权手机号以使用完整功能</view>
|
||||
<button v-if="!showPhoneButton" class="auth-button" open-type="getUserInfo"
|
||||
@getuserinfo="onGetUserInfo">
|
||||
<image class="auth-icon" src="/static/imgs/phone.png"></image>
|
||||
手机号快捷登录
|
||||
</button>
|
||||
<view class="auth-section">
|
||||
<view class="auth-title">请先阅读并同意相关协议</view>
|
||||
|
||||
<button class="auth-button"
|
||||
@click="showEditModal=false">
|
||||
|
||||
取消登录授权
|
||||
</button>
|
||||
|
||||
<button v-if="showPhoneButton" type="default" open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber" class="auth-button phone-button">
|
||||
<image class="phone-icon" src="/static/imgs/phone.png"></image>
|
||||
授权获取手机号
|
||||
</button>
|
||||
<view class="auth-agreement">
|
||||
<checkbox-group @change="handleAgreementChange">
|
||||
<label>
|
||||
<checkbox :checked="agreementChecked" color="#2979ff" style="transform:scale(0.7)"/>
|
||||
我已阅读并同意<text class="agreement-link" @click.stop="goToAgreement('userAgreement')">《用户协议》</text>和<text class="agreement-link" @click.stop="goToAgreement('agreement')">《隐私政策》</text>
|
||||
我已阅读并同意
|
||||
<text class="agreement-link" @click.stop="goToAgreement('userAgreement')">《用户协议》</text>
|
||||
和
|
||||
<text class="agreement-link" @click.stop="goToAgreement('agreement')">《隐私政策》</text>
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
|
||||
<button
|
||||
class="auth-button"
|
||||
:class="{ 'disabled': !agreementChecked }"
|
||||
:disabled="!agreementChecked"
|
||||
open-type="getUserInfo"
|
||||
@getuserinfo="onGetUserInfo">
|
||||
<image class="auth-icon" src="/static/imgs/phone.png"></image>
|
||||
微信用户一键登录
|
||||
</button>
|
||||
|
||||
<view class="auth-tip">
|
||||
登录表示您同意我们的用户协议和隐私政策
|
||||
</view>
|
||||
<!-- 已登录时显示编辑表单 -->
|
||||
<view v-else class="edit-section">
|
||||
</view>
|
||||
</view>
|
||||
</u-modal>
|
||||
|
||||
<!-- 手机号授权弹窗 -->
|
||||
<u-modal :show="showPhoneModal" title="绑定手机号" :show-confirm-button="false" :show-cancel-button="true"
|
||||
@cancel="showPhoneModal = false" cancel-text="暂不绑定" :closeOnClickOverlay="true">
|
||||
<view class="modal-content">
|
||||
<view class="auth-section">
|
||||
<view class="auth-title">为了提供更好的服务,请绑定手机号</view>
|
||||
|
||||
<view class="auth-agreement">
|
||||
<checkbox-group @change="handleAgreementChange">
|
||||
<label>
|
||||
<checkbox :checked="agreementChecked" color="#2979ff" style="transform:scale(0.7)"/>
|
||||
我已阅读并同意
|
||||
<text class="agreement-link" @click.stop="goToAgreement('userAgreement')">《用户协议》</text>
|
||||
和
|
||||
<text class="agreement-link" @click.stop="goToAgreement('agreement')">《隐私政策》</text>
|
||||
</label>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
|
||||
<button
|
||||
class="auth-button phone-button"
|
||||
:class="{ 'disabled': !agreementChecked }"
|
||||
:disabled="!agreementChecked"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber">
|
||||
<image class="phone-icon" src="/static/imgs/phone.png"></image>
|
||||
授权获取手机号
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</u-modal>
|
||||
|
||||
<!-- 修改用户信息弹窗 -->
|
||||
<u-modal :show="showEditModal" title="修改用户信息" :show-confirm-button="true"
|
||||
:show-cancel-button="true" @confirm="handleSubmit" @cancel="showEditModal = false" confirm-color="#2979ff"
|
||||
cancel-color="#606266">
|
||||
<view class="modal-content">
|
||||
<view class="edit-section">
|
||||
<view class="form-item">
|
||||
<text class="form-label">头像:</text>
|
||||
<view class="avatar-upload-container" @click="onAvatarClick">
|
||||
@ -104,6 +143,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</u-modal>
|
||||
|
||||
<u-modal
|
||||
:show="showPhoneDialog"
|
||||
title="联系社区"
|
||||
@ -117,6 +157,7 @@
|
||||
<text class="phone-number">{{communityPhone}}</text>
|
||||
</view>
|
||||
</u-modal>
|
||||
|
||||
<Copyright/>
|
||||
<Footer></Footer>
|
||||
</view>
|
||||
@ -133,6 +174,7 @@
|
||||
IMAGE_BASE_URL,
|
||||
BASE_URL
|
||||
} from '@/utils/config';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Footer,Copyright
|
||||
@ -140,8 +182,11 @@
|
||||
data() {
|
||||
return {
|
||||
isLogin: false,
|
||||
showEditModal: false,
|
||||
showPhoneButton: false,
|
||||
showLoginModal: false, // 登录弹窗
|
||||
showPhoneModal: false, // 手机号绑定弹窗
|
||||
showEditModal: false, // 编辑信息弹窗
|
||||
showPhoneDialog: false, // 联系社区弹窗
|
||||
agreementChecked: false, // 协议勾选状态
|
||||
avatarList: [],
|
||||
formData: {
|
||||
name: "",
|
||||
@ -155,116 +200,56 @@
|
||||
},
|
||||
uploading: false,
|
||||
displayAvatar: '/static/imgs/index/nav.png',
|
||||
agreementChecked: false,
|
||||
choseList: [{
|
||||
key: 1,
|
||||
url: "/static/imgs/service/service_list.png",
|
||||
name: '全部工单',
|
||||
pageUrl: 'myTickets'
|
||||
},
|
||||
choseList: [
|
||||
{
|
||||
key: 2,
|
||||
url: "/static/imgs/service/service_help.png",
|
||||
name: '邻里互助',
|
||||
pageUrl: 'mySeekHelp'
|
||||
key: 4,
|
||||
url: "/static/imgs/service/service_friend.png",
|
||||
name: '会客厅预约',
|
||||
pageUrl: 'meetingList',
|
||||
needLogin: true // 标记需要登录的功能
|
||||
},
|
||||
{
|
||||
key: 3,
|
||||
url: "/static/imgs/service/service_service.png",
|
||||
name: '周边服务',
|
||||
pageUrl: 'neighbor'
|
||||
},
|
||||
{
|
||||
key: 4,
|
||||
url: "/static/imgs/service/service_friend.png",
|
||||
name: '会客厅预约',
|
||||
pageUrl: 'meetingList'
|
||||
pageUrl: 'neighbor',
|
||||
needLogin: true
|
||||
},
|
||||
{
|
||||
key: 5,
|
||||
url: "/static/imgs/service/service_notice.png",
|
||||
name: '设置'
|
||||
name: '设置',
|
||||
needLogin: true
|
||||
},
|
||||
{
|
||||
key: 6,
|
||||
url: "/static/imgs/service/service_phone.png",
|
||||
name: '联系社区',
|
||||
needLogin: false
|
||||
},
|
||||
{
|
||||
key: 7,
|
||||
url: "/static/imgs/service/service_xieyi.png",
|
||||
name: '用户协议',
|
||||
pageUrl: 'userAgreement'
|
||||
pageUrl: 'userAgreement',
|
||||
needLogin: false
|
||||
},
|
||||
{
|
||||
key: 8,
|
||||
url: "/static/imgs/service/service_zhengce.png",
|
||||
name: '隐私政策',
|
||||
pageUrl: 'agreement'
|
||||
pageUrl: 'agreement',
|
||||
needLogin: false
|
||||
}
|
||||
],
|
||||
communityPhone: '0513-59000051',
|
||||
showPhoneDialog: false
|
||||
wxCode: '' // 存储微信登录code
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
// 新增:协议勾选状态变化
|
||||
handleAgreementChange(e) {
|
||||
this.agreementChecked = e.detail.value.length > 0;
|
||||
},
|
||||
|
||||
// 新增:跳转到协议页面
|
||||
goToAgreement(type) {
|
||||
if (type === 'user') {
|
||||
uni.navigateTo({
|
||||
url: '/pages/userAgreement/index'
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: '/pages/agreement/index'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 点击头像触发上传
|
||||
onAvatarClick() {
|
||||
if (!this.isLogin) {
|
||||
this.showEditModal = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.uploading) return;
|
||||
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
if (tempFilePaths && tempFilePaths.length > 0) {
|
||||
const file = {
|
||||
url: tempFilePaths[0]
|
||||
};
|
||||
this.handleAvatarUpload({ file });
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('选择图片失败', err);
|
||||
uni.showToast({
|
||||
title: '选择图片失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handleCloseModal() {
|
||||
this.showPhoneDialog = false;
|
||||
},
|
||||
|
||||
// 初始化数据
|
||||
async initData() {
|
||||
const token = uni.getStorageSync('token');
|
||||
@ -287,48 +272,19 @@
|
||||
}
|
||||
},
|
||||
|
||||
// 更新用户信息
|
||||
updateUserInfo(data) {
|
||||
const avatarUrl = data.avatar ? `${IMAGE_BASE_URL}${data.avatar}` : '/static/imgs/index/nav.png';
|
||||
this.userInfo = {
|
||||
nickName: data.name || data.nickName || '未命名用户',
|
||||
avatarUrl: avatarUrl,
|
||||
bio: data.introduce || data.bio || '这家伙很懒,什么都没有写~',
|
||||
phone: data.phone || ''
|
||||
};
|
||||
this.displayAvatar = this.userInfo.avatarUrl;
|
||||
this.formData = {
|
||||
name: this.userInfo.nickName,
|
||||
bio: this.userInfo.bio
|
||||
};
|
||||
if (this.userInfo.avatarUrl) {
|
||||
this.avatarList = [{
|
||||
url: this.userInfo.avatarUrl
|
||||
}];
|
||||
// 点击用户信息区域
|
||||
handleUserInfoClick() {
|
||||
if (!this.isLogin) {
|
||||
this.showLoginModal = true;
|
||||
this.agreementChecked = false; // 重置协议勾选
|
||||
}
|
||||
},
|
||||
|
||||
// 清除用户数据
|
||||
clearUserData() {
|
||||
this.isLogin = false;
|
||||
this.userInfo = {
|
||||
nickName: '未登录用户',
|
||||
avatarUrl: '/static/imgs/index/nav.png',
|
||||
bio: '这家家伙很懒,什么都没有写~'
|
||||
};
|
||||
this.formData = {
|
||||
name: '',
|
||||
bio: ''
|
||||
};
|
||||
this.avatarList = [];
|
||||
uni.removeStorageSync('token');
|
||||
uni.removeStorageSync('userInfo');
|
||||
},
|
||||
|
||||
// 处理编辑点击
|
||||
handleEditClick() {
|
||||
if (!this.isLogin) {
|
||||
this.showEditModal = true;
|
||||
this.showLoginModal = true;
|
||||
this.agreementChecked = false;
|
||||
return;
|
||||
}
|
||||
this.formData = {
|
||||
@ -345,7 +301,19 @@
|
||||
this.showEditModal = true;
|
||||
},
|
||||
|
||||
// 获取用户信息 - 修改方法名和逻辑
|
||||
// 协议勾选状态变化
|
||||
handleAgreementChange(e) {
|
||||
this.agreementChecked = e.detail.value.length > 0;
|
||||
},
|
||||
|
||||
// 跳转到协议页面
|
||||
goToAgreement(type) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/${type}/index`
|
||||
});
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
onGetUserInfo(e) {
|
||||
if (!this.agreementChecked) {
|
||||
uni.showToast({
|
||||
@ -364,19 +332,20 @@
|
||||
title: '您拒绝了授权',
|
||||
icon: 'none'
|
||||
});
|
||||
this.showEditModal = false;
|
||||
}
|
||||
},
|
||||
|
||||
// 微信登录获取code - 修改方法名
|
||||
// 微信登录
|
||||
wxLogin() {
|
||||
uni.showLoading({
|
||||
title: '登录中...'
|
||||
});
|
||||
this.showEditModal = false;
|
||||
this.showLoginModal = false;
|
||||
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (loginRes) => {
|
||||
this.wxCode = loginRes.code;
|
||||
this.sendLoginRequest(loginRes.code);
|
||||
},
|
||||
fail: (err) => {
|
||||
@ -398,12 +367,12 @@
|
||||
});
|
||||
if (res.success) {
|
||||
uni.setStorageSync('token', res.data.access_token);
|
||||
|
||||
// 检查是否需要绑定手机号
|
||||
if (!res.data.phone) {
|
||||
this.showPhoneButton = true;
|
||||
uni.showToast({
|
||||
title: '请授权获取手机号',
|
||||
icon: 'none'
|
||||
});
|
||||
this.showPhoneModal = true;
|
||||
this.agreementChecked = false;
|
||||
uni.hideLoading();
|
||||
} else {
|
||||
await this.loginComplete(res.data);
|
||||
}
|
||||
@ -441,12 +410,14 @@
|
||||
uni.showLoading({
|
||||
title: '获取手机号中...'
|
||||
});
|
||||
|
||||
try {
|
||||
const res = await post('/api/v1/app_auth/weixin/bind_phone', {
|
||||
code: e.detail.code
|
||||
});
|
||||
if (res.success) {
|
||||
await this.loginComplete(res.data);
|
||||
this.showPhoneModal = false;
|
||||
} else {
|
||||
throw new Error(res.message || '绑定手机号失败');
|
||||
}
|
||||
@ -463,13 +434,12 @@
|
||||
// 登录完成处理
|
||||
async loginComplete(data) {
|
||||
try {
|
||||
this.showEditModal = false;
|
||||
const res = await get('/api/v1/app_auth/mine');
|
||||
if (res && res.success) {
|
||||
uni.setStorageSync('userInfo', res.data);
|
||||
this.updateUserInfo(res.data);
|
||||
this.isLogin = true;
|
||||
this.showPhoneButton = false;
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '登录成功'
|
||||
});
|
||||
@ -477,6 +447,7 @@
|
||||
throw new Error(res.message || '获取用户信息失败');
|
||||
}
|
||||
} catch (err) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '登录失败: ' + err.message,
|
||||
icon: 'none'
|
||||
@ -485,16 +456,81 @@
|
||||
}
|
||||
},
|
||||
|
||||
// 上传头像
|
||||
async handleAvatarUpload(event) {
|
||||
// 更新用户信息
|
||||
updateUserInfo(data) {
|
||||
const avatarUrl = data.avatar ? `${IMAGE_BASE_URL}${data.avatar}` : '/static/imgs/index/nav.png';
|
||||
this.userInfo = {
|
||||
nickName: data.name || data.nickName || '未命名用户',
|
||||
avatarUrl: avatarUrl,
|
||||
bio: data.introduce || data.bio || '这家伙很懒,什么都没有写~',
|
||||
phone: data.phone || ''
|
||||
};
|
||||
this.displayAvatar = this.userInfo.avatarUrl;
|
||||
this.formData = {
|
||||
name: this.userInfo.nickName,
|
||||
bio: this.userInfo.bio
|
||||
};
|
||||
if (this.userInfo.avatarUrl) {
|
||||
this.avatarList = [{
|
||||
url: this.userInfo.avatarUrl
|
||||
}];
|
||||
}
|
||||
},
|
||||
|
||||
// 清除用户数据
|
||||
clearUserData() {
|
||||
this.isLogin = false;
|
||||
this.userInfo = {
|
||||
nickName: '点击登录/注册',
|
||||
avatarUrl: '/static/imgs/index/nav.png',
|
||||
bio: '登录后可查看完整信息',
|
||||
phone: ''
|
||||
};
|
||||
this.formData = {
|
||||
name: '',
|
||||
bio: ''
|
||||
};
|
||||
this.avatarList = [];
|
||||
},
|
||||
|
||||
// 点击头像上传
|
||||
onAvatarClick() {
|
||||
if (!this.isLogin) {
|
||||
this.showEditModal = true;
|
||||
this.showLoginModal = true;
|
||||
this.agreementChecked = false;
|
||||
return;
|
||||
}
|
||||
const {
|
||||
file
|
||||
} = event;
|
||||
|
||||
if (this.uploading) return;
|
||||
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
const tempFilePaths = res.tempFilePaths;
|
||||
if (tempFilePaths && tempFilePaths.length > 0) {
|
||||
const file = {
|
||||
url: tempFilePaths[0]
|
||||
};
|
||||
this.handleAvatarUpload({ file });
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('选择图片失败', err);
|
||||
uni.showToast({
|
||||
title: '选择图片失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 上传头像
|
||||
async handleAvatarUpload(event) {
|
||||
const { file } = event;
|
||||
if (!file || !file.url) return;
|
||||
|
||||
this.uploading = true;
|
||||
try {
|
||||
const fileInfo = await new Promise((resolve, reject) => {
|
||||
@ -504,9 +540,11 @@
|
||||
fail: reject
|
||||
});
|
||||
});
|
||||
|
||||
if (fileInfo.size > 3 * 1024 * 1024) {
|
||||
throw new Error('图片大小不能超过3MB');
|
||||
}
|
||||
|
||||
const avatarUrl = await this.uploadAvatar(file.url);
|
||||
await this.updateUserAvatar(avatarUrl);
|
||||
uni.showToast({
|
||||
@ -560,6 +598,7 @@
|
||||
introduce: this.formData.bio,
|
||||
name: this.formData.name
|
||||
});
|
||||
|
||||
const res = await get('/api/v1/app_auth/mine');
|
||||
if (res && res.success) {
|
||||
uni.setStorageSync('userInfo', res.data);
|
||||
@ -597,15 +636,14 @@
|
||||
// 提交表单
|
||||
async handleSubmit() {
|
||||
if (!this.isLogin) return;
|
||||
const {
|
||||
name,
|
||||
bio
|
||||
} = this.formData;
|
||||
|
||||
const { name, bio } = this.formData;
|
||||
|
||||
let avatarUrl = this.avatarList.length > 0 ? this.avatarList[0].url : "";
|
||||
if (avatarUrl && avatarUrl.includes(IMAGE_BASE_URL)) {
|
||||
avatarUrl = avatarUrl.replace(IMAGE_BASE_URL, '');
|
||||
}
|
||||
|
||||
if (!name) {
|
||||
uni.showToast({
|
||||
title: '请输入姓名',
|
||||
@ -613,15 +651,18 @@
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: '提交中...'
|
||||
});
|
||||
|
||||
try {
|
||||
await post('/api/v1/app_auth/bind', {
|
||||
avatar: avatarUrl,
|
||||
introduce: bio,
|
||||
name: name
|
||||
});
|
||||
|
||||
const res = await get('/api/v1/app_auth/mine');
|
||||
if (res && res.success) {
|
||||
uni.setStorageSync('userInfo', res.data);
|
||||
@ -644,25 +685,28 @@
|
||||
}
|
||||
},
|
||||
|
||||
// 取消修改
|
||||
handleCancel() {
|
||||
this.showEditModal = false;
|
||||
},
|
||||
|
||||
// 跳转页面
|
||||
goPage(item) {
|
||||
// 联系社区
|
||||
if (item.key === 6) {
|
||||
this.handleContactCommunity();
|
||||
return;
|
||||
}
|
||||
|
||||
// 需要登录的功能
|
||||
if (item.needLogin && !this.isLogin) {
|
||||
this.showLoginModal = true;
|
||||
this.agreementChecked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置按钮
|
||||
if (item.key === 5) {
|
||||
this.handleEditClick();
|
||||
return;
|
||||
}
|
||||
if (!this.checkLogin()) {
|
||||
this.showEditModal = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// 协议页面(不需要登录)
|
||||
if (item.pageUrl) {
|
||||
uni.navigateTo({
|
||||
url: `/pages/${item.pageUrl}/index`
|
||||
@ -670,10 +714,11 @@
|
||||
}
|
||||
},
|
||||
|
||||
// 处理联系社区点击
|
||||
// 处理联系社区
|
||||
handleContactCommunity() {
|
||||
if (!this.checkLogin()) {
|
||||
this.showEditModal = true;
|
||||
if (!this.isLogin) {
|
||||
this.showLoginModal = true;
|
||||
this.agreementChecked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -706,19 +751,6 @@
|
||||
}
|
||||
});
|
||||
this.showPhoneDialog = false;
|
||||
},
|
||||
|
||||
// 检查登录状态
|
||||
checkLogin() {
|
||||
const token = uni.getStorageSync('token');
|
||||
if (!token) {
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -732,24 +764,29 @@
|
||||
box-sizing: border-box;
|
||||
padding-bottom: calc(100rpx + 50rpx);
|
||||
}
|
||||
|
||||
.user-info-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 40rpx 30rpx;
|
||||
margin-bottom: 24rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-section {
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.avatar-wrapper {
|
||||
position: relative;
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
|
||||
.avatar {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@ -757,6 +794,7 @@
|
||||
border: 4rpx solid #fff;
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.edit-icon {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
@ -770,81 +808,81 @@
|
||||
justify-content: center;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.u-loading-icon {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.3);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.name-section {
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
.name {
|
||||
font-size: 36rpx;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.phone {
|
||||
color: #999;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.description-card {
|
||||
background: #f8f9fa;
|
||||
border-radius: 12rpx;
|
||||
padding: 24rpx;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #666;
|
||||
margin-bottom: 12rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.content {
|
||||
font-size: 26rpx;
|
||||
color: #999;
|
||||
line-height: 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
.function-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
padding: 0 30rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
|
||||
|
||||
.button-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 28rpx 0;
|
||||
border-bottom: 1rpx solid #f2f3f5;
|
||||
|
||||
&:active {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.button-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.icon {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
margin-right: 24rpx;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 30rpx;
|
||||
color: #333;
|
||||
@ -852,51 +890,41 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
padding: 0 30rpx;
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
max-height: 70vh;
|
||||
overflow-y: auto;
|
||||
/* 编辑表单区域 */
|
||||
.edit-section {
|
||||
padding: 20rpx 0;
|
||||
.form-item {
|
||||
margin-bottom: 40rpx;
|
||||
.form-label {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: #606266;
|
||||
margin-bottom: 16rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
.upload-tip {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.word-count {
|
||||
text-align: right;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 授权登录区域 - 修改相关文案和图标 */
|
||||
|
||||
// 授权登录区域
|
||||
.auth-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40rpx 0;
|
||||
|
||||
.auth-title {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
margin-bottom: 40rpx;
|
||||
margin-bottom: 30rpx;
|
||||
text-align: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.auth-agreement {
|
||||
margin-bottom: 30rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
|
||||
.agreement-link {
|
||||
color: #2979ff;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
|
||||
.auth-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -912,6 +940,11 @@
|
||||
box-sizing: border-box;
|
||||
box-shadow: 0 4rpx 12rpx rgba(41, 121, 255, 0.3);
|
||||
|
||||
&.disabled {
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
@ -925,25 +958,44 @@
|
||||
}
|
||||
|
||||
.phone-button {
|
||||
background: #07C160; /* 微信绿色,保持原有成功色 */
|
||||
background: #07C160;
|
||||
}
|
||||
.auth-agreement {
|
||||
margin-top: 20rpx;
|
||||
|
||||
.auth-tip {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
.agreement-link {
|
||||
color: #2979ff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.phone-dialog-content {
|
||||
padding: 40rpx;
|
||||
color: #999;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
.phone-number {
|
||||
font-weight: bold;
|
||||
color: #2979ff;
|
||||
margin-left: 10rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 编辑表单区域
|
||||
.edit-section {
|
||||
padding: 20rpx 0;
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.form-label {
|
||||
display: block;
|
||||
font-size: 28rpx;
|
||||
color: #606266;
|
||||
margin-bottom: 16rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.upload-tip {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.word-count {
|
||||
text-align: right;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1004,4 +1056,16 @@
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
.phone-dialog-content {
|
||||
padding: 40rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
|
||||
.phone-number {
|
||||
font-weight: bold;
|
||||
color: #2979ff;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -484,7 +484,7 @@
|
||||
.applyInfo)
|
||||
console.log("===response", response)
|
||||
if (!response || !response.success) {
|
||||
throw new Error('会议室预定失败');
|
||||
throw new Error(response.msg);
|
||||
}
|
||||
if (response.success == true) {
|
||||
uni.redirectTo({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user