100 lines
2.8 KiB
JavaScript
100 lines
2.8 KiB
JavaScript
|
"use strict";
|
||
|
const common_vendor = require("./common/vendor.js");
|
||
|
const _sfc_main = {
|
||
|
name: "ad-popup",
|
||
|
props: {
|
||
|
// 是否显示弹窗
|
||
|
visible: {
|
||
|
type: Boolean,
|
||
|
value: false
|
||
|
},
|
||
|
coupons: {
|
||
|
type: Object,
|
||
|
value: null
|
||
|
}
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
localVisible: this.visible,
|
||
|
checked: false,
|
||
|
initPosition: {
|
||
|
left: 50,
|
||
|
top: 50
|
||
|
},
|
||
|
// top: 35%;
|
||
|
// left: 8%;
|
||
|
content: {
|
||
|
left: 20,
|
||
|
top: 150
|
||
|
},
|
||
|
animation: {},
|
||
|
screenWidth: 0,
|
||
|
screenHeight: 0,
|
||
|
top: 590,
|
||
|
left: 80
|
||
|
};
|
||
|
},
|
||
|
mounted() {
|
||
|
const sysInfo = common_vendor.index.getSystemInfoSync();
|
||
|
this.screenHeight = sysInfo.screenHeight;
|
||
|
this.screenWidth = sysInfo.screenWidth;
|
||
|
},
|
||
|
methods: {
|
||
|
toggleCheck() {
|
||
|
this.checked = !this.checked;
|
||
|
},
|
||
|
// 关闭弹窗
|
||
|
onClose() {
|
||
|
this.$emit("ad-close", this.checked);
|
||
|
},
|
||
|
onFurl() {
|
||
|
this.startAnimation();
|
||
|
this.$emit("ad-furl", this.checked);
|
||
|
},
|
||
|
startAnimation() {
|
||
|
this.showBox = true;
|
||
|
this.animation = {};
|
||
|
setTimeout(() => {
|
||
|
const animation = common_vendor.index.createAnimation({
|
||
|
duration: 1e3,
|
||
|
timingFunction: "ease-in-out"
|
||
|
});
|
||
|
const targetLeft = this.screenWidth - 170;
|
||
|
const targetTop = this.screenHeight - 170;
|
||
|
animation.translate(targetLeft - this.initPosition.left, targetTop - this.initPosition.top).scale(0.03).rotate(180).skew(10, 10).opacity(0).step();
|
||
|
this.animation = animation.export();
|
||
|
setTimeout(() => {
|
||
|
this.$emit("ad-close", false);
|
||
|
this.initPosition = {
|
||
|
left: 50,
|
||
|
top: 50
|
||
|
};
|
||
|
this.animation = {};
|
||
|
}, 1e3);
|
||
|
}, 50);
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||
|
return common_vendor.e({
|
||
|
a: $props.visible
|
||
|
}, $props.visible ? common_vendor.e({
|
||
|
b: common_vendor.o((...args) => $options.onClose && $options.onClose(...args)),
|
||
|
c: common_vendor.t($props.coupons.amount / 100),
|
||
|
d: common_vendor.t($props.coupons.title),
|
||
|
e: common_vendor.t($props.coupons.useGmtStart),
|
||
|
f: common_vendor.t($props.coupons.useGmtEnd),
|
||
|
g: $data.checked
|
||
|
}, $data.checked ? {} : {}, {
|
||
|
h: common_vendor.n($data.checked ? "checked" : ""),
|
||
|
i: common_vendor.o((...args) => $options.toggleCheck && $options.toggleCheck(...args)),
|
||
|
j: common_vendor.o((...args) => $options.onFurl && $options.onFurl(...args)),
|
||
|
k: $data.animation,
|
||
|
l: $data.initPosition.left,
|
||
|
m: $data.initPosition.top
|
||
|
}) : {});
|
||
|
}
|
||
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||
|
exports.MiniProgramPage = MiniProgramPage;
|
||
|
//# sourceMappingURL=../.sourcemap/mp-baidu/ad-popup.js.map
|