@sugarat/easypicker2-client 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +6 -0
- package/.env.production +3 -0
- package/.env.test +4 -0
- package/.eslintignore +0 -0
- package/.eslintrc.json +57 -0
- package/.github/workflows/main.yml +61 -0
- package/.prettierrc.js +9 -0
- package/LICENSE +21 -0
- package/README.md +86 -0
- package/auto-imports.d.ts +6 -0
- package/components.d.ts +56 -0
- package/docker/ep_backup/easypicker2.sql +214 -0
- package/docker/ep_backup/mongodb/easypicker2/action.bson +0 -0
- package/docker/ep_backup/mongodb/easypicker2/action.metadata.json +1 -0
- package/docker/ep_backup/mongodb/easypicker2/log.bson +0 -0
- package/docker/ep_backup/mongodb/easypicker2/log.metadata.json +1 -0
- package/docker/ep_backup/user-config.json +176 -0
- package/docs/.env +1 -0
- package/docs/.env.production +2 -0
- package/docs/.vitepress/config.ts +204 -0
- package/docs/.vitepress/theme/bg.png +0 -0
- package/docs/.vitepress/theme/index.scss +41 -0
- package/docs/.vitepress/theme/index.ts +5 -0
- package/docs/author.md +24 -0
- package/docs/auto-imports.d.ts +6 -0
- package/docs/components.d.ts +17 -0
- package/docs/deploy/design/api.md +3 -0
- package/docs/deploy/design/db.md +3 -0
- package/docs/deploy/design/index.md +3 -0
- package/docs/deploy/design/shell.md +9 -0
- package/docs/deploy/faq.md +86 -0
- package/docs/deploy/index.md +9 -0
- package/docs/deploy/local.md +275 -0
- package/docs/deploy/online-new.md +610 -0
- package/docs/deploy/online.md +683 -0
- package/docs/deploy/qiniu.md +183 -0
- package/docs/index.md +40 -0
- package/docs/introduction/about/code.md +26 -0
- package/docs/introduction/about/index.md +33 -0
- package/docs/introduction/feature/index.md +3 -0
- package/docs/plan/log.md +333 -0
- package/docs/plan/todo.md +127 -0
- package/docs/plan/wish.md +29 -0
- package/docs/praise/index.md +45 -0
- package/docs/public/favicon.ico +0 -0
- package/docs/public/logo.png +0 -0
- package/docs/public/robots.txt +2 -0
- package/docs/src/apis/ajax.ts +66 -0
- package/docs/src/apis/index.ts +1 -0
- package/docs/src/apis/modules/wish.ts +20 -0
- package/docs/src/components/Avatar.vue +60 -0
- package/docs/src/components/Home.vue +85 -0
- package/docs/src/components/Picture.vue +13 -0
- package/docs/src/components/Praise.vue +52 -0
- package/docs/src/components/WishBtn.vue +98 -0
- package/docs/src/components/WishPanel.vue +170 -0
- package/docs/src/components/callme/index.vue +72 -0
- package/docs/vite.config.ts +42 -0
- package/index.html +127 -0
- package/package.json +52 -0
- package/public/favicon.ico +0 -0
- package/public/logo.png +0 -0
- package/scripts/deploy/docs.mjs +24 -0
- package/scripts/deploy/prod.mjs +24 -0
- package/scripts/deploy/test.mjs +26 -0
- package/src/@types/ajax.d.ts +5 -0
- package/src/@types/api.d.ts +305 -0
- package/src/@types/lib.d.ts +26 -0
- package/src/@types/page.d.ts +18 -0
- package/src/App.vue +36 -0
- package/src/apis/ajax.ts +70 -0
- package/src/apis/index.ts +20 -0
- package/src/apis/modules/action.ts +17 -0
- package/src/apis/modules/category.ts +20 -0
- package/src/apis/modules/config.ts +19 -0
- package/src/apis/modules/file.ts +150 -0
- package/src/apis/modules/people.ts +81 -0
- package/src/apis/modules/public.ts +49 -0
- package/src/apis/modules/super/overview.ts +56 -0
- package/src/apis/modules/super/user.ts +62 -0
- package/src/apis/modules/task.ts +67 -0
- package/src/apis/modules/user.ts +56 -0
- package/src/apis/modules/wish.ts +31 -0
- package/src/assets/i/EasyPicker.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/assets/styles/app.css +69 -0
- package/src/components/HomeFooter/index.vue +134 -0
- package/src/components/HomeHeader/index.vue +156 -0
- package/src/components/InfosForm/index.vue +73 -0
- package/src/components/MessageList/index.vue +155 -0
- package/src/components/MessagePanel/index.vue +42 -0
- package/src/components/Praise/index.vue +102 -0
- package/src/components/QrCode.vue +44 -0
- package/src/components/linkDialog.vue +104 -0
- package/src/components/loginPanel.vue +92 -0
- package/src/constants/index.ts +83 -0
- package/src/env.d.ts +8 -0
- package/src/main.ts +19 -0
- package/src/pages/404/index.vue +59 -0
- package/src/pages/about/index.vue +152 -0
- package/src/pages/callme/index.vue +155 -0
- package/src/pages/dashboard/config/index.vue +264 -0
- package/src/pages/dashboard/files/index.vue +1152 -0
- package/src/pages/dashboard/index.vue +335 -0
- package/src/pages/dashboard/manage/config/index.vue +97 -0
- package/src/pages/dashboard/manage/index.vue +105 -0
- package/src/pages/dashboard/manage/overview/index.vue +488 -0
- package/src/pages/dashboard/manage/user/index.vue +679 -0
- package/src/pages/dashboard/manage/wish/index.vue +257 -0
- package/src/pages/dashboard/tasks/components/CategoryPanel.vue +208 -0
- package/src/pages/dashboard/tasks/components/CreateTask.vue +93 -0
- package/src/pages/dashboard/tasks/components/TaskInfo.vue +129 -0
- package/src/pages/dashboard/tasks/components/infoPanel/ddl.vue +96 -0
- package/src/pages/dashboard/tasks/components/infoPanel/file.vue +175 -0
- package/src/pages/dashboard/tasks/components/infoPanel/info.vue +477 -0
- package/src/pages/dashboard/tasks/components/infoPanel/people.vue +567 -0
- package/src/pages/dashboard/tasks/components/infoPanel/template.vue +146 -0
- package/src/pages/dashboard/tasks/components/infoPanel/tip.vue +55 -0
- package/src/pages/dashboard/tasks/components/infoPanel/tipInfo.vue +196 -0
- package/src/pages/dashboard/tasks/index.vue +302 -0
- package/src/pages/dashboard/tasks/public.ts +32 -0
- package/src/pages/disabled/index.vue +47 -0
- package/src/pages/feedback/index.vue +5 -0
- package/src/pages/home/index.vue +72 -0
- package/src/pages/login/index.vue +270 -0
- package/src/pages/register/index.vue +211 -0
- package/src/pages/reset/index.vue +186 -0
- package/src/pages/task/index.vue +897 -0
- package/src/pages/wish/index.vue +152 -0
- package/src/router/Interceptor/index.ts +112 -0
- package/src/router/index.ts +13 -0
- package/src/router/routes/index.ts +197 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/store/index.ts +17 -0
- package/src/store/modules/category.ts +44 -0
- package/src/store/modules/public.ts +27 -0
- package/src/store/modules/task.ts +55 -0
- package/src/store/modules/user.ts +57 -0
- package/src/utils/elementUI.ts +8 -0
- package/src/utils/networkUtil.ts +236 -0
- package/src/utils/other.ts +25 -0
- package/src/utils/regExp.ts +11 -0
- package/src/utils/stringUtil.ts +242 -0
- package/tsconfig.json +24 -0
- package/vite.config.ts +55 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="home">
|
|
3
|
+
<!-- 顶部导航栏 -->
|
|
4
|
+
<header>
|
|
5
|
+
<HomeHeader />
|
|
6
|
+
</header>
|
|
7
|
+
<h1 class="title">EasyPicker</h1>
|
|
8
|
+
|
|
9
|
+
<!-- 简介 -->
|
|
10
|
+
<section class="introduce">
|
|
11
|
+
<p v-for="(item, index) in introduces" :key="index">{{ item }}</p>
|
|
12
|
+
</section>
|
|
13
|
+
<section class="introduce">
|
|
14
|
+
<p>
|
|
15
|
+
<router-link to="/login">点我登陆</router-link>
|
|
16
|
+
</p>
|
|
17
|
+
<p>
|
|
18
|
+
<router-link to="/register">没有账号? 去注册</router-link>
|
|
19
|
+
</p>
|
|
20
|
+
</section>
|
|
21
|
+
<footer>
|
|
22
|
+
<!-- 底部导航栏 -->
|
|
23
|
+
<HomeFooter />
|
|
24
|
+
</footer>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
<script lang="ts" setup>
|
|
28
|
+
import { reactive } from 'vue'
|
|
29
|
+
import HomeHeader from '@components/HomeHeader/index.vue'
|
|
30
|
+
import HomeFooter from '@components/HomeFooter/index.vue'
|
|
31
|
+
|
|
32
|
+
const introduces: string[] = reactive([
|
|
33
|
+
'一款在线文件收取助手',
|
|
34
|
+
'自动归档,记录每次提交的文件信息与提交人信息',
|
|
35
|
+
'随时随地下载,查看收取详细情况',
|
|
36
|
+
])
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<style lang="scss" scoped>
|
|
41
|
+
.home {
|
|
42
|
+
font-family: "Avenir", Helvetica, Arial, sans-serif;
|
|
43
|
+
background-image: linear-gradient(to top, #30cfd0 0%, #330867 100%);
|
|
44
|
+
min-height: 100vh;
|
|
45
|
+
}
|
|
46
|
+
.title {
|
|
47
|
+
color: aliceblue;
|
|
48
|
+
text-align: center;
|
|
49
|
+
font-weight: lighter;
|
|
50
|
+
font-size: 60px;
|
|
51
|
+
padding-top: 22vh;
|
|
52
|
+
}
|
|
53
|
+
.introduce {
|
|
54
|
+
padding: 10px;
|
|
55
|
+
color: aliceblue;
|
|
56
|
+
text-align: center;
|
|
57
|
+
p {
|
|
58
|
+
margin-top: 10px;
|
|
59
|
+
}
|
|
60
|
+
a {
|
|
61
|
+
color: aliceblue;
|
|
62
|
+
font-weight: bold;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
footer {
|
|
66
|
+
position: absolute;
|
|
67
|
+
bottom: 20px;
|
|
68
|
+
left: 0;
|
|
69
|
+
right: 0;
|
|
70
|
+
// margin-top: 25vh;
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="login">
|
|
3
|
+
<login-panel>
|
|
4
|
+
<!-- 表单输入区域 -->
|
|
5
|
+
<div class="inputArea">
|
|
6
|
+
<div>
|
|
7
|
+
<el-input
|
|
8
|
+
:placeholder="accountLogin ? '输入账号/手机号' : '输入手机号'"
|
|
9
|
+
:prefix-icon="accountLogin ? User : Phone"
|
|
10
|
+
v-model="account"
|
|
11
|
+
clearable
|
|
12
|
+
>
|
|
13
|
+
<template #append>
|
|
14
|
+
<template v-if="accountLogin">
|
|
15
|
+
<el-button @click="accountLogin = !accountLogin"
|
|
16
|
+
>验证码登录</el-button
|
|
17
|
+
>
|
|
18
|
+
</template>
|
|
19
|
+
<template v-else>
|
|
20
|
+
<el-button @click="accountLogin = !accountLogin"
|
|
21
|
+
>账号登录</el-button
|
|
22
|
+
>
|
|
23
|
+
</template>
|
|
24
|
+
</template>
|
|
25
|
+
</el-input>
|
|
26
|
+
</div>
|
|
27
|
+
<div>
|
|
28
|
+
<el-input
|
|
29
|
+
maxlength="16"
|
|
30
|
+
minlength="6"
|
|
31
|
+
:type="accountLogin ? 'password' : 'number'"
|
|
32
|
+
:placeholder="accountLogin ? '请输入密码' : '请输入验证码'"
|
|
33
|
+
:prefix-icon="Lock"
|
|
34
|
+
v-model="pwd"
|
|
35
|
+
:show-password="accountLogin"
|
|
36
|
+
clearable
|
|
37
|
+
>
|
|
38
|
+
<template #append>
|
|
39
|
+
<el-button v-if="accountLogin">
|
|
40
|
+
<router-link style="color: #909399" to="/reset"
|
|
41
|
+
>忘记密码?</router-link
|
|
42
|
+
>
|
|
43
|
+
</el-button>
|
|
44
|
+
<!-- 获取验证码 -->
|
|
45
|
+
<el-button :disabled="time !== 0" @click="getCode" v-else>{{
|
|
46
|
+
codeText
|
|
47
|
+
}}</el-button>
|
|
48
|
+
</template>
|
|
49
|
+
</el-input>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="tc">
|
|
52
|
+
<el-checkbox v-model="remember">记住登录信息?</el-checkbox>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="tc">
|
|
55
|
+
<el-button @click="login()" type="primary" class="fw-w100"
|
|
56
|
+
>登录</el-button
|
|
57
|
+
>
|
|
58
|
+
</div>
|
|
59
|
+
<el-divider></el-divider>
|
|
60
|
+
<div class="links">
|
|
61
|
+
<router-link to="/register">快速注册</router-link>
|
|
62
|
+
</div>
|
|
63
|
+
<div class="links" style="margin-top: 20px">
|
|
64
|
+
<el-link target="_blank" href="https://support.qq.com/product/444158"
|
|
65
|
+
>问题反馈?</el-link
|
|
66
|
+
>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</login-panel>
|
|
70
|
+
</div>
|
|
71
|
+
</template>
|
|
72
|
+
<script setup lang="ts">
|
|
73
|
+
import { ElMessage } from 'element-plus'
|
|
74
|
+
import { onMounted, ref } from 'vue'
|
|
75
|
+
import { useRouter } from 'vue-router'
|
|
76
|
+
import { useStore } from 'vuex'
|
|
77
|
+
import loginPanel from '@components/loginPanel.vue'
|
|
78
|
+
import { User, Phone, Lock } from '@element-plus/icons-vue'
|
|
79
|
+
import { rMobilePhone, rPassword, rVerCode } from '@/utils/regExp'
|
|
80
|
+
import { formatDate } from '@/utils/stringUtil'
|
|
81
|
+
import { PublicApi, UserApi } from '@/apis'
|
|
82
|
+
|
|
83
|
+
const account = ref('')
|
|
84
|
+
const pwd = ref('')
|
|
85
|
+
const remember = ref(false)
|
|
86
|
+
const accountLogin = ref(true)
|
|
87
|
+
const $store = useStore()
|
|
88
|
+
const $router = useRouter()
|
|
89
|
+
const redirectDashBoard = (system?: boolean) => {
|
|
90
|
+
if (system) {
|
|
91
|
+
$router.replace({
|
|
92
|
+
name: 'config'
|
|
93
|
+
})
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
const { redirect } = $router.currentRoute.value.query
|
|
97
|
+
if (redirect) {
|
|
98
|
+
$router.replace({
|
|
99
|
+
path: `${redirect}`
|
|
100
|
+
})
|
|
101
|
+
return
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
$router.replace({
|
|
105
|
+
name: 'dashboard'
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
const checkForm = () => {
|
|
109
|
+
if (account.value.length === 11) {
|
|
110
|
+
if (!rMobilePhone.test(account.value)) {
|
|
111
|
+
ElMessage.warning('手机号格式不正确')
|
|
112
|
+
return false
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// else if (!rAccount.test(account.value)) {
|
|
116
|
+
// 兼容老平台数据,不校验账号
|
|
117
|
+
// ElMessage.warning('帐号格式不正确(4-11位 数字字母)')
|
|
118
|
+
// return false
|
|
119
|
+
// }
|
|
120
|
+
|
|
121
|
+
if (accountLogin.value && !rPassword.test(pwd.value)) {
|
|
122
|
+
ElMessage.warning('密码格式不正确(6-16位 支持字母/数字/下划线)')
|
|
123
|
+
return false
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (!accountLogin.value && !rVerCode.test(pwd.value)) {
|
|
127
|
+
ElMessage.warning('验证码不正确(4位 数字)')
|
|
128
|
+
return false
|
|
129
|
+
}
|
|
130
|
+
return true
|
|
131
|
+
}
|
|
132
|
+
const codeText = ref('获取验证码')
|
|
133
|
+
const time = ref(0)
|
|
134
|
+
const refreshCodeText = () => {
|
|
135
|
+
if (time.value === 0) {
|
|
136
|
+
codeText.value = '获取验证码'
|
|
137
|
+
return
|
|
138
|
+
}
|
|
139
|
+
codeText.value = `${time.value}s`
|
|
140
|
+
time.value -= 1
|
|
141
|
+
setTimeout(refreshCodeText, 1000)
|
|
142
|
+
}
|
|
143
|
+
const getCode = () => {
|
|
144
|
+
if (!rMobilePhone.test(account.value)) {
|
|
145
|
+
ElMessage.warning('手机号格式不正确')
|
|
146
|
+
return
|
|
147
|
+
}
|
|
148
|
+
PublicApi.getCode(account.value)
|
|
149
|
+
.then(() => {
|
|
150
|
+
time.value = 120
|
|
151
|
+
refreshCodeText()
|
|
152
|
+
ElMessage.success('获取成功,请注意查看手机短信')
|
|
153
|
+
})
|
|
154
|
+
.catch((err) => {
|
|
155
|
+
const { code: c } = err
|
|
156
|
+
const msg = '注册失败,未知错误'
|
|
157
|
+
const options = {
|
|
158
|
+
1006: '手机号格式不正确'
|
|
159
|
+
}
|
|
160
|
+
ElMessage.error(options[c] || msg)
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const loginErrorMsg = (err: any, msg: string) => {
|
|
165
|
+
const { code, data } = err
|
|
166
|
+
const msgs: any = {
|
|
167
|
+
1010: '账号已被封禁,有疑问请联系管理员',
|
|
168
|
+
1009: `账号已被冻结,解冻时间${
|
|
169
|
+
data?.openTime && formatDate(new Date(data.openTime))
|
|
170
|
+
}`
|
|
171
|
+
}
|
|
172
|
+
ElMessage.error({
|
|
173
|
+
type: 'error',
|
|
174
|
+
message: msgs[code] || msg
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
const login = () => {
|
|
178
|
+
if (!checkForm()) {
|
|
179
|
+
return
|
|
180
|
+
}
|
|
181
|
+
// 账号密码
|
|
182
|
+
if (accountLogin.value) {
|
|
183
|
+
if (remember.value) {
|
|
184
|
+
localStorage.setItem(
|
|
185
|
+
'userinfo',
|
|
186
|
+
JSON.stringify({
|
|
187
|
+
account: account.value,
|
|
188
|
+
pwd: pwd.value,
|
|
189
|
+
remember: remember.value
|
|
190
|
+
})
|
|
191
|
+
)
|
|
192
|
+
} else {
|
|
193
|
+
localStorage.removeItem('userinfo')
|
|
194
|
+
}
|
|
195
|
+
UserApi.login(account.value, pwd.value)
|
|
196
|
+
.then((res) => {
|
|
197
|
+
const { token, system } = res.data
|
|
198
|
+
$store.commit('user/setToken', token)
|
|
199
|
+
$store.commit('user/setSystem', system)
|
|
200
|
+
ElMessage.success({
|
|
201
|
+
message: '登录成功',
|
|
202
|
+
duration: 500
|
|
203
|
+
})
|
|
204
|
+
redirectDashBoard(system)
|
|
205
|
+
})
|
|
206
|
+
.catch((err) => {
|
|
207
|
+
loginErrorMsg(err, '密码不正确')
|
|
208
|
+
})
|
|
209
|
+
} else {
|
|
210
|
+
// 手机号验证码登录
|
|
211
|
+
UserApi.codeLogin(account.value, pwd.value)
|
|
212
|
+
.then((res) => {
|
|
213
|
+
const { token } = res.data
|
|
214
|
+
$store.commit('user/setToken', token)
|
|
215
|
+
$store.commit('user/setSystem', false)
|
|
216
|
+
ElMessage.success({
|
|
217
|
+
message: '登录成功',
|
|
218
|
+
duration: 500
|
|
219
|
+
})
|
|
220
|
+
redirectDashBoard()
|
|
221
|
+
})
|
|
222
|
+
.catch((err) => {
|
|
223
|
+
loginErrorMsg(err, '验证码不正确')
|
|
224
|
+
})
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
onMounted(() => {
|
|
228
|
+
const token = localStorage.getItem('token')
|
|
229
|
+
if (token) {
|
|
230
|
+
redirectDashBoard(localStorage.getItem('system') === 'true')
|
|
231
|
+
return
|
|
232
|
+
}
|
|
233
|
+
const info = localStorage.getItem('userinfo')
|
|
234
|
+
if (info) {
|
|
235
|
+
const user = JSON.parse(info)
|
|
236
|
+
account.value = user.account
|
|
237
|
+
pwd.value = user.pwd
|
|
238
|
+
remember.value = user.remember
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
</script>
|
|
242
|
+
|
|
243
|
+
<style scoped lang="scss">
|
|
244
|
+
.login {
|
|
245
|
+
background-image: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
|
|
246
|
+
min-height: 100vh;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.inputArea {
|
|
250
|
+
// padding: 1rem;
|
|
251
|
+
margin: 0 auto;
|
|
252
|
+
max-width: 320px;
|
|
253
|
+
div {
|
|
254
|
+
margin-top: 10px;
|
|
255
|
+
}
|
|
256
|
+
:deep(.el-input-group__append) {
|
|
257
|
+
width: 80px;
|
|
258
|
+
padding: 0 10px;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// 登录按钮下方链接
|
|
262
|
+
.links {
|
|
263
|
+
display: flex;
|
|
264
|
+
justify-content: center;
|
|
265
|
+
a {
|
|
266
|
+
color: #409eff;
|
|
267
|
+
margin-left: 10px;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
</style>
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="register">
|
|
3
|
+
<login-panel>
|
|
4
|
+
<div class="inputArea">
|
|
5
|
+
<div>
|
|
6
|
+
<el-input
|
|
7
|
+
maxlength="11"
|
|
8
|
+
placeholder="输入账号"
|
|
9
|
+
:prefix-icon="User"
|
|
10
|
+
v-model="account"
|
|
11
|
+
clearable
|
|
12
|
+
></el-input>
|
|
13
|
+
</div>
|
|
14
|
+
<div>
|
|
15
|
+
<el-input
|
|
16
|
+
maxlength="16"
|
|
17
|
+
minlength="6"
|
|
18
|
+
type="password"
|
|
19
|
+
placeholder="请输入密码"
|
|
20
|
+
:prefix-icon="Lock"
|
|
21
|
+
v-model="pwd1"
|
|
22
|
+
show-password
|
|
23
|
+
clearable
|
|
24
|
+
></el-input>
|
|
25
|
+
</div>
|
|
26
|
+
<div>
|
|
27
|
+
<el-input
|
|
28
|
+
maxlength="16"
|
|
29
|
+
minlength="6"
|
|
30
|
+
type="password"
|
|
31
|
+
placeholder="请再次输入密码"
|
|
32
|
+
:prefix-icon="Lock"
|
|
33
|
+
v-model="pwd2"
|
|
34
|
+
show-password
|
|
35
|
+
clearable
|
|
36
|
+
></el-input>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="tc">
|
|
39
|
+
<el-checkbox v-model="bindPhone">绑定手机</el-checkbox>
|
|
40
|
+
<el-tooltip
|
|
41
|
+
effect="dark"
|
|
42
|
+
content="可用于修改/找回密码"
|
|
43
|
+
placement="top-start"
|
|
44
|
+
>
|
|
45
|
+
<el-icon :size="16">
|
|
46
|
+
<QuestionFilled />
|
|
47
|
+
</el-icon>
|
|
48
|
+
</el-tooltip>
|
|
49
|
+
</div>
|
|
50
|
+
<div v-if="bindPhone">
|
|
51
|
+
<el-input
|
|
52
|
+
maxlength="11"
|
|
53
|
+
placeholder="输入手机号"
|
|
54
|
+
:prefix-icon="Phone"
|
|
55
|
+
v-model="phone"
|
|
56
|
+
clearable
|
|
57
|
+
></el-input>
|
|
58
|
+
</div>
|
|
59
|
+
<div v-if="bindPhone">
|
|
60
|
+
<el-input
|
|
61
|
+
maxlength="4"
|
|
62
|
+
type="number"
|
|
63
|
+
placeholder="请输入验证码"
|
|
64
|
+
:prefix-icon="Lock"
|
|
65
|
+
v-model="code"
|
|
66
|
+
clearable
|
|
67
|
+
>
|
|
68
|
+
<template #append>
|
|
69
|
+
<el-button :disabled="time !== 0" @click="getCode">{{
|
|
70
|
+
codeText
|
|
71
|
+
}}</el-button>
|
|
72
|
+
</template>
|
|
73
|
+
</el-input>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="tc">
|
|
76
|
+
<el-button @click="handleRegister" type="primary">注册</el-button>
|
|
77
|
+
</div>
|
|
78
|
+
<el-divider></el-divider>
|
|
79
|
+
<div class="links">
|
|
80
|
+
<router-link to="/login">已有账号,去登陆</router-link>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="links" style="margin-top: 20px">
|
|
83
|
+
<el-link target="_blank" href="https://support.qq.com/product/444158"
|
|
84
|
+
>问题反馈?</el-link
|
|
85
|
+
>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</login-panel>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
<script setup lang="ts">
|
|
92
|
+
import { ref } from 'vue'
|
|
93
|
+
import { useRouter } from 'vue-router'
|
|
94
|
+
import { ElMessage } from 'element-plus'
|
|
95
|
+
import loginPanel from '@components/loginPanel.vue'
|
|
96
|
+
import { useStore } from 'vuex'
|
|
97
|
+
import { User, Lock, Phone, QuestionFilled } from '@element-plus/icons-vue'
|
|
98
|
+
import { rAccount, rMobilePhone, rPassword, rVerCode } from '@/utils/regExp'
|
|
99
|
+
import { PublicApi, UserApi } from '@/apis'
|
|
100
|
+
|
|
101
|
+
const $store = useStore()
|
|
102
|
+
const account = ref('')
|
|
103
|
+
const pwd1 = ref('')
|
|
104
|
+
const pwd2 = ref('')
|
|
105
|
+
const phone = ref('')
|
|
106
|
+
const code = ref('')
|
|
107
|
+
const $router = useRouter()
|
|
108
|
+
const bindPhone = ref(false)
|
|
109
|
+
const codeText = ref('获取验证码')
|
|
110
|
+
const time = ref(0)
|
|
111
|
+
const refreshCodeText = () => {
|
|
112
|
+
if (time.value === 0) {
|
|
113
|
+
codeText.value = '获取验证码'
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
codeText.value = `${time.value}s`
|
|
117
|
+
time.value -= 1
|
|
118
|
+
setTimeout(refreshCodeText, 1000)
|
|
119
|
+
}
|
|
120
|
+
const getCode = () => {
|
|
121
|
+
if (!rMobilePhone.test(phone.value)) {
|
|
122
|
+
ElMessage.warning('手机号格式不正确')
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
PublicApi.getCode(phone.value).then(() => {
|
|
126
|
+
time.value = 120
|
|
127
|
+
refreshCodeText()
|
|
128
|
+
ElMessage.success('获取成功,请注意查看手机短信')
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
const checkForm = () => {
|
|
132
|
+
if (!rAccount.test(account.value)) {
|
|
133
|
+
ElMessage.warning('帐号格式不正确(4-11位 数字字母)')
|
|
134
|
+
return false
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (!rPassword.test(pwd1.value)) {
|
|
138
|
+
ElMessage.warning('密码格式不正确(6-16位 支持字母/数字/下划线)')
|
|
139
|
+
return false
|
|
140
|
+
}
|
|
141
|
+
if (pwd1.value !== pwd2.value) {
|
|
142
|
+
ElMessage.warning('两次输入的密码不一致')
|
|
143
|
+
return false
|
|
144
|
+
}
|
|
145
|
+
if (bindPhone.value) {
|
|
146
|
+
if (!rMobilePhone.test(phone.value)) {
|
|
147
|
+
ElMessage.warning('手机号格式不正确')
|
|
148
|
+
return false
|
|
149
|
+
}
|
|
150
|
+
if (!rVerCode.test(code.value)) {
|
|
151
|
+
ElMessage.warning('验证码不正确(4位 数字)')
|
|
152
|
+
return false
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return true
|
|
156
|
+
}
|
|
157
|
+
const handleRegister = () => {
|
|
158
|
+
if (!checkForm()) {
|
|
159
|
+
return
|
|
160
|
+
}
|
|
161
|
+
UserApi.register({
|
|
162
|
+
account: account.value,
|
|
163
|
+
pwd: pwd1.value,
|
|
164
|
+
bindPhone: bindPhone.value,
|
|
165
|
+
phone: phone.value,
|
|
166
|
+
code: code.value
|
|
167
|
+
})
|
|
168
|
+
.then((res) => {
|
|
169
|
+
const { token } = res.data
|
|
170
|
+
$store.commit('user/setToken', token)
|
|
171
|
+
ElMessage.success('注册成功')
|
|
172
|
+
$router.replace({
|
|
173
|
+
name: 'dashboard'
|
|
174
|
+
})
|
|
175
|
+
})
|
|
176
|
+
.catch((err) => {
|
|
177
|
+
const { code: c } = err
|
|
178
|
+
const msg = '注册失败,未知错误'
|
|
179
|
+
const options: any = {
|
|
180
|
+
1001: '账号已存在',
|
|
181
|
+
1002: '手机号已被注册',
|
|
182
|
+
1003: '验证码不正确',
|
|
183
|
+
1004: '密码格式不正确',
|
|
184
|
+
1006: '手机号格式不正确'
|
|
185
|
+
}
|
|
186
|
+
ElMessage.error(options[c] || msg)
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
</script>
|
|
190
|
+
<style scoped lang="scss">
|
|
191
|
+
.register {
|
|
192
|
+
background-image: linear-gradient(120deg, #a1c4fd 0%, #c2e9fb 100%);
|
|
193
|
+
min-height: 100vh;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.inputArea {
|
|
197
|
+
margin: 0 auto;
|
|
198
|
+
max-width: 320px;
|
|
199
|
+
> div {
|
|
200
|
+
margin-top: 10px;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
.links {
|
|
204
|
+
display: flex;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
a {
|
|
207
|
+
color: #409eff;
|
|
208
|
+
margin-left: 10px;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
</style>
|