修改邮箱 账号 手机号 登录密码
This commit is contained in:
parent
4f84721a49
commit
8e157f6996
|
@ -1,29 +1,29 @@
|
|||
<script setup>
|
||||
import {
|
||||
import {
|
||||
onLaunch,
|
||||
onExit
|
||||
} from '@dcloudio/uni-app'
|
||||
// 工具库
|
||||
import util from '@/common/js/util';
|
||||
//
|
||||
import api from '@/api/index.js'
|
||||
// vuex
|
||||
import store from '@/store/index.js'
|
||||
// #ifdef APP
|
||||
// 引入各种权限配置
|
||||
import {
|
||||
} from '@dcloudio/uni-app'
|
||||
// 工具库
|
||||
import util from '@/common/js/util';
|
||||
//
|
||||
import api from '@/api/index.js'
|
||||
// vuex
|
||||
import store from '@/store/index.js'
|
||||
// #ifdef APP
|
||||
// 引入各种权限配置
|
||||
import {
|
||||
registerRequestPermissionTipsListener,
|
||||
unregisterRequestPermissionTipsListener,
|
||||
setRequestPermissionTips
|
||||
} from "@/uni_modules/uni-registerRequestPermissionTips"
|
||||
var PermissionTips = {
|
||||
} from "@/uni_modules/uni-registerRequestPermissionTips"
|
||||
var PermissionTips = {
|
||||
"android.permission.CAMERA": "<h4 style=\"font-size:40px;\">相机使用权限说明</h4><font color=#cccccc>用于在添加、上传、发布、图片和视频等场景中读取和写入相册和文件内容</font>",
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">存储空间/照片权限说明</h4><font color=#cccccc>用于在添加、上传、发布、图片和视频等场景中读取和写入相册和文件内容</font>",
|
||||
"android.permission.RECORD_AUDIO": "<h4 style=\"font-size:40px;\">录音权限说明</h4><font color=#cccccc>用于发送语音消息、语音通话功能</font>",
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
// #endif
|
||||
|
||||
onLaunch(() => {
|
||||
onLaunch(() => {
|
||||
// 获取用户信息
|
||||
getUserinfo()
|
||||
// 获取系统配置
|
||||
|
@ -32,19 +32,19 @@
|
|||
// 处理用户在app端提交的权限
|
||||
init()
|
||||
// #endif
|
||||
})
|
||||
})
|
||||
|
||||
onExit(() => {
|
||||
onExit(() => {
|
||||
// #ifdef APP
|
||||
unregisterRequestPermissionTipsListener(null)
|
||||
// #endif
|
||||
})
|
||||
})
|
||||
|
||||
/**
|
||||
/**
|
||||
* 处理用户在app端申请的权限
|
||||
* 文档地址:https://ext.dcloud.net.cn/plugin?name=uni-registerRequestPermissionTips
|
||||
*/
|
||||
function init() {
|
||||
function init() {
|
||||
var brand = uni.getSystemInfoSync().deviceBrand
|
||||
setRequestPermissionTips(PermissionTips)
|
||||
registerRequestPermissionTipsListener({
|
||||
|
@ -77,10 +77,10 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 获取用户信息
|
||||
function getUserinfo() {
|
||||
// 获取用户信息
|
||||
function getUserinfo() {
|
||||
// 登录令牌
|
||||
const token = uni.getStorageSync('token')
|
||||
// 用户信息
|
||||
|
@ -96,14 +96,16 @@
|
|||
|
||||
//
|
||||
util.getUserinfo().then(rs => {
|
||||
if (userinfo.isRealName) {
|
||||
// 腾讯im登录
|
||||
util.loginTencent(userinfo)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 获取系统配置
|
||||
function getConfig() {
|
||||
// 获取系统配置
|
||||
function getConfig() {
|
||||
api.getConfig().then(rs => {
|
||||
if (rs.code == 200) {
|
||||
store.commit('setState', {
|
||||
|
@ -113,10 +115,10 @@
|
|||
return
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/*每个页面公共css */
|
||||
@import "./common/css/style.scss";
|
||||
/*每个页面公共css */
|
||||
@import "./common/css/style.scss";
|
||||
</style>
|
|
@ -416,6 +416,45 @@ const mine = {
|
|||
method: 'POST',
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改账号
|
||||
* @param {Object} param
|
||||
*/
|
||||
updateAccount(param) {
|
||||
return util.request({
|
||||
url: `/user/home/update/account`,
|
||||
data: param.data,
|
||||
method: 'POST',
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改手机号
|
||||
* @param {Object} param
|
||||
*/
|
||||
updatePhone(param) {
|
||||
return util.request({
|
||||
url: `/user/login/updatePhone`,
|
||||
data: param.data,
|
||||
method: 'POST',
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改登录密码
|
||||
* @param {Object} param
|
||||
*/
|
||||
updatePassword(param) {
|
||||
return util.request({
|
||||
url: `/user/login/updatePassword`,
|
||||
data: param.data,
|
||||
method: 'POST',
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
export default mine
|
|
@ -224,6 +224,7 @@ function handleAlert(ev) {
|
|||
|
||||
// 获取未读消息数量
|
||||
function getNoReadNum() {
|
||||
if (userinfo.value.isRealName) {
|
||||
// 验证sdk是否准备完毕
|
||||
let isReady = uni.$chat.isReady();
|
||||
if (!isReady) {
|
||||
|
@ -237,7 +238,7 @@ function getNoReadNum() {
|
|||
const unreadCount = uni.$chat.getTotalUnreadMessageCount();
|
||||
noReadNum.value = +unreadCount > 99 ? '99+' : unreadCount;
|
||||
// #endif
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -746,6 +746,24 @@
|
|||
{
|
||||
"navigationBarTitleText" : "账号解冻"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/mine/setting/updateAccount",
|
||||
"style": {
|
||||
"navigationBarTitleText": "修改账号"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/mine/setting/updatePhoneNum",
|
||||
"style": {
|
||||
"navigationBarTitleText": "修改手机号"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/mine/setting/loginPassword",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录密码"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
<script setup>
|
||||
/**
|
||||
* 修改账号
|
||||
*/
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
} from 'vue'
|
||||
import {
|
||||
useStore
|
||||
} from 'vuex'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
// 加密
|
||||
import CryptoJS from 'crypto-js';
|
||||
|
||||
// 显示密码
|
||||
const showPwd = ref(false)
|
||||
const showPwds = ref(false)
|
||||
//
|
||||
const store = useStore()
|
||||
// 表单
|
||||
const form = reactive({
|
||||
oldPassword: '',
|
||||
password: ''
|
||||
})
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
let result = store.state.userinfo
|
||||
return result
|
||||
})
|
||||
|
||||
// 实名认证
|
||||
function handleSubmit() {
|
||||
const data = {
|
||||
...form
|
||||
}
|
||||
|
||||
// 验证
|
||||
if (!data.oldPassword) {
|
||||
util.alert('请输入旧密码')
|
||||
return
|
||||
}
|
||||
if (!data.password) {
|
||||
util.alert('请输入新密码')
|
||||
return
|
||||
}
|
||||
data.oldPassword = CryptoJS.MD5(data.oldPassword).toString();
|
||||
data.password = CryptoJS.MD5(data.password).toString();
|
||||
|
||||
api.mine.updatePassword({ data }).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
util.alert('修改成功')
|
||||
util.getUserinfo()
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="line df aic">
|
||||
<view class="key">旧密码</view>
|
||||
<view class="value">
|
||||
<input :password="showPwd ? false : true" v-model="form.oldPassword" placeholder="请输入旧密码" />
|
||||
</view>
|
||||
<view class="btn sm ml20 plr20">
|
||||
<uni-icons :type="showPwd ? 'eye' : 'eye-slash'" color="#999" size="40rpx"
|
||||
@click="showPwd = !showPwd" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="line df aic">
|
||||
<view class="key">新密码</view>
|
||||
<view class="value">
|
||||
<input :password="showPwds ? false : true" v-model="form.password" placeholder="请输入新密码" />
|
||||
</view>
|
||||
<view class="btn sm ml20 plr20">
|
||||
<uni-icons :type="showPwds ? 'eye' : 'eye-slash'" color="#999" size="40rpx"
|
||||
@click="showPwds = !showPwds" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btn bar lg black mtb60 mlr60" @click="handleSubmit">提交</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// 容器
|
||||
.container {
|
||||
padding: 50rpx 30rpx;
|
||||
color: #333333;
|
||||
font-size: 34rpx;
|
||||
|
||||
.line {
|
||||
padding: 35rpx 10rpx;
|
||||
}
|
||||
|
||||
.key {
|
||||
width: 200rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,44 +1,44 @@
|
|||
<script setup>
|
||||
// 设置
|
||||
import {
|
||||
// 设置
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
} from 'vue'
|
||||
import {
|
||||
} from 'vue'
|
||||
import {
|
||||
useStore
|
||||
} from 'vuex'
|
||||
import {
|
||||
} from 'vuex'
|
||||
import {
|
||||
onLoad,
|
||||
} from '@dcloudio/uni-app'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
// 仓库
|
||||
const store = useStore()
|
||||
// 用户信息
|
||||
const userinfo = computed(() => store.state.userinfo)
|
||||
// 添加好友方式
|
||||
const allowType = [{
|
||||
} from '@dcloudio/uni-app'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
// 仓库
|
||||
const store = useStore()
|
||||
// 用户信息
|
||||
const userinfo = computed(() => store.state.userinfo)
|
||||
// 添加好友方式
|
||||
const allowType = [{
|
||||
id: 'AllowType_Type_AllowAny',
|
||||
name: '允许任何人添加',
|
||||
}, {
|
||||
}, {
|
||||
id: 'AllowType_Type_NeedConfirm',
|
||||
name: '需要确认才能添加',
|
||||
}, {
|
||||
}, {
|
||||
id: 'AllowType_Type_DenyAny',
|
||||
name: '不允许任何人添加 ',
|
||||
}, ]
|
||||
// 添加好友下标
|
||||
const allowTypeIndex = ref(0)
|
||||
// im用户信息
|
||||
const imUserinfo = ref({})
|
||||
// app版本号
|
||||
const appVersion = ref(0)
|
||||
},]
|
||||
// 添加好友下标
|
||||
const allowTypeIndex = ref(0)
|
||||
// im用户信息
|
||||
const imUserinfo = ref({})
|
||||
// app版本号
|
||||
const appVersion = ref(0)
|
||||
|
||||
onLoad(() => {
|
||||
onLoad(() => {
|
||||
util.isLogin(() => {
|
||||
// 获取添加好友方式
|
||||
getAddType()
|
||||
|
@ -47,19 +47,19 @@
|
|||
let system = uni.getSystemInfoSync()
|
||||
appVersion.value = system.appVersion
|
||||
// #endif
|
||||
})
|
||||
})
|
||||
|
||||
// 修改加好友方式
|
||||
function handleAllowType(ev) {
|
||||
// 修改加好友方式
|
||||
function handleAllowType(ev) {
|
||||
const index = ev.detail.value
|
||||
if (index === allowTypeIndex.value) return
|
||||
allowTypeIndex.value = index
|
||||
// 更新个人资料
|
||||
updateMyProfile()
|
||||
}
|
||||
}
|
||||
|
||||
// 获取添加好友方式
|
||||
function getAddType() {
|
||||
// 获取添加好友方式
|
||||
function getAddType() {
|
||||
api.mine.getImUserInfo({
|
||||
query: {
|
||||
userIds: userinfo.value.id
|
||||
|
@ -77,10 +77,10 @@
|
|||
showCancel: false
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 更新im个人资料
|
||||
function updateMyProfile() {
|
||||
// 更新im个人资料
|
||||
function updateMyProfile() {
|
||||
// 修改个人标配资料
|
||||
api.mine.setImUserInfo({
|
||||
query: {
|
||||
|
@ -94,26 +94,26 @@
|
|||
showCancel: false
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 登录跳转
|
||||
function loginLink(url) {
|
||||
// 登录跳转
|
||||
function loginLink(url) {
|
||||
util.isLogin().then(() => {
|
||||
link(url)
|
||||
}).catch(() => {
|
||||
link('/pages/login/login')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 跳转
|
||||
function link(url) {
|
||||
// 跳转
|
||||
function link(url) {
|
||||
uni.navigateTo({
|
||||
url,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 退出登录
|
||||
function logOff() {
|
||||
// 退出登录
|
||||
function logOff() {
|
||||
util.alert({
|
||||
title: '提示',
|
||||
content: '确定退出登录?',
|
||||
|
@ -123,7 +123,7 @@
|
|||
query: {
|
||||
phoneNumber: userinfo.phoneNumber,
|
||||
}
|
||||
}).then(rs => {})
|
||||
}).then(rs => { })
|
||||
|
||||
// 退出登录
|
||||
util.logout(() => {
|
||||
|
@ -133,7 +133,7 @@
|
|||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -146,19 +146,25 @@
|
|||
<image class="head-portrait wh80" :src="userinfo.avatar" mode="aspectFill" />
|
||||
</view>
|
||||
<view class="info f1 ml20">
|
||||
<view class="">{{userinfo.userNickname}}</view>
|
||||
<view class="">{{ userinfo.userNickname }}</view>
|
||||
<!-- <view class="account mt10 c999 f26">账号:{{userinfo.account}}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="line rows">
|
||||
<view class="">修改账号</view>
|
||||
<view class="f1 tar c999 f28">{{userinfo.account}}</view>
|
||||
<view class="line rows" @click="link('/pages/mine/setting/updateAccount')">
|
||||
<view class="key">修改账号</view>
|
||||
<view class="col f1 ml20 tar c999 f28">
|
||||
<view class="">{{ userinfo.account }}</view>
|
||||
</view>
|
||||
<uni-icons class="ml20" type="right" />
|
||||
</view>
|
||||
|
||||
<view class="line rows">
|
||||
<view class="">绑定手机号</view>
|
||||
<view class="f1 tar c999 f28">{{userinfo.phoneNumber}}</view>
|
||||
<view class="line rows" @click="link('/pages/mine/setting/updatePhoneNum')">
|
||||
<view class="key">修改手机号</view>
|
||||
<view class="col f1 ml20 tar c999 f28">
|
||||
<view class="">{{ userinfo.phoneNumber }}</view>
|
||||
</view>
|
||||
<uni-icons class="ml20" type="right" />
|
||||
</view>
|
||||
|
||||
<view class="line rows" @click="link('/pages/mine/realname')">
|
||||
|
@ -189,7 +195,7 @@
|
|||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
||||
<view class="line rows">
|
||||
<view class="line rows" @click="link('/pages/mine/setting/loginPassword')">
|
||||
<view class="">登录密码</view>
|
||||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
@ -222,7 +228,7 @@
|
|||
<view class=" rows">
|
||||
<view class="">好友验证方式</view>
|
||||
<view class="value mlr20 f1 tar c666 f28">
|
||||
{{allowType[allowTypeIndex].name}}
|
||||
{{ allowType[allowTypeIndex].name }}
|
||||
</view>
|
||||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
@ -242,17 +248,17 @@
|
|||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
||||
<view class="line rows" @click="link(util.setUrl('/pages/index/article',{id: 2,}))">
|
||||
<view class="line rows" @click="link(util.setUrl('/pages/index/article', { id: 2, }))">
|
||||
<view class="">关于我们</view>
|
||||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
||||
<view class="line rows" @click="link(util.setUrl('/pages/index/article',{id: 3,}))">
|
||||
<view class="line rows" @click="link(util.setUrl('/pages/index/article', { id: 3, }))">
|
||||
<view class="">用户协议</view>
|
||||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
||||
<view class="line rows" @click="link(util.setUrl('/pages/index/article',{id: 1,}))">
|
||||
<view class="line rows" @click="link(util.setUrl('/pages/index/article', { id: 1, }))">
|
||||
<view class="">隐私政策</view>
|
||||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
@ -260,7 +266,7 @@
|
|||
<!-- #ifdef APP -->
|
||||
<view class="line rows ptb20 plr10">
|
||||
<view class="">版本号</view>
|
||||
<view class="c999 f28">{{appVersion}}</view>
|
||||
<view class="c999 f28">{{ appVersion }}</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
|
@ -282,8 +288,8 @@
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
//
|
||||
.area {
|
||||
//
|
||||
.area {
|
||||
margin: 30rpx;
|
||||
padding: 0 30rpx;
|
||||
color: #333;
|
||||
|
@ -304,5 +310,5 @@
|
|||
border-radius: 50%;
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,93 @@
|
|||
<script setup>
|
||||
/**
|
||||
* 修改账号
|
||||
*/
|
||||
import {
|
||||
reactive,
|
||||
computed,
|
||||
} from 'vue'
|
||||
import {
|
||||
useStore
|
||||
} from 'vuex'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
|
||||
//
|
||||
const store = useStore()
|
||||
// 表单
|
||||
const form = reactive({
|
||||
id: '',
|
||||
account: ''
|
||||
})
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
let result = store.state.userinfo
|
||||
return result
|
||||
})
|
||||
|
||||
// 实名认证
|
||||
function handleSubmit() {
|
||||
const data = {
|
||||
...form
|
||||
}
|
||||
|
||||
// 验证
|
||||
if (!data.account) {
|
||||
util.alert('请输入账号')
|
||||
return
|
||||
}
|
||||
data.id = userinfo.value.id
|
||||
|
||||
api.mine.updateAccount({ data }).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
util.alert('修改成功')
|
||||
util.getUserinfo()
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="line df aic">
|
||||
<view class="key">账号</view>
|
||||
<view class="value">
|
||||
<input class="input" type="text" v-model="form.account" placeholder="请输入账号" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btn bar lg black mtb60 mlr60" @click="handleSubmit">提交</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// 容器
|
||||
.container {
|
||||
padding: 50rpx 30rpx;
|
||||
color: #333333;
|
||||
font-size: 34rpx;
|
||||
|
||||
.line {
|
||||
padding: 35rpx 10rpx;
|
||||
}
|
||||
|
||||
.key {
|
||||
width: 200rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,118 @@
|
|||
<script setup>
|
||||
/**
|
||||
* 修改手机号
|
||||
*/
|
||||
import {
|
||||
reactive,
|
||||
computed,
|
||||
} from 'vue'
|
||||
import {
|
||||
useStore
|
||||
} from 'vuex'
|
||||
// 获取验证码
|
||||
import getCode from '@/components/getCode/getCode.vue'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
|
||||
//
|
||||
const store = useStore()
|
||||
// 表单
|
||||
const form = reactive({
|
||||
phoneNumber: '',
|
||||
verifyCode: ''
|
||||
})
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
let result = store.state.userinfo
|
||||
return result
|
||||
})
|
||||
|
||||
// 实名认证
|
||||
function handleSubmit() {
|
||||
const data = {
|
||||
...form
|
||||
}
|
||||
|
||||
// 验证
|
||||
if (!data.phoneNumber) {
|
||||
util.alert('请输入手机号')
|
||||
return
|
||||
}
|
||||
if (!data.verifyCode) {
|
||||
util.alert('请输入验证码')
|
||||
return
|
||||
}
|
||||
|
||||
api.mine.updatePhone({ data }).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
util.alert('修改成功')
|
||||
util.getUserinfo()
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 500)
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="line df aic">
|
||||
<view class="key">手机号</view>
|
||||
<view class="value">
|
||||
<input class="input" type="text" v-model="form.phoneNumber" placeholder="请输入手机号" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="line df aic">
|
||||
<view class="key">验证码</view>
|
||||
<view class="value">
|
||||
<input type="text" v-model="form.verifyCode" placeholder="请输入验证码" class="f1" />
|
||||
</view>
|
||||
<view class="getCode btn sm ml20 plr20">
|
||||
<getCode :phone="form.phoneNumber" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="btn bar lg black mtb60 mlr60" @click="handleSubmit">提交</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// 容器
|
||||
.container {
|
||||
padding: 50rpx 30rpx;
|
||||
color: #333333;
|
||||
font-size: 34rpx;
|
||||
|
||||
.line+.line {
|
||||
border-top: 2rpx solid #ddd;
|
||||
}
|
||||
|
||||
.line {
|
||||
padding: 35rpx 10rpx;
|
||||
}
|
||||
|
||||
.key {
|
||||
width: 200rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取验证码
|
||||
.getCode {
|
||||
color: #666;
|
||||
background-color: #fff;
|
||||
}
|
||||
</style>
|
|
@ -1,49 +1,49 @@
|
|||
<script setup>
|
||||
/**
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
import {
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
reactive,
|
||||
} from 'vue'
|
||||
import {
|
||||
} from 'vue'
|
||||
import {
|
||||
onLoad,
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
useStore
|
||||
} from 'vuex'
|
||||
// 工具库
|
||||
import util from '@/common/js/util';
|
||||
// 接口
|
||||
import api from '@/api';
|
||||
} from 'vuex'
|
||||
// 工具库
|
||||
import util from '@/common/js/util';
|
||||
// 接口
|
||||
import api from '@/api';
|
||||
|
||||
// vuex
|
||||
const store = useStore()
|
||||
// vuex
|
||||
const store = useStore()
|
||||
|
||||
// 用户
|
||||
const user = reactive({})
|
||||
// 用户
|
||||
const user = reactive({})
|
||||
|
||||
// 性别
|
||||
const gender = reactive([{
|
||||
// 性别
|
||||
const gender = reactive([{
|
||||
id: 0,
|
||||
name: '男',
|
||||
},
|
||||
{
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: '女',
|
||||
}
|
||||
])
|
||||
// 性别下标
|
||||
const genderIndex = ref(0)
|
||||
}
|
||||
])
|
||||
// 性别下标
|
||||
const genderIndex = ref(0)
|
||||
|
||||
onLoad(() => {
|
||||
onLoad(() => {
|
||||
// 同步用户信息
|
||||
syncInfo()
|
||||
})
|
||||
})
|
||||
|
||||
// 同步用户信息
|
||||
function syncInfo() {
|
||||
// 同步用户信息
|
||||
function syncInfo() {
|
||||
// 用户信息
|
||||
const userinfo = store.state.userinfo
|
||||
user.background = userinfo.background
|
||||
|
@ -55,35 +55,36 @@
|
|||
user.id = userinfo.id + ''
|
||||
user.birthday = userinfo.birthday
|
||||
user.avatar = userinfo.avatar
|
||||
user.email = userinfo.email
|
||||
// 修改性别下标
|
||||
genderIndex.value = gender.findIndex(item => item.id == userinfo.sex)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 选择生日日期
|
||||
* @param {Object} ev 默认事件
|
||||
*/
|
||||
function handleBirthday(ev) {
|
||||
function handleBirthday(ev) {
|
||||
const value = ev.detail.value
|
||||
if (user.birthday === value) return
|
||||
user.birthday = value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 选择性别
|
||||
* @param {Object} ev 默认事件
|
||||
*/
|
||||
function handleGender(ev) {
|
||||
function handleGender(ev) {
|
||||
const value = ev.detail.value
|
||||
if (genderIndex.value === value) return
|
||||
genderIndex.value = value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 上传图片
|
||||
* @param {String} key 需要修改个人信息的字段
|
||||
*/
|
||||
function uploadImg(key) {
|
||||
function uploadImg(key) {
|
||||
util.upload_image({
|
||||
value: user[key],
|
||||
type: 1,
|
||||
|
@ -93,13 +94,18 @@
|
|||
console.log('user', user)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 保存个人信息
|
||||
function handleSubmit() {
|
||||
// 保存个人信息
|
||||
function handleSubmit() {
|
||||
// 同步性别值
|
||||
if (gender[genderIndex.value]) user.sex = gender[genderIndex.value].id
|
||||
|
||||
if (!IsEmail(user.email)) {
|
||||
util.alert('邮箱格式不正确!')
|
||||
return
|
||||
}
|
||||
|
||||
const data = {
|
||||
...user,
|
||||
}
|
||||
|
@ -126,7 +132,13 @@
|
|||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
// 校验邮箱地址
|
||||
function IsEmail(str) {
|
||||
var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
|
||||
return reg.test(str);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -156,7 +168,7 @@
|
|||
<view class="line rows ptb20">
|
||||
<view class="key">账号</view>
|
||||
<view class="value tar f1">
|
||||
<text>{{user.account}}</text>
|
||||
<text>{{ user.account }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
@ -171,7 +183,7 @@
|
|||
<view class="line rows ptb20">
|
||||
<view class="key">生日</view>
|
||||
<picker class="value tar f1" mode="date" @change="handleBirthday">
|
||||
<text v-if="user.birthday">{{user.birthday}}</text>
|
||||
<text v-if="user.birthday">{{ user.birthday }}</text>
|
||||
<text v-else>请选择</text>
|
||||
</picker>
|
||||
<uni-icons type="right" />
|
||||
|
@ -182,7 +194,7 @@
|
|||
<picker class="value tar f1" :range="gender" :value="genderIndex" range-key="name"
|
||||
@change="handleGender">
|
||||
<text v-if="genderIndex == -1">请选择</text>
|
||||
<text v-else>{{gender[genderIndex].name}}</text>
|
||||
<text v-else>{{ gender[genderIndex].name }}</text>
|
||||
</picker>
|
||||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
@ -195,6 +207,14 @@
|
|||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
||||
<view class="line rows ptb20">
|
||||
<view class="key">邮箱</view>
|
||||
<view class="value tar f1">
|
||||
<input type="text" v-model="user.email" placeholder="请输入你的邮箱" />
|
||||
</view>
|
||||
<uni-icons type="right" />
|
||||
</view>
|
||||
|
||||
<view class="line ptb20">
|
||||
<view class="key">个性签名</view>
|
||||
<view class="value textareaBox inputBox mt20 ptb20 plr20">
|
||||
|
@ -213,8 +233,8 @@
|
|||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 背景
|
||||
.bgBox {
|
||||
// 背景
|
||||
.bgBox {
|
||||
.content {
|
||||
height: 400rpx;
|
||||
}
|
||||
|
@ -223,16 +243,16 @@
|
|||
.changeBg {
|
||||
background-color: rgba(0, 0, 0, .3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 头像
|
||||
.avatarBox {
|
||||
// 头像
|
||||
.avatarBox {
|
||||
padding: 2rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
// 资料
|
||||
.info {
|
||||
// 资料
|
||||
.info {
|
||||
margin-top: -20rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,51 +1,51 @@
|
|||
<script setup>
|
||||
/**
|
||||
/**
|
||||
* 发起群聊
|
||||
*/
|
||||
import {
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
computed
|
||||
} from 'vue'
|
||||
import {
|
||||
} from 'vue'
|
||||
import {
|
||||
useStore
|
||||
} from 'vuex'
|
||||
import {
|
||||
} from 'vuex'
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// 头部
|
||||
import apex from '@/components/header/apex.vue'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
} from '@dcloudio/uni-app'
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// 头部
|
||||
import apex from '@/components/header/apex.vue'
|
||||
// 腾讯云聊天
|
||||
import TencentCloudChat from '@tencentcloud/chat';
|
||||
// api
|
||||
import api from '@/api/index.js'
|
||||
|
||||
const store = useStore()
|
||||
// 已选择的用户id
|
||||
const ids = ref([])
|
||||
// 表单
|
||||
const form = reactive({
|
||||
const store = useStore()
|
||||
// 已选择的用户id
|
||||
const ids = ref([])
|
||||
// 表单
|
||||
const form = reactive({
|
||||
name: '',
|
||||
groupFaceUrl: '',
|
||||
type: 'Public',
|
||||
})
|
||||
// 列表
|
||||
const list = reactive([])
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
})
|
||||
// 列表
|
||||
const list = reactive([])
|
||||
// 用户信息
|
||||
const userinfo = computed(() => {
|
||||
let result = store.state.userinfo
|
||||
return result
|
||||
})
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
onLoad(() => {
|
||||
// 获取朋友列表
|
||||
getFriendList()
|
||||
})
|
||||
})
|
||||
|
||||
// 获取朋友列表
|
||||
function getFriendList() {
|
||||
// 获取朋友列表
|
||||
function getFriendList() {
|
||||
api.news.getFriendList().then(rs => {
|
||||
if (rs.code == 200) {
|
||||
const result = rs.data
|
||||
|
@ -59,21 +59,21 @@
|
|||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 点击用户
|
||||
* @param {Object} item 当前用户信息
|
||||
*/
|
||||
function handleUser(item) {
|
||||
function handleUser(item) {
|
||||
const find_index = ids.value.findIndex(node => node == item.userId)
|
||||
console.log(find_index)
|
||||
if (find_index >= 0) ids.value.splice(find_index, 1)
|
||||
else ids.value.push(item.userId)
|
||||
}
|
||||
}
|
||||
|
||||
// 新建群组
|
||||
function handleCreateGroup() {
|
||||
// 新建群组
|
||||
function handleCreateGroup() {
|
||||
const data = {
|
||||
...form
|
||||
}
|
||||
|
@ -111,6 +111,7 @@
|
|||
}).then(rs => {
|
||||
if (rs.code == 200) {
|
||||
util.alert('创建成功')
|
||||
createGroup(data)
|
||||
|
||||
setTimeout(() => {
|
||||
form.name = ''
|
||||
|
@ -125,17 +126,26 @@
|
|||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
function uploadImg() {
|
||||
function createGroup(data) {
|
||||
uni.$chat.createGroup({
|
||||
type: TencentCloudChat.TYPES.GRP_PUBLIC,
|
||||
name: data.name,
|
||||
groupID: data.groupId,
|
||||
avatar: data.groupFaceUrl
|
||||
})
|
||||
}
|
||||
|
||||
// 上传图片
|
||||
function uploadImg() {
|
||||
util.upload_image({
|
||||
type: 1,
|
||||
success: (res) => {
|
||||
form.groupFaceUrl = res.value
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -148,7 +158,7 @@
|
|||
<view class="li" v-for="(item, index) in list" :key="index" @click="handleUser(item)">
|
||||
<view class="item rows ptb20 pl30 pr50">
|
||||
<image class="wh80 avatar cir" :src="item.avatar" mode="aspectFill" />
|
||||
<view class="name thd f1 ml20 c333 f32">{{item.remark || item.userNickname}}</view>
|
||||
<view class="name thd f1 ml20 c333 f32">{{ item.remark || item.userNickname }}</view>
|
||||
<uni-icons type="circle-filled" size="40rpx" color="#20D200"
|
||||
v-if="ids.includes(item.userId)" />
|
||||
<uni-icons type="circle" size="40rpx" color="#ccc" v-else />
|
||||
|
@ -163,7 +173,7 @@
|
|||
<view class="fill" style="height: 120rpx;"></view>
|
||||
|
||||
<view class="footer plr30 bfff shadow">
|
||||
<view class="btn lg colourful" @click="$refs.groupAlt.open() ">下一步</view>
|
||||
<view class="btn lg colourful" @click="$refs.groupAlt.open()">下一步</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
@ -199,8 +209,8 @@
|
|||
</template>
|
||||
|
||||
<style scoped lang="scss">
|
||||
// 朋友列表
|
||||
.firendBox {
|
||||
// 朋友列表
|
||||
.firendBox {
|
||||
height: 100%;
|
||||
|
||||
.scroll {
|
||||
|
@ -220,5 +230,5 @@
|
|||
border-top: 2rpx solid #eee;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue