Browse Source

上传代码

master
杨豪 3 years ago
commit
ca67f7ce6f
  1. 137
      app.js
  2. 20
      app.json
  3. 95
      app.wxss
  4. 1
      dist/cell/index.d.ts
  5. 38
      dist/cell/index.js
  6. 6
      dist/cell/index.json
  7. 47
      dist/cell/index.wxml
  8. 17
      dist/cell/index.wxs
  9. 1
      dist/cell/index.wxss
  10. 6
      dist/collapse-item/animate.d.ts
  11. 70
      dist/collapse-item/animate.js
  12. 1
      dist/collapse-item/index.d.ts
  13. 59
      dist/collapse-item/index.js
  14. 6
      dist/collapse-item/index.json
  15. 44
      dist/collapse-item/index.wxml
  16. 1
      dist/collapse-item/index.wxss
  17. 1
      dist/collapse/index.d.ts
  18. 44
      dist/collapse/index.js
  19. 3
      dist/collapse/index.json
  20. 3
      dist/collapse/index.wxml
  21. 1
      dist/collapse/index.wxss
  22. 7
      dist/common/color.d.ts
  23. 7
      dist/common/color.js
  24. 8
      dist/common/component.d.ts
  25. 45
      dist/common/component.js
  26. 1
      dist/common/index.wxss
  27. 21
      dist/common/relation.d.ts
  28. 64
      dist/common/relation.js
  29. 1
      dist/common/style/clearfix.wxss
  30. 1
      dist/common/style/ellipsis.wxss
  31. 1
      dist/common/style/hairline.wxss
  32. 0
      dist/common/style/mixins/clearfix.wxss
  33. 0
      dist/common/style/mixins/ellipsis.wxss
  34. 0
      dist/common/style/mixins/hairline.wxss
  35. 0
      dist/common/style/theme.wxss
  36. 0
      dist/common/style/var.wxss
  37. 31
      dist/common/utils.d.ts
  38. 90
      dist/common/utils.js
  39. 11
      dist/common/validator.d.ts
  40. 31
      dist/common/validator.js
  41. 7
      dist/common/version.d.ts
  42. 48
      dist/common/version.js
  43. 1
      dist/icon/index.d.ts
  44. 20
      dist/icon/index.js
  45. 6
      dist/icon/index.json
  46. 20
      dist/icon/index.wxml
  47. 39
      dist/icon/index.wxs
  48. 1
      dist/icon/index.wxss
  49. 1
      dist/info/index.d.ts
  50. 8
      dist/info/index.js
  51. 3
      dist/info/index.json
  52. 7
      dist/info/index.wxml
  53. 1
      dist/info/index.wxss
  54. 1
      dist/mixins/basic.d.ts
  55. 11
      dist/mixins/basic.js
  56. 1
      dist/mixins/button.d.ts
  57. 41
      dist/mixins/button.js
  58. 1
      dist/mixins/link.d.ts
  59. 24
      dist/mixins/link.js
  60. 8
      dist/mixins/page-scroll.d.ts
  61. 33
      dist/mixins/page-scroll.js
  62. 1
      dist/mixins/touch.d.ts
  63. 37
      dist/mixins/touch.js
  64. 1
      dist/mixins/transition.d.ts
  65. 115
      dist/mixins/transition.js
  66. 12
      dist/wxs/add-unit.wxs
  67. 5
      dist/wxs/array.wxs
  68. 39
      dist/wxs/bem.wxs
  69. 55
      dist/wxs/memoize.wxs
  70. 13
      dist/wxs/object.wxs
  71. 42
      dist/wxs/style.wxs
  72. 10
      dist/wxs/utils.wxs
  73. BIN
      images/agreement1.png
  74. BIN
      images/agreement2.png
  75. BIN
      images/agreement3.png
  76. BIN
      images/arrow-r.png
  77. BIN
      images/back.png
  78. BIN
      images/icon-bg.png
  79. BIN
      images/income-bg.png
  80. BIN
      images/logo.png
  81. BIN
      images/mail-b.png
  82. BIN
      images/mail-c.png
  83. BIN
      images/mail-t.png
  84. BIN
      images/menu1.png
  85. BIN
      images/menu2.png
  86. BIN
      images/menu3.png
  87. BIN
      images/menu4.png
  88. BIN
      images/menu5.png
  89. BIN
      images/menu6.png
  90. BIN
      images/menu7.png
  91. BIN
      images/menu8.png
  92. BIN
      images/menu9.png
  93. BIN
      images/no1-bg.png
  94. BIN
      images/no1.png
  95. BIN
      images/no2-bg.png
  96. BIN
      images/no2.png
  97. BIN
      images/no3-bg.png
  98. BIN
      images/no3.png
  99. BIN
      images/pay-btn.png
  100. BIN
      images/pay1.png
  101. Some files were not shown because too many files have changed in this diff Show More

137
app.js

@ -0,0 +1,137 @@
//app.js
App({
onLaunch: function (e) {
var that = this;
//获取设备信息
this.setMenuHeight()
},
onShow(e){
var query = {};
if(e.query.q){
//通过扫码进来获取二维码上的参数并存入storage
let urlSpread = e.query.q;
if (urlSpread) {
if (urlSpread.indexOf('%3F') != -1) {
// 通过扫桌面二维码进来
urlSpread = urlSpread.split("%3F")[1].replace(/%3D/g, ":").replace(/%26/g, ",").split(",").map((item, index) => {
item = item.split(":");
return `"${item[0]}":"${item[1]}"`;
}).join(",");
query = JSON.parse("{" + urlSpread + "}");
}
console.log('query1',query)
this.globalData.inviterId = query.id
}
} else{
query = e.query
console.log('query2',query)
this.globalData.inviterId = query.id
}
},
setMenuHeight(){
wx.getSystemInfo({
success: res => {
// console.log(res)
this.globalData.navTopHeight = res.statusBarHeight;
this.globalData.CustomBar = res.statusBarHeight + 45;
}
});
let menuButtonObj = wx.getMenuButtonBoundingClientRect();
this.globalData.menuTop = menuButtonObj.top;
// console.log(menuButtonObj)
this.globalData.menuHeight = menuButtonObj.height;
this.globalData.navHeight = menuButtonObj.height + (menuButtonObj.top - this.globalData.navTopHeight);
},
getToken(){
// console.log('getToken')
var tokentime = wx.getStorageSync('tokentime') || '';//过期时间
var timestamp = Date.parse(new Date());// 当前时间
var expiration = timestamp + 60000 * 60 * 12; //缓存12小时
var token = wx.getStorageSync('token') || '';
this.login(expiration);
},
login(expiration){
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
// console.log('code:',res.code)
this.http('GET','wechat/auth',{code : res.code,spread:0,login_type:0}).then(
response =>{
if(response.data.isSuccess){
wx.setStorageSync('token', 'Bearer '+ response.data.data.token);
wx.setStorageSync('uid', response.data.data.userId);
wx.setStorageSync('tokentime', expiration);
} else{
wx.showToast({
title: response.data.msg,
icon : 'none'
})
}
}
)
}
})
},
getInfo(){
this.http('get','userinfo').then((res)=>{
if(res.data.success){
wx.setStorageSync('userInfo',res.data.data)
var pages = getCurrentPages().pop();//当前页面
if (pages.getUser){
pages.getUser();
}
}
})
},
http(mathods,url, params) {
var that = this;
var header = {
'content-type': 'application/json',
'Authorization' : wx.getStorageSync('token') || ''
}
return new Promise(
(resolve,reject) => {
wx.showLoading({
title: "正在加载中...",
})
wx.request({
url: this.globalData.baseURL + url, //请求地址
method: mathods, //请求方法
header: header,
data: params || {}, //请求参数
success: res => {
wx.hideLoading();
//判断token是否过期 res.data.code == 40001
if(!res.data.isSuccess && res.data.code == 40001){
console.log('token过期')
that.getToken()
}
resolve(res);
//成功执行方法,参数值为res.data,直接将返回的数据传入
},
fail: function() {
//请求失败
wx.hideLoading();
wx.showToast({
title: '服务器错误,请稍后再试!',
icon : 'none'
})
reject(err)
},
})
}
)
},
globalData: {
// baseURL : 'http://192.168.0.114:8092/api/',
baseURL : 'https://www.cyjyyjy.com:8093/api/',
userInfo: null,
navHeight : 0,
navTopHeight: 0,
menuTop: 0,
menuHeight: 0,
CustomBar: 0,
inviterId: null , //分享码
}
})

20
app.json

