Files
pasd_app/components/uni-section/uni-section.vue
2025-07-28 14:57:35 +08:00

187 lines
8.6 KiB
Vue

<template>
<view class="uni-section">
<view class="uni-section-header" @click="onClick">
<view class="uni-section-header__decoration" v-if="type" :class="type" />
<svg t="1726135504350" class="icon" v-else-if="signIn" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12491" width="32" height="32"><path d="M704 170.666667H320v53.333333a21.333333 21.333333 0 0 1-42.666667 0V170.666667h-42.666666a106.666667 106.666667 0 0 0-106.666667 106.666666v85.333334h768v-85.333334a106.666667 106.666667 0 0 0-106.666667-106.666666h-42.666666v53.333333a21.333333 21.333333 0 0 1-42.666667 0V170.666667z m42.666667-42.666667h42.666666a149.333333 149.333333 0 0 1 149.333334 149.333333v512a149.333333 149.333333 0 0 1-149.333334 149.333334H234.666667a149.333333 149.333333 0 0 1-149.333334-149.333334V277.333333a149.333333 149.333333 0 0 1 149.333334-149.333333h42.666666V96a21.333333 21.333333 0 0 1 42.666667 0V128h384V96a21.333333 21.333333 0 0 1 42.666667 0V128z m149.333333 277.333333H128v384a106.666667 106.666667 0 0 0 106.666667 106.666667h554.666666a106.666667 106.666667 0 0 0 106.666667-106.666667V405.333333zM327.210667 642.304a21.333333 21.333333 0 0 1 28.245333-32l98.048 86.549333a21.333333 21.333333 0 0 0 29.866667-1.642666l179.882666-197.568a21.333333 21.333333 0 0 1 31.552 28.714666l-179.861333 197.568a64 64 0 0 1-89.664 4.906667l-98.069333-86.528z" fill="#f4ea2a" p-id="12492"></path></svg>
<svg t="1726135142690" class="icon" v-else-if="List" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11328" width="32" height="32"><path d="M918.764335 161.280677 811.054238 161.280677l0-20.906253c0-12.507629-10.304119-22.811747-23.687733-22.811747L661.856742 117.562677c-6.96273-27.435506-21.421007-51.628962-40.891366-70.909675-27.841891-27.173613-66.791639-44.277908-109.12793-44.277908-42.589152 0-80.7171 17.104295-109.100838 44.277908-19.750313 19.280713-34.217621 43.474169-40.891366 70.909675L236.326449 117.562677c-13.356522 0-23.398748 10.304119-23.398748 22.811747l0 20.906253L104.928618 161.280677c-21.709992 0-38.940718 17.655172-38.940718 38.308563l0 783.71807c0 21.213299 17.239757 38.308563 38.940718 38.308563l813.835717 0c21.709992 0 39.256795-17.095264 39.256795-38.308563L958.021131 199.598271C958.021131 178.93585 940.474328 161.280677 918.764335 161.280677L918.764335 161.280677zM436.132428 79.245083 436.132428 79.245083c19.217497-19.289743 46.210495-30.713678 75.705018-30.713678 29.512585 0 56.514613 11.432966 75.73211 30.713678 11.125919 10.602134 20.039298 23.642579 25.584196 38.308563L411.081048 117.553647C416.373084 102.887662 425.033601 89.856248 436.132428 79.245083L436.132428 79.245083zM259.698104 163.439033 259.698104 163.439033l504.287715 0 0 72.562307L259.698104 236.001341 259.698104 163.439033 259.698104 163.439033zM879.796525 945.034871 879.796525 945.034871 144.465367 945.034871 144.465367 238.159697l68.462334 0 0 20.662422c0 13.040444 10.042226 22.793686 23.398748 22.793686l551.049087 0c13.383614 0 23.687733-9.753241 23.687733-22.793686l0-20.662422 68.742288 0L879.805556 945.034871 879.796525 945.034871zM281.949943 565.245471 281.949943 565.245471c-21.700961 0-39.247764 16.851433-39.247764 38.561425 0 20.915284 17.546803 38.064732 39.247764 38.064732 21.737084 0 39.256795-17.149449 39.256795-38.064732C321.197707 582.087874 303.677996 565.245471 281.949943 565.245471L281.949943 565.245471zM281.949943 727.140242 281.949943 727.140242c-21.700961 0-39.247764 16.851433-39.247764 38.03764s17.546803 38.03764 39.247764 38.03764c21.737084 0 39.256795-16.851433 39.256795-38.03764S303.677996 727.140242 281.949943 727.140242L281.949943 727.140242zM740.072317 418.540471 740.072317 418.540471 399.39522 418.540471c-13.356522 0-23.66064 10.611165-23.66064 23.091701 0 12.76049 10.304119 23.091701 23.66064 23.091701L740.072317 464.723873c12.823706 0 23.380686-10.331211 23.380686-23.091701C763.453003 429.142605 752.896023 418.540471 740.072317 418.540471L740.072317 418.540471zM281.949943 403.323609 281.949943 403.323609c-21.700961 0-39.247764 17.402311-39.247764 38.308563 0 21.186207 17.546803 38.868472 39.247764 38.868472 21.737084 0 39.256795-17.682265 39.256795-38.868472C321.197707 420.716889 303.677996 403.323609 281.949943 403.323609L281.949943 403.323609zM740.072317 742.08618 740.072317 742.08618 399.39522 742.08618c-13.356522 0-23.66064 10.602134-23.66064 23.091701 0 12.489567 10.304119 22.811747 23.66064 22.811747L740.072317 787.989629c12.823706 0 23.380686-10.331211 23.380686-22.811747C763.453003 752.688315 752.896023 742.08618 740.072317 742.08618L740.072317 742.08618zM740.072317 580.444272 740.072317 580.444272 399.39522 580.444272c-13.356522 0-23.66064 10.349272-23.66064 23.362625 0 12.516659 10.304119 22.567916 23.66064 22.567916L740.072317 626.374813c12.823706 0 23.380686-10.051257 23.380686-22.567916C763.453003 590.793544 752.896023 580.444272 740.072317 580.444272L740.072317 580.444272z" p-id="11329" fill="#f4ea2a"></path></svg>
<slot v-else name="decoration"></slot>
<view class="uni-section-header__content">
<text :style="{'font-size':titleFontSize,'color':titleColor}" class="uni-section__content-title" :class="{'distraction':!subTitle}">{{ title }}</text>
<text v-if="subTitle" :style="{'font-size':subTitleFontSize,'color':subTitleColor}" class="uni-section-header__content-sub">{{ subTitle }}</text>
</view>
<view class="uni-section-header__slot-right">
<slot name="right"></slot>
</view>
</view>
<view class="uni-section-content" :style="{padding: _padding}">
<slot />
</view>
</view>
</template>
<script>
/**
* Section 标题栏
* @description 标题栏
* @property {String} type = [line|circle|square] 标题装饰类型
* @value line 竖线
* @value circle 圆形
* @value square 正方形
* @property {String} title 主标题
* @property {String} titleFontSize 主标题字体大小
* @property {String} titleColor 主标题字体颜色
* @property {String} subTitle 副标题
* @property {String} subTitleFontSize 副标题字体大小
* @property {String} subTitleColor 副标题字体颜色
* @property {String} padding 默认插槽 padding
*/
export default {
name: 'UniSection',
emits:['click'],
props: {
List: {
type: String,
default: ''
},
signIn: {
type: String,
default: ''
},
type: {
type: String,
default: ''
},
title: {
type: String,
required: true,
default: ''
},
titleFontSize: {
type: String,
default: '14px'
},
titleColor:{
type: String,
default: '#333'
},
subTitle: {
type: String,
default: ''
},
subTitleFontSize: {
type: String,
default: '12px'
},
subTitleColor: {
type: String,
default: '#999'
},
padding: {
type: [Boolean, String],
default: false
}
},
computed:{
_padding(){
if(typeof this.padding === 'string'){
return this.padding
}
return this.padding?'10px':''
}
},
watch: {
title(newVal) {
if (uni.report && newVal !== '') {
uni.report('title', newVal)
}
}
},
methods: {
onClick() {
this.$emit('click')
}
}
}
</script>
<style lang="scss" >
$uni-primary: #2979ff !default;
.uni-section {
background-color: #fff;
.uni-section-header {
position: relative;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: row;
align-items: center;
padding: 12px 10px;
font-weight: normal;
&__decoration{
margin-right: 6px;
background-color: $uni-primary;
&.line {
width: 4px;
height: 12px;
border-radius: 10px;
}
&.circle {
width: 8px;
height: 8px;
border-top-right-radius: 50px;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
border-bottom-right-radius: 50px;
}
&.square {
width: 8px;
height: 8px;
}
&.signin1 {
background-image: url(/static/images/signin2.png);
background-size: cover;
}
&.signin2 {
background-image: url(/static/images/List.png);
}
}
&__content {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
flex: 1;
color: #333;
.distraction {
flex-direction: row;
align-items: center;
}
&-sub {
margin-top: 2px;
}
}
&__slot-right{
font-size: 14px;
}
}
.uni-section-content{
font-size: 14px;
}
}
</style>