You've already forked template-MP
Initial commit
This commit is contained in:
617
common/styles/common.css
Normal file
617
common/styles/common.css
Normal file
@@ -0,0 +1,617 @@
|
||||
view,
|
||||
text {
|
||||
color: #333;
|
||||
font-size: 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 2. 主背景色 */
|
||||
.main-bg-color {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
/* 3. 主文字色 */
|
||||
.main-color {
|
||||
color: #005097;
|
||||
}
|
||||
|
||||
.main-border-color {
|
||||
border-color: #646464;
|
||||
}
|
||||
|
||||
.w100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.h100 {
|
||||
height: 100vw;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
button::after {
|
||||
border: none;
|
||||
}
|
||||
.flex-sp {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 6rpx 20rpx;
|
||||
font-feature-settings: 'liga' off, 'clig' off;
|
||||
font-family: 'Source Han Sans CN';
|
||||
font-size: 26rpx;
|
||||
}
|
||||
|
||||
.tag1 {
|
||||
background: #d9ebff;
|
||||
color: #005097;
|
||||
}
|
||||
|
||||
.tag2 {
|
||||
background: #ffefd9;
|
||||
color: #972300;
|
||||
}
|
||||
|
||||
.tag3 {
|
||||
background: #ffe4d9;
|
||||
color: #970000;
|
||||
}
|
||||
|
||||
.tag4 {
|
||||
background: #d9ffea;
|
||||
color: #00972d;
|
||||
}
|
||||
/************************************************************
|
||||
** 请将全局样式拷贝到项目的全局 CSS 文件或者当前页面的顶部 **
|
||||
** 否则页面将无法正常显示 **
|
||||
************************************************************/
|
||||
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 'Microsoft Yahei', sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
view,
|
||||
image,
|
||||
text {
|
||||
box-sizing: border-box;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
#app {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.code-fun-flex-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.code-fun-flex-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.code-fun-justify-start {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.code-fun-justify-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.code-fun-justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.code-fun-justify-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.code-fun-justify-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.code-fun-justify-evenly {
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.code-fun-items-start {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.code-fun-items-end {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.code-fun-items-center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.code-fun-items-baseline {
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.code-fun-items-stretch {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.code-fun-self-start {
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.code-fun-self-end {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.code-fun-self-center {
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.code-fun-self-baseline {
|
||||
align-self: baseline;
|
||||
}
|
||||
|
||||
.code-fun-self-stretch {
|
||||
align-self: stretch;
|
||||
}
|
||||
|
||||
.code-fun-flex-1 {
|
||||
flex: 1 1 0%;
|
||||
}
|
||||
|
||||
.code-fun-flex-auto {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.code-fun-grow {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.code-fun-grow-0 {
|
||||
flex-grow: 0;
|
||||
}
|
||||
|
||||
.code-fun-shrink {
|
||||
flex-shrink: 1;
|
||||
}
|
||||
|
||||
.code-fun-shrink-0 {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.code-fun-relative {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.code-fun-ml-2 {
|
||||
margin-left: 4rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-2 {
|
||||
margin-top: 4rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-4 {
|
||||
margin-left: 8rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-4 {
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-6 {
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-6 {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-8 {
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-8 {
|
||||
margin-top: 16rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-10 {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-10 {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-12 {
|
||||
margin-left: 24rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-12 {
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-14 {
|
||||
margin-left: 28rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-14 {
|
||||
margin-top: 28rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-16 {
|
||||
margin-left: 32rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-16 {
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-18 {
|
||||
margin-left: 36rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-18 {
|
||||
margin-top: 36rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-20 {
|
||||
margin-left: 40rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-20 {
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-22 {
|
||||
margin-left: 44rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-22 {
|
||||
margin-top: 44rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-24 {
|
||||
margin-left: 48rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-24 {
|
||||
margin-top: 48rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-26 {
|
||||
margin-left: 52rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-26 {
|
||||
margin-top: 52rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-28 {
|
||||
margin-left: 56rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-28 {
|
||||
margin-top: 56rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-30 {
|
||||
margin-left: 60rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-30 {
|
||||
margin-top: 60rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-32 {
|
||||
margin-left: 64rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-32 {
|
||||
margin-top: 64rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-34 {
|
||||
margin-left: 68rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-34 {
|
||||
margin-top: 68rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-36 {
|
||||
margin-left: 72rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-36 {
|
||||
margin-top: 72rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-38 {
|
||||
margin-left: 76rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-38 {
|
||||
margin-top: 76rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-40 {
|
||||
margin-left: 80rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-40 {
|
||||
margin-top: 80rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-42 {
|
||||
margin-left: 84rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-42 {
|
||||
margin-top: 84rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-44 {
|
||||
margin-left: 88rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-44 {
|
||||
margin-top: 88rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-46 {
|
||||
margin-left: 92rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-46 {
|
||||
margin-top: 92rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-48 {
|
||||
margin-left: 96rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-48 {
|
||||
margin-top: 96rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-50 {
|
||||
margin-left: 100rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-50 {
|
||||
margin-top: 100rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-52 {
|
||||
margin-left: 104rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-52 {
|
||||
margin-top: 104rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-54 {
|
||||
margin-left: 108rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-54 {
|
||||
margin-top: 108rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-56 {
|
||||
margin-left: 112rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-56 {
|
||||
margin-top: 112rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-58 {
|
||||
margin-left: 116rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-58 {
|
||||
margin-top: 116rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-60 {
|
||||
margin-left: 120rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-60 {
|
||||
margin-top: 120rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-62 {
|
||||
margin-left: 124rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-62 {
|
||||
margin-top: 124rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-64 {
|
||||
margin-left: 128rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-64 {
|
||||
margin-top: 128rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-66 {
|
||||
margin-left: 132rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-66 {
|
||||
margin-top: 132rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-68 {
|
||||
margin-left: 136rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-68 {
|
||||
margin-top: 136rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-70 {
|
||||
margin-left: 140rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-70 {
|
||||
margin-top: 140rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-72 {
|
||||
margin-left: 144rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-72 {
|
||||
margin-top: 144rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-74 {
|
||||
margin-left: 148rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-74 {
|
||||
margin-top: 148rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-76 {
|
||||
margin-left: 152rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-76 {
|
||||
margin-top: 152rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-78 {
|
||||
margin-left: 156rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-78 {
|
||||
margin-top: 156rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-80 {
|
||||
margin-left: 160rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-80 {
|
||||
margin-top: 160rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-82 {
|
||||
margin-left: 164rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-82 {
|
||||
margin-top: 164rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-84 {
|
||||
margin-left: 168rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-84 {
|
||||
margin-top: 168rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-86 {
|
||||
margin-left: 172rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-86 {
|
||||
margin-top: 172rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-88 {
|
||||
margin-left: 176rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-88 {
|
||||
margin-top: 176rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-90 {
|
||||
margin-left: 180rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-90 {
|
||||
margin-top: 180rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-92 {
|
||||
margin-left: 184rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-92 {
|
||||
margin-top: 184rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-94 {
|
||||
margin-left: 188rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-94 {
|
||||
margin-top: 188rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-96 {
|
||||
margin-left: 192rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-96 {
|
||||
margin-top: 192rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-98 {
|
||||
margin-left: 196rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-98 {
|
||||
margin-top: 196rpx;
|
||||
}
|
||||
|
||||
.code-fun-ml-100 {
|
||||
margin-left: 200rpx;
|
||||
}
|
||||
|
||||
.code-fun-mt-100 {
|
||||
margin-top: 200rpx;
|
||||
}
|
||||
.head {
|
||||
width: 750rpx;
|
||||
height: 372rpx;
|
||||
flex-shrink: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: linear-gradient(180deg, #d4eaff 0%, #fff 65.32%);
|
||||
}
|
||||
.container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-image: linear-gradient(to bottom, #dff0ff 8%, white 15%);
|
||||
overflow: hidden;
|
||||
}
|
||||
397
common/styles/normal.scss
Normal file
397
common/styles/normal.scss
Normal file
@@ -0,0 +1,397 @@
|
||||
.underline-text {
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 4rpx; /* 调整这个值可以改变下划线距离文字的间距 */
|
||||
}
|
||||
/* flex 布局 */
|
||||
.flex {
|
||||
/* #ifndef APP-PLUS-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='flex-'] {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-bet'] {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-cen'] {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-aro'] {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-eve'] {
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-jfend'] {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-ali'] {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-bas'] {
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-end'] {
|
||||
align-items: end;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-col'] {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-row'] {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-rowre'] {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
[class*='-container'] [class*='-wra'] {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
[class*='-container'] [class*='-end'] {
|
||||
justify-content: flex-end;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
// 定义内外边距,历遍1-80
|
||||
@for $i from 0 through 10 {
|
||||
.flex-#{$i} {
|
||||
flex: $i;
|
||||
}
|
||||
}
|
||||
|
||||
/* #ifndef APP-PLUS-NVUE */
|
||||
.flex-shrink {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
// 定义内外边距,历遍1-80
|
||||
@for $i from 0 through 40 {
|
||||
// 只要双数和能被5除尽的数
|
||||
@if $i % 2==0 or $i % 5==0 {
|
||||
// 得出:u-margin-30或者u-m-30
|
||||
.w-#{$i} {
|
||||
width: calc($i * 1%) !important;
|
||||
}
|
||||
.p-x-#{$i} {
|
||||
padding-left: $i + rpx !important;
|
||||
padding-right: $i + rpx !important;
|
||||
}
|
||||
|
||||
.p-y-#{$i} {
|
||||
padding-top: $i + rpx !important;
|
||||
padding-bottom: $i + rpx !important;
|
||||
}
|
||||
|
||||
.m-x-#{$i} {
|
||||
margin-left: $i + rpx !important;
|
||||
margin-right: $i + rpx !important;
|
||||
}
|
||||
|
||||
.m-y-#{$i} {
|
||||
margin-top: $i + rpx !important;
|
||||
margin-bottom: $i + rpx !important;
|
||||
}
|
||||
|
||||
.m-#{$i} {
|
||||
margin-left: $i + rpx !important;
|
||||
margin-right: $i + rpx !important;
|
||||
margin-top: $i + rpx !important;
|
||||
margin-bottom: $i + rpx !important;
|
||||
}
|
||||
|
||||
.p-#{$i} {
|
||||
padding-left: $i + rpx !important;
|
||||
padding-right: $i + rpx !important;
|
||||
padding-top: $i + rpx !important;
|
||||
padding-bottom: $i + rpx !important;
|
||||
}
|
||||
|
||||
.m-l-#{$i} {
|
||||
margin-left: $i + rpx !important;
|
||||
}
|
||||
|
||||
.m-t-#{$i} {
|
||||
margin-top: $i + rpx !important;
|
||||
}
|
||||
|
||||
.m-r-#{$i} {
|
||||
margin-right: $i + rpx !important;
|
||||
}
|
||||
|
||||
.m-b-#{$i} {
|
||||
margin-bottom: $i + rpx !important;
|
||||
}
|
||||
|
||||
.p-l-#{$i} {
|
||||
padding-left: $i + rpx !important;
|
||||
}
|
||||
|
||||
.p-t-#{$i} {
|
||||
padding-top: $i + rpx !important;
|
||||
}
|
||||
|
||||
.p-r-#{$i} {
|
||||
padding-right: $i + rpx !important;
|
||||
}
|
||||
|
||||
.p-b-#{$i} {
|
||||
padding-bottom: $i + rpx !important;
|
||||
}
|
||||
|
||||
.l-p-#{$i} {
|
||||
letter-spacing: $i + rpx !important;
|
||||
}
|
||||
|
||||
.z-i-#{$i} {
|
||||
z-index: $i;
|
||||
}
|
||||
|
||||
.l-h-#{$i} {
|
||||
line-height: $i + rpx !important;
|
||||
}
|
||||
.r-#{$i} {
|
||||
right: $i + rpx !important;
|
||||
}
|
||||
.l-#{$i} {
|
||||
left: $i + rpx !important;
|
||||
}
|
||||
|
||||
.t-#{$i} {
|
||||
top: $i + rpx !important;
|
||||
}
|
||||
.b-#{$i} {
|
||||
bottom: $i + rpx !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 定义字体大小
|
||||
// @for $i from 9 to 18 {
|
||||
// .font-#{$i} {
|
||||
// font-size: $i + px;
|
||||
// }
|
||||
// }
|
||||
// 定义字体(rpx)单位,大于或等于20的都为rpx单位字体
|
||||
@for $i from 9 through 60 {
|
||||
.font-#{$i} {
|
||||
font-size: $i + rpx !important;
|
||||
}
|
||||
}
|
||||
|
||||
// 圆角
|
||||
@for $i from 4 through 60 {
|
||||
.rounded-#{$i} {
|
||||
border-radius: $i + rpx;
|
||||
}
|
||||
}
|
||||
|
||||
// 定义中文字体(rpx)间距
|
||||
@for $i from 2 through 10 {
|
||||
.l-p-#{$i} {
|
||||
letter-spacing: $i + rpx;
|
||||
}
|
||||
.over-line-#{$i} {
|
||||
width: 100%;
|
||||
height: calc($i * 1em + 0.5em);
|
||||
display: -webkit-box;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-line-clamp: $i;
|
||||
overflow: hidden;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
}
|
||||
|
||||
/* 内容溢出 */
|
||||
.overflow-hidden {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 文字缩进 */
|
||||
/* #ifndef APP-PLUS-NVUE */
|
||||
.text-indent {
|
||||
text-indent: 2;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
/* 文字划线 */
|
||||
.text-through {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
/* 文字对齐 */
|
||||
.text-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 文字换行溢出处理 */
|
||||
.text-ellipsis {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.text-ellipsis-2 {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2; //多行在这里修改数字即可
|
||||
overflow: hidden;
|
||||
/* autoprefixer: ignore next */
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
/* 文字粗细和斜体 */
|
||||
.font-weight-light {
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
/*细*/
|
||||
.font-weight-lighter {
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
/*更细*/
|
||||
.font-weight-normal {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/*正常*/
|
||||
.font-weight-middle {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/*正常*/
|
||||
.font-weight-middles {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/*正常*/
|
||||
.font-weight-bold {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
/*粗*/
|
||||
.font-weight-bolder {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/*更粗*/
|
||||
.font-italic {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/*斜体*/
|
||||
|
||||
/* 文字颜色 */
|
||||
.text-body {
|
||||
color: #333333;
|
||||
}
|
||||
// 边框
|
||||
.border {
|
||||
border-width: 2rpx;
|
||||
border-style: solid;
|
||||
border-color: #ececec;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top-width: 2rpx;
|
||||
border-top-style: solid;
|
||||
border-top-color: #ececec;
|
||||
}
|
||||
|
||||
.border-right {
|
||||
border-right-width: 2rpx;
|
||||
border-right-style: solid;
|
||||
border-right-color: #ececec;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-bottom-width: 2rpx;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: #9f9f9f;
|
||||
}
|
||||
|
||||
.border-left {
|
||||
border-left-width: 2rpx;
|
||||
border-left-style: solid;
|
||||
border-left-color: #ececec;
|
||||
}
|
||||
|
||||
/* 定位 */
|
||||
.position-relative {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.position-absolute {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.position-fixed {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
/* 定位 - 固定顶部 */
|
||||
.fixed-top {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 1030;
|
||||
}
|
||||
|
||||
/* 定位 - 固定底部 */
|
||||
.fixed-bottom {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 1030;
|
||||
}
|
||||
|
||||
.top-0 {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.left-0 {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.right-0 {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.bottom-0 {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.font-family-B {
|
||||
font-family: 'OPPOSans-B' !important;
|
||||
}
|
||||
|
||||
:deep(.u-empty) {
|
||||
height: 500rpx;
|
||||
}
|
||||
362
common/utils/tool.js
Normal file
362
common/utils/tool.js
Normal file
@@ -0,0 +1,362 @@
|
||||
const baseUrl = import.meta.env.BASE_URL
|
||||
|
||||
/**
|
||||
* 工具类 - 提供常用的工具方法
|
||||
* @class Tool
|
||||
*/
|
||||
class Tool {
|
||||
constructor() {
|
||||
// 图标类型映射
|
||||
this.ICON_TYPES = {
|
||||
NONE: 0,
|
||||
SUCCESS: 1,
|
||||
LOADING: 2,
|
||||
}
|
||||
|
||||
// 字体加载状态缓存
|
||||
this.loadedFonts = new Set()
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字轻提示
|
||||
* @param {string} str 提示文字
|
||||
* @param {number} [icon=0] 提示icon (0: none, 1: success, 2: loading)
|
||||
* @param {number} [duration=1500] 提示时间(毫秒)
|
||||
*/
|
||||
alert(str, icon = this.ICON_TYPES.NONE, duration = 1500) {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!str && str !== 0) {
|
||||
console.warn('alert方法需要提供提示文字')
|
||||
return
|
||||
}
|
||||
|
||||
const iconMap = {
|
||||
[this.ICON_TYPES.NONE]: 'none',
|
||||
[this.ICON_TYPES.SUCCESS]: 'success',
|
||||
[this.ICON_TYPES.LOADING]: 'loading',
|
||||
}
|
||||
|
||||
uni.showToast({
|
||||
title: String(str),
|
||||
icon: iconMap[icon] || 'none',
|
||||
mask: true,
|
||||
duration,
|
||||
success: () => {
|
||||
setTimeout(resolve, duration)
|
||||
},
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示loading加载
|
||||
* @param {string} [title=' '] 加载文案
|
||||
* @param {boolean} [mask=true] 是否显示遮罩
|
||||
*/
|
||||
loading(title = ' ', mask = true) {
|
||||
uni.showLoading({ title, mask })
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭loading提示框
|
||||
*/
|
||||
hideLoading() {
|
||||
uni.hideLoading()
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一处理URL格式,确保以/开头
|
||||
* @param {string} url 页面地址
|
||||
* @returns {string} 格式化后的URL
|
||||
* @private
|
||||
*/
|
||||
_formatUrl(url) {
|
||||
if (!url || typeof url !== 'string') {
|
||||
throw new Error('URL必须是字符串')
|
||||
}
|
||||
|
||||
return url.startsWith('/') ? url : `/${url}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 可返回跳转(导航到新页面)
|
||||
* @param {string} url 页面地址
|
||||
*/
|
||||
navigateTo(url) {
|
||||
const formattedUrl = this._formatUrl(url)
|
||||
|
||||
uni.navigateTo({
|
||||
url: formattedUrl,
|
||||
fail: err => {
|
||||
console.warn('navigateTo失败,尝试switchTab:', err)
|
||||
uni.switchTab({ url: formattedUrl })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 不可返回跳转(重定向到新页面)
|
||||
* @param {string} url 页面地址
|
||||
*/
|
||||
redirectTo(url) {
|
||||
uni.redirectTo({ url: this._formatUrl(url) })
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除页面栈跳转(重新启动到新页面)
|
||||
* @param {string} url 页面地址
|
||||
*/
|
||||
reLaunch(url) {
|
||||
uni.reLaunch({ url: this._formatUrl(url) })
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转tabBar页
|
||||
* @param {string} url 页面地址
|
||||
*/
|
||||
switchTab(url) {
|
||||
uni.switchTab({ url: this._formatUrl(url) })
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回上一页面或指定页面
|
||||
* @param {number} [delta=1] 返回的页面数
|
||||
* @param {string} [fallbackUrl='/pages/index/index'] 无上一页时的回退地址
|
||||
*/
|
||||
navigateBack(delta = 1, fallbackUrl = '/pages/index/index') {
|
||||
const pages = getCurrentPages()
|
||||
|
||||
if (pages.length <= 1) {
|
||||
console.warn('无上一页,使用回退地址')
|
||||
uni.reLaunch({ url: fallbackUrl })
|
||||
} else {
|
||||
uni.navigateBack({ delta })
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作本地缓存
|
||||
* @param {string} key 缓存键值
|
||||
* @param {any} [value] 缓存数据,不传则为读取
|
||||
* @returns {any|undefined} 读取操作时返回数据
|
||||
*/
|
||||
storage(key, value) {
|
||||
if (typeof key !== 'string') {
|
||||
throw new Error('key必须是字符串')
|
||||
}
|
||||
|
||||
// 设置操作
|
||||
if (value !== undefined && value !== null) {
|
||||
uni.setStorageSync(key, value)
|
||||
return
|
||||
}
|
||||
|
||||
// 读取操作
|
||||
if (key !== '#') {
|
||||
return uni.getStorageSync(key)
|
||||
}
|
||||
|
||||
// 特殊操作
|
||||
if (key === '#') {
|
||||
uni.clearStorageSync()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除指定缓存
|
||||
* @param {string} key 要删除的缓存键
|
||||
*/
|
||||
removeStorage(key) {
|
||||
if (typeof key !== 'string') {
|
||||
throw new Error('key必须是字符串')
|
||||
}
|
||||
|
||||
uni.removeStorageSync(key)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存信息
|
||||
* @returns {Object} 缓存信息
|
||||
*/
|
||||
getStorageInfo() {
|
||||
return uni.getStorageInfoSync()
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制文本到剪贴板
|
||||
* @param {string} data 要复制的文本
|
||||
* @returns {Promise<boolean>} 复制是否成功
|
||||
*/
|
||||
async copy(data) {
|
||||
if (!data && data !== 0) {
|
||||
this.alert('暂无内容')
|
||||
return false
|
||||
}
|
||||
|
||||
try {
|
||||
await new Promise((resolve, reject) => {
|
||||
uni.setClipboardData({
|
||||
data: String(data),
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
|
||||
this.alert('复制成功')
|
||||
return true
|
||||
} catch (error) {
|
||||
console.error('复制失败:', error)
|
||||
this.alert('复制失败,请重试')
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入外部字体
|
||||
* @param {string} fontName 字体文件名(不含路径)
|
||||
* @returns {Promise<boolean>} 字体加载是否成功
|
||||
*/
|
||||
async loadFont(fontName) {
|
||||
if (!fontName || typeof fontName !== 'string') {
|
||||
throw new Error('字体名称必须是字符串')
|
||||
}
|
||||
|
||||
// 检查是否已加载过
|
||||
if (this.loadedFonts.has(fontName)) {
|
||||
return true
|
||||
}
|
||||
|
||||
try {
|
||||
const fontFamily = fontName.replace(/\.[^/.]+$/, '') // 移除文件扩展名
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
uni.loadFontFace({
|
||||
family: fontFamily,
|
||||
source: `url(${config.ASSETSURL}${fontName})`,
|
||||
global: true,
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
|
||||
this.loadedFonts.add(fontName)
|
||||
return true
|
||||
} catch (error) {
|
||||
console.error(`字体加载失败: ${fontName}`, error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存图片到相册
|
||||
* @param {string} url 图片URL
|
||||
* @returns {Promise<boolean>} 保存是否成功
|
||||
*/
|
||||
async saveImageToPhotos(url) {
|
||||
if (!url) {
|
||||
this.alert('图片地址不能为空')
|
||||
return false
|
||||
}
|
||||
|
||||
try {
|
||||
// 检查权限
|
||||
const { authSetting } = await new Promise((resolve, reject) => {
|
||||
uni.getSetting({
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
|
||||
if (!authSetting['scope.writePhotosAlbum']) {
|
||||
// 请求权限
|
||||
await new Promise((resolve, reject) => {
|
||||
uni.authorize({
|
||||
scope: 'scope.writePhotosAlbum',
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 获取图片信息
|
||||
const { path } = await new Promise((resolve, reject) => {
|
||||
uni.getImageInfo({
|
||||
src: url,
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
|
||||
// 保存到相册
|
||||
await new Promise((resolve, reject) => {
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: path,
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
|
||||
this.alert('已保存到相册')
|
||||
return true
|
||||
} catch (error) {
|
||||
console.error('保存图片失败:', error)
|
||||
|
||||
if (error.errMsg && error.errMsg.includes('auth')) {
|
||||
// 权限相关错误
|
||||
await new Promise(resolve => {
|
||||
uni.showModal({
|
||||
title: '保存失败',
|
||||
content: '请开启访问手机相册权限',
|
||||
showCancel: false,
|
||||
success: resolve,
|
||||
})
|
||||
})
|
||||
|
||||
uni.openSetting()
|
||||
} else {
|
||||
this.alert('保存失败,请重试')
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
* @param {Object} paymentData 支付参数
|
||||
* @returns {Promise<Object>} 支付结果
|
||||
*/
|
||||
requestPayment(paymentData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
...paymentData,
|
||||
success: resolve,
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
}
|
||||
upload(filePath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: `${baseUrl}file/upload`,
|
||||
fileType: 'image',
|
||||
header: {
|
||||
Authorization: `Bearer ${this.storage('token')}`,
|
||||
},
|
||||
filePath,
|
||||
name: 'file',
|
||||
success: ({ data }) => {
|
||||
resolve(JSON.parse(data))
|
||||
},
|
||||
fail: error => {
|
||||
reject(error)
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 创建单例并导出
|
||||
export default new Tool()
|
||||
Reference in New Issue
Block a user