# 2022-01-17

### 1.3.0 开源社区版:
【新增】完善商品查看详情功能。#I4QTLR
【新增】订单详情页面需要增加下单客户信息。
【新增】完善服务订单管理功能,实现订单作废、导出功能;核销码实现列表,作废,导出功能。#I4OSBK
【修复】修复普通订单查看详情,因优惠信息问题导致的异常情况。#I4QXUQ
【修复】修复门店列表下的用户编辑页面名称大小写问题(linux下大小写敏感问题)。
【修复】修复微信支付成功相应的日志记录类型有误。#I4QSNZ
【修复】修复发货日志记录sku货号错误问题。#I4PX25
【修复】修复发货单列表查看详情,提示权限不足的问题。#I4QDQR

### 0.0.8 会员专业版:
【新增】新增接龙功能营销功能,实现单个活动,可以添加多个不同商品的不同sku混合选择下单。
【新增】增加接龙数据库脚本及演示文件。
【升级】升级uView组件到2.0.20版本。
【修复】修复编辑收货地址的路径中选取区域部分可以手动输入文字。
【修复】修复【微信直播带货】组件缺少获取sku分页数据的问题。#I4QKSU
【优化】调整【微信自定义交易组件】商品类目排序方式及展示内容。#I4QE0N
This commit is contained in:
JianWeie
2022-01-17 02:16:00 +08:00
parent 4164e59919
commit 5167b0e096
107 changed files with 7668 additions and 3218 deletions

View File

