mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
智慧宿舍系统小程序
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.basic = void 0;
|
||||
exports.basic = Behavior({
|
||||
methods: {
|
||||
$emit: function (name, detail, options) {
|
||||
this.triggerEvent(name, detail, options);
|
||||
},
|
||||
set: function (data) {
|
||||
this.setData(data);
|
||||
return new Promise(function (resolve) {
|
||||
return wx.nextTick(resolve);
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.button = void 0;
|
||||
var version_1 = require('../common/version');
|
||||
exports.button = Behavior({
|
||||
externalClasses: ['hover-class'],
|
||||
properties: {
|
||||
id: String,
|
||||
lang: String,
|
||||
businessId: Number,
|
||||
sessionFrom: String,
|
||||
sendMessageTitle: String,
|
||||
sendMessagePath: String,
|
||||
sendMessageImg: String,
|
||||
showMessageCard: Boolean,
|
||||
appParameter: String,
|
||||
ariaLabel: String,
|
||||
openType: String,
|
||||
getUserProfileDesc: String,
|
||||
},
|
||||
data: {
|
||||
canIUseGetUserProfile: version_1.canIUseGetUserProfile(),
|
||||
},
|
||||
methods: {
|
||||
onGetUserInfo: function (event) {
|
||||
this.triggerEvent('getuserinfo', event.detail);
|
||||
},
|
||||
onContact: function (event) {
|
||||
this.triggerEvent('contact', event.detail);
|
||||
},
|
||||
onGetPhoneNumber: function (event) {
|
||||
this.triggerEvent('getphonenumber', event.detail);
|
||||
},
|
||||
onError: function (event) {
|
||||
this.triggerEvent('error', event.detail);
|
||||
},
|
||||
onLaunchApp: function (event) {
|
||||
this.triggerEvent('launchapp', event.detail);
|
||||
},
|
||||
onOpenSetting: function (event) {
|
||||
this.triggerEvent('opensetting', event.detail);
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.link = void 0;
|
||||
exports.link = Behavior({
|
||||
properties: {
|
||||
url: String,
|
||||
linkType: {
|
||||
type: String,
|
||||
value: 'navigateTo',
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
jumpLink: function (urlKey) {
|
||||
if (urlKey === void 0) {
|
||||
urlKey = 'url';
|
||||
}
|
||||
var url = this.data[urlKey];
|
||||
if (url) {
|
||||
if (
|
||||
this.data.linkType === 'navigateTo' &&
|
||||
getCurrentPages().length > 9
|
||||
) {
|
||||
wx.redirectTo({ url: url });
|
||||
} else {
|
||||
wx[this.data.linkType]({ url: url });
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,41 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.pageScrollMixin = void 0;
|
||||
var utils_1 = require('../common/utils');
|
||||
function onPageScroll(event) {
|
||||
var _a = utils_1.getCurrentPage().vanPageScroller,
|
||||
vanPageScroller = _a === void 0 ? [] : _a;
|
||||
vanPageScroller.forEach(function (scroller) {
|
||||
if (typeof scroller === 'function') {
|
||||
// @ts-ignore
|
||||
scroller(event);
|
||||
}
|
||||
});
|
||||
}
|
||||
var pageScrollMixin = function (scroller) {
|
||||
return Behavior({
|
||||
attached: function () {
|
||||
var page = utils_1.getCurrentPage();
|
||||
if (Array.isArray(page.vanPageScroller)) {
|
||||
page.vanPageScroller.push(scroller.bind(this));
|
||||
} else {
|
||||
page.vanPageScroller =
|
||||
typeof page.onPageScroll === 'function'
|
||||
? [page.onPageScroll.bind(page), scroller.bind(this)]
|
||||
: [scroller.bind(this)];
|
||||
}
|
||||
page.onPageScroll = onPageScroll;
|
||||
},
|
||||
detached: function () {
|
||||
var _a;
|
||||
var page = utils_1.getCurrentPage();
|
||||
page.vanPageScroller =
|
||||
((_a = page.vanPageScroller) === null || _a === void 0
|
||||
? void 0
|
||||
: _a.filter(function (item) {
|
||||
return item !== scroller;
|
||||
})) || [];
|
||||
},
|
||||
});
|
||||
};
|
||||
exports.pageScrollMixin = pageScrollMixin;
|
||||
@@ -0,0 +1,40 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.touch = void 0;
|
||||
// @ts-nocheck
|
||||
var MIN_DISTANCE = 10;
|
||||
function getDirection(x, y) {
|
||||
if (x > y && x > MIN_DISTANCE) {
|
||||
return 'horizontal';
|
||||
}
|
||||
if (y > x && y > MIN_DISTANCE) {
|
||||
return 'vertical';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
exports.touch = Behavior({
|
||||
methods: {
|
||||
resetTouchStatus: function () {
|
||||
this.direction = '';
|
||||
this.deltaX = 0;
|
||||
this.deltaY = 0;
|
||||
this.offsetX = 0;
|
||||
this.offsetY = 0;
|
||||
},
|
||||
touchStart: function (event) {
|
||||
this.resetTouchStatus();
|
||||
var touch = event.touches[0];
|
||||
this.startX = touch.clientX;
|
||||
this.startY = touch.clientY;
|
||||
},
|
||||
touchMove: function (event) {
|
||||
var touch = event.touches[0];
|
||||
this.deltaX = touch.clientX - this.startX;
|
||||
this.deltaY = touch.clientY - this.startY;
|
||||
this.offsetX = Math.abs(this.deltaX);
|
||||
this.offsetY = Math.abs(this.deltaY);
|
||||
this.direction =
|
||||
this.direction || getDirection(this.offsetX, this.offsetY);
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,155 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
exports.transition = void 0;
|
||||
// @ts-nocheck
|
||||
var utils_1 = require('../common/utils');
|
||||
var validator_1 = require('../common/validator');
|
||||
var getClassNames = function (name) {
|
||||
return {
|
||||
enter:
|
||||
'van-' +
|
||||
name +
|
||||
'-enter van-' +
|
||||
name +
|
||||
'-enter-active enter-class enter-active-class',
|
||||
'enter-to':
|
||||
'van-' +
|
||||
name +
|
||||
'-enter-to van-' +
|
||||
name +
|
||||
'-enter-active enter-to-class enter-active-class',
|
||||
leave:
|
||||
'van-' +
|
||||
name +
|
||||
'-leave van-' +
|
||||
name +
|
||||
'-leave-active leave-class leave-active-class',
|
||||
'leave-to':
|
||||
'van-' +
|
||||
name +
|
||||
'-leave-to van-' +
|
||||
name +
|
||||
'-leave-active leave-to-class leave-active-class',
|
||||
};
|
||||
};
|
||||
function transition(showDefaultValue) {
|
||||
return Behavior({
|
||||
properties: {
|
||||
customStyle: String,
|
||||
// @ts-ignore
|
||||
show: {
|
||||
type: Boolean,
|
||||
value: showDefaultValue,
|
||||
observer: 'observeShow',
|
||||
},
|
||||
// @ts-ignore
|
||||
duration: {
|
||||
type: null,
|
||||
value: 300,
|
||||
observer: 'observeDuration',
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
value: 'fade',
|
||||
},
|
||||
},
|
||||
data: {
|
||||
type: '',
|
||||
inited: false,
|
||||
display: false,
|
||||
},
|
||||
ready: function () {
|
||||
if (this.data.show === true) {
|
||||
this.observeShow(true, false);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
observeShow: function (value, old) {
|
||||
if (value === old) {
|
||||
return;
|
||||
}
|
||||
value ? this.enter() : this.leave();
|
||||
},
|
||||
enter: function () {
|
||||
var _this = this;
|
||||
var _a = this.data,
|
||||
duration = _a.duration,
|
||||
name = _a.name;
|
||||
var classNames = getClassNames(name);
|
||||
var currentDuration = validator_1.isObj(duration)
|
||||
? duration.enter
|
||||
: duration;
|
||||
this.status = 'enter';
|
||||
this.$emit('before-enter');
|
||||
utils_1.requestAnimationFrame(function () {
|
||||
if (_this.status !== 'enter') {
|
||||
return;
|
||||
}
|
||||
_this.$emit('enter');
|
||||
_this.setData({
|
||||
inited: true,
|
||||
display: true,
|
||||
classes: classNames.enter,
|
||||
currentDuration: currentDuration,
|
||||
});
|
||||
utils_1.requestAnimationFrame(function () {
|
||||
if (_this.status !== 'enter') {
|
||||
return;
|
||||
}
|
||||
_this.transitionEnded = false;
|
||||
_this.setData({ classes: classNames['enter-to'] });
|
||||
});
|
||||
});
|
||||
},
|
||||
leave: function () {
|
||||
var _this = this;
|
||||
if (!this.data.display) {
|
||||
return;
|
||||
}
|
||||
var _a = this.data,
|
||||
duration = _a.duration,
|
||||
name = _a.name;
|
||||
var classNames = getClassNames(name);
|
||||
var currentDuration = validator_1.isObj(duration)
|
||||
? duration.leave
|
||||
: duration;
|
||||
this.status = 'leave';
|
||||
this.$emit('before-leave');
|
||||
utils_1.requestAnimationFrame(function () {
|
||||
if (_this.status !== 'leave') {
|
||||
return;
|
||||
}
|
||||
_this.$emit('leave');
|
||||
_this.setData({
|
||||
classes: classNames.leave,
|
||||
currentDuration: currentDuration,
|
||||
});
|
||||
utils_1.requestAnimationFrame(function () {
|
||||
if (_this.status !== 'leave') {
|
||||
return;
|
||||
}
|
||||
_this.transitionEnded = false;
|
||||
setTimeout(function () {
|
||||
return _this.onTransitionEnd();
|
||||
}, currentDuration);
|
||||
_this.setData({ classes: classNames['leave-to'] });
|
||||
});
|
||||
});
|
||||
},
|
||||
onTransitionEnd: function () {
|
||||
if (this.transitionEnded) {
|
||||
return;
|
||||
}
|
||||
this.transitionEnded = true;
|
||||
this.$emit('after-' + this.status);
|
||||
var _a = this.data,
|
||||
show = _a.show,
|
||||
display = _a.display;
|
||||
if (!show && display) {
|
||||
this.setData({ display: false });
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
exports.transition = transition;
|
||||
Reference in New Issue
Block a user