Browse Source

no message

master
xpz2018 6 years ago
parent
commit
0687ea1f81
12 changed files with 297 additions and 5 deletions
  1. 2
      colorui/main.wxss
  2. 58
      components/col/index.js
  3. 3
      components/col/index.json
  4. 3
      components/col/index.wxml
  5. 161
      components/col/index.wxss
  6. 53
      components/row/index.js
  7. 3
      components/row/index.json
  8. 3
      components/row/index.wxml
  9. 8
      components/row/index.wxss
  10. 2
      pages/mall/order-info/index.wxml
  11. 4
      pages/mall/search-list/index.wxml
  12. 2
      pages/mall/shops/index.wxml

2
colorui/main.wxss

@ -744,7 +744,7 @@ button.icon.lg {
flex: 1;
display: flex;
align-items: center;
margin: 0 30rpx;
margin: 0 24rpx;
}
.cu-bar .search-form+.action {

58
components/col/index.js

@ -0,0 +1,58 @@
import baseComponent from '../helpers/baseComponent'
import classNames from '../helpers/classNames'
baseComponent({
relations: {
'../row/index': {
type: 'parent',
},
},
properties: {
prefixCls: {
type: String,
value: 'wux-col',
},
span: {
value: 0,
type: Number,
},
offset: {
value: 0,
type: Number,
},
pull: {
value: 0,
type: Number,
},
push: {
value: 0,
type: Number,
},
},
data: {
colStyle: '',
},
computed: {
classes: ['prefixCls, span, offset, pull, push', function(prefixCls, span, offset, pull, push) {
const wrap = classNames(prefixCls, {
[`${prefixCls}--span-${span}`]: span,
[`${prefixCls}--offset-${offset}`]: offset,
[`${prefixCls}--pull-${pull}`]: pull,
[`${prefixCls}--push-${push}`]: push,
})
return {
wrap,
}
}],
},
methods: {
updateStyle(colStyle) {
if (this.data.colStyle !== colStyle) {
this.setData({
colStyle,
})
}
},
},
})

3
components/col/index.json

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

3
components/col/index.wxml

@ -0,0 +1,3 @@
<view class="wux-class {{ classes.wrap }}" style="{{ colStyle }}">
<slot></slot>
</view>

161
components/col/index.wxss

@ -0,0 +1,161 @@
.wux-col {
position: relative;
min-height: 2rpx;
box-sizing: border-box
}
.wux-col--span-12 {
float: left;
width: 100%
}
.wux-col--pull-12 {
right: 100%
}
.wux-col--push-12 {
left: 100%
}
.wux-col--offset-12 {
margin-left: 100%
}
.wux-col--span-11 {
float: left;
width: 91.66666667%
}
.wux-col--pull-11 {
right: 91.66666667%
}
.wux-col--push-11 {
left: 91.66666667%
}
.wux-col--offset-11 {
margin-left: 91.66666667%
}
.wux-col--span-10 {
float: left;
width: 83.33333333%
}
.wux-col--pull-10 {
right: 83.33333333%
}
.wux-col--push-10 {
left: 83.33333333%
}
.wux-col--offset-10 {
margin-left: 83.33333333%
}
.wux-col--span-9 {
float: left;
width: 75%
}
.wux-col--pull-9 {
right: 75%
}
.wux-col--push-9 {
left: 75%
}
.wux-col--offset-9 {
margin-left: 75%
}
.wux-col--span-8 {
float: left;
width: 66.66666667%
}
.wux-col--pull-8 {
right: 66.66666667%
}
.wux-col--push-8 {
left: 66.66666667%
}
.wux-col--offset-8 {
margin-left: 66.66666667%
}
.wux-col--span-7 {
float: left;
width: 58.33333333%
}
.wux-col--pull-7 {
right: 58.33333333%
}
.wux-col--push-7 {
left: 58.33333333%
}
.wux-col--offset-7 {
margin-left: 58.33333333%
}
.wux-col--span-6 {
float: left;
width: 50%
}
.wux-col--pull-6 {
right: 50%
}
.wux-col--push-6 {
left: 50%
}
.wux-col--offset-6 {
margin-left: 50%
}
.wux-col--span-5 {
float: left;
width: 41.66666667%
}
.wux-col--pull-5 {
right: 41.66666667%
}
.wux-col--push-5 {
left: 41.66666667%
}
.wux-col--offset-5 {
margin-left: 41.66666667%
}
.wux-col--span-4 {
float: left;
width: 33.33333333%
}
.wux-col--pull-4 {
right: 33.33333333%
}
.wux-col--push-4 {
left: 33.33333333%
}
.wux-col--offset-4 {
margin-left: 33.33333333%
}
.wux-col--span-3 {
float: left;
width: 25%
}
.wux-col--pull-3 {
right: 25%
}
.wux-col--push-3 {
left: 25%
}
.wux-col--offset-3 {
margin-left: 25%
}
.wux-col--span-2 {
float: left;
width: 16.66666667%
}
.wux-col--pull-2 {
right: 16.66666667%
}
.wux-col--push-2 {
left: 16.66666667%
}
.wux-col--offset-2 {
margin-left: 16.66666667%
}
.wux-col--span-1 {
float: left;
width: 8.33333333%
}
.wux-col--pull-1 {
right: 8.33333333%
}
.wux-col--push-1 {
left: 8.33333333%
}
.wux-col--offset-1 {
margin-left: 8.33333333%
}

53
components/row/index.js

@ -0,0 +1,53 @@
import baseComponent from '../helpers/baseComponent'
import classNames from '../helpers/classNames'
baseComponent({
relations: {
'../col/index': {
type: 'child',
observer() {
this.updateStyle()
},
},
},
properties: {
prefixCls: {
type: String,
value: 'wux-row',
},
gutter: {
value: 0,
type: Number,
observer: 'updateStyle',
},
},
data: {
rowStyle: '',
},
computed: {
classes: ['prefixCls', function(prefixCls) {
const wrap = classNames(prefixCls)
return {
wrap,
}
}],
},
methods: {
updateStyle(gutter = this.data.gutter) {
const elements = this.getRelationNodes('../col/index')
const rowStyle = gutter > 0 ? `margin-left: ${gutter / -2}px; margin-right: ${gutter / -2}px` : ''
const colStyle = gutter > 0 ? `padding-left: ${gutter / 2}px; padding-right: ${gutter / 2}px` : ''
if (elements.length > 0) {
elements.forEach((element) => {
element.updateStyle(colStyle)
})
}
this.setData({
rowStyle,
})
},
},
})

3
components/row/index.json

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

3
components/row/index.wxml

@ -0,0 +1,3 @@
<view class="wux-class {{ classes.wrap }}" style="{{ rowStyle }}">
<slot></slot>
</view>

8
components/row/index.wxss

@ -0,0 +1,8 @@
.wux-row:after,
.wux-row:before {
display: table;
content: " "
}
.wux-row:after {
clear: both
}

2
pages/mall/order-info/index.wxml

@ -13,7 +13,7 @@
<view class="bg-white flex flex-justify" style="padding:8rpx 32rpx 0rpx 32rpx">
<view class="flex flex-center">
<view class="detail-price">¥{{orderInfo.price}}</view>
<view class="text-gray" style="font-size:12px;margin-left:48rpx">库存:{{orderInfo.stockNumbe + orderInfo.unit}}</view>
<view class="text-gray" style="font-size:12px;margin-left:48rpx">库存:{{orderInfo.stockNumber}}{{orderInfo.unit}}</view>
</view>
<view class="flex flex-center">
<view class="text-gray" style="font-size:12px;margin-right:24rpx">{{orderInfo.viewNum}} 浏览</view>

4
pages/mall/search-list/index.wxml

@ -41,12 +41,12 @@
<view style="flex:1;padding:16rpx">
<view class="flex flex-justify">
<view class="page-name">{{item.name}}</view>
<view class="page-num">已拼{{item.soldNum}}</view>
<view class="page-num">已拼{{item.soldNum}}{{item.unit}}</view>
</view>
<view class="page-num" style="height:100rpx">{{item.summary}}</view>
<view class="flex flex-justify" style="align-items:flex-end">
<view class="page-price">¥{{item.price}}</view>
<view class="page-stock" style="margin-bottom:6rpx">库存:{{item.stockNumber}}</view>
<view class="page-stock" style="margin-bottom:6rpx">库存:{{item.stockNumber}}{{item.unit}}</view>
<button class="cu-btn bg-red round shadow-blur page-btn">立即抢购</button>
</view>
</view>

2
pages/mall/shops/index.wxml

@ -64,7 +64,7 @@
<view style="flex:1;padding:16rpx 20rpx">
<view class="flex flex-justify">
<view class="page-name">{{item.name}}</view>
<view class="page-num">已拼{{item.soldNum}}</view>
<view class="page-num">已拼{{item.soldNum}}{{item.unit}}</view>
</view>
<view class="page-num" style="height:100rpx">{{item.summary}}</view>
<view class="flex flex-justify" style="align-items:flex-end">

Loading…
Cancel
Save