| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <template>
- <view class="mask" :class="maskState===0 ? 'none' : maskState===1 ? 'show' : ''" >
- <view class="mask-content" @click.stop.prevent="stopPrevent">
- <view class="title" v-if="defautlOptions.title" v-html="defautlOptions.title"></view>
- <div class="divider"></div>
- <view class="desc" v-if="defautlOptions.content" v-html="defautlOptions.content"></view>
- <view class="info-name">打卡方式</view>
- <view class="info" v-if="defautlOptions.info" v-html="defautlOptions.info"></view>
- <view class="action-content">
- <u-button type="primary"
- style="margin-bottom: 30rpx;"
- class="c-button"
- @click="confirm">
- <image style="width: 32rpx;height: 32rpx;" src="@/static/app/daka.png" mode="aspectFill"></image>
- <text style="font-size: 32rpx;font-weight: 500;margin-left: 20rpx;">
- {{defautlOptions.confirmText}}
- </text>
- </u-button>
- <view class="cancel-btn" @click="cancel">{{defautlOptions.cancelText}}</view>
- </view>
- </view>
- </view>
- </template>
- <script>
-
- export default {
- name:"c-confrim-sign",
- data() {
- return {
- maskState: 0,
- defautlOptions: {
- title: '',
- content: '',
- info: '',
- confirmText: '打卡',
- confirmClass: 'text-red',
- cancelText: '我再想想',
- cancelClass: 'text-black'
- }
- };
- },
- methods: {
- stopPrevent(){
-
- },
- toggleMask(type){
- let timer = type === 'show' ? 10 : 0;
- let state = type === 'show' ? 1 : 0;
- this.maskState = 2;
- setTimeout(()=>{
- this.maskState = state;
- }, timer)
- },
- /**
- * @description 确认
- * @param {Object} title: String desc: String
- */
- $confirm(options = {}){
- // 继承原来的
- this.defautlOptions = Object.assign(this.defautlOptions, options);
- return new Promise((resolve,reject)=> {
- this.toggleMask('show')
- this._confirm = () => {
- resolve(1)
- this._confirm = null;
- }
- this._cancel = () => {
- resolve(0)
- this._cancel = null;
- }
- })
- },
- confirm() {
- if(this._confirm){
- this._confirm()
- this.toggleMask();
- }
- },
- cancel() {
- if(this._cancel){
- this._cancel()
- this.toggleMask();
- }
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .mask{
- display: flex;
- align-items: center;
- justify-content: center;
- position: fixed;
- left: 0;
- top: var(--window-top);
- bottom: 0;
- width: 100vw;
- background: rgba(0,0,0,0);
- z-index: 10001;
- transition: .6s;
-
- .mask-content{
- padding-top: 0rpx;
- display: flex;
- flex-direction: column;
- width: 630rpx;
- background: #fff;
- border-radius: 3px;
- transition: transform .1s opacity 0.1s;
- transform: scale(1.2);
- transition-timing-function: ease-out;
- opacity: 0.3;
- }
-
- &.none{
- display: none;
- }
- &.show{
- background: rgba(0,0,0,0);
-
- .mask-content{
- transition: transform .3s;
- opacity: 1;
- transform: scale(1);
- }
- }
- .title{
- display: flex;
- justify-content: center;
- align-items: center;
- height: 90rpx;
- font-size: 30rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #FD8701;
- text-align: justify;
- }
- .divider{
- height: 14rpx;
- background: #F3F3F3;
- }
- .desc {
- padding: 31rpx 29rpx 20rpx;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 36rpx;
- text-indent: 2em;
- text-align: justify;
- }
- .info-name{
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #333333;
- padding-left: 30rpx;
- }
- .info{
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 36rpx;
- padding: 10rpx 30rpx;
- text-align: justify;
- text-indent: 2em;
- }
- .action-content{
- padding: 81rpx 50rpx 30rpx;
-
- .cancel-btn{
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 26rpx;
- font-family: PingFang SC;
- font-weight: 400;
- text-decoration: underline;
- color: #999999;
- line-height: 40rpx;
- }
- }
- }
- .icon-wrap{
- position: absolute;
- top: -60rpx;
- right: -5rpx;
- }
- </style>
|