Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/1.8.0-uniapp

 Conflicts:
	sql/ruoyi-vue-pro.sql
	yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm
This commit is contained in:
YunaiV
2022-05-04 23:44:11 +08:00
290 changed files with 28512 additions and 14831 deletions

View File

@ -73,26 +73,11 @@ export function getSchemaTableList(query) {
}
// 基于数据库的表结构,创建代码生成器的表定义
export function createCodegenListFromDB(tableNames) {
export function createCodegenList(data) {
return request({
url: '/infra/codegen/create-list-from-db',
url: '/infra/codegen/create-list',
method: 'post',
headers:{
'Content-type': 'application/x-www-form-urlencoded'
},
data: 'tableNames=' + tableNames
})
}
// 基于 SQL 建表语句,创建代码生成器的表定义
export function createCodegenListFromSQL(data) {
return request({
url: '/infra/codegen/create-list-from-sql',
method: 'post',
headers:{
'Content-type': 'application/x-www-form-urlencoded'
},
data: 'sql=' + data.sql,
data: data
})
}

View File

@ -0,0 +1,43 @@
import request from '@/utils/request'
// 创建数据源配置
export function createDataSourceConfig(data) {
return request({
url: '/infra/data-source-config/create',
method: 'post',
data: data
})
}
// 更新数据源配置
export function updateDataSourceConfig(data) {
return request({
url: '/infra/data-source-config/update',
method: 'put',
data: data
})
}
// 删除数据源配置
export function deleteDataSourceConfig(id) {
return request({
url: '/infra/data-source-config/delete?id=' + id,
method: 'delete'
})
}
// 获得数据源配置
export function getDataSourceConfig(id) {
return request({
url: '/infra/data-source-config/get?id=' + id,
method: 'get'
})
}
// 获得数据源配置列表
export function getDataSourceConfigList() {
return request({
url: '/infra/data-source-config/list',
method: 'get',
})
}

View File

@ -9,7 +9,7 @@ export function login(username, password, code, uuid) {
uuid
}
return request({
url: '/system/login',
url: '/system/auth/login',
method: 'post',
data: data
})
@ -18,7 +18,7 @@ export function login(username, password, code, uuid) {
// 获取用户详细信息
export function getInfo() {
return request({
url: '/system/get-permission-info',
url: '/system/auth/get-permission-info',
method: 'get'
})
}
@ -43,15 +43,15 @@ export function getCodeImg() {
// 社交授权的跳转
export function socialAuthRedirect(type, redirectUri) {
return request({
url: '/system/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri,
url: '/system/auth/social-auth-redirect?type=' + type + '&redirectUri=' + redirectUri,
method: 'get'
})
}
// 社交登录,使用 code 授权码
export function socialLogin(type, code, state) {
// 社交快捷登录,使用 code 授权码
export function socialQuickLogin(type, code, state) {
return request({
url: '/system/social-login',
url: '/system/auth/social-quick-login',
method: 'post',
data: {
type,
@ -61,10 +61,10 @@ export function socialLogin(type, code, state) {
})
}
// 社交登录,使用 code 授权码 + + 账号密码
export function socialLogin2(type, code, state, username, password) {
// 社交绑定登录,使用 code 授权码 + + 账号密码
export function socialBindLogin(type, code, state, username, password) {
return request({
url: '/system/social-login2',
url: '/system/auth/social-bind-login',
method: 'post',
data: {
type,
@ -76,27 +76,26 @@ export function socialLogin2(type, code, state, username, password) {
})
}
// 社交绑定,使用 code 授权
export function socialBind(type, code, state) {
// 获取登录验证
export function sendSmsCode(mobile, scene) {
return request({
url: '/system/social-bind',
url: '/system/auth/send-sms-code',
method: 'post',
data: {
type,
code,
state,
mobile,
scene
}
})
}
// 取消社交绑定
export function socialUnbind(type, unionId) {
// 短信验证码登录
export function smsLogin(mobile, code) {
return request({
url: '/system/social-unbind',
method: 'delete',
url: '/system/auth/sms-login',
method: 'post',
data: {
type,
unionId
mobile,
code
}
})
}

View File

@ -3,7 +3,7 @@ import request from '@/utils/request'
// 获取路由
export const getRouters = () => {
return request({
url: '/system/list-menus',
url: '/system/auth/list-menus',
method: 'get'
})
}

View File

@ -0,0 +1,26 @@
import request from "@/utils/request";
// 社交绑定,使用 code 授权码
export function socialBind(type, code, state) {
return request({
url: '/system/social-user/bind',
method: 'post',
data: {
type,
code,
state,
}
})
}
// 取消社交绑定
export function socialUnbind(type, openid) {
return request({
url: '/system/social-user/unbind',
method: 'delete',
data: {
type,
openid
}
})
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 509 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
yudao-ui-admin/src/assets/images/profile.jpg Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,387 @@
/* ===== PC DESIGN ===== */
$W: 1000;
$H: 1920;
$picW: 438;
$picH: 560;
$formW: 320;
$tabW: $formW / 2;
$rowH: 56;
$buttonH: 50;
// container
$containerBgColor: #e6ebf2;
$containerBgImage: '../assets/images/bg.png';
// container-logo
$logoWidth: 417px;
$logoHeight: 64px;
$logoImage: '../assets/logo/login-logo.png';
// container-content
$contentWidth: round($W / $H * 100) * 1vw;
$contentHeight: round($picH / $W * 100) / 100 * $contentWidth;
$contentBgColor: #ffffff;
// container-content-pic
$picWidth: round($picW / $H * 100) * 1vw;
$picHeight: inherit;
$picImage: '../assets/images/pic.png';
// container-content-field
$fieldWidth: $contentWidth - $picWidth;
$fieldHeight: inherit;
// container-content-field-form
$formWidth: $formW * 1px;
$tabWidth: $tabW * 1px;
$rowHeight: $rowH * 1px;
$buttonHeight: $buttonH * 1px;
// - - - - - 页面基础设置
.container {
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
width:100%;max-width:100px; height:auto;
vertical-align: middle;
}
}
// 元素
width: inherit;
height: inherit;
min-width: 1080px;
min-height: 620px;
background-color: $containerBgColor;
background-image: url($containerBgImage);
background-size: cover;
// 定位
position: relative;
display: flex;
justify-content: center;
align-items: center;
// 文字
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: 400;
.logo {
// 元素
width: $logoWidth;
height: $logoHeight;
background-image: url($logoImage);
background-size: contain;
// 定位
position: absolute;
top: 50px;
left: 50%;
margin-left: -$logoWidth/2;
}
.content {
// 元素
width: $contentWidth;
height: $contentHeight;
background-color: #ffffff;
box-shadow: 0px 16px 40px rgba(0, 0, 0, 0.07);
border-radius: 20px;
// 定位
position: relative;
.pic {
// 元素
width: $picWidth;
height: $picHeight;
background-image: url($picImage);
background-repeat: no-repeat;
background-size: cover;
border-radius: 20px 0 0 20px;
// 定位
position: absolute;
top: 0;
left: 0;
}
.field {
width: $fieldWidth;
height: $fieldHeight;
// 定位
position: absolute;
top: 0;
left: $picWidth;
display:flex;
justify-content: center;
align-items: center;
.pc-title{ width: 100%; clear: both;}
.mobile-title,
.mobile-switch {
display: none;
}
.form {
box-sizing: border-box;
width: $formWidth;
// - - - tab
:deep(.el-tabs__content) {
padding: 20px 0 0;
}
:deep(.el-tabs__item) {
// 元素
width: $tabWidth;
height: $rowHeight;
padding: 0;
// 文字
line-height: $rowHeight;
color: #666666;
}
:deep(.el-tabs__item.is-active) {
font-weight: bold;
color: #2F53EB;
}
:deep(.el-tabs__active-bar) {
height: 3px;
border-radius: 2px;
}
// - - - input
:deep(.el-input__inner) {
// 元素
width: 100%;
height: $rowHeight;
background: #f5f5f5;
border: 0;
border-radius: 28px;
// 文字
text-align: center;
line-height: 19px;
color: #262626;
}
.code:deep(.el-input__inner) {
padding: 0 24px;
// 文字
text-align: left;
}
:deep(.el-input__inner::-webkit-input-placeholder) { /* WebKit browsers */
font-weight: 400;
color: #8C8C8C;
}
:deep(.el-input__inner:-moz-placeholder) { /* Mozilla Firefox 4 to 18 */
font-weight: 400;
color: #8C8C8C;
}
:deep(.el-input__inner::-moz-placeholder) { /* Mozilla Firefox 19+ */
font-weight: 400;
color: #8C8C8C;
opacity:1;
}
:deep(.el-input__inner:-ms-input-placeholder) { /* Internet Explorer 10+ */
font-weight: 400;
color: #8C8C8C !important;
}
:deep(.el-form-item) {
position: relative;
.button-code {
// 元素
height: $rowHeight;
box-sizing: border-box;
// 定位
position: absolute;
top: 0;
right: 20px;
z-index: 1;
// 文字
line-height: 20px;
font-size: 14px;
font-family: PingFang SC;
font-weight: 400;
color: #2F53EB;
span {
padding-left: 15px;
border-left: 2px solid #D9D9D9;
}
}
}
:deep(.el-form-item__error) {
padding-left: 24px;
}
.button {
width: 100%;
height: $buttonHeight;
background: rgba(24, 144, 255, 0.2);
border: 0;
border-radius: 24px;
margin-bottom: 20px;
// 文字
line-height: 26px;
font-size: 20px;
color: #FFFFFF;
}
.button-active {
background: #2F53EB;
box-shadow: 0px 2px 8px rgba(0, 80, 184, 0.2);
}
}
}
}
.footer {
// 元素
height: 16px;
line-height: 16px;
font-size: 12px;
color: #8c8c8c;
// 定位
position: absolute;
bottom: 30px;
a,
a:hover,
a:active {
color: inherit;
text-decoration: none;
}
}
}
// - - - - - PC 最小尺寸设置
@media screen and (min-width: 599px) and (max-width: 1366px) {
.container {
.content {
width: 710px;
height: 397px;
.pic {
width: 314px;
}
.field {
width: calc(710px - 314px);
left: 314px;
.form {
width: 320px;
:deep(.el-input__inner) {
width: 320px;
height: 56px;
}
.button {
height: 50px;
}
}
}
}
}
}
/* ===== MOBILE DESIGN ===== */
$mobileW: 375;
$mobileH: 812;
$mobileContentW: 327;
$mobileContentH: 376;
$mobileFormW: 280;
$mobileRowH: 48;
$mobileButtonH: 48;
// container
$mobileContainerBgImage: '../assets/images/bg-mobile.png';
// container-content
$mobileContentWidth: round($mobileContentW / $mobileW * 100) * 1vw;
$mobileContentHeight: round($mobileContentH / $mobileW * 100) / 100 * $mobileContentWidth;
// container-content-field-form
$mobileFormWidth: round($mobileFormW / $mobileW *100) * 1vw;
$mobileRowHeight: $mobileRowH * 1px;
$mobileButtonHeight: $mobileButtonH * 1px;
$iconBgImage: '../assets/images/icon.png';
// - - - - - 移动端设置
@media screen and (max-width: 599px) {
.container {
// 元素
background-image: url($mobileContainerBgImage);
min-width: 280px;
min-height: 568px;
// 文字
font-size: 17px;
font-family: PingFang SC;
font-weight: bold;
.logo {
display: none;
}
.content {
// 元素
width: $mobileContentWidth;
height: $mobileContentHeight;
min-width: 250px;
min-height: 340px;
// 定位
display: flex;
justify-content: center;
align-items: center;
.pic {
display: none;
}
.field {
// 元素
width: inherit;
min-height: inherit;
// 定位
left: 0;
display: flex;
flex-direction: column;
.mobile-title {
// 元素
margin: 0 0 20px;
display: block;
}
.form {
width: $mobileFormWidth;
// - - - tab
:deep(.el-tabs__header) {
display: none;
}
:deep(.el-tabs__content) {
padding: 0;
}
// - - - input
:deep(.el-input__inner) {
height: $mobileRowHeight;
line-height: 24px;
// 文字
text-align: center;
color: #262626;
}
:deep(.el-form-item) {
.button-code {
// 元素
height: $mobileRowHeight;
}
}
.button {
height: $mobileButtonHeight;
line-height: 24px;
color: #FFFFFF;
}
}
.mobile-switch {
display: block;
line-height: 20px;
font-size: 14px;
font-weight: 400;
color: #595959;
margin: 0;
.icon {
width: 14px;
height: 14px;
display: inline-block;
background-image: url($iconBgImage);
background-size: cover;
}
}
.mobile-switch:hover {
cursor: pointer;
}
}
}
.footer {
// 元素
font-size: 12px;
font-family: PingFang SC;
font-weight: 400;
line-height: 17px;
color: #333333;
opacity: 0.6;
// 定位
position: absolute;
bottom: 20px;
}
}
}

View File

@ -292,8 +292,8 @@ export default {
if (task.endTime) {
html += `<p>结束时间:${this.parseTime(task.endTime)}</p>`
}
if (task.comment) {
html += `<p>审批建议:${task.comment}</p>`
if (task.reason) {
html += `<p>审批建议:${task.reason}</p>`
}
} else if (element.type === 'bpmn:EndEvent' && this.processInstance) {
html = `<p>结果:${this.getDictDataLabel(this.DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, this.processInstance.result)}</p>`;

View File

@ -1,4 +1,4 @@
import {login, logout, getInfo, socialLogin, socialLogin2} from '@/api/login'
import {login, logout, getInfo, socialQuickLogin, socialBindLogin, smsLogin} from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
const user = {
@ -57,7 +57,7 @@ const user = {
const state = userInfo.state
const type = userInfo.type
return new Promise((resolve, reject) => {
socialLogin(type, code, state).then(res => {
socialQuickLogin(type, code, state).then(res => {
res = res.data;
setToken(res.token)
commit('SET_TOKEN', res.token)
@ -76,7 +76,22 @@ const user = {
const username = userInfo.username.trim()
const password = userInfo.password
return new Promise((resolve, reject) => {
socialLogin2(type, code, state, username, password).then(res => {
socialBindLogin(type, code, state, username, password).then(res => {
res = res.data;
setToken(res.token)
commit('SET_TOKEN', res.token)
resolve()
}).catch(error => {
reject(error)
})
})
},
// 登录
SmsLogin({ commit }, userInfo) {
const mobile = userInfo.mobile.trim()
const mobileCode = userInfo.mobileCode
return new Promise((resolve, reject) => {
smsLogin(mobile,mobileCode).then(res => {
res = res.data;
setToken(res.token)
commit('SET_TOKEN', res.token)
@ -86,7 +101,6 @@ const user = {
})
})
},
// 获取用户信息
GetInfo({ commit, state }) {
return new Promise((resolve, reject) => {

View File

@ -71,12 +71,6 @@ export const InfraApiErrorLogProcessStatusEnum = {
* 用户的社交平台的类型枚举
*/
export const SystemUserSocialTypeEnum = {
// GITEE: {
// title: "码云",
// type: 10,
// source: "gitee",
// img: "https://cdn.jsdelivr.net/gh/justauth/justauth-oauth-logo@1.11/gitee.png",
// },
DINGTALK: {
title: "钉钉",
type: 20,

View File

@ -15,7 +15,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API + '/admin-api/', // 此处的 /admin-api/ 地址,原因是后端的基础路径为 /admin-api/
// 超时
timeout: 10000
timeout: 30000
})
// request拦截器
service.interceptors.request.use(config => {

View File

@ -39,7 +39,7 @@ export default {
simulation: true,
labelEditing: false,
labelVisible: false,
prefix: "activiti",
prefix: "flowable",
headerButtonSize: "mini",
additionalModel: [CustomContentPadProvider, CustomPaletteProvider]
},

View File

@ -14,8 +14,8 @@
{{ processInstance.startUser.nickname }}
<el-tag type="info" size="mini">{{ processInstance.startUser.deptName }}</el-tag>
</el-form-item>
<el-form-item label="审批建议" prop="comment">
<el-input type="textarea" v-model="auditForms[index].comment" placeholder="请输入审批建议" />
<el-form-item label="审批建议" prop="reason">
<el-input type="textarea" v-model="auditForms[index].reason" placeholder="请输入审批建议" />
</el-form-item>
</el-form>
<div style="margin-left: 10%; margin-bottom: 20px; font-size: 14px;">
@ -66,8 +66,8 @@
<label v-if="item.endTime" style="color:#8a909c;font-weight: normal"> {{ parseTime(item.endTime) }}</label>
<label v-if="item.durationInMillis" style="margin-left: 30px;font-weight: normal">耗时</label>
<label v-if="item.durationInMillis" style="color:#8a909c;font-weight: normal"> {{ getDateStar(item.durationInMillis) }} </label>
<p v-if="item.comment">
<el-tag :type="getTimelineItemType(item)">{{ item.comment }}</el-tag>
<p v-if="item.reason">
<el-tag :type="getTimelineItemType(item)">{{ item.reason }}</el-tag>
</p>
</el-card>
</el-timeline-item>
@ -148,7 +148,7 @@ export default {
runningTasks: [],
auditForms: [],
auditRule: {
comment: [{ required: true, message: "审批建议不能为空", trigger: "blur" }],
reason: [{ required: true, message: "审批建议不能为空", trigger: "blur" }],
},
// 转派审批人
@ -259,7 +259,7 @@ export default {
}
this.runningTasks.push({...task});
this.auditForms.push({
comment: ''
reason: ''
})
});
@ -351,7 +351,7 @@ export default {
}
const data = {
id: task.id,
comment: this.auditForms[index].comment
reason: this.auditForms[index].reason
}
if (pass) {
approveTask(data).then(response => {

View File

@ -28,7 +28,7 @@
<dict-tag :type="DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT" :value="scope.row.result"/>
</template>
</el-table-column>
<el-table-column label="审批意见" align="center" prop="comment" width="200" />
<el-table-column label="审批意见" align="center" prop="reason" width="200" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>

View File

@ -19,7 +19,7 @@
</el-table-column>
<el-table-column
label="物理类型"
prop="columnType"
prop="dataType"
min-width="10%"
:show-overflow-tooltip="true"
/>

View File

@ -1,24 +1,18 @@
<template>
<!-- 导入表 -->
<el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="表名称" prop="tableName">
<el-input
v-model="queryParams.tableName"
placeholder="请输入表名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
<el-form-item label="数据源" prop="dataSourceConfigId">
<el-select v-model="queryParams.dataSourceConfigId" placeholder="请选择数据源" clearable>
<el-option v-for="config in dataSourceConfigs"
:key="config.id" :label="config.name" :value="config.id"/>
</el-select>
</el-form-item>
<el-form-item label="表描述" prop="tableComment">
<el-input
v-model="queryParams.tableComment"
placeholder="请输入表描述"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
<el-form-item label="表名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入表名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="表描述" prop="comment">
<el-input v-model="queryParams.comment" placeholder="请输入表描述" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@ -26,16 +20,11 @@
</el-form-item>
</el-form>
<el-row>
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="tableSchema" label="数据库" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="createTime" label="创建时间">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table v-loading="loading" @row-click="clickRow" ref="table" :data="dbTableList"
@selection-change="handleSelectionChange" height="260px">
<el-table-column type="selection" width="55" />
<el-table-column prop="name" label="表名称" :show-overflow-tooltip="true" />
<el-table-column prop="comment" label="表描述" :show-overflow-tooltip="true" />
</el-table>
</el-row>
<div slot="footer" class="dialog-footer">
@ -46,10 +35,13 @@
</template>
<script>
import { getSchemaTableList, createCodegenListFromDB } from "@/api/infra/codegen";
import { getSchemaTableList, createCodegenList } from "@/api/infra/codegen";
import {getDataSourceConfigList} from "@/api/infra/dataSourceConfig";
export default {
data() {
return {
// 遮罩层
loading: false,
// 遮罩层
visible: false,
// 选中数组值
@ -60,28 +52,40 @@ export default {
dbTableList: [],
// 查询参数
queryParams: {
tableName: undefined,
tableComment: undefined
}
dataSourceConfigId: undefined,
name: undefined,
comment: undefined,
},
// 数据源列表
dataSourceConfigs: [],
};
},
methods: {
// 显示弹框
show() {
this.getList();
this.visible = true;
// 加载数据源
getDataSourceConfigList().then(response => {
this.dataSourceConfigs = response.data;
this.queryParams.dataSourceConfigId = this.dataSourceConfigs[0].id;
// 加载表列表
this.getList();
});
},
clickRow(row) {
this.$refs.table.toggleRowSelection(row);
},
// 多选框选中数据
handleSelectionChange(selection) {
this.tables = selection.map(item => item.tableName);
this.tables = selection.map(item => item.name);
},
// 查询表数据
getList() {
this.loading = true;
getSchemaTableList(this.queryParams).then(res => {
this.dbTableList = res.data;
}).finally(() => {
this.loading = false;
});
},
/** 搜索按钮操作 */
@ -91,11 +95,15 @@ export default {
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.queryParams.dataSourceConfigId = this.dataSourceConfigs[0].id;
this.handleQuery();
},
/** 导入按钮操作 */
handleImportTable() {
createCodegenListFromDB(this.tables.join(",")).then(res => {
createCodegenList({
dataSourceConfigId: this.queryParams.dataSourceConfigId,
tableNames: this.tables
}).then(res => {
this.$modal.msgSuccess("导入成功");
this.visible = false;
this.$emit("ok");

View File

@ -26,29 +26,28 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="info" plain icon="el-icon-upload" size="mini" @click="openImportTable"
v-hasPermi="['infra:codegen:create']">基于 DB 导入</el-button>
<el-button type="info" plain icon="el-icon-upload" size="mini" @click="openImportSQL"
v-hasPermi="['infra:codegen:create']">基于 SQL 导入</el-button>
v-hasPermi="['infra:codegen:create']">导入</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="tableList">
<el-table-column label="表名称" align="center" prop="tableName" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="数据源" align="center" :formatter="dataSourceConfigNameFormat"/>
<el-table-column label="表名称" align="center" prop="tableName" width="200"/>
<el-table-column label="表描述" align="center" prop="tableComment" :show-overflow-tooltip="true" width="120"/>
<el-table-column label="实体" align="center" prop="className" :show-overflow-tooltip="true" width="200"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
<el-table-column label="实体" align="center" prop="className" width="200"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="createTime" width="160">
<el-table-column label="更新时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<el-table-column label="操作" align="center" width="300px" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="text" size="small" icon="el-icon-view" @click="handlePreview(scope.row)" v-hasPermi="['infra:codegen:preview']">预览</el-button>
<el-button type="text" size="small" icon="el-icon-edit" @click="handleEditTable(scope.row)" v-hasPermi="['infra:codegen:update']">编辑</el-button>
@ -81,23 +80,6 @@
<!-- 基于 DB 导入 -->
<import-table ref="import" @ok="handleQuery" />
<!-- 基于 SQL 导入 -->
<el-dialog :title="importSQL.title" :visible.sync="importSQL.open" width="800px" append-to-body>
<el-form ref="importSQLForm" :model="importSQL.form" :rules="importSQL.rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="建表 SQL 语句" prop="sql">
<el-input v-model="importSQL.form.sql" type="textarea" rows="30" style="width: 650px;" placeholder="请输入建 SQL 语句" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitImportSQLForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
@ -109,6 +91,7 @@ import importTable from "./importTable";
// 代码高亮插件
import hljs from "highlight.js/lib/highlight";
import "highlight.js/styles/github-gist.css";
import {getDataSourceConfigList} from "@/api/infra/dataSourceConfig";
hljs.registerLanguage("java", require("highlight.js/lib/languages/java"));
hljs.registerLanguage("xml", require("highlight.js/lib/languages/xml"));
hljs.registerLanguage("html", require("highlight.js/lib/languages/xml"));
@ -150,21 +133,16 @@ export default {
data: {},
activeName: "",
},
// 基于 SQL 导入
importSQL: {
open: false,
title: "",
form: {
},
rules: {
sql: [{ required: true, message: "SQL 不能为空", trigger: "blur" }]
}
}
// 数据源列表
dataSourceConfigs: [],
};
},
created() {
this.getList();
// 加载数据源
getDataSourceConfigList().then(response => {
this.dataSourceConfigs = response.data;
});
},
activated() {
const time = this.$route.query.t;
@ -200,12 +178,6 @@ export default {
},
/** 同步数据库操作 */
handleSynchDb(row) {
// 基于 SQL 同步
if (row.importType === 2) {
this.importSQL.open = true;
this.importSQL.form.tableId = row.id;
return;
}
// 基于 DB 同步
const tableName = row.tableName;
this.$modal.confirm('确认要强制同步"' + tableName + '"表结构吗?').then(function() {
@ -218,10 +190,6 @@ export default {
openImportTable() {
this.$refs.import.show();
},
/** 打开 SQL 导入的弹窗 **/
openImportSQL() {
this.importSQL.open = true;
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
@ -336,43 +304,15 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
// 取消按钮
cancel() {
this.importSQL.open = false;
this.reset();
},
// 表单重置
reset() {
this.importSQL.form = {
tableId: undefined,
sql: undefined,
};
this.resetForm("importSQLForm");
},
// 提交 import SQL 表单
submitImportSQLForm() {
this.$refs["importSQLForm"].validate(valid => {
if (!valid) {
return;
// 数据源配置的名字
dataSourceConfigNameFormat(row, column) {
for (const config of this.dataSourceConfigs) {
if (row.dataSourceConfigId === config.id) {
return config.name;
}
// 修改的提交
let form = this.importSQL.form;
if (form.tableId != null) {
syncCodegenFromSQL(form.tableId, form.sql).then(response => {
this.$modal.msgSuccess("同步成功");
this.importSQL.open = false;
this.getList();
});
return;
}
// 添加的提交
createCodegenListFromSQL(form).then(response => {
this.$modal.msgSuccess("导入成功");
this.importSQL.open = false;
this.getList();
});
});
}
}
return '未知【' + row.leaderUserId + '】';
},
}
};
</script>

View File

@ -41,7 +41,7 @@
<el-table v-loading="loading" :data="configList">
<el-table-column label="参数主键" align="center" prop="id" />
<el-table-column label="参数分" align="center" prop="group" />
<el-table-column label="参数分" align="center" prop="group" />
<el-table-column label="参数名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="参数键名" align="center" prop="key" :show-overflow-tooltip="true" />
<el-table-column label="参数键值" align="center" prop="value" />
@ -50,9 +50,9 @@
<dict-tag :type="DICT_TYPE.INFRA_CONFIG_TYPE" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="是否敏感" align="center" prop="sensitive">
<el-table-column label="是否可见" align="center" prop="visible">
<template slot-scope="scope">
<span>{{ scope.row.sensitive ? '是' : '否' }}</span>
<span>{{ scope.row.visible ? '是' : '否' }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
@ -76,8 +76,8 @@
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="参数分" prop="group">
<el-input v-model="form.group" placeholder="请输入参数分" />
<el-form-item label="参数分" prop="category">
<el-input v-model="form.category" placeholder="请输入参数分" />
</el-form-item>
<el-form-item label="参数名称" prop="name">
<el-input v-model="form.name" placeholder="请输入参数名称" />
@ -88,8 +88,8 @@
<el-form-item label="参数键值" prop="value">
<el-input v-model="form.value" placeholder="请输入参数键值" />
</el-form-item>
<el-form-item label="是否敏感" prop="type">
<el-radio-group v-model="form.sensitive">
<el-form-item label="是否可见" prop="type">
<el-radio-group v-model="form.visible">
<el-radio :key="true" :label="true"></el-radio>
<el-radio :key="false" :label="false"></el-radio>
</el-radio-group>
@ -143,8 +143,8 @@ export default {
form: {},
// 表单校验
rules: {
group: [
{ required: true, message: "参数分不能为空", trigger: "blur" }
category: [
{ required: true, message: "参数分不能为空", trigger: "blur" }
],
name: [
{ required: true, message: "参数名称不能为空", trigger: "blur" }

View File

@ -0,0 +1,166 @@
<template>
<div class="app-container">
<!-- 操作工具栏 -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['infra:data-source-config:create']">新增</el-button>
</el-col>
</el-row>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column label="主键编号" align="center" prop="id" />
<el-table-column label="数据源名称" align="center" prop="name" />
<el-table-column label="数据源连接" align="center" prop="url" />
<el-table-column label="用户名" align="center" prop="username" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['infra:data-source-config:update']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['infra:data-source-config:delete']">删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="数据源名称" prop="name">
<el-input v-model="form.name" placeholder="请输入参数名称" />
</el-form-item>
<el-form-item label="数据源连接" prop="url">
<el-input v-model="form.url" placeholder="请输入数据源连接" />
</el-form-item>
<el-form-item label="用户名" prop="username">
<el-input v-model="form.username" placeholder="请输入用户名" />
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="form.password" placeholder="请输入密码" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { createDataSourceConfig, updateDataSourceConfig, deleteDataSourceConfig, getDataSourceConfig, getDataSourceConfigList } from "@/api/infra/dataSourceConfig";
export default {
name: "DataSourceConfig",
components: {
},
data() {
return {
// 遮罩层
loading: true,
// 总条数
total: 0,
// 数据源配置列表
list: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 表单参数
form: {},
// 表单校验
rules: {
name: [{ required: true, message: "数据源名称不能为空", trigger: "blur" }],
url: [{ required: true, message: "数据源连接不能为空", trigger: "blur" }],
username: [{ required: true, message: "用户名不能为空", trigger: "blur" }],
password: [{ required: true, message: "密码不能为空", trigger: "blur" }],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
// 执行查询
getDataSourceConfigList().then(response => {
this.list = response.data;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: undefined,
name: undefined,
url: undefined,
username: undefined,
password: undefined,
};
this.resetForm("form");
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加数据源配置";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
getDataSourceConfig(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改数据源配置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (!valid) {
return;
}
// 修改的提交
if (this.form.id != null) {
updateDataSourceConfig(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
return;
}
// 添加的提交
createDataSourceConfig(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.confirm('是否确认删除数据源配置编号为"' + id + '"的数据项?').then(function() {
return deleteDataSourceConfig(id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
}
};
</script>

View File

@ -1,61 +1,115 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">芋道后台管理系统</h3>
<el-form-item prop="tenantName" v-if="tenantEnable">
<el-input v-model="loginForm.tenantName" type="text" auto-complete="off" placeholder='租户'>
<svg-icon slot="prefix" icon-class="tree" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码" @keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnable">
<el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%" @keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;">
<el-button :loading="loading" size="medium" type="primary" style="width:100%;" @click.native.prevent="handleLogin">
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
</el-form-item>
<div class="container">
<div class="logo"></div>
<!-- 登录区域 -->
<div class="content">
<!-- 配图 -->
<div class="pic"></div>
<!-- 表单 -->
<div class="field">
<!-- [移动端]标题 -->
<h2 class="mobile-title">
<h3 class="title">芋道后台管理系统</h3>
</h2>
<el-form-item style="width:100%;">
<div class="oauth-login" style="display:flex">
<div class="oauth-login-item" v-for="item in SysUserSocialTypeEnum" :key="item.type" @click="doSocialLogin(item)">
<img :src="item.img" height="25px" width="25px" alt="登录" >
<span>{{item.title}}</span>
</div>
<!-- 表单 -->
<div class="form-cont">
<el-tabs class="form" v-model="loginForm.loginType" style=" float:none;">
<el-tab-pane label="账号密码登录" name="uname">
</el-tab-pane>
<el-tab-pane label="短信验证码登录" name="sms">
</el-tab-pane>
</el-tabs>
<div>
<el-form ref="loginForm" :model="loginForm" :rules="LoginRules" class="login-form">
<el-form-item prop="tenantName" v-if="tenantEnable">
<el-input v-model="loginForm.tenantName" type="text" auto-complete="off" placeholder='租户'>
<svg-icon slot="prefix" icon-class="tree" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<!-- 账号密码登录 -->
<div v-if="loginForm.loginType === 'uname'">
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
@keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnable">
<el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
@keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon"/>
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">记住密码</el-checkbox>
</div>
<!-- 短信验证码登录 -->
<div v-if="loginForm.loginType === 'sms'">
<el-form-item prop="mobile">
<el-input v-model="loginForm.mobile" type="text" auto-complete="off" placeholder="请输入手机号">
<svg-icon slot="prefix" icon-class="phone" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<el-form-item prop="mobileCode">
<el-input v-model="loginForm.mobileCode" type="text" auto-complete="off" placeholder="短信验证码"
@keyup.enter.native="handleLogin">
<template slot="icon">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
</template>
<template slot="append">
<span v-if="mobileCodeTimer <= 0" class="getMobileCode" @click="getSmsCode" style="cursor: pointer;">获取验证码</span>
<span v-if="mobileCodeTimer > 0" class="getMobileCode">{{ mobileCodeTimer }}秒后可重新获取</span>
</template>
</el-input>
</el-form-item>
</div>
<!-- 下方的登录按钮 -->
<el-form-item style="width:100%;">
<el-button :loading="loading" size="medium" type="primary" style="width:100%;"
@click.native.prevent="handleLogin">
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
</el-form-item>
<!-- 社交登录 -->
<el-form-item style="width:100%;">
<div class="oauth-login" style="display:flex">
<div class="oauth-login-item" v-for="item in SysUserSocialTypeEnum" :key="item.type" @click="doSocialLogin(item)">
<img :src="item.img" height="25px" width="25px" alt="登录" >
<span>{{item.title}}</span>
</div>
</div>
</el-form-item>
</el-form>
</div>
</div>
</el-form-item>
</el-form>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2020-2021 iocoder.cn All Rights Reserved.</span>
</div>
</div>
<!-- footer -->
<div class="footer">
Copyright © 2020-2022 iocoder.cn All Rights Reserved.
</div>
</div>
</template>
<script>
import { getCodeImg,socialAuthRedirect } from "@/api/login";
import { getTenantIdByName } from "@/api/system/tenant";
import {getCodeImg, sendSmsCode, socialAuthRedirect} from "@/api/login";
import {getTenantIdByName} from "@/api/system/tenant";
import Cookies from "js-cookie";
import { encrypt, decrypt } from '@/utils/jsencrypt'
import {decrypt, encrypt} from '@/utils/jsencrypt'
import {SystemUserSocialTypeEnum} from "@/utils/constants";
import { getTenantEnable } from "@/utils/ruoyi";
import {getTenantEnable} from "@/utils/ruoyi";
export default {
name: "Login",
@ -64,26 +118,45 @@ export default {
codeUrl: "",
captchaEnable: true,
tenantEnable: true,
mobileCodeTimer: 0,
loginForm: {
loginType: "uname",
username: "admin",
password: "admin123",
mobile: "",
mobileCode: "",
rememberMe: false,
code: "",
uuid: "",
tenantName: "芋道源码",
},
loginRules: {
scene: 21,
LoginRules: {
username: [
{ required: true, trigger: "blur", message: "用户名不能为空" }
{required: true, trigger: "blur", message: "用户名不能为空"}
],
password: [
{ required: true, trigger: "blur", message: "密码不能为空" }
{required: true, trigger: "blur", message: "密码不能为空"}
],
code: [{required: true, trigger: "change", message: "验证码不能为空"}],
mobile: [
{required: true, trigger: "blur", message: "手机号不能为空"},
{
validator: function (rule, value, callback) {
if (/^1[0-9]\d{9}$/.test(value) == false) {
callback(new Error("手机号格式错误"));
} else {
callback();
}
}, trigger: "blur"
}
],
code: [{ required: true, trigger: "change", message: "验证码不能为空" }],
tenantName: [
{ required: true, trigger: "blur", message: "租户不能为空" },
{required: true, trigger: "blur", message: "租户不能为空"},
{
validator: (rule, value, callback) => {
// debugger
getTenantIdByName(value).then(res => {
const tenantId = res.data;
if (tenantId && tenantId >= 0) {
@ -97,8 +170,10 @@ export default {
},
trigger: 'blur'
}
],
]
},
loading: false,
redirect: undefined,
// 枚举
@ -142,11 +217,17 @@ export default {
const password = Cookies.get("password");
const rememberMe = Cookies.get('rememberMe')
const tenantName = Cookies.get('tenantName');
const mobile = Cookies.get('mobile');
const mobileCode = Cookies.get('mobileCode');
const loginType = Cookies.get('loginType');
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
tenantName: tenantName === undefined ? this.loginForm.tenantName : tenantName,
mobile: mobile === undefined ? this.loginForm.mobile : mobile,
mobileCode: mobileCode === undefined ? this.loginForm.mobileCode : mobileCode,
loginType: loginType === undefined ? this.loginForm.loginType : loginType,
};
},
handleLogin() {
@ -155,10 +236,10 @@ export default {
this.loading = true;
// 设置 Cookie
if (this.loginForm.rememberMe) {
Cookies.set("username", this.loginForm.username, { expires: 30 });
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
Cookies.set('tenantName', this.loginForm.tenantName, { expires: 30 });
Cookies.set("username", this.loginForm.username, {expires: 30});
Cookies.set("password", encrypt(this.loginForm.password), {expires: 30});
Cookies.set('rememberMe', this.loginForm.rememberMe, {expires: 30});
Cookies.set('tenantName', this.loginForm.tenantName, {expires: 30});
} else {
Cookies.remove("username");
Cookies.remove("password");
@ -166,8 +247,10 @@ export default {
Cookies.remove('tenantName');
}
// 发起登陆
this.$store.dispatch("Login", this.loginForm).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
console.log("发起登录", this.loginForm);
this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => {
this.$router.push({path: this.redirect || "/"}).catch(() => {
});
}).catch(() => {
this.loading = false;
this.getCode();
@ -176,7 +259,6 @@ export default {
});
},
doSocialLogin(socialTypeEnum) {
// console.log("开始Oauth登录...%o", socialTypeEnum.code);
// 设置登录中
this.loading = true;
// 计算 redirectUri
@ -188,74 +270,34 @@ export default {
// console.log(res.url);
window.location.href = res.data;
});
},
/** ========== 以下为升级短信登录 ========== */
getSmsCode() {
if (this.mobileCodeTimer > 0) return;
this.$refs.loginForm.validate(valid => {
if (!valid) return;
sendSmsCode(this.loginForm.mobile, this.scene, this.loginForm.uuid, this.loginForm.code).then(res => {
this.$modal.msgSuccess("获取验证码成功")
this.mobileCodeTimer = 60;
let msgTimer = setInterval(() => {
this.mobileCodeTimer = this.mobileCodeTimer - 1;
if (this.mobileCodeTimer <= 0) {
clearInterval(msgTimer);
}
}, 1000);
});
});
}
}
};
</script>
<style lang="scss" scoped>
@import "~@/assets/styles/login.scss";
<style rel="stylesheet/scss" lang="scss">
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background-image: url("http://static.yudao.iocoder.cn/login-background.jpg");
background-size: cover;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
color: #707070;
}
.login-form {
border-radius: 6px;
background: #ffffff;
width: 500px;
padding: 25px 25px 5px 25px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
color: #fff;
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 38px;
}
.oauth-login {
display: flex;
align-items: cen;
cursor:pointer;
}
.oauth-login-item {

View File

@ -1,28 +1,63 @@
<template>
<div class="login">
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">绑定账号</h3>
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码" @keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
</el-input>
</el-form-item>
<el-form-item style="width:100%;">
<el-button :loading="loading" size="medium" type="primary" style="width:100%;" @click.native.prevent="handleLogin">
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
</el-form-item>
<div class="container">
<div class="logo"></div>
<!-- 登录区域 -->
<div class="content">
<!-- 配图 -->
<div class="pic"></div>
<!-- 表单 -->
<div class="field">
<!-- [移动端]标题 -->
<h2 class="mobile-title">
<h3 class="title">芋道后台管理系统</h3>
</h2>
</el-form>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2020-2021 iocoder.cn All Rights Reserved.</span>
<!-- 表单 -->
<div class="form-cont">
<el-tabs class="form" v-model="loginForm.loginType " style=" float:none;">
<el-tab-pane label="绑定账号" name="uname">
</el-tab-pane>
</el-tabs>
<div>
<el-form ref="loginForm" :model="loginForm" :rules="LoginRules" class="login-form">
<!-- 账号密码登录 -->
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
@keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnable">
<el-input v-model="loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
@keyup.enter.native="handleLogin">
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon"/>
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0 0 25px 0;">记住密码</el-checkbox>
<!-- 下方的登录按钮 -->
<el-form-item style="width:100%;">
<el-button :loading="loading" size="medium" type="primary" style="width:100%;"
@click.native.prevent="handleLogin">
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</div>
<!-- footer -->
<div class="footer">
Copyright © 2020-2022 iocoder.cn All Rights Reserved.
</div>
</div>
</template>
@ -36,6 +71,7 @@ export default {
data() {
return {
loginForm: {
loginType: "uname",
username: "admin",
password: "admin123",
rememberMe: false, // TODO 芋艿:后面看情况,去掉这块
@ -87,10 +123,12 @@ export default {
const username = Cookies.get("username");
const password = Cookies.get("password");
const rememberMe = Cookies.get('rememberMe')
const loginType = Cookies.get('loginType');
this.loginForm = {
username: username === undefined ? this.loginForm.username : username,
password: password === undefined ? this.loginForm.password : decrypt(password),
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
loginType: loginType === undefined ? this.loginForm.loginType : loginType,
};
},
handleLogin() {
@ -123,64 +161,5 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss">
.login {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
background-image: url("http://static.yudao.iocoder.cn/login-background.jpg");
background-size: cover;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
color: #707070;
}
.login-form {
border-radius: 6px;
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
.el-input {
height: 38px;
input {
height: 38px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 2px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 38px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
position: fixed;
bottom: 0;
width: 100%;
text-align: center;
color: #fff;
font-family: Arial;
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 38px;
}
@import "~@/assets/styles/login.scss";
</style>

View File

@ -1,6 +1,7 @@
<template>
<div class="app-container">
<doc-alert title="用户体系" url="https://doc.iocoder.cn/user-center/" />
<doc-alert title="三方登陆" url="https://doc.iocoder.cn/social-user/" />
<doc-alert title="Excel 导入导出" url="https://doc.iocoder.cn/excel-import-and-export/" />
<!-- 搜索工作栏 -->
<el-row :gutter="20">

View File

@ -7,7 +7,7 @@
</el-table-column>
<el-table-column label="操作" align="left" >
<template slot-scope="scope">
<div v-if="scope.row.unionId">
<div v-if="scope.row.openid">
已绑定
<el-button size="large" type="text" @click="unbind(scope.row)">(解绑)</el-button>
</div>
@ -23,7 +23,8 @@
<script>
import {SystemUserSocialTypeEnum} from "@/utils/constants";
import {socialAuthRedirect, socialBind, socialUnbind} from "@/api/login";
import {socialAuthRedirect} from "@/api/login";
import {socialBind, socialUnbind} from "@/api/system/socialUser";
export default {
props: {
@ -50,7 +51,7 @@ export default {
if (this.user.socialUsers) {
for (const j in this.user.socialUsers) {
if (socialUser.type === this.user.socialUsers[j].type) {
socialUser.unionId = this.user.socialUsers[j].unionId;
socialUser.openid = this.user.socialUsers[j].openid;
break;
}
}
@ -86,9 +87,9 @@ export default {
});
},
unbind(socialUser) {
socialUnbind(socialUser.type, socialUser.unionId).then(resp => {
socialUnbind(socialUser.type, socialUser.openid).then(resp => {
this.$modal.msgSuccess("解绑成功");
socialUser.unionId = undefined;
socialUser.openid = undefined;
});
},
close() {