wking-jie 2 months ago
commit fe9580d83d

@ -1,12 +1,18 @@
<template> <template>
<el-config-provider <!-- 使用Element Plus的配置提供者组件来包裹应用的主要内容 -->
namespace="el" <el-config-provider namespace="el">
> <!-- 路由视图组件它是Vue Router的一部分用于渲染与当前路由匹配的组件 -->
<router-view /> <router-view />
</el-config-provider> </el-config-provider>
</template> </template>
<!--
下面的样式部分使用SCSS预处理器并且引入了一个全局样式文件
注意这里的注释指出了一个ESLint规则被禁用这可能是为了允许在scoped样式中使用特定的style类型`lang="scss"`
-->
<!-- eslint-disable-next-line vue-scoped-css/enforce-style-type --> <!-- eslint-disable-next-line vue-scoped-css/enforce-style-type -->
<style lang="scss"> <style lang="scss">
// 使@useSCSSapp.scss
// mixin
@use '@/assets/app.scss'; @use '@/assets/app.scss';
</style> </style>

File diff suppressed because one or more lines are too long

@ -1,46 +1,87 @@
<template> <template>
<div style="position: relative;"> <div style="position: relative;">
<!-- 图片验证码部分 -->
<div <div
v-if="type === '2'" class="verify-img-out" v-if="type === '2'"
class="verify-img-out"
:style="{height: (parseInt(setSize.imgHeight) + vSpace) + 'px'}" :style="{height: (parseInt(setSize.imgHeight) + vSpace) + 'px'}"
> >
<div <div
class="verify-img-panel" :style="{width: setSize.imgWidth, class="verify-img-panel"
height: setSize.imgHeight,}"> :style="{width: setSize.imgWidth, height: setSize.imgHeight}"
<img :src="'data:image/png;base64,'+backImgBase" alt="" style="width:100%;height:100%;display:block"/> >
<div v-show="showRefresh" class="verify-refresh" @click="refresh"><i class="iconfont icon-refresh"/> <!-- 显示背景图片 -->
<img
:src="'data:image/png;base64,'+backImgBase"
alt=""
style="width:100%;height:100%;display:block"
/>
<!-- 刷新按钮 -->
<div
v-show="showRefresh"
class="verify-refresh"
@click="refresh"
>
<i class="iconfont icon-refresh"/>
</div> </div>
<!-- 提示信息 -->
<transition name="tips"> <transition name="tips">
<span v-if="tipWords" class="verify-tips" :class="passFlag ?'suc-bg':'err-bg'">{{tipWords}}</span> <span
v-if="tipWords"
class="verify-tips"
:class="passFlag ?'suc-bg':'err-bg'"
>{{tipWords}}</span>
</transition> </transition>
</div> </div>
</div> </div>
<!-- 公共部分 -->
<!-- 公共部分滑动条 -->
<div <div
class="verify-bar-area" :style="{width: setSize.imgWidth, class="verify-bar-area"
height: barSize.height, :style="{width: setSize.imgWidth, height: barSize.height, 'line-height':barSize.height}"
'line-height':barSize.height}"> >
<!-- 滑动条上的消息文本 -->
<span class="verify-msg" v-text="text"/> <span class="verify-msg" v-text="text"/>
<!-- 左边进度条 -->
<div <div
class="verify-left-bar" class="verify-left-bar"
:style="{width: (leftBarWidth!==undefined)?leftBarWidth: barSize.height, height: barSize.height, 'border-color': leftBarBorderColor, transaction: transitionWidth}"> :style="{width: (leftBarWidth !== undefined)? leftBarWidth: barSize.height, height: barSize.height, 'border-color': leftBarBorderColor, transition: transitionWidth}"
>
<!-- 完成后的消息文本 -->
<span class="verify-msg" v-text="finishText"/> <span class="verify-msg" v-text="finishText"/>
<!-- 滑动块 -->
<div <div
class="verify-move-block" class="verify-move-block"
:style="{width: barSize.height, height: barSize.height, 'background-color': moveBlockBackgroundColor, left: moveBlockLeft, transition: transitionLeft}" :style="{width: barSize.height, height: barSize.height, 'background-color': moveBlockBackgroundColor, left: moveBlockLeft, transition: transitionLeft}"
@touchstart="start" @touchstart="start"
@mousedown="start"> @mousedown="start"
>
<!-- 滑动块内的图标 -->
<i <i
:class="['verify-icon iconfont', iconClass]" :class="['verify-icon iconfont', iconClass]"
:style="{color: iconColor}"/> :style="{color: iconColor}"
/>
<!-- type '2' 时显示的小图块 -->
<div <div
v-if="type === '2'" class="verify-sub-block" v-if="type === '2'"
:style="{'width':Math.floor(parseInt(setSize.imgWidth)*47/310)+ 'px', class="verify-sub-block"
'height': setSize.imgHeight, :style="{
'top':'-' + (parseInt(setSize.imgHeight) + vSpace) + 'px', width: Math.floor(parseInt(setSize.imgWidth)*47/310) + 'px',
height: setSize.imgHeight,
top: '-' + (parseInt(setSize.imgHeight) + vSpace) + 'px',
'background-size': setSize.imgWidth + ' ' + setSize.imgHeight, 'background-size': setSize.imgWidth + ' ' + setSize.imgHeight,
}"> }"
<img :src="'data:image/png;base64,'+blockBackImgBase" alt="" style="width:100%;height:100%;display:block;-webkit-user-drag:none;"/> >
<img
:src="'data:image/png;base64,'+blockBackImgBase"
alt=""
style="width:100%;height:100%;display:block;-webkit-user-drag:none;"
/>
</div> </div>
</div> </div>
</div> </div>
@ -50,37 +91,36 @@ v-if="type === '2'" class="verify-sub-block"
<script type="text/babel"> <script type="text/babel">
/** /**
* VerifySlide * VerifySlide
* @description 滑块 * @description 滑块验证组件用于用户交互验证防止机器人操作
* */ */
import { aesEncrypt } from './../utils/ase' import { aesEncrypt } from './../utils/ase' // AES
import { resetSize } from './../utils/util' import { resetSize } from './../utils/util' //
import { reqCheck, reqGet } from './../api/index' import { reqCheck, reqGet } from './../api/index' // API
import { computed, getCurrentInstance, nextTick, onMounted, reactive, ref, toRefs, watch } from 'vue' import { computed, getCurrentInstance, nextTick, onMounted, reactive, ref, toRefs, watch } from 'vue'
// "captchaType":"blockPuzzle",
export default { export default {
name: 'VerifySlide', name: 'VerifySlide',
props: { props: {
captchaType: { captchaType: { //
type: String type: String
}, },
type: { type: { // '1'
type: String, type: String,
default: '1' default: '1'
}, },
// popfixed mode: { //
mode: {
type: String, type: String,
default: 'fixed' default: 'fixed'
}, },
vSpace: { vSpace: { //
type: Number, type: Number,
default: 5 default: 5
}, },
explain: { explain: { //
type: String, type: String,
default: '向右滑动完成验证' default: '向右滑动完成验证'
}, },
imgSize: { imgSize: { //
type: Object, type: Object,
default () { default () {
return { return {
@ -89,7 +129,7 @@ export default {
} }
} }
}, },
blockSize: { blockSize: { //
type: Object, type: Object,
default () { default () {
return { return {
@ -98,7 +138,7 @@ export default {
} }
} }
}, },
barSize: { barSize: { //
type: Object, type: Object,
default () { default () {
return { return {
@ -111,133 +151,110 @@ export default {
setup (props) { setup (props) {
const { mode, captchaType, type, blockSize, explain } = toRefs(props) const { mode, captchaType, type, blockSize, explain } = toRefs(props)
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const secretKey = ref('') // ase
const passFlag = ref('') // //
const backImgBase = ref('') // const secretKey = ref('') //
const blockBackImgBase = ref('') // const passFlag = ref(false) //
const backImgBase = ref('') // base64
const blockBackImgBase = ref('') // base64
const backToken = ref('') // token const backToken = ref('') // token
const startMoveTime = ref('') // const startMoveTime = ref(0) //
const endMovetime = ref('') // const endMovetime = ref(0) //
const tipsBackColor = ref('') // const tipsBackColor = ref('') //
const tipWords = ref('') const tipWords = ref('') //
const text = ref('') const text = ref(explain.value) //
const finishText = ref('') const finishText = ref('') //
const setSize = reactive({ const setSize = reactive({
imgHeight: 0, imgHeight: 0,
imgWidth: 0, imgWidth: 0,
barHeight: 0, barHeight: 0,
barWidth: 0 barWidth: 0
}) }) //
const top = ref(0)
const left = ref(0) const top = ref(0) //
const moveBlockLeft = ref(undefined) const left = ref(0) //
const leftBarWidth = ref(undefined) const moveBlockLeft = ref(undefined) //
// const leftBarWidth = ref(undefined) //
const moveBlockBackgroundColor = ref(undefined)
const leftBarBorderColor = ref('#ddd') //
const iconColor = ref(undefined) const moveBlockBackgroundColor = ref(undefined) //
const iconClass = ref('icon-right') const leftBarBorderColor = ref('#ddd') //
const status = ref(false) // const iconColor = ref(undefined) //
const isEnd = ref(false) // const iconClass = ref('icon-right') //
const showRefresh = ref(true)
const transitionLeft = ref('') const status = ref(false) //
const transitionWidth = ref('') const isEnd = ref(false) //
const startLeft = ref(0) const showRefresh = ref(true) //
const transitionLeft = ref('') //
const transitionWidth = ref('') //
const startLeft = ref(0) // left
const barArea = computed(() => { const barArea = computed(() => {
return proxy.$el.querySelector('.verify-bar-area') return proxy.$el.querySelector('.verify-bar-area') // DOM
}) })
function init () { function init () {
text.value = explain.value //
getPictrue() getPictrue()
// ready
nextTick(() => { nextTick(() => {
const { imgHeight, imgWidth, barHeight, barWidth } = resetSize(proxy) const sizeInfo = resetSize(proxy)
setSize.imgHeight = imgHeight Object.assign(setSize, sizeInfo)
setSize.imgWidth = imgWidth
setSize.barHeight = barHeight
setSize.barWidth = barWidth
proxy.$parent.$emit('ready', proxy) proxy.$parent.$emit('ready', proxy)
}) })
// PC
window.removeEventListener('touchmove', (e) => { window.addEventListener('touchmove', move)
move(e) window.addEventListener('mousemove', move)
}) window.addEventListener('touchend', end)
window.removeEventListener('mousemove', (e) => { window.addEventListener('mouseup', end)
move(e)
})
//
window.removeEventListener('touchend', () => {
end()
})
window.removeEventListener('mouseup', () => {
end()
})
window.addEventListener('touchmove', (e) => {
move(e)
})
window.addEventListener('mousemove', (e) => {
move(e)
})
//
window.addEventListener('touchend', () => {
end()
})
window.addEventListener('mouseup', () => {
end()
})
} }
// type
watch(type, () => { watch(type, () => {
init() init()
}) })
//
onMounted(() => { onMounted(() => {
//
init() init()
//
proxy.$el.onselectstart = function () { proxy.$el.onselectstart = function () {
return false return false
} }
}) })
//
//
function start (e) { function start (e) {
e = e || window.event e = e || window.event
let x let x = !e.touches ? e.clientX : e.touches[0].pageX //
if (!e.touches) { // PC startLeft.value = Math.floor(x - barArea.value.getBoundingClientRect().left) // left
x = e.clientX startMoveTime.value = Date.now() //
} else { // if (!isEnd.value) {
x = e.touches[0].pageX text.value = '' //
} //
startLeft.value = Math.floor(x - barArea.value.getBoundingClientRect().left)
startMoveTime.value = Date.now() //
if (isEnd.value === false) {
text.value = ''
moveBlockBackgroundColor.value = '#337ab7' moveBlockBackgroundColor.value = '#337ab7'
leftBarBorderColor.value = '#337AB7' leftBarBorderColor.value = '#337AB7'
iconColor.value = '#fff' iconColor.value = '#fff'
e.stopPropagation() status.value = true //
status.value = true
} }
} }
//
//
function move (e) { function move (e) {
e = e || window.event e = e || window.event
let x let x = !e.touches ? e.clientX : e.touches[0].pageX //
if (status.value && isEnd.value === false) { if (status.value && !isEnd.value) {
if (!e.touches) { // PC
x = e.clientX
} else { //
x = e.touches[0].pageX
}
const bar_area_left = barArea.value.getBoundingClientRect().left const bar_area_left = barArea.value.getBoundingClientRect().left
let move_block_left = x - bar_area_left // left let move_block_left = x - bar_area_left // left
if (move_block_left >= barArea.value.offsetWidth - Number.parseInt(Number.parseInt(blockSize.value.width) / 2) - 2) { //
move_block_left = barArea.value.offsetWidth - Number.parseInt(Number.parseInt(blockSize.value.width) / 2) - 2 if (move_block_left >= barArea.value.offsetWidth - parseInt(blockSize.value.width) / 2 - 2) {
move_block_left = barArea.value.offsetWidth - parseInt(blockSize.value.width) / 2 - 2
} }
if (move_block_left <= 0) { if (move_block_left <= 0) {
move_block_left = Number.parseInt(Number.parseInt(blockSize.value.width) / 2) move_block_left = parseInt(blockSize.value.width) / 2
} }
// left //
moveBlockLeft.value = `${move_block_left - startLeft.value}px` moveBlockLeft.value = `${move_block_left - startLeft.value}px`
leftBarWidth.value = `${move_block_left - startLeft.value}px` leftBarWidth.value = `${move_block_left - startLeft.value}px`
} }
@ -245,99 +262,168 @@ export default {
// //
function end () { function end () {
//
endMovetime.value = Date.now() endMovetime.value = Date.now()
//
// statustrueisEndfalse
if (status.value && isEnd.value === false) { if (status.value && isEnd.value === false) {
//
let moveLeftDistance = Number.parseInt((moveBlockLeft.value || '').replace('px', '')) let moveLeftDistance = Number.parseInt((moveBlockLeft.value || '').replace('px', ''))
moveLeftDistance = moveLeftDistance * 310 / Number.parseInt(setSize.imgWidth) moveLeftDistance = moveLeftDistance * 310 / Number.parseInt(setSize.imgWidth)
// xy5.0
const data = { const data = {
captchaType: captchaType.value, captchaType: captchaType.value, //
pointJson: secretKey.value ? aesEncrypt(JSON.stringify({ x: moveLeftDistance, y: 5.0 }), secretKey.value) : JSON.stringify({ x: moveLeftDistance, y: 5.0 }), pointJson: secretKey.value
token: backToken.value ? aesEncrypt(JSON.stringify({ x: moveLeftDistance, y: 5.0 }), secretKey.value) //
: JSON.stringify({ x: moveLeftDistance, y: 5.0 }), //
token: backToken.value //
} }
//
reqCheck(data).then(res => { reqCheck(data).then(res => {
// '0000'
if (res.data.repCode === '0000') { if (res.data.repCode === '0000') {
// UI
moveBlockBackgroundColor.value = '#5cb85c' moveBlockBackgroundColor.value = '#5cb85c'
leftBarBorderColor.value = '#5cb85c' leftBarBorderColor.value = '#5cb85c'
iconColor.value = '#fff' iconColor.value = '#fff'
iconClass.value = 'icon-check' iconClass.value = 'icon-check'
showRefresh.value = false showRefresh.value = false
isEnd.value = true isEnd.value = true
//
if (mode.value === 'pop') { if (mode.value === 'pop') {
setTimeout(() => { setTimeout(() => {
proxy.$parent.clickShow = false proxy.$parent.clickShow = false
refresh() refresh() //
}, 1500) }, 1500)
} }
passFlag.value = true
tipWords.value = `${((endMovetime.value - startMoveTime.value) / 1000).toFixed(2)}s验证成功` passFlag.value = true //
const captchaVerification = secretKey.value ? aesEncrypt(`${backToken.value}---${JSON.stringify({ x: moveLeftDistance, y: 5.0 })}`, secretKey.value) : `${backToken.value}---${JSON.stringify({ x: moveLeftDistance, y: 5.0 })}` tipWords.value = `${((endMovetime.value - startMoveTime.value) / 1000).toFixed(2)}s验证成功` //
//
const captchaVerification = secretKey.value
? aesEncrypt(`${backToken.value}---${JSON.stringify({ x: moveLeftDistance, y: 5.0 })}`, secretKey.value) //
: `${backToken.value}---${JSON.stringify({ x: moveLeftDistance, y: 5.0 })}` //
//
setTimeout(() => { setTimeout(() => {
tipWords.value = '' tipWords.value = ''
proxy.$parent.closeBox() proxy.$parent.closeBox()
proxy.$parent.$emit('success', { captchaVerification }) proxy.$parent.$emit('success', { captchaVerification })
}, 1000) }, 1000)
} else { } else {
// UI
moveBlockBackgroundColor.value = '#d9534f' moveBlockBackgroundColor.value = '#d9534f'
leftBarBorderColor.value = '#d9534f' leftBarBorderColor.value = '#d9534f'
iconColor.value = '#fff' iconColor.value = '#fff'
iconClass.value = 'icon-close' iconClass.value = 'icon-close'
passFlag.value = false passFlag.value = false
//
setTimeout(() => { setTimeout(() => {
refresh() refresh()
}, 1000) }, 1000)
//
proxy.$parent.$emit('error', proxy) proxy.$parent.$emit('error', proxy)
tipWords.value = '验证失败' tipWords.value = '验证失败'
//
setTimeout(() => { setTimeout(() => {
tipWords.value = '' tipWords.value = ''
}, 1000) }, 1000)
} }
}) })
status.value = false
status.value = false //
} }
} }
const refresh = () => { const refresh = () => {
showRefresh.value = true // showRefresh true
finishText.value = '' //
showRefresh.value = true;
transitionLeft.value = 'left .3s' // finishText finishText
moveBlockLeft.value = 0 //
finishText.value = '';
leftBarWidth.value = undefined // transitionLeft 0.3
transitionWidth.value = 'width .3s' // 使
transitionLeft.value = 'left .3s';
leftBarBorderColor.value = '#ddd' // moveBlockLeft 0
moveBlockBackgroundColor.value = '#fff' moveBlockLeft.value = 0;
iconColor.value = '#000'
iconClass.value = 'icon-right'
isEnd.value = false
getPictrue() // leftBarWidth undefined
//
leftBarWidth.value = undefined;
// transitionWidth 0.3
// 使
transitionWidth.value = 'width .3s';
// #ddd
leftBarBorderColor.value = '#ddd';
// #fff
moveBlockBackgroundColor.value = '#fff';
// #000
iconColor.value = '#000';
// 'icon-right'
//
iconClass.value = 'icon-right';
// isEnd false
isEnd.value = false;
// getPictrue
// 使
getPictrue();
// 使 setTimeout 300
// - transitionWidth transitionLeft CSS
// - text explain
//
setTimeout(() => { setTimeout(() => {
transitionWidth.value = '' transitionWidth.value = '';
transitionLeft.value = '' transitionLeft.value = '';
text.value = explain.value text.value = explain.value;
}, 300) }, 300);
} };
// //
function getPictrue () { function getPictrue () {
//
const data = { const data = {
captchaType: captchaType.value, captchaType: captchaType.value, //
clientUid: localStorage.getItem('b2cSlider'), clientUid: localStorage.getItem('b2cSlider'), //
ts: Date.now() // ts: Date.now() //
} };
//
reqGet(data).then(res => { reqGet(data).then(res => {
// '0000'
if (res.data.repCode === '0000') { if (res.data.repCode === '0000') {
backImgBase.value = res.data.repData.originalImageBase64 // Base64
blockBackImgBase.value = res.data.repData.jigsawImageBase64 backImgBase.value = res.data.repData.originalImageBase64; // Base64
backToken.value = res.data.repData.token blockBackImgBase.value = res.data.repData.jigsawImageBase64; // Base64
secretKey.value = res.data.repData.secretKey
//
backToken.value = res.data.repData.token;
secretKey.value = res.data.repData.secretKey;
} else { } else {
tipWords.value = res.data.repMsg //
tipWords.value = res.data.repMsg; //
} }
}) });
} }
return { return {
secretKey, // ase secretKey, // ase

@ -1,27 +1,66 @@
export const tableOption = { export const tableOption = {
// 搜索菜单所占的栅格数默认为6适用于响应式布局。
searchMenuSpan: 6, searchMenuSpan: 6,
// 是否显示列按钮如排序、筛选等false表示不显示。
columnBtn: false, columnBtn: false,
// 是否启用表格边框true表示启用。
border: true, border: true,
// 是否显示多选框true表示启用允许用户选择一行或多行记录。
selection: true, selection: true,
// 是否显示行号默认为false即不显示行号。
index: false, index: false,
// 行号标题当index为true时生效默认值为'序号'。
indexLabel: '序号', indexLabel: '序号',
// 是否启用斑马纹样式true表示启用使表格更易读。
stripe: true, stripe: true,
// 菜单对齐方式,设置为居中对齐。
menuAlign: 'center', menuAlign: 'center',
// 菜单宽度默认为350px。
menuWidth: 350, menuWidth: 350,
// 表格内容的对齐方式,设置为居中对齐。
align: 'center', align: 'center',
// 是否显示刷新按钮true表示显示允许用户刷新表格数据。
refreshBtn: true, refreshBtn: true,
// 搜索框大小设置为mini提供紧凑型搜索输入框。
searchSize: 'mini', searchSize: 'mini',
// 是否显示添加按钮默认为false即不显示。
addBtn: false, addBtn: false,
// 是否显示编辑按钮默认为false即不显示。
editBtn: false, editBtn: false,
// 是否显示删除按钮默认为false即不显示。
delBtn: false, delBtn: false,
// 是否显示查看按钮默认为false即不显示。
viewBtn: false, viewBtn: false,
// 配置选项指定下拉框等组件的label和value字段名。
props: { props: {
label: 'label', label: 'label', // 下拉框选项显示的文本字段名
value: 'value' value: 'value' // 下拉框选项对应的值字段名
}, },
column: [{
// 定义表格中的列,每一列由一个对象表示。
column: [
{
// 列标题
label: '表单名称', label: '表单名称',
// 对应的数据字段名
prop: 'formName', prop: 'formName',
// 是否允许在该列上进行搜索过滤
search: true search: true
}, { }, {
label: '按钮文本', label: '按钮文本',
@ -30,41 +69,27 @@ export const tableOption = {
}, { }, {
label: '提交次数', label: '提交次数',
prop: 'submitNum', prop: 'submitNum',
type: 'select', type: 'select', // 列类型,这里是下拉选择框
dicData: [ dicData: [ // 下拉选择框的数据源
{ { label: '不做限制', value: 0 },
label: '不做限制', { label: '每个IP限填一次', value: 1 }
value: 0
}, {
label: '每个IP限填一次',
value: 1
}
] ]
}, { }, {
label: '开启验证', label: '开启验证',
prop: 'needValidation', prop: 'needValidation',
type: 'select', type: 'select',
dicData: [ dicData: [
{ { label: '不需要', value: 0 },
label: '不需要', { label: '需要', value: 1 }
value: 0
}, {
label: '需要',
value: 1
}
] ]
}, { }, {
label: '提交权限', label: '提交权限',
prop: 'submitPerm', prop: 'submitPerm',
type: 'select', type: 'select',
dicData: [ dicData: [
{ { label: '所有人', value: 0 },
label: '所有人', { label: '仅会员可提交', value: 1 }
value: 0 ]
}, {
label: '仅会员可提交',
value: 1
} }
] ]
}]
} }

@ -1,47 +1,92 @@
export const tableOption = { export const tableOption = {
// 搜索菜单所占的栅格数默认为6适用于响应式布局。
searchMenuSpan: 6, searchMenuSpan: 6,
// 是否显示列按钮如排序、筛选等false表示不显示。
columnBtn: false, columnBtn: false,
// 是否启用表格边框true表示启用。
border: true, border: true,
// 是否显示多选框true表示启用允许用户选择一行或多行记录。
selection: true, selection: true,
// 是否显示行号默认为false即不显示行号。
index: false, index: false,
// 行号标题当index为true时生效默认值为'序号'。
indexLabel: '序号', indexLabel: '序号',
// 是否启用斑马纹样式true表示启用使表格更易读。
stripe: true, stripe: true,
// 菜单对齐方式,设置为居中对齐。
menuAlign: 'center', menuAlign: 'center',
// 菜单宽度默认为350px。
menuWidth: 350, menuWidth: 350,
// 表格内容的对齐方式,设置为居中对齐。
align: 'center', align: 'center',
// 是否显示刷新按钮true表示显示允许用户刷新表格数据。
refreshBtn: true, refreshBtn: true,
// 搜索框大小设置为mini提供紧凑型搜索输入框。
searchSize: 'mini', searchSize: 'mini',
// 是否显示添加按钮默认为false即不显示。
addBtn: false, addBtn: false,
// 是否显示编辑按钮默认为false即不显示。
editBtn: false, editBtn: false,
// 是否显示删除按钮默认为false即不显示。
delBtn: false, delBtn: false,
// 是否显示查看按钮默认为false即不显示。
viewBtn: false, viewBtn: false,
// 配置选项指定下拉框等组件的label和value字段名。
props: { props: {
label: 'label', label: 'label', // 下拉框选项显示的文本字段名
value: 'value' value: 'value' // 下拉框选项对应的值字段名
}, },
column: [{
// 定义表格中的列,每一列由一个对象表示。
column: [
{
// 列标题
label: '轮播图片', label: '轮播图片',
// 对应的数据字段名
prop: 'imgUrl', prop: 'imgUrl',
// 列类型,这里是上传组件
type: 'upload', type: 'upload',
// 使用插槽自定义列的内容true表示启用
slot: true, slot: true,
// 上传列表的类型,这里是指定为图片格式
listType: 'picture-img' listType: 'picture-img'
}, { }, {
// 列标题
label: '顺序', label: '顺序',
// 对应的数据字段名
prop: 'seq' prop: 'seq'
}, { }, {
// 设置该列的宽度为150px
width: 150, width: 150,
// 列标题
label: '状态', label: '状态',
// 对应的数据字段名
prop: 'status', prop: 'status',
// 是否允许在该列上进行搜索过滤
search: true, search: true,
// 列类型,这里是下拉选择框
type: 'select', type: 'select',
// 下拉选择框的数据源
dicData: [ dicData: [
{ { label: '禁用', value: 0 },
label: '禁用', { label: '正常', value: 1 }
value: 0 ]
}, {
label: '正常',
value: 1
} }
] ]
}]
} }

@ -1,52 +1,102 @@
export const tableOption = { export const tableOption = {
// 搜索菜单所占的栅格数默认为6适用于响应式布局。
searchMenuSpan: 6, searchMenuSpan: 6,
// 是否显示列按钮如排序、筛选等false表示不显示。
columnBtn: false, columnBtn: false,
// 是否启用表格边框true表示启用。
border: true, border: true,
// 是否显示行号默认为false即不显示行号。
index: false, index: false,
// 行号标题当index为true时生效默认值为'序号'。
indexLabel: '序号', indexLabel: '序号',
// 是否显示多选框true表示启用允许用户选择一行或多行记录。
selection: true, selection: true,
// 是否启用斑马纹样式true表示启用使表格更易读。
stripe: true, stripe: true,
// 菜单对齐方式,设置为居中对齐。
menuAlign: 'center', menuAlign: 'center',
// 菜单宽度默认为350px。
menuWidth: 350, menuWidth: 350,
// 表格内容的对齐方式,设置为居中对齐。
align: 'center', align: 'center',
// 是否显示刷新按钮true表示显示允许用户刷新表格数据。
refreshBtn: true, refreshBtn: true,
// 搜索框大小设置为mini提供紧凑型搜索输入框。
searchSize: 'mini', searchSize: 'mini',
// 是否显示添加按钮默认为false即不显示。
addBtn: false, addBtn: false,
// 是否显示编辑按钮默认为false即不显示。
editBtn: false, editBtn: false,
// 是否显示删除按钮默认为false即不显示。
delBtn: false, delBtn: false,
// 是否显示查看按钮默认为false即不显示。
viewBtn: false, viewBtn: false,
// 配置选项指定下拉框等组件的label和value字段名。
props: { props: {
label: 'label', label: 'label', // 下拉框选项显示的文本字段名
value: 'value' value: 'value' // 下拉框选项对应的值字段名
}, },
column: [{
// 定义表格中的列,每一列由一个对象表示。
column: [
{
// 列标题
label: '创建时间', label: '创建时间',
// 对应的数据字段名
prop: 'createTime' prop: 'createTime'
}, },
{ {
// 列标题
label: '姓名', label: '姓名',
// 对应的数据字段名
prop: 'userName', prop: 'userName',
// 是否允许在该列上进行搜索过滤
search: true search: true
}, { },
{
// 列标题
label: '邮箱', label: '邮箱',
// 对应的数据字段名
prop: 'email' prop: 'email'
}, { },
{
// 列标题
label: '联系方式', label: '联系方式',
// 对应的数据字段名
prop: 'contact' prop: 'contact'
}, { },
{
// 列标题
label: '审核', label: '审核',
// 对应的数据字段名
prop: 'status', prop: 'status',
// 是否允许在该列上进行搜索过滤
search: true, search: true,
// 使用插槽自定义列的内容true表示启用
slot: true, slot: true,
// 列类型,这里是下拉选择框
type: 'select', type: 'select',
// 下拉选择框的数据源
dicData: [ dicData: [
{ { label: '未审核', value: 0 },
label: '未审核', { label: '审核通过', value: 1 }
value: 0 ]
}, {
label: '审核通过',
value: 1
} }
] ]
}]
} }

Loading…
Cancel
Save