bug修改

This commit is contained in:
jiang 2024-07-29 19:23:39 +08:00
parent bc2c980153
commit fab7226afb
12 changed files with 51 additions and 34 deletions

View File

@ -206,6 +206,7 @@ export function handleTree(data, id, parentId, children) {
* @param {*} params 参数 * @param {*} params 参数
*/ */
export function tansParams(params) { export function tansParams(params) {
console.log(params)
let result = '' let result = ''
for (const propName of Object.keys(params)) { for (const propName of Object.keys(params)) {
const value = params[propName]; const value = params[propName];

View File

@ -89,13 +89,12 @@ service.interceptors.request.use(
let formData = tansParams(config.data) let formData = tansParams(config.data)
if (formData) { if (formData) {
formData = formData.slice(0, -1) formData = formData.slice(0, -1)
const encryptedData = encryptCBC(formData) config.data = encryptCBC(formData)
config.data = { formData: encryptedData } console.log(config.data)
config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加参数哈希到请求头 config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加参数哈希到请求头
} }
} else { } else {
const encryptedData = encryptCBC(JSON.stringify(config.data)) config.data = encryptCBC('formData=' + JSON.stringify(config.data))
config.data = `formData=${encryptedData}`
config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加参数哈希到请求头 config.headers['Params-Hash'] = hashWithSM3AndSalt(config.data) // 添加参数哈希到请求头
} }
} }
@ -187,10 +186,13 @@ export function download(url, params, filename, config) {
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)' background: 'rgba(0, 0, 0, 0.7)'
}) })
console.log(params)
return service.post(url, params, { return service.post(url, params, {
transformRequest: [(params) => tansParams(params)], transformRequest: [(params) => params],
headers: { 'Content-Type': 'application/x-www-form-urlencoded', encryption: 'encryption' }, headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Params-Hash': hashWithSM3AndSalt(params)
},
responseType: 'blob', responseType: 'blob',
...config ...config
}).then(async(data) => { }).then(async(data) => {

View File

@ -105,14 +105,14 @@ export function validatePassword(rule, value, callback) {
return callback(new Error('请输入密码')) return callback(new Error('请输入密码'))
} }
const lengthRegex = /^.{8,}$/ const lengthRegex = /^.{8,20}$/;
const uppercaseRegex = /[A-Z]/ const uppercaseRegex = /[A-Z]/
const lowercaseRegex = /[a-z]/ const lowercaseRegex = /[a-z]/
const digitRegex = /\d/ const digitRegex = /\d/
const specialCharRegex = /[!@#$%^&*(),.?":{}|<>]/ const specialCharRegex = /[!@#$%^&*(),.?":{}|<>]/
if (!lengthRegex.test(value)) { if (!lengthRegex.test(value)) {
return callback(new Error('密码必须至少为8个字符')) return callback(new Error('密码长度必须为8到20位'));
} }
const checks = [ const checks = [

View File

@ -75,7 +75,7 @@
:disabled="isSendingCode || !loginForm.code" :disabled="isSendingCode || !loginForm.code"
class="send-code-button" class="send-code-button"
> >
{{ isSendingCode ? `${countdown}s` : '获取验证码' }} {{ countdown === 0 ? '获取验证码' : `${countdown}s` }}
</el-button> </el-button>
</template> </template>
<svg-icon slot="prefix" icon-class="message" class="el-input__icon input-icon"/> <svg-icon slot="prefix" icon-class="message" class="el-input__icon input-icon"/>
@ -226,6 +226,12 @@ export default {
}) })
}, },
sendCode() { sendCode() {
let form = new FormData
form.append('13123', '123123')
console.log(form.getAll("13123"))
if (!this.loginForm.code) { if (!this.loginForm.code) {
this.$message.error('请先填写验证码') this.$message.error('请先填写验证码')
return return
@ -243,7 +249,7 @@ export default {
this.countdown -= 1 this.countdown -= 1
if (this.countdown <= 0) { if (this.countdown <= 0) {
clearInterval(timer) clearInterval(timer)
this.isSendingCode = false /* this.isSendingCode = false */
} }
}, 1000) }, 1000)
}) })

View File

@ -98,6 +98,7 @@
<script> <script>
import { getCodeImg, register } from '@/api/login' import { getCodeImg, register } from '@/api/login'
import { validatePassword } from '@/utils/validate' import { validatePassword } from '@/utils/validate'
export default { export default {
name: 'Register', name: 'Register',
data() { data() {
@ -201,10 +202,6 @@ export default {
// //
sendCode() { sendCode() {
if (!this.registerForm.code) {
this.$message.error('请先填写验证码')
return
}
if (!this.registerForm.mobile) { if (!this.registerForm.mobile) {
this.$message.error('请先填写手机号') this.$message.error('请先填写手机号')
@ -218,7 +215,7 @@ export default {
this.countdown -= 1 this.countdown -= 1
if (this.countdown <= 0) { if (this.countdown <= 0) {
clearInterval(timer) clearInterval(timer)
this.isSendingCode = false /* this.isSendingCode = false */
} }
}, 1000) }, 1000)
}) })

View File

@ -56,7 +56,7 @@
> >
<el-table-column label="序号" align="center" width="80" type="index"> <el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope"> <template scope="scope">
<span>{{ (listQuery.pageNum - 1) * 10 + scope.$index + 1 }}</span> <span>{{ (listQuery.pageNum - 1) * listQuery.pageSize + scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作人" align="center" prop="operaUserName"> <el-table-column label="操作人" align="center" prop="operaUserName">

View File

@ -59,7 +59,7 @@
> >
<el-table-column label="序号" align="center" width="80" type="index"> <el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope"> <template scope="scope">
<span>{{ (listQuery.pageNum - 1) * 10 + scope.$index + 1 }}</span> <span>{{ (listQuery.pageNum - 1) * listQuery.pageSize + scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作人" align="center" prop="operaUserName" /> <el-table-column label="操作人" align="center" prop="operaUserName" />

View File

@ -59,7 +59,7 @@
> >
<el-table-column label="序号" align="center" width="80" type="index"> <el-table-column label="序号" align="center" width="80" type="index">
<template scope="scope"> <template scope="scope">
<span>{{ (listQuery.pageNum - 1) * 10 + scope.$index + 1 }}</span> <span>{{ (listQuery.pageNum - 1) * listQuery.pageSize + scope.$index + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作人" align="center" prop="operaUserName" /> <el-table-column label="操作人" align="center" prop="operaUserName" />

View File

@ -113,6 +113,8 @@
:options="menuOptions" :options="menuOptions"
:normalizer="normalizer" :normalizer="normalizer"
:show-count="true" :show-count="true"
:searchable="false"
:disable-branch-nodes="true"
placeholder="选择上级菜单" placeholder="选择上级菜单"
/> />
</el-form-item> </el-form-item>

View File

@ -98,12 +98,12 @@
</el-row> </el-row>
<el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="roleList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" min-width="55" align="center" />
<el-table-column label="角色编号" prop="roleId" width="120" /> <el-table-column label="角色编号" prop="roleId" min-width="120" align="center" />
<el-table-column label="角色名称" prop="roleName" :show-overflow-tooltip="true" width="150" /> <el-table-column label="角色名称" align="center" prop="roleName" :show-overflow-tooltip="true" min-width="150" />
<el-table-column label="权限字符" prop="roleKey" :show-overflow-tooltip="true" width="150" /> <el-table-column label="权限字符" align="center" prop="roleKey" :show-overflow-tooltip="true" min-width="150" />
<el-table-column label="显示顺序" prop="roleSort" width="100" /> <el-table-column label="显示顺序" align="center" prop="roleSort" min-width="100" />
<el-table-column label="状态" align="center" width="100"> <el-table-column label="状态" align="center" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<el-switch <el-switch
v-model="scope.row.status" v-model="scope.row.status"
@ -113,7 +113,7 @@
></el-switch> ></el-switch>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> <el-table-column label="创建时间" align="center" prop="createTime" min-width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>

View File

@ -111,7 +111,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" width="160" class-name="small-padding fixed-width">
<template slot-scope="scope" v-if="scope.row.userId !== 1"> <template slot-scope="scope" v-if="scope.row.userId !== 1">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:user:edit']" v-hasPermi="['system:user:edit']"
>修改 >修改
@ -161,7 +161,9 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="归属部门" prop="deptId"> <el-form-item label="归属部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门"/> <treeselect v-model="form.deptId" :searchable="false" :disable-branch-nodes="true" :options="deptOptions"
:show-count="true" placeholder="请选择归属部门"
/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -466,9 +468,20 @@ export default {
/** 查询部门下拉树结构 */ /** 查询部门下拉树结构 */
getDeptTree() { getDeptTree() {
deptTreeSelect().then(response => { deptTreeSelect().then(response => {
this.deptOptions = response.data console.log(response.data)
this.deptOptions = this.filterTree(response.data)
}) })
}, },
filterTree(nodes) {
return nodes
.map(node => {
if (node.children) {
node.children = this.filterTree(node.children)
}
return node
})
.filter(node => node.status !== '1')
},
// //
filterNode(value, data) { filterNode(value, data) {
if (!value) return true if (!value) return true
@ -481,10 +494,6 @@ export default {
}, },
// //
handleApprovalStatus(row) { handleApprovalStatus(row) {
if (row.roles.length === 0) {
this.$modal.msgError('请先分配用户权限')
return;
}
this.$modal.confirm('确认要审批' + row.userName + '"用户吗?').then(function() { this.$modal.confirm('确认要审批' + row.userName + '"用户吗?').then(function() {
console.log({ userId: row.userId }) console.log({ userId: row.userId })
return approvalStatus({ userId: row.userId }) return approvalStatus({ userId: row.userId })

View File

@ -35,7 +35,7 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://192.168.0.41:18080`, target: `http://localhost:18080`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''