@ -0,0 +1,20 @@
{
"pages":[
"pages/user/agreement/index",
"pages/user/index",
"pages/user/incomeDetail/index",
"pages/user/profession/index",
"pages/index/index",
"pages/user/completeData/index",
"pages/user/personalData/index",
"pages/user/industry/index"
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#212226",
"navigationBarTitleText": "禅易云生态",
"navigationBarTextStyle":"white"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

95
app.wxss

@ -0,0 +1,95 @@
/**app.wxss**/
view,
scroll-view,
swiper,
button,
input,
textarea,
label,
navigator,
image {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
/* layout */
.acea-row-nowrap {
display: flex;
/* 辅助类 */
}
.acea-row {
display: flex;
flex-wrap: wrap;
/* 辅助类 */
}
.acea-row.row-middle,.acea-row-nowrap.row-middle{
align-items: center;
}
.acea-row.row-top,.acea-row-nowrap.row-top {
align-items: flex-start;
}
.acea-row.row-bottom {
align-items: flex-end;
}
.acea-row.row-center,.acea-row-nowrap.row-center {
justify-content: center;
}
.acea-row.row-right,.acea-row-nowrap.row-right {
justify-content: flex-end;
}
.acea-row.row-left,.acea-row-nowrap.row-left {
justify-content: flex-start;
}
.acea-row.row-between,.acea-row-nowrap.row-between {
justify-content: space-between;
}
.acea-row.row-around, .acea-row-nowrap.row-around{
justify-content: space-around;
}
.acea-row.row-column-around,.acea-row-nowrap.row-column-around {
flex-direction: column;
justify-content: space-around;
}
.acea-row.row-column {
flex-direction: column;
}
.acea-row.row-column-between,.acea-row-nowrap.row-column-between {
flex-direction: column;
justify-content: space-between;
}
/* 上下左右垂直居中 */
.acea-row.row-center-wrapper,.acea-row-nowrap.row-center-wrapper {
align-items: center;
justify-content: center;
}
/* 上下两边居中对齐 */
.acea-row.row-between-wrapper,.acea-row-nowrap.row-between-wrapper {
align-items: center;
justify-content: space-between;
}
.line1{
overflow:hidden;
text-overflow:ellipsis;
white-space:nowrap;
width: 100%;
}
.line2{
word-break:break-all;
display:-webkit-box;
-webkit-line-clamp:2;
-webkit-box-orient:vertical;
overflow:hidden;
}
.back-btn{
width: 36rpx;
height: 36rpx;
position: fixed;
left: 40rpx;
text-align: center;
line-height: 36rpx;
z-index: 99;
}
.back-btn image{
width: 100%;
height: 100%;
}

1
dist/cell/index.d.ts vendored

@ -0,0 +1 @@
export {};

38
dist/cell/index.js vendored

@ -0,0 +1,38 @@
import { link } from '../mixins/link';
import { VantComponent } from '../common/component';
VantComponent({
classes: [
'title-class',
'label-class',
'value-class',
'right-icon-class',
'hover-class',
],
mixins: [link],
props: {
title: null,
value: null,
icon: String,
size: String,
label: String,
center: Boolean,
isLink: Boolean,
required: Boolean,
clickable: Boolean,
titleWidth: String,
customStyle: String,
arrowDirection: String,
useLabelSlot: Boolean,
border: {
type: Boolean,
value: true,
},
titleStyle: String,
},
methods: {
onClick(event) {
this.$emit('click', event.detail);
this.jumpLink();
},
},
});

6
dist/cell/index.json vendored

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

47
dist/cell/index.wxml vendored

@ -0,0 +1,47 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<view
class="custom-class {{ utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]) }}"
hover-class="van-cell--hover hover-class"
hover-stay-time="70"
style="{{ customStyle }}"
bind:tap="onClick"
>
<van-icon
wx:if="{{ icon }}"
name="{{ icon }}"
class="van-cell__left-icon-wrap"
custom-class="van-cell__left-icon"
/>
<slot wx:else name="icon" />
<view
style="{{ computed.titleStyle({ titleWidth, titleStyle }) }}"
class="van-cell__title title-class"
>
<block wx:if="{{ title }}">{{ title }}</block>
<slot wx:else name="title" />
<view wx:if="{{ label || useLabelSlot }}" class="van-cell__label label-class">
<slot wx:if="{{ useLabelSlot }}" name="label" />
<block wx:elif="{{ label }}">{{ label }}</block>
</view>
</view>
<view class="van-cell__value value-class">
<block wx:if="{{ value || value === 0 }}">{{ value }}</block>
<slot wx:else />
</view>
<van-icon
wx:if="{{ isLink }}"
name="{{ arrowDirection ? 'arrow' + '-' + arrowDirection : 'arrow' }}"
class="van-cell__right-icon-wrap right-icon-class"
custom-class="van-cell__right-icon"
/>
<slot wx:else name="right-icon" />
<slot name="extra" />
</view>

17
dist/cell/index.wxs vendored

@ -0,0 +1,17 @@
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function titleStyle(data) {
return style([
{
'max-width': addUnit(data.titleWidth),
'min-width': addUnit(data.titleWidth),
},
data.titleStyle,
]);
}
module.exports = {
titleStyle: titleStyle,
};

1
dist/cell/index.wxss vendored

@ -0,0 +1 @@
@import '../common/index.wxss';.van-cell{position:relative;display:-webkit-flex;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{-webkit-flex:1;flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:4px;margin-right:var(--padding-base,4px)}.van-cell__right-icon-wrap{margin-left:4px;margin-left:var(--padding-base,4px);color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{-webkit-align-items:center;align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)}

6
dist/collapse-item/animate.d.ts vendored

@ -0,0 +1,6 @@
/// <reference types="miniprogram-api-typings" />
export declare function setContentAnimate(
context: WechatMiniprogram.Component.TrivialInstance,
expanded: boolean,
mounted: boolean
): void;

70
dist/collapse-item/animate.js vendored

@ -0,0 +1,70 @@
import { canIUseAnimate } from '../common/version';
import { getRect } from '../common/utils';
function useAnimate(context, expanded, mounted, height) {
const selector = '.van-collapse-item__wrapper';
if (expanded) {
context.animate(
selector,
[
{ height: 0, ease: 'ease-in-out', offset: 0 },
{ height: `${height}px`, ease: 'ease-in-out', offset: 1 },
{ height: `auto`, ease: 'ease-in-out', offset: 1 },
],
mounted ? 300 : 0,
() => {
context.clearAnimation(selector);
}
);
return;
}
context.animate(
selector,
[
{ height: `${height}px`, ease: 'ease-in-out', offset: 0 },
{ height: 0, ease: 'ease-in-out', offset: 1 },
],
300,
() => {
context.clearAnimation(selector);
}
);
}
function useAnimation(context, expanded, mounted, height) {
const animation = wx.createAnimation({
duration: 0,
timingFunction: 'ease-in-out',
});
if (expanded) {
if (height === 0) {
animation.height('auto').top(1).step();
} else {
animation
.height(height)
.top(1)
.step({
duration: mounted ? 300 : 1,
})
.height('auto')
.step();
}
context.setData({
animation: animation.export(),
});
return;
}
animation.height(height).top(0).step({ duration: 1 }).height(0).step({
duration: 300,
});
context.setData({
animation: animation.export(),
});
}
export function setContentAnimate(context, expanded, mounted) {
getRect(context, '.van-collapse-item__content')
.then((rect) => rect.height)
.then((height) => {
canIUseAnimate()
? useAnimate(context, expanded, mounted, height)
: useAnimation(context, expanded, mounted, height);
});
}

1
dist/collapse-item/index.d.ts vendored

@ -0,0 +1 @@
export {};

59
dist/collapse-item/index.js vendored

@ -0,0 +1,59 @@
import { VantComponent } from '../common/component';
import { useParent } from '../common/relation';
import { setContentAnimate } from './animate';
VantComponent({
classes: ['title-class', 'content-class'],
relation: useParent('collapse'),
props: {
name: null,
title: null,
value: null,
icon: String,
label: String,
disabled: Boolean,
clickable: Boolean,
border: {
type: Boolean,
value: true,
},
isLink: {
type: Boolean,
value: true,
},
},
data: {
expanded: false,
},
mounted() {
this.updateExpanded();
this.mounted = true;
},
methods: {
updateExpanded() {
if (!this.parent) {
return;
}
const { value, accordion } = this.parent.data;
const { children = [] } = this.parent;
const { name } = this.data;
const index = children.indexOf(this);
const currentName = name == null ? index : name;
const expanded = accordion
? value === currentName
: (value || []).some((name) => name === currentName);
if (expanded !== this.data.expanded) {
setContentAnimate(this, expanded, this.mounted);
}
this.setData({ index, expanded });
},
onClick() {
if (this.data.disabled) {
return;
}
const { name, expanded } = this.data;
const index = this.parent.children.indexOf(this);
const currentName = name == null ? index : name;
this.parent.switch(currentName, !expanded);
},
},
});

6
dist/collapse-item/index.json vendored

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

44
dist/collapse-item/index.wxml vendored

@ -0,0 +1,44 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="van-collapse-item custom-class {{ index !== 0 ? 'van-hairline--top' : '' }}">
<van-cell
title="{{ title }}"
title-class="title-class"
icon="{{ icon }}"
value="{{ value }}"
label="{{ label }}"
is-link="{{ isLink }}"
clickable="{{ clickable }}"
border="{{ border && expanded }}"
class="{{ utils.bem('collapse-item__title', { disabled, expanded }) }}"
right-icon-class="van-cell__right-icon"
custom-class="van-cell"
hover-class="van-cell--hover"
bind:click="onClick"
>
<slot
name="title"
slot="title"
/>
<slot
name="icon"
slot="icon"
/>
<slot name="value" />
<slot
name="right-icon"
slot="right-icon"
/>
</van-cell>
<view
class="{{ utils.bem('collapse-item__wrapper') }}"
style="height: 0;"
animation="{{ animation }}"
>
<view
class="van-collapse-item__content content-class"
>
<slot />
</view>
</view>
</view>

1
dist/collapse-item/index.wxss vendored

@ -0,0 +1 @@
@import '../common/index.wxss';.van-collapse-item__title .van-cell__right-icon{-webkit-transform:rotate(90deg);transform:rotate(90deg);transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s;transition:-webkit-transform var(--collapse-item-transition-duration,.3s);transition:transform var(--collapse-item-transition-duration,.3s);transition:transform var(--collapse-item-transition-duration,.3s),-webkit-transform var(--collapse-item-transition-duration,.3s)}.van-collapse-item__title--expanded .van-cell__right-icon{-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.van-collapse-item__title--disabled .van-cell,.van-collapse-item__title--disabled .van-cell__right-icon{color:#c8c9cc!important;color:var(--collapse-item-title-disabled-color,#c8c9cc)!important}.van-collapse-item__title--disabled .van-cell--hover{background-color:#fff!important;background-color:var(--white,#fff)!important}.van-collapse-item__wrapper{overflow:hidden}.van-collapse-item__content{padding:15px;padding:var(--collapse-item-content-padding,15px);color:#969799;color:var(--collapse-item-content-text-color,#969799);font-size:13px;font-size:var(--collapse-item-content-font-size,13px);line-height:1.5;line-height:var(--collapse-item-content-line-height,1.5);background-color:#fff;background-color:var(--collapse-item-content-background-color,#fff)}

1
dist/collapse/index.d.ts vendored

@ -0,0 +1 @@
export {};

44
dist/collapse/index.js vendored

@ -0,0 +1,44 @@
import { VantComponent } from '../common/component';
import { useChildren } from '../common/relation';
VantComponent({
relation: useChildren('collapse-item'),
props: {
value: {
type: null,
observer: 'updateExpanded',
},
accordion: {
type: Boolean,
observer: 'updateExpanded',
},
border: {
type: Boolean,
value: true,
},
},
methods: {
updateExpanded() {
this.children.forEach((child) => {
child.updateExpanded();
});
},
switch(name, expanded) {
const { accordion, value } = this.data;
const changeItem = name;
if (!accordion) {
name = expanded
? (value || []).concat(name)
: (value || []).filter((activeName) => activeName !== name);
} else {
name = expanded ? name : '';
}
if (expanded) {
this.$emit('open', changeItem);
} else {
this.$emit('close', changeItem);
}
this.$emit('change', name);
this.$emit('input', name);
},
},
});

3
dist/collapse/index.json vendored

@ -0,0 +1,3 @@
{
"component": true
}

3
dist/collapse/index.wxml vendored

@ -0,0 +1,3 @@
<view class="custom-class van-collapse {{ border ? 'van-hairline--top-bottom' : '' }}">
<slot />
</view>

1
dist/collapse/index.wxss vendored

@ -0,0 +1 @@
@import '../common/index.wxss';

7
dist/common/color.d.ts vendored

@ -0,0 +1,7 @@
export declare const RED = "#ee0a24";
export declare const BLUE = "#1989fa";
export declare const WHITE = "#fff";
export declare const GREEN = "#07c160";
export declare const ORANGE = "#ff976a";
export declare const GRAY = "#323233";
export declare const GRAY_DARK = "#969799";

7
dist/common/color.js vendored

@ -0,0 +1,7 @@
export const RED = '#ee0a24';
export const BLUE = '#1989fa';
export const WHITE = '#fff';
export const GREEN = '#07c160';
export const ORANGE = '#ff976a';
export const GRAY = '#323233';
export const GRAY_DARK = '#969799';

8
dist/common/component.d.ts vendored

@ -0,0 +1,8 @@
/// <reference types="miniprogram-api-typings" />
import { VantComponentOptions } from '../definitions/index';
declare function VantComponent<
Data extends WechatMiniprogram.Component.DataOption,
Props extends WechatMiniprogram.Component.PropertyOption,
Methods extends WechatMiniprogram.Component.MethodOption
>(vantOptions: VantComponentOptions<Data, Props, Methods>): void;
export { VantComponent };

45
dist/common/component.js vendored

@ -0,0 +1,45 @@
import { basic } from '../mixins/basic';
function mapKeys(source, target, map) {
Object.keys(map).forEach((key) => {
if (source[key]) {
target[map[key]] = source[key];
}
});
}
function VantComponent(vantOptions) {
const options = {};
mapKeys(vantOptions, options, {
data: 'data',
props: 'properties',
mixins: 'behaviors',
methods: 'methods',
beforeCreate: 'created',
created: 'attached',
mounted: 'ready',
destroyed: 'detached',
classes: 'externalClasses',
});
// add default externalClasses
options.externalClasses = options.externalClasses || [];
options.externalClasses.push('custom-class');
// add default behaviors
options.behaviors = options.behaviors || [];
options.behaviors.push(basic);
// add relations
const { relation } = vantOptions;
if (relation) {
options.relations = relation.relations;
options.behaviors.push(relation.mixin);
}
// map field to form-field behavior
if (vantOptions.field) {
options.behaviors.push('wx://form-field');
}
// add default options
options.options = {
multipleSlots: true,
addGlobalClass: true,
};
Component(options);
}
export { VantComponent };

1
dist/common/index.wxss vendored

@ -0,0 +1 @@
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{display:table;clear:both;content:""}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}

21
dist/common/relation.d.ts vendored

@ -0,0 +1,21 @@
/// <reference types="miniprogram-api-typings" />
declare type TrivialInstance = WechatMiniprogram.Component.TrivialInstance;
export declare function useParent(
name: string,
onEffect?: (this: TrivialInstance) => void
): {
relations: {
[x: string]: WechatMiniprogram.Component.RelationOption;
};
mixin: string;
};
export declare function useChildren(
name: string,
onEffect?: (this: TrivialInstance, target: TrivialInstance) => void
): {
relations: {
[x: string]: WechatMiniprogram.Component.RelationOption;
};
mixin: string;
};
export {};

64
dist/common/relation.js vendored

@ -0,0 +1,64 @@
export function useParent(name, onEffect) {
const path = `../${name}/index`;
return {
relations: {
[path]: {
type: 'ancestor',
linked() {
onEffect && onEffect.call(this);
},
linkChanged() {
onEffect && onEffect.call(this);
},
unlinked() {
onEffect && onEffect.call(this);
},
},
},
mixin: Behavior({
created() {
Object.defineProperty(this, 'parent', {
get: () => this.getRelationNodes(path)[0],
});
Object.defineProperty(this, 'index', {
// @ts-ignore
get: () => {
var _a, _b;
return (_b =
(_a = this.parent) === null || _a === void 0
? void 0
: _a.children) === null || _b === void 0
? void 0
: _b.indexOf(this);
},
});
},
}),
};
}
export function useChildren(name, onEffect) {
const path = `../${name}/index`;
return {
relations: {
[path]: {
type: 'descendant',
linked(target) {
onEffect && onEffect.call(this, target);
},
linkChanged(target) {
onEffect && onEffect.call(this, target);
},
unlinked(target) {
onEffect && onEffect.call(this, target);
},
},
},
mixin: Behavior({
created() {
Object.defineProperty(this, 'children', {
get: () => this.getRelationNodes(path) || [],
});
},
}),
};
}

1
dist/common/style/clearfix.wxss vendored

@ -0,0 +1 @@
.van-clearfix:after{display:table;clear:both;content:""}

1
dist/common/style/ellipsis.wxss vendored

@ -0,0 +1 @@
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}

1
dist/common/style/hairline.wxss vendored

@ -0,0 +1 @@
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #ebedf0;-webkit-transform:scale(.5);transform:scale(.5)}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}

0
dist/common/style/mixins/clearfix.wxss vendored

0
dist/common/style/mixins/ellipsis.wxss vendored

0
dist/common/style/mixins/hairline.wxss vendored

0
dist/common/style/theme.wxss vendored

0
dist/common/style/var.wxss vendored

31
dist/common/utils.d.ts vendored

@ -0,0 +1,31 @@
/// <reference types="miniprogram-api-typings" />
export { isDef } from './validator';
export declare function range(num: number, min: number, max: number): number;
export declare function nextTick(cb: (...args: any[]) => void): void;
export declare function getSystemInfoSync(): WechatMiniprogram.SystemInfo;
export declare function addUnit(value?: string | number): string | undefined;
export declare function requestAnimationFrame(
cb: () => void
): number | WechatMiniprogram.NodesRef;
export declare function pickExclude(obj: unknown, keys: string[]): {};
export declare function getRect(
context: WechatMiniprogram.Component.TrivialInstance,
selector: string
): Promise<WechatMiniprogram.BoundingClientRectCallbackResult>;
export declare function getAllRect(
context: WechatMiniprogram.Component.TrivialInstance,
selector: string
): Promise<WechatMiniprogram.BoundingClientRectCallbackResult[]>;
export declare function groupSetData(
context: WechatMiniprogram.Component.TrivialInstance,
cb: () => void
): void;
export declare function toPromise(
promiseLike: Promise<unknown> | unknown
): Promise<unknown>;
export declare function getCurrentPage<T>(): T &
WechatMiniprogram.OptionalInterface<WechatMiniprogram.Page.ILifetime> &
WechatMiniprogram.Page.InstanceProperties &
WechatMiniprogram.Page.InstanceMethods<WechatMiniprogram.IAnyObject> &
WechatMiniprogram.Page.Data<WechatMiniprogram.IAnyObject> &
WechatMiniprogram.IAnyObject;

90
dist/common/utils.js vendored

@ -0,0 +1,90 @@
import { isDef, isNumber, isPlainObject, isPromise } from './validator';
import { canIUseGroupSetData, canIUseNextTick } from './version';
export { isDef } from './validator';
export function range(num, min, max) {
return Math.min(Math.max(num, min), max);
}
export function nextTick(cb) {
if (canIUseNextTick()) {
wx.nextTick(cb);
} else {
setTimeout(() => {
cb();
}, 1000 / 30);
}
}
let systemInfo;
export function getSystemInfoSync() {
if (systemInfo == null) {
systemInfo = wx.getSystemInfoSync();
}
return systemInfo;
}
export function addUnit(value) {
if (!isDef(value)) {
return undefined;
}
value = String(value);
return isNumber(value) ? `${value}px` : value;
}
export function requestAnimationFrame(cb) {
const systemInfo = getSystemInfoSync();
if (systemInfo.platform === 'devtools') {
return setTimeout(() => {
cb();
}, 1000 / 30);
}
return wx
.createSelectorQuery()
.selectViewport()
.boundingClientRect()
.exec(() => {
cb();
});
}
export function pickExclude(obj, keys) {
if (!isPlainObject(obj)) {
return {};
}
return Object.keys(obj).reduce((prev, key) => {
if (!keys.includes(key)) {
prev[key] = obj[key];
}
return prev;
}, {});
}
export function getRect(context, selector) {
return new Promise((resolve) => {
wx.createSelectorQuery()
.in(context)
.select(selector)
.boundingClientRect()
.exec((rect = []) => resolve(rect[0]));
});
}
export function getAllRect(context, selector) {
return new Promise((resolve) => {
wx.createSelectorQuery()
.in(context)
.selectAll(selector)
.boundingClientRect()
.exec((rect = []) => resolve(rect[0]));
});
}
export function groupSetData(context, cb) {
if (canIUseGroupSetData()) {
context.groupSetData(cb);
} else {
cb();
}
}
export function toPromise(promiseLike) {
if (isPromise(promiseLike)) {
return promiseLike;
}
return Promise.resolve(promiseLike);
}
export function getCurrentPage() {
const pages = getCurrentPages();
return pages[pages.length - 1];
}

11
dist/common/validator.d.ts vendored

@ -0,0 +1,11 @@
export declare function isFunction(val: unknown): val is Function;
export declare function isPlainObject(
val: unknown
): val is Record<string, unknown>;
export declare function isPromise<T = unknown>(val: unknown): val is Promise<T>;
export declare function isDef(value: unknown): boolean;
export declare function isObj(x: unknown): x is Record<string, unknown>;
export declare function isNumber(value: string): boolean;
export declare function isBoolean(value: unknown): value is boolean;
export declare function isImageUrl(url: string): boolean;
export declare function isVideoUrl(url: string): boolean;

31
dist/common/validator.js vendored

@ -0,0 +1,31 @@
// eslint-disable-next-line @typescript-eslint/ban-types
export function isFunction(val) {
return typeof val === 'function';
}
export function isPlainObject(val) {
return val !== null && typeof val === 'object' && !Array.isArray(val);
}
export function isPromise(val) {
return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch);
}
export function isDef(value) {
return value !== undefined && value !== null;
}
export function isObj(x) {
const type = typeof x;
return x !== null && (type === 'object' || type === 'function');
}
export function isNumber(value) {
return /^\d+(\.\d+)?$/.test(value);
}
export function isBoolean(value) {
return typeof value === 'boolean';
}
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i;
export function isImageUrl(url) {
return IMAGE_REGEXP.test(url);
}
export function isVideoUrl(url) {
return VIDEO_REGEXP.test(url);
}

7
dist/common/version.d.ts vendored

@ -0,0 +1,7 @@
export declare function canIUseModel(): boolean;
export declare function canIUseFormFieldButton(): boolean;
export declare function canIUseAnimate(): boolean;
export declare function canIUseGroupSetData(): boolean;
export declare function canIUseNextTick(): boolean;
export declare function canIUseCanvas2d(): boolean;
export declare function canIUseGetUserProfile(): boolean;

48
dist/common/version.js vendored

@ -0,0 +1,48 @@
import { getSystemInfoSync } from './utils';
function compareVersion(v1, v2) {
v1 = v1.split('.');
v2 = v2.split('.');
const len = Math.max(v1.length, v2.length);
while (v1.length < len) {
v1.push('0');
}
while (v2.length < len) {
v2.push('0');
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i], 10);
const num2 = parseInt(v2[i], 10);
if (num1 > num2) {
return 1;
}
if (num1 < num2) {
return -1;
}
}
return 0;
}
function gte(version) {
const system = getSystemInfoSync();
return compareVersion(system.SDKVersion, version) >= 0;
}
export function canIUseModel() {
return gte('2.9.3');
}
export function canIUseFormFieldButton() {
return gte('2.10.3');
}
export function canIUseAnimate() {
return gte('2.9.0');
}
export function canIUseGroupSetData() {
return gte('2.4.0');
}
export function canIUseNextTick() {
return wx.canIUse('nextTick');
}
export function canIUseCanvas2d() {
return gte('2.9.0');
}
export function canIUseGetUserProfile() {
return !!wx.getUserProfile;
}

1
dist/icon/index.d.ts vendored

@ -0,0 +1 @@
export {};

20
dist/icon/index.js vendored

@ -0,0 +1,20 @@
import { VantComponent } from '../common/component';
VantComponent({
props: {
dot: Boolean,
info: null,
size: null,
color: String,
customStyle: String,
classPrefix: {
type: String,
value: 'van-icon',
},
name: String,
},
methods: {
onClick() {
this.$emit('click');
},
},
});

6
dist/icon/index.json vendored

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

20
dist/icon/index.wxml vendored

@ -0,0 +1,20 @@
<wxs src="./index.wxs" module="computed" />
<view
class="{{ computed.rootClass({ classPrefix, name }) }}"
style="{{ computed.rootStyle({ customStyle, color, size }) }}"
bindtap="onClick"
>
<van-info
wx:if="{{ info !== null || dot }}"
dot="{{ dot }}"
info="{{ info }}"
custom-class="van-icon__info"
/>
<image
wx:if="{{ computed.isImage(name) }}"
src="{{ name }}"
mode="aspectFit"
class="van-icon__image"
/>
</view>

39
dist/icon/index.wxs vendored

@ -0,0 +1,39 @@
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function isImage(name) {
return name.indexOf('/') !== -1;
}
function rootClass(data) {
var classes = ['custom-class'];
if (data.classPrefix != null) {
classes.push(data.classPrefix);
}
if (isImage(data.name)) {
classes.push('van-icon--image');
} else if (data.classPrefix != null) {
classes.push(data.classPrefix + '-' + data.name);
}
return classes.join(' ');
}
function rootStyle(data) {
return style([
{
color: data.color,
'font-size': addUnit(data.size),
},
data.customStyle,
]);
}
module.exports = {
isImage: isImage,
rootClass: rootClass,
rootStyle: rootStyle,
};

1
dist/icon/index.wxss vendored

File diff suppressed because one or more lines are too long

1
dist/info/index.d.ts vendored

@ -0,0 +1 @@
export {};

8
dist/info/index.js vendored

@ -0,0 +1,8 @@
import { VantComponent } from '../common/component';
VantComponent({
props: {
dot: Boolean,
info: null,
customStyle: String,
},
});

3
dist/info/index.json vendored

@ -0,0 +1,3 @@
{
"component": true
}

7
dist/info/index.wxml vendored

@ -0,0 +1,7 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view
wx:if="{{ info !== null && info !== '' || dot }}"
class="van-info {{ utils.bem('info', { dot }) }} custom-class"
style="{{ customStyle }}"
>{{ dot ? '' : info }}</view>

1
dist/info/index.wxss vendored

@ -0,0 +1 @@
@import '../common/index.wxss';.van-info{position:absolute;top:0;right:0;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;white-space:nowrap;-webkit-transform:translate(50%,-50%);transform:translate(50%,-50%);-webkit-transform-origin:100%;transform-origin:100%;height:16px;height:var(--info-size,16px);min-width:16px;min-width:var(--info-size,16px);padding:0 3px;padding:var(--info-padding,0 3px);color:#fff;color:var(--info-color,#fff);font-weight:500;font-weight:var(--info-font-weight,500);font-size:12px;font-size:var(--info-font-size,12px);font-family:-apple-system-font,Helvetica Neue,Arial,sans-serif;font-family:var(--info-font-family,-apple-system-font,Helvetica Neue,Arial,sans-serif);background-color:#ee0a24;background-color:var(--info-background-color,#ee0a24);border:1px solid #fff;border:var(--info-border-width,1px) solid var(--white,#fff);border-radius:16px;border-radius:var(--info-size,16px)}.van-info--dot{min-width:0;border-radius:100%;width:8px;width:var(--info-dot-size,8px);height:8px;height:var(--info-dot-size,8px);background-color:#ee0a24;background-color:var(--info-dot-color,#ee0a24)}

1
dist/mixins/basic.d.ts vendored

@ -0,0 +1 @@
export declare const basic: string;

11
dist/mixins/basic.js vendored

@ -0,0 +1,11 @@
export const basic = Behavior({
methods: {
$emit(name, detail, options) {
this.triggerEvent(name, detail, options);
},
set(data) {
this.setData(data);
return new Promise((resolve) => wx.nextTick(resolve));
},
},
});

1
dist/mixins/button.d.ts vendored

@ -0,0 +1 @@
export declare const button: string;

41
dist/mixins/button.js vendored

@ -0,0 +1,41 @@
import { canIUseGetUserProfile } from '../common/version';
export const 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: canIUseGetUserProfile(),
},
methods: {
onGetUserInfo(event) {
this.triggerEvent('getuserinfo', event.detail);
},
onContact(event) {
this.triggerEvent('contact', event.detail);
},
onGetPhoneNumber(event) {
this.triggerEvent('getphonenumber', event.detail);
},
onError(event) {
this.triggerEvent('error', event.detail);
},
onLaunchApp(event) {
this.triggerEvent('launchapp', event.detail);
},
onOpenSetting(event) {
this.triggerEvent('opensetting', event.detail);
},
},
});

