| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812 |
- /**
- * BaseCloud APP更新检测组件
- v1.0.4
- */
- <template>
- <view class="base-cloud" style="display: inline-block;">
- <view class="father" style="display: flex;align-items: center;" v-if="showVersion" @click.stop.prevent="checkVersion">
- <text class="version-text">版本{{version}}</text>
- <view class="abs top right" v-if="updateData.updated" style="top: -3px;right: -7px;">
- <view class="w7 h7 rds redBg"></view>
- </view>
- </view>
- <view class="fixed z20 wp6 flex ct plr50 pb50 " v-if="show">
- <view class="w100p showIn" :animation="inData" style="max-width: 300px;">
- <view class="rds12" :style="{'background-color':color}">
- <view class="father">
- <view class="h120 father hidden">
- <view class="abs top left50p">
- <image src="./static/cloudRight.png" mode="widthFix" class="w500 h120 animated goAway infinite"></image>
- </view>
- <view class="abs top right50p">
- <image src="./static/cloudLeft.png" mode="widthFix" class="w500 h120 animated goAwayLeft infinite"></image>
- </view>
- <image class="abs top30 left30 w10 h10 animated infinite fadeOut slow" src="./static/star.png" mode="widthFix"></image>
- <image class="abs top60 left80 w10 h10 animated infinite fadeOut slowest delay-1s" src="./static/star.png" mode="widthFix"></image>
- <image class="abs top20 right20 w10 h10 animated infinite fadeOut slower delay-2s" src="./static/star.png" mode="widthFix"></image>
- <image class="abs top20 right50 w30 h30 animated fadeOutRight infinite slowest" src="./static/smallCloud.png"
- mode="widthFix"></image>
- <image class="abs top30 left50 w30 h30 animated fadeOutRight infinite slow8 " src="./static/smallCloud.png" mode="widthFix"></image>
- </view>
- <view class="abs bottom animated bounceUp infinite">
- <view class="animated goUp delay-06s">
- <image src="./static/airship.png" mode="widthFix" class="w80 h75 center-block father z3"></image>
- <view class="father" style="top: -5px;">
- <image src="./static/shipAir.png" mode="widthFix" class="w40 h85 center-block animated infinite splashOut"></image>
- <view class="abs">
- <image src="./static/shipAir.png" mode="widthFix" class="w40 h85 center-block animated infinite splashOut delay-03s"></image>
- </view>
- <view class="abs">
- <image src="./static/shipAir.png" mode="widthFix" class="w40 h85 center-block animated infinite splashOut delay-06s"></image>
- </view>
- <view class="abs bottom" style="bottom: -80upx;">
- <image src="./static/shipGas.png" mode="widthFix" class="w40 h85 center-block animated infinite splash"></image>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class=" whiteBg hidden plr20 father z3 rdsBr12 rdsBl12" :class="{'pb100':progress <= 0 || progress >= 100 || completed}">
- <view class="ptb10 fz16 bold">
- <block v-if="progress == 0">
- {{title}} {{ updateData.version ? 'v' + updateData.version : ''}}
- </block>
- <block v-else-if="progress <=100 && !completed">
- <view>
- <view class="fz30 normal avanti pt15 text-center">
- {{ progress }}
- <text class="fz12 ml2">
- %
- </text>
- </view>
- <view class="text-center pb40 op8 gray fz14 normal">
- 版本更新中,不要离开...
- </view>
- </view>
- </block>
- <view class="text-center pt15" v-else-if="completed">
- 版本升级成功
- <view class="pb40 op8 gray fz14 normal pt5">
- 更新已完成,请重启应用体验新版
- </view>
- </view>
- </view>
- <scroll-view scroll-y="true" class="scroll-view h60 autoY pb20" v-if="progress == 0">
- <view class="column">
- <text v-if="updateData.description.length === 0">
- {{ defaultContent }}
- </text>
- <text v-for="(item, index) in updateData.description" :key="index">
- {{ index + 1 }}.{{ item }}
- </text>
- </view>
- </scroll-view>
- <view class="pd50 pt25" v-else-if="progress < 100">
- <view class="grayBg bd rds23">
- <view class="grayBg rds23">
- <view class="ptb3 rds23" :style="{width:progress+'%','background-color':color}"></view>
- </view>
- </view>
- </view>
- <view class="father">
- <view class="abs top left50p roundBox rds text-center" :style="{'background-color':color}">
- <view class="pt30" v-if="!completed">
- <button hover-class="op9" @tap.stop="download" class="btn bd2 whiteBg line rds23 inline plr50 ptb10 fz16">
- 立即升级
- </button>
- </view>
- <view class="pt30" v-else>
- <button hover-class="op8" @tap.stop="restart" class="btn bd2 whiteBg line rds23 inline plr50 ptb10 fz16">
- 立即重启
- </button>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="op9 father" v-if="progress == 0">
- <view class="abs">
- <view class="flex ct ">
- <view class="h30 bl3 whiteBd"></view>
- </view>
- <view class="close-btn" @click="hide">
- <text class="mix-icon icon-close"></text>
- </view>
- </view>
- </view>
- </view>
- </view>
-
- <mix-loading v-if="isLoading"></mix-loading>
- </view>
- </template>
- <script>
- export default {
- name: "version-update",
- props: {
- title: {
- default: "发现新版本"
- },
- defaultContent: {
- default: "快来升级,体验最新的功能吧!"
- },
- showVersion: {
- default: true
- },
- autoShow: {
- default: false
- },
- isCache: {
- default: true
- },
- updateUrl: {
- default: "api/base-app-version"
- },
- color: {
- default: "#ff536f"
- }
- },
- data() {
- return {
- show: false,
- version: "1.0.0",
- updateData: {
- description: []
- },
- progress: 0,
- completed: false,
- inData: null
- };
- },
- created() {
- // #ifdef APP-PLUS
- plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
- this.version = widgetInfo.version;
- });
- // #endif
- },
- methods: {
- async checkVersion(e) {
- console.log(e);
- const res = await this.$request('version', 'check', {
- version: this.version
- }, {
- showLoading: true
- })
- if (res.status === 0) {
- this.$util.msg(res.msg);
- } else {
- res.data.description = res.data.description.split(';');
- this.updateData = res.data;
- this.show = true;
- }
- },
- download(e) {
- if(this.isDownloading){
- return;
- }
- this.isDownloading = true;
- const task = uni.downloadFile({
- url: this.updateData.downloadLink,
- success: (downloadResult) => {
- this.isDownloading =false;
- uni.hideLoading();
- if (downloadResult.statusCode === 200) {
- plus.runtime.install(downloadResult.tempFilePath, {
- force: false
- }, (e) => {
- this.downloadSuccess(e);
- }, (err) => {
- this.downloadError(err);
- });
- }
- },
- fail: err => {
- this.isDownloading =false;
- this.downloadError(err);
- }
- });
- task.onProgressUpdate((e) => {
- console.log(e.progress);
- this.progress = e.progress;
- });
- },
- downloadError(e) {
- this.show = false;
- this.progress = 0;
- uni.showModal({
- title: '提示',
- content: '更新失败,请稍后再试',
- showCancel: false,
- confirmColor: '#414cd9'
- });
- },
- downloadSuccess(e) {
- this.completed = true;
- },
- restart(e) {
- this.show = false;
- this.completed = false;
- this.progress = 0;
- // #ifdef APP-PLUS
- plus.runtime.restart();
- // #endif
- },
- hide(e) {
- var animation = uni.createAnimation({
- duration: 300,
- timingFunction: 'ease',
- });
- animation.scale(0).opacity(0).step();
- this.inData = animation.export();
- setTimeout((e) => {
- this.show = false;
- this.inData = null;
- }, 420);
- },
- },
- }
- </script>
- <style scoped lang="scss">
- .version-text{
- margin-right: 10rpx;
- font-size: 26rpx;
- color: #999;
- position: relative;
- z-index: -2rpx;
- }
- .close-btn{
- display: flex;
- justify-content: center;
- color: #fff;
-
- .mix-icon{
- margin-top: -20rpx;
- padding: 20rpx;
- font-size: 48rpx;
- }
- }
- .scroll-view{
- height: auto !important;
- min-height: 120rpx;
- max-height: 17vh;
-
- text{
- margin-bottom: 16rpx;
- line-height: 1.5;
- font-size: 28rpx;
- }
- }
- .roundBox {
- width: 5000upx;
- height: 5000upx;
- margin-left: -2500upx;
- }
- .animated {
- -webkit-animation-duration: 1s;
- animation-duration: 1s;
- -webkit-animation-fill-mode: both;
- animation-fill-mode: both;
- animation-timing-function: linear;
- }
- .animated.infinite {
- -webkit-animation-iteration-count: infinite;
- animation-iteration-count: infinite;
- }
- @keyframes goUp {
- from {
- -webkit-transform: translate3d(0, 70%, 0);
- transform: translate3d(0, 70%, 0);
- }
- to {
- -webkit-transform: translate3d(0, 0, 0);
- transform: translate3d(0, 0, 0);
- }
- }
- .goUp {
- -webkit-animation-name: goUp;
- animation-name: goUp;
- -webkit-animation-duration: 600ms;
- animation-duration: 600ms;
- animation-timing-function: ease-in;
- }
- @keyframes splash {
- 0,
- 100% {
- transform: scaleX(0.9);
- }
- 5%,
- 95% {
- transform: scaleX(1.02);
- }
- 10%,
- 80% {
- transform: scaleX(1.05);
- }
- 25%,
- 75% {
- transform: scaleX(1.08);
- }
- 50% {
- transform: scaleX(1.1);
- }
- }
- .splash {
- -webkit-animation-name: splash;
- animation-name: splash;
- -webkit-animation-duration: 0.6s;
- animation-duration: 0.6s;
- animation-timing-function: linear;
- }
- @-webkit-keyframes splashOut {
- from {
- opacity: 1;
- transform: scaleX(0);
- }
- to {
- opacity: 0;
- transform: scaleX(2);
- }
- }
- .splashOut {
- -webkit-animation-name: splashOut;
- animation-name: splashOut;
- -webkit-animation-duration: 1s;
- animation-duration: 1s;
- }
- @keyframes bounceUp {
- 0% {
- transform: translate3d(0, 0, 0);
- }
- 50% {
- transform: translate3d(0, -30rpx, 0);
- }
- }
- .bounceUp {
- -webkit-animation-name: bounceUp;
- animation-name: bounceUp;
- -webkit-animation-duration: 1.6s;
- animation-duration: 1.6s;
- animation-timing-function: linear;
- }
- @keyframes fadeOut {
- 0,
- 100% {
- opacity: 1;
- }
- 50% {
- opacity: 0;
- }
- }
- .fadeOut {
- -webkit-animation-name: fadeOut;
- animation-name: fadeOut;
- }
- @keyframes fadeOutRight {
- 0% {
- opacity: 0;
- transform: translate3d(-200%, 0, 0);
- }
- 50% {
- opacity: 1;
- transform: translate3d(0, 0, 0);
- }
- 100% {
- opacity: 0;
- transform: translate3d(200%, 0, 0);
- }
- }
- .fadeOutRight {
- -webkit-animation-name: fadeOutRight;
- animation-name: fadeOutRight;
- }
- .animated.delay-03s {
- -webkit-animation-delay: 0.3s;
- animation-delay: 0.3s;
- }
- .animated.delay-06s {
- -webkit-animation-delay: 0.6s;
- animation-delay: 0.6s;
- }
- .animated.delay-1s {
- -webkit-animation-delay: 1s;
- animation-delay: 1s;
- }
- .animated.delay-2s {
- -webkit-animation-delay: 2s;
- animation-delay: 2s;
- }
- .animated.delay-3s {
- -webkit-animation-delay: 3s;
- animation-delay: 3s;
- }
- .animated.fast {
- -webkit-animation-duration: 800ms;
- animation-duration: 800ms;
- }
- .animated.faster {
- -webkit-animation-duration: 500ms;
- animation-duration: 500ms;
- }
- .animated.fastest {
- -webkit-animation-duration: 200ms;
- animation-duration: 200ms;
- }
- .animated.slow {
- -webkit-animation-duration: 2s;
- animation-duration: 2s;
- }
- .animated.slower {
- -webkit-animation-duration: 3s;
- animation-duration: 3s;
- }
- .animated.slowest {
- -webkit-animation-duration: 10s;
- animation-duration: 10s;
- }
- .animated.slow4 {
- -webkit-animation-duration: 5s;
- animation-duration: 5s;
- }
- .animated.slow5 {
- -webkit-animation-duration: 5s;
- animation-duration: 5s;
- }
- .animated.slow8 {
- -webkit-animation-duration: 8s;
- animation-duration: 8s;
- }
- .goAway {
- transform: translate3d(-50%, 10%, 0);
- -webkit-animation-name: goAway;
- animation-name: goAway;
- -webkit-animation-duration: 2s;
- animation-duration: 2s;
- }
- @keyframes goAway {
- from {
- transform: translate3d(-50%, 10%, 0);
- }
- to {
- transform: translate3d(-1.3%, -17.6%, 0);
- }
- }
- .goAwayLeft {
- transform: translate3d(50%, 10%, 0);
- -webkit-animation-name: goAwayLeft;
- animation-name: goAwayLeft;
- -webkit-animation-duration: 2s;
- animation-duration: 2s;
- }
- @keyframes goAwayLeft {
- from {
- transform: translate3d(50%, 10%, 0);
- }
- to {
- transform: translate3d(2%, -17%, 0);
- }
- }
- @keyframes showIn {
- 0% {
- opacity: 0;
- transform: scale3d(0.5, 0.5, 0.5);
- }
- 100% {
- opacity: 1;
- transform: scale3d(1, 1, 1);
- }
- }
- .showIn {
- animation-duration: 0.4s;
- animation-name: showIn;
- }
-
- div,a,img,span,page,view,navigator,image,text,input,textarea,button,form{
- box-sizing: border-box;
- }
-
- a{
- text-decoration: none;
- color: $main;
- }
-
- form{
- display: block;
- width: 100%;
- }
-
- image{will-change: transform}
-
- input,textarea,form{
- width: 100%;
- height: auto;
- min-height: 10px;
- display: block;
- font-size: inherit;
- }
-
- button{
- color: inherit;
- line-height: inherit;
- margin: 0;
- background-color: transparent;
- padding: 0;
- -webkit-border-radius: 0;
- -moz-border-radius: 0;
- border-radius: 0;
- &:after{
- display: none;
- }
- }
-
- switch .uni-switch-input{
- margin-right: 0;
- }
- .wx-switch-input,.uni-switch-input{width:42px !important;height:22px !important;}
- .wx-switch-input::before,.uni-switch-input::before{width:40px !important;height: 20px !important;}
- .wx-switch-input::after,.uni-switch-input::after{width: 20px !important;height: 20px !important;}
-
-
- /**背景颜色**/
- .bg{
- background-color: $main;
- color: $mainInverse;
- }
- .gradualBg{
- background-image: $mainGradual;
- color: $mainGradualInverse ;
- }
- .grayBg{
- background-color: #f7f7f7;
- color: #30302f;
- }
- .whiteBg{
- background-color: #fff;
- color: #000;
- }
- .blackBg{
- background-color: #000;
- color: #fff;
- }
- .orangeBg{
- background-color: $orange;
- color: #fff;
- }
- .redBg{
- background-color: $red;
- color: #fff;
- }
- .yellowBg{
- background-color: $yellow;
- color: #000;
- }
- .greenBg{
- background-color: $green;
- color: #fff;
- }
- .brownBg{
- background-color: $brown;
- color: #fff;
- }
- .blueBg{
- background-color: $blue;
- color: #fff;
- }
- .purpleBg{
- background-color: $purple;
- color: #fff;
- }
-
- /* 文字颜色 */
- .main{
- color: $main;
- }
- .green{
- color: $green;
- }
- .red{
- color: $red;
- }
- .yellow{
- color: $yellow;
- }
- .black{
- color: $black;
- }
- .white{
- color: $white;
- }
- .gray{
- color: $gray;
- }
- .grey{
- color: $grey;
- }
- .orange{
- color: $orange;
- }
- .brown{
- color: $brown;
- }
- .blue{
- color: $blue;
- }
- .purple{
- color: $purple;
- }
-
- .hoverMain{
- &:hover{
- color: $main;
- }
- }
-
- .hoverGreen{
- &:hover{
- color: $green;
- }
- }
-
- .hoverRed{
- &:hover{
- color: $red;
- }
- }
-
- .hoverBlue{
- &:hover{
- color: $blue;
- }
- }
-
- .hoverGray{
- &:hover{
- color: $gray;
- }
- }
-
- .hoverWhite{
- &:hover{
- color: $white;
- }
- }
-
- .hoverBlack{
- &:hover{
- color: $black;
- }
- }
-
- .hoverOrange{
- &:hover{
- color: $orange;
- }
- }
-
- .hoverYellow{
- &:hover{
- color: $yellow;
- }
- }
-
- .hoverBrown{
- &:hover{
- color: $brown;
- }
- }
-
- .hoverPurple{
- &:hover{
- color: $purple;
- }
- }
-
- /* 宽度 高度 */
- $w:0;
- @while $w <= 500 {
- @if $w <= 100 {
- .w#{$w}p{
- width: $w*1%;
- }
- .h#{$w}p{
- height: $w*1%;
- }
- @if $w == 100 {
- .100p{
- width: 100%;
- height: 100%;
- }
- .ww{
- width: 100vw;
- }
- .hh{
- height: 100vh;
- }
- }
- }
- .w#{$w}{
- width: $w*2upx;
- }
- .h#{$w}{
- height: $w*2upx;
- }
- @if $w < 10 {
- $w : $w + 1 ;
- } @else{
- $w : $w + 5 ;
- }
- }
-
-
- /* 字号 */
- @for $fz from 12 through 100 {
- .fz#{$fz}{
- font-size: $fz*2upx !important;
- }
- }
-
- /* 边距 - 覆盖顺序是小的尺寸覆盖大的尺寸 少的方向覆盖多的方向 */
- $s : 0 ;
- @while $s <= 500 {
- .pd#{$s}{
- padding: $s*2upx!important;
- }
- .m#{$s}{
- margin: $s*2upx!important;
- }
- @if $s == 15 {
- .pd{
- padding: 30upx!important;
- }
- .m{
- margin: 30upx!important;
- }
- }
- @if $s < 10 {
- $s : $s + 1 ;
- } @else if($s < 100){
- $s : $s + 5 ;
- } @else if($s < 300){
- $s : $s + 10 ;
- } @else{
- $s : $s + 50 ;
- }
- }
-
- $s : 0 ;
- @while $s <= 500 {
- .ptb#{$s}{
- padding-top: $s*2upx!important;
- padding-bottom: $s*2upx!important;
- }
- .plr#{$s}{
- padding-left: $s*2upx!important;
- padding-right: $s*2upx!important;
- }
- .mtb#{$s}{
- margin-top: $s*2upx!important;
- margin-bottom: $s*2upx!important;
- }
- .mlr#{$s}{
- margin-left: $s*2upx!important;
- margin-right: $s*2upx!important;
- }
- @if $s == 15 {
- .ptb{
- padding-top: 30upx!important;
- padding-bottom: 30upx!important;
- }
- .plr{
- padding-left: 30upx!important;
- padding-right: 30upx!important;
- }
-
- .mlr{
- margin-left: 30upx!important;
- margin-right: 30upx!important;
- }
- .mtb{
- margin-top: 30upx!important;
- margin-bottom: 30upx!important;
- }
- }
- @if $s < 10 {
- $s : $s + 1 ;
- } @else if($s < 100){
- $s : $s + 5 ;
- } @else if($s < 300){
- $s : $s + 10 ;
- } @else{
- $s : $s + 50 ;
- }
- }
-
- $s : 0 ;
- @while $s <= 500 {
- .pl#{$s}{
- padding-left: $s*2upx!important;
- }
- .pr#{$s}{
- padding-right: $s*2upx!important;
- }
- .pt#{$s}{
- padding-top: $s*2upx!important;
- }
- .pb#{$s}{
- padding-bottom: $s*2upx!important;
- }
- .ml#{$s}{
- margin-left: $s*2upx!important;
- }
- .mr#{$s}{
- margin-right: $s*2upx!important;
- }
- .mt#{$s}{
- margin-top: $s*2upx!important;
- }
- .mb#{$s}{
- margin-bottom: $s*2upx!important;
- }
- @if $s == 15 {
- .pt{
- padding-top: 30upx!important;
- }
- .pb{
- padding-bottom: 30upx!important;
- }
- .pl{
- padding-left: 30upx!important;
- }
- .pr{
- padding-right: 30upx!important;
- }
- .mt{
- margin-top: 30upx!important;
- }
- .mr{
- margin-right: 30upx!important;
- }
- .ml{
- margin-left: 30upx!important;
- }
- .mb{
- margin-bottom: 30upx!important;
- }
- }
- @if $s < 10 {
- $s : $s + 1 ;
- } @else if($s < 100){
- $s : $s + 5 ;
- } @else if($s < 300){
- $s : $s + 10 ;
- } @else{
- $s : $s + 50 ;
- }
- }
-
-
-
- /* 文字溢出隐藏 */
- .clip{
- width: 100%;
- display: -webkit-box;
- overflow: hidden;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- @for $i from 2 through 10{
- &.c#{$i}{
- -webkit-line-clamp: $i;
- }
- }
- }
-
- .cut{
- display: block;
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- /* 价格 */
- .price{
- font-size: inherit ;
- &:before{
- content: "¥";
- font-size: 70%;
- color: inherit;
- font-weight: normal;
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif ;
- }
- .point{
- display: inline-block;
- font-size: 70%;
- font-weight: inherit;
- letter-spacing: 1px;
- color: inherit;
- }
- &.noPrefix{
- &:before{
- content: '';
- }
- }
- }
-
- /* 布局 */
- .grid,.gridNoPd,.gridSmPd,.gridNoMb{
- display: -webkit-box;
- display: -webkit-flex;
- display: -ms-flexbox;
- display: flex;
- -webkit-flex-wrap: wrap;
- -ms-flex-wrap: wrap;
- flex-wrap: wrap;
- width: 100%;
- padding: 20upx 20upx 0 20upx;
- >.item,>image,>view,>navigator,>text,>button{
- width: 50%;
- padding: 0 10upx;
- margin-bottom: 20upx;
- }
- @for $i from 1 through 50{
- &.g#{$i}{
- >.item,>image,>view,>navigator,>text,>button{
- width: 100%/$i;
- }
- }
- }
- }
-
- .gridNoMb{
- >.item,>image,>view,>navigator,>text,>button{
- margin-bottom: 0;
- }
- }
-
- .gridNoPd{
- padding: 0;
- >.item,>image,>view,>navigator,>text,>button{
- padding: 0;
- margin-bottom: 0;
- }
- }
- .gridSmPd{
- padding: 0;
- >.item,>image,>view,>navigator,>text,>button{
- padding-right: 0;
- &:first-child{
- padding-left: 0;
- padding-right: 10upx;
- }
- }
- }
-
- /* flex布局 */
- .flex{
- display: flex;
- align-items: center;
- justify-content: space-between;
- &.t{
- align-items: flex-start;
- }
- &.b{
- align-items: flex-end;
- }
- &.cv{ //垂直方向铺满
- align-items: stretch;
- }
- &.bk{ //水平方向铺满
- flex-direction: column;
- }
- &.lt{
- justify-content: flex-start;
- }
- &.ct{
- justify-content: center;
- }
- &.rt{
- justify-content: flex-end;
- }
- &.ar{
- justify-content: space-around;
- }
- &.av{
- >.item,view,button,navigator,image,text{
- flex:1;
- }
- }
- }
-
- /* 定位布局 */
- .father{
- position: relative;
- }
- .abs,.fixed{
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 1;
- &image{
- width: 100%;
- height: 100%;
- }
- &.top{
- bottom: auto;
- }
- &.bottom{
- top: auto;
- }
- &.left{
- right: auto;
- }
- &.right{
- left: auto;
- }
- }
- @for $i from 0 through 20 {
- .z#{$i}{
- z-index: $i !important;
- }
- }
-
- @for $i from 1 through 200 {
- .top-#{$i}{
- bottom: auto;
- top: $i * -2upx;
- }
- .left-#{$i}{
- right: auto;
- left: $i * -2upx;
- }
- .bottom-#{$i}{
- top: auto;
- bottom: $i * -2upx;
- }
- .right-#{$i}{
- left: auto;
- right: $i * -2upx;
- }
- .top#{$i}{
- bottom: auto;
- top: $i * 2upx;
- }
- .left#{$i}{
- right: auto;
- left: $i * 2upx;
- }
- .bottom#{$i}{
- top: auto;
- bottom: $i * 2upx;
- }
- .right#{$i}{
- left: auto;
- right: $i * 2upx;
- }
- .top-#{$i}p{
- bottom: auto;
- top: $i * -1%;
- }
- .left-#{$i}p{
- right: auto;
- left: $i * -1%;
- }
- .bottom-#{$i}p{
- top: auto;
- bottom: $i * -1%;
- }
- .right-#{$i}p{
- left: auto;
- right: $i * -1%;
- }
- .top#{$i}p{
- bottom: auto;
- top: $i * 1%;
- }
- .left#{$i}p{
- right: auto;
- left: $i * 1%;
- }
- .bottom#{$i}p{
- top: auto;
- bottom: $i * 1%;
- }
- .right#{$i}p{
- left: auto;
- right: $i * 1%;
- }
- }
-
- .fixed{
- position: fixed;
- }
-
- /* fix-auto布局 */
- .fixAuto,.fixAutoNoPd,.fixAutoSmPd{
- display: table;
- width: 100%;
- padding: 20upx 10upx;
- >.item,>view,>image,>navigator,>text,>button{
- vertical-align: top;
- padding: 0 10upx;
- display: table-cell ;
- }
- &.middle{
- >.item,>view,>image,>navigator,>text{
- vertical-align: middle;
- }
- }
- &.bottom{
- >.item,>view,>image,>navigator,>text{
- vertical-align: bottom;
- }
- }
- }
- .fixAutoSmPd{
- padding: 0;
- >.item,>view,>image,>navigator,>text{
- padding-right: 0;
- &:first-child{
- padding-left: 0;
- padding-right: 10upx;
- }
- }
- }
- .fixAutoNoPd{
- padding: 0;
- >.item,>view,>image,>navigator,>text{
- padding: 0;
- }
- }
-
- /* 浮动组件 */
- .clear{
- &:after{
- content: "";
- clear: both;
- height: 0;
- display: block;
- visibility: hidden;
- }
- }
- .fl{
- float: left;
- }
- .fr{
- float: right;
- }
-
- /* 按钮样式类 */
- .btn,.roundBtn{
- cursor: pointer;
- display: inline-block;
- text-align: center;
- padding: 8upx 24upx;
- background-color: $main;
- color: $mainInverse ;
- font-size: 28upx;
- border: 1px solid $main;
- -webkit-border-radius: 8upx;
- -moz-border-radius: 8upx;
- border-radius: 8upx;
- transition: 0.4s;
- white-space: nowrap;
- text-overflow: ellipsis;
- &.gradualBg{
- border-color: transparent;
- background-image: $mainGradual;
- color: $mainGradualInverse;
-
- }
- &.blackBg{
- background-color: $black;
- border-color: $black;
- color: #fff;
- &.shadow{
- box-shadow: 0px 2px 9px -1px rgba($black , 0.4);
- }
- }
- &.greenBg{
- background-color: $green;
- border-color: $green;
- color: #fff;
- &.shadow{
- box-shadow: 0px 2px 9px -1px rgba($green , 0.4);
- }
- }
- &.grayBg{
- border-color: rgba(#30302f,0.2);
- background-color: #f7f7f7;
- color: #30302f;
- &.shadow{
- box-shadow: 0px 2px 9px -1px rgba( #30302f , 0.2);
- }
- }
- &.whiteBg{
- border-color: rgba(#fff,0.2);
- background-color: #fff;
- color: #000;
- }
-
- &.orangeBg{
- border-color: $orange;
- background-color: $orange;
- color: #fff;
- &.shadow{
- box-shadow: 0px 2px 9px -1px rgba( $orange , 0.4);
- }
- }
- &.redBg{
- border-color: $red;
- background-color: $red;
- color: #fff;
- &.shadow{
- box-shadow: 0px 2px 9px -1px rgba( $red , 0.4);
- }
- }
- &.yellowBg{
- border-color: $yellow;
- background-color: $yellow;
- color: #000;
- &.shadow{
- box-shadow: 0px 2px 9px -1px rgba( $yellow , 0.4);
- }
- }
-
- &.line{
- background-color: transparent;
- background-image: none;
- color: $main;
- &.blackBg{
- color: $black;
- }
- &.greenBg{
- color: $green;
- }
- &.yellowBg{
- color: $yellow;
- }
- &.grayBg{
- color: #30302f;
- }
- &.whiteBg{
- border-color: rgba(#fff,0.7);
- color: #fff;
- }
- &.orangeBg{
- color: $orange;
- }
- &.redBg{
- color: $red;
- }
- }
- &+.btn,&+.roundBtn{
- margin-left: 20upx;
- }
- &.block{
- margin: 0;
- padding: 20upx 24upx;
- display: block;
- width: 100%;
- &+.btn{
- margin-left: 0;
- }
- }
- &:hover{
- -webkit-transform: scale(0.99);
- -moz-transform: scale(0.99);
- -ms-transform: scale(0.99);
- -o-transform: scale(0.99);
- transform: scale(0.99);
- opacity: 0.8;
- }
- &.disabled{
- -webkit-transform: scale(1);
- -moz-transform: scale(1);
- -ms-transform: scale(1);
- -o-transform: scale(1);
- transform: scale(1);
- opacity: 0.4;
- cursor: not-allowed;
- }
- }
-
- [class^="tag"] , [class*=" tag"]{
- display: inline-block;
- font-size: 24upx;
- padding: 4upx 14upx;
- border-radius: 4upx;
- margin-right: 6upx;
- margin-left: 6upx;
- }
- .tag{
- background-color: rgba($main,0.2);
- color: $main;
- }
- .tagBlue{
- background-color: rgba($blue,0.2);
- color: $blue;
- }
- .tagGray{
- background-color: rgba($gray,0.2);
- color: $gray;
- }
-
- .tagGradual{
- background-image: linear-gradient(to top right,rgba($main,0.2),rgba($main,0.1));
- color: $main;
- }
-
- .tagBlack{
- background-color: rgba($black,0.2);
- color: $black;
- }
- .tagGreen{
- background-color: rgba($green,0.2);
- color: $green;
- }
-
- .tagWhite{
- background-color: rgba($white,0.2);
- color: $white;
- }
-
- .tagOrange{
- background-color: rgba($orange,0.2);
- color: $orange;
- }
- .tagRed{
- background-color: rgba($red,0.2);
- color: $red;
- }
- .tagYellow{
- background-color: rgba($yellow,0.2);
- color: $yellow;
- }
-
- /* 边线(实线、虚线) */
- .bdn{
- border: none;
- }
- .bd{
- border: 1px solid $borderColor;
- &.dashed{
- border-style: dashed;
- }
- }
- .bt{
- border-top:1px solid $borderColor;
- &.dashed{
- border-top-style: dashed;
- }
- }
- .bb{
- border-bottom:1px solid $borderColor;
- &.dashed{
- border-bottom-style: dashed;
- }
- }
- .bl{
- border-left:1px solid $borderColor;
- &.dashed{
- border-left-style: dashed;
- }
- }
- .br{
- border-right: 1px solid $borderColor;
- &.dashed{
- border-right-style: dashed;
- }
- }
-
- $b:2;
- @while $b <= 10 {
- .bd#{$b}{
- border: #{$b}px solid $borderColor;
- &.dashed{
- border-style: dashed;
- }
- }
- .bt#{$b}{
- border-top:#{$b}px solid $borderColor;
- &.dashed{
- border-top-style: dashed;
- }
- }
- .bb#{$b}{
- border-bottom:#{$b}px solid $borderColor;
- &.dashed{
- border-bottom-style: dashed;
- }
- }
- .bl#{$b}{
- border-left:#{$b}px solid $borderColor;
- &.dashed{
- border-left-style: dashed;
- }
- }
- .br#{$b}{
- border-right: #{$b}px solid $borderColor;
- &.dashed{
- border-right-style: dashed;
- }
- }
- $b : $b + 1 ;
- }
-
- /* 边线颜色 */
- .mainBd{
- border-color: $main;
- }
- .greenBd{
- border-color: $green;
- }
- .redBd{
- border-color: $red;
- }
- .yellowBd{
- border-color:$yellow ;
- }
- .blackBd{
- border-color: $black;
- }
- .whiteBd{
- border-color:$white ;
- }
- .grayBd{
- border-color:$gray;
- }
- .greyBd{
- border-color:$grey;
- }
- .orangeBd{
- border-color:$orange;
- }
-
- /* 圆角 */
- .radius,.rds{
- -webkit-border-radius: 100%!important;
- -moz-border-radius: 100%!important;
- border-radius: 100%!important;
- }
-
- $r:0;
- @while $r <= 50{
- .rds#{$r},&.radius#{$r}{
- -webkit-border-radius:$r*2upx!important;
- -moz-border-radius:$r*2upx!important;
- border-radius:$r*2upx!important;
- }
- $r : $r + 1;
- }
-
- .rdsTl,.radiusTopLeft{
- border-top-left-radius:100%!important;
- }
- .rdsTr,.radiusTopRight{
- border-top-right-radius: 100%!important;
- }
- .rdsBl,.radiusBottomLeft{
- border-bottom-left-radius: 100%!important;
- }
- .rdsBr,.radiusBottomRight{
- border-bottom-right-radius: 100%!important;
- }
-
- $r:0;
- @while $r <= 50{
- .rdsTl#{$r},.radiusTopLeft#{$r}{
- border-top-left-radius: $r*2upx!important;
- }
- .rdsTr#{$r},.radiusTopRight#{$r}{
- border-top-right-radius: $r*2upx!important;
- }
- .rdsBl#{$r},.radiusBottomLeft#{$r}{
- border-bottom-left-radius: $r*2upx!important;
- }
- .rdsBr#{$r},.radiusBottomRight#{$r}{
- border-bottom-right-radius: $r*2upx!important;
- }
- $r : $r + 1;
- }
-
- /* 正方形&长方形 */
- [class^="square"] , [class*=" square"]{
- width: 100%;
- position: relative;
- height: auto;
- >.item,>image,>view,>navigator,>text,>button{
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- }
- }
-
- $p : 200 ;
- @while $p > 0 {
- .square#{$p}{
- padding-top: $p*1%;
- }
- @if $p == 100 {
- .square{
- padding-top: 100%;
- }
- }
- $p : $p - 5 ;
- }
-
-
-
- /* 阴影 */
- .shadow{
- box-shadow: 0px 2px 9px -1px rgba(0, 0, 0, 0.1);
- }
-
- /* 遮罩层 */
- .wrapper-top,.wt{
- background-image: linear-gradient(rgba(0,0,0,0.3) , rgba(0,0,0,0.02));
- }
- .wrapper-bottom,.wb{
- background-image: linear-gradient( rgba(0,0,0,0.02) , rgba(0,0,0,0.3) );
- }
-
- [class^="wp"],[class*=" wp"] {
- z-index: 10;
- }
-
- /* 透明度 */
- @for $op from 0 through 10 {
- .op#{$op}{
- opacity: $op * 0.1!important;
- }
- .wp#{$op}{
- background-color: rgba(#000,$op*0.1);
- }
- @if $op == 5 {
- .wp{
- background-color: rgba(#000,0.5);
- }
- }
- }
-
- /* 分割线 */
- [class*=" split"],[class^="split"] {
- position: relative;
- &:before{
- content:"";
- display: block;
- position: absolute;
- left: 0;
- top: 50%;
- border-left: 1px solid $borderColor;
- }
- }
-
- $s:10;
- @while $s <= 100 {
- .split#{$s}{
- &:before{
- height: #{$s*2}upx;
- margin-top: -#{$s}upx;
- }
- }
- @if $s == 10 {
- .split{
- &:before{
- height: 20upx;
- margin-top: -10upx;
- }
- }
- }
- $s:$s+2;
- }
-
- .hover,[class^="hover"],[class*=" hover"]{
- transition: all 0.4s;
- cursor: pointer;
- &:hover{
- opacity: 0.8 !important;
- }
- }
-
-
-
- .statusBar{
- height: var(--status-bar-height);
- }
-
- .winBottom{
- height: var(--windown-bottom);
- }
-
- .safeBottom{
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- }
-
- .disabled{
- opacity:0.8;
- cursor: not-allowed;
- }
-
-
-
- .grid,.gridNoMb,.gridNoPd{
- >.btn,>.roundBtn{
- &+.btn,&+.roundBtn{
- margin-left: 0 ;
- }
- }
- }
-
- .roundBtn{
- -webkit-border-radius: 100upx;
- -moz-border-radius: 100upx;
- border-radius: 100upx;
- }
-
-
-
- /* 位置 */
- .text-center,.tc{
- text-align: center!important;
- }
- .text-left,.tl{
- text-align: left!important;
- }
- .text-right,.tr{
- text-align: right!important;
- }
- .text-justify,.tj{
- text-align: justify!important;
- }
- .text-bold,.bold{
- font-weight: bold!important;
- }
- .text-normal,.normal{
- font-weight: normal!important;
- }
- .break{
- white-space: normal;
- word-break: break-all;
- }
- .noBreak{
- white-space: nowrap;
- word-break: keep-all;
- }
- .inline{
- display: inline-block;
- }
- .block{
- display: block;
- width: 100%;
- }
- .none{
- display: none;
- }
- .center-block{
- margin: 0 auto;
- display: block;
- }
- .hidden{
- overflow: hidden;
- }
- .hiddenX{
- overflow-x: hidden;
- }
- .hiddenY{
- overflow-y: hidden;
- }
- .auto{
- overflow: auto;
- }
- .autoX{
- overflow-x: auto;
- }
- .autoY{
- overflow-y: auto;
- }
- .showInMb{
- display: block;
- }
- .showInPc{
- display: none;
- }
- table{
- width: 100%;
- border-collapse: collapse;
- border-spacing: 0;
- border: 1px solid #e6e6e6;
- thead{
- tr{
- background-color: #f2f2f2;
- th{
- color: #8799a3;
- width: 1%;
- }
- }
- }
- tr{
- background-color: #fff;
- transition: all 0.4s;
- td,th{
- border: 1px solid #e6e6e6;
- overflow: hidden;
- -o-text-overflow: ellipsis;
- text-overflow: ellipsis;
- white-space: nowrap;
- word-wrap: break-word;
- padding: 5px 10px;
- height: 28px;
- line-height: 28px;
- &.autoWidth{
- width: auto;
- }
- }
- &:hover{
- background-color: #f2f2f2;
- }
- }
- }
- </style>
|