Default Changelist

feature/qzw
秦泽旺 2 months ago
parent 90f47d711d
commit 7061f4db4c

@ -1,27 +1,31 @@
<template>
<!-- 模板部分 -->
<div :class="['description-list', size, layout === 'vertical' ? 'vertical': 'horizontal']">
<!-- 根据size和layout动态设置类名 -->
<div v-if="title" class="title">{{ title }}</div>
<!-- 如果存在title属性则显示标题 -->
<a-row>
<slot></slot>
<!-- 使用slot来插入内容 -->
</a-row>
</div>
</template>
<script>
import { Col } from 'ant-design-vue/es/grid/'
import { Col } from 'ant-design-vue/es/grid' // Ant Design Vue
const Item = {
name: 'DetailListItem',
name: 'DetailListItem', //
props: {
term: {
type: String,
default: '',
required: false
type: String, // term
default: '', //
required: false //
}
},
inject: {
col: {
type: Number
type: Number // col
}
},
render () {
@ -34,6 +38,7 @@ const Item = {
}
}
//
const responsive = {
1: {xs: 24},
2: {xs: 24, sm: 12},
@ -42,10 +47,10 @@ const responsive = {
}
export default {
name: 'DetailList',
Item: Item,
name: 'DetailList', //
Item: Item, //
components: {
Col
Col //
},
props: {
title: {
@ -71,86 +76,69 @@ export default {
},
provide() {
return {
col: this.col > 4 ? 4 : this.col
}
col: this.col > 4 ? 4 : this.col // col4使4使col
}
}
</script>
<style lang="less" scoped>
/* 样式部分使用Less编写并且是作用域样式只影响当前组件 */
.description-list {
.title {
color: rgba(0, 0, 0, .85);
font-size: 14px;
font-weight: 500;
margin-bottom: 16px;
color: rgba(0, 0, 0, .85); //
font-size: 14px; // 14px
font-weight: 500; //
margin-bottom: 16px; // 16px
}
/deep/ .term {
color: rgba(0, 0, 0, .85);
display: table-cell;
line-height: 20px;
margin-right: 8px;
padding-bottom: 16px;
white-space: nowrap;
&:not(:empty):after {
content: ":";
margin: 0 8px 0 2px;
position: relative;
top: -.5px;
}
color: rgba(0, 0, 0, .85); //
display: table-cell; //
line-height: 20px; // 20px
margin-right: 8px; // 8px
padding-bottom: 16px; // 16px
white-space: nowrap; //
}
/deep/ .content {
color: rgba(0, 0, 0, .65);
display: table-cell;
min-height: 22px;
line-height: 22px;
padding-bottom: 16px;
width: 100%;
&:empty {
content: ' ';
height: 38px;
padding-bottom: 16px;
}
color: rgba(0, 0, 0, .65); //
display: table-cell; //
min-height: 22px; // 222px
line-height: 22px; // 222px
padding-bottom: 16px; // 16px
width: 100%; // 100%
}
&.small {
.title {
font-size: 14px;
color: rgba(0, 0, 0, .65);
font-weight: normal;
margin-bottom: 12px;
font-size: 14px; // 14px
color: rgba(0, 0, 0, .65); //
font-weight: normal; //
margin-bottom: 12px; // 12px
}
/deep/ .term, .content {
padding-bottom: 8px;
padding-bottom: 8px; // 8px
}
}
&.large {
/deep/ .term, .content {
padding-bottom: 16px;
padding-bottom: 16px; // 16px
}
.title {
font-size: 16px;
font-size: 16px; // 16px
}
}
&.vertical {
.term {
padding-bottom: 8px;
padding-bottom: 8px; // 8px
}
/deep/ .term, .content {
display: block;
}
display: block; //
}
}
</style>

@ -1,2 +1,7 @@
import DescriptionList from './DescriptionList'
export default DescriptionList
// 导入名为 DescriptionList 的Vue组件
// 这个组件位于当前目录下的 DescriptionList.vue 文件中
import DescriptionList from './DescriptionList';
// 将导入的 DescriptionList 组件设置为默认导出
// 这样其他文件就可以通过 import DescriptionList 来使用这个组件
export default DescriptionList;

@ -1,129 +1,102 @@
<template>
<!-- 模板部分定义了组件的HTML结构 -->
<div class="exception">
<div class="imgBlock">
<!-- 图片区域 -->
<div class="imgEle" :style="{backgroundImage: `url(${config[type].img})`}">
</div>
</div>
<div class="content">
<h1>{{ config[type].title }}</h1>
<div class="desc">{{ config[type].desc }}</div>
<!-- 内容区域 -->
<h1>{{ config[type].title }}</h1> <!-- 异常标题 -->
<div class="desc">{{ config[type].desc }}</div> <!-- 异常描述 -->
<div class="actions">
<a-button type="primary" @click="handleToHome"></a-button>
<a-button type="primary" @click="handleToHome"></a-button> <!-- 返回首页按钮 -->
</div>
</div>
</div>
</template>
<script>
import types from './type'
import types from './type' //
export default {
name: 'Exception',
name: 'Exception', //
props: {
type: {
type: String,
default: '404'
type: String, // prop
default: '404' // '404'
}
},
data () {
return {
config: types
config: types //
}
},
methods: {
handleToHome () {
this.$router.push({ name: 'dashboard' })
}
handleToHome () { //
this.$router.push({ name: 'dashboard' }) // 使Vue Routerdashboard
}
}
</script>
<style lang="less">
@import "~ant-design-vue/lib/style/index";
@import "~ant-design-vue/lib/style/index"; // Ant Design Vue
.exception {
display: flex;
align-items: center;
height: 80%;
min-height: 500px;
display: flex; // 使flex
align-items: center; //
height: 80%; // 80%
min-height: 500px; // 500px
.imgBlock {
flex: 0 0 62.5%;
width: 62.5%;
padding-right: 152px;
zoom: 1;
flex: 0 0 62.5%; // 62.5%
width: 62.5%; // 62.5%
padding-right: 152px; // 152px
zoom: 1; // 1
&::before,
&::after {
content: ' ';
display: table;
content: ' '; //
display: table; //
}
&::after {
clear: both;
height: 0;
font-size: 0;
visibility: hidden;
clear: both; //
height: 0; // 0
font-size: 0; // 0
visibility: hidden; //
}
}
.imgEle {
float: right;
width: 100%;
max-width: 430px;
height: 360px;
background-repeat: no-repeat;
background-position: 50% 50%;
background-size: contain;
float: right; //
width: 100%; // 100%
max-width: 430px; // 430px
height: 360px; // 360px
background-repeat: no-repeat; //
background-position: 50% 50%; //
background-size: contain; //
}
.content {
flex: auto;
flex: auto; // flex
h1 {
margin-bottom: 24px;
color: #434e59;
font-weight: 600;
font-size: 72px;
line-height: 72px;
margin-bottom: 24px; // 24px
color: #434e59; //
font-weight: 600; //
font-size: 72px; // 72px
line-height: 72px; // 72px
}
.desc {
margin-bottom: 16px;
color: @text-color-secondary;
font-size: 20px;
line-height: 28px;
margin-bottom: 16px; // 16px
color: @text-color-secondary; //
font-size: 20px; // 20px
line-height: 28px; // 28px
}
.actions {
button:not(:last-child) {
margin-right: 8px;
}
}
}
}
@media screen and (max-width: @screen-xl) {
.exception {
.imgBlock {
padding-right: 88px;
}
}
}
@media screen and (max-width: @screen-sm) {
.exception {
display: block;
text-align: center;
.imgBlock {
margin: 0 auto 24px;
padding-right: 0;
}
}
}
@media screen and (max-width: @screen-xs) {
.exception {
.imgBlock {
margin-bottom: -24px;
overflow: hidden;
margin-right: 8px; // 8px
}
}
}

@ -1,2 +1,6 @@
import ExceptionPage from './ExceptionPage.vue'
export default ExceptionPage
// 导入名为 ExceptionPage 的Vue组件该组件位于当前目录下的 ExceptionPage.vue 文件中
import ExceptionPage from './ExceptionPage.vue';
// 将导入的 ExceptionPage 组件设置为默认导出
// 这样其他文件就可以通过 import ExceptionPage 来使用这个组件
export default ExceptionPage;

@ -1,19 +1,33 @@
// 定义一个对象用于存储不同HTTP状态码的错误信息
const types = {
// 定义403状态码的错误信息
403: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg',
// 错误页面的图片URL
img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOYFcZDnb.svg',
// 错误标题
title: '403',
// 错误描述
desc: '抱歉,你无权访问该页面'
},
// 定义404状态码的错误信息
404: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg',
// 错误页面的图片URL
img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozI.svg',
// 错误标题
title: '404',
// 错误描述
desc: '抱歉,你访问的页面不存在或仍在开发中'
},
// 定义500状态码的错误信息
500: {
// 错误页面的图片URL
img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg',
// 错误标题
title: '500',
// 错误描述
desc: '抱歉,服务器出错了'
}
}
export default types
// 导出types对象使其可以在其他模块中使用
export default types;

@ -1,46 +1,59 @@
/**
* components util
* 工具组件集合
*/
/**
* 清理空值对象
* @param children
* @returns {*[]}
* 清理数组中的空值或空对象
* @param {Array} children - 要处理的数组默认为空数组
* @returns {Array} - 过滤后的数组
*/
export function filterEmpty(children = []) {
// 使用Array.prototype.filter方法移除数组中的空值或空对象
return children.filter(c => c.tag || (c.text && c.text.trim() !== ''))
}
/**
* 获取字符串长度英文字符 长度1中文字符长度2
* @param {*} str
* 获取字符串的完整长度英文字符长度为1中文字符长度为2
* @param {string} str - 要处理的字符串默认为空字符串
* @returns {number} - 字符串的完整长度
*/
export const getStrFullLength = (str = '') =>
// 使用Array.prototype.split方法将字符串转换为字符数组
str.split('').reduce((pre, cur) => {
// 获取字符的Unicode编码
const charCode = cur.charCodeAt(0)
// 如果字符是ASCII字符英文字符则长度加1
if (charCode >= 0 && charCode <= 128) {
return pre + 1
}
// 如果字符是双字节字符中文字符则长度加2
return pre + 2
}, 0)
/**
* 截取字符串根据 maxLength 截取后返回
* @param {*} str
* @param {*} maxLength
* 根据最大长度截取字符串保留完整字符
* @param {string} str - 要截取的字符串默认为空字符串
* @param {number} maxLength - 最大长度默认无限制
* @returns {string} - 截取后的字符串
*/
export const cutStrByFullLength = (str = '', maxLength) => {
let showLength = 0
// 使用Array.prototype.split方法将字符串转换为字符数组
return str.split('').reduce((pre, cur) => {
// 获取字符的Unicode编码
const charCode = cur.charCodeAt(0)
// 如果字符是ASCII字符英文字符则长度加1
if (charCode >= 0 && charCode <= 128) {
showLength += 1
} else {
// 如果字符是双字节字符中文字符则长度加2
showLength += 2
}
// 如果当前长度小于等于最大长度,则继续累加字符
if (showLength <= maxLength) {
return pre + cur
}
// 如果超过最大长度,则返回当前累加的字符串
return pre
}, '')
}
Loading…
Cancel
Save