会员商品
This commit is contained in:
commit
1256593190
@ -33,6 +33,11 @@
|
||||
- orderconfirm/chooseway 选择方式
|
||||
- orderconfirm/ordershopinfo 顶部的商品信息
|
||||
- orderconfirm/orderyf 运费
|
||||
- pages/order/order 订单列表<br>
|
||||
组件
|
||||
- order/tab 切换列表
|
||||
- order/commodity 商品信息操作
|
||||
- order/message 商品信息
|
||||
|
||||
- pages/chooseaddr/chooseaddr 选择地址 <br>
|
||||
- chooseaddr/address 地址列表(单个)
|
||||
|
2
app.json
2
app.json
@ -3,6 +3,7 @@
|
||||
"pages/member/member",
|
||||
"pages/addaddress/addaddress",
|
||||
"pages/chooseaddr/chooseaddr",
|
||||
"pages/order/order",
|
||||
"pages/orderconfirm/orderconfirm",
|
||||
"pages/message/message",
|
||||
"pages/personal/personal",
|
||||
@ -20,4 +21,5 @@
|
||||
},
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json"
|
||||
|
||||
}
|
8
components/order/commodity/index.js
Normal file
8
components/order/commodity/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
Component({
|
||||
properties: {
|
||||
},
|
||||
data: {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
})
|
6
components/order/commodity/index.json
Normal file
6
components/order/commodity/index.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"message":"../message/index"
|
||||
}
|
||||
}
|
81
components/order/commodity/index.scss
Normal file
81
components/order/commodity/index.scss
Normal file
@ -0,0 +1,81 @@
|
||||
.commodity {
|
||||
margin-top: 20rpx;
|
||||
background-color: #fff;
|
||||
.message {
|
||||
padding: 35rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1rpx solid #F2F2F2;
|
||||
.image {
|
||||
width: 141rpx;
|
||||
height: 150rpx;
|
||||
background-color: #000;
|
||||
margin-left: 34rpx;
|
||||
}
|
||||
.introduce {
|
||||
margin-left: 32rpx;
|
||||
height: 120rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
width: 362rpx;
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
.count {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
display: flex;
|
||||
> view {
|
||||
margin-right: 27rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.parameter {
|
||||
width: 150rpx;
|
||||
height: 120rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
}
|
||||
}
|
||||
.aggregate{
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
padding: 30rpx;
|
||||
justify-content: flex-end;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
height: 78rpx;
|
||||
border-bottom: 1rpx solid #F2F2F2;
|
||||
|
||||
>text{
|
||||
color: #333;
|
||||
margin: 0 5rpx;
|
||||
}
|
||||
}
|
||||
.operation{
|
||||
height: 84rpx;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding:0 30rpx;
|
||||
align-items: center;
|
||||
.button{
|
||||
width: 133rpx;
|
||||
height: 51rpx;
|
||||
border:2rpx solid #999999;
|
||||
border-radius: 26rpx;
|
||||
text-align: center;
|
||||
font-size: 22rpx;
|
||||
color:#999999;
|
||||
line-height: 51rpx;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.hlight{
|
||||
border:2rpx solid rgba(71,200,119,1);
|
||||
color: #47C877;
|
||||
}
|
||||
}
|
||||
}
|
14
components/order/commodity/index.wxml
Normal file
14
components/order/commodity/index.wxml
Normal file
@ -0,0 +1,14 @@
|
||||
<view class="commodity">
|
||||
<message></message>
|
||||
<view class="aggregate">
|
||||
共计1件商品 合计:
|
||||
<text>¥29.80</text>
|
||||
(含运费¥0.00)
|
||||
</view>
|
||||
<view class="operation">
|
||||
<view class="button">评价</view>
|
||||
|
||||
<view class="button hlight">评价</view>
|
||||
|
||||
</view>
|
||||
</view>
|
1
components/order/commodity/index.wxss
Normal file
1
components/order/commodity/index.wxss
Normal file
@ -0,0 +1 @@
|
||||
.commodity{margin-top:20rpx;background-color:#fff}.commodity .message{padding:35rpx;display:flex;align-items:center;border-bottom:1rpx solid #F2F2F2}.commodity .message .image{width:141rpx;height:150rpx;background-color:#000;margin-left:34rpx}.commodity .message .introduce{margin-left:32rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;width:362rpx}.commodity .message .introduce .title{font-size:28rpx;color:#333}.commodity .message .introduce .count{font-size:24rpx;color:#999;display:flex}.commodity .message .introduce .count>view{margin-right:27rpx}.commodity .message .parameter{width:150rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end}.commodity .aggregate{display:flex;box-sizing:border-box;padding:30rpx;justify-content:flex-end;font-size:22rpx;color:#999;height:78rpx;border-bottom:1rpx solid #F2F2F2}.commodity .aggregate>text{color:#333;margin:0 5rpx}.commodity .operation{height:84rpx;display:flex;justify-content:flex-end;padding:0 30rpx;align-items:center}.commodity .operation .button{width:133rpx;height:51rpx;border:2rpx solid #999999;border-radius:26rpx;text-align:center;font-size:22rpx;color:#999999;line-height:51rpx;margin-right:8rpx}.commodity .operation .hlight{border:2rpx solid #47c877;color:#47C877}
|
8
components/order/message/index.js
Normal file
8
components/order/message/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
Component({
|
||||
properties: {
|
||||
},
|
||||
data: {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
})
|
3
components/order/message/index.json
Normal file
3
components/order/message/index.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
40
components/order/message/index.scss
Normal file
40
components/order/message/index.scss
Normal file
@ -0,0 +1,40 @@
|
||||
.message {
|
||||
padding: 35rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1rpx solid #F2F2F2;
|
||||
.image {
|
||||
width: 141rpx;
|
||||
height: 150rpx;
|
||||
background-color: #000;
|
||||
margin-left: 34rpx;
|
||||
}
|
||||
.introduce {
|
||||
margin-left: 32rpx;
|
||||
height: 120rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
width: 362rpx;
|
||||
.title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
}
|
||||
.count {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
display: flex;
|
||||
> view {
|
||||
margin-right: 27rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.parameter {
|
||||
width: 150rpx;
|
||||
height: 120rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
align-items: flex-end;
|
||||
}
|
||||
}
|
14
components/order/message/index.wxml
Normal file
14
components/order/message/index.wxml
Normal file
@ -0,0 +1,14 @@
|
||||
<view class="message">
|
||||
<image class="image"></image>
|
||||
<view class="introduce">
|
||||
<view class="title">001|德国双心药房版 胶原蛋白美容口服液养颜</view>
|
||||
<view class="count">
|
||||
<view>30只</view>
|
||||
<view>1.0356kg</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="parameter">
|
||||
<view class="price">¥29.80</view>
|
||||
<view class="num">x2</view>
|
||||
</view>
|
||||
</view>
|
1
components/order/message/index.wxss
Normal file
1
components/order/message/index.wxss
Normal file
@ -0,0 +1 @@
|
||||
.message{padding:35rpx;display:flex;align-items:center;border-bottom:1rpx solid #F2F2F2}.message .image{width:141rpx;height:150rpx;background-color:#000;margin-left:34rpx}.message .introduce{margin-left:32rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;width:362rpx}.message .introduce .title{font-size:28rpx;color:#333}.message .introduce .count{font-size:24rpx;color:#999;display:flex}.message .introduce .count>view{margin-right:27rpx}.message .parameter{width:150rpx;height:120rpx;display:flex;flex-direction:column;justify-content:space-between;align-items:flex-end}
|
8
components/order/tab/index.js
Normal file
8
components/order/tab/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
Component({
|
||||
properties: {
|
||||
},
|
||||
data: {
|
||||
},
|
||||
methods: {
|
||||
}
|
||||
})
|
8
components/order/tab/index.json
Normal file
8
components/order/tab/index.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"commodity":"../commodity/index",
|
||||
"van-tab": "../utils/dist/tab/index",
|
||||
"van-tabs": "../utils/dist/tabs/index"
|
||||
}
|
||||
}
|
3
components/order/tab/index.scss
Normal file
3
components/order/tab/index.scss
Normal file
@ -0,0 +1,3 @@
|
||||
.tab {
|
||||
width: 750rpx;
|
||||
}
|
9
components/order/tab/index.wxml
Normal file
9
components/order/tab/index.wxml
Normal file
@ -0,0 +1,9 @@
|
||||
<van-tabs class="tab" swipe-threshold="5">
|
||||
<van-tab title="待付款">
|
||||
<commodity></commodity>
|
||||
</van-tab>
|
||||
<van-tab title="代发货"></van-tab>
|
||||
<van-tab title="待收货"> </van-tab>
|
||||
<van-tab title="已完成"> </van-tab>
|
||||
<van-tab title="售后"> </van-tab>
|
||||
</van-tabs>
|
1
components/order/tab/index.wxss
Normal file
1
components/order/tab/index.wxss
Normal file
@ -0,0 +1 @@
|
||||
.tab{width:750rpx}
|
66
pages/order/order.js
Normal file
66
pages/order/order.js
Normal file
@ -0,0 +1,66 @@
|
||||
// pages/order/order.js
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
5
pages/order/order.json
Normal file
5
pages/order/order.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"tab":"../components/order/tab/index"
|
||||
}
|
||||
}
|
9
pages/order/order.scss
Normal file
9
pages/order/order.scss
Normal file
@ -0,0 +1,9 @@
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
page {
|
||||
background-color: #efefef;
|
||||
}
|
3
pages/order/order.wxml
Normal file
3
pages/order/order.wxml
Normal file
@ -0,0 +1,3 @@
|
||||
<view class="box">
|
||||
<tab style="width:100%"></tab>
|
||||
</view>
|
1
pages/order/order.wxss
Normal file
1
pages/order/order.wxss
Normal file
@ -0,0 +1 @@
|
||||
.box{display:flex;flex-direction:column;align-items:center;width:100%}page{background-color:#efefef}
|
1
utils/dist/action-sheet/index.d.ts
vendored
Normal file
1
utils/dist/action-sheet/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
59
utils/dist/action-sheet/index.js
vendored
Normal file
59
utils/dist/action-sheet/index.js
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
show: Boolean,
|
||||
title: String,
|
||||
cancelText: String,
|
||||
description: String,
|
||||
round: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
value: 100
|
||||
},
|
||||
actions: {
|
||||
type: Array,
|
||||
value: []
|
||||
},
|
||||
overlay: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
closeOnClickOverlay: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
closeOnClickAction: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
},
|
||||
safeAreaInsetBottom: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onSelect(event) {
|
||||
const { index } = event.currentTarget.dataset;
|
||||
const item = this.data.actions[index];
|
||||
if (item && !item.disabled && !item.loading) {
|
||||
this.$emit('select', item);
|
||||
if (this.data.closeOnClickAction) {
|
||||
this.onClose();
|
||||
}
|
||||
}
|
||||
},
|
||||
onCancel() {
|
||||
this.$emit('cancel');
|
||||
},
|
||||
onClose() {
|
||||
this.$emit('close');
|
||||
},
|
||||
onClickOverlay() {
|
||||
this.$emit('click-overlay');
|
||||
this.onClose();
|
||||
}
|
||||
}
|
||||
});
|
8
utils/dist/action-sheet/index.json
vendored
Normal file
8
utils/dist/action-sheet/index.json
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index",
|
||||
"van-popup": "../popup/index",
|
||||
"van-loading": "../loading/index"
|
||||
}
|
||||
}
|
54
utils/dist/action-sheet/index.wxml
vendored
Normal file
54
utils/dist/action-sheet/index.wxml
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<van-popup
|
||||
show="{{ show }}"
|
||||
position="bottom"
|
||||
round="{{ round }}"
|
||||
z-index="{{ zIndex }}"
|
||||
overlay="{{ overlay }}"
|
||||
custom-class="van-action-sheet"
|
||||
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
|
||||
close-on-click-overlay="{{ closeOnClickOverlay }}"
|
||||
bind:close="onClickOverlay"
|
||||
>
|
||||
<view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header">
|
||||
{{ title }}
|
||||
<van-icon
|
||||
name="close"
|
||||
custom-class="van-action-sheet__close"
|
||||
bind:click="onClose"
|
||||
/>
|
||||
</view>
|
||||
<view wx:if="{{ description }}" class="van-action-sheet__description">
|
||||
{{ description }}
|
||||
</view>
|
||||
<view wx:if="{{ actions && actions.length }}">
|
||||
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
|
||||
<button
|
||||
wx:for="{{ actions }}"
|
||||
wx:key="index"
|
||||
open-type="{{ item.openType }}"
|
||||
style="{{ item.color ? 'color: ' + item.color : '' }}"
|
||||
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
|
||||
hover-class="van-action-sheet__item--hover"
|
||||
data-index="{{ index }}"
|
||||
bind:tap="onSelect"
|
||||
>
|
||||
<block wx:if="{{ !item.loading }}">
|
||||
{{ item.name }}
|
||||
<text wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</text>
|
||||
</block>
|
||||
<van-loading wx:else custom-class="van-action-sheet__loading" size="20px" />
|
||||
</button>
|
||||
</view>
|
||||
<slot />
|
||||
<view
|
||||
wx:if="{{ cancelText }}"
|
||||
class="van-action-sheet__cancel"
|
||||
hover-class="van-action-sheet__cancel--hover"
|
||||
hover-stay-time="70"
|
||||
bind:tap="onCancel"
|
||||
>
|
||||
{{ cancelText }}
|
||||
</view>
|
||||
</van-popup>
|
1
utils/dist/action-sheet/index.wxss
vendored
Normal file
1
utils/dist/action-sheet/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;max-height:var(--action-sheet-max-height,90%)!important;color:#323233;color:var(--action-sheet-item-text-color,#323233)}.van-action-sheet__cancel,.van-action-sheet__item{text-align:center;font-size:16px;font-size:var(--action-sheet-item-font-size,16px);line-height:50px;line-height:var(--action-sheet-item-height,50px);background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel:before{display:block;content:" ";height:8px;height:var(--action-sheet-cancel-padding-top,8px);background-color:#f7f8fa;background-color:var(--action-sheet-cancel-padding-color,#f7f8fa)}.van-action-sheet__item--disabled{color:#c8c9cc;color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{margin-left:4px;margin-left:var(--padding-base,4px);font-size:12px;font-size:var(--action-sheet-subname-font-size,12px);color:#646566;color:var(--action-sheet-subname-color,#646566)}.van-action-sheet__header{text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--action-sheet-header-font-size,16px);line-height:44px;line-height:var(--action-sheet-header-height,44px)}.van-action-sheet__description{text-align:center;padding:16px;padding:var(--padding-md,16px);color:#646566;color:var(--action-sheet-description-color,#646566);font-size:14px;font-size:var(--action-sheet-description-font-size,14px);line-height:20px;line-height:var(--action-sheet-description-line-height,20px)}.van-action-sheet__close{position:absolute!important;top:0;right:0;line-height:inherit!important;padding:0 12px;padding:var(--action-sheet-close-icon-padding,0 12px);font-size:18px!important;font-size:var(--action-sheet-close-icon-size,18px)!important;color:#969799;color:var(--action-sheet-close-icon-color,#969799)}.van-action-sheet__loading{display:-webkit-flex!important;display:flex!important;height:50px;height:var(--action-sheet-item-height,50px)}
|
1
utils/dist/area/index.d.ts
vendored
Normal file
1
utils/dist/area/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
210
utils/dist/area/index.js
vendored
Normal file
210
utils/dist/area/index.js
vendored
Normal file
@ -0,0 +1,210 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { pickerProps } from '../picker/shared';
|
||||
const COLUMNSPLACEHOLDERCODE = '000000';
|
||||
VantComponent({
|
||||
classes: ['active-class', 'toolbar-class', 'column-class'],
|
||||
props: Object.assign(Object.assign({}, pickerProps), { value: String, areaList: {
|
||||
type: Object,
|
||||
value: {}
|
||||
}, columnsNum: {
|
||||
type: null,
|
||||
value: 3
|
||||
}, columnsPlaceholder: {
|
||||
type: Array,
|
||||
observer(val) {
|
||||
this.setData({
|
||||
typeToColumnsPlaceholder: {
|
||||
province: val[0] || '',
|
||||
city: val[1] || '',
|
||||
county: val[2] || '',
|
||||
}
|
||||
});
|
||||
}
|
||||
} }),
|
||||
data: {
|
||||
columns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||
displayColumns: [{ values: [] }, { values: [] }, { values: [] }],
|
||||
typeToColumnsPlaceholder: {}
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
this.code = value;
|
||||
this.setValues();
|
||||
},
|
||||
areaList: 'setValues',
|
||||
columnsNum(value) {
|
||||
this.setData({
|
||||
displayColumns: this.data.columns.slice(0, +value)
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
setTimeout(() => {
|
||||
this.setValues();
|
||||
}, 0);
|
||||
},
|
||||
methods: {
|
||||
getPicker() {
|
||||
if (this.picker == null) {
|
||||
this.picker = this.selectComponent('.van-area__picker');
|
||||
}
|
||||
return this.picker;
|
||||
},
|
||||
onCancel(event) {
|
||||
this.emit('cancel', event.detail);
|
||||
},
|
||||
onConfirm(event) {
|
||||
const { index } = event.detail;
|
||||
let { value } = event.detail;
|
||||
value = this.parseOutputValues(value);
|
||||
this.emit('confirm', { value, index });
|
||||
},
|
||||
emit(type, detail) {
|
||||
detail.values = detail.value;
|
||||
delete detail.value;
|
||||
this.$emit(type, detail);
|
||||
},
|
||||
// parse output columns data
|
||||
parseOutputValues(values) {
|
||||
const { columnsPlaceholder } = this.data;
|
||||
return values.map((value, index) => {
|
||||
// save undefined value
|
||||
if (!value)
|
||||
return value;
|
||||
value = JSON.parse(JSON.stringify(value));
|
||||
if (!value.code || value.name === columnsPlaceholder[index]) {
|
||||
value.code = '';
|
||||
value.name = '';
|
||||
}
|
||||
return value;
|
||||
});
|
||||
},
|
||||
onChange(event) {
|
||||
const { index, picker, value } = event.detail;
|
||||
this.code = value[index].code;
|
||||
this.setValues().then(() => {
|
||||
this.$emit('change', {
|
||||
picker,
|
||||
values: this.parseOutputValues(picker.getValues()),
|
||||
index
|
||||
});
|
||||
});
|
||||
},
|
||||
getConfig(type) {
|
||||
const { areaList } = this.data;
|
||||
return (areaList && areaList[`${type}_list`]) || {};
|
||||
},
|
||||
getList(type, code) {
|
||||
const { typeToColumnsPlaceholder } = this.data;
|
||||
let result = [];
|
||||
if (type !== 'province' && !code) {
|
||||
return result;
|
||||
}
|
||||
const list = this.getConfig(type);
|
||||
result = Object.keys(list).map(code => ({
|
||||
code,
|
||||
name: list[code]
|
||||
}));
|
||||
if (code) {
|
||||
// oversea code
|
||||
if (code[0] === '9' && type === 'city') {
|
||||
code = '9';
|
||||
}
|
||||
result = result.filter(item => item.code.indexOf(code) === 0);
|
||||
}
|
||||
if (typeToColumnsPlaceholder[type] && result.length) {
|
||||
// set columns placeholder
|
||||
const codeFill = type === 'province' ? '' : type === 'city' ? COLUMNSPLACEHOLDERCODE.slice(2, 4) : COLUMNSPLACEHOLDERCODE.slice(4, 6);
|
||||
result.unshift({
|
||||
code: `${code}${codeFill}`,
|
||||
name: typeToColumnsPlaceholder[type]
|
||||
});
|
||||
}
|
||||
return result;
|
||||
},
|
||||
getIndex(type, code) {
|
||||
let compareNum = type === 'province' ? 2 : type === 'city' ? 4 : 6;
|
||||
const list = this.getList(type, code.slice(0, compareNum - 2));
|
||||
// oversea code
|
||||
if (code[0] === '9' && type === 'province') {
|
||||
compareNum = 1;
|
||||
}
|
||||
code = code.slice(0, compareNum);
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].code.slice(0, compareNum) === code) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
setValues() {
|
||||
const county = this.getConfig('county');
|
||||
let { code } = this;
|
||||
if (!code) {
|
||||
if (this.data.columnsPlaceholder.length) {
|
||||
code = COLUMNSPLACEHOLDERCODE;
|
||||
}
|
||||
else if (Object.keys(county)[0]) {
|
||||
code = Object.keys(county)[0];
|
||||
}
|
||||
else {
|
||||
code = '';
|
||||
}
|
||||
}
|
||||
const province = this.getList('province');
|
||||
const city = this.getList('city', code.slice(0, 2));
|
||||
const picker = this.getPicker();
|
||||
if (!picker) {
|
||||
return;
|
||||
}
|
||||
const stack = [];
|
||||
stack.push(picker.setColumnValues(0, province, false));
|
||||
stack.push(picker.setColumnValues(1, city, false));
|
||||
if (city.length && code.slice(2, 4) === '00') {
|
||||
[{ code }] = city;
|
||||
}
|
||||
stack.push(picker.setColumnValues(2, this.getList('county', code.slice(0, 4)), false));
|
||||
return Promise.all(stack)
|
||||
.catch(() => { })
|
||||
.then(() => picker.setIndexes([
|
||||
this.getIndex('province', code),
|
||||
this.getIndex('city', code),
|
||||
this.getIndex('county', code)
|
||||
]))
|
||||
.catch(() => { });
|
||||
},
|
||||
getValues() {
|
||||
const picker = this.getPicker();
|
||||
return picker ? picker.getValues().filter(value => !!value) : [];
|
||||
},
|
||||
getDetail() {
|
||||
const values = this.getValues();
|
||||
const area = {
|
||||
code: '',
|
||||
country: '',
|
||||
province: '',
|
||||
city: '',
|
||||
county: ''
|
||||
};
|
||||
if (!values.length) {
|
||||
return area;
|
||||
}
|
||||
const names = values.map((item) => item.name);
|
||||
area.code = values[values.length - 1].code;
|
||||
if (area.code[0] === '9') {
|
||||
area.country = names[1] || '';
|
||||
area.province = names[2] || '';
|
||||
}
|
||||
else {
|
||||
area.province = names[0] || '';
|
||||
area.city = names[1] || '';
|
||||
area.county = names[2] || '';
|
||||
}
|
||||
return area;
|
||||
},
|
||||
reset(code) {
|
||||
this.code = code || '';
|
||||
return this.setValues();
|
||||
}
|
||||
}
|
||||
});
|
6
utils/dist/area/index.json
vendored
Normal file
6
utils/dist/area/index.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-picker": "../picker/index"
|
||||
}
|
||||
}
|
18
utils/dist/area/index.wxml
vendored
Normal file
18
utils/dist/area/index.wxml
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
<van-picker
|
||||
class="van-area__picker"
|
||||
active-class="active-class"
|
||||
toolbar-class="toolbar-class"
|
||||
column-class="column-class"
|
||||
show-toolbar
|
||||
value-key="name"
|
||||
title="{{ title }}"
|
||||
loading="{{ loading }}"
|
||||
columns="{{ displayColumns }}"
|
||||
item-height="{{ itemHeight }}"
|
||||
visible-item-count="{{ visibleItemCount }}"
|
||||
cancel-button-text="{{ cancelButtonText }}"
|
||||
confirm-button-text="{{ confirmButtonText }}"
|
||||
bind:change="onChange"
|
||||
bind:confirm="onConfirm"
|
||||
bind:cancel="onCancel"
|
||||
/>
|
1
utils/dist/area/index.wxss
vendored
Normal file
1
utils/dist/area/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';
|
1
utils/dist/button/index.d.ts
vendored
Normal file
1
utils/dist/button/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
68
utils/dist/button/index.js
vendored
Normal file
68
utils/dist/button/index.js
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { button } from '../mixins/button';
|
||||
import { openType } from '../mixins/open-type';
|
||||
VantComponent({
|
||||
mixins: [button, openType],
|
||||
classes: ['hover-class', 'loading-class'],
|
||||
data: {
|
||||
style: ''
|
||||
},
|
||||
props: {
|
||||
icon: String,
|
||||
plain: Boolean,
|
||||
block: Boolean,
|
||||
round: Boolean,
|
||||
square: Boolean,
|
||||
loading: Boolean,
|
||||
hairline: Boolean,
|
||||
disabled: Boolean,
|
||||
loadingText: String,
|
||||
customStyle: String,
|
||||
loadingType: {
|
||||
type: String,
|
||||
value: 'circular'
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
value: 'default'
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
value: 'normal'
|
||||
},
|
||||
loadingSize: {
|
||||
type: String,
|
||||
value: '20px'
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
observer(color) {
|
||||
let style = '';
|
||||
if (color) {
|
||||
style += `color: ${this.data.plain ? color : 'white'};`;
|
||||
if (!this.data.plain) {
|
||||
// Use background instead of backgroundColor to make linear-gradient work
|
||||
style += `background: ${color};`;
|
||||
}
|
||||
// hide border when color is linear-gradient
|
||||
if (color.indexOf('gradient') !== -1) {
|
||||
style += 'border: 0;';
|
||||
}
|
||||
else {
|
||||
style += `border-color: ${color};`;
|
||||
}
|
||||
}
|
||||
if (style !== this.data.style) {
|
||||
this.setData({ style });
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
if (!this.data.disabled && !this.data.loading) {
|
||||
this.$emit('click');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
7
utils/dist/button/index.json
vendored
Normal file
7
utils/dist/button/index.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index",
|
||||
"van-loading": "../loading/index"
|
||||
}
|
||||
}
|
52
utils/dist/button/index.wxml
vendored
Normal file
52
utils/dist/button/index.wxml
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<button
|
||||
id="{{ id }}"
|
||||
class="custom-class {{ utils.bem('button', [type, size, { block, round, plain, square, loading, disabled, hairline, unclickable: disabled || loading }]) }} {{ hairline ? 'van-hairline--surround' : '' }}"
|
||||
hover-class="van-button--active hover-class"
|
||||
lang="{{ lang }}"
|
||||
style="{{ style }} {{ customStyle }}"
|
||||
open-type="{{ openType }}"
|
||||
business-id="{{ businessId }}"
|
||||
session-from="{{ sessionFrom }}"
|
||||
send-message-title="{{ sendMessageTitle }}"
|
||||
send-message-path="{{ sendMessagePath }}"
|
||||
send-message-img="{{ sendMessageImg }}"
|
||||
show-message-card="{{ showMessageCard }}"
|
||||
app-parameter="{{ appParameter }}"
|
||||
aria-label="{{ ariaLabel }}"
|
||||
bindtap="onClick"
|
||||
bindgetuserinfo="bindGetUserInfo"
|
||||
bindcontact="bindContact"
|
||||
bindgetphonenumber="bindGetPhoneNumber"
|
||||
binderror="bindError"
|
||||
bindlaunchapp="bindLaunchApp"
|
||||
bindopensetting="bindOpenSetting"
|
||||
>
|
||||
<block wx:if="{{ loading }}">
|
||||
<van-loading
|
||||
custom-class="loading-class"
|
||||
size="{{ loadingSize }}"
|
||||
type="{{ loadingType }}"
|
||||
color="{{ type === 'default' ? '#c9c9c9' : 'white' }}"
|
||||
/>
|
||||
<view
|
||||
wx:if="{{ loadingText }}"
|
||||
class="van-button__loading-text"
|
||||
>
|
||||
{{ loadingText }}
|
||||
</view>
|
||||
</block>
|
||||
<block wx:else>
|
||||
<van-icon
|
||||
wx:if="{{ icon }}"
|
||||
size="1.2em"
|
||||
name="{{ icon }}"
|
||||
class="van-button__icon"
|
||||
custom-style="line-height: inherit;"
|
||||
/>
|
||||
<view class="van-button__text">
|
||||
<slot />
|
||||
</view>
|
||||
</block>
|
||||
</button>
|
1
utils/dist/button/index.wxss
vendored
Normal file
1
utils/dist/button/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';.van-button{position:relative;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;padding:0;line-height:20px;text-align:center;vertical-align:middle;-webkit-appearance:none;-webkit-text-size-adjust:100%;height:44px;height:var(--button-default-height,44px);font-size:16px;font-size:var(--button-default-font-size,16px);transition:opacity .2s;transition:opacity var(--animation-duration-fast,.2s);border-radius:2px;border-radius:var(--button-border-radius,2px)}.van-button:before{position:absolute;top:50%;left:50%;width:100%;height:100%;border:inherit;border-radius:inherit;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);opacity:0;content:" ";background-color:#000;background-color:var(--black,#000);border-color:#000;border-color:var(--black,#000)}.van-button:after{border-width:0}.van-button--active:before{opacity:.15}.van-button--unclickable:after{display:none}.van-button--default{color:#323233;color:var(--button-default-color,#323233);background-color:#fff;background-color:var(--button-default-background-color,#fff);border:1px solid #ebedf0;border:1px solid var(--button-default-border-color,#ebedf0)}.van-button--primary{color:#fff;color:var(--button-primary-color,#fff);background-color:#07c160;background-color:var(--button-primary-background-color,#07c160);border:1px solid #07c160;border:1px solid var(--button-primary-border-color,#07c160)}.van-button--info{color:#fff;color:var(--button-info-color,#fff);background-color:#1989fa;background-color:var(--button-info-background-color,#1989fa);border:1px solid #1989fa;border:1px solid var(--button-info-border-color,#1989fa)}.van-button--danger{color:#fff;color:var(--button-danger-color,#fff);background-color:#ee0a24;background-color:var(--button-danger-background-color,#ee0a24);border:1px solid #ee0a24;border:1px solid var(--button-danger-border-color,#ee0a24)}.van-button--warning{color:#fff;color:var(--button-warning-color,#fff);background-color:#ff976a;background-color:var(--button-warning-background-color,#ff976a);border:1px solid #ff976a;border:1px solid var(--button-warning-border-color,#ff976a)}.van-button--plain{background-color:#fff;background-color:var(--button-plain-background-color,#fff)}.van-button--plain.van-button--primary{color:#07c160;color:var(--button-primary-background-color,#07c160)}.van-button--plain.van-button--info{color:#1989fa;color:var(--button-info-background-color,#1989fa)}.van-button--plain.van-button--danger{color:#ee0a24;color:var(--button-danger-background-color,#ee0a24)}.van-button--plain.van-button--warning{color:#ff976a;color:var(--button-warning-background-color,#ff976a)}.van-button--large{width:100%;height:50px;height:var(--button-large-height,50px)}.van-button--normal{padding:0 15px;font-size:14px;font-size:var(--button-normal-font-size,14px)}.van-button--small{min-width:60px;min-width:var(--button-small-min-width,60px);height:30px;height:var(--button-small-height,30px);padding:0 8px;padding:0 var(--padding-xs,8px);font-size:12px;font-size:var(--button-small-font-size,12px)}.van-button--mini{display:inline-block;min-width:50px;min-width:var(--button-mini-min-width,50px);height:22px;height:var(--button-mini-height,22px);font-size:10px;font-size:var(--button-mini-font-size,10px)}.van-button--mini+.van-button--mini{margin-left:5px}.van-button--block{display:-webkit-flex;display:flex;width:100%}.van-button--round{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--square{border-radius:0}.van-button--disabled{opacity:.5;opacity:var(--button-disabled-opacity,.5)}.van-button__text{display:inline}.van-button__icon+.van-button__text:not(:empty),.van-button__loading-text{margin-left:4px}.van-button__icon{min-width:1em;line-height:inherit!important;vertical-align:top}.van-button--hairline{padding-top:1px;border-width:0}.van-button--hairline:after{border-color:inherit;border-width:1px;border-radius:4px;border-radius:calc(var(--button-border-radius, 2px)*2)}.van-button--hairline.van-button--round:after{border-radius:999px;border-radius:var(--button-round-border-radius,999px)}.van-button--hairline.van-button--square:after{border-radius:0}
|
1
utils/dist/card/index.d.ts
vendored
Normal file
1
utils/dist/card/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
38
utils/dist/card/index.js
vendored
Normal file
38
utils/dist/card/index.js
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
import { link } from '../mixins/link';
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
classes: [
|
||||
'num-class',
|
||||
'desc-class',
|
||||
'thumb-class',
|
||||
'title-class',
|
||||
'price-class',
|
||||
'origin-price-class',
|
||||
],
|
||||
mixins: [link],
|
||||
props: {
|
||||
tag: String,
|
||||
num: String,
|
||||
desc: String,
|
||||
thumb: String,
|
||||
title: String,
|
||||
price: String,
|
||||
centered: Boolean,
|
||||
lazyLoad: Boolean,
|
||||
thumbLink: String,
|
||||
originPrice: String,
|
||||
thumbMode: {
|
||||
type: String,
|
||||
value: 'aspectFit'
|
||||
},
|
||||
currency: {
|
||||
type: String,
|
||||
value: '¥'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClickThumb() {
|
||||
this.jumpLink('thumbLink');
|
||||
}
|
||||
}
|
||||
});
|
6
utils/dist/card/index.json
vendored
Normal file
6
utils/dist/card/index.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-tag": "../tag/index"
|
||||
}
|
||||
}
|
45
utils/dist/card/index.wxml
vendored
Normal file
45
utils/dist/card/index.wxml
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view class="custom-class van-card">
|
||||
<view class="{{ utils.bem('card__header', { center: centered }) }}">
|
||||
<view class="van-card__thumb" bind:tap="onClickThumb">
|
||||
<image
|
||||
wx:if="{{ thumb }}"
|
||||
src="{{ thumb }}"
|
||||
mode="{{ thumbMode }}"
|
||||
lazy-load="{{ lazyLoad }}"
|
||||
class="van-card__img thumb-class"
|
||||
/>
|
||||
<slot name="thumb" />
|
||||
<van-tag
|
||||
wx:if="{{ tag }}"
|
||||
mark
|
||||
type="danger"
|
||||
custom-class="van-card__tag"
|
||||
>
|
||||
{{ tag }}
|
||||
</van-tag>
|
||||
</view>
|
||||
|
||||
<view class="van-card__content">
|
||||
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
|
||||
<slot wx:else name="title" />
|
||||
|
||||
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
|
||||
<slot wx:else name="desc" />
|
||||
|
||||
<slot name="tags" />
|
||||
|
||||
<view class="van-card__bottom">
|
||||
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
|
||||
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
|
||||
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
|
||||
<slot name="bottom" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="van-card__footer">
|
||||
<slot name="footer" />
|
||||
</view>
|
||||
</view>
|
1
utils/dist/card/index.wxss
vendored
Normal file
1
utils/dist/card/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;-webkit-flex:none;flex:none;width:90px;width:var(--card-thumb-size,90px);height:90px;height:var(--card-thumb-size,90px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%}.van-card__content{position:relative;-webkit-flex:1;flex:1;min-width:0}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{-webkit-flex:none;flex:none;width:100%;text-align:right}
|
1
utils/dist/cell-group/index.d.ts
vendored
Normal file
1
utils/dist/cell-group/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
10
utils/dist/cell-group/index.js
vendored
Normal file
10
utils/dist/cell-group/index.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
title: String,
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
}
|
||||
});
|
3
utils/dist/cell-group/index.json
vendored
Normal file
3
utils/dist/cell-group/index.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
9
utils/dist/cell-group/index.wxml
vendored
Normal file
9
utils/dist/cell-group/index.wxml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<view
|
||||
wx:if="{{ title }}"
|
||||
class="van-cell-group__title"
|
||||
>
|
||||
{{ title }}
|
||||
</view>
|
||||
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||
<slot />
|
||||
</view>
|
1
utils/dist/cell-group/index.wxss
vendored
Normal file
1
utils/dist/cell-group/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}
|
1
utils/dist/cell/index.d.ts
vendored
Normal file
1
utils/dist/cell/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
37
utils/dist/cell/index.js
vendored
Normal file
37
utils/dist/cell/index.js
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
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
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClick(event) {
|
||||
this.$emit('click', event.detail);
|
||||
this.jumpLink();
|
||||
}
|
||||
}
|
||||
});
|
6
utils/dist/cell/index.json
vendored
Normal file
6
utils/dist/cell/index.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index"
|
||||
}
|
||||
}
|
45
utils/dist/cell/index.wxml
vendored
Normal file
45
utils/dist/cell/index.wxml
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<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="{{ titleWidth ? 'max-width:' + titleWidth + ';min-width:' + titleWidth : '' }}"
|
||||
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>
|
1
utils/dist/cell/index.wxss
vendored
Normal file
1
utils/dist/cell/index.wxss
vendored
Normal file
@ -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;top:auto;right:0;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:5px}.van-cell__right-icon-wrap{margin-left:5px;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__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)}
|
1
utils/dist/checkbox-group/index.d.ts
vendored
Normal file
1
utils/dist/checkbox-group/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
39
utils/dist/checkbox-group/index.js
vendored
Normal file
39
utils/dist/checkbox-group/index.js
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
field: true,
|
||||
relation: {
|
||||
name: 'checkbox',
|
||||
type: 'descendant',
|
||||
linked(target) {
|
||||
this.children = this.children || [];
|
||||
this.children.push(target);
|
||||
this.updateChild(target);
|
||||
},
|
||||
unlinked(target) {
|
||||
this.children = this.children.filter((child) => child !== target);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
max: Number,
|
||||
value: {
|
||||
type: Array,
|
||||
observer: 'updateChildren'
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
observer: 'updateChildren'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateChildren() {
|
||||
(this.children || []).forEach((child) => this.updateChild(child));
|
||||
},
|
||||
updateChild(child) {
|
||||
const { value, disabled } = this.data;
|
||||
child.setData({
|
||||
value: value.indexOf(child.data.name) !== -1,
|
||||
disabled: disabled || child.data.disabled
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
3
utils/dist/checkbox-group/index.json
vendored
Normal file
3
utils/dist/checkbox-group/index.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
1
utils/dist/checkbox-group/index.wxml
vendored
Normal file
1
utils/dist/checkbox-group/index.wxml
vendored
Normal file
@ -0,0 +1 @@
|
||||
<slot />
|
1
utils/dist/checkbox-group/index.wxss
vendored
Normal file
1
utils/dist/checkbox-group/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';
|
1
utils/dist/checkbox/index.d.ts
vendored
Normal file
1
utils/dist/checkbox/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
87
utils/dist/checkbox/index.js
vendored
Normal file
87
utils/dist/checkbox/index.js
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { addUnit } from '../common/utils';
|
||||
function emit(target, value) {
|
||||
target.$emit('input', value);
|
||||
target.$emit('change', value);
|
||||
}
|
||||
VantComponent({
|
||||
field: true,
|
||||
relation: {
|
||||
name: 'checkbox-group',
|
||||
type: 'ancestor',
|
||||
linked(target) {
|
||||
this.parent = target;
|
||||
},
|
||||
unlinked() {
|
||||
this.parent = null;
|
||||
}
|
||||
},
|
||||
classes: ['icon-class', 'label-class'],
|
||||
props: {
|
||||
value: Boolean,
|
||||
disabled: Boolean,
|
||||
useIconSlot: Boolean,
|
||||
checkedColor: String,
|
||||
labelPosition: String,
|
||||
labelDisabled: Boolean,
|
||||
shape: {
|
||||
type: String,
|
||||
value: 'round'
|
||||
},
|
||||
iconSize: {
|
||||
type: null,
|
||||
observer: 'setSizeWithUnit'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
sizeWithUnit: '20px'
|
||||
},
|
||||
methods: {
|
||||
emitChange(value) {
|
||||
if (this.parent) {
|
||||
this.setParentValue(this.parent, value);
|
||||
}
|
||||
else {
|
||||
emit(this, value);
|
||||
}
|
||||
},
|
||||
toggle() {
|
||||
const { disabled, value } = this.data;
|
||||
if (!disabled) {
|
||||
this.emitChange(!value);
|
||||
}
|
||||
},
|
||||
onClickLabel() {
|
||||
const { labelDisabled, disabled, value } = this.data;
|
||||
if (!disabled && !labelDisabled) {
|
||||
this.emitChange(!value);
|
||||
}
|
||||
},
|
||||
setParentValue(parent, value) {
|
||||
const parentValue = parent.data.value.slice();
|
||||
const { name } = this.data;
|
||||
const { max } = parent.data;
|
||||
if (value) {
|
||||
if (max && parentValue.length >= max) {
|
||||
return;
|
||||
}
|
||||
if (parentValue.indexOf(name) === -1) {
|
||||
parentValue.push(name);
|
||||
emit(parent, parentValue);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const index = parentValue.indexOf(name);
|
||||
if (index !== -1) {
|
||||
parentValue.splice(index, 1);
|
||||
emit(parent, parentValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
setSizeWithUnit(size) {
|
||||
this.set({
|
||||
sizeWithUnit: addUnit(size)
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
6
utils/dist/checkbox/index.json
vendored
Normal file
6
utils/dist/checkbox/index.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-icon": "../icon/index"
|
||||
}
|
||||
}
|
19
utils/dist/checkbox/index.wxml
vendored
Normal file
19
utils/dist/checkbox/index.wxml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view class="van-checkbox custom-class">
|
||||
<view class="van-checkbox__icon-wrap" bindtap="toggle">
|
||||
<slot wx:if="{{ useIconSlot }}" name="icon" />
|
||||
<van-icon
|
||||
wx:else
|
||||
name="success"
|
||||
size="0.8em"
|
||||
class="{{ utils.bem('checkbox__icon', [shape, { disabled, checked: value }]) }}"
|
||||
style="font-size: {{ sizeWithUnit }};{{ checkedColor && value && !disabled ? 'border-color:' + checkedColor + '; background-color:' + checkedColor : '' }}"
|
||||
custom-class="icon-class"
|
||||
custom-style="line-height: 1.25em;"
|
||||
/>
|
||||
</view>
|
||||
<view class="label-class {{ utils.bem('checkbox__label', [labelPosition, { disabled }]) }}" bindtap="onClickLabel">
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
1
utils/dist/checkbox/index.wxss
vendored
Normal file
1
utils/dist/checkbox/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';.van-checkbox{display:-webkit-flex;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.van-checkbox__icon-wrap,.van-checkbox__label{line-height:20px;line-height:var(--checkbox-size,20px)}.van-checkbox__icon-wrap{-webkit-flex:none;flex:none}.van-checkbox__icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:border-box;width:1em;height:1em;color:transparent;text-align:center;transition-property:color,border-color,background-color;font-size:20px;font-size:var(--checkbox-size,20px);border:1px solid #c8c9cc;border:1px solid var(--checkbox-border-color,#c8c9cc);transition-duration:.2s;transition-duration:var(--checkbox-transition-duration,.2s)}.van-checkbox__icon--round{border-radius:100%}.van-checkbox__icon--checked{color:#fff;color:var(--white,#fff);background-color:#1989fa;background-color:var(--checkbox-checked-icon-color,#1989fa);border-color:#1989fa;border-color:var(--checkbox-checked-icon-color,#1989fa)}.van-checkbox__icon--disabled{background-color:#ebedf0;background-color:var(--checkbox-disabled-background-color,#ebedf0);border-color:#c8c9cc;border-color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__icon--disabled.van-checkbox__icon--checked{color:#c8c9cc;color:var(--checkbox-disabled-icon-color,#c8c9cc)}.van-checkbox__label{word-wrap:break-word;margin-left:10px;margin-left:var(--checkbox-label-margin,10px);color:#323233;color:var(--checkbox-label-color,#323233)}.van-checkbox__label--left{float:left;margin:0 10px 0 0;margin:0 var(--checkbox-label-margin,10px) 0 0}.van-checkbox__label--disabled{color:#c8c9cc;color:var(--checkbox-disabled-label-color,#c8c9cc)}.van-checkbox__label:empty{margin:0}
|
1
utils/dist/circle/index.d.ts
vendored
Normal file
1
utils/dist/circle/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
158
utils/dist/circle/index.js
vendored
Normal file
158
utils/dist/circle/index.js
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { isObj } from '../common/utils';
|
||||
import { BLUE, WHITE } from '../common/color';
|
||||
function format(rate) {
|
||||
return Math.min(Math.max(rate, 0), 100);
|
||||
}
|
||||
const PERIMETER = 2 * Math.PI;
|
||||
const BEGIN_ANGLE = -Math.PI / 2;
|
||||
const STEP = 1;
|
||||
VantComponent({
|
||||
props: {
|
||||
text: String,
|
||||
lineCap: {
|
||||
type: String,
|
||||
value: 'round'
|
||||
},
|
||||
value: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
observer: 'reRender'
|
||||
},
|
||||
speed: {
|
||||
type: Number,
|
||||
value: 50
|
||||
},
|
||||
size: {
|
||||
type: Number,
|
||||
value: 100,
|
||||
observer: 'setStyle'
|
||||
},
|
||||
fill: String,
|
||||
layerColor: {
|
||||
type: String,
|
||||
value: WHITE
|
||||
},
|
||||
color: {
|
||||
type: [String, Object],
|
||||
value: BLUE,
|
||||
observer: 'setHoverColor'
|
||||
},
|
||||
strokeWidth: {
|
||||
type: Number,
|
||||
value: 4
|
||||
},
|
||||
clockwise: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
data: {
|
||||
style: 'width: 100px; height: 100px;',
|
||||
hoverColor: BLUE
|
||||
},
|
||||
methods: {
|
||||
getContext() {
|
||||
if (!this.ctx) {
|
||||
this.ctx = wx.createCanvasContext('van-circle', this);
|
||||
}
|
||||
return this.ctx;
|
||||
},
|
||||
setHoverColor() {
|
||||
const context = this.getContext();
|
||||
const { color, size } = this.data;
|
||||
let hoverColor = color;
|
||||
if (isObj(color)) {
|
||||
const LinearColor = context.createLinearGradient(size, 0, 0, 0);
|
||||
Object.keys(color)
|
||||
.sort((a, b) => parseFloat(a) - parseFloat(b))
|
||||
.map(key => LinearColor.addColorStop(parseFloat(key) / 100, color[key]));
|
||||
hoverColor = LinearColor;
|
||||
}
|
||||
this.setData({ hoverColor });
|
||||
},
|
||||
setStyle() {
|
||||
const { size } = this.data;
|
||||
const style = `width: ${size}px; height: ${size}px;`;
|
||||
this.setData({ style });
|
||||
},
|
||||
presetCanvas(context, strokeStyle, beginAngle, endAngle, fill) {
|
||||
const { strokeWidth, lineCap, clockwise, size } = this.data;
|
||||
const position = size / 2;
|
||||
const radius = position - strokeWidth / 2;
|
||||
context.setStrokeStyle(strokeStyle);
|
||||
context.setLineWidth(strokeWidth);
|
||||
context.setLineCap(lineCap);
|
||||
context.beginPath();
|
||||
context.arc(position, position, radius, beginAngle, endAngle, !clockwise);
|
||||
context.stroke();
|
||||
if (fill) {
|
||||
context.setFillStyle(fill);
|
||||
context.fill();
|
||||
}
|
||||
},
|
||||
renderLayerCircle(context) {
|
||||
const { layerColor, fill } = this.data;
|
||||
this.presetCanvas(context, layerColor, 0, PERIMETER, fill);
|
||||
},
|
||||
renderHoverCircle(context, formatValue) {
|
||||
const { clockwise, hoverColor } = this.data;
|
||||
// 结束角度
|
||||
const progress = PERIMETER * (formatValue / 100);
|
||||
const endAngle = clockwise
|
||||
? BEGIN_ANGLE + progress
|
||||
: 3 * Math.PI - (BEGIN_ANGLE + progress);
|
||||
this.presetCanvas(context, hoverColor, BEGIN_ANGLE, endAngle);
|
||||
},
|
||||
drawCircle(currentValue) {
|
||||
const context = this.getContext();
|
||||
const { size } = this.data;
|
||||
context.clearRect(0, 0, size, size);
|
||||
this.renderLayerCircle(context);
|
||||
const formatValue = format(currentValue);
|
||||
if (formatValue !== 0) {
|
||||
this.renderHoverCircle(context, formatValue);
|
||||
}
|
||||
context.draw();
|
||||
},
|
||||
reRender() {
|
||||
// tofector 动画暂时没有想到好的解决方案
|
||||
const { value, speed } = this.data;
|
||||
if (speed <= 0 || speed > 1000) {
|
||||
this.drawCircle(value);
|
||||
return;
|
||||
}
|
||||
this.clearInterval();
|
||||
this.currentValue = this.currentValue || 0;
|
||||
this.interval = setInterval(() => {
|
||||
if (this.currentValue !== value) {
|
||||
if (this.currentValue < value) {
|
||||
this.currentValue += STEP;
|
||||
}
|
||||
else {
|
||||
this.currentValue -= STEP;
|
||||
}
|
||||
this.drawCircle(this.currentValue);
|
||||
}
|
||||
else {
|
||||
this.clearInterval();
|
||||
}
|
||||
}, 1000 / speed);
|
||||
},
|
||||
clearInterval() {
|
||||
if (this.interval) {
|
||||
clearInterval(this.interval);
|
||||
this.interval = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
const { value } = this.data;
|
||||
this.currentValue = value;
|
||||
this.drawCircle(value);
|
||||
},
|
||||
destroyed() {
|
||||
this.ctx = null;
|
||||
this.clearInterval();
|
||||
}
|
||||
});
|
3
utils/dist/circle/index.json
vendored
Normal file
3
utils/dist/circle/index.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
7
utils/dist/circle/index.wxml
vendored
Normal file
7
utils/dist/circle/index.wxml
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<view class="van-circle">
|
||||
<canvas class="van-circle__canvas" style="{{ style }}" canvas-id="van-circle"></canvas>
|
||||
<view wx:if="{{ !text }}" class="van-circle__text">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<cover-view wx:else class="van-circle__text">{{ text }}</cover-view>
|
||||
</view>
|
1
utils/dist/circle/index.wxss
vendored
Normal file
1
utils/dist/circle/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';.van-circle{position:relative;display:inline-block;text-align:center}.van-circle__text{position:absolute;top:50%;left:0;width:100%;-webkit-transform:translateY(-50%);transform:translateY(-50%);color:#323233;color:var(--circle-text-color,#323233)}
|
1
utils/dist/col/index.d.ts
vendored
Normal file
1
utils/dist/col/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
23
utils/dist/col/index.js
vendored
Normal file
23
utils/dist/col/index.js
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
relation: {
|
||||
name: 'row',
|
||||
type: 'ancestor'
|
||||
},
|
||||
props: {
|
||||
span: Number,
|
||||
offset: Number
|
||||
},
|
||||
data: {
|
||||
style: ''
|
||||
},
|
||||
methods: {
|
||||
setGutter(gutter) {
|
||||
const padding = `${gutter / 2}px`;
|
||||
const style = gutter ? `padding-left: ${padding}; padding-right: ${padding};` : '';
|
||||
if (style !== this.data.style) {
|
||||
this.setData({ style });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
3
utils/dist/col/index.json
vendored
Normal file
3
utils/dist/col/index.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
8
utils/dist/col/index.wxml
vendored
Normal file
8
utils/dist/col/index.wxml
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
class="custom-class {{ utils.bem('col', [span]) }} {{ offset ? 'van-col--offset-' + offset : '' }}"
|
||||
style="{{ style }}"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
1
utils/dist/col/index.wxss
vendored
Normal file
1
utils/dist/col/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';.van-col{float:left;box-sizing:border-box}.van-col--1{width:4.16666667%}.van-col--offset-1{margin-left:4.16666667%}.van-col--2{width:8.33333333%}.van-col--offset-2{margin-left:8.33333333%}.van-col--3{width:12.5%}.van-col--offset-3{margin-left:12.5%}.van-col--4{width:16.66666667%}.van-col--offset-4{margin-left:16.66666667%}.van-col--5{width:20.83333333%}.van-col--offset-5{margin-left:20.83333333%}.van-col--6{width:25%}.van-col--offset-6{margin-left:25%}.van-col--7{width:29.16666667%}.van-col--offset-7{margin-left:29.16666667%}.van-col--8{width:33.33333333%}.van-col--offset-8{margin-left:33.33333333%}.van-col--9{width:37.5%}.van-col--offset-9{margin-left:37.5%}.van-col--10{width:41.66666667%}.van-col--offset-10{margin-left:41.66666667%}.van-col--11{width:45.83333333%}.van-col--offset-11{margin-left:45.83333333%}.van-col--12{width:50%}.van-col--offset-12{margin-left:50%}.van-col--13{width:54.16666667%}.van-col--offset-13{margin-left:54.16666667%}.van-col--14{width:58.33333333%}.van-col--offset-14{margin-left:58.33333333%}.van-col--15{width:62.5%}.van-col--offset-15{margin-left:62.5%}.van-col--16{width:66.66666667%}.van-col--offset-16{margin-left:66.66666667%}.van-col--17{width:70.83333333%}.van-col--offset-17{margin-left:70.83333333%}.van-col--18{width:75%}.van-col--offset-18{margin-left:75%}.van-col--19{width:79.16666667%}.van-col--offset-19{margin-left:79.16666667%}.van-col--20{width:83.33333333%}.van-col--offset-20{margin-left:83.33333333%}.van-col--21{width:87.5%}.van-col--offset-21{margin-left:87.5%}.van-col--22{width:91.66666667%}.van-col--offset-22{margin-left:91.66666667%}.van-col--23{width:95.83333333%}.van-col--offset-23{margin-left:95.83333333%}.van-col--24{width:100%}.van-col--offset-24{margin-left:100%}
|
1
utils/dist/collapse-item/index.d.ts
vendored
Normal file
1
utils/dist/collapse-item/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
96
utils/dist/collapse-item/index.js
vendored
Normal file
96
utils/dist/collapse-item/index.js
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
const nextTick = () => new Promise(resolve => setTimeout(resolve, 20));
|
||||
VantComponent({
|
||||
classes: ['title-class', 'content-class'],
|
||||
relation: {
|
||||
name: 'collapse',
|
||||
type: 'ancestor',
|
||||
linked(parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
},
|
||||
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: {
|
||||
contentHeight: 0,
|
||||
expanded: false,
|
||||
transition: false
|
||||
},
|
||||
mounted() {
|
||||
this.updateExpanded()
|
||||
.then(nextTick)
|
||||
.then(() => {
|
||||
const data = { transition: true };
|
||||
if (this.data.expanded) {
|
||||
data.contentHeight = 'auto';
|
||||
}
|
||||
this.setData(data);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
updateExpanded() {
|
||||
if (!this.parent) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
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);
|
||||
const stack = [];
|
||||
if (expanded !== this.data.expanded) {
|
||||
stack.push(this.updateStyle(expanded));
|
||||
}
|
||||
stack.push(this.set({ index, expanded }));
|
||||
return Promise.all(stack);
|
||||
},
|
||||
updateStyle(expanded) {
|
||||
return this.getRect('.van-collapse-item__content')
|
||||
.then((rect) => rect.height)
|
||||
.then((height) => {
|
||||
if (expanded) {
|
||||
return this.set({
|
||||
contentHeight: height ? `${height}px` : 'auto'
|
||||
});
|
||||
}
|
||||
return this.set({ contentHeight: `${height}px` })
|
||||
.then(nextTick)
|
||||
.then(() => this.set({ contentHeight: 0 }));
|
||||
});
|
||||
},
|
||||
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);
|
||||
},
|
||||
onTransitionEnd() {
|
||||
if (this.data.expanded) {
|
||||
this.setData({
|
||||
contentHeight: 'auto'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
6
utils/dist/collapse-item/index.json
vendored
Normal file
6
utils/dist/collapse-item/index.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-cell": "../cell/index"
|
||||
}
|
||||
}
|
44
utils/dist/collapse-item/index.wxml
vendored
Normal file
44
utils/dist/collapse-item/index.wxml
vendored
Normal file
@ -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', { transition }) }}"
|
||||
style="height: {{ contentHeight }};"
|
||||
bind:transitionend="onTransitionEnd"
|
||||
>
|
||||
<view
|
||||
class="van-collapse-item__content content-class"
|
||||
>
|
||||
<slot />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
1
utils/dist/collapse-item/index.wxss
vendored
Normal file
1
utils/dist/collapse-item/index.wxss
vendored
Normal file
@ -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__wrapper--transition{transition:height .3s ease-in-out}.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
utils/dist/collapse/index.d.ts
vendored
Normal file
1
utils/dist/collapse/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
50
utils/dist/collapse/index.js
vendored
Normal file
50
utils/dist/collapse/index.js
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
relation: {
|
||||
name: 'collapse-item',
|
||||
type: 'descendant',
|
||||
linked(child) {
|
||||
this.children.push(child);
|
||||
},
|
||||
unlinked(child) {
|
||||
this.children = this.children.filter((item) => item !== child);
|
||||
}
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: null,
|
||||
observer: 'updateExpanded'
|
||||
},
|
||||
accordion: {
|
||||
type: Boolean,
|
||||
observer: 'updateExpanded'
|
||||
},
|
||||
border: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
beforeCreate() {
|
||||
this.children = [];
|
||||
},
|
||||
methods: {
|
||||
updateExpanded() {
|
||||
this.children.forEach((child) => {
|
||||
child.updateExpanded();
|
||||
});
|
||||
},
|
||||
switch(name, expanded) {
|
||||
const { accordion, value } = this.data;
|
||||
if (!accordion) {
|
||||
name = expanded
|
||||
? (value || []).concat(name)
|
||||
: (value || []).filter((activeName) => activeName !== name);
|
||||
}
|
||||
else {
|
||||
name = expanded ? name : '';
|
||||
}
|
||||
this.$emit('change', name);
|
||||
this.$emit('input', name);
|
||||
}
|
||||
}
|
||||
});
|
3
utils/dist/collapse/index.json
vendored
Normal file
3
utils/dist/collapse/index.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
3
utils/dist/collapse/index.wxml
vendored
Normal file
3
utils/dist/collapse/index.wxml
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
<view class="custom-class van-collapse {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||
<slot />
|
||||
</view>
|
1
utils/dist/collapse/index.wxss
vendored
Normal file
1
utils/dist/collapse/index.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';
|
7
utils/dist/common/color.d.ts
vendored
Normal file
7
utils/dist/common/color.d.ts
vendored
Normal file
@ -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
utils/dist/common/color.js
vendored
Normal file
7
utils/dist/common/color.js
vendored
Normal file
@ -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';
|
3
utils/dist/common/component.d.ts
vendored
Normal file
3
utils/dist/common/component.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import { VantComponentOptions, CombinedComponentInstance } from '../definitions/index';
|
||||
declare function VantComponent<Data, Props, Methods>(vantOptions?: VantComponentOptions<Data, Props, Methods, CombinedComponentInstance<Data, Props, Methods>>): void;
|
||||
export { VantComponent };
|
48
utils/dist/common/component.js
vendored
Normal file
48
utils/dist/common/component.js
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
import { basic } from '../mixins/basic';
|
||||
import { observe } from '../mixins/observer/index';
|
||||
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',
|
||||
relations: 'relations',
|
||||
destroyed: 'detached',
|
||||
classes: 'externalClasses'
|
||||
});
|
||||
const { relation } = vantOptions;
|
||||
if (relation) {
|
||||
options.relations = Object.assign(options.relations || {}, {
|
||||
[`../${relation.name}/index`]: relation
|
||||
});
|
||||
}
|
||||
// add default externalClasses
|
||||
options.externalClasses = options.externalClasses || [];
|
||||
options.externalClasses.push('custom-class');
|
||||
// add default behaviors
|
||||
options.behaviors = options.behaviors || [];
|
||||
options.behaviors.push(basic);
|
||||
// map field to form-field behavior
|
||||
if (vantOptions.field) {
|
||||
options.behaviors.push('wx://form-field');
|
||||
}
|
||||
// add default options
|
||||
options.options = {
|
||||
multipleSlots: true,
|
||||
addGlobalClass: true
|
||||
};
|
||||
observe(vantOptions, options);
|
||||
Component(options);
|
||||
}
|
||||
export { VantComponent };
|
1
utils/dist/common/index.wxss
vendored
Normal file
1
utils/dist/common/index.wxss
vendored
Normal file
@ -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 #eee;-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}
|
1
utils/dist/common/style/clearfix.wxss
vendored
Normal file
1
utils/dist/common/style/clearfix.wxss
vendored
Normal file
@ -0,0 +1 @@
|
||||
.van-clearfix:after{display:table;clear:both;content:""}
|
1
utils/dist/common/style/ellipsis.wxss
vendored
Normal file
1
utils/dist/common/style/ellipsis.wxss
vendored
Normal file
@ -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
utils/dist/common/style/hairline.wxss
vendored
Normal file
1
utils/dist/common/style/hairline.wxss
vendored
Normal file
@ -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 #eee;-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
utils/dist/common/style/mixins/clearfix.wxss
vendored
Normal file
0
utils/dist/common/style/mixins/clearfix.wxss
vendored
Normal file
0
utils/dist/common/style/mixins/ellipsis.wxss
vendored
Normal file
0
utils/dist/common/style/mixins/ellipsis.wxss
vendored
Normal file
0
utils/dist/common/style/mixins/hairline.wxss
vendored
Normal file
0
utils/dist/common/style/mixins/hairline.wxss
vendored
Normal file
0
utils/dist/common/style/theme.wxss
vendored
Normal file
0
utils/dist/common/style/theme.wxss
vendored
Normal file
0
utils/dist/common/style/var.wxss
vendored
Normal file
0
utils/dist/common/style/var.wxss
vendored
Normal file
8
utils/dist/common/utils.d.ts
vendored
Normal file
8
utils/dist/common/utils.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/// <reference types="miniprogram-api-typings" />
|
||||
export declare function isDef(value: any): boolean;
|
||||
export declare function isObj(x: any): boolean;
|
||||
export declare function isNumber(value: any): boolean;
|
||||
export declare function range(num: number, min: number, max: number): number;
|
||||
export declare function nextTick(fn: Function): void;
|
||||
export declare function getSystemInfoSync(): WechatMiniprogram.GetSystemInfoSuccessCallbackResult;
|
||||
export declare function addUnit(value?: string | number): string | undefined;
|
32
utils/dist/common/utils.js
vendored
Normal file
32
utils/dist/common/utils.js
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
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 range(num, min, max) {
|
||||
return Math.min(Math.max(num, min), max);
|
||||
}
|
||||
export function nextTick(fn) {
|
||||
setTimeout(() => {
|
||||
fn();
|
||||
}, 1000 / 30);
|
||||
}
|
||||
let systemInfo = null;
|
||||
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;
|
||||
}
|
1
utils/dist/count-down/index.d.ts
vendored
Normal file
1
utils/dist/count-down/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
100
utils/dist/count-down/index.js
vendored
Normal file
100
utils/dist/count-down/index.js
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { isSameSecond, parseFormat, parseTimeData } from './utils';
|
||||
function simpleTick(fn) {
|
||||
return setTimeout(fn, 30);
|
||||
}
|
||||
VantComponent({
|
||||
props: {
|
||||
useSlot: Boolean,
|
||||
millisecond: Boolean,
|
||||
time: {
|
||||
type: Number,
|
||||
observer: 'reset'
|
||||
},
|
||||
format: {
|
||||
type: String,
|
||||
value: 'HH:mm:ss'
|
||||
},
|
||||
autoStart: {
|
||||
type: Boolean,
|
||||
value: true
|
||||
}
|
||||
},
|
||||
data: {
|
||||
timeData: parseTimeData(0),
|
||||
formattedTime: '0'
|
||||
},
|
||||
destroyed() {
|
||||
clearTimeout(this.tid);
|
||||
this.tid = null;
|
||||
},
|
||||
methods: {
|
||||
// 开始
|
||||
start() {
|
||||
if (this.counting) {
|
||||
return;
|
||||
}
|
||||
this.counting = true;
|
||||
this.endTime = Date.now() + this.remain;
|
||||
this.tick();
|
||||
},
|
||||
// 暂停
|
||||
pause() {
|
||||
this.counting = false;
|
||||
clearTimeout(this.tid);
|
||||
},
|
||||
// 重置
|
||||
reset() {
|
||||
this.pause();
|
||||
this.remain = this.data.time;
|
||||
this.setRemain(this.remain);
|
||||
if (this.data.autoStart) {
|
||||
this.start();
|
||||
}
|
||||
},
|
||||
tick() {
|
||||
if (this.data.millisecond) {
|
||||
this.microTick();
|
||||
}
|
||||
else {
|
||||
this.macroTick();
|
||||
}
|
||||
},
|
||||
microTick() {
|
||||
this.tid = simpleTick(() => {
|
||||
this.setRemain(this.getRemain());
|
||||
if (this.remain !== 0) {
|
||||
this.microTick();
|
||||
}
|
||||
});
|
||||
},
|
||||
macroTick() {
|
||||
this.tid = simpleTick(() => {
|
||||
const remain = this.getRemain();
|
||||
if (!isSameSecond(remain, this.remain) || remain === 0) {
|
||||
this.setRemain(remain);
|
||||
}
|
||||
if (this.remain !== 0) {
|
||||
this.macroTick();
|
||||
}
|
||||
});
|
||||
},
|
||||
getRemain() {
|
||||
return Math.max(this.endTime - Date.now(), 0);
|
||||
},
|
||||
setRemain(remain) {
|
||||
this.remain = remain;
|
||||
const timeData = parseTimeData(remain);
|
||||
if (this.data.useSlot) {
|
||||
this.$emit('change', timeData);
|
||||
}
|
||||
this.setData({
|
||||
formattedTime: parseFormat(this.data.format, timeData)
|
||||
});
|
||||
if (remain === 0) {
|
||||
this.pause();
|
||||
this.$emit('finish');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
3
utils/dist/count-down/index.json
vendored
Normal file
3
utils/dist/count-down/index.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user