1
dist/mixins/link.d.ts vendored

@ -0,0 +1 @@
export declare const link: string;

24
dist/mixins/link.js vendored

@ -0,0 +1,24 @@
export const link = Behavior({
properties: {
url: String,
linkType: {
type: String,
value: 'navigateTo',
},
},
methods: {
jumpLink(urlKey = 'url') {
const url = this.data[urlKey];
if (url) {
if (
this.data.linkType === 'navigateTo' &&
getCurrentPages().length > 9
) {
wx.redirectTo({ url });
} else {
wx[this.data.linkType]({ url });
}
}
},
},
});

8
dist/mixins/page-scroll.d.ts vendored

@ -0,0 +1,8 @@
/// <reference types="miniprogram-api-typings" />
declare type IPageScrollOption = WechatMiniprogram.Page.IPageScrollOption;
declare type Scroller = (
this: WechatMiniprogram.Component.TrivialInstance,
event?: IPageScrollOption
) => void;
export declare const pageScrollMixin: (scroller: Scroller) => string;
export {};

33
dist/mixins/page-scroll.js vendored

@ -0,0 +1,33 @@
import { getCurrentPage } from '../common/utils';
function onPageScroll(event) {
const { vanPageScroller = [] } = getCurrentPage();
vanPageScroller.forEach((scroller) => {
if (typeof scroller === 'function') {
// @ts-ignore
scroller(event);
}
});
}
export const pageScrollMixin = (scroller) =>
Behavior({
attached() {
const page = 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() {
var _a;
const page = getCurrentPage();
page.vanPageScroller =
((_a = page.vanPageScroller) === null || _a === void 0
? void 0
: _a.filter((item) => item !== scroller)) || [];
},
});

1
dist/mixins/touch.d.ts vendored

@ -0,0 +1 @@
export declare const touch: string;

37
dist/mixins/touch.js vendored

@ -0,0 +1,37 @@
// @ts-nocheck
const MIN_DISTANCE = 10;
function getDirection(x, y) {
if (x > y && x > MIN_DISTANCE) {
return 'horizontal';
}
if (y > x && y > MIN_DISTANCE) {
return 'vertical';
}
return '';
}
export const touch = Behavior({
methods: {
resetTouchStatus() {
this.direction = '';
this.deltaX = 0;
this.deltaY = 0;
this.offsetX = 0;
this.offsetY = 0;
},
touchStart(event) {
this.resetTouchStatus();
const touch = event.touches[0];
this.startX = touch.clientX;
this.startY = touch.clientY;
},
touchMove(event) {
const 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);
},
},
});

