仿互站小程序

This commit is contained in:
Drawfans
2020-06-09 16:17:23 +08:00
commit 7bfd53851e
321 changed files with 22890 additions and 0 deletions

19
vant/mixins/basic.js Normal file
View File

@@ -0,0 +1,19 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.basic = Behavior({
methods: {
$emit: function() {
this.triggerEvent.apply(this, arguments);
},
getRect: function(e, t) {
var r = this;
return new Promise(function(i) {
wx.createSelectorQuery().in(r)[t ? "selectAll" : "select"](e).boundingClientRect(function(e) {
t && Array.isArray(e) && e.length && i(e), !t && e && i(e);
}).exec();
});
}
}
});

22
vant/mixins/button.js Normal file
View File

@@ -0,0 +1,22 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.button = Behavior({
externalClasses: [ "hover-class" ],
properties: {
id: String,
lang: {
type: String,
value: "en"
},
businessId: Number,
sessionFrom: String,
sendMessageTitle: String,
sendMessagePath: String,
sendMessageImg: String,
showMessageCard: Boolean,
appParameter: String,
ariaLabel: String
}
});

21
vant/mixins/link.js Normal file
View File

@@ -0,0 +1,21 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.link = Behavior({
properties: {
url: String,
linkType: {
type: String,
value: "navigateTo"
}
},
methods: {
jumpLink: function() {
var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "url", t = this.data[e];
t && wx[this.data.linkType]({
url: t
});
}
}
});

View File

