| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <template>
- <view class="mask" :class="maskState===0 ? 'none' : maskState===1 ? 'show' : ''" >
- <view class="content">
- <view class="arrow-wrap">
- <image style="width: 150rpx;height: 141rpx;" src="/static/app/share/share-arrow.png" mode="aspectFit"></image>
- </view>
- <view class="arrow-content">
- <view class="text">点击更多,可以转发</view>
- <view class="text">给朋友和分享到朋友圈哦!</view>
- </view>
- <view class="button-wrap">
- <u-button type="primary"
- style="margin-bottom: 30rpx;width: 280rpx;"
- shape="circle"
- class="c-button"
- :text="defautlOptions.confirmText"
- @click="confirm">
- </u-button>
- </view>
- </view>
- </view>
- </template>
- <script>
-
- export default {
- name:"c-share-model",
- data() {
- return {
- maskState: 0,
- defautlOptions: {
- title: '',
- content: '',
- 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();
- }else{
- this.toggleMask();
- }
- },
- cancel() {
- if(this._cancel){
- this._cancel()
- this.toggleMask();
- }else{
- this.toggleMask();
- }
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .mask{
- display: flex;
- position: fixed;
- left: 0;
- top: var(--window-top);
- bottom: 0;
- width: 100vw;
- background: rgba(0,0,0,0);
- z-index: 10001;
- transition: .6s;
-
- &.none{
- display: none;
- }
- &.show{
- background: rgba(0,0,0,.6);
-
- .mask-content{
- transition: transform .3s;
- opacity: 1;
- transform: scale(1);
- }
- }
-
- }
- .content{
- width: 100%;
- align-self: stretch;
- .arrow-wrap{
- padding-top: 42rpx;
- padding-right: 36rpx;
- width: 100%;
- display: flex;
- justify-content: flex-end;
- box-sizing: border-box;
- }
- .arrow-content{
- padding-left: 40vw;
- .text{
- text-align: left;
- font-size: 28rpx;
- font-family: NSimSun;
- font-weight: 400;
- color: #FFFFFF;
- line-height: 1.2;
- }
- }
- .button-wrap{
- padding-top: 60rpx;
- }
- }
- </style>
|