微信登录版

This commit is contained in:
qianlile
2021-08-28 11:30:34 +08:00
parent 7af68fee6b
commit 33aecb6bda
432 changed files with 13362 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var component_1 = require('../common/component');
var color_1 = require('../common/color');
var utils_1 = require('../common/utils');
component_1.VantComponent({
props: {
message: String,
background: String,
type: {
type: String,
value: 'danger',
},
color: {
type: String,
value: color_1.WHITE,
},
duration: {
type: Number,
value: 3000,
},
zIndex: {
type: Number,
value: 110,
},
safeAreaInsetTop: {
type: Boolean,
value: false,
},
top: null,
},
data: {
show: false,
onOpened: null,
onClose: null,
onClick: null,
},
created: function () {
var statusBarHeight = utils_1.getSystemInfoSync().statusBarHeight;
this.setData({ statusBarHeight: statusBarHeight });
},
methods: {
show: function () {
var _this = this;
var _a = this.data,
duration = _a.duration,
onOpened = _a.onOpened;
clearTimeout(this.timer);
this.setData({ show: true });
wx.nextTick(onOpened);
if (duration > 0 && duration !== Infinity) {
this.timer = setTimeout(function () {
_this.hide();
}, duration);
}
},
hide: function () {
var onClose = this.data.onClose;
clearTimeout(this.timer);
this.setData({ show: false });
wx.nextTick(onClose);
},
onTap: function (event) {
var onClick = this.data.onClick;
if (onClick) {
onClick(event.detail);
}
},
},
});

View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"van-transition": "../transition/index"
}
}

View File

@@ -0,0 +1,21 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<van-transition
name="slide-down"
show="{{ show }}"
custom-class="van-notify__container"
custom-style="{{ computed.rootStyle({ zIndex, top }) }}"
bind:tap="onTap"
>
<view
class="van-notify van-notify--{{ type }}"
style="{{ computed.notifyStyle({ background, color }) }}"
>
<view
wx:if="{{ safeAreaInsetTop }}"
style="height: {{ statusBarHeight }}px"
/>
<text>{{ message }}</text>
</view>
</van-transition>

View File

@@ -0,0 +1,22 @@
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function rootStyle(data) {
return style({
'z-index': data.zIndex,
top: addUnit(data.top),
});
}
function notifyStyle(data) {
return style({
background: data.background,
color: data.color,
});
}
module.exports = {
rootStyle: rootStyle,
notifyStyle: notifyStyle,
};

View File

@@ -0,0 +1 @@
@import '../common/index.wxss';.van-notify{text-align:center;word-wrap:break-word;padding:6px 15px;padding:var(--notify-padding,6px 15px);font-size:14px;font-size:var(--notify-font-size,14px);line-height:20px;line-height:var(--notify-line-height,20px)}.van-notify__container{position:fixed;top:0;left:0;box-sizing:border-box;width:100%}.van-notify--primary{background-color:#1989fa;background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:#07c160;background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:#ee0a24;background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:#ff976a;background-color:var(--notify-warning-background-color,#ff976a)}

View File

@@ -0,0 +1,64 @@
'use strict';
var __assign =
(this && this.__assign) ||
function () {
__assign =
Object.assign ||
function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, '__esModule', { value: true });
var color_1 = require('../common/color');
var defaultOptions = {
selector: '#van-notify',
type: 'danger',
message: '',
background: '',
duration: 3000,
zIndex: 110,
top: 0,
color: color_1.WHITE,
safeAreaInsetTop: false,
onClick: function () {},
onOpened: function () {},
onClose: function () {},
};
function parseOptions(message) {
if (message == null) {
return {};
}
return typeof message === 'string' ? { message: message } : message;
}
function getContext() {
var pages = getCurrentPages();
return pages[pages.length - 1];
}
function Notify(options) {
options = __assign(__assign({}, defaultOptions), parseOptions(options));
var context = options.context || getContext();
var notify = context.selectComponent(options.selector);
delete options.context;
delete options.selector;
if (notify) {
notify.setData(options);
notify.show();
return notify;
}
console.warn('未找到 van-notify 节点,请确认 selector 及 context 是否正确');
}
exports.default = Notify;
Notify.clear = function (options) {
options = __assign(__assign({}, defaultOptions), parseOptions(options));
var context = options.context || getContext();
var notify = context.selectComponent(options.selector);
if (notify) {
notify.hide();
}
};