feat: 短信验证码功能已完成,手机端同步实现。

This commit is contained in:
RockYang
2023-07-03 15:18:15 +08:00
parent 1fc361242e
commit 440169ff60
13 changed files with 267 additions and 26 deletions

View File

@@ -60,6 +60,13 @@
<span>修改密码</span>
</el-dropdown-item>
<el-dropdown-item @click="showBindMobileDialog = true">
<el-icon>
<Iphone/>
</el-icon>
<span>绑定手机号</span>
</el-dropdown-item>
<el-dropdown-item @click="clearAllChats">
<el-icon>
<Delete/>
@@ -188,7 +195,8 @@
<password-dialog v-if="isLogin" :show="showPasswordDialog" @hide="showPasswordDialog = false"
@logout="logout"/>
<bind-mobile/>
<bind-mobile v-if="isLogin" :show="showBindMobileDialog" :mobile="loginUser.mobile"
@hide="showBindMobileDialog = false"/>
</div>
@@ -202,7 +210,7 @@ import {
Check,
Close,
Delete,
Edit,
Edit, Iphone,
Plus,
Promotion,
RefreshRight,
@@ -242,6 +250,7 @@ const newChatItem = ref(null);
const router = useRouter();
const showConfigDialog = ref(false);
const showPasswordDialog = ref(false);
const showBindMobileDialog = ref(false);
const isLogin = ref(false)
if (isMobile()) {
@@ -253,6 +262,9 @@ onMounted(() => {
checkSession().then((user) => {
loginUser.value = user
isLogin.value = true
if (user.mobile === '') {
showBindMobileDialog.value = true
}
// 加载角色列表
httpGet(`/api/role/list?user_id=${user.id}`).then((res) => {
roles.value = res.data;

View File

@@ -9,7 +9,7 @@
<div class="header">{{ title }}</div>
<div class="content">
<el-form :model="formData" label-width="120px" ref="formRef" :rules="rules">
<el-form :model="formData" label-width="120px" ref="formRef">
<div class="block">
<el-input placeholder="请输入用户名(4-30位)"
size="large" maxlength="30"
@@ -115,7 +115,7 @@ const title = ref('ChatGPT-PLUS 用户注册');
const formData = ref({
username: '',
password: '',
mobile: '18575670125',
mobile: '',
code: '',
repass: '',
})

View File

@@ -63,6 +63,9 @@
</template>
</van-picker>
</van-popup>
<bind-mobile v-if="isLogin" :show="showBindMobileDialog" :mobile="loginUser.mobile"
@hide="showBindMobileDialog = false"/>
</div>
</template>
@@ -74,6 +77,7 @@ import {checkSession} from "@/action/session";
import router from "@/router";
import {setChatConfig} from "@/store/chat";
import {removeArrayItem} from "@/utils/libs";
import BindMobile from "@/components/mobile/BindMobile.vue";
const title = ref("会话列表")
const chatName = ref("")
@@ -88,10 +92,14 @@ const roles = ref([])
const models = ref([])
const showPicker = ref(false)
const columns = ref([roles.value, models.value])
const showBindMobileDialog = ref(false)
checkSession().then((user) => {
loginUser.value = user
isLogin.value = true
if (user.mobile === '') {
showBindMobileDialog.value = true
}
// 加载角色列表
httpGet(`/api/role/list?user_id=${user.id}`).then((res) => {
if (res.data) {

View File

@@ -13,6 +13,14 @@
disabled
placeholder="用户名"
/>
<van-field
v-model="form.mobile"
name="手机号"
label="手机号"
readonly
disabled
placeholder="手机号"
/>
<van-field
v-model="form.nickname"
name="昵称"
@@ -61,6 +69,7 @@ const title = ref('用户设置')
const form = ref({
username: '',
nickname: '',
mobile: '',
avatar: '',
calls: 0,
tokens: 0