mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2025-02-22 02:32:49 +08:00
登录地址,组件优化等
This commit is contained in:
parent
bdea28e66e
commit
89b3188be8
@ -5,7 +5,7 @@
|
||||
"groupId" : "d95a58e77d314370862ffc4cdfdb8283",
|
||||
"name" : "列表",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1647396892675,
|
||||
"updateTime" : 1647433235510,
|
||||
"lock" : null,
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
@ -113,6 +113,7 @@ return db.page("""
|
||||
select
|
||||
su.username,
|
||||
so.name office_name,
|
||||
sll.address,
|
||||
sll.token,
|
||||
sll.ip,
|
||||
sll.browser,
|
||||
|
@ -5,7 +5,7 @@
|
||||
"groupId" : "1952f25c81084e24b55b11385767dc38",
|
||||
"name" : "登录",
|
||||
"createTime" : null,
|
||||
"updateTime" : 1647396539380,
|
||||
"updateTime" : 1647561372842,
|
||||
"lock" : "0",
|
||||
"createBy" : null,
|
||||
"updateBy" : null,
|
||||
@ -178,6 +178,7 @@
|
||||
}
|
||||
}
|
||||
================================
|
||||
import org.ssssssss.magicboot.utils.AddressUtil
|
||||
import log
|
||||
import 'cn.dev33.satoken.secure.SaSecureUtil';
|
||||
import 'cn.dev33.satoken.stp.StpUtil';
|
||||
@ -205,7 +206,8 @@ var loginLog = {
|
||||
type: '成功',
|
||||
ip: request.getClientIP(),
|
||||
browser: ua.getBrowser().toString(),
|
||||
os: ua.getOs().toString()
|
||||
os: ua.getOs().toString(),
|
||||
address: AddressUtil.getAddress(request.getClientIP())
|
||||
}
|
||||
|
||||
if(!user){
|
||||
|
@ -37,6 +37,9 @@ body{
|
||||
--el-avatar-bg-color: var(--mb-main-color);
|
||||
border: 1px solid white;
|
||||
}
|
||||
.el-dialog__body{
|
||||
padding: 5px 20px;
|
||||
}
|
||||
.app-container hr {
|
||||
border: none;
|
||||
height: 1px;
|
||||
|
@ -11,7 +11,7 @@
|
||||
<component
|
||||
:is="!col.component ? 'mb-input' : col.component.startsWith('el-') ? col.component : 'mb-' + col.component"
|
||||
v-model="formData[col.name]"
|
||||
:label="col.label"
|
||||
:item-label="col.label"
|
||||
v-bind="col.props"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
@ -1,77 +1,85 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-row style="margin-bottom: 6px">
|
||||
<el-button type="primary" @click="tableOptions.data.push({})">添加一行</el-button>
|
||||
<el-button type="primary" @click="addRow">添加一行</el-button>
|
||||
</el-row>
|
||||
<mb-table v-bind="tableOptions">
|
||||
<mb-table ref="magicTable" v-bind="tableOptions">
|
||||
<template v-for="col in cols" #[col.field]="{ index }">
|
||||
<el-input v-if="col.type === 'input'" v-bind="col.properties" v-model="tableOptions.data[index][col.field]" @change="dataChange" />
|
||||
<mb-select v-else-if="col.type === 'select'" v-bind="col.properties" v-model="tableOptions.data[index][col.field]" @change="dataChange" />
|
||||
<component
|
||||
:is="!col.component ? 'mb-input' : col.component.startsWith('el-') ? col.component : 'mb-' + col.component"
|
||||
v-model="tableOptions.data[index][col.field]"
|
||||
v-bind="col.props"
|
||||
@change="dataChange"
|
||||
/>
|
||||
</template>
|
||||
</mb-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script setup>
|
||||
|
||||
export default {
|
||||
name: 'MbEditorTable',
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'change'
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
|
||||
const emit = defineEmits(['update:modelValue', 'change'])
|
||||
|
||||
const magicTable = ref()
|
||||
const props = defineProps({
|
||||
modelValue: Array,
|
||||
cols: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
props: {
|
||||
// eslint-disable-next-line vue/require-prop-types
|
||||
value: {
|
||||
required: true
|
||||
},
|
||||
cols: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
showNo: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableOptions: {
|
||||
data: [],
|
||||
cols: [],
|
||||
showNo: this.showNo
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
for (var i in this.cols) {
|
||||
var col = this.cols[i]
|
||||
this.tableOptions.cols.push({
|
||||
type: 'dynamic',
|
||||
field: col.field,
|
||||
label: col.label
|
||||
})
|
||||
}
|
||||
this.tableOptions.cols.push({
|
||||
label: '操作',
|
||||
type: 'btns',
|
||||
width: 85,
|
||||
fixed: 'right',
|
||||
btns: [{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
click: (row, index) => {
|
||||
this.tableOptions.data.splice(index, 1)
|
||||
}
|
||||
}]
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
dataChange() {
|
||||
console.log('更新')
|
||||
this.$emit('update:value', this.tableOptions.data)
|
||||
this.$emit('change', this.tableOptions.data)
|
||||
}
|
||||
showNo: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
|
||||
const tableOptions = reactive({
|
||||
data: [],
|
||||
cols: [],
|
||||
showNo: props.showNo
|
||||
})
|
||||
|
||||
for (var i in props.cols) {
|
||||
var col = props.cols[i]
|
||||
tableOptions.cols.push({
|
||||
type: 'dynamic',
|
||||
field: col.field,
|
||||
label: col.label
|
||||
})
|
||||
}
|
||||
|
||||
tableOptions.cols.push({
|
||||
label: '操作',
|
||||
type: 'btns',
|
||||
width: 85,
|
||||
fixed: 'right',
|
||||
btns: [{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
click: (row, index) => {
|
||||
tableOptions.data.splice(index, 1)
|
||||
}
|
||||
}]
|
||||
})
|
||||
|
||||
watch(() => props.modelValue, (value) => {
|
||||
tableOptions.data = value
|
||||
}, {
|
||||
deep: true
|
||||
})
|
||||
|
||||
function addRow(){
|
||||
tableOptions.data.push({})
|
||||
magicTable.value.reloadList()
|
||||
}
|
||||
|
||||
function dataChange() {
|
||||
console.log('更新')
|
||||
console.log(tableOptions.data)
|
||||
emit('update:modelValue', tableOptions.data)
|
||||
emit('change', tableOptions.data)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -154,6 +154,9 @@ function reloadList() {
|
||||
listCurrent.value = 1
|
||||
getList()
|
||||
}
|
||||
if (props.data) {
|
||||
handlerData()
|
||||
}
|
||||
}
|
||||
|
||||
function handlerData() {
|
||||
|
@ -88,7 +88,6 @@ import {watch, ref, getCurrentInstance} from "vue";
|
||||
}
|
||||
|
||||
watch(() => props.modelValue, (value) => {
|
||||
console.log(value)
|
||||
emit('update:modelValue', value)
|
||||
})
|
||||
</script>
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-input v-model="modelValue" :type="type" :placeholder="placeholder || (label && '请输入' + label)" v-bind="props.props" />
|
||||
<el-input v-model="modelValue" :type="type" :placeholder="placeholder || (itemLabel && '请输入' + itemLabel)" v-bind="props.props" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -7,7 +7,7 @@
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
const props = defineProps({
|
||||
modelValue: String,
|
||||
label: String,
|
||||
itemLabel: String,
|
||||
placeholder: String,
|
||||
type: String,
|
||||
props: Object
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<treeselect v-model="modelValue" :options="options" :key="modelValue" :placeholder="placeholder || (label && '请选择' + label)" :show-count="true" v-bind="props.props" />
|
||||
<treeselect v-model="modelValue" :options="options" :key="modelValue" :placeholder="placeholder || (itemLabel && '请选择' + itemLabel)" :show-count="true" v-bind="props.props" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
@ -16,7 +16,7 @@
|
||||
default: '',
|
||||
required: true
|
||||
},
|
||||
label: String,
|
||||
itemLabel: String,
|
||||
placeholder: String,
|
||||
props: Object
|
||||
})
|
||||
|
@ -31,7 +31,7 @@ const formOptions = reactive({
|
||||
},{
|
||||
span: 12,
|
||||
name: 'checkbox',
|
||||
component: 'checkbox',
|
||||
component: 'checkbox-group',
|
||||
label: 'checkbox',
|
||||
props: {
|
||||
type: 'office_type'
|
||||
@ -39,7 +39,7 @@ const formOptions = reactive({
|
||||
},{
|
||||
span: 12,
|
||||
name: 'checkboxButton',
|
||||
component: 'checkbox',
|
||||
component: 'checkbox-group',
|
||||
label: 'checkboxButton',
|
||||
props: {
|
||||
type: 'office_type',
|
||||
@ -48,7 +48,7 @@ const formOptions = reactive({
|
||||
},{
|
||||
span: 12,
|
||||
name: 'radio',
|
||||
component: 'radio',
|
||||
component: 'radio-group',
|
||||
label: 'radio',
|
||||
props: {
|
||||
type: 'is_login'
|
||||
@ -56,7 +56,7 @@ const formOptions = reactive({
|
||||
},{
|
||||
span: 12,
|
||||
name: 'radioButton',
|
||||
component: 'radio',
|
||||
component: 'radio-group',
|
||||
label: 'radioButton',
|
||||
props: {
|
||||
type: 'is_login',
|
||||
|
@ -196,11 +196,12 @@ const formOptions = reactive({
|
||||
gutter: 24,
|
||||
cols: [{
|
||||
span: 24,
|
||||
component: 'radio-button',
|
||||
component: 'radio-group',
|
||||
name: 'isLogin',
|
||||
label: '登录状态',
|
||||
defaultValue: '0',
|
||||
props: {
|
||||
button: true,
|
||||
options: [{
|
||||
label: '有效',
|
||||
value: '0'
|
||||
|
@ -198,6 +198,7 @@ function reloadTable(){
|
||||
proxy.$get('menu/tree').then(res => {
|
||||
menuData.value = res.data.list
|
||||
tableOptions.data = menuData.value
|
||||
searchMenu()
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,9 @@
|
||||
}, {
|
||||
field: 'officeName',
|
||||
label: '所属机构'
|
||||
}, {
|
||||
field: 'address',
|
||||
label: '登录地址'
|
||||
}, {
|
||||
field: 'ip',
|
||||
label: 'IP'
|
||||
|
@ -16,7 +16,7 @@
|
||||
<java.version>1.8</java.version>
|
||||
<magic-api.version>2.0.0</magic-api.version>
|
||||
<druid.version>1.1.10</druid.version>
|
||||
<hutool-all.version>5.7.13</hutool-all.version>
|
||||
<hutool-all.version>5.7.22</hutool-all.version>
|
||||
<sa-token.version>1.26.0</sa-token.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
@ -0,0 +1,22 @@
|
||||
package org.ssssssss.magicboot.utils;
|
||||
|
||||
import cn.hutool.core.net.Ipv4Util;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
|
||||
public class AddressUtil {
|
||||
|
||||
public static String getAddress(String ip){
|
||||
try {
|
||||
if(Ipv4Util.isInnerIP(ip)){
|
||||
return "内网IP";
|
||||
}
|
||||
return JSONUtil.parseObj(HttpUtil.get("https://whois.pconline.com.cn/ipJson.jsp?json=true&ip=" + ip)).getStr("addr");
|
||||
}catch(IllegalArgumentException e){
|
||||
return "内网IP";
|
||||
}catch(Exception e){
|
||||
return "未知";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user