@@ -0,0 +1,37 @@
function t(t, e) {
return new Promise(function(i) {
t.setData(e, i);
});
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.behavior = Behavior({
created: function() {
var t = this;
if (this.$options) {
var e = {}, i = this.$options().computed, o = Object.keys(i);
this.calcComputed = function() {
var n = {};
return o.forEach(function(o) {
var s = i[o].call(t);
e[o] !== s && (e[o] = n[o] = s);
}), n;
};
}
},
attached: function() {
this.set();
},
methods: {
set: function(e, i) {
var o = this, n = [];
return e && n.push(t(this, e)), this.calcComputed && n.push(t(this, this.calcComputed())),
Promise.all(n).then(function(t) {
return i && "function" == typeof i && i.call(o), t;
});
}
}
});

View File

@@ -0,0 +1,21 @@
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.observe = function(o, t) {
var s = o.watch, i = o.computed;
if (t.behaviors.push(e.behavior), s) {
var p = t.properties || {};
Object.keys(s).forEach(function(e) {
if (e in p) {
var r = p[e];
null !== r && "type" in r || (r = {
type: r
}), r.observer = s[e], p[e] = r;
}
}), t.properties = p;
}
i && (t.methods = t.methods || {}, t.methods.$options = function() {
return o;
}, t.properties && (0, r.observeProps)(t.properties));
};
var e = require("./behavior"), r = require("./props");

View File

@@ -0,0 +1,14 @@
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.observeProps = function(e) {
e && Object.keys(e).forEach(function(t) {
var r = e[t];
null !== r && "type" in r || (r = {
type: r
});
var s = r.observer;
r.observer = function() {
s && ("string" == typeof s && (s = this[s]), s.apply(this, arguments)), this.set();
}, e[t] = r;
});
};

29
vant/mixins/open-type.js Normal file
View File

@@ -0,0 +1,29 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.openType = Behavior({
properties: {
openType: String
},
methods: {
bindGetUserInfo: function(e) {
this.$emit("getuserinfo", e.detail);
},
bindContact: function(e) {
this.$emit("contact", e.detail);
},
bindGetPhoneNumber: function(e) {
this.$emit("getphonenumber", e.detail);
},
bindError: function(e) {
this.$emit("error", e.detail);
},
bindLaunchApp: function(e) {
this.$emit("launchapp", e.detail);
},
bindOpenSetting: function(e) {
this.$emit("opensetting", e.detail);
}
}
});

46
vant/mixins/safe-area.js Normal file
View File

@@ -0,0 +1,46 @@
function e() {
return new Promise(function(e, s) {
null != t ? e(t) : wx.getSystemInfo({
success: function(s) {
var n = s.model, o = s.screenHeight, a = s.statusBarHeight, r = /iphone x/i.test(n), i = /iPhone11/i.test(n) && 812 === o;
e(t = {
isIPhoneX: r || i,
statusBarHeight: a
});
},
fail: s
});
});
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var t = null;
exports.safeArea = function() {
var t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}, s = t.safeAreaInsetBottom, n = void 0 === s || s, o = t.safeAreaInsetTop, a = void 0 !== o && o;
return Behavior({
properties: {
safeAreaInsetTop: {
type: Boolean,
value: a
},
safeAreaInsetBottom: {
type: Boolean,
value: n
}
},
created: function() {
var t = this;
e().then(function(e) {
var s = e.isIPhoneX, n = e.statusBarHeight;
t.set({
isIPhoneX: s,
statusBarHeight: n
});
});
}
});
};

18
vant/mixins/touch.js Normal file
View File

@@ -0,0 +1,18 @@
Object.defineProperty(exports, "__esModule", {
value: !0
});
exports.touch = Behavior({
methods: {
touchStart: function(t) {
var s = t.touches[0];
this.direction = "", this.deltaX = 0, this.deltaY = 0, this.offsetX = 0, this.offsetY = 0,
this.startX = s.clientX, this.startY = s.clientY;
},
touchMove: function(t) {
var s = t.touches[0];
this.deltaX = s.clientX - this.startX, this.deltaY = s.clientY - this.startY, this.offsetX = Math.abs(this.deltaX),
this.offsetY = Math.abs(this.deltaY), this.direction = this.offsetX > this.offsetY ? "horizontal" : this.offsetX < this.offsetY ? "vertical" : "";
}
}
});

91
vant/mixins/transition.js Normal file
View File

@@ -0,0 +1,91 @@
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.transition = void 0;
var e = require("../common/utils"), t = function(e) {
return {
enter: "van-" + e + "-enter van-" + e + "-enter-active enter-class enter-active-class",
"enter-to": "van-" + e + "-enter-to van-" + e + "-enter-active enter-to-class enter-active-class",
leave: "van-" + e + "-leave van-" + e + "-leave-active leave-class leave-active-class",
"leave-to": "van-" + e + "-leave-to van-" + e + "-leave-active leave-to-class leave-active-class"
};
}, s = function() {
return new Promise(function(e) {
return setTimeout(e, 1e3 / 30);
});
};
exports.transition = function(n) {
return Behavior({
properties: {
customStyle: String,
show: {
type: Boolean,
value: n,
observer: "observeShow"
},
duration: {
type: [ Number, Object ],
value: 300,
observer: "observeDuration"
},
name: {
type: String,
value: "fade",
observer: "updateClasses"
}
},
data: {
type: "",
inited: !1,
display: !1,
classNames: t("fade")
},
attached: function() {
this.data.show && this.show();
},
methods: {
observeShow: function(e) {
e ? this.show() : this.leave();
},
updateClasses: function(e) {
this.set({
classNames: t(e)
});
},
show: function() {
var t = this, n = this.data, a = n.classNames, i = n.duration, r = (0, e.isObj)(i) ? i.leave : i;
Promise.resolve().then(s).then(function() {
return t.set({
inited: !0,
display: !0,
classes: a.enter,
currentDuration: r
});
}).then(s).then(function() {
return t.set({
classes: a["enter-to"]
});
});
},
leave: function() {
var t = this, n = this.data, a = n.classNames, i = n.duration, r = (0, e.isObj)(i) ? i.leave : i;
0 != +r ? Promise.resolve().then(s).then(function() {
return t.set({
classes: a.leave,
currentDuration: r
});
}).then(s).then(function() {
return t.set({
classes: a["leave-to"]
});
}) : this.onTransitionEnd();
},
onTransitionEnd: function() {
this.data.show || (this.set({
display: !1
}), this.$emit("transitionEnd"));
}
}
});
};