1
dist/mixins/transition.d.ts vendored

@ -0,0 +1 @@
export declare function transition(showDefaultValue: boolean): string;

115
dist/mixins/transition.js vendored

@ -0,0 +1,115 @@
// @ts-nocheck
import { requestAnimationFrame } from '../common/utils';
import { isObj } from '../common/validator';
const getClassNames = (name) => ({
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`,
});
export 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() {
if (this.data.show === true) {
this.observeShow(true, false);
}
},
methods: {
observeShow(value, old) {
if (value === old) {
return;
}
value ? this.enter() : this.leave();
},
enter() {
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.enter : duration;
this.status = 'enter';
this.$emit('before-enter');
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.$emit('enter');
this.setData({
inited: true,
display: true,
classes: classNames.enter,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'enter') {
return;
}
this.transitionEnded = false;
this.setData({ classes: classNames['enter-to'] });
});
});
},
leave() {
if (!this.data.display) {
return;
}
const { duration, name } = this.data;
const classNames = getClassNames(name);
const currentDuration = isObj(duration) ? duration.leave : duration;
this.status = 'leave';
this.$emit('before-leave');
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.$emit('leave');
this.setData({
classes: classNames.leave,
currentDuration,
});
requestAnimationFrame(() => {
if (this.status !== 'leave') {
return;
}
this.transitionEnded = false;
setTimeout(() => this.onTransitionEnd(), currentDuration);
this.setData({ classes: classNames['leave-to'] });
});
});
},
onTransitionEnd() {
if (this.transitionEnded) {
return;
}
this.transitionEnded = true;
this.$emit(`after-${this.status}`);
const { show, display } = this.data;
if (!show && display) {
this.setData({ display: false });
}
},
},
});
}

12
dist/wxs/add-unit.wxs vendored

@ -0,0 +1,12 @@
/* eslint-disable */
var REGEXP = getRegExp('^-?\d+(\.\d+)?$');
function addUnit(value) {
if (value == null) {
return undefined;
}
return REGEXP.test('' + value) ? value + 'px' : value;
}
module.exports = addUnit;

5
dist/wxs/array.wxs vendored

@ -0,0 +1,5 @@
function isArray(array) {
return array && array.constructor === 'Array';
}
module.exports.isArray = isArray;

39
dist/wxs/bem.wxs vendored

@ -0,0 +1,39 @@
/* eslint-disable */
var array = require('./array.wxs');
var object = require('./object.wxs');
var PREFIX = 'van-';
function join(name, mods) {
name = PREFIX + name;
mods = mods.map(function(mod) {
return name + '--' + mod;
});
mods.unshift(name);
return mods.join(' ');
}
function traversing(mods, conf) {
if (!conf) {
return;
}
if (typeof conf === 'string' || typeof conf === 'number') {
mods.push(conf);
} else if (array.isArray(conf)) {
conf.forEach(function(item) {
traversing(mods, item);
});
} else if (typeof conf === 'object') {
object.keys(conf).forEach(function(key) {
conf[key] && mods.push(key);
});
}
}
function bem(name, conf) {
var mods = [];
traversing(mods, conf);
return join(name, mods);
}
module.exports = bem;

55
dist/wxs/memoize.wxs vendored

@ -0,0 +1,55 @@
/**
* Simple memoize
* wxs doesn't support fn.apply, so this memoize only support up to 2 args
*/
/* eslint-disable */
function isPrimitive(value) {
var type = typeof value;
return (
type === 'boolean' ||
type === 'number' ||
type === 'string' ||
type === 'undefined' ||
value === null
);
}
// mock simple fn.call in wxs
function call(fn, args) {
if (args.length === 2) {
return fn(args[0], args[1]);
}
if (args.length === 1) {
return fn(args[0]);
}
return fn();
}
function serializer(args) {
if (args.length === 1 && isPrimitive(args[0])) {
return args[0];
}
var obj = {};
for (var i = 0; i < args.length; i++) {
obj['key' + i] = args[i];
}
return JSON.stringify(obj);
}
function memoize(fn) {
var cache = {};
return function() {
var key = serializer(arguments);
if (cache[key] === undefined) {
cache[key] = call(fn, arguments);
}
return cache[key];
};
}
module.exports = memoize;

13
dist/wxs/object.wxs vendored

@ -0,0 +1,13 @@
/* eslint-disable */
var REGEXP = getRegExp('{|}|"', 'g');
function keys(obj) {
return JSON.stringify(obj)
.replace(REGEXP, '')
.split(',')
.map(function(item) {
return item.split(':')[0];
});
}
module.exports.keys = keys;

42
dist/wxs/style.wxs vendored

@ -0,0 +1,42 @@
/* eslint-disable */
var object = require('./object.wxs');
var array = require('./array.wxs');
function kebabCase(word) {
var newWord = word
.replace(getRegExp("[A-Z]", 'g'), function (i) {
return '-' + i;
})
.toLowerCase()
return newWord;
}
function style(styles) {
if (array.isArray(styles)) {
return styles
.filter(function (item) {
return item != null && item !== '';
})
.map(function (item) {
return style(item);
})
.join(';');
}
if ('Object' === styles.constructor) {
return object
.keys(styles)
.filter(function (key) {
return styles[key] != null && styles[key] !== '';
})
.map(function (key) {
return [kebabCase(key), [styles[key]]].join(':');
})
.join(';');
}
return styles;
}
module.exports = style;

10
dist/wxs/utils.wxs vendored

@ -0,0 +1,10 @@
/* eslint-disable */
var bem = require('./bem.wxs');
var memoize = require('./memoize.wxs');
var addUnit = require('./add-unit.wxs');
module.exports = {
bem: memoize(bem),
memoize: memoize,
addUnit: addUnit
};

BIN
images/agreement1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

BIN
images/agreement2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
images/agreement3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
images/arrow-r.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

BIN
images/back.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

BIN
images/icon-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
images/income-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
images/logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

BIN
images/mail-b.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

BIN
images/mail-c.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
images/mail-t.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
images/menu1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
images/menu2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
images/menu3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
images/menu4.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
images/menu5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
images/menu6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
images/menu7.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
images/menu8.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
images/menu9.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
images/no1-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
images/no1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
images/no2-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
images/no2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
images/no3-bg.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
images/no3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
images/pay-btn.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
images/pay1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save