mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-08 10:13:44 +08:00
feat: email registration function is ready
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<div class="user-info" id="user-info">
|
||||
<el-form v-if="user.id" :model="user" label-width="150px">
|
||||
<el-form-item label="账户">
|
||||
<span>{{ user.mobile }}</span>
|
||||
<span>{{ user.username }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="剩余对话次数">
|
||||
<el-tag>{{ user['calls'] }}</el-tag>
|
||||
@@ -54,17 +54,14 @@ const user = ref({
|
||||
username: '',
|
||||
nickname: '',
|
||||
avatar: '',
|
||||
mobile: '',
|
||||
calls: 0,
|
||||
tokens: 0,
|
||||
chat_config: {api_keys: {OpenAI: "", Azure: "", ChatGLM: ""}}
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// 获取最新用户信息
|
||||
httpGet('/api/user/profile').then(res => {
|
||||
user.value = res.data
|
||||
user.value.chat_config.api_keys = res.data.chat_config.api_keys ?? {OpenAI: "", Azure: "", ChatGLM: ""}
|
||||
}).catch(e => {
|
||||
ElMessage.error("获取用户信息失败:" + e.message)
|
||||
});
|
||||
|
||||
@@ -7,21 +7,21 @@
|
||||
:title="title"
|
||||
>
|
||||
<div class="form" id="bind-mobile-form">
|
||||
<el-alert v-if="mobile !== ''" type="info" show-icon :closable="false" style="margin-bottom: 20px;">
|
||||
<p>当前用户已绑定手机号:{{ mobile }}, 绑定其他手机号之后自动解绑该手机号。</p>
|
||||
<el-alert v-if="username !== ''" type="info" show-icon :closable="false" style="margin-bottom: 20px;">
|
||||
<p>当前绑定账号:{{ username }},只允许使绑定有效的手机号或者邮箱地址作为登录账号。</p>
|
||||
</el-alert>
|
||||
|
||||
<el-form :model="form" label-width="120px">
|
||||
<el-form-item label="手机号码">
|
||||
<el-input v-model="form.mobile"/>
|
||||
<el-form-item label="新账号">
|
||||
<el-input v-model="form.username"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机验证码">
|
||||
<el-form-item label="验证码">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="16">
|
||||
<el-input v-model="form.code" maxlength="6"/>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<send-msg size="" :mobile="form.mobile"/>
|
||||
<send-msg size="" :receiver="form.username"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
@@ -43,37 +43,36 @@ import {computed, ref} from "vue";
|
||||
import SendMsg from "@/components/SendMsg.vue";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {httpPost} from "@/utils/http";
|
||||
import {validateMobile} from "@/utils/validate";
|
||||
import {validateEmail, validateMobile} from "@/utils/validate";
|
||||
|
||||
const props = defineProps({
|
||||
show: Boolean,
|
||||
mobile: String
|
||||
username: String
|
||||
});
|
||||
|
||||
const showDialog = computed(() => {
|
||||
return props.show
|
||||
})
|
||||
|
||||
const title = ref('绑定手机号')
|
||||
const title = ref('重置登录账号')
|
||||
const form = ref({
|
||||
mobile: '',
|
||||
username: '',
|
||||
code: ''
|
||||
})
|
||||
|
||||
const emits = defineEmits(['hide']);
|
||||
|
||||
const save = () => {
|
||||
if (!validateMobile(form.value.mobile)) {
|
||||
return ElMessage.error("请输入正确的手机号码");
|
||||
if (!validateMobile(form.value.username) && !validateEmail(form.value.username)) {
|
||||
return ElMessage.error("请输入合法的手机号/邮箱地址")
|
||||
}
|
||||
if (form.value.code === '') {
|
||||
return ElMessage.error("请输入短信验证码");
|
||||
return ElMessage.error("请输入验证码");
|
||||
}
|
||||
|
||||
httpPost('/api/user/bind/mobile', form.value).then(() => {
|
||||
httpPost('/api/user/bind/username', form.value).then(() => {
|
||||
ElMessage.success({
|
||||
message: '绑定成功',
|
||||
appendTo: '#bind-mobile-form',
|
||||
duration: 1000,
|
||||
onClose: () => emits('hide', false)
|
||||
})
|
||||
@@ -10,16 +10,16 @@
|
||||
<div class="form">
|
||||
|
||||
<el-form :model="form" label-width="120px" label-position="left">
|
||||
<el-form-item label="手机号码">
|
||||
<el-input v-model="form.mobile"/>
|
||||
<el-form-item label="用户名">
|
||||
<el-input v-model="form.username" placeholder="手机号/邮箱地址"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机验证码">
|
||||
<el-form-item label="验证码">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="16">
|
||||
<el-input v-model="form.code" maxlength="6"/>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<send-msg size="" :mobile="form.mobile"/>
|
||||
<send-msg size="" :receiver="form.username"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
@@ -48,7 +48,7 @@ import {computed, ref} from "vue";
|
||||
import SendMsg from "@/components/SendMsg.vue";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {httpPost} from "@/utils/http";
|
||||
import {validateMobile} from "@/utils/validate";
|
||||
import {validateEmail, validateMobile} from "@/utils/validate";
|
||||
|
||||
const props = defineProps({
|
||||
show: Boolean,
|
||||
@@ -61,7 +61,7 @@ const showDialog = computed(() => {
|
||||
|
||||
const title = ref('重置密码')
|
||||
const form = ref({
|
||||
mobile: '',
|
||||
username: '',
|
||||
code: '',
|
||||
password: '',
|
||||
repass: ''
|
||||
@@ -70,11 +70,11 @@ const form = ref({
|
||||
const emits = defineEmits(['hide']);
|
||||
|
||||
const save = () => {
|
||||
if (!validateMobile(form.value.mobile)) {
|
||||
return ElMessage.error("请输入正确的手机号码");
|
||||
if (!validateMobile(form.value.username) && !validateEmail(form.value.username)) {
|
||||
return ElMessage.error("请输入正确的手机号码/邮箱地址");
|
||||
}
|
||||
if (form.value.code === '') {
|
||||
return ElMessage.error("请输入短信验证码");
|
||||
return ElMessage.error("请输入验证码");
|
||||
}
|
||||
if (form.value.repass !== form.value.password) {
|
||||
return ElMessage.error("两次输入密码不一致");
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
// 发送短信验证码组件
|
||||
import {ref} from "vue";
|
||||
import lodash from 'lodash'
|
||||
import {validateMobile} from "@/utils/validate";
|
||||
import {validateEmail, validateMobile} from "@/utils/validate";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {httpGet, httpPost} from "@/utils/http";
|
||||
import CaptchaPlus from "@/components/CaptchaPlus.vue";
|
||||
|
||||
const props = defineProps({
|
||||
mobile: String,
|
||||
receiver: String,
|
||||
size: String,
|
||||
});
|
||||
const btnText = ref('发送验证码')
|
||||
@@ -82,8 +82,8 @@ const handleConfirm = (dots) => {
|
||||
}
|
||||
|
||||
const loadCaptcha = () => {
|
||||
if (!validateMobile(props.mobile)) {
|
||||
return ElMessage.error("请输入合法的手机号")
|
||||
if (!validateMobile(props.receiver) && !validateEmail(props.receiver)) {
|
||||
return ElMessage.error("请输入合法的手机号/邮箱地址")
|
||||
}
|
||||
|
||||
showCaptcha.value = true
|
||||
@@ -96,8 +96,8 @@ const sendMsg = () => {
|
||||
}
|
||||
|
||||
canSend.value = false
|
||||
httpPost('/api/sms/code', {mobile: props.mobile, key: captKey.value, dots: dots.value}).then(() => {
|
||||
ElMessage.success('短信发送成功')
|
||||
httpPost('/api/sms/code', {receiver: props.receiver, key: captKey.value, dots: dots.value}).then(() => {
|
||||
ElMessage.success('验证码发送成功')
|
||||
let time = 120
|
||||
btnText.value = time
|
||||
const handler = setInterval(() => {
|
||||
@@ -112,7 +112,7 @@ const sendMsg = () => {
|
||||
}, 1000)
|
||||
}).catch(e => {
|
||||
canSend.value = true
|
||||
ElMessage.error('短信发送失败:' + e.message)
|
||||
ElMessage.error('验证码发送失败:' + e.message)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
<el-form-item label="昵称">
|
||||
<el-input v-model="user['nickname']"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号">
|
||||
<span>{{ user.mobile }}</span>
|
||||
<el-form-item label="账号">
|
||||
<span>{{ user.username }}</span>
|
||||
<el-tooltip
|
||||
class="box-item"
|
||||
effect="light"
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
<template>
|
||||
<van-dialog v-model:show="showDialog"
|
||||
:title="title"
|
||||
:show-cancel-button="mobile !== ''"
|
||||
@confirm="save"
|
||||
@cancel="close">
|
||||
<van-cell-group inset>
|
||||
<van-field
|
||||
v-model="form.mobile"
|
||||
label="手机号"
|
||||
placeholder="请输入手机号"
|
||||
/>
|
||||
<van-field
|
||||
v-model.number="form.code"
|
||||
center
|
||||
clearable
|
||||
label="短信验证码"
|
||||
placeholder="请输入短信验证码"
|
||||
>
|
||||
<template #button>
|
||||
<send-msg size="small" :mobile="form.mobile"/>
|
||||
</template>
|
||||
</van-field>
|
||||
</van-cell-group>
|
||||
</van-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {computed, ref} from "vue";
|
||||
import {httpPost} from "@/utils/http";
|
||||
import {validateMobile} from "@/utils/validate";
|
||||
import {showNotify} from "vant";
|
||||
import SendMsg from "@/components/SendMsg.vue";
|
||||
|
||||
const props = defineProps({
|
||||
show: Boolean,
|
||||
mobile: String
|
||||
});
|
||||
|
||||
const showDialog = computed(() => {
|
||||
return props.show
|
||||
})
|
||||
|
||||
const title = ref('绑定手机号')
|
||||
const form = ref({
|
||||
mobile: '',
|
||||
code: ''
|
||||
})
|
||||
|
||||
const emits = defineEmits(['hide']);
|
||||
|
||||
const save = () => {
|
||||
if (!validateMobile(form.value.mobile)) {
|
||||
return showNotify({type: 'danger', message: '请输入正确的手机号码'});
|
||||
}
|
||||
if (form.value.code === '') {
|
||||
return showNotify({type: "danger", message: '请输入短信验证码'})
|
||||
}
|
||||
|
||||
httpPost('/api/user/bind/mobile', form.value).then(() => {
|
||||
showNotify({type: 'success', message: '绑定成功', duration: 1000, onClose: emits('hide', false)});
|
||||
}).catch(e => {
|
||||
showNotify({type: 'danger', message: '绑定失败:' + e.message, duration: 2000});
|
||||
})
|
||||
}
|
||||
|
||||
const close = function () {
|
||||
emits('hide', false);
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
@@ -84,6 +84,10 @@ export function dateFormat(timestamp, format) {
|
||||
|
||||
// 判断数组中是否包含某个元素
|
||||
export function arrayContains(array, value, compare) {
|
||||
if (!array) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (typeof compare !== 'function') {
|
||||
compare = function (v1, v2) {
|
||||
return v1 === v2;
|
||||
|
||||
@@ -231,12 +231,17 @@
|
||||
<div class="notice">
|
||||
<el-text type="primary">
|
||||
注意:当前站点仅为开源项目
|
||||
<a style="color: #F56C6C" href="https://github.com/yangjian102621/chatgpt-plus">ChatPlus</a>
|
||||
<a style="color: #F56C6C" href="https://github.com/yangjian102621/chatgpt-plus" target="_blank">ChatPlus</a>
|
||||
的演示项目,本项目单纯就是给大家体验项目功能使用。<br/>
|
||||
|
||||
体验额度用完之后请不要在当前站点进行任何充值操作!!!<br/>
|
||||
体验额度用完之后请不要在当前站点进行任何充值操作!!!<br/>
|
||||
体验额度用完之后请不要在当前站点进行任何充值操作!!!<br/>
|
||||
|
||||
如果觉得好用你就花几分钟自己部署一套,没有API KEY 的同学可以去
|
||||
<a href="https://gpt.bemore.lol" target="_blank"
|
||||
style="font-size: 20px;color:#F56C6C">https://gpt.bemore.lol</a>
|
||||
购买,现在有超级优惠,价格远低于 OpenAI 官方。
|
||||
</el-text>
|
||||
|
||||
<p style="text-align: right">
|
||||
@@ -350,7 +355,7 @@ onMounted(() => {
|
||||
|
||||
httpGet("/api/admin/config/get?key=system").then(res => {
|
||||
title.value = res.data.title
|
||||
const show = localStorage.getItem(showNoticeKey.value + loginUser.value.mobile)
|
||||
const show = localStorage.getItem(showNoticeKey.value + loginUser.value.username)
|
||||
if (!show) {
|
||||
showDemoNotice.value = res.data['show_demo_notice']
|
||||
}
|
||||
@@ -878,7 +883,7 @@ const getModelValue = (model_id) => {
|
||||
|
||||
|
||||
const notShow = () => {
|
||||
localStorage.setItem(showNoticeKey.value + loginUser.value.mobile, true)
|
||||
localStorage.setItem(showNoticeKey.value + loginUser.value.username, true)
|
||||
showDemoNotice.value = false
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -2,9 +2,7 @@
|
||||
<div class="home">
|
||||
<div class="navigator">
|
||||
<div class="logo">
|
||||
<el-link href="/">
|
||||
<el-image :src="logo"/>
|
||||
</el-link>
|
||||
<el-image :src="logo"/>
|
||||
<div class="divider"></div>
|
||||
</div>
|
||||
<ul class="nav-items">
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<div class="header">{{ title }}</div>
|
||||
<div class="content">
|
||||
<div class="block">
|
||||
<el-input placeholder="手机号" size="large" maxlength="11" v-model="username" autocomplete="off">
|
||||
<el-input placeholder="手机号/邮箱地址" size="large" v-model="username" autocomplete="off">
|
||||
<template #prefix>
|
||||
<el-icon>
|
||||
<UserFilled/>
|
||||
@@ -59,7 +59,7 @@ import FooterBar from "@/components/FooterBar.vue";
|
||||
import {isMobile} from "@/utils/libs";
|
||||
import {checkSession} from "@/action/session";
|
||||
import {setUserToken} from "@/store/session";
|
||||
import {validateMobile} from "@/utils/validate";
|
||||
import {validateEmail, validateMobile} from "@/utils/validate";
|
||||
import {prevRoute} from "@/router";
|
||||
import ResetPass from "@/components/ResetPass.vue";
|
||||
|
||||
@@ -92,8 +92,8 @@ onUnmounted(() => {
|
||||
})
|
||||
|
||||
const login = function () {
|
||||
if (!validateMobile(username.value)) {
|
||||
return ElMessage.error('请输入合法的手机号');
|
||||
if (!validateMobile(username.value) && !validateEmail(username.value)) {
|
||||
return ElMessage.error("请输入合法的手机号/邮箱地址")
|
||||
}
|
||||
if (password.value.trim() === '') {
|
||||
return ElMessage.error('请输入密码');
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<el-button type="primary" @click="showPasswordDialog = true">修改密码</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-button type="primary" @click="showBindMobileDialog = true">绑定手机号</el-button>
|
||||
<el-button type="primary" @click="showBindMobileDialog = true">更改账号</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-button type="primary" v-if="enableReward" @click="showRewardDialog = true">加入众筹</el-button>
|
||||
@@ -93,7 +93,7 @@
|
||||
<password-dialog v-if="isLogin" :show="showPasswordDialog" @hide="showPasswordDialog = false"
|
||||
@logout="logout"/>
|
||||
|
||||
<bind-mobile v-if="isLogin" :show="showBindMobileDialog" :mobile="user.mobile"
|
||||
<bind-mobile v-if="isLogin" :show="showBindMobileDialog" :username="user.username"
|
||||
@hide="showBindMobileDialog = false"/>
|
||||
|
||||
<reward-verify v-if="isLogin" :show="showRewardVerifyDialog" @hide="showRewardVerifyDialog = false"/>
|
||||
@@ -158,7 +158,7 @@ import LoginDialog from "@/components/LoginDialog.vue";
|
||||
import {checkSession} from "@/action/session";
|
||||
import UserProfile from "@/components/UserProfile.vue";
|
||||
import PasswordDialog from "@/components/PasswordDialog.vue";
|
||||
import BindMobile from "@/components/BindMobile.vue";
|
||||
import BindMobile from "@/components/ResetAccount.vue";
|
||||
import RewardVerify from "@/components/RewardVerify.vue";
|
||||
import {useRouter} from "vue-router";
|
||||
import {removeUserToken} from "@/store/session";
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
<div class="content">
|
||||
<el-form :model="formData" label-width="120px" ref="formRef">
|
||||
<div class="block">
|
||||
<el-input placeholder="手机号码"
|
||||
size="large" maxlength="11"
|
||||
v-model="formData.mobile"
|
||||
<el-input :placeholder="placeholder"
|
||||
size="large"
|
||||
v-model="formData.username"
|
||||
autocomplete="off">
|
||||
<template #prefix>
|
||||
<el-icon>
|
||||
@@ -49,10 +49,10 @@
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
<div class="block" v-if="enableMsg">
|
||||
<div class="block">
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="12">
|
||||
<el-input placeholder="手机验证码"
|
||||
<el-input placeholder="验证码"
|
||||
size="large" maxlength="30"
|
||||
v-model="formData.code"
|
||||
autocomplete="off">
|
||||
@@ -64,7 +64,7 @@
|
||||
</el-input>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<send-msg size="large" :mobile="formData.mobile"/>
|
||||
<send-msg size="large" :receiver="formData.username"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
@@ -118,42 +118,44 @@
|
||||
import {ref} from "vue";
|
||||
import {Checked, Iphone, Lock, Message} from "@element-plus/icons-vue";
|
||||
import {httpGet, httpPost} from "@/utils/http";
|
||||
import {ElMessage, ElNotification} from "element-plus";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {useRouter} from "vue-router";
|
||||
import FooterBar from "@/components/FooterBar.vue";
|
||||
import SendMsg from "@/components/SendMsg.vue";
|
||||
import {validateMobile} from "@/utils/validate";
|
||||
import {isMobile} from "@/utils/libs";
|
||||
import {validateEmail, validateMobile} from "@/utils/validate";
|
||||
import {arrayContains} from "@/utils/libs";
|
||||
import {setUserToken} from "@/store/session";
|
||||
import {checkSession} from "@/action/session";
|
||||
|
||||
const router = useRouter();
|
||||
const title = ref('ChatPlus 用户注册');
|
||||
const formData = ref({
|
||||
mobile: '',
|
||||
username: '',
|
||||
password: '',
|
||||
code: '',
|
||||
repass: '',
|
||||
invite_code: router.currentRoute.value.query['invite_code'],
|
||||
})
|
||||
const formRef = ref(null)
|
||||
const enableMsg = ref(false)
|
||||
const enableMobile = ref(false)
|
||||
const enableEmail = ref(false)
|
||||
const enableRegister = ref(true)
|
||||
const wxImg = ref("/images/wx.png")
|
||||
const ways = []
|
||||
const placeholder = ref("用户名:")
|
||||
|
||||
httpGet("/api/admin/config/get?key=system").then(res => {
|
||||
if (res.data) {
|
||||
enableMsg.value = res.data['enabled_msg']
|
||||
enableRegister.value = res.data['enabled_register']
|
||||
if (res.data['force_invite'] && !formData.value.invite_code) {
|
||||
ElNotification({
|
||||
title: '提示:',
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: '当前系统开启了强制邀请注册功能,必须有邀请码才能注册哦。扫描下面二维码获取邀请码。<br/> <img alt="qrcode" src="/images/wx.png" />',
|
||||
type: 'info',
|
||||
duration: 5000,
|
||||
})
|
||||
const registerWays = res.data['register_ways']
|
||||
if (arrayContains(registerWays, "mobile")) {
|
||||
enableMobile.value = true
|
||||
ways.push("手机号")
|
||||
}
|
||||
if (arrayContains(registerWays, "email")) {
|
||||
enableEmail.value = true
|
||||
ways.push("邮箱地址")
|
||||
}
|
||||
placeholder.value += ways.join("/")
|
||||
}
|
||||
}).catch(e => {
|
||||
ElMessage.error("获取系统配置失败:" + e.message)
|
||||
@@ -165,9 +167,19 @@ httpGet("/api/invite/hits", {code: formData.value.invite_code}).then(() => {
|
||||
|
||||
|
||||
const register = function () {
|
||||
if (!validateMobile(formData.value.mobile)) {
|
||||
if (formData.value.username === '') {
|
||||
return ElMessage.error('请输入用户名');
|
||||
}
|
||||
|
||||
if (!enableMobile.value && !validateEmail(formData.value.username)) {
|
||||
return ElMessage.error('请输入合法的邮箱地址');
|
||||
}
|
||||
if (!enableEmail.value && !validateMobile(formData.value.username)) {
|
||||
return ElMessage.error('请输入合法的手机号');
|
||||
}
|
||||
if (!validateMobile(formData.value.username) && !validateEmail(formData.value.username)) {
|
||||
return ElMessage.error('请输入合法的手机号或者邮箱地址');
|
||||
}
|
||||
if (formData.value.password.length < 8) {
|
||||
return ElMessage.error('密码的长度为8-16个字符');
|
||||
}
|
||||
@@ -175,7 +187,7 @@ const register = function () {
|
||||
return ElMessage.error('两次输入密码不一致');
|
||||
}
|
||||
|
||||
if (enableMsg.value && formData.value.code === '') {
|
||||
if (formData.value.code === '') {
|
||||
return ElMessage.error('请输入短信验证码');
|
||||
}
|
||||
httpPost('/api/user/register', formData.value).then((res) => {
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
<div class="handle-box">
|
||||
<el-button type="primary" :icon="Plus" @click="add">新增</el-button>
|
||||
<a href="https://gpt.bemore.lol" target="_blank" style="margin-left: 10px">
|
||||
<el-button type="success" :icon="ShoppingCart" @click="add" plain>购买API-KEY</el-button>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<el-row>
|
||||
@@ -129,7 +132,7 @@ import {reactive, ref} from "vue";
|
||||
import {httpGet, httpPost} from "@/utils/http";
|
||||
import {ElMessage} from "element-plus";
|
||||
import {dateFormat, disabledDate, removeArrayItem} from "@/utils/libs";
|
||||
import {InfoFilled, Plus} from "@element-plus/icons-vue";
|
||||
import {InfoFilled, Plus, ShoppingCart} from "@element-plus/icons-vue";
|
||||
|
||||
// 变量定义
|
||||
const items = ref([])
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="container user-list" v-loading="loading">
|
||||
<div class="handle-box">
|
||||
<el-input v-model="query.mobile" placeholder="手机号码" class="handle-input mr10"></el-input>
|
||||
<el-input v-model="query.username" placeholder="账号" class="handle-input mr10"></el-input>
|
||||
<el-button type="primary" :icon="Search" @click="handleSearch">搜索</el-button>
|
||||
|
||||
<el-button type="success" :icon="Plus" @click="addUser">新增用户</el-button>
|
||||
@@ -13,7 +13,7 @@
|
||||
<el-table-column type="selection" width="38"/>
|
||||
<el-table-column prop="mobile" label="账号">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.mobile }}</span>
|
||||
<span>{{ scope.row.username }}</span>
|
||||
<el-image v-if="scope.row.vip" :src="vipImg" style="height: 20px;position: relative; top:5px; left: 5px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -69,7 +69,7 @@
|
||||
width="50%"
|
||||
>
|
||||
<el-form :model="user" label-width="100px" ref="userEditFormRef" :rules="rules">
|
||||
<el-form-item label="手机号:" prop="mobile">
|
||||
<el-form-item label="手机号:" prop="username">
|
||||
<el-input v-model="user.mobile" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="add" label="密码:" prop="password">
|
||||
@@ -150,7 +150,7 @@
|
||||
>
|
||||
<el-form label-width="100px" ref="userEditFormRef">
|
||||
<el-form-item label="账户:">
|
||||
<el-input v-model="pass.mobile" autocomplete="off" readonly disabled/>
|
||||
<el-input v-model="pass.username" autocomplete="off" readonly disabled/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="新密码:">
|
||||
@@ -177,13 +177,13 @@ import {Plus, Search} from "@element-plus/icons-vue";
|
||||
|
||||
// 变量定义
|
||||
const users = ref({page: 1, page_size: 15, items: []})
|
||||
const query = ref({mobile: '', page: 1, page_size: 15})
|
||||
const query = ref({username: '', page: 1, page_size: 15})
|
||||
|
||||
const title = ref('添加用户')
|
||||
const vipImg = ref("/images/vip.png")
|
||||
const add = ref(true)
|
||||
const user = ref({chat_roles: [], chat_models: []})
|
||||
const pass = ref({mobile: '', password: '', id: 0})
|
||||
const pass = ref({username: '', password: '', id: 0})
|
||||
const roles = ref([])
|
||||
const models = ref([])
|
||||
const showUserEditDialog = ref(false)
|
||||
@@ -191,7 +191,7 @@ const showResetPassDialog = ref(false)
|
||||
const rules = reactive({
|
||||
nickname: [{required: true, message: '请输入昵称', trigger: 'change',}],
|
||||
password: [{required: true, message: '请输入密码', trigger: 'change',}],
|
||||
mobile: [{required: true, message: '请输入手机号码', trigger: 'change',}],
|
||||
username: [{required: true, message: '请输入手机号码', trigger: 'change',}],
|
||||
calls: [
|
||||
{required: true, message: '请输入提问次数'},
|
||||
{type: 'number', message: '请输入有效数字'},
|
||||
@@ -309,7 +309,7 @@ const handleSelectionChange = function (rows) {
|
||||
const resetPass = (row) => {
|
||||
showResetPassDialog.value = true
|
||||
pass.value.id = row.id
|
||||
pass.value.mobile = row.mobile
|
||||
pass.value.username = row.mobile
|
||||
}
|
||||
|
||||
const doResetPass = () => {
|
||||
|
||||
@@ -73,8 +73,6 @@
|
||||
<van-field v-model="tmpChatTitle" label="" placeholder="请输入对话标题" class="field"/>
|
||||
</van-dialog>
|
||||
|
||||
<bind-mobile v-if="isLogin" :show="showBindMobileDialog" :mobile="loginUser.mobile"
|
||||
@hide="showBindMobileDialog = false"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -86,7 +84,6 @@ 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("")
|
||||
@@ -101,7 +98,6 @@ const roles = ref([])
|
||||
const models = ref([])
|
||||
const showPicker = ref(false)
|
||||
const columns = ref([roles.value, models.value])
|
||||
const showBindMobileDialog = ref(false)
|
||||
const showEditChat = ref(false)
|
||||
const item = ref({})
|
||||
const tmpChatTitle = ref("")
|
||||
|
||||
@@ -52,9 +52,6 @@
|
||||
<el-col :span="12">
|
||||
<el-button type="primary" @click="showPasswordDialog = true">修改密码</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-button type="primary" @click="showBindMobileDialog = true">绑定手机号</el-button>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-button type="primary" v-if="enableReward" @click="showRewardDialog = true">加入众筹</el-button>
|
||||
</el-col>
|
||||
@@ -72,8 +69,6 @@
|
||||
<login-dialog :show="showLoginDialog" @hide="showLoginDialog = false"/>
|
||||
<password-dialog v-if="isLogin" :show="showPasswordDialog" width="100%" @hide="showPasswordDialog = false"
|
||||
@logout="logout"/>
|
||||
<bind-mobile v-if="isLogin" :show="showBindMobileDialog" width="100%" :mobile="user.mobile"
|
||||
@hide="showBindMobileDialog = false"/>
|
||||
<reward-verify v-if="isLogin" :show="showRewardVerifyDialog" @hide="showRewardVerifyDialog = false"/>
|
||||
<el-dialog
|
||||
v-model="showRewardDialog"
|
||||
@@ -135,11 +130,9 @@ import LoginDialog from "@/components/LoginDialog.vue";
|
||||
import {checkSession} from "@/action/session";
|
||||
import UserProfile from "@/components/UserProfile.vue";
|
||||
import PasswordDialog from "@/components/PasswordDialog.vue";
|
||||
import BindMobile from "@/components/BindMobile.vue";
|
||||
import RewardVerify from "@/components/RewardVerify.vue";
|
||||
import {useRouter} from "vue-router";
|
||||
import {removeUserToken} from "@/store/session";
|
||||
import UserOrder from "@/components/UserOrder.vue";
|
||||
import CountDown from "@/components/CountDown.vue";
|
||||
|
||||
const listBoxHeight = window.innerHeight - 97
|
||||
@@ -151,7 +144,6 @@ const enableReward = ref(false) // 是否启用众筹功能
|
||||
const rewardImg = ref('/images/reward.png')
|
||||
const qrcode = ref("")
|
||||
const showPasswordDialog = ref(false);
|
||||
const showBindMobileDialog = ref(false);
|
||||
const showRewardDialog = ref(false);
|
||||
const showRewardVerifyDialog = ref(false);
|
||||
const text = ref("")
|
||||
|
||||
Reference in New Issue
Block a user