## 0.0.2(2021-12-30)
使用SixLabors.ImageSharp替换System.Drawing,全面拥抱跨平台,减少安装libgdiplus的过程。组件功能更加丰富。 升级uview至2.0.19版本。进一步减小包大小。 取消全部WebRequest,替换为HttpClient。 nuget更新大批组件升级到6.0版本
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.0" />
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="2.2.0" />
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="2.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotLiquid" Version="2.2.585" />
|
||||
<PackageReference Include="sqlSugarCore" Version="5.0.4.8" />
|
||||
<PackageReference Include="sqlSugarCore" Version="5.0.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
|
||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
||||
<PackageReference Include="sqlSugarCore" Version="5.0.4.8" />
|
||||
<PackageReference Include="sqlSugarCore" Version="5.0.5.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace CoreCms.Net.IServices
|
||||
/// <param name="mobile"></param>
|
||||
/// <param name="contentBody"></param>
|
||||
/// <param name="smsOptions"></param>
|
||||
string SendSms(string mobile, string contentBody, SMSOptions smsOptions);
|
||||
Task<string> SendSms(string mobile, string contentBody, SMSOptions smsOptions);
|
||||
|
||||
/// <summary>
|
||||
/// 校验短信验证码
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace CoreCms.Net.IServices
|
||||
/// </summary>
|
||||
/// <param name="cardCode"></param>
|
||||
/// <returns></returns>
|
||||
WebApiCallBack BankCardsOrganization(string cardCode);
|
||||
Task<WebApiCallBack> BankCardsOrganization(string cardCode);
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="sqlSugarCore" Version="5.0.4.8" />
|
||||
<PackageReference Include="sqlSugarCore" Version="5.0.5.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.7" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.8" />
|
||||
<PackageReference Include="InitQ" Version="1.0.0.8" />
|
||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="2.2.0" />
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="2.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotLiquid" Version="2.2.585" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.7" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
@@ -31,6 +30,7 @@ using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.FileProviders;
|
||||
using Qiniu.Storage;
|
||||
using Qiniu.Util;
|
||||
using SixLabors.ImageSharp;
|
||||
using ToolGood.Words;
|
||||
|
||||
namespace CoreCms.Net.Services
|
||||
@@ -302,8 +302,11 @@ namespace CoreCms.Net.Services
|
||||
var newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + ".jpg";
|
||||
var today = DateTime.Now.ToString("yyyyMMdd");
|
||||
|
||||
Image mImage = Image.FromStream(memStream);
|
||||
Bitmap bp = new Bitmap(mImage);
|
||||
byte[] data = new byte[memStream.Length];
|
||||
memStream.Seek(0, SeekOrigin.Begin);
|
||||
memStream.Read(data, 0, Convert.ToInt32(memStream.Length));
|
||||
SixLabors.ImageSharp.Image image = SixLabors.ImageSharp.Image.Load(new MemoryStream(data));
|
||||
|
||||
|
||||
var saveUrl = options.Path + today + "/";
|
||||
var dirPath = _webHostEnvironment.WebRootPath + saveUrl;
|
||||
@@ -322,7 +325,8 @@ namespace CoreCms.Net.Services
|
||||
var filePath = dirPath + newFileName;
|
||||
var fileUrl = saveUrl + newFileName;
|
||||
|
||||
bp.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg);//注意保存路径
|
||||
//保存到图片
|
||||
image.SaveAsync(filePath);
|
||||
|
||||
return bucketBindDomain + fileUrl;
|
||||
}
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.7" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.8" />
|
||||
<PackageReference Include="Flurl.Http" Version="3.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
||||
<PackageReference Include="Qiniu" Version="8.0.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
|
||||
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta13" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
|
||||
<PackageReference Include="Tencent.QCloud.Cos.Sdk" Version="5.4.25" />
|
||||
<PackageReference Include="ToolGood.Words" Version="3.0.2.8" />
|
||||
|
||||
@@ -20,6 +20,7 @@ using CoreCms.Net.Model.ViewModels.Sms;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Flurl.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json;
|
||||
@@ -154,12 +155,19 @@ namespace CoreCms.Net.Services
|
||||
/// <param name="mobile"></param>
|
||||
/// <param name="contentBody"></param>
|
||||
/// <param name="smsOptions">配置文件</param>
|
||||
public string SendSms(string mobile, string contentBody, SMSOptions smsOptions)
|
||||
public async Task<string> SendSms(string mobile, string contentBody, SMSOptions smsOptions)
|
||||
{
|
||||
if (smsOptions.Enabled)
|
||||
{
|
||||
string param = $@"action=send&userid={smsOptions.UserId}&account={smsOptions.Account}&password={smsOptions.Password}&content={"【" + smsOptions.Signature + "】" + contentBody}&mobile={mobile}";
|
||||
var str = HttpHelper.PostSend(smsOptions.ApiUrl, param);
|
||||
var str = await smsOptions.ApiUrl.PostUrlEncodedAsync(new
|
||||
{
|
||||
action = "send",
|
||||
userid = smsOptions.UserId,
|
||||
account = smsOptions.Account,
|
||||
password = smsOptions.Password,
|
||||
mobile = mobile,
|
||||
content = "【" + smsOptions.Signature + "】" + contentBody,
|
||||
}).ReceiveString();
|
||||
return str;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using CoreCms.Net.Caching.AccressToken;
|
||||
@@ -31,6 +29,12 @@ using CoreCms.Net.WeChat.Service.Options;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SixLabors.Fonts;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Drawing.Processing;
|
||||
using SixLabors.ImageSharp.Formats.Jpeg;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||
|
||||
@@ -854,7 +858,6 @@ namespace CoreCms.Net.Services
|
||||
|
||||
//文件硬地址
|
||||
var qrCodeDir = _webHostEnvironment.WebRootPath + "/static/qrCode/weChat/" + otherData;
|
||||
System.Drawing.Image qrCodeImage = System.Drawing.Image.FromFile(qrCodeDir);
|
||||
|
||||
//获取数据来源
|
||||
var dataObj = JObject.FromObject(data);
|
||||
@@ -881,58 +884,67 @@ namespace CoreCms.Net.Services
|
||||
if (images.Any())
|
||||
{
|
||||
var image = images[0];
|
||||
//创建画布
|
||||
//创建 带二维码的图片 大小的 位图
|
||||
Bitmap tmpImage = new Bitmap(400, 600);
|
||||
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(tmpImage);
|
||||
//下面这个设成High
|
||||
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
|
||||
g.SmoothingMode = SmoothingMode.HighQuality;
|
||||
g.CompositingQuality = CompositingQuality.HighQuality;
|
||||
//清除整个绘图面并以背景色填充
|
||||
//g.Clear(Color.Transparent);// 透明(看到的可能是黑色)
|
||||
g.Clear(Color.White); //绘制白色
|
||||
|
||||
//创建一个背景宽度为400X600的底图
|
||||
using var imageTemple = new SixLabors.ImageSharp.Image<Rgba32>(400, 600);
|
||||
//设置底图的背景色为白色
|
||||
imageTemple.Mutate(x => x.BackgroundColor(SixLabors.ImageSharp.Color.White));
|
||||
//绘制商品图片(网络下载图片)
|
||||
System.Net.WebRequest request = System.Net.WebRequest.Create(image);
|
||||
System.Net.WebResponse response = request.GetResponse();
|
||||
Stream reader = response.GetResponseStream();
|
||||
if (reader != null)
|
||||
HttpClient client = new HttpClient();
|
||||
HttpResponseMessage response = await client.GetAsync(image);
|
||||
response.EnsureSuccessStatusCode();
|
||||
var stream = await response.Content.ReadAsStreamAsync();
|
||||
//载入下载的图片流
|
||||
var imageThumbnail = await SixLabors.ImageSharp.Image.LoadAsync(stream);
|
||||
//将下载的图片压缩至400X400
|
||||
imageThumbnail.Mutate(x =>
|
||||
{
|
||||
System.Drawing.Image imgHeadPhoto = System.Drawing.Image.FromStream(reader);
|
||||
g.DrawImage(imgHeadPhoto, 0, 0, 400, 400);
|
||||
imgHeadPhoto.Dispose();
|
||||
}
|
||||
reader.Close();
|
||||
reader.Dispose();
|
||||
|
||||
//绘制分享二维码
|
||||
g.DrawImage(qrCodeImage, 275, 420, 120, 120);
|
||||
|
||||
//绘制商品名称
|
||||
Font titleFont = new Font("微软雅黑", 14);
|
||||
|
||||
RectangleF descRect = new RectangleF();
|
||||
descRect.Location = new Point(10, 460);
|
||||
descRect.Size = new Size(260, ((int)g.MeasureString(goodModel.name, titleFont, 260, StringFormat.GenericTypographic).Height));
|
||||
g.DrawString(goodModel.name, titleFont, Brushes.Black, descRect);
|
||||
|
||||
//g.DrawString(goodModel.name, titleFont, new SolidBrush(Color.Black), new PointF(10, 430));
|
||||
|
||||
x.Resize(400, 400);
|
||||
});
|
||||
//将商品大图合并到背景图上
|
||||
imageTemple.Mutate(x => x.DrawImage(imageThumbnail, new SixLabors.ImageSharp.Point(0, 0), 1));
|
||||
//将用户的分享二维码合并大背景图上
|
||||
var imageQrcode = await SixLabors.ImageSharp.Image.LoadAsync(qrCodeDir);
|
||||
//将二维码缩略至120X120
|
||||
imageQrcode.Mutate(x =>
|
||||
{
|
||||
x.Resize(120, 120);
|
||||
});
|
||||
//将二维码图片合并到背景图上
|
||||
imageTemple.Mutate(x => x.DrawImage(imageQrcode, new SixLabors.ImageSharp.Point(275, 420), 1));
|
||||
//构建字体//装载字体(ttf)(而且字体一定要支持简体中文的)
|
||||
var fonts = new FontCollection();
|
||||
SixLabors.Fonts.FontFamily fontFamily = fonts.Install(_webHostEnvironment.WebRootPath + "/fonts/SourceHanSansK-Normal.ttf");
|
||||
//商品名称可能较长,设置为多行文本输出
|
||||
SixLabors.Fonts.Font titleFont = new SixLabors.Fonts.Font(fontFamily, 20, SixLabors.Fonts.FontStyle.Regular);
|
||||
//多行文本输出
|
||||
var textOptions = new TextOptions()
|
||||
{
|
||||
ApplyKerning = true,
|
||||
VerticalAlignment = VerticalAlignment.Top,
|
||||
HorizontalAlignment = HorizontalAlignment.Left,
|
||||
WrapTextWidth = 230
|
||||
};
|
||||
var graphicsOptions = new GraphicsOptions()
|
||||
{
|
||||
Antialias = true
|
||||
};
|
||||
//沿着行尾的绕行路径绘制文本
|
||||
var options = new SixLabors.ImageSharp.Drawing.Processing.DrawingOptions
|
||||
{
|
||||
GraphicsOptions = graphicsOptions,
|
||||
TextOptions = textOptions
|
||||
};
|
||||
//开始绘制商品名称
|
||||
imageTemple.Mutate(ctx => ctx.DrawText(options, goodModel.name, titleFont, SixLabors.ImageSharp.Color.Red, new SixLabors.ImageSharp.PointF(10, 450)));
|
||||
//绘制商品金额
|
||||
Font moneyFont = new Font("微软雅黑", 18);
|
||||
g.DrawString("¥" + goodModel.price, moneyFont, new SolidBrush(Color.Crimson), new PointF(10, 420));
|
||||
|
||||
SixLabors.Fonts.Font moneyFont = new SixLabors.Fonts.Font(fontFamily, 18);
|
||||
//获取该文件绘制所需的大小
|
||||
imageTemple.Mutate(ctx => ctx.DrawText("¥" + goodModel.price, moneyFont, SixLabors.ImageSharp.Color.Crimson, new SixLabors.ImageSharp.PointF(10, 410)));
|
||||
//绘制提示语
|
||||
Font tipsFont = new Font("微软雅黑", 8);
|
||||
g.DrawString("扫描或长按识别二维码", tipsFont, new SolidBrush(Color.Black), new PointF(278, 555));
|
||||
|
||||
//释放资源 并保存要返回 位图
|
||||
qrCodeImage.Dispose();
|
||||
//图片压缩
|
||||
SaveImage2File(_webHostEnvironment.WebRootPath + fileName, tmpImage, 90);
|
||||
g.Dispose();
|
||||
tmpImage.Dispose();
|
||||
SixLabors.Fonts.Font tipsFont = new SixLabors.Fonts.Font(fontFamily, 10);
|
||||
imageTemple.Mutate(ctx => ctx.DrawText("扫描或长按识别二维码", tipsFont, SixLabors.ImageSharp.Color.Black, new SixLabors.ImageSharp.PointF(283, 555)));
|
||||
//载入流存储在到文件
|
||||
await imageTemple.SaveAsync(_webHostEnvironment.WebRootPath + fileName);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -943,32 +955,6 @@ namespace CoreCms.Net.Services
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将Image实例保存到文件,注意此方法不执行 img.Dispose()
|
||||
/// 图片保存时本可以直接使用destImage.Save(path, ImageFormat.Jpeg),但是这种方法无法进行进一步控制图片质量
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="img"></param>
|
||||
/// <param name="quality">1~100整数,无效值,则取默认值95</param>
|
||||
/// <param name="mimeType"></param>
|
||||
private void SaveImage2File(string path, Image destImage, int quality, string mimeType = "image/jpeg")
|
||||
{
|
||||
if (quality <= 0 || quality > 100) quality = 95;
|
||||
//创建保存的文件夹
|
||||
FileInfo fileInfo = new FileInfo(path);
|
||||
if (!Directory.Exists(fileInfo.DirectoryName))
|
||||
{
|
||||
Directory.CreateDirectory(fileInfo.DirectoryName);
|
||||
}
|
||||
//设置保存参数,保存参数里进一步控制质量
|
||||
EncoderParameters encoderParams = new EncoderParameters();
|
||||
long[] qua = new long[] { quality };
|
||||
EncoderParameter encoderParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, quality);
|
||||
encoderParams.Param[0] = encoderParam;
|
||||
//获取指定mimeType的mimeType的ImageCodecInfo
|
||||
var codecInfo = ImageCodecInfo.GetImageEncoders().FirstOrDefault(ici => ici.MimeType == mimeType);
|
||||
destImage.Save(path, codecInfo, encoderParams);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Flurl.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
@@ -248,12 +249,12 @@ namespace CoreCms.Net.Services
|
||||
/// </summary>
|
||||
/// <param name="cardCode"></param>
|
||||
/// <returns></returns>
|
||||
public WebApiCallBack BankCardsOrganization(string cardCode)
|
||||
public async Task<WebApiCallBack> BankCardsOrganization(string cardCode)
|
||||
{
|
||||
var jm = new WebApiCallBack();
|
||||
|
||||
var url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo=" + cardCode + "&cardBinCheck=true";
|
||||
var res = HttpHelper.PostSend(url, "");
|
||||
var res = await url.GetStringAsync();
|
||||
var resObj = JObject.Parse(res);
|
||||
if (!resObj.ContainsKey("validated"))
|
||||
{
|
||||
|
||||
@@ -1,3 +1,41 @@
|
||||
## 2.0.19(2021-12-29)
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
1. 优化微信小程序包体积可在微信中预览,请升级HbuilderX3.3.4,同时在“运行->运行到小程序模拟器”中勾选“运行时是否压缩代码”
|
||||
2. 优化微信小程序setData性能,处理某些方法如$u.route()无法在模板中使用的问题
|
||||
3. navbar添加autoBack参数
|
||||
4. 允许avatar组件的事件冒泡
|
||||
5. 修复cell组件报错问题
|
||||
6. 其他修复
|
||||
## 2.0.18(2021-12-28)
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
1. 修复app端编译报错问题
|
||||
2. 重新处理微信小程序端setData过大的性能问题
|
||||
3. 修复边框问题
|
||||
4. 修复最大最小月份不大于0则没有数据出现的问题
|
||||
5. 修复SwipeAction微信小程序端无法上下滑动问题
|
||||
6. 修复input的placeholder在小程序端默认显示为true问题
|
||||
7. 修复divider组件click事件无效问题
|
||||
8. 修复u-code-input maxlength 属性值为 String 类型时显示异常
|
||||
9. 修复当 grid只有 1到2时 在小程序端algin设置无效的问题
|
||||
10. 处理form-item的label为top时,取消错误提示的左边距
|
||||
11. 其他修复
|
||||
## 2.0.17(2021-12-26)
|
||||
## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583)
|
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
1. 解决HBuilderX3.3.3.20211225版本导致的样式问题
|
||||
2. calendar日历添加monthNum参数
|
||||
3. navbar添加center slot
|
||||
## 2.0.16(2021-12-25)
|
||||
## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583)
|
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖
|
||||
|
||||
1. 解决微信小程序setData性能问题
|
||||
2. 修复count-down组件change事件不触发问题
|
||||
## 2.0.15(2021-12-21)
|
||||
## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583)
|
||||
|
||||
|
||||
@@ -20,7 +20,14 @@
|
||||
@click="$emit('click')"
|
||||
@error="$emit('error')"
|
||||
@load="$emit('load')"
|
||||
></uvImage>
|
||||
>
|
||||
<template v-slot:loading>
|
||||
<slot name="loading"></slot>
|
||||
</template>
|
||||
<template v-slot:error>
|
||||
<slot name="error"></slot>
|
||||
</template>
|
||||
</uvImage>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -143,12 +143,12 @@ export default {
|
||||
return arr
|
||||
},
|
||||
imageWidth() {
|
||||
return this.$u.addUnit(
|
||||
return uni.$u.addUnit(
|
||||
this.urls.length === 1 ? this.singleWidth : this.multipleSize
|
||||
)
|
||||
},
|
||||
imageHeight() {
|
||||
return this.$u.addUnit(
|
||||
return uni.$u.addUnit(
|
||||
this.urls.length === 1 ? this.singleHeight : this.multipleSize
|
||||
)
|
||||
},
|
||||
|
||||
@@ -190,7 +190,7 @@ export default {
|
||||
// 如果有设置color值,则用color值,否则使用type主题颜色
|
||||
return this.color
|
||||
? this.color
|
||||
: this.$u.config.color[`u-${this.type}`];
|
||||
: uni.$u.config.color[`u-${this.type}`];
|
||||
}
|
||||
if (this.type === "info") {
|
||||
return "#c9c9c9";
|
||||
|
||||
@@ -328,7 +328,7 @@
|
||||
getMonthRectByPromise(el) {
|
||||
// #ifndef APP-NVUE
|
||||
// $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://www.uviewui.com/js/getRect.html
|
||||
// 组件内部一般用this.$uGetRect,对外的为this.$u.getRect,二者功能一致,名称不同
|
||||
// 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同
|
||||
return new Promise(resolve => {
|
||||
this.$uGetRect(`.${el}`).then(size => {
|
||||
resolve(size)
|
||||
|
||||
@@ -134,6 +134,11 @@ export default {
|
||||
round: {
|
||||
type: [Boolean, String, Number],
|
||||
default: uni.$u.props.calendar.round
|
||||
},
|
||||
// 最多展示月份数量
|
||||
monthNum: {
|
||||
type: [Number, String],
|
||||
default: 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+298
-244
@@ -1,73 +1,75 @@
|
||||
<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="{
|
||||
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="minDate"
|
||||
:maxDate="maxDate"
|
||||
:maxMonth="maxMonth"
|
||||
: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>
|
||||
<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="
|
||||
buttonDisabled ? confirmDisabledText : confirmText
|
||||
"
|
||||
:color="color"
|
||||
@click="confirm"
|
||||
:disabled="buttonDisabled"
|
||||
></u-button>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
</u-popup>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import uHeader from './header.vue';
|
||||
import uMonth from './month.vue';
|
||||
import props from './props.js';
|
||||
import util from './util.js';
|
||||
import dayjs from '../../libs/util/dayjs.js';
|
||||
import Calendar from '../../libs/util/calendar.js';
|
||||
/**
|
||||
import uHeader from './header.vue'
|
||||
import uMonth from './month.vue'
|
||||
import props from './props.js'
|
||||
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
|
||||
@@ -98,192 +100,244 @@
|
||||
* @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: [],
|
||||
// 如果没有设置最大可选日期,默认为往后推3个月
|
||||
maxMonth: 3,
|
||||
scrollIntoView: '',
|
||||
// 过滤处理方法
|
||||
innerFormatter: value => value
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
selectedChange: {
|
||||
immediate: true,
|
||||
handler(n) {
|
||||
this.setMonth()
|
||||
}
|
||||
},
|
||||
// 打开弹窗时,设置月份数据
|
||||
show: {
|
||||
immediate: true,
|
||||
handler(n) {
|
||||
this.setMonth()
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
// 多个条件的变化,会引起选中日期的变化,这里统一管理监听
|
||||
selectedChange() {
|
||||
return [this.minDate, this.maxDate, 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() {
|
||||
// 滚动区域的高度
|
||||
this.listHeight = this.rowHeight * 5 + 30
|
||||
this.setMonth()
|
||||
},
|
||||
close() {
|
||||
this.$emit('close')
|
||||
},
|
||||
// 点击确定按钮
|
||||
confirm() {
|
||||
if (!this.buttonDisabled) {
|
||||
this.$emit('confirm', this.selected)
|
||||
}
|
||||
},
|
||||
// 设置月份数据
|
||||
setMonth() {
|
||||
// 最小日期的毫秒数
|
||||
const minDate = this.minDate || dayjs().valueOf()
|
||||
// 如果没有指定最大日期,则往后推3个月
|
||||
const maxDate = this.maxDate || dayjs(minDate).add(this.maxMonth - 1, 'month').valueOf()
|
||||
// 最小与最大月份
|
||||
let minMonth = dayjs(minDate).month() + 1
|
||||
let maxMonth = dayjs(maxDate).month() + 1
|
||||
// 如果maxMonth小于minMonth,则意味着maxMonth为下一年的月份,需要加上12,为的是计算出两个月份之间间隔着多少月份
|
||||
maxMonth = minMonth > maxMonth ? maxMonth + 12 : maxMonth
|
||||
// 最大最小月份之间的共有多少个月份
|
||||
const months = Math.abs(minMonth - maxMonth)
|
||||
// 先清空数组
|
||||
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-6,0为周日
|
||||
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
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
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-6,0为周日
|
||||
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
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "../../libs/css/components.scss";
|
||||
@import '../../libs/css/components.scss';
|
||||
|
||||
.u-calendar {
|
||||
|
||||
&__confirm {
|
||||
padding: 7px 18px;
|
||||
}
|
||||
}
|
||||
.u-calendar {
|
||||
&__confirm {
|
||||
padding: 7px 18px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+2
-2
@@ -129,7 +129,7 @@
|
||||
];
|
||||
let tmp = [];
|
||||
// 打乱顺序
|
||||
if (this.random) data = this.$u.randomArray(data);
|
||||
if (this.random) data = uni.$u.randomArray(data);
|
||||
// 切割成二维数组
|
||||
tmp[0] = data.slice(0, 10);
|
||||
tmp[1] = data.slice(10, 20);
|
||||
@@ -177,7 +177,7 @@
|
||||
'M'
|
||||
];
|
||||
let tmp = [];
|
||||
if (this.random) data = this.$u.randomArray(data);
|
||||
if (this.random) data = uni.$u.randomArray(data);
|
||||
tmp[0] = data.slice(0, 10);
|
||||
tmp[1] = data.slice(10, 20);
|
||||
tmp[2] = data.slice(20, 30);
|
||||
|
||||
@@ -77,18 +77,24 @@ export default {
|
||||
},
|
||||
// 左侧图标样式
|
||||
iconStyle: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
type: [Object, String],
|
||||
default: () => {
|
||||
return uni.$u.props.cell.iconStyle
|
||||
}
|
||||
},
|
||||
// 右侧箭头图标的样式
|
||||
rightIconStyle: {
|
||||
type: Object,
|
||||
default: () => uni.$u.props.cell.rightIconStyle
|
||||
type: [Object, String],
|
||||
default: () => {
|
||||
return uni.$u.props.cell.rightIconStyle
|
||||
}
|
||||
},
|
||||
// 标题的样式
|
||||
titleStyle: {
|
||||
type: Object,
|
||||
default: () => uni.$u.props.cell.titleStyle
|
||||
type: [Object, String],
|
||||
default: () => {
|
||||
return uni.$u.props.cell.titleStyle
|
||||
}
|
||||
},
|
||||
// 单位元的大小,可选值为large
|
||||
size: {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</view>
|
||||
<view class="u-cell__title">
|
||||
<slot name="title">
|
||||
<text v-if="title" class="u-cell__title-text"
|
||||
<text v-if="title" class="u-cell__title-text" :style="[titleTextStyle]"
|
||||
:class="[disabled && 'u-cell--disabled', size === 'large' && 'u-cell__title-text--large']">{{ title }}</text>
|
||||
</slot>
|
||||
<slot name="label">
|
||||
@@ -58,8 +58,9 @@
|
||||
* @property {Boolean} required 是否显示表单状态下的必填星号(此组件可能会内嵌入input组件) (默认 false )
|
||||
* @property {String} rightIcon 右侧的图标箭头 (默认 'arrow-right')
|
||||
* @property {String} arrowDirection 右侧箭头的方向,可选值为:left,up,down
|
||||
* @property {Object} rightIconStyle 右侧箭头图标的样式
|
||||
* @property {Object} titleStyle 标题的样式
|
||||
* @property {Object | String} rightIconStyle 右侧箭头图标的样式
|
||||
* @property {Object | String} titleStyle 标题的样式
|
||||
* @property {Object | String} iconStyle 左侧图标样式
|
||||
* @property {String} size 单位元的大小,可选值为 large,normal,mini
|
||||
* @property {Boolean} stop 点击cell是否阻止事件传播 (默认 true )
|
||||
* @property {Object} customStyle 定义需要用到的外部样式
|
||||
@@ -75,6 +76,11 @@
|
||||
}
|
||||
},
|
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin, props],
|
||||
computed: {
|
||||
titleTextStyle() {
|
||||
return uni.$u.addStyle(this.titleStyle)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 点击cell
|
||||
clickHandler(e) {
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@
|
||||
computed: {
|
||||
// 根据长度,循环输入框的个数,因为头条小程序数值不能用于v-for
|
||||
codeLength() {
|
||||
return new Array(this.maxlength)
|
||||
return new Array(Number(this.maxlength))
|
||||
},
|
||||
// 循环item的样式
|
||||
itemStyle() {
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@
|
||||
queryRect() {
|
||||
// #ifndef APP-NVUE
|
||||
// $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://www.uviewui.com/js/getRect.html
|
||||
// 组件内部一般用this.$uGetRect,对外的为this.$u.getRect,二者功能一致,名称不同
|
||||
// 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同
|
||||
return new Promise(resolve => {
|
||||
this.$uGetRect(`#${this.elId}`).then(size => {
|
||||
resolve(size)
|
||||
|
||||
+18
-17
@@ -97,7 +97,7 @@
|
||||
if (this.remainTime !== 0) {
|
||||
this.microTick()
|
||||
}
|
||||
}, 30)
|
||||
}, 50)
|
||||
},
|
||||
// 获取剩余的时间
|
||||
getRemainTime() {
|
||||
@@ -109,10 +109,7 @@
|
||||
this.remainTime = remain
|
||||
// 根据剩余的毫秒时间,得出该有天,小时,分钟等的值,返回一个对象
|
||||
const timeData = parseTimeData(remain)
|
||||
// 如果有传入slot内容,则发出change事件
|
||||
if(this.$slots.default || this.$slots.$default) {
|
||||
this.$emit('change', timeData)
|
||||
}
|
||||
this.$emit('change', timeData)
|
||||
// 得出格式化后的时间
|
||||
this.formattedTime = parseFormat(this.format, timeData)
|
||||
// 如果时间已到,停止倒计时
|
||||
@@ -123,17 +120,17 @@
|
||||
},
|
||||
// 重置倒计时
|
||||
reset() {
|
||||
this.pause()
|
||||
this.remainTime = this.time
|
||||
this.setRemainTime(this.remainTime)
|
||||
if (this.autoStart) {
|
||||
this.start()
|
||||
}
|
||||
this.pause()
|
||||
this.remainTime = this.time
|
||||
this.setRemainTime(this.remainTime)
|
||||
if (this.autoStart) {
|
||||
this.start()
|
||||
}
|
||||
},
|
||||
// 暂停倒计时
|
||||
pause() {
|
||||
this.runing = false;
|
||||
this.clearTimeout()
|
||||
this.runing = false;
|
||||
this.clearTimeout()
|
||||
},
|
||||
// 清空定时器
|
||||
clearTimeout() {
|
||||
@@ -147,16 +144,20 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
<style
|
||||
lang="scss"
|
||||
scoped
|
||||
>
|
||||
@import "../../libs/css/components.scss";
|
||||
$u-count-down-text-color:$u-content-color !default;
|
||||
$u-count-down-text-font-size:15px !default;
|
||||
$u-count-down-text-line-height:22px !default;
|
||||
|
||||
.u-count-down {
|
||||
&__text {
|
||||
color:$u-count-down-text-color;
|
||||
font-size:$u-count-down-text-font-size;
|
||||
line-height:$u-count-down-text-line-height;
|
||||
color: $u-count-down-text-color;
|
||||
font-size: $u-count-down-text-font-size;
|
||||
line-height: $u-count-down-text-line-height;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<view
|
||||
class="u-divider"
|
||||
:style="[$u.addStyle(customStyle)]"
|
||||
@tap="click"
|
||||
>
|
||||
<u-line
|
||||
:color="lineColor"
|
||||
|
||||
+8
-2
@@ -9,6 +9,7 @@
|
||||
>
|
||||
<!-- 微信小程序中,将一个参数设置空字符串,结果会变成字符串"true" -->
|
||||
<slot name="label">
|
||||
<!-- {{required}} -->
|
||||
<view
|
||||
class="u-form-item__body__left"
|
||||
v-if="required || leftIcon || label"
|
||||
@@ -61,13 +62,13 @@
|
||||
v-if="!!message && parentData.errorType === 'message'"
|
||||
class="u-form-item__body__right__message"
|
||||
:style="{
|
||||
marginLeft: $u.addUnit(labelWidth || parentData.labelWidth)
|
||||
marginLeft: $u.addUnit(parentData.labelPosition === 'top' ? 0 : (labelWidth || parentData.labelWidth))
|
||||
}"
|
||||
>{{ message }}</text>
|
||||
</slot>
|
||||
<u-line
|
||||
v-if="borderBottom"
|
||||
:color="message && parentData.errorType === 'border-bottom' ? $u.color.error : $u.props.line.color"
|
||||
:color="message && parentData.errorType === 'border-bottom' ? $u.color.error : propsLine.color"
|
||||
:customStyle="`margin-top: ${message ? '5px' : 0}`"
|
||||
></u-line>
|
||||
</view>
|
||||
@@ -111,6 +112,11 @@
|
||||
}
|
||||
},
|
||||
// 组件创建完成时,将当前实例保存到u-form中
|
||||
computed: {
|
||||
propsLine() {
|
||||
return uni.$u.props.line
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
},
|
||||
|
||||
@@ -90,10 +90,8 @@
|
||||
display: block;
|
||||
/* #endif */
|
||||
justify-content: center;
|
||||
/* #ifndef MP */
|
||||
@include flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
/* #endif */
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
// classes.push(this.customPrefix)
|
||||
// }
|
||||
// 主题色,通过类配置
|
||||
if (this.color && this.$u.config.type.includes(this.color)) classes.push('u-icon__icon--' + this.color)
|
||||
if (this.color && uni.$u.config.type.includes(this.color)) classes.push('u-icon__icon--' + this.color)
|
||||
// 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别
|
||||
// 故需将其拆成一个字符串的形式,通过空格隔开各个类名
|
||||
//#ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU
|
||||
@@ -107,14 +107,14 @@
|
||||
iconStyle() {
|
||||
let style = {}
|
||||
style = {
|
||||
fontSize: this.$u.addUnit(this.size),
|
||||
lineHeight: this.$u.addUnit(this.size),
|
||||
fontSize: uni.$u.addUnit(this.size),
|
||||
lineHeight: uni.$u.addUnit(this.size),
|
||||
fontWeight: this.bold ? 'bold' : 'normal',
|
||||
// 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
|
||||
top: this.$u.addUnit(this.top)
|
||||
top: uni.$u.addUnit(this.top)
|
||||
}
|
||||
// 非主题色值时,才当作颜色值
|
||||
if (this.color && !this.$u.config.type.includes(this.color)) style.color = this.color
|
||||
if (this.color && !uni.$u.config.type.includes(this.color)) style.color = this.color
|
||||
|
||||
return style
|
||||
},
|
||||
@@ -125,8 +125,8 @@
|
||||
imgStyle() {
|
||||
let style = {}
|
||||
// 如果设置width和height属性,则优先使用,否则使用size属性
|
||||
style.width = this.width ? this.$u.addUnit(this.width) : this.$u.addUnit(this.size)
|
||||
style.height = this.height ? this.$u.addUnit(this.height) : this.$u.addUnit(this.size)
|
||||
style.width = this.width ? uni.$u.addUnit(this.width) : uni.$u.addUnit(this.size)
|
||||
style.height = this.height ? uni.$u.addUnit(this.height) : uni.$u.addUnit(this.size)
|
||||
return style
|
||||
},
|
||||
// 通过图标名,查找对应的图标
|
||||
@@ -139,7 +139,7 @@
|
||||
clickHandler(e) {
|
||||
this.$emit('click', this.index)
|
||||
// 是否阻止事件冒泡
|
||||
this.stop && this.$u.preventEvent(e)
|
||||
this.stop && uni.$u.preventEvent(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,9 @@
|
||||
class="u-image__loading"
|
||||
:style="{
|
||||
borderRadius: shape == 'circle' ? '50%' : $u.addUnit(radius),
|
||||
backgroundColor: this.bgColor
|
||||
backgroundColor: this.bgColor,
|
||||
width: $u.addUnit(width),
|
||||
height: $u.addUnit(height)
|
||||
}"
|
||||
>
|
||||
<slot name="loading">
|
||||
@@ -44,7 +46,9 @@
|
||||
v-if="showError && isError && !loading"
|
||||
class="u-image__error"
|
||||
:style="{
|
||||
borderRadius: shape == 'circle' ? '50%' : $u.addUnit(radius)
|
||||
borderRadius: shape == 'circle' ? '50%' : $u.addUnit(radius),
|
||||
width: $u.addUnit(width),
|
||||
height: $u.addUnit(height)
|
||||
}"
|
||||
>
|
||||
<slot name="error">
|
||||
@@ -113,9 +117,10 @@
|
||||
if (!n) {
|
||||
// 如果传入null或者'',或者false,或者undefined,标记为错误状态
|
||||
this.isError = true
|
||||
this.loading = false
|
||||
|
||||
} else {
|
||||
this.isError = false
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +129,7 @@
|
||||
wrapStyle() {
|
||||
let style = {};
|
||||
// 如果是显示圆形,设置一个很多的半径值即可
|
||||
style.borderRadius = this.shape == 'circle' ? '10000px' : this.$u.addUnit(this.radius)
|
||||
style.borderRadius = this.shape == 'circle' ? '10000px' : uni.$u.addUnit(this.radius)
|
||||
// 如果设置圆角,必须要有hidden,否则可能圆角无效
|
||||
style.overflow = this.borderRadius > 0 ? 'hidden' : 'visible'
|
||||
// if (this.fade) {
|
||||
|
||||
@@ -188,7 +188,7 @@ export default {
|
||||
style.paddingLeft = "9px";
|
||||
style.paddingRight = "9px";
|
||||
}
|
||||
return uni.$u.deepMerge(style, this.$u.addStyle(this.customStyle));
|
||||
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle));
|
||||
},
|
||||
// 输入框的样式
|
||||
inputStyle() {
|
||||
|
||||
@@ -34,13 +34,13 @@
|
||||
// 此处采用兼容分开写,兼容nvue的写法
|
||||
style.borderBottomWidth = '1px'
|
||||
style.borderBottomStyle = this.dashed ? 'dashed' : 'solid'
|
||||
style.width = this.$u.addUnit(this.length)
|
||||
style.width = uni.$u.addUnit(this.length)
|
||||
if (this.hairline) style.transform = 'scaleY(0.5)'
|
||||
} else {
|
||||
// 如果是竖向线条,边框宽度为1px,再通过transform缩小一半,就是0.5px了
|
||||
style.borderLeftWidth = '1px'
|
||||
style.borderLeftStyle = this.dashed ? 'dashed' : 'solid'
|
||||
style.height = this.$u.addUnit(this.length)
|
||||
style.height = uni.$u.addUnit(this.length)
|
||||
if (this.hairline) style.transform = 'scaleX(0.5)'
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,16 @@ export default {
|
||||
leftIconSize: {
|
||||
type: [String, Number],
|
||||
default: uni.$u.props.navbar.leftIconSize
|
||||
},
|
||||
// 左侧返回图标的颜色
|
||||
leftIconColor: {
|
||||
type: String,
|
||||
default: uni.$u.props.navbar.leftIconColor
|
||||
},
|
||||
// 点击左侧区域(返回图标),是否自动返回上一页
|
||||
autoBack: {
|
||||
type: Boolean,
|
||||
default: uni.$u.props.navbar.autoBack
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,19 +31,25 @@
|
||||
v-if="leftIcon"
|
||||
:name="leftIcon"
|
||||
:size="leftIconSize"
|
||||
:color="leftIconColor"
|
||||
></u-icon>
|
||||
<text
|
||||
v-if="leftText"
|
||||
:style="{
|
||||
color: leftIconColor
|
||||
}"
|
||||
class="u-navbar__content__left__text"
|
||||
>{{ leftText }}</text>
|
||||
</slot>
|
||||
</view>
|
||||
<text
|
||||
class="u-line-1 u-navbar__content__title"
|
||||
:style="{
|
||||
width: $u.addUnit(titleWidth)
|
||||
}"
|
||||
>{{ title }}</text>
|
||||
<slot name="center">
|
||||
<text
|
||||
class="u-line-1 u-navbar__content__title"
|
||||
:style="{
|
||||
width: $u.addUnit(titleWidth)
|
||||
}"
|
||||
>{{ title }}</text>
|
||||
</slot>
|
||||
<view
|
||||
class="u-navbar__content__right"
|
||||
v-if="$slots.right || rightIcon || rightText"
|
||||
@@ -72,7 +78,7 @@
|
||||
* Navbar 自定义导航栏
|
||||
* @description 此组件一般用于在特殊情况下,需要自定义导航栏的时候用到,一般建议使用uni-app带的导航栏。
|
||||
* @tutorial https://www.uviewui.com/components/navbar.html
|
||||
* @property {Boolean} safeAreaInsetTop 是否开启顶部安全区适配 (默认 false )
|
||||
* @property {Boolean} safeAreaInsetTop 是否开启顶部安全区适配 (默认 true )
|
||||
* @property {Boolean} placeholder 固定在顶部时,是否生成一个等高元素,以防止塌陷 (默认 false )
|
||||
* @property {Boolean} fixed 导航栏是否固定在顶部 (默认 false )
|
||||
* @property {Boolean} border 导航栏底部是否显示下边框 (默认 false )
|
||||
@@ -85,6 +91,8 @@
|
||||
* @property {String | Number} titleWidth 导航栏标题的最大宽度,内容超出会以省略号隐藏 (默认 '400rpx' )
|
||||
* @property {String | Number} height 导航栏高度(不包括状态栏高度在内,内部自动加上)(默认 '44px' )
|
||||
* @property {String | Number} leftIconSize 左侧返回图标的大小(默认 20px )
|
||||
* @property {String | Number} leftIconColor 左侧返回图标的颜色(默认 #303133 )
|
||||
* @property {Boolean} autoBack 点击左侧区域(返回图标),是否自动返回上一页(默认 false )
|
||||
* @event {Function} leftClick 点击左侧区域
|
||||
* @event {Function} rightClick 点击右侧区域
|
||||
* @example <u-navbar title="剑未配妥,出门已是江湖" left-text="返回" right-text="帮助" @click-left="onClickBack" @click-right="onClickRight"></u-navbar>
|
||||
@@ -100,7 +108,11 @@
|
||||
methods: {
|
||||
// 点击左侧区域
|
||||
leftClick() {
|
||||
// 如果配置了autoBack,自动返回上一页
|
||||
this.$emit('leftClick')
|
||||
if(this.autoBack) {
|
||||
uni.navigateBack()
|
||||
}
|
||||
},
|
||||
// 点击右侧区域
|
||||
rightClick() {
|
||||
@@ -148,7 +160,7 @@
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
&__txet {
|
||||
&__text {
|
||||
font-size: 15px;
|
||||
margin-left: 3px;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
methods: {
|
||||
show(options) {
|
||||
// 不将结果合并到this.config变量,避免多次调用u-toast,前后的配置造成混乱
|
||||
this.tmpConfig = this.$u.deepMerge(this.config, options)
|
||||
this.tmpConfig = uni.$u.deepMerge(this.config, options)
|
||||
// 任何定时器初始化之前,都要执行清除操作,否则可能会造成混乱
|
||||
this.clearTimer()
|
||||
this.open = true
|
||||
|
||||
+3
-3
@@ -142,7 +142,7 @@
|
||||
return (type) => {
|
||||
const style = {
|
||||
backgroundColor: this.bgColor,
|
||||
height: this.$u.addUnit(this.buttonSize),
|
||||
height: uni.$u.addUnit(this.buttonSize),
|
||||
color: this.color
|
||||
}
|
||||
if (this.isDisabled(type)) {
|
||||
@@ -157,8 +157,8 @@
|
||||
const style = {
|
||||
color: this.color,
|
||||
backgroundColor: this.bgColor,
|
||||
height: this.$u.addUnit(this.buttonSize),
|
||||
width: this.$u.addUnit(this.inputWidth)
|
||||
height: uni.$u.addUnit(this.buttonSize),
|
||||
width: uni.$u.addUnit(this.inputWidth)
|
||||
}
|
||||
return style
|
||||
},
|
||||
|
||||
+3
-3
@@ -70,19 +70,19 @@
|
||||
if (!this.random) {
|
||||
return [1, 2, 3, 4, 5, 6, 7, 8, 9, 0];
|
||||
} else {
|
||||
return this.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
|
||||
return uni.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
|
||||
}
|
||||
} else if (!this.dotDisabled && this.mode == 'number') {
|
||||
if (!this.random) {
|
||||
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0];
|
||||
} else {
|
||||
return this.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0]);
|
||||
return uni.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.dot, 0]);
|
||||
}
|
||||
} else if (this.mode == 'card') {
|
||||
if (!this.random) {
|
||||
return [1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0];
|
||||
} else {
|
||||
return this.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0]);
|
||||
return uni.$u.randomArray([1, 2, 3, 4, 5, 6, 7, 8, 9, this.cardX, 0]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
></u-toolbar>
|
||||
<picker-view
|
||||
class="u-picker__view"
|
||||
:indicatorStyle="`height: ${itemHeight}px`"
|
||||
:indicatorStyle="`height: ${$u.addUnit(itemHeight)}`"
|
||||
:value="innerIndex"
|
||||
:style="{
|
||||
height: `${visibleItemCount * itemHeight}px`
|
||||
height: `${$u.addUnit(visibleItemCount * itemHeight)}`
|
||||
}"
|
||||
@change="changeHandler"
|
||||
>
|
||||
|
||||
@@ -95,27 +95,27 @@
|
||||
}
|
||||
style[this.mode] = 0
|
||||
if (this.mode === 'left') {
|
||||
return this.$u.deepMerge(style, {
|
||||
return uni.$u.deepMerge(style, {
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
})
|
||||
} else if (this.mode === 'right') {
|
||||
return this.$u.deepMerge(style, {
|
||||
return uni.$u.deepMerge(style, {
|
||||
bottom: 0,
|
||||
top: 0,
|
||||
})
|
||||
} else if (this.mode === 'top') {
|
||||
return this.$u.deepMerge(style, {
|
||||
return uni.$u.deepMerge(style, {
|
||||
left: 0,
|
||||
right: 0
|
||||
})
|
||||
} else if (this.mode === 'bottom') {
|
||||
return this.$u.deepMerge(style, {
|
||||
return uni.$u.deepMerge(style, {
|
||||
left: 0,
|
||||
right: 0,
|
||||
})
|
||||
} else if (this.mode === 'center') {
|
||||
return this.$u.deepMerge(style, {
|
||||
return uni.$u.deepMerge(style, {
|
||||
alignItems: 'center',
|
||||
'justify-content': 'center',
|
||||
top: 0,
|
||||
|
||||
+3
@@ -38,6 +38,9 @@
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.u-status-bar {
|
||||
// nvue会默认100%,如果nvue下,显式写100%的话,会导致宽度不为100%而异常
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
/* #endif */
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
if (this.cssSticky) {
|
||||
style.position = 'sticky'
|
||||
style.zIndex = this.uZindex
|
||||
style.top = this.$u.addUnit(this.stickyTop)
|
||||
style.top = uni.$u.addUnit(this.stickyTop)
|
||||
} else {
|
||||
style.height = this.fixed ? this.height + 'px' : 'auto'
|
||||
}
|
||||
@@ -65,7 +65,7 @@
|
||||
// #endif
|
||||
}
|
||||
style.backgroundColor = this.bgColor
|
||||
return this.$u.deepMerge(uni.$u.addStyle(this.customStyle), style)
|
||||
return uni.$u.deepMerge(uni.$u.addStyle(this.customStyle), style)
|
||||
},
|
||||
// 吸顶内容的样式
|
||||
stickyContent() {
|
||||
@@ -152,7 +152,7 @@
|
||||
// #endif
|
||||
|
||||
// 如果安卓版本高于8.0,依然认为是支持css sticky的(因为安卓7在某些机型,可能不支持sticky)
|
||||
if (this.$u.os() === 'android' && Number(this.$u.sys().system) > 8) {
|
||||
if (uni.$u.os() === 'android' && Number(uni.$u.sys().system) > 8) {
|
||||
this.cssSticky = true
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
// #endif
|
||||
|
||||
// ios上,从ios6开始,都是支持css sticky的
|
||||
if (this.$u.os() === 'ios') {
|
||||
if (uni.$u.os() === 'ios') {
|
||||
this.cssSticky = true
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@
|
||||
.u-swipe-action-item {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
/* #ifndef APP-NVUE */
|
||||
/* #ifndef APP-NVUE || MP-WEIXIN */
|
||||
touch-action: none;
|
||||
/* #endif */
|
||||
|
||||
|
||||
@@ -34,16 +34,16 @@
|
||||
>{{ item[keyName] }}</text>
|
||||
<u-badge
|
||||
:show="!!(item.badge && (item.badge.show || item.badge.isDot || item.badge.value))"
|
||||
:isDot="item.badge && item.badge.isDot || $u.props.badge.isDot"
|
||||
:value="item.badge && item.badge.value || $u.props.badge.value"
|
||||
:max="item.badge && item.badge.max || $u.props.badge.max"
|
||||
:type="item.badge && item.badge.type || $u.props.badge.type"
|
||||
:showZero="item.badge && item.badge.showZero || $u.props.badge.showZero"
|
||||
:bgColor="item.badge && item.badge.bgColor || $u.props.badge.bgColor"
|
||||
:color="item.badge && item.badge.color || $u.props.badge.color"
|
||||
:shape="item.badge && item.badge.shape || $u.props.badge.shape"
|
||||
:numberType="item.badge && item.badge.numberType || $u.props.badge.numberType"
|
||||
:inverted="item.badge && item.badge.inverted || $u.props.badge.inverted"
|
||||
:isDot="item.badge && item.badge.isDot || propsBadge.isDot"
|
||||
:value="item.badge && item.badge.value || propsBadge.value"
|
||||
:max="item.badge && item.badge.max || propsBadge.max"
|
||||
:type="item.badge && item.badge.type || propsBadge.type"
|
||||
:showZero="item.badge && item.badge.showZero || propsBadge.showZero"
|
||||
:bgColor="item.badge && item.badge.bgColor || propsBadge.bgColor"
|
||||
:color="item.badge && item.badge.color || propsBadge.color"
|
||||
:shape="item.badge && item.badge.shape || propsBadge.shape"
|
||||
:numberType="item.badge && item.badge.numberType || propsBadge.numberType"
|
||||
:inverted="item.badge && item.badge.inverted || propsBadge.inverted"
|
||||
customStyle="margin-left: 4px;"
|
||||
></u-badge>
|
||||
</view>
|
||||
@@ -147,6 +147,9 @@
|
||||
}
|
||||
return uni.$u.deepMerge(customeStyle, style)
|
||||
}
|
||||
},
|
||||
propsBadge() {
|
||||
return uni.$u.props.badge
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
@@ -275,7 +278,7 @@
|
||||
queryRect(el, item) {
|
||||
// #ifndef APP-NVUE
|
||||
// $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://www.uviewui.com/js/getRect.html
|
||||
// 组件内部一般用this.$uGetRect,对外的为this.$u.getRect,二者功能一致,名称不同
|
||||
// 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同
|
||||
return new Promise(resolve => {
|
||||
this.$uGetRect(`.${el}`).then(size => {
|
||||
resolve(size)
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
return '';
|
||||
}
|
||||
if (['error', 'warning', 'success', 'primary'].includes(this.tmpConfig.type)) {
|
||||
return this.$u.type2icon(this.tmpConfig.type)
|
||||
return uni.$u.type2icon(this.tmpConfig.type)
|
||||
} else {
|
||||
return ''
|
||||
}
|
||||
@@ -151,7 +151,7 @@
|
||||
// 显示toast组件,由父组件通过this.$refs.xxx.show(options)形式调用
|
||||
show(options) {
|
||||
// 不将结果合并到this.config变量,避免多次调用u-toast,前后的配置造成混乱
|
||||
this.tmpConfig = this.$u.deepMerge(this.config, options)
|
||||
this.tmpConfig = uni.$u.deepMerge(this.config, options)
|
||||
// 清除定时器
|
||||
this.clearTimer()
|
||||
this.isShow = true
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@
|
||||
queryRect(ref) {
|
||||
// #ifndef APP-NVUE
|
||||
// $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://www.uviewui.com/js/getRect.html
|
||||
// 组件内部一般用this.$uGetRect,对外的为this.$u.getRect,二者功能一致,名称不同
|
||||
// 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同
|
||||
return new Promise(resolve => {
|
||||
this.$uGetRect(`#${ref}`).then(size => {
|
||||
resolve(size)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 此版本发布于2020-12-21
|
||||
const version = '2.0.15'
|
||||
// 此版本发布于2020-12-29
|
||||
const version = '2.0.19'
|
||||
|
||||
export default {
|
||||
v: version,
|
||||
|
||||
@@ -36,6 +36,7 @@ export default {
|
||||
rangePrompt: '',
|
||||
showRangePrompt: true,
|
||||
allowSameDay: false,
|
||||
round: 0
|
||||
round: 0,
|
||||
monthNum: 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,28 +8,29 @@
|
||||
* @FilePath : /u-view2.0/uview-ui/libs/config/props/cell.js
|
||||
*/
|
||||
export default {
|
||||
// cell组件的props
|
||||
cell: {
|
||||
customClass: '',
|
||||
title: '',
|
||||
label: '',
|
||||
value: '',
|
||||
icon: '',
|
||||
titleWidth: '',
|
||||
disabled: false,
|
||||
border: true,
|
||||
center: false,
|
||||
url: '',
|
||||
linkType: 'navigateTo',
|
||||
clickable: false,
|
||||
isLink: false,
|
||||
required: false,
|
||||
arrowDirection: '',
|
||||
rightIconStyle: {},
|
||||
rightIcon: 'arrow-right',
|
||||
titleStyle: {},
|
||||
size: '',
|
||||
stop: true,
|
||||
name: ''
|
||||
}
|
||||
// cell组件的props
|
||||
cell: {
|
||||
customClass: '',
|
||||
title: '',
|
||||
label: '',
|
||||
value: '',
|
||||
icon: '',
|
||||
titleWidth: '',
|
||||
disabled: false,
|
||||
border: true,
|
||||
center: false,
|
||||
url: '',
|
||||
linkType: 'navigateTo',
|
||||
clickable: false,
|
||||
isLink: false,
|
||||
required: false,
|
||||
arrowDirection: '',
|
||||
iconStyle: {},
|
||||
rightIconStyle: {},
|
||||
rightIcon: 'arrow-right',
|
||||
titleStyle: {},
|
||||
size: '',
|
||||
stop: true,
|
||||
name: ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export default {
|
||||
clearable: false,
|
||||
password: false,
|
||||
maxlength: -1,
|
||||
placeholder: '',
|
||||
placeholder: null,
|
||||
placeholderClass: 'input-placeholder',
|
||||
placeholderStyle: 'color: #c0c4cc',
|
||||
showWordLimit: false,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* @lastTime : 2021-08-20 17:16:18
|
||||
* @FilePath : /u-view2.0/uview-ui/libs/config/props/navbar.js
|
||||
*/
|
||||
import color from '../color'
|
||||
export default {
|
||||
// navbar 组件
|
||||
navbar: {
|
||||
@@ -22,7 +23,9 @@ export default {
|
||||
bgColor: '#ffffff',
|
||||
titleWidth: '400rpx',
|
||||
height: '44px',
|
||||
leftIconSize: 20
|
||||
leftIconSize: 20,
|
||||
leftIconColor: color.mainColor,
|
||||
autoBack: false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
}
|
||||
|
||||
|
||||
// /* #ifdef APP-NVUE */
|
||||
// 此处加上!important并非随意乱用,而是因为目前*.nvue页面编译到H5时,
|
||||
// App.vue的样式会被uni-app的view元素的自带border属性覆盖,导致无效
|
||||
// 综上,这是uni-app的缺陷导致我们为了多端兼容,而必须要加上!important
|
||||
@@ -70,7 +69,6 @@
|
||||
border-top-style: solid;
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
// /* #endif */
|
||||
|
||||
// 去除button的所有默认样式,让其表现跟普通的view、text元素一样
|
||||
.u-reset-button {
|
||||
|
||||
@@ -31,13 +31,24 @@ module.exports = {
|
||||
created() {
|
||||
// 组件当中,只有created声明周期,为了能在组件使用,故也在created中将方法挂载到$u
|
||||
this.$u.getRect = this.$uGetRect
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
// 在2.x版本中,将会把$u挂载到uni对象下,导致在模板中无法使用uni.$u.xxx形式
|
||||
// 所以这里通过computed计算属性将其附加到this.$u上,就可以在模板或者js中使用this.$u.xxx
|
||||
$u() {
|
||||
return uni.$u
|
||||
},
|
||||
// 所以这里通过computed计算属性将其附加到this.$u上,就可以在模板或者js中使用uni.$u.xxx
|
||||
// 只在nvue环境通过此方式引入完整的$u,其他平台会出现性能问题,非nvue则按需引入(主要原因是props过大)
|
||||
$u() {
|
||||
// #ifndef APP-NVUE
|
||||
// 在非nvue端,移除props,http,mixin等对象,避免在小程序setData时数据过大影响性能
|
||||
return uni.$u.deepMerge(uni.$u, {
|
||||
props: undefined,
|
||||
http: undefined,
|
||||
mixin: undefined
|
||||
})
|
||||
// #endif
|
||||
// #ifdef APP-NVUE
|
||||
return uni.$u
|
||||
// #endif
|
||||
},
|
||||
/**
|
||||
* 生成bem规则类名
|
||||
* 由于微信小程序,H5,nvue之间绑定class的差异,无法通过:class="[bem()]"的形式进行同用
|
||||
@@ -104,7 +115,7 @@ module.exports = {
|
||||
// 将父组件this中对应的参数,赋值给本组件(u-radio的this)的parentData对象中对应的属性
|
||||
// 之所以需要这么做,是因为所有端中,头条小程序不支持通过this.parent.xxx去监听父组件参数的变化
|
||||
// 此处并不会自动更新子组件的数据,而是依赖父组件u-radio-group去监听data的变化,手动调用更新子组件的方法去重新获取
|
||||
this.parent = this.$u.$parent.call(this, parentName)
|
||||
this.parent = uni.$u.$parent.call(this, parentName)
|
||||
if (this.parent.children) {
|
||||
// 如果父组件的children不存在本组件的实例,才将本实例添加到父组件的children中
|
||||
this.parent.children.indexOf(this) === -1 && this.parent.children.push(this)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"id": "uview-ui",
|
||||
"name": "uview-ui",
|
||||
"displayName": "uView2.0重磅发布,利剑出鞘,一统江湖",
|
||||
"version": "2.0.15",
|
||||
"version": "2.0.19",
|
||||
"description": "uView UI已完美兼容nvue,全面的组件和便捷的工具会让您信手拈来,如鱼得水",
|
||||
"keywords": [
|
||||
"uview",
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* CreateTime: 2020-05-12 0:54:53
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
|
||||
namespace CoreCms.Net.Utility.Helper
|
||||
{
|
||||
/// <summary>
|
||||
/// 模拟标准表单Post提交
|
||||
/// </summary>
|
||||
public static class HttpHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 模拟标准表单Post提交
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="postdate"></param>
|
||||
/// <returns></returns>
|
||||
public static string PostSend(string url, string postdate)
|
||||
{
|
||||
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||
myHttpWebRequest.ContentType = "application/x-www-form-urlencoded;charset=UTF-8";
|
||||
myHttpWebRequest.Method = "POST";
|
||||
Stream myRequestStream = myHttpWebRequest.GetRequestStream();
|
||||
StreamWriter myStreamWriter = new StreamWriter(myRequestStream);
|
||||
myStreamWriter.Write(postdate);
|
||||
myStreamWriter.Flush();
|
||||
myStreamWriter.Close();
|
||||
myRequestStream.Close();
|
||||
|
||||
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
|
||||
Stream myResponseStream = myHttpWebResponse.GetResponseStream();
|
||||
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
|
||||
String outdata = myStreamReader.ReadToEnd();
|
||||
myStreamReader.Close();
|
||||
myResponseStream.Close();
|
||||
return outdata;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="2.2.0" />
|
||||
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="2.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
|
||||
<PackageReference Include="Essensoft.Paylink.Alipay" Version="4.0.7" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.7" />
|
||||
<PackageReference Include="IdentityModel" Version="5.2.0" />
|
||||
<PackageReference Include="Essensoft.Paylink.Alipay" Version="4.0.8" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.8" />
|
||||
<PackageReference Include="IdentityModel" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.0.0" />
|
||||
|
||||
@@ -1257,9 +1257,9 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public WebApiCallBack GetBankCardsOrganization([FromBody] FMStringId entity)
|
||||
public async Task<WebApiCallBack> GetBankCardsOrganization([FromBody] FMStringId entity)
|
||||
{
|
||||
var jm = _userBankCardServices.BankCardsOrganization(entity.id);
|
||||
var jm = await _userBankCardServices.BankCardsOrganization(entity.id);
|
||||
return jm;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
|
||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
|
||||
<PackageReference Include="Essensoft.Paylink.Alipay" Version="4.0.7" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.7" />
|
||||
<PackageReference Include="Essensoft.Paylink.Alipay" Version="4.0.8" />
|
||||
<PackageReference Include="Essensoft.Paylink.WeChatPay" Version="4.0.8" />
|
||||
<PackageReference Include="Hangfire" Version="1.7.28" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.28" />
|
||||
<PackageReference Include="Hangfire.Core" Version="1.7.28" />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user