冲突合并
This commit is contained in:
commit
643146c888
|
|
@ -3,10 +3,12 @@ import request from '@/utils/request';
|
|||
// 登录方法
|
||||
export function login(data) {
|
||||
return request({
|
||||
url: '/login/appUserLogin', // login - ruoyi
|
||||
url: '/auth/login', // login - ruoyi
|
||||
// url: '/login/appUserLogin', // login - ruoyi
|
||||
headers: {
|
||||
isToken: false,
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
isForm: false,
|
||||
// 'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
method: 'post',
|
||||
data
|
||||
|
|
|
|||
|
|
@ -2,14 +2,13 @@ import upload from '@/utils/upload'
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 用户密码重置
|
||||
export function updateUserPwd(oldPassword, newPassword) {
|
||||
export function updateUserPwd(password) {
|
||||
const data = {
|
||||
oldPassword,
|
||||
newPassword
|
||||
password
|
||||
}
|
||||
return request({
|
||||
url: '/system/user/profile/updatePwd',
|
||||
method: 'put',
|
||||
url: '/system/user/confirmPassword',
|
||||
method: 'post',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
|
@ -17,7 +16,7 @@ export function updateUserPwd(oldPassword, newPassword) {
|
|||
// 查询用户个人信息
|
||||
export function getUserProfile() {
|
||||
return request({
|
||||
url: '/system/user/profile',
|
||||
url: '/system/user/getInfo',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
|
@ -25,8 +24,8 @@ export function getUserProfile() {
|
|||
// 修改用户个人信息
|
||||
export function updateUserProfile(data) {
|
||||
return request({
|
||||
url: '/system/user/profile',
|
||||
method: 'put',
|
||||
url: '/system/user/edit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,16 @@
|
|||
module.exports = {
|
||||
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
|
||||
// baseUrl: 'http://192.168.0.39:21995',
|
||||
baseUrl: 'http://192.168.0.14:21520',
|
||||
// #ifdef H5
|
||||
baseUrl: '/dev-api',
|
||||
// #endif
|
||||
// #ifdef APP-PLUS
|
||||
baseUrl: 'http://192.168.2.47:58080',
|
||||
// #endif
|
||||
// baseUrl: 'http://localhost:8080',
|
||||
uploadFileUrl: '/app/common/appUploadFile',
|
||||
// fileUrl: 'http://192.168.0.39:21995/statics', // 图片预览
|
||||
fileUrl: 'http://192.168.0.14:21520/statics', // 图片预览
|
||||
fileUrl: 'http://192.168.2.47:58080/statics', // 图片预览
|
||||
// 应用信息
|
||||
appInfo: {
|
||||
// 应用名称
|
||||
|
|
|
|||
|
|
@ -71,8 +71,19 @@
|
|||
"h5" : {
|
||||
"template" : "static/index.html",
|
||||
"devServer" : {
|
||||
"https" : false,
|
||||
"disableHostCheck" : true,
|
||||
"port" : 9090,
|
||||
"https" : false
|
||||
"proxy" : {
|
||||
"/dev-api" : {
|
||||
"target" : "http://192.168.2.47:58080",
|
||||
"changeOrigin" : true,
|
||||
"secure" : false,
|
||||
"pathRewrite" : {
|
||||
"^/dev-api" : ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"title" : "贵州安全工机具",
|
||||
"router" : {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
{
|
||||
"path": "pages/mine/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
"navigationBarTitleText": "我的"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -227,6 +227,13 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": "订单结算"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/mine/me/changePassword",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText" : "修改密码"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
|
|
|||
|
|
@ -67,10 +67,8 @@ export default {
|
|||
register: false,
|
||||
globalConfig: getApp().globalData.config,
|
||||
loginForm: {
|
||||
username: uni.getStorageSync('remember') ? uni.getStorageSync('remember').username : 'bns', // 账号
|
||||
password: uni.getStorageSync('remember')
|
||||
? uni.getStorageSync('remember').password
|
||||
: '1769fb2837e10e9d22c1c25add76355a', // 密码 1769fb2837e10e9d22c1c25add76355a', // bns - 1769fb2837e10e9d22c1c25add76355a
|
||||
username: uni.getStorageSync('remember') ? uni.getStorageSync('remember').username : 'admin', // 账号
|
||||
password: uni.getStorageSync('remember') ? uni.getStorageSync('remember').password : 'Bonus$2026', // 密码 1769fb2837e10e9d22c1c25add76355a', // bns - 1769fb2837e10e9d22c1c25add76355a
|
||||
code: '',
|
||||
uuid: ''
|
||||
},
|
||||
|
|
@ -115,8 +113,8 @@ export default {
|
|||
// this.$modal.msgError("请输入验证码")
|
||||
} else {
|
||||
// this.$modal.loading('登录中,请耐心等待...')
|
||||
this.$tab.reLaunch('/pages/system')
|
||||
// this.pwdLogin()
|
||||
// this.$tab.reLaunch('/pages/system')
|
||||
this.pwdLogin()
|
||||
}
|
||||
},
|
||||
// 密码登录
|
||||
|
|
|
|||
|
|
@ -1,181 +1,286 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
<!-- 顶部标题 -->
|
||||
<view class="header">
|
||||
<view class="container">
|
||||
<!-- 顶部标题 -->
|
||||
<!-- <view class="header">
|
||||
<text class="title">我的</text>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<!-- 用户信息区域 -->
|
||||
<view class="user-info">
|
||||
<view class="avatar-wrapper">
|
||||
<image class="avatar" src="/static/images/my/face.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
<view class="user-detail">
|
||||
<text class="username">冯武鹏</text>
|
||||
</view>
|
||||
<view class="star-icon">
|
||||
<uni-icons type="star" size="24" color="#ff9900"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 用户信息区域 -->
|
||||
<view class="user-info">
|
||||
<view class="avatar-wrapper">
|
||||
<image class="avatar" @click="avatarClick()" :src="userInfo.avatar" mode="aspectFill" @error="avatarError"></image>
|
||||
</view>
|
||||
<view class="user-detail">
|
||||
<text class="username">{{userInfo.nickName}}</text>
|
||||
</view>
|
||||
<view class="star-icon">
|
||||
<uni-icons type="star" size="24" color="#ff9900"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 我的服务区域 -->
|
||||
<view class="services">
|
||||
<text class="services-title">我的服务</text>
|
||||
<view class="grid-container">
|
||||
<!-- 个人信息 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/mine/me/index')">
|
||||
<!-- 我的服务区域 -->
|
||||
<view class="services">
|
||||
<text class="services-title">我的服务</text>
|
||||
<view class="grid-container">
|
||||
<!-- 个人信息 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/mine/me/index')">
|
||||
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="person" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/notice.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">个人信息</text>
|
||||
</view>
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="person" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/notice.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">个人信息</text>
|
||||
</view>
|
||||
|
||||
<!-- 通知公告 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/mine/announcement/index')">
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="notification" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/notice.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">通知公告</text>
|
||||
</view>
|
||||
<!-- 通知公告 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/mine/announcement/index')">
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="notification" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/notice.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">通知公告</text>
|
||||
</view>
|
||||
|
||||
<!-- 投诉建议 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/feedback/index')">
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="chat" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/complaints.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">投诉建议</text>
|
||||
</view>
|
||||
<!-- 投诉建议 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/feedback/index')">
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="chat" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/complaints.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">投诉建议</text>
|
||||
</view>
|
||||
|
||||
<!-- 食堂评价 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/review/index')">
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="star" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/evaluation.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">食堂评价</text>
|
||||
</view>
|
||||
<!-- 食堂评价 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/review/index')">
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="star" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/evaluation.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">食堂评价</text>
|
||||
</view>
|
||||
|
||||
<!-- 体检报告 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/survey/index')">
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="help" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/report.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">体检报告</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 体检报告 -->
|
||||
<view class="grid-item" @click="navigateTo('/pages/survey/index')">
|
||||
<view class="icon-wrapper">
|
||||
<!-- <uni-icons type="help" size="24" color="#666"></uni-icons>-->
|
||||
<image style="width: 28px;height: 28px;" src="/static/images/my/report.png"></image>
|
||||
</view>
|
||||
<text class="icon-text">体检报告</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-action-sheet :actions="list" :show="avatarShow" safeAreaInsetBottom closeOnClickOverlay cancelText="取消"
|
||||
round="10" @close="avatarShow = false" @select="avatarSelect"></u-action-sheet>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
methods: {
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
import {
|
||||
getUserProfile,
|
||||
uploadAvatar
|
||||
} from "@/api/system/user"
|
||||
import config from '@/config'
|
||||
import { getToken } from '@/utils/auth'
|
||||
import { showConfirm } from '@/utils/common'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userInfo: {},
|
||||
defaultImg: '/static/images/my/face.png',
|
||||
avatarShow: false,
|
||||
list: [{
|
||||
name: '上传头像',
|
||||
val: 1
|
||||
}, {
|
||||
name: '查看头像',
|
||||
val: 2
|
||||
}]
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.userInfo = uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo') : {}
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
avatarClick() {
|
||||
this.avatarShow = true
|
||||
},
|
||||
|
||||
avatarSelect(e) {
|
||||
if (e.val == 1) {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success: chooseImageRes => {
|
||||
uni.showLoading({
|
||||
title: '上传中...'
|
||||
})
|
||||
uni.uploadFile({
|
||||
url: config.baseUrl + '/system/user/profile/avatar',
|
||||
filePath: chooseImageRes.tempFilePaths[0],
|
||||
name: 'avatarfile',
|
||||
header: {
|
||||
'Authorization': 'Bearer ' + getToken()
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
console.log(uploadFileRes);
|
||||
if(uploadFileRes.statusCode == 200) {
|
||||
let reslut = JSON.parse(uploadFileRes.data)
|
||||
console.log('reslut',reslut)
|
||||
if(reslut.code == 200) {
|
||||
uni.showToast({ title: reslut.msg,icon: 'none' });
|
||||
this.getUserInfo()
|
||||
}else{
|
||||
uni.showToast({ title: reslut.msg,icon: 'none' });
|
||||
}
|
||||
}else if(uploadFileRes.statusCode == 401) {
|
||||
showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => {
|
||||
if (res.confirm) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
}
|
||||
})
|
||||
}else{
|
||||
uni.showToast({ title: uploadFileRes.errMsg,icon: 'none' });
|
||||
}
|
||||
uni.hideLoading()
|
||||
},
|
||||
fail: (uploadFileErr) => {
|
||||
let { message } = uploadFileErr
|
||||
if (message == 'Network Error') {
|
||||
message = '后端接口连接异常'
|
||||
} else if (message.includes('timeout')) {
|
||||
message = '系统接口请求超时'
|
||||
} else if (message.includes('Request failed with status code')) {
|
||||
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||
}
|
||||
uni.showToast({ title: message,icon: 'none' });
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else if(e.val == 2) {
|
||||
uni.previewImage({
|
||||
urls: [this.userInfo.avatar]
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
getUserInfo() {
|
||||
getUserProfile().then(res => {
|
||||
this.userInfo = res.user
|
||||
if(!this.userInfo.avatar) {
|
||||
this.userInfo.avatar = this.defaultImg
|
||||
}
|
||||
console.log('this.userInfo',this.userInfo)
|
||||
uni.setStorageSync('userInfo', this.userInfo)
|
||||
})
|
||||
},
|
||||
|
||||
avatarError(e) {
|
||||
console.log(e)
|
||||
if (e.type == 'error') {
|
||||
this.userInfo.avatar = this.defaultImg
|
||||
}
|
||||
},
|
||||
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
min-height: 10vh;
|
||||
background-color: #F9FBFF;
|
||||
}
|
||||
.container {
|
||||
min-height: 10vh;
|
||||
background-color: #F9FBFF;
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 14px 16px 16px;
|
||||
background: #F9FBFF;
|
||||
.header {
|
||||
padding: 14px 16px 16px;
|
||||
background: #F9FBFF;
|
||||
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.title {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
background: #fff;
|
||||
margin-bottom: 10px;
|
||||
.user-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
background: #fff;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.avatar-wrapper {
|
||||
margin-right: 12px;
|
||||
.avatar-wrapper {
|
||||
margin-right: 12px;
|
||||
|
||||
.avatar {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 30px;
|
||||
}
|
||||
}
|
||||
.avatar {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.user-detail {
|
||||
flex: 1;
|
||||
.user-detail {
|
||||
flex: 1;
|
||||
|
||||
.username {
|
||||
margin-left: 12px;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
.username {
|
||||
margin-left: 12px;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
}
|
||||
|
||||
.star-icon {
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
.star-icon {
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.services {
|
||||
background: #fff;
|
||||
padding: 16px;
|
||||
.services {
|
||||
background: #fff;
|
||||
padding: 16px;
|
||||
|
||||
.services-title {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
margin-bottom: 26px;
|
||||
.services-title {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
margin-bottom: 26px;
|
||||
|
||||
font-weight: 400;
|
||||
}
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.grid-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 20px;
|
||||
.grid-container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 20px;
|
||||
|
||||
.grid-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.grid-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.icon-wrapper {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
//border-radius: 24px;
|
||||
//background: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.icon-text {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
.icon-wrapper {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
//border-radius: 24px;
|
||||
//background: #f5f5f5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.icon-text {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,175 +1,295 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
<!-- 顶部导航栏 -->
|
||||
<!-- <view class="header">-->
|
||||
<!-- <view class="back-icon" @click="goBack">-->
|
||||
<!-- <image class="icon" :src="require('@/static/images/icons/back.png')" mode="aspectFit"></image>-->
|
||||
<!-- </view>-->
|
||||
<!-- <text class="title">基本信息</text>-->
|
||||
<!-- </view>-->
|
||||
<view class="container">
|
||||
<!-- 顶部导航栏 -->
|
||||
<!-- <view class="header">-->
|
||||
<!-- <view class="back-icon" @click="goBack">-->
|
||||
<!-- <image class="icon" :src="require('@/static/images/icons/back.png')" mode="aspectFit"></image>-->
|
||||
<!-- </view>-->
|
||||
<!-- <text class="title">基本信息</text>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<!-- 个人信息表单 -->
|
||||
<view class="form-container">
|
||||
<!-- 头像区域 -->
|
||||
<view class="avatar-section" @click="handleUpdateAvatar">
|
||||
<image class="avatar" :src="userInfo.avatar" mode="aspectFill"></image>
|
||||
<view class="camera-icon">
|
||||
<image class="icon" :src="require('@/static/images/my/camera.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 个人信息表单 -->
|
||||
<view class="form-container">
|
||||
<!-- 头像区域 -->
|
||||
<view class="avatar-section" @click="handleUpdateAvatar">
|
||||
<image class="avatar" :src="userInfo.avatar ? userInfo.avatar : defaultFace" mode="aspectFill"></image>
|
||||
<view class="camera-icon">
|
||||
<image class="icon" :src="require('@/static/images/my/camera.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 信息列表 -->
|
||||
<view class="info-list">
|
||||
<!-- 姓名 -->
|
||||
<view class="info-item" @click="navigateTo('/pages/edit-name/index')">
|
||||
<text class="label">姓名</text>
|
||||
<view class="value-wrapper">
|
||||
<text class="value">冯武鹏</text>
|
||||
<image class="arrow-icon" :src="require('@/static/images/my/enter.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 信息列表 -->
|
||||
<view class="info-list">
|
||||
<!-- 姓名 -->
|
||||
<view class="info-item">
|
||||
<text class="label">姓名</text>
|
||||
<view class="value-wrapper">
|
||||
<text class="value">{{userInfo.nickName}}</text>
|
||||
<image class="arrow-icon" :src="require('@/static/images/my/enter.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 手机号 -->
|
||||
<view class="info-item" @click="navigateTo('/pages/mine/me/bindingPhone')">
|
||||
<text class="label">手机号</text>
|
||||
<view class="value-wrapper">
|
||||
<text class="value">18407028572</text>
|
||||
<image class="arrow-icon" :src="require('@/static/images/my/enter.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 手机号 -->
|
||||
<view class="info-item" @click="navigateTo('/pages/mine/me/bindingPhone')">
|
||||
<text class="label">手机号</text>
|
||||
<view class="value-wrapper">
|
||||
<text class="value">{{userInfo.phonenumber}}</text>
|
||||
<image class="arrow-icon" :src="require('@/static/images/my/enter.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 生日 -->
|
||||
<view class="info-item" @click="navigateTo('/pages/edit-birthday/index')">
|
||||
<text class="label">生日</text>
|
||||
<view class="value-wrapper">
|
||||
<text class="value placeholder">填写生日完善信息</text>
|
||||
<image class="arrow-icon" :src="require('@/static/images/my/enter.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 生日 -->
|
||||
<view class="info-item">
|
||||
<text class="label">生日</text>
|
||||
<view class="value-wrapper" @click="selectBirthDay()">
|
||||
<text class="value" :class="userInfo.birthDay? '' :'placeholder'">{{userInfo.birthDay || '填写生日完善信息'}}</text>
|
||||
<image class="arrow-icon" :src="require('@/static/images/my/enter.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-datetime-picker :minDate="minDate" :maxDate="maxDate" :show="dateShow" v-model="defaultDate" mode="date"
|
||||
:closeOnClickOverlay="true" :formatter="formatter" @cancel="dateShow = false" @confirm="birthDayConfirm">
|
||||
</u-datetime-picker>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
userInfo: {
|
||||
avatar: require('@/static/images/my/face.png'),
|
||||
name: '冯武鹏',
|
||||
phone: '18407028572',
|
||||
birthday: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
},
|
||||
handleUpdateAvatar() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: (res) => {
|
||||
// 这里可以处理选择的图片,比如上传到服务器
|
||||
this.userInfo.avatar = res.tempFilePaths[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
import {
|
||||
getUserProfile,
|
||||
uploadAvatar,
|
||||
updateUserProfile
|
||||
} from "@/api/system/user"
|
||||
import config from '@/config'
|
||||
import {
|
||||
getToken
|
||||
} from '@/utils/auth'
|
||||
import {
|
||||
showConfirm
|
||||
} from '@/utils/common'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dateShow: false,
|
||||
defaultFace: '/static/images/my/face.png',
|
||||
userInfo: {},
|
||||
defaultDate: Number(new Date()),
|
||||
minDate: 7200000,
|
||||
maxDate: Number(new Date())
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
getUserProfile().then(res => {
|
||||
this.userInfo = res.user
|
||||
console.log('this.userInfo',this.userInfo)
|
||||
})
|
||||
},
|
||||
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
|
||||
navigateTo(url) {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
},
|
||||
|
||||
selectBirthDay() {
|
||||
this.dateShow = true
|
||||
},
|
||||
|
||||
birthDayConfirm(e) {
|
||||
this.userInfo.birthDay = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否确认修改生日信息',
|
||||
showCancel: false,
|
||||
success: res => {
|
||||
if(res.confirm) {
|
||||
delete this.userInfo.phonenumber
|
||||
updateUserProfile(this.userInfo).then(res => {
|
||||
uni.showToast({ title: '修改成功', icon: 'success' });
|
||||
this.getUserInfo()
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
this.dateShow = false
|
||||
},
|
||||
|
||||
handleUpdateAvatar() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success: chooseImageRes => {
|
||||
uni.showLoading({
|
||||
title: '上传中...'
|
||||
})
|
||||
uni.uploadFile({
|
||||
url: config.baseUrl + '/system/user/profile/avatar',
|
||||
filePath: chooseImageRes.tempFilePaths[0],
|
||||
name: 'avatarfile',
|
||||
header: {
|
||||
'Authorization': 'Bearer ' + getToken()
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
console.log(uploadFileRes);
|
||||
if (uploadFileRes.statusCode == 200) {
|
||||
let reslut = JSON.parse(uploadFileRes.data)
|
||||
console.log('reslut', reslut)
|
||||
if (reslut.code == 200) {
|
||||
uni.showToast({
|
||||
title: reslut.msg,
|
||||
icon: 'none'
|
||||
});
|
||||
this.getUserInfo()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: reslut.msg,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} else if (uploadFileRes.statusCode == 401) {
|
||||
showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => {
|
||||
if (res.confirm) {
|
||||
uni.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: uploadFileRes.errMsg,
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
uni.hideLoading()
|
||||
},
|
||||
fail: (uploadFileErr) => {
|
||||
let {
|
||||
message
|
||||
} = uploadFileErr
|
||||
if (message == 'Network Error') {
|
||||
message = '后端接口连接异常'
|
||||
} else if (message.includes('timeout')) {
|
||||
message = '系统接口请求超时'
|
||||
} else if (message.includes('Request failed with status code')) {
|
||||
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||
}
|
||||
uni.showToast({
|
||||
title: message,
|
||||
icon: 'none'
|
||||
});
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
formatter(type, value) {
|
||||
if (type === 'year') {
|
||||
return `${value}年`
|
||||
}
|
||||
if (type === 'month') {
|
||||
return `${value}月`
|
||||
}
|
||||
if (type === 'day') {
|
||||
return `${value}日`
|
||||
}
|
||||
return value
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #FBFCFF;
|
||||
}
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #FBFCFF;
|
||||
}
|
||||
|
||||
.form-container {
|
||||
padding: 32rpx;
|
||||
background-color: #FBFCFF;
|
||||
}
|
||||
.form-container {
|
||||
padding: 32rpx;
|
||||
background-color: #FBFCFF;
|
||||
}
|
||||
|
||||
.avatar-section {
|
||||
position: relative;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin: 50rpx auto 48rpx;
|
||||
.avatar-section {
|
||||
position: relative;
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
margin: 50rpx auto 48rpx;
|
||||
|
||||
.avatar {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.avatar {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.camera-icon {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
.camera-icon {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
background: #fff;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
|
||||
.icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.info-list {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
.info-list {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx;
|
||||
border-bottom: 1rpx solid #FFFFFF;
|
||||
.info-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 32rpx;
|
||||
border-bottom: 1rpx solid #FFFFFF;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
}
|
||||
.label {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.value-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.value-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.value {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
margin-right: 16rpx;
|
||||
.value {
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
margin-right: 16rpx;
|
||||
|
||||
&.placeholder {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.arrow-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
&.placeholder {
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
.arrow-icon {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
<!-- 手机号信息 -->
|
||||
<view class="phone-info">
|
||||
<text class="label">已绑定手机号</text>
|
||||
<text class="phone-number">184****8572</text>
|
||||
<text class="phone-number">{{currentPhone}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 提示信息 -->
|
||||
|
|
@ -41,13 +41,24 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getUserProfile
|
||||
} from "@/api/system/user"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentPhone: '18407028572'
|
||||
currentPhone: ''
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
getUserProfile().then(res => {
|
||||
this.currentPhone = res.user.phonenumber
|
||||
})
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,147 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="changePw">
|
||||
<u--form labelPosition="left" :model="formData" :rules="rules" ref="uForm" labelWidth="80">
|
||||
<u-form-item label="旧密码:" prop="formData.oldPw" borderBottom>
|
||||
<u--input v-model="formData.oldPw" border="none" clearable :password="!oldPwShow" maxlength="16" placeholder="请输入旧密码">
|
||||
<template slot="suffix">
|
||||
<u-icon :name="oldPwShow?'eye-fill':'eye-off'" size="20" style="margin-left: 10rpx;" @click="showPw('oldPw')"></u-icon>
|
||||
</template>
|
||||
</u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="新密码:" prop="formData.newPw" borderBottom>
|
||||
<u--input v-model="formData.newPw" border="none" clearable :password="!newPwShow" maxlength="16" placeholder="请输入新密码">
|
||||
<template slot="suffix">
|
||||
<u-icon :name="newPwShow?'eye-fill':'eye-off'" size="20" style="margin-left: 10rpx;" @click="showPw('newPw')"></u-icon>
|
||||
</template>
|
||||
</u--input>
|
||||
</u-form-item>
|
||||
<u-form-item label="确认密码:" prop="formData.confirmPw">
|
||||
<u--input v-model="formData.confirmPw" border="none" clearable :password="!confirmPwShow" maxlength="16" placeholder="请确认密码">
|
||||
<template slot="suffix">
|
||||
<u-icon :name="confirmPwShow?'eye-fill':'eye-off'" size="20" style="margin-left: 10rpx;" @click="showPw('confirmPw')"></u-icon>
|
||||
</template>
|
||||
</u--input>
|
||||
</u-form-item>
|
||||
</u--form>
|
||||
</view>
|
||||
|
||||
|
||||
<button class="verify-btn" @click="confirmPwClick()">修改</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {updateUserPwd} from "@/api/system/user"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
oldPw: '',
|
||||
newPw: '',
|
||||
confirmPw: ''
|
||||
},
|
||||
oldPwShow: false,
|
||||
newPwShow: false,
|
||||
confirmPwShow: false,
|
||||
rules: {
|
||||
'formData.oldPw': [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if(this.formData.oldPw != uni.getStorageSync('remember').password) {
|
||||
return false
|
||||
}else{
|
||||
return true
|
||||
}
|
||||
},
|
||||
message: '旧密码填写错误,请检查'
|
||||
}
|
||||
],
|
||||
'formData.newPw': [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if(this.formData.confirmPw) {
|
||||
if(this.formData.newPw != this.formData.confirmPw) {
|
||||
callback(new Error('新密码与确认密码不一致,请检查'));
|
||||
return false
|
||||
}else{
|
||||
return true
|
||||
}
|
||||
}else{
|
||||
callback(new Error('请输入密码'));
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
'formData.confirmPw': [
|
||||
{
|
||||
validator: (rule, value, callback) => {
|
||||
if(this.formData.newPw) {
|
||||
if(this.formData.newPw != this.formData.confirmPw) {
|
||||
callback(new Error('新密码与确认密码不一致,请检查'));
|
||||
return false
|
||||
}else{
|
||||
return true
|
||||
}
|
||||
}else{
|
||||
callback(new Error('请输入密码'));
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showPw(type) {
|
||||
if(type == 'oldPw') {
|
||||
this.oldPwShow = !this.oldPwShow
|
||||
}else if(type == 'newPw') {
|
||||
this.newPwShow = !this.newPwShow
|
||||
}else if(type == 'confirmPw') {
|
||||
this.confirmPwShow = !this.confirmPwShow
|
||||
}
|
||||
},
|
||||
confirmPwClick() {
|
||||
this.$refs.uForm.validate().then(res => {
|
||||
updateUserPwd(this.formData.newPw).then(res => {
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.changePw {
|
||||
background-color: #ffffff;
|
||||
padding: 20rpx 30rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
/deep/.u-form-item__body {
|
||||
padding: 30rpx 0 !important;
|
||||
}
|
||||
.verify-btn {
|
||||
width: 90%;
|
||||
height: 88rpx;
|
||||
background: #FF8126;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
margin-top: 100rpx;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,270 +1,315 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
<!-- 顶部导航栏 -->
|
||||
<!-- <view class="header">-->
|
||||
<!-- <view class="back-icon" @click="goBack">-->
|
||||
<!-- <image class="icon" :src="require('@/static/images/icons/back.png')" mode="aspectFit"></image>-->
|
||||
<!-- </view>-->
|
||||
<!-- <text class="title">人脸上传</text>-->
|
||||
<!-- </view>-->
|
||||
<view class="container">
|
||||
<!-- 顶部导航栏 -->
|
||||
<!-- <view class="header">-->
|
||||
<!-- <view class="back-icon" @click="goBack">-->
|
||||
<!-- <image class="icon" :src="require('@/static/images/icons/back.png')" mode="aspectFit"></image>-->
|
||||
<!-- </view>-->
|
||||
<!-- <text class="title">人脸上传</text>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<!-- 主要内容区域 -->
|
||||
<view class="content">
|
||||
<!-- 上传区域 -->
|
||||
<view class="upload-area" @click="handleChooseImage">
|
||||
<view class="upload-box" :class="{ 'has-image': imageUrl }">
|
||||
<image
|
||||
v-if="imageUrl"
|
||||
:src="imageUrl"
|
||||
mode="aspectFill"
|
||||
class="preview-image"
|
||||
/>
|
||||
<view v-else class="upload-placeholder">
|
||||
<image class="camera-icon" :src="require('@/static/images/my/camera.png')" mode="aspectFit"></image>
|
||||
<text class="upload-text">点击上传照片</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 主要内容区域 -->
|
||||
<view class="content">
|
||||
<!-- 上传区域 -->
|
||||
<view class="upload-area" @click="handleChooseImage">
|
||||
<view class="upload-box" :class="{ 'has-image': userInfo.avatar }">
|
||||
<image v-if="userInfo.avatar" :src="userInfo.avatar" mode="aspectFill" class="preview-image" />
|
||||
<view v-else class="upload-placeholder">
|
||||
<image class="camera-icon" :src="require('@/static/images/my/camera.png')" mode="aspectFill"></image>
|
||||
<text class="upload-text">点击上传照片</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提示信息 -->
|
||||
<view class="tips">
|
||||
<text class="tip-item">·五官端正,面部无遮挡(请使用人脸照片)</text>
|
||||
<text class="tip-item">·不要带视频(如墨镜等)</text>
|
||||
<text class="tip-item">·请在光线明亮的纯色背景下拍照(建议背景颜色为白色)</text>
|
||||
<text class="tip-item">·上传照片后需保存,保存失败照片将被清除</text>
|
||||
</view>
|
||||
<!-- 提示信息 -->
|
||||
<view class="tips">
|
||||
<text class="tip-item">·五官端正,面部无遮挡(请使用人脸照片)</text>
|
||||
<text class="tip-item">·不要带视频(如墨镜等)</text>
|
||||
<text class="tip-item">·请在光线明亮的纯色背景下拍照(建议背景颜色为白色)</text>
|
||||
<text class="tip-item">·上传照片后需保存,保存失败照片将被清除</text>
|
||||
</view>
|
||||
|
||||
<!-- 隐私协议 -->
|
||||
<!-- <view class="privacy-agreement">-->
|
||||
<!-- <checkbox-->
|
||||
<!-- :checked="agreed"-->
|
||||
<!-- @click="agreed = !agreed"-->
|
||||
<!-- color="#FF8126"-->
|
||||
<!-- />-->
|
||||
<!-- <text class="agreement-text">我已阅读并同意</text>-->
|
||||
<!-- <text class="agreement-link" @click="showAgreement">《东华管理生物特征采集私隐声明》</text>-->
|
||||
<!-- </view>-->
|
||||
<!-- 隐私协议 -->
|
||||
<!-- <view class="privacy-agreement">-->
|
||||
<!-- <checkbox-->
|
||||
<!-- :checked="agreed"-->
|
||||
<!-- @click="agreed = !agreed"-->
|
||||
<!-- color="#FF8126"-->
|
||||
<!-- />-->
|
||||
<!-- <text class="agreement-text">我已阅读并同意</text>-->
|
||||
<!-- <text class="agreement-link" @click="showAgreement">《东华管理生物特征采集私隐声明》</text>-->
|
||||
<!-- </view>-->
|
||||
|
||||
<!-- 按钮组 -->
|
||||
<view class="button-group">
|
||||
<button
|
||||
class="submit-btn"
|
||||
:disabled="!agreed || !imageUrl"
|
||||
@click="handleUpload"
|
||||
>
|
||||
确定上传
|
||||
</button>
|
||||
<button
|
||||
class="cancel-btn"
|
||||
@click="goBack"
|
||||
>
|
||||
取消
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮组 -->
|
||||
<view class="button-group">
|
||||
<button class="submit-btn" :disabled="!agreed || !imageUrl" @click="handleUpload">确定上传</button>
|
||||
<button class="cancel-btn" @click="goBack">取消</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imageUrl: '',
|
||||
agreed: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
handleChooseImage() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: ['camera', 'album'],
|
||||
success: (res) => {
|
||||
this.imageUrl = res.tempFilePaths[0]
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUpload() {
|
||||
if (!this.agreed || !this.imageUrl) return
|
||||
import {
|
||||
getUserProfile,
|
||||
uploadAvatar
|
||||
} from "@/api/system/user"
|
||||
import config from '@/config'
|
||||
import {
|
||||
getToken
|
||||
} from '@/utils/auth'
|
||||
import {
|
||||
showConfirm
|
||||
} from '@/utils/common'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
imageUrl: '',
|
||||
agreed: true,
|
||||
userInfo: {}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
getUserProfile().then(res => {
|
||||
this.userInfo = res.user
|
||||
console.log('this.userInfo', this.userInfo)
|
||||
})
|
||||
},
|
||||
|
||||
uni.showLoading({
|
||||
title: '上传中...'
|
||||
})
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
|
||||
handleChooseImage() {
|
||||
uni.chooseImage({
|
||||
count: 1,
|
||||
success: chooseImageRes => {
|
||||
this.userInfo.avatar = chooseImageRes.tempFilePaths[0]
|
||||
this.imageUrl = chooseImageRes.tempFilePaths[0]
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
handleUpload() {
|
||||
if (!this.agreed || !this.imageUrl) return
|
||||
|
||||
// 这里添加实际的上传逻辑
|
||||
setTimeout(() => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
this.goBack()
|
||||
}, 2000)
|
||||
}
|
||||
})
|
||||
}, 1500)
|
||||
},
|
||||
showAgreement() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/privacy-agreement/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '上传中...'
|
||||
})
|
||||
|
||||
uni.uploadFile({
|
||||
url: config.baseUrl + '/system/user/profile/avatar',
|
||||
filePath: this.imageUrl,
|
||||
name: 'avatarfile',
|
||||
header: {
|
||||
'Authorization': 'Bearer ' + getToken()
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
console.log(uploadFileRes);
|
||||
if(uploadFileRes.statusCode == 200) {
|
||||
let reslut = JSON.parse(uploadFileRes.data)
|
||||
console.log('reslut',reslut)
|
||||
if(reslut.code == 200) {
|
||||
uni.showToast({
|
||||
title: '上传成功',
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
this.goBack()
|
||||
}, 2000)
|
||||
}
|
||||
})
|
||||
}else{
|
||||
uni.showToast({ title: reslut.msg,icon: 'none' });
|
||||
}
|
||||
}else if(uploadFileRes.statusCode == 401) {
|
||||
showConfirm("登录状态已过期,您可以继续留在该页面,或者重新登录?").then(res => {
|
||||
if (res.confirm) {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
}
|
||||
})
|
||||
}else{
|
||||
uni.showToast({ title: uploadFileRes.errMsg,icon: 'none' });
|
||||
}
|
||||
uni.hideLoading()
|
||||
},
|
||||
fail: (uploadFileErr) => {
|
||||
let { message } = uploadFileErr
|
||||
if (message == 'Network Error') {
|
||||
message = '后端接口连接异常'
|
||||
} else if (message.includes('timeout')) {
|
||||
message = '系统接口请求超时'
|
||||
} else if (message.includes('Request failed with status code')) {
|
||||
message = '系统接口' + message.substr(message.length - 3) + '异常'
|
||||
}
|
||||
uni.showToast({ title: message,icon: 'none' });
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
showAgreement() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/privacy-agreement/index'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #fff;
|
||||
}
|
||||
.container {
|
||||
min-height: 100vh;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.header {
|
||||
padding: 44px 32rpx 0;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.header {
|
||||
padding: 44px 32rpx 0;
|
||||
height: 88rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.back-icon {
|
||||
padding: 20rpx;
|
||||
margin-left: -20rpx;
|
||||
.back-icon {
|
||||
padding: 20rpx;
|
||||
margin-left: -20rpx;
|
||||
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.title {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
font-size: 34rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-right: 60rpx;
|
||||
}
|
||||
}
|
||||
.title {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
font-size: 34rpx;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-right: 60rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 32rpx;
|
||||
}
|
||||
.content {
|
||||
padding: 32rpx;
|
||||
}
|
||||
|
||||
.upload-area {
|
||||
margin-bottom: 48rpx;
|
||||
.upload-area {
|
||||
margin-bottom: 48rpx;
|
||||
|
||||
.upload-box {
|
||||
width: 75%;
|
||||
height: 400rpx;
|
||||
border: 2rpx dashed #CCCCCC;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.upload-box {
|
||||
width: 75%;
|
||||
height: 400rpx;
|
||||
border: 2rpx dashed #CCCCCC;
|
||||
border-radius: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
&.has-image {
|
||||
border-style: solid;
|
||||
}
|
||||
&.has-image {
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.preview-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.preview-image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.upload-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
.upload-placeholder {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
.camera-icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
.camera-icon {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.upload-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
.upload-text {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.tips {
|
||||
margin-bottom: 48rpx;
|
||||
width: 75%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
.tips {
|
||||
margin-bottom: 48rpx;
|
||||
width: 75%;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
|
||||
.tip-item {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
line-height: 1.6;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
.tip-item {
|
||||
display: block;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
line-height: 1.6;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.privacy-agreement {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 48rpx;
|
||||
/deep/ .uni-checkbox-input {
|
||||
border-radius: 50% !important;
|
||||
}
|
||||
}
|
||||
.privacy-agreement {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 48rpx;
|
||||
|
||||
.button-group {
|
||||
margin-top: 32rpx;
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #FF8126;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
margin-bottom: 24rpx;
|
||||
/deep/ .uni-checkbox-input {
|
||||
border-radius: 50% !important;
|
||||
}
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
.button-group {
|
||||
margin-top: 32rpx;
|
||||
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
.submit-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #FF8126;
|
||||
color: #fff;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.cancel-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #fff;
|
||||
color: #333;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 2rpx solid #CCCCCC;
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
}
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #fff;
|
||||
color: #333;
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
border-radius: 44rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 2rpx solid #CCCCCC;
|
||||
|
||||
&:active {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -59,7 +59,7 @@ export default {
|
|||
},
|
||||
{
|
||||
title: '修改密码',
|
||||
path: '/pages/change-password/index'
|
||||
path: '/pages/mine/me/changePassword'
|
||||
},
|
||||
{
|
||||
title: '挂失解绑',
|
||||
|
|
|
|||
|
|
@ -16,36 +16,31 @@
|
|||
|
||||
<!-- 手机号输入框 -->
|
||||
<view class="input-wrapper">
|
||||
<input
|
||||
type="number"
|
||||
v-model="phoneNumber"
|
||||
placeholder="请输入手机号"
|
||||
maxlength="11"
|
||||
class="phone-input"
|
||||
/>
|
||||
<input type="number" v-model="phoneNumber" placeholder="请输入手机号" maxlength="11" class="phone-input"/>
|
||||
<view class="clear-icon" v-if="phoneNumber" @click="clearPhoneNumber">
|
||||
<image class="icon" :src="require('@/static/images/my/cancel.png')" mode="aspectFit"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 获取验证码按钮 -->
|
||||
<button
|
||||
class="verify-btn"
|
||||
:disabled="!isValidPhone"
|
||||
@click="handleGetVerifyCode"
|
||||
>
|
||||
获取短信验证码
|
||||
</button>
|
||||
<!-- <button class="verify-btn" :disabled="!isValidPhone" @click="handleGetVerifyCode">获取短信验证码</button> -->
|
||||
|
||||
<button class="verify-btn" @click="handleGetVerifyCode">修改</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getUserProfile,
|
||||
updateUserProfile
|
||||
} from "@/api/system/user"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
phoneNumber: '',
|
||||
countdown: 0
|
||||
countdown: 0,
|
||||
userInfo: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
|
@ -53,20 +48,41 @@ export default {
|
|||
return /^1[3-9]\d{9}$/.test(this.phoneNumber)
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.getUserInfo()
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
getUserProfile().then(res => {
|
||||
this.userInfo = res.user
|
||||
})
|
||||
},
|
||||
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
|
||||
clearPhoneNumber() {
|
||||
this.phoneNumber = ''
|
||||
},
|
||||
|
||||
handleGetVerifyCode() {
|
||||
if (!this.isValidPhone) return
|
||||
if (!this.isValidPhone) {
|
||||
uni.showToast({ title: '请正确输入手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.userInfo.phonenumber = this.phoneNumber
|
||||
updateUserProfile(this.userInfo).then(res => {
|
||||
uni.showToast({ title: '修改成功', icon: 'success',duration: 2000 });
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
},2000)
|
||||
})
|
||||
|
||||
// 这里添加获取验证码的逻辑
|
||||
uni.navigateTo({
|
||||
url: `/pages/mine/me/phoneCode?phone=${this.phoneNumber}`
|
||||
})
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/mine/me/phoneCode?phone=${this.phoneNumber}`
|
||||
// })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ const user = {
|
|||
const formData = {
|
||||
username: userInfo.username.trim(),
|
||||
password: userInfo.password,
|
||||
loginType: "USERNAME_PASSWORD",
|
||||
// code: userInfo.code,
|
||||
// uuid: userInfo.uuid
|
||||
};
|
||||
|
|
@ -50,8 +51,8 @@ const user = {
|
|||
console.log('🚀 ~ login ~ formData11:', formData);
|
||||
login(formData).then(res => {
|
||||
console.log('🚀 ~ login ~ res:', res);
|
||||
setToken(res.token);
|
||||
commit('SET_TOKEN', res.token);
|
||||
setToken(res.data.access_token);
|
||||
commit('SET_TOKEN', res.data.access_token);
|
||||
resolve();
|
||||
}).catch(error => {
|
||||
reject(error);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ const request = config => {
|
|||
// 是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
config.header = config.headers || {}
|
||||
|
||||
if (getToken() && !isToken) {
|
||||
config.header['Authorization'] = 'Bearer ' + getToken()
|
||||
}
|
||||
|
|
@ -36,10 +37,17 @@ const request = config => {
|
|||
}
|
||||
// post请求
|
||||
if (config.method === 'post') {
|
||||
config.header = {
|
||||
...config.header,
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
if(config.header.isForm) {
|
||||
config.header = {
|
||||
...config.header,
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}else{
|
||||
config.header = {
|
||||
...config.header
|
||||
}
|
||||
}
|
||||
|
||||
// config.data = AES.encryptCBC(JSON.stringify(config.data))
|
||||
}
|
||||
// put请求
|
||||
|
|
|
|||
Loading…
Reference in New Issue