Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.0-rc.1 #1524

Merged
merged 14 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ toc: false
docClass: timeline
---

## 🌈 1.0.0-rc.1 `2023-01-18`
### ❗ BREAKING CHANGES
- `Dialog`: 移除内置的 input 样式 @LeeJim ([#1516](https://github.com/Tencent/tdesign-miniprogram/pull/1516))
- `Input`: 优化 DOM,移除外置的 wapper 元素 @LeeJim ([#1516](https://github.com/Tencent/tdesign-miniprogram/pull/1516))

### 🚀 Features
- `Cell`: 新增底边框左右边距 CSS Variables @anlyyao ([#1515](https://github.com/Tencent/tdesign-miniprogram/pull/1515))
- `Cell`: 补充 CSS Variables @anlyyao ([#1517](https://github.com/Tencent/tdesign-miniprogram/pull/1517))
- `SideBar`: 支持传入 Icon @LeeJim ([#1520](https://github.com/Tencent/tdesign-miniprogram/pull/1520))
- `Tabs`: 支持传入 icon @LeeJim ([#1519](https://github.com/Tencent/tdesign-miniprogram/pull/1519))
### 🐞 Bug Fixes
- `Upload`: 修复 add-content 不生效的问题 @LeeJim ([#1507](https://github.com/Tencent/tdesign-miniprogram/pull/1507))
- `Upload`: 优化插槽渲染,不再需要传入 add-content = 'slot' @LeeJim ([#1507](https://github.com/Tencent/tdesign-miniprogram/pull/1507))
- `Cascader`: 修复 slot 无法使用的问题 @LeeJim ([#1508](https://github.com/Tencent/tdesign-miniprogram/pull/1508))
- `Picker`: 修复样式、优化布局以及交互体验 @LeeJim ([#1513](https://github.com/Tencent/tdesign-miniprogram/pull/1513))
- `Swiper`: 修复 `autoplay` 状态下,`swiper` 偶现左右抖动问题 @anlyyao ([#1494](https://github.com/Tencent/tdesign-miniprogram/pull/1494))

## 🌈 1.0.0-rc `2023-01-12`
### ❗ Breaking Changes
- 全部组件开启 vritualHost,当基础库版本低于 2.19.2 自动关闭 @LeeJim ([#1495](https://github.com/Tencent/tdesign-miniprogram/pull/1495))
Expand Down
2 changes: 1 addition & 1 deletion example/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"subpackages": [
{
"root": "pages/side-bar/",
"pages": ["side-bar", "base/index", "switch/index", "custom/index"]
"pages": ["side-bar", "base/index", "switch/index", "custom/index", "with-icon/index"]
},
{
"root": "pages/action-sheet/",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tdesign-miniprogram",
"purename": "tdesign",
"version": "1.0.0-rc",
"version": "1.0.0-rc.1",
"description": "tdesign-miniprogram",
"title": "tdesign-miniprogram",
"main": "miniprogram_dist/index.js",
Expand Down
95 changes: 66 additions & 29 deletions script/qrcode/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,45 @@ const fs = require('fs');
const path = require('path');
const { getAccessToken, getUnlimitedQRCode } = require('./api');

// 去读 app.json 中 pages 字段
const { pages } = require('../../example/app.json');

const APP_ID = process.argv[process.argv.indexOf('--APP_ID') + 1]; // 在 --APP_ID 后面
const APP_SECRET = process.argv[process.argv.indexOf('--APP_SECRET') + 1]; // --APP_SECRET 后面

// 去读 app.json 中 pages && subpackages 字段
const { pages, subpackages } = require('../../example/app.json');

const isExistStr = (str, arr) => {
const temp = [...new Set(str.split('/').slice(1))].join('-');
return arr.includes(temp);
};

const getImageList = () => {
const imageFolderDir = path.resolve(__dirname, `../../site/public/assets/qrcode`);
const images = fs.readdirSync(imageFolderDir);
const imageOldList = [];
images.forEach((item) => {
imageOldList.push(item.split('.')[0]);
});
return imageOldList;
};

const getNewPageList = (list) => {
const pageList = [];
const imageOldList = getImageList();
list.forEach((item) => {
if (Object.prototype.toString.call(item) === '[object Object]') {
item.pages.forEach((subItem) => {
if (!isExistStr(item.root + subItem, imageOldList)) {
pageList.push(item.root + subItem);
}
});
} else if (!isExistStr(item, imageOldList)) {
pageList.push(item);
}
});

return pageList;
};

const getUnlimitedQRCodeImage = (appid, appSecret) => {
getAccessToken(appid, appSecret).then((e) => {
if (e.access_token) {
Expand All @@ -22,42 +55,46 @@ const getUnlimitedQRCodeImage = (appid, appSecret) => {
responseType: 'arraybuffer',
};

const pageList = getNewPageList(pages.concat(subpackages));

// 循环 pages, 获取相应小程序码
pages.forEach((item, index) => {
pageList.forEach((item, index) => {
const temp = [...new Set(item.split('/').slice(1))];
const fileName = temp.join('-');

const specialParameter = {
page: item, // 扫码进入的小程序页面路径
scene: `name=${temp[0]}`, // 标识
};
getUnlimitedQRCode(token, { ...specialParameter, ...baseParameter }, { ...baseConfig }).then((res) => {
// 因为微信接口 getwxacodeunlimit 成功时返回的是 Buffer ,失败时返回 JSON 结构。这里把返回数据全部当成 Buffer 处理,所以 res.length < 200, 则表示获取失败。
if (res.length < 200) {
const { errcode, errmsg } = JSON.parse(res.toString());
// eslint-disable-next-line no-console
console.log('===小程序码获取失败===', item, { errcode, errmsg });
return;
}
getUnlimitedQRCode(token, JSON.stringify({ ...specialParameter, ...baseParameter }), { ...baseConfig }).then(
(res) => {
// 因为微信接口 getwxacodeunlimit 成功时返回的是 Buffer ,失败时返回 JSON 结构。这里把返回数据全部当成 Buffer 处理,所以 res.length < 200, 则表示获取失败。
if (res.length < 200) {
const { errcode, errmsg } = JSON.parse(res.toString());
// eslint-disable-next-line no-console
console.log('===小程序码获取失败===', item, { errcode, errmsg });
return;
}

const buffer = Buffer.from(res, 'base64');
const destPath = path.resolve(__dirname, `../../site/public/assets/qrcode/${fileName}.png`);
const buffer = Buffer.from(res, 'base64');
const destPath = path.resolve(__dirname, `../../site/public/assets/qrcode/${fileName}.png`);

fs.writeFile(
destPath,
buffer,
{
encoding: 'binary',
flag: 'w+',
},
(err) => {
if (err) {
// eslint-disable-next-line no-console
console.log('===小程序码图片存储错误===', err);
}
},
);
});
fs.writeFile(
destPath,
buffer,
{
encoding: 'binary',
flag: 'w+',
},
(err) => {
if (err) {
// eslint-disable-next-line no-console
console.log('===小程序码图片存储错误===', err);
}
},
);
},
);
});
}
});
Expand Down
Binary file added site/public/assets/qrcode/calendar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/assets/qrcode/cascader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/assets/qrcode/link.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/assets/qrcode/side-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added site/public/assets/qrcode/tree-select.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/cascader/cascader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const defaultOptionLabel = '选择选项';
export default class Cascader extends SuperComponent {
externalClasses = [`${prefix}-class`];

options: WechatMiniprogram.Component.ComponentOptions = {
multipleSlots: true,
};

properties = props;

data = {
Expand Down
Loading