@@ -258,6 +258,20 @@
}
},
{
"path": "pages/activity/solitaire/list/list",
"style": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "接龙"
}
},
{
"path": "pages/activity/solitaire/solitaireDetails/solitaireDetails",
"style": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "接龙详情"
}
},
{
"path": "pages/template",
"style": {
"navigationBarTextStyle": "black",

View File

@@ -0,0 +1,126 @@
<template>
<view>
<u-navbar title="接龙" safeAreaInsetTop fixed placeholder>
<view class="coreshop-navbar-left-slot" slot="left">
<u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
<u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
<u-icon name="home" size="22" @click="goHome"></u-icon>
</view>
<view slot="right">
</view>
</u-navbar>
<view class="solitaire-details-bg"></view>
<view class="solitaire-details-placeholder-body" />
<!--商家及推荐-->
<view class="coreshop-margin-20 coreshop-goods-shop-info-view-box">
<view class="coreshop-shop-view">
<view class="coreshop-position-absolute">
<u-avatar :src="shopLogo" shape="square"></u-avatar>
</view>
<view class="coreshop-margin-left-10 coreshop-padding-left-40 coreshop-padding-right-40">
<view class="coreshop-margin-bottom-5 coreshop-text-white">{{shopName || ' '}}</view>
<view class="coreshop-font-sm u-line-1 coreshop-text-white">{{shareTitle || ' '}}</view>
</view>
<u-button type="default" size="mini" :plain="true" @click="doPhoneCall" icon="phone" text="联系商家" color="#272d47"></u-button>
</view>
</view>
<view class="page-box coreshop-margin-top-20" v-if="listData.length > 0">
<view class="orderList" v-for="(item, itemIndex) in listData" :key="itemIndex">
<view class="top" @click="goSolitaireDetail(item.id)">
<view class="store u-line-2">{{item.title}}</view>
</view>
<view class="item">
<view class="left"><image :src="item.thumbnail && item.thumbnail!='null' ? item.thumbnail : '/static/images/common/empty-banner.png'" mode="aspectFill"></image></view>
<view class="content">
<view class="type u-line-4">{{item.description}}</view>
<view class="delivery-time">截止时间{{ $u.timeFormat(item.endTime, 'yyyy-mm-dd hh:MM:ss') }}</view>
</view>
</view>
<view class="bottom coreshop-margin-top-10">
<view class="more">正在接龙中</view>
<view class="coreshop-flex">
<view class='logistics coreshop-btn' @click="goSolitaireDetail(item.id)">查看详情</view>
</view>
</view>
</view>
<u-loadmore :status="loadStatus"></u-loadmore>
</view>
<!-- 无数据时默认显示 -->
<view class="coreshop-emptybox" v-else>
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/order.png'" icon-size="150" text="暂无接龙信息" mode="list"></u-empty>
<navigator class="coreshop-btn" url="/pages/category/index/index" open-type="switchTab">随便逛逛</navigator>
</view>
</view>
</template>
<script>
export default {
data() {
return {
page: 1,
limit: 10,
listData: [],
loadStatus: 'loadmore',
iconType: 'flower',
loadText: {
loadmore: '轻轻上拉',
loading: '努力加载中',
nomore: '实在没有了'
},
}
},
onLoad() {
this.getList();
},
computed: {
shopName() {
return this.$store.state.config.shopName;
},
shareTitle() {
return this.$store.state.config.shareTitle;
},
shopLogo() {
return this.$store.state.config.shopLogo;
},
},
onReachBottom() {
if (this.loadStatus === 'loadmore') {
this.getList();
}
},
methods: {
//获取列表
getList() {
this.loadStatus = 'loading'
let data = {
page: this.page,
limit: this.limit,
}
this.$u.api.getSolitairePageList(data).then(res => {
if (res.status) {
let newList = this.listData.concat(res.data);
this.listData = newList;
if (res.data.count > this.listData.length) {
this.page++
this.loadStatus = 'loadmore'
} else {
this.loadStatus = 'nomore'
}
} else {
this.$u.toast(res.msg);
}
});
}
}
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -0,0 +1,389 @@
<template>
<view>
<u-navbar title="群接龙" safeAreaInsetTop fixed placeholder>
<view class="coreshop-navbar-left-slot" slot="left">
<u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
<u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
<u-icon name="home" size="22" @click="goHome"></u-icon>
</view>
<view slot="right">
</view>
</u-navbar>
<view class="solitaire-details-bg"></view>
<view class="solitaire-details-placeholder-body" />
<!--商家及推荐-->
<view class="coreshop-margin-20 coreshop-goods-shop-info-view-box">
<view class="coreshop-shop-view">
<view class="coreshop-position-absolute">
<u-avatar :src="shopLogo" shape="square"></u-avatar>
</view>
<view class="coreshop-margin-left-10 coreshop-padding-left-40 coreshop-padding-right-40">
<view class="coreshop-margin-bottom-5 coreshop-text-white">{{shopName || ' '}}</view>
<view class="coreshop-font-sm u-line-1 coreshop-text-white">{{shareTitle || ' '}}</view>
</view>
<u-button type="default" size="mini" :plain="true" @click="doPhoneCall" icon="phone" text="联系商家" color="#272d47"></u-button>
</view>
</view>
<view class="coreshop-bg-white solitaire-details-body">
<view class="coreshop-flex coreshop-flex-nowrap coreshop-justify-between">
<view class="coreshop-padding-top-15 coreshop-margin-bottom-10 coreshop-text-black u-line-2 coreshop-font-15">
{{model.title || ' '}}
</view>
<view class="solitaire-details-shareBox" @click="goShare()">
<u-icon name="share" color="#fff" size="22"></u-icon>
</view>
</view>
<view class="coreshop-font-11 coreshop-text-gray coreshop-margin-bottom-10 ">
{{$u.timeFormat(model.createTime, 'mm月dd日')}}发布截至{{$u.timeFormat(model.endTime, 'mm月dd日 hh:MM:ss')}}
</view>
<view class="coreshop-padding-10 coreshop-content">
<u-parse :content="model.contentBody" :selectable="true" v-if="model.contentBody"></u-parse>
<!-- 无数据时默认显示 -->
<view class="coreshop-emptybox" v-else>
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/data.png'" icon-size="150" text="详情为空" mode="list"></u-empty>
</view>
</view>
</view>
<!-- 购物车主结构 -->
<view class="solitaire-details-product-item" v-for="(item, index) in items" :key="index">
<view class="coreshop-flex">
<u-avatar :src="item.productObj.images ? item.productObj.images+'?x-oss-process=image/resize,m_lfit,h_320,w_240' : item.goodObj.image+'?x-oss-process=image/resize,m_lfit,h_320,w_240'" :size="60" shape="square"></u-avatar>
<view class="coreshop-margin-left-10">
<view class="coreshop-font-13 u-line-2">{{item.goodObj.name}} </view>
<view class="coreshop-font-12 coreshop-text-yellow coreshop-margin-top-10 u-line-1">{{ item.productObj.spesDesc }}</view>
<view class="coreshop-flex coreshop-justify-between coreshop-margin-top-10">
<view>
<text class="coreshop-font-16 coreshop-text-red coreshop-text-price">
{{item.price}}
</text>
<text class="coreshop-text-through coreshop-font-11 coreshop-margin-left-10 coreshop-text-grey">原价{{ item.productObj.price || '0.00'}}</text>
</view>
<view class="cart-shoppingcard-goods-number">
<u-number-box buttonSize="24" integer :name="index" :value="item.nums" @change="toNumberChange" :step="1" :min="0" :max="item.oneCanBuy"></u-number-box>
</view>
</view>
<view class="cart-space-between">
<text class="cart-shoppingcard-remove cart-icons icon-msg" v-if="item.stockNo">库存不足</text>
<text class="cart-shoppingcard-remove cart-icons icon-msg" v-else-if="item.stockTension">库存紧张</text>
<text class="cart-shoppingcard-remove cart-icons" v-else=""></text>
</view>
</view>
</view>
</view>
<!--内容区-->
<view class="coreshop-margin-10 coreshop-padding-top-10 coreshop-bg-white">
<view class="coreshop-font-md coreshop-padding-top-10 coreshop-padding-bottom-10 coreshop-padding-left-10 coreshop-padding-right-10 coreshop-flex-direction-row">
<u-icon name="more-circle" color="#e54d42" label="接龙清单" labelSize="15px" label-pos="right"></u-icon>
</view>
<view class="coreshop-padding-top-10">
<!--接龙记录-->
<view class="coreshop-padding-left-10 coreshop-padding-right-10 coreshop-padding-top-10 coreshop-padding-bottom-10" v-if="records.length>0">
<view class="coreshop-flex coreshop-flex-nowrap coreshop-justify-between coreshop-margin-bottom-10" v-for="(item, index) in records" :key="index">
<view class="coreshop-flex coreshop-flex-nowrap coreshop-justify-between coreshop-align-center">
<text class="coreshop-text-black coreshop-margin-right-10 coreshop-font-12">{{ records.length-index}}</text>
<u-avatar :src="item.avatarImage" :size="30"></u-avatar>
<text class="coreshop-text-black coreshop-font-12 u-line-1">{{ item.nickName}}</text>
<view class="coreshop-margin-left-10 coreshop-width-max-content">
<text class="coreshop-text-gray coreshop-font-10">{{$u.timeFormat(item.create, 'mm月dd日')}}</text>
</view>
</view>
<view class="coreshop-text-right coreshop-flex-direction-column">
<text class="coreshop-text-black coreshop-font-11 u-line-1">{{ item.productSku}}</text>
<text class="coreshop-text-gray coreshop-margin-left-10 coreshop-font-10">x{{ item.nums}}</text>
</view>
</view>
</view>
<!-- 无数据时默认显示 -->
<view class="coreshop-emptybox coreshop-margin-0" v-else>
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/data.png'" icon-size="150" text="就你购买后展示效果了^_^" mode="list"></u-empty>
</view>
</view>
</view>
<!-- 分享弹窗 -->
<view class="coreshop-padding-10">
<u-popup mode="bottom" :show="shareBox" ref="share">
<!-- #ifdef H5 -->
<coreshop-share-h5 :objectId="model.id" :shareType="12" @close="closeShare()"></coreshop-share-h5>
<!-- #endif -->
<!-- #ifdef MP-WEIXIN -->
<coreshop-share-wx :objectId="model.id" :shareType="12" @close="closeShare()"></coreshop-share-wx>
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<coreshop-share-alipay :objectId="model.id" :shareType="12" @close="closeShare()"></coreshop-share-alipay>
<!-- #endif -->
<!-- #ifdef MP-TOUTIAO -->
<coreshop-share-tt :objectId="model.id" :shareType="12" @close="closeShare()"></coreshop-share-tt>
<!-- #endif -->
<!-- #ifdef APP-PLUS || APP-PLUS-NVUE -->
<coreshop-share-app :objectId="model.id" :shareType="12" @close="closeShare()"></coreshop-share-app>
<!-- #endif -->
</u-popup>
<div id="qrCode" ref="qrCodeDiv"></div>
</view>
<view class="coreshop-foot-hight-view" />
<!--按钮-->
<view class="coreshop-bg-white coreshop-footer-fixed coreshop-foot-padding-bottom">
<view class="coreshop-flex coreshop-padding-10 coreshop-justify-between coreshop-align-center coreshop-percent-100">
<view>
<text>合计 :</text>
<text class="coreshop-font-26 coreshop-text-red">¥{{totalprice}}</text>
</view>
<view class="coreshop-width-fit-content">
<u-button type="error" size="normal" @click="doSubmit" :disabled='submitStatus' :loading='submitStatus'>立即结算</u-button>
</view>
</view>
</view>
<!-- 右边浮动球 -->
<!--<coreshop-fab horizontal="right" vertical="bottom" direction="vertical"></coreshop-fab>-->
<!-- 登录提示 -->
<coreshop-login-modal></coreshop-login-modal>
</view>
</template>
<script>
export default {
data() {
return {
id: 0,
model: {},
items: [],
records: [],
background: {
background: '#272d47'
},
customButtonStyle: {
background: 'none',
color: '#fff'
},
totalprice: '0.00',
cart: [],
type: 2,
cartType: 8,
shareBox: false,
submitStatus: false,
shareUrl: '/pages/share/jump/jump',
}
},
onLoad(e) {
this.id = e.id;
},
onShow() {
this.getDetial();
this.submitStatus = false;
},
computed: {
shopName() {
return this.$store.state.config.shopName;
},
shareTitle() {
return this.$store.state.config.shareTitle;
},
shopLogo() {
return this.$store.state.config.shopLogo;
},
},
methods: {
//获取列表
getDetial() {
let data = {
id: this.id
}
this.$u.api.getSolitaireDetail(data).then(res => {
if (res.status) {
this.model = res.data.model;
this.items = res.data.items;
this.records = res.data.record;
} else {
this.$u.toast(res.msg);
}
});
},
//获取商品总额
getGoodsTotalMoney() {
var goodsTotalMoney = 0
this.cart.forEach(function (item, index, input) {
goodsTotalMoney += item.price * item.nums
})
this.totalprice = this.$common.formatMoney(goodsTotalMoney, 2, '')
},
toNumberChange: function (e) {
console.log(e);
this.$u.throttle(this.numberChange(e), 500)
},
numberChange: function (e) {
var _this = this;
var item = this.items[e.name];
var nums = e.value;
if (nums > 0) {
let data = {
ProductId: item.productId,
Nums: nums,
type: this.type,
cartType: this.cartType,
objectId: this.id
};
_this.$u.api.addCart(data).then(res => {
if (res.status) {
if (_this.cart.length < 1) {
_this.cart.push({
key: e.name,
id: res.data,
productId: item.productId,
goodsId: item.goodId,
nums: e.value,
price: item.price
})
} else {
var isIn = false
for (var i = 0; i < _this.cart.length; i++) {
if (_this.cart[i].key == e.name && _this.cart[i].productId == item.productId) {
_this.cart[i] = {
key: e.name,
id: res.data,
productId: item.productId,
goodsId: item.goodId,
nums: e.value,
price: item.price
}
isIn = true
}
}
if (!isIn) {
_this.cart.push({
key: e.name,
id: res.data,
productId: item.productId,
goodsId: item.goodId,
nums: e.value,
price: item.price
})
}
}
_this.getGoodsTotalMoney();
} else {
_this.$u.toast(res.msg);
}
});
} else {
var deleteIndex = -1;
var deleteId = 0;
for (var i = 0; i < _this.cart.length; i++) {
if (_this.cart[i].key == e.name && _this.cart[i].productId == item.productId) {
//移除数据库
deleteIndex = i;
deleteId = _this.cart[i].id;
}
}
if (deleteIndex >= 0 && deleteId > 0) {
let data = {
id: deleteId
};
_this.$u.api.removeCart(data).then(res => {
if (res.status) {
_this.cart.splice(deleteIndex, 1);
_this.getGoodsTotalMoney();
}
});
}
}
},
doSubmit() {
if (this.cart.length < 1) {
this.$u.toast('请先选择商品')
return true
}
if (parseFloat(this.totalprice) < parseFloat(this.model.startBuyPrice)) {
this.$u.toast('最小购买价格为' + this.model.startBuyPrice + '元,请增加购买产品')
return true
}
let userToken = this.$db.get('userToken');
let obj = {
cart: this.cart,
id: this.id,
token: userToken
}
this.submitStatus = true;
let newData = '';
for (var i = 0; i < this.cart.length; i++) {
if (this.cart[i].nums > 0) {
newData += ',' + this.cart[i].id;
}
}
if (newData.substr(0, 1) == ',') {
newData = newData.substr(1);
}
if (newData.length > 0) {
this.$u.route('/pages/placeOrder/index/index?orderType=' + this.cartType + '&objectId=' + this.id + '&cartIds=' + JSON.stringify(newData));
return true;
} else {
//没有选择不跳转
}
},
// 跳转到h5分享页面
goShare() {
this.shareBox = true;
},
closeShare() {
this.shareBox = false;
},
//获取分享URL
getShareUrl() {
let data = {
client: 2,
url: "/pages/share/jump/jump",
type: 1,
page: 12,
params: {
id: this.model.id,
}
};
let userToken = this.$db.get('userToken');
if (userToken && userToken != '') {
data['token'] = userToken;
}
this.$u.api.share(data).then(res => {
this.shareUrl = res.data
});
},
},
watch: {
model: {
handler() {
this.getShareUrl();
},
deep: true
}
},
//分享
onShareAppMessage(res) {
return {
title: this.model.title,
imageUrl: this.model.thumbnail,
path: this.shareUrl
}
},
onShareTimeline(res) {
return {
title: this.model.title,
imageUrl: this.model.thumbnail,
path: this.shareUrl
}
},
}
</script>
<style lang="scss" scoped>
</style>

View File

@@ -4,12 +4,6 @@
<h3 align="center" style="margin: 30px 0 30px;font-weight: bold;font-size:40px;">uView</h3>
<h3 align="center">多平台快速开发的UI框架</h3>
## 一起推动uView发展
uView正在参与开源中国的“年度最佳项目”评选目前投票进入了最后一个阶段之前投过票的现在也可以投票
我们不分昼夜的努力恳请同学们能为我们投一票uView来源于社区也希望社区能一起推动它的发展[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583)
## 说明
uView UI是[uni-app](https://uniapp.dcloud.io/)生态优秀的UI框架全面的组件和便捷的工具会让您信手拈来如鱼得水
@@ -27,7 +21,7 @@ uView UI是[uni-app](https://uniapp.dcloud.io/)生态优秀的UI框架
## 安装
```bash
# npm方式安装
# npm方式安装,插件市场导入无需执行此命令
npm i uview-ui
```

View File

@@ -1,3 +1,21 @@
## 2.0.202022-01-14
# uView2.0重磅发布,利剑出鞘,一统江湖
1. 修复calendar默认会选择一个日期如果直接点确定的话无法取到值的问题
2. 修复Slider缺少disabled props 还有注释
3. 修复u-notice-bar点击事件无法拿到index索引值的问题
4. 修复u-collapse-item在vue文件下app端自定义插槽不生效的问题
5. 优化头像为空时显示默认头像
6. 修复图片地址赋值后判断加载状态为完成问题
7. 修复日历滚动到默认日期月份区域
8. search组件暴露点击左边icon事件
9. 修复u-form clearValidate方法不生效
10. upload h5端增加返回文件参数文件的name参数
11. 处理upload选择文件后url为blob类型无法预览的问题
12. u-code-input 修复输入框没有往左移出一半屏幕
13. 修复Upload上传 disabled为true时控制台报hoverClass类型错误
14. 临时处理ios app下grid点击坍塌问题
15. 其他修复
## 2.0.192021-12-29
# uView2.0重磅发布,利剑出鞘,一统江湖

View File

@@ -7,7 +7,7 @@
width: $u.addUnit(size),
height: $u.addUnit(size),
}, $u.addStyle(customStyle)]"
@tap.stop="clickHandler"
@tap="clickHandler"
>
<slot>
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU -->
@@ -41,7 +41,7 @@
class="u-avatar__image"
v-else
:class="[`u-avatar__image--${shape}`]"
:src="avatarUrl"
:src="avatarUrl || defaultUrl"
:mode="mode"
@error="errorHandler"
:style="[{

View File

@@ -1,7 +1,7 @@
<template>
<view class="u-calendar-month-wrapper" ref="u-calendar-month-wrapper">
<view v-for="(item, index) in months" :key="index" :class="[`u-calendar-month-${index}`]"
:ref="`u-calendar-month-${index}`" :id="`month-${item.month}`">
:ref="`u-calendar-month-${index}`" :id="`month-${index}`">
<text v-if="index !== 0" class="u-calendar-month__title">{{ item.year }}{{ item.month }}</text>
<view class="u-calendar-month__days">
<view v-if="showMark" class="u-calendar-month__days__month-mark-wrapper">
@@ -280,6 +280,8 @@
},
methods: {
init() {
// 初始化默认选中
this.$emit('monthSelected', this.selected)
this.$nextTick(() => {
// 这里需要另一个延时,因为获取宽度后,会进行月份数据渲染,只有渲染完成之后,才有真正的高度
// 因为nvue下$nextTick并不是100%可靠的
@@ -336,7 +338,7 @@
})
// #endif
// #ifdef APP-NVUE
// #ifdef APP-NVUE
// nvue下使用dom模块查询元素高度
// 返回一个promise让调用此方法的主体能使用then回调
return new Promise(resolve => {
@@ -387,7 +389,7 @@
} else {
uni.$u.toast(`选择天数不能超过 ${this.maxRange}`)
}
return
return
}
// 如果当前日期大于已有日期,将当前的添加到数组尾部
selected.push(date)

View File

@@ -1,65 +1,66 @@
<template>
<u-popup
:show="show"
mode="bottom"
closeable
@close="close"
:round="round"
:closeOnClickOverlay="closeOnClickOverlay"
>
<view class="u-calendar">
<uHeader
:title="title"
:subtitle="subtitle"
:showSubtitle="showSubtitle"
:showTitle="showTitle"
></uHeader>
<scroll-view
:style="{
<u-popup
:show="show"
mode="bottom"
closeable
@close="close"
:round="round"
:closeOnClickOverlay="closeOnClickOverlay"
>
<view class="u-calendar">
<uHeader
:title="title"
:subtitle="subtitle"
:showSubtitle="showSubtitle"
:showTitle="showTitle"
></uHeader>
<scroll-view
:style="{
height: $u.addUnit(listHeight)
}"
scroll-y
@scroll="onScroll"
:scrollIntoView="scrollIntoView"
>
<uMonth
:color="color"
:rowHeight="rowHeight"
:showMark="showMark"
:months="months"
:mode="mode"
:maxCount="maxCount"
:startText="startText"
:endText="endText"
:defaultDate="defaultDate"
:minDate="innerMinDate"
:maxDate="innerMaxDate"
:maxMonth="monthNum"
:readonly="readonly"
:maxRange="maxRange"
:rangePrompt="rangePrompt"
:showRangePrompt="showRangePrompt"
:allowSameDay="allowSameDay"
ref="month"
@monthSelected="monthSelected"
@updateMonthTop="updateMonthTop"
></uMonth>
</scroll-view>
<slot name="footer" v-if="showConfirm">
<view class="u-calendar__confirm">
<u-button
shape="circle"
:text="
scroll-y
@scroll="onScroll"
:scroll-top="scrollTop"
:scrollIntoView="scrollIntoView"
>
<uMonth
:color="color"
:rowHeight="rowHeight"
:showMark="showMark"
:months="months"
:mode="mode"
:maxCount="maxCount"
:startText="startText"
:endText="endText"
:defaultDate="defaultDate"
:minDate="innerMinDate"
:maxDate="innerMaxDate"
:maxMonth="monthNum"
:readonly="readonly"
:maxRange="maxRange"
:rangePrompt="rangePrompt"
:showRangePrompt="showRangePrompt"
:allowSameDay="allowSameDay"
ref="month"
@monthSelected="monthSelected"
@updateMonthTop="updateMonthTop"
></uMonth>
</scroll-view>
<slot name="footer" v-if="showConfirm">
<view class="u-calendar__confirm">
<u-button
shape="circle"
:text="
buttonDisabled ? confirmDisabledText : confirmText
"
:color="color"
@click="confirm"
:disabled="buttonDisabled"
></u-button>
</view>
</slot>
</view>
</u-popup>
:color="color"
@click="confirm"
:disabled="buttonDisabled"
></u-button>
</view>
</slot>
</view>
</u-popup>
</template>
<script>
@@ -70,265 +71,304 @@ import util from './util.js'
import dayjs from '../../libs/util/dayjs.js'
import Calendar from '../../libs/util/calendar.js'
/**
* Calendar 日历
* @description 此组件用于单个选择日期,范围选择日期等,日历被包裹在底部弹起的容器中.
* @tutorial https://www.uviewui.com/components/calendar.html
*
* @property {String} title 标题内容 (默认 日期选择 )
* @property {Boolean} showTitle 是否显示标题 (默认 true )
* @property {Boolean} showSubtitle 是否显示副标题 (默认 true )
* @property {String} mode 日期类型选择 single-选择单个日期multiple-可以选择多个日期range-选择日期范围 默认 'single' )
* @property {String} startText mode=range时第一个日期底部的提示文字 (默认 '开始' )
* @property {String} endText mode=range时最后一个日期底部的提示文字 (默认 '结束' )
* @property {Array} customList 自定义列表
* @property {String} color 主题色,对底部按钮和选中日期有效 (默认 #3c9cff' )
* @property {String | Number} minDate 最小的可选日期 (默认 0 )
* @property {String | Number} maxDate 最大可选日期 (默认 0 )
* @property {Array | String| Date} defaultDate 默认选中的日期mode为multiple或range是必须为数组格式
* @property {String | Number} maxCount mode=multiple时最多可选多少个日期 (默认 Number.MAX_SAFE_INTEGER )
* @property {String | Number} rowHeight 日期行高 (默认 56 )
* @property {Function} formatter 日期格式化函数
* @property {Boolean} showLunar 是否显示农历 (默认 false )
* @property {Boolean} showMark 是否显示月份背景色 (默认 true )
* @property {String} confirmText 确定按钮的文字 (默认 '确定' )
* @property {String} confirmDisabledText 确认按钮处于禁用状态时的文字 (默认 '确定' )
* @property {Boolean} show 是否显示日历弹窗 (默认 false )
* @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭日历 (默认 false )
* @property {Boolean} readonly 是否为只读状态,只读状态下禁止选择日期 (默认 false )
* @property {String | Number} maxRange 日期区间最多可选天数默认无限制mode = range时有效
* @property {String} rangePrompt 范围选择超过最多可选天数时的提示文案mode = range时有效
* @property {Boolean} showRangePrompt 范围选择超过最多可选天数时是否展示提示文案mode = range时有效 (默认 true )
* @property {Boolean} allowSameDay 是否允许日期范围的起止时间为同一天mode = range时有效 (默认 false )
* @property {Number|String} round 圆角值,默认无圆角 (默认 0 )
* @property {Number|String} monthNum 最多展示的月份数量 (默认 3 )
*
* @event {Function()} confirm 点击确定按钮时触发 选择日期相关的返回参数
* @event {Function()} close 日历关闭时触发 可定义页面关闭时的回调事件
* @example <u-calendar :defaultDate="defaultDateMultiple" :show="show" mode="multiple" @confirm="confirm">
* Calendar 日历
* @description 此组件用于单个选择日期,范围选择日期等,日历被包裹在底部弹起的容器中.
* @tutorial https://www.uviewui.com/components/calendar.html
*
* @property {String} title 标题内容 (默认 日期选择 )
* @property {Boolean} showTitle 是否显示标题 (默认 true )
* @property {Boolean} showSubtitle 是否显示副标题 (默认 true )
* @property {String} mode 日期类型选择 single-选择单个日期multiple-可以选择多个日期range-选择日期范围 默认 'single' )
* @property {String} startText mode=range时第一个日期底部的提示文字 (默认 '开始' )
* @property {String} endText mode=range时最后一个日期底部的提示文字 (默认 '结束' )
* @property {Array} customList 自定义列表
* @property {String} color 主题色,对底部按钮和选中日期有效 (默认 #3c9cff' )
* @property {String | Number} minDate 最小的可选日期 (默认 0 )
* @property {String | Number} maxDate 最大可选日期 (默认 0 )
* @property {Array | String| Date} defaultDate 默认选中的日期mode为multiple或range是必须为数组格式
* @property {String | Number} maxCount mode=multiple时最多可选多少个日期 (默认 Number.MAX_SAFE_INTEGER )
* @property {String | Number} rowHeight 日期行高 (默认 56 )
* @property {Function} formatter 日期格式化函数
* @property {Boolean} showLunar 是否显示农历 (默认 false )
* @property {Boolean} showMark 是否显示月份背景色 (默认 true )
* @property {String} confirmText 确定按钮的文字 (默认 '确定' )
* @property {String} confirmDisabledText 确认按钮处于禁用状态时的文字 (默认 '确定' )
* @property {Boolean} show 是否显示日历弹窗 (默认 false )
* @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭日历 (默认 false )
* @property {Boolean} readonly 是否为只读状态,只读状态下禁止选择日期 (默认 false )
* @property {String | Number} maxRange 日期区间最多可选天数默认无限制mode = range时有效
* @property {String} rangePrompt 范围选择超过最多可选天数时的提示文案mode = range时有效
* @property {Boolean} showRangePrompt 范围选择超过最多可选天数时是否展示提示文案mode = range时有效 (默认 true )
* @property {Boolean} allowSameDay 是否允许日期范围的起止时间为同一天mode = range时有效 (默认 false )
* @property {Number|String} round 圆角值,默认无圆角 (默认 0 )
* @property {Number|String} monthNum 最多展示的月份数量 (默认 3 )
*
* @event {Function()} confirm 点击确定按钮时触发 选择日期相关的返回参数
* @event {Function()} close 日历关闭时触发 可定义页面关闭时的回调事件
* @example <u-calendar :defaultDate="defaultDateMultiple" :show="show" mode="multiple" @confirm="confirm">
</u-calendar>
* */
* */
export default {
name: 'u-calendar',
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
components: {
uHeader,
uMonth
},
data() {
return {
// 需要显示的月份的数组
months: [],
// 在月份滚动区域中当前视图中月份的index索引
monthIndex: 0,
// 月份滚动区域的高度
listHeight: 0,
// month组件中选择的日期数组
selected: [],
scrollIntoView: '',
// 过滤处理方法
innerFormatter: (value) => value
}
},
watch: {
selectedChange: {
immediate: true,
handler(n) {
this.setMonth()
}
},
// 打开弹窗时,设置月份数据
show: {
immediate: true,
handler(n) {
this.setMonth()
}
}
},
computed: {
// 由于maxDate和minDate可以为字符串(2021-10-10),或者数值(时间戳)但是dayjs如果接受字符串形式的时间戳会有问题这里进行处理
innerMaxDate() {
return uni.$u.test.number(this.maxDate)
? Number(this.maxDate)
: this.maxDate
},
innerMinDate() {
return uni.$u.test.number(this.minDate)
? Number(this.minDate)
: this.minDate
},
// 多个条件的变化,会引起选中日期的变化,这里统一管理监听
selectedChange() {
return [this.innerMinDate, this.innerMaxDate, this.defaultDate]
},
subtitle() {
// 初始化时this.months为空数组所以需要特别判断处理
if (this.months.length) {
return `${this.months[this.monthIndex].year}${
this.months[this.monthIndex].month
}`
} else {
return ''
}
},
buttonDisabled() {
// 如果为range类型且选择的日期个数不足1个时让底部的按钮出于disabled状态
if (this.mode === 'range') {
if (this.selected.length <= 1) {
return true
} else {
return false
}
} else {
return false
}
}
},
mounted() {
this.start = Date.now()
this.init()
},
methods: {
// 在微信小程序中不支持将函数当做props参数故只能通过ref形式调用
setFormatter(e) {
this.innerFormatter = e
},
// month组件内部选择日期后通过事件通知给父组件
monthSelected(e) {
this.selected = e
if (!this.showConfirm) {
// 在不需要确认按钮的情况下如果为单选或者范围多选且已选长度大于2则直接进行返还
if (
this.mode === 'multiple' ||
this.mode === 'single' ||
(this.mode === 'range' && this.selected.length >= 2)
) {
this.$emit('confirm', this.selected)
}
}
},
init() {
// 校验maxDate不能小于当前时间
if (
this.innerMaxDate &&
new Date(this.innerMaxDate).getTime() <= Date.now()
) {
return uni.$u.error('maxDate不能小于当前时间')
}
// 滚动区域的高度
this.listHeight = this.rowHeight * 5 + 30
this.setMonth()
},
close() {
this.$emit('close')
},
// 点击确定按钮
confirm() {
if (!this.buttonDisabled) {
this.$emit('confirm', this.selected)
}
},
// 获得两个日期之间的月份数
getMonths(minDate, maxDate) {
const minYear = dayjs(minDate).year()
const minMonth = dayjs(minDate).month() + 1
const maxYear = dayjs(maxDate).year()
const maxMonth = dayjs(maxDate).month() + 1
return (maxYear - minYear) * 12 + (maxMonth - minMonth)
},
// 设置月份数据
setMonth() {
// 最小日期的毫秒数
const minDate = this.innerMinDate || dayjs().valueOf()
// 如果没有指定最大日期则往后推3个月
const maxDate =
this.innerMaxDate ||
dayjs(minDate)
.add(this.monthNum - 1, 'month')
.valueOf()
// 最大最小月份之间的共有多少个月份,
const months = uni.$u.range(
1,
this.monthNum,
this.getMonths(minDate, maxDate)
)
// 先清空数组
this.months = []
for (let i = 0; i < months; i++) {
this.months.push({
date: new Array(
dayjs(minDate).add(i, 'month').daysInMonth()
)
.fill(1)
.map((item, index) => {
// 日期取值1-31
let day = index + 1
// 星期0-60为周日
const week = dayjs(minDate)
.add(i, 'month')
.date(day)
.day()
const date = dayjs(minDate)
.add(i, 'month')
.date(day)
.format('YYYY-MM-DD')
let bottomInfo = ''
if (this.showLunar) {
// 将日期转为农历格式
const lunar = Calendar.solar2lunar(
dayjs(date).year(),
dayjs(date).month() + 1,
dayjs(date).date()
)
bottomInfo = lunar.IDayCn
}
let config = {
day,
week,
// 小于最小允许的日期或者大于最大的日期则设置为disabled状态
disabled:
dayjs(date).isBefore(
dayjs(minDate).format('YYYY-MM-DD')
) ||
dayjs(date).isAfter(
dayjs(maxDate).format('YYYY-MM-DD')
),
// 返回一个日期对象供外部的formatter获取当前日期的年月日等信息进行加工处理
date: new Date(date),
bottomInfo,
dot: false,
month:
dayjs(minDate).add(i, 'month').month() + 1
}
const formatter =
this.formatter || this.innerFormatter
return formatter(config)
}),
// 当前所属的月份
month: dayjs(minDate).add(i, 'month').month() + 1,
// 当前年份
year: dayjs(minDate).add(i, 'month').year()
})
}
},
// scroll-view滚动监听
onScroll(event) {
// 不允许小于0的滚动值如果scroll-view到顶了继续下拉会出现负数值
const scrollTop = Math.max(0, event.detail.scrollTop)
// 将当前滚动条数值,除以滚动区域的高度,可以得出当前滚动到了哪一个月份的索引
for (let i = 0; i < this.months.length; i++) {
if (scrollTop >= (this.months[i].top || this.listHeight)) {
this.monthIndex = i
}
}
},
// 更新月份的top值
updateMonthTop(topArr = []) {
// 设置对应月份的top值用于onScroll方法更新月份
topArr.map((item, index) => {
this.months[index].top = item
})
}
}
name: 'u-calendar',
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
components: {
uHeader,
uMonth
},
data() {
return {
// 需要显示的月份的数组
months: [],
// 在月份滚动区域中当前视图中月份的index索引
monthIndex: 0,
// 月份滚动区域的高度
listHeight: 0,
// month组件中选择的日期数组
selected: [],
scrollIntoView: '',
scrollTop:0,
// 过滤处理方法
innerFormatter: (value) => value
}
},
watch: {
selectedChange: {
immediate: true,
handler(n) {
this.setMonth()
}
},
// 打开弹窗时,设置月份数据
show: {
immediate: true,
handler(n) {
this.setMonth()
}
}
},
computed: {
// 由于maxDate和minDate可以为字符串(2021-10-10),或者数值(时间戳)但是dayjs如果接受字符串形式的时间戳会有问题这里进行处理
innerMaxDate() {
return uni.$u.test.number(this.maxDate)
? Number(this.maxDate)
: this.maxDate
},
innerMinDate() {
return uni.$u.test.number(this.minDate)
? Number(this.minDate)
: this.minDate
},
// 多个条件的变化,会引起选中日期的变化,这里统一管理监听
selectedChange() {
return [this.innerMinDate, this.innerMaxDate, this.defaultDate]
},
subtitle() {
// 初始化时this.months为空数组所以需要特别判断处理
if (this.months.length) {
return `${this.months[this.monthIndex].year}${
this.months[this.monthIndex].month
}`
} else {
return ''
}
},
buttonDisabled() {
// 如果为range类型且选择的日期个数不足1个时让底部的按钮出于disabled状态
if (this.mode === 'range') {
if (this.selected.length <= 1) {
return true
} else {
return false
}
} else {
return false
}
}
},
mounted() {
this.start = Date.now()
this.init()
},
methods: {
// 在微信小程序中不支持将函数当做props参数故只能通过ref形式调用
setFormatter(e) {
this.innerFormatter = e
},
// month组件内部选择日期后通过事件通知给父组件
monthSelected(e) {
this.selected = e
if (!this.showConfirm) {
// 在不需要确认按钮的情况下如果为单选或者范围多选且已选长度大于2则直接进行返还
if (
this.mode === 'multiple' ||
this.mode === 'single' ||
(this.mode === 'range' && this.selected.length >= 2)
) {
this.$emit('confirm', this.selected)
}
}
},
init() {
// 校验maxDate不能小于当前时间
if (
this.innerMaxDate &&
new Date(this.innerMaxDate).getTime() <= Date.now()
) {
return uni.$u.error('maxDate不能小于当前时间')
}
// 滚动区域的高度
this.listHeight = this.rowHeight * 5 + 30
this.setMonth()
},
close() {
this.$emit('close')
},
// 点击确定按钮
confirm() {
if (!this.buttonDisabled) {
this.$emit('confirm', this.selected)
}
},
// 获得两个日期之间的月份数
getMonths(minDate, maxDate) {
const minYear = dayjs(minDate).year()
const minMonth = dayjs(minDate).month() + 1
const maxYear = dayjs(maxDate).year()
const maxMonth = dayjs(maxDate).month() + 1
return (maxYear - minYear) * 12 + (maxMonth - minMonth) + 1
},
// 设置月份数据
setMonth() {
// 最小日期的毫秒数
const minDate = this.innerMinDate || dayjs().valueOf()
// 如果没有指定最大日期则往后推3个月
const maxDate =
this.innerMaxDate ||
dayjs(minDate)
.add(this.monthNum - 1, 'month')
.valueOf()
// 最大最小月份之间的共有多少个月份,
const months = uni.$u.range(
1,
this.monthNum,
this.getMonths(minDate, maxDate)
)
// 先清空数组
this.months = []
for (let i = 0; i < months; i++) {
this.months.push({
date: new Array(
dayjs(minDate).add(i, 'month').daysInMonth()
)
.fill(1)
.map((item, index) => {
// 日期取值1-31
let day = index + 1
// 星期0-60为周日
const week = dayjs(minDate)
.add(i, 'month')
.date(day)
.day()
const date = dayjs(minDate)
.add(i, 'month')
.date(day)
.format('YYYY-MM-DD')
let bottomInfo = ''
if (this.showLunar) {
// 将日期转为农历格式
const lunar = Calendar.solar2lunar(
dayjs(date).year(),
dayjs(date).month() + 1,
dayjs(date).date()
)
bottomInfo = lunar.IDayCn
}
let config = {
day,
week,
// 小于最小允许的日期,或者大于最大的日期,则设置为disabled状态
disabled:
dayjs(date).isBefore(
dayjs(minDate).format('YYYY-MM-DD')
) ||
dayjs(date).isAfter(
dayjs(maxDate).format('YYYY-MM-DD')
),
// 返回一个日期对象供外部的formatter获取当前日期的年月日等信息进行加工处理
date: new Date(date),
bottomInfo,
dot: false,
month:
dayjs(minDate).add(i, 'month').month() + 1
}
const formatter =
this.formatter || this.innerFormatter
return formatter(config)
}),
// 当前所属的月份
month: dayjs(minDate).add(i, 'month').month() + 1,
// 当前年份
year: dayjs(minDate).add(i, 'month').year()
})
}
},
// 滚动到默认设置的月份
scrollIntoDefaultMonth(selected) {
// 查询默认日期在可选列表的下标
const _index = this.months.findIndex(({
year,
month
}) => {
month = uni.$u.padZero(month)
return `${year}-${month}` === selected
})
if (_index !== -1) {
// #ifndef MP-WEIXIN
this.$nextTick(() => {
this.scrollIntoView = `month-${_index}`
})
// #endif
// #ifdef MP-WEIXIN
this.scrollTop = this.months[_index].top || 0;
// #endif
}
},
// scroll-view滚动监听
onScroll(event) {
// 不允许小于0的滚动值如果scroll-view到顶了继续下拉会出现负数值
const scrollTop = Math.max(0, event.detail.scrollTop)
// 将当前滚动条数值,除以滚动区域的高度,可以得出当前滚动到了哪一个月份的索引
for (let i = 0; i < this.months.length; i++) {
if (scrollTop >= (this.months[i].top || this.listHeight)) {
this.monthIndex = i
}
}
},
// 更新月份的top值
updateMonthTop(topArr = []) {
// 设置对应月份的top值用于onScroll方法更新月份
topArr.map((item, index) => {
this.months[index].top = item
})
// 获取默认日期的下标
if (!this.defaultDate) {
// 如果没有设置默认日期,则将当天日期设置为默认选中的日期
const selected = dayjs().format("YYYY-MM")
this.scrollIntoDefaultMonth(selected)
return
}
let selected = dayjs().format("YYYY-MM");
// 单选模式可以是字符串或数组Date对象等
if (!uni.$u.test.array(this.defaultDate)) {
selected = dayjs(this.defaultDate).format("YYYY-MM")
} else {
selected = dayjs(this.defaultDate[0]).format("YYYY-MM");
}
this.scrollIntoDefaultMonth(selected)
}
}
}
</script>
@@ -336,8 +376,8 @@ export default {
@import '../../libs/css/components.scss';
.u-calendar {
&__confirm {
padding: 7px 18px;
}
&__confirm {
padding: 7px 18px;
}
}
</style>

View File

@@ -203,7 +203,7 @@
// 之所以需要input输入框是因为有它才能唤起键盘
// 这里将它设置为两倍的屏幕宽度,再将左边的一半移出屏幕,为了不让用户看到输入的内容
position: absolute;
left: -150rpx;
left: -750rpx;
width: 1500rpx;
top: 0;
background-color: transparent;

View File

@@ -14,22 +14,18 @@
>
<!-- #ifndef MP-WEIXIN -->
<!-- 微信小程序不支持因为微信中不支持 <slot name="title" slot="title" />的写法 -->
<slot
name="title"
slot="title"
/>
<slot
name="icon"
slot="icon"
/>
<slot
name="value"
slot="value"
/>
<slot
name="right-icon"
slot="right-icon"
/>
<template slot="title">
<slot name="title"></slot>
</template>
<template slot="icon">
<slot name="icon"></slot>
</template>
<template slot="value">
<slot name="value"></slot>
</template>
<template slot="right-icon">
<slot name="right-icon"></slot>
</template>
<!-- #endif -->
</u-cell>
<view

View File

@@ -22,6 +22,7 @@
:interval="duration"
:autoplay="true"
class="u-notice__swiper"
@change="noticeChange"
>
<swiper-item
v-for="(item, index) in text"
@@ -101,13 +102,16 @@
},
data() {
return {
index:0
}
},
methods: {
noticeChange(e){
this.index = e.detail.current
},
// 点击通告栏
clickHandler(index) {
this.$emit('click', index)
clickHandler() {
this.$emit('click', this.index)
},
// 点击关闭按钮
close() {

View File

@@ -112,7 +112,7 @@
props = [].concat(props);
this.children.map((child) => {
// 如果u-form-item的prop在props数组中则清除对应的校验结果信息
if (props.includes(child.props)) {
if (props.includes(child.prop)) {
child.message = null;
}
});

View File

@@ -1,4 +1,5 @@
<template>
<!-- #ifndef APP-NVUE -->
<view
class="u-grid-item"
hover-class="u-grid-item--hover-class"
@@ -9,6 +10,18 @@
>
<slot />
</view>
<!-- #endif -->
<!-- #ifdef APP-NVUE -->
<view
class="u-grid-item"
:hover-stay-time="200"
@tap="clickHandler"
:class="classes"
:style="[itemStyle]"
>
<slot />
</view>
<!-- #endif -->
</template>
<script>
@@ -123,7 +136,7 @@
// 贴近右边屏幕边沿的child并且最后一个比如只有横向2个的时候无需右边框
if((index + 1) % this.parentData.col !== 0 && index + 1 !== len) {
classes.push('u-border-right')
}
}
// 总的宫格数量对列数取余的值
// 如果取余后值为0则意味着要将最后一排的宫格都不需要下边框
const lessNum = len % this.parentData.col === 0 ? this.parentData.col : len % this.parentData.col
@@ -150,12 +163,12 @@
<style lang="scss" scoped>
@import "../../libs/css/components.scss";
$u-grid-item-hover-class-opcatiy:.5 !default;
$u-grid-item-margin-top:1rpx !default;
$u-grid-item-border-right-width:0.5px !default;
$u-grid-item-border-bottom-width:0.5px !default;
$u-grid-item-border-right-color:$u-border-color !default;
$u-grid-item-border-bottom-color:$u-border-color !default;
$u-grid-item-hover-class-opcatiy:.5 !default;
$u-grid-item-margin-top:1rpx !default;
$u-grid-item-border-right-width:0.5px !default;
$u-grid-item-border-bottom-width:0.5px !default;
$u-grid-item-border-right-color:$u-border-color !default;
$u-grid-item-border-bottom-color:$u-border-color !default;
.u-grid-item {
align-items: center;
justify-content: center;
@@ -170,11 +183,11 @@
position: relative;
float: left;
/* #endif */
/* #ifdef MP-WEIXIN */
margin-top:$u-grid-item-margin-top;
/* #endif */
&--hover-class {
opacity:$u-grid-item-hover-class-opcatiy;
}

View File

@@ -117,10 +117,9 @@
if (!n) {
// 如果传入null或者''或者false或者undefined标记为错误状态
this.isError = true
this.loading = false
} else {
this.isError = false
this.loading = false
}
}
}

View File

@@ -6,7 +6,7 @@
enable-back-to-top
:offset-accuracy="1"
:style="{
height: $u.addUnit(scrollViewHeight)
maxHeight: $u.addUnit(scrollViewHeight)
}"
@scroll="scrollHandler"
ref="uList"
@@ -29,7 +29,7 @@
:scrollIntoView="scrollIntoView"
:offset-accuracy="1"
:style="{
height: $u.addUnit(scrollViewHeight)
maxHeight: $u.addUnit(scrollViewHeight)
}"
scroll-y
@scroll="scrollHandler"
@@ -187,7 +187,9 @@
methods: {
init() {
// 设置列表的高度为整个屏幕的高度
this.scrollViewHeight = this.sys.windowHeight
//减去this.customNavHeight并将this.scrollViewHeight设置为maxHeight
//解决当u-index-list组件放在tabbar页面时,scroll-view内容较少时还能滚动
this.scrollViewHeight = this.sys.windowHeight - this.customNavHeight
},
// 索引列表被触摸
touchStart(e) {

View File

@@ -14,6 +14,9 @@
</slot>
</view>
<view class="u-input__content__field-wrapper" @tap="clickHandler">
<!-- 根据uni-app的input组件文档H5和APP中只要声明了password参数(无论true还是false)type均失效此时
为了防止type=number时又存在password属性type无效此时需要设置password为undefined
-->
<input
class="u-input__content__field-wrapper__field"
:style="[inputStyle]"
@@ -34,7 +37,7 @@
:adjust-position="adjustPosition"
:selection-end="selectionEnd"
:selection-start="selectionStart"
:password="password || type === 'password'"
:password="password || type === 'password' || undefined"
@input="onInput"
@blur="onBlur"
@focus="onFocus"

View File

@@ -254,6 +254,7 @@ export default {
/* #ifndef APP-NVUE */
display: block;
/* #endif */
color: $u-main-color;
&--disabled {
/* #ifndef APP-NVUE */

View File

@@ -22,6 +22,7 @@
</template>
<view class="u-search__content__icon">
<u-icon
@tap="clickIcon"
:size="22"
:name="searchIcon"
:color="searchIconColor ? searchIconColor : color"
@@ -100,7 +101,7 @@
* @property {String | Number} height 输入框高度单位px默认 64
* @property {String | Number} label 搜索框左边显示内容
* @property {Object} customStyle 定义需要用到的外部样式
*
*
* @event {Function} change 输入框内容发生变化时触发
* @event {Function} search 用户确定搜索时触发,用户按回车键,或者手机键盘右下角的"搜索"键时触发
* @event {Function} custom 用户点击右侧控件时触发
@@ -190,6 +191,10 @@
// 点击搜索框只有disabled=true时才发出事件因为禁止了输入意味着是想跳转真正的搜索页
clickHandler() {
if (this.disabled) this.$emit('click');
},
// 点击左边图标
clickIcon() {
this.$emit('clickIcon');
}
}
}
@@ -217,8 +222,8 @@ $u-search-action-margin-left: 5px !default;
/* #ifdef H5 */
// iOS15在H5下hx的某些版本input type=search时会多了一个搜索图标进行移除
[type="search"]::-webkit-search-decoration {
display: none;
[type="search"]::-webkit-search-decoration {
display: none;
}
/* #endif */

View File

@@ -40,6 +40,11 @@ export default {
type: String,
default: uni.$u.props.slider.blockColor
},
// 禁用状态
disabled: {
type: Boolean,
default: uni.$u.props.slider.disabled
},
// 是否显示当前的选择值
showValue: {
type: Boolean,

View File

@@ -13,6 +13,7 @@
:blockSize="$u.getPx(blockSize)"
:blockColor="blockColor"
:showValue="showValue"
:disabled="disabled"
@changing="changingHandler"
@change="changeHandler"
></slider>

View File

@@ -95,7 +95,7 @@
<view
v-else
class="u-upload__button"
:hover-class="!disabled && 'u-upload__button--hover'"
:hover-class="!disabled ? 'u-upload__button--hover' : ''"
hover-stay-time="150"
@tap="chooseFile"
:class="[disabled && 'u-upload__button--disabled']"
@@ -188,8 +188,9 @@
} = this;
const lists = fileList.map((item) =>
Object.assign(Object.assign({}, item), {
isImage: uni.$u.test.image(item.url),
isVideo: uni.$u.test.video(item.url),
// 如果item.url为本地选择的blob文件的话无法判断其为video还是image此处优先通过accept做判断处理
isImage: this.accept === 'image' || uni.$u.test.image(item.url || item.thumb),
isVideo: this.accept === 'video' || uni.$u.test.video(item.url || item.thumb),
deletable: typeof(item.deletable) === 'boolean' ? item.deletable : this.deletable,
})
);
@@ -299,8 +300,8 @@
if (!item.isImage || !this.previewFullImage) return
uni.previewImage({
// 先filter找出为图片的item再返回filter结果中的图片url
urls: this.lists.filter((item) => uni.$u.test.image(item.url)).map((item) => item.url),
current: item.url,
urls: this.lists.filter((item) => this.accept === 'image' || uni.$u.test.image(item.url || item.thumb)).map((item) => item.url || item.thumb),
current: item.url || item.thumb,
fail() {
uni.$u.toast('预览图片失败')
},
@@ -324,10 +325,7 @@
),
current: index,
fail() {
wx.showToast({
title: '预览视频失败',
icon: 'none'
});
uni.$u.toast('预览视频失败')
},
});
},

View File

@@ -17,7 +17,10 @@ function formatImage(res) {
type: 'image',
url: item.path,
thumb: item.path,
size: item.size
size: item.size,
// #ifdef H5
name: item.name
// #endif
}))
}
@@ -28,7 +31,10 @@ function formatVideo(res) {
type: 'video',
url: res.tempFilePath,
thumb: res.thumbTempFilePath,
size: res.size
size: res.size,
// #ifdef H5
name: res.name
// #endif
}
]
}
@@ -44,7 +50,15 @@ function formatMedia(res) {
}
function formatFile(res) {
return res.tempFiles.map((item) => ({ ...pickExclude(item, ['path']), url: item.path, size:item.size }))
return res.tempFiles.map((item) => ({
...pickExclude(item, ['path']),
url: item.path,
size:item.size,
// #ifdef H5
name: item.name,
type: item.type
// #endif
}))
}
export function chooseFile({
accept,

View File

@@ -1,5 +1,10 @@
// 此版本发布于2020-12-29
const version = '2.0.19'
// 此版本发布于2022-01-14
const version = '2.0.20'
// 开发环境才提示,生产环境不会提示
if (process.env.NODE_ENV === 'development') {
console.log(`\n %c uView V${version} %c https://www.uviewui.com/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0;', 'color: #3c9cff;background: #ffffff; padding:5px 0;');
}
export default {
v: version,

View File

@@ -19,6 +19,7 @@ export default {
inactiveColor: '#c0c4cc',
blockColor: '#ffffff',
showValue: false,
disabled:false,
blockStyle: () => {}
}
}

View File

@@ -2,7 +2,7 @@
"id": "uview-ui",
"name": "uview-ui",
"displayName": "uView2.0重磅发布,利剑出鞘,一统江湖",
"version": "2.0.19",
"version": "2.0.20",
"description": "uView UI已完美兼容nvue全面的组件和便捷的工具会让您信手拈来如鱼得水",
"keywords": [
"uview",