Compare commits

..
39 Commits
Author SHA1 Message Date
lik 179b059250 增加了商务合作,去掉了医院页面 2026-10-07 16:28:04 +08:00
lik 136b3111cf tmp 2026-10-07 15:51:42 +08:00
lik f0adf77a41 基本重构完成 2026-10-07 14:55:06 +08:00
lik f655c906f5 优化了页面;增加了陪诊师页面 2026-10-06 21:57:12 +08:00
lik 509a10e4f1 tmp 2026-10-06 21:19:20 +08:00
lik 40d0df3330 重构完大部分页面了 2026-10-06 17:58:18 +08:00
lik 530135fce3 tmp 2026-10-04 22:13:54 +08:00
lik f542b1dced 更新了AI页和我的页,一级页面都重构完成。 2026-10-04 21:21:50 +08:00
lik 428fb7c52c AI和Mine页面的样式改成新样式了。 2026-10-04 19:06:45 +08:00
lik 5844272762 首页和服务列表定稿 2026-10-04 12:53:19 +08:00
lik c412964ab6 tmp6 2026-10-03 22:32:50 +08:00
lik a954b78908 怎加了陪诊师页 2026-10-02 16:15:44 +08:00
lik 1b182cd858 tmp 2026-10-02 15:34:58 +08:00
lik 3d20984395 tmp5 2026-10-02 15:29:15 +08:00
lik ce8eb85019 tmp4 2026-10-02 15:17:52 +08:00
lik a4627592b4 tmp3 2026-10-02 14:25:50 +08:00
lik 1c4cadd2eb tmp2 2026-10-02 13:52:32 +08:00
lik 63ad613fab tmp1 2026-10-02 11:56:08 +08:00
lik 55a9c7e3e8 修改界面中,临时提交 2026-10-02 10:28:44 +08:00
lik 089e0eb081 tmp 2026-09-09 17:37:34 +08:00
lik 3bbf4b0449 怎加了微信联系说明 2026-06-13 19:20:54 +08:00
lik c208b95ad2 v1.1.3: 修复了部分bug 2026-06-13 19:00:42 +08:00
lik 2828c28a23 调整了ai聊天表格过宽显示补全问题 2026-06-05 05:50:26 +08:00
lik 1d61e5f74e 增加了朋友圈转发功能;增加了AI聊天markdown信息支持;增加了新版本提示 2026-06-05 05:31:22 +08:00
lik 74e42671bc 增加了朋友圈分享 2026-06-04 22:47:47 +08:00
lik 77861672d0 tmp 2026-06-04 10:45:53 +08:00
lik 051b408e1b clear消息后重启agent 2026-06-04 10:44:57 +08:00
lik c924f84384 v1.1.1-修改Bug 2026-06-04 10:34:25 +08:00
lik 535827b17b v1.1.0 2026-06-04 09:14:50 +08:00
lik c121ebdb94 tmp 2026-05-31 20:12:53 +08:00
lik 87c852b6a9 tmp 2026-05-31 19:43:16 +08:00
lik 13a61896db tmp 2026-05-31 17:44:06 +08:00
lik 350da5f33a 改了ai聊天的格式 2026-05-30 17:15:07 +08:00
lik 91ffaa62e7 tmp 2026-05-29 20:30:42 +08:00
lik 659232cf77 tmp 2026-05-28 19:43:35 +08:00
lik 12aaa5f43a tmp 2026-05-28 19:36:09 +08:00
lik 9447452e6f 界面改版 2026-05-28 19:27:15 +08:00
lik db0f47d994 tmp 2026-05-28 17:06:18 +08:00
lik a93a75b3c6 调整了页面命名和组织 2026-05-27 15:33:11 +08:00
693 changed files with 19464 additions and 4962 deletions
-95
View File
@@ -1,95 +0,0 @@
# 值班助手小程序 - 使用说明
## 项目介绍
值班助手是一个基于微信小程序的值班管理应用,使用 TDesign 组件库构建。
## 技术栈
- 微信小程序原生框架
- TDesign 微信小程序组件库
## 安装步骤
### 1. 安装依赖
```bash
npm install
```
### 2. 在微信开发者工具中配置
1. 打开微信开发者工具
2. 导入项目(选择本项目目录)
3. 在工具栏点击 `工具` -> `构建 npm`
4. 构建成功后,勾选 `将 JS 编译成 ES5`
### 3. 添加底部导航图标
需要在 `images` 目录下添加以下图标文件(PNG格式):
- `home.png` - 首页图标(未选中)
- `home-active.png` - 首页图标(选中)
- `mine.png` - 我的图标(未选中)
- `mine-active.png` - 我的图标(选中)
### 4. 添加默认头像
在 `images` 目录下添加 `default-avatar.png` 作为默认头像图片
## 项目结构
```
attendant-wechat/
├── app.js # 小程序主入口
├── app.json # 小程序全局配置
├── app.wxss # 小程序全局样式
├── sitemap.json # 站点地图配置
├── package.json # 项目依赖配置
├── project.config.json # 项目配置文件
├── pages/ # 页面目录
│ ├── index/ # 首页
│ │ ├── index.wxml # 页面结构
│ │ ├── index.wxss # 页面样式
│ │ ├── index.js # 页面逻辑
│ │ └── index.json # 页面配置
│ └── mine/ # 我的页面
│ ├── mine.wxml # 页面结构
│ ├── mine.wxss # 页面样式
│ ├── mine.js # 页面逻辑
│ └── mine.json # 页面配置
└── images/ # 图片资源目录
├── home.png # 首页图标
├── home-active.png # 首页图标(选中)
├── mine.png # 我的图标
├── mine-active.png # 我的图标(选中)
└── default-avatar.png # 默认头像
```
## 页面说明
### 首页 (pages/index)
- 欢迎卡片:显示应用名称和欢迎语
- 快捷功能:今日值班、值班表、值班记录
- 统计信息:显示值班相关统计数据
### 我的 (pages/mine)
- 用户信息卡片:显示用户头像和昵称
- 功能菜单:个人信息、我的值班、值班统计、设置、帮助与反馈、关于
- 退出登录:退出当前账号
## 使用的 TDesign 组件
- `t-button`: 按钮组件
- `t-cell`: 单元格组件
- `t-cell-group`: 单元格组组件
- `t-icon`: 图标组件
- `t-avatar`: 头像组件
- `t-card`: 卡片组件
- `t-divider`: 分割线组件
- `t-badge`: 徽标组件
## 注意事项
1. 确保微信开发者工具的基础库版本 >= 2.12.0
2. 安装依赖后必须执行"构建 npm"操作
3. 建议在真机上测试,部分功能可能与模拟器有差异
4. 图标文件尺寸建议:未选中状态 81x81px,选中状态 81x81px
## 下一步开发建议
1. 实现用户登录功能
2. 对接后端 API,获取真实的值班数据
3. 添加数据缓存机制,提升用户体验
4. 实现消息通知功能
5. 添加数据导出功能
+17
View File
@@ -0,0 +1,17 @@
Add-Type -AssemblyName System.Drawing
foreach ($n in 'home-green', 'ai-green', 'mine-green') {
$bmp = [System.Drawing.Bitmap]::FromFile("d:\work\health\code\ws_health\ui\wxapp_escort\images\$n.png")
$counts = @{}
for ($x = 0; $x -lt $bmp.Width; $x += 2) {
for ($y = 0; $y -lt $bmp.Height; $y += 2) {
$p = $bmp.GetPixel($x, $y)
if ($p.A -lt 128) { continue }
$key = '{0},{1},{2}' -f $p.R, $p.G, $p.B
$counts[$key] = [int]$counts[$key] + 1
}
}
$top = $counts.GetEnumerator() | Sort-Object Value -Descending | Select-Object -First 2
$line = ($top | ForEach-Object { "$($_.Key)=$($_.Value)" }) -join ' '
Write-Host "$n : $line"
$bmp.Dispose()
}
+93 -11
View File
@@ -1,8 +1,13 @@
const AIChatSocket = require('./utils/chatmsg.js') const AIChatSocket = require('./utils/chatmsg.js')
const API = require('./utils/api.js') const API = require('./utils/api.js')
const request = require('./utils/request.js')
App({ App({
onLaunch() { onLaunch() {
// request 层遇到 code 401(token 已失效)时回调这里:静默重登后自动重试原请求。
// 登录逻辑只在 app 里有一份,request 层不碰
request.setUnauthorizedHandler(() => this.silentSignin())
let appId = wx.getStorageSync('attendant-appid') let appId = wx.getStorageSync('attendant-appid')
if (!appId) { if (!appId) {
appId = 'app_' + Date.now().toString(36) + Math.random().toString(36).substr(2, 9) appId = 'app_' + Date.now().toString(36) + Math.random().toString(36).substr(2, 9)
@@ -10,7 +15,6 @@ App({
} }
this.globalData.appId = appId this.globalData.appId = appId
const request = require('./utils/request.js')
this.globalData.servicesReady = new Promise((resolve) => { this.globalData.servicesReady = new Promise((resolve) => {
API.resource.getServices().then((data) => { API.resource.getServices().then((data) => {
this.globalData.services = data.data.services this.globalData.services = data.data.services
@@ -20,31 +24,78 @@ App({
resolve([]) resolve([])
}) })
}) })
this.globalData.agreementReady = new Promise((resolve) => {
API.resource.getAgreement().then((data) => {
this.globalData.agreement = data.data.agreement
resolve(data.data.agreement)
}).catch((err) => {
console.error('获取服务协议失败', err)
resolve(null)
})
})
this.checkUpdate();
}, },
onShow(options) { onShow() {
const request = require('./utils/request.js') this.silentSignin()
wx.login({ this.initChatSocket()
success: res => { },
if (res.code) {
request.post('/user/wxsignin', { code: res.code }) // 静默重登:app.onShow 与 request 层的 401 兜底共用这一个入口
// (wxsignin 只凭 code 换到 openid 就能签发 token,见 api/user/handler/users.js)。
//
// 单飞:并发只发一次——每次 wxsignin 都会重签 token 覆盖上一次,
// 两个请求重叠时 DB 里存的是后保存的那个、而 globalData 存的是后返回的那个,
// 一旦错位本机就拿着作废的 token,之后所有接口都 401。
//
// 用户主动退出过(has_logout)就不再静默重登,否则「我的」页的退出登录
// 会被切后台/重进抵消;用户在「我的」页重新授权成功时会清掉这个标记
silentSignin() {
if (wx.getStorageSync('has_logout')) {
return Promise.resolve(false)
}
if (this.signinPromise) {
return this.signinPromise
}
this.signinPromise = new Promise((resolve) => {
wx.login({
success: res => {
if (!res.code) {
console.log('登录失败!' + res.errMsg)
resolve(false)
return
}
API.user.wxSignin({
code: res.code
})
.then((data) => { .then((data) => {
if (data.code == 0) { if (data.code == 0) {
this.globalData.user = data.data.user this.globalData.user = data.data.user
resolve(true)
} else { } else {
console.log('error:', data) console.log('error:', data)
resolve(false)
} }
}) })
.catch((err) => { .catch((err) => {
console.log('请求失败', err) console.log('请求失败', err)
resolve(false)
}) })
} else { },
console.log('登录失败!' + res.errMsg) fail: (err) => {
console.log('登录失败!' + err.errMsg)
resolve(false)
} }
} })
}).then((ok) => {
this.signinPromise = null
return ok
}) })
this.initChatSocket() return this.signinPromise
}, },
initChatSocket() { initChatSocket() {
@@ -71,10 +122,41 @@ App({
this.globalData.chatSocket = socket this.globalData.chatSocket = socket
}, },
checkUpdate() {
// 获取小程序更新管理器实例
const updateManager = wx.getUpdateManager();
// 监听检查更新事件,当小程序有新版本时会触发此回调
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
console.log(res.hasUpdate); // 打印是否有新版本
});
// 监听更新准备就绪事件,当新版本下载完成时会触发此回调
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,可以重启应用小程序了!',
success(res) {
if (res.confirm) {
// 用户确认更新,调用 applyUpdate 应用新版本并重启小程序
updateManager.applyUpdate();
}
}
});
});
// 监听更新失败事件,当新版本下载失败时会触发此回调
updateManager.onUpdateFailed(function () {
// 新版本下载失败,可以在这里处理失败逻辑,例如提示用户稍后再试
});
},
globalData: { globalData: {
appId: '', appId: '',
user: null, user: null,
chatSocket: null, chatSocket: null,
services: [], services: [],
agreement: null,
} }
}) })
+27 -13
View File
@@ -1,41 +1,55 @@
{ {
"pages": [ "pages": [
"pages/index/index", "pages/home/index",
"pages/ai/aichat",
"pages/escort/itemdetail",
"pages/escort/itemlist",
"pages/attendant/attendantlist",
"pages/attendant/attendantdetail",
"pages/escort/recordlist",
"pages/escort/agreement",
"pages/escort/recorddetail",
"pages/escort/guide",
"pages/health/profilelist",
"pages/health/profileedit",
"pages/mine/mine", "pages/mine/mine",
"pages/itemdetail/itemdetail", "pages/mine/profileedit",
"pages/healthrecord/main/healthrecord", "pages/mine/addressedit",
"pages/ai/aichat/aichat", "pages/mine/about",
"pages/escort_record_list/escort_record_list" "pages/mine/contact",
"pages/home/webview",
"pages/mine/business"
], ],
"window": { "window": {
"backgroundTextStyle": "light", "backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#FFFFFF", "navigationBarBackgroundColor": "#FAFAF9",
"navigationBarTitleText": "陪诊助手", "navigationBarTitleText": "暖橙陪诊",
"navigationBarTextStyle": "black" "navigationBarTextStyle": "black"
}, },
"tabBar": { "tabBar": {
"custom": true,
"color": "#999999", "color": "#999999",
"selectedColor": "#FF9B33", "selectedColor": "#B8520A",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"borderStyle": "black", "borderStyle": "black",
"list": [ "list": [
{ {
"pagePath": "pages/index/index", "pagePath": "pages/home/index",
"text": "首页", "text": "首页",
"iconPath": "images/home.png", "iconPath": "images/home.png",
"selectedIconPath": "images/home-active2.png" "selectedIconPath": "images/home-green.png"
}, },
{ {
"pagePath": "pages/ai/aichat/aichat", "pagePath": "pages/ai/aichat",
"text": "AI客服", "text": "AI客服",
"iconPath": "images/ai.png", "iconPath": "images/ai.png",
"selectedIconPath": "images/ai-active.png" "selectedIconPath": "images/ai-green.png"
}, },
{ {
"pagePath": "pages/mine/mine", "pagePath": "pages/mine/mine",
"text": "我的", "text": "我的",
"iconPath": "images/mine.png", "iconPath": "images/mine.png",
"selectedIconPath": "images/mine-active2.png" "selectedIconPath": "images/mine-green.png"
} }
] ]
}, },
+51 -12
View File
@@ -1,23 +1,62 @@
/**app.wxss**/ /**app.wxss**/
page { page {
--td-brand-color-1: #fff8f0; /* ===== 全站配色令牌 · 唯一来源(改配色只改这里)=====
--td-brand-color-2: #ffe8d4; 各页 page{} 不再重复定义这份色板。本文件先注入、页面 wxss 后注入,
--td-brand-color-3: #ffd4a8; 同特异度下页面胜出,所以某页确需例外时仍可在自己的 page{} 里覆盖同名变量。
--td-brand-color-4: #ffbb72; 仍有四处硬编码走不了变量,改色时须一并手改(清单见 doc/DESIGN.md §7.3):
--td-brand-color-5: #ff9b33; t-icon 的 color 属性、app.json 的 tabBar.selectedColor、
--td-brand-color-6: #ff8500; 首页 base64 内嵌线图标的 stroke、images/ai-ink.png 位图。
--td-brand-color-7: #FF9B33; 主色沿革(#C2410C H18/L40 → #B8520A H25/L38)与逐文件回滚清单见 DESIGN.md §七 */
--td-brand-color-8: #e68600; --brand-strong: #B8520A; /* 主按钮 / 选中态 / 实心强调块:白字 4.94:1、纸面 4.66:1、白卡 4.94:1,过 AA */
--td-brand-color-9: #cc6e00; --brand-soft: #FFF4E8; /* 浅橙衬底:图标底、标签底、按钮按下态 */
--td-brand-color-10: #a35700; --brand-line: #FFE0C2; /* 浅橙衬底的描边 */
--brand-ink: #9B4508; /* 浅橙底 / 纸面上的文字与线图标:浅橙底 5.96:1、纸面 6.10:1,过 AA */
/* 中性:暖灰阶,与暖白纸面同温(冷灰会让白卡边缘发青) */
--ink: #2B2521;
--ink-2: #4A4038;
--muted: #6F655C; /* 纸面 5.37:1 / 白卡 5.69:1 / 浅橙底 5.24:1,过 AA 正文。
历史值 #7A7068 落在纸面上只有 4.56:1,已废弃 */
--faint: #A79C92; /* 仅用于非文字装饰 */
--line: #ECE3D6; /* 米色发丝边。原 #F0E9E0 在纸面上只有 1.12:1,而白卡与纸面的
填充差本身只有 1.06:1——边界全靠这条边,故压深一档:
纸面 1.20:1 / 白卡 1.27:1 */
--sep: #E5DACC; /* 分隔线专用:比 --line 深一档,浅橙底上才看得见 */
--paper: #FAF8F5; /* 暖白纸面。原 #FAF6F0 的 R−B=10,黄度偏重、大面积铺开会被读成
"旧纸/发闷";压到 R−B=5 后黄度减半,明度反而略升
(L* 97.0 → 97.7),暖白身份保留 */
--white: #FFFFFF;
/* 阴影:偏移与模糊半径都保持"小偏移、小模糊"的锐利档 */
--shadow-card: 0 2rpx 10rpx rgba(63, 43, 25, 0.07); /* 白面一律走中性阴影 */
--shadow-cta: 0 2rpx 8rpx rgba(184, 82, 10, 0.16); /* 只给实心 CTA、品牌印记这类小体量元素 */
/* --- 以下与上面的色板无关,是待收口的历史遗留(见 DESIGN.md §5.2)---
品牌翠绿:#22A45D 为基准色(第 7 档),向浅/深各展开数档。
首页主视觉已确定该绿为品牌主色,全站令牌与之对齐,
避免二级页沿用旧橙色造成首页与内页两套配色。 */
--td-brand-color-1: #f0faf3;
--td-brand-color-2: #dcf3e3;
--td-brand-color-3: #bce6cb;
--td-brand-color-4: #8ed6a9;
--td-brand-color-5: #5cc387;
--td-brand-color-6: #3bb471;
--td-brand-color-7: #22a45d;
--td-brand-color-8: #1b8550;
--td-brand-color-9: #166940;
--td-brand-color-10: #114f31;
--td-brand-color: var(--td-brand-color-7); --td-brand-color: var(--td-brand-color-7);
--td-brand-color-active: var(--td-brand-color-8); --td-brand-color-active: var(--td-brand-color-8);
--td-brand-color-disabled: var(--td-brand-color-3); --td-brand-color-disabled: var(--td-brand-color-3);
--td-brand-color-light: var(--td-brand-color-1); --td-brand-color-light: var(--td-brand-color-1);
--td-brand-color-light-active: var(--td-brand-color-2); --td-brand-color-light-active: var(--td-brand-color-2);
background-color: #FAF6F1;
font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'miui', 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif; /* 深锚点:用于标题、Logo 文字等需要"分量"的地方,压住整页的重心 */
--c-ink: #1c1917;
background-color: #ffffff;
font-family: -apple-system, PingFang SC, Microsoft YaHei, sans-serif;
} }
.container { .container {
+42
View File
@@ -0,0 +1,42 @@
// 自定义 tabBar:固定在底部,选中态只换颜色、不换图形。
// 三个 tab 统一走 TDesign 线性图标字体:home / chat-bubble / user。
// 「AI客服」曾用位图(气泡内嵌 AI 字:灰色 ai.png、暖橙 ai-ink.png)当图标,
// 其轮廓笔画比图标字体细一档,与另外两个并排时粗细不搭,故弃用。
// 位图文件仍留在 images/ 下未删(app.json 的 tabBar 项也在引用,见 DESIGN.md §5.2)
Component({
data: {
selected: 0, // 当前选中项,由各 tab 页在 onShow 里同步
activeColor: '#B8520A', // 选中:暖橙(色相 25°、保住原亮度),白底 4.94:1,过 WCAG AA 正文标准
inactiveColor: '#7A7068', // 未选中:暖灰,白底 4.83:1,过 WCAG AA 正文标准
list: [{
pagePath: '/pages/home/index',
text: '首页',
icon: 'home'
}, {
pagePath: '/pages/ai/aichat',
text: 'AI客服',
// 标准「聊天」图标:线性,与 home / user 同族
icon: 'chat'
}, {
pagePath: '/pages/mine/mine',
text: '我的',
icon: 'user'
}]
},
methods: {
onTap(e) {
const {
index,
path
} = e.currentTarget.dataset
// 重复点击当前 tab 不做跳转,避免页面被重置
if (index === this.data.selected) {
return
}
wx.switchTab({
url: path
})
}
}
})
+18
View File
@@ -0,0 +1,18 @@
<view class="tab-bar">
<view
class="tab-item {{ selected === index ? 'is-active' : '' }}"
wx:for="{{ list }}"
wx:key="pagePath"
data-index="{{ index }}"
data-path="{{ item.pagePath }}"
bindtap="onTap"
>
<!-- 三个 tab 统一走 TDesign 线性图标字体,笔画同族;选中态只换颜色、不换图形 -->
<t-icon
name="{{ item.icon }}"
size="44rpx"
color="{{ selected === index ? activeColor : inactiveColor }}"
/>
<text class="tab-text">{{ item.text }}</text>
</view>
</view>
+35
View File
@@ -0,0 +1,35 @@
/* 自定义 tabBar 脱离文档流,fixed 在底部;
各 tab 页需自备底部占位(见 home / aichat / mine 的底部留白),否则内容会被盖住 */
.tab-bar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 100;
display: flex;
padding: 12rpx 0 calc(12rpx + env(safe-area-inset-bottom));
background: #FFFFFF;
/* 与各页 --line 保持同一档(#ECE3D6):tabBar 是独立组件,读不到 page 上的 CSS 变量,只能硬编码 */
border-top: 2rpx solid #ECE3D6;
}
.tab-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
}
.tab-text {
margin-top: 6rpx;
/* 与全局约束一致:中文正文不小于 24rpx(12px) */
font-size: 24rpx;
line-height: 1;
color: #7A7068;
}
.tab-item.is-active .tab-text {
/* 选中文字:暖橙 --brand-strong 的硬编码(组件读不到 page 级变量),白底 4.94:1,过 AA */
color: #B8520A;
font-weight: 600;
}
+207
View File
@@ -0,0 +1,207 @@
# 陪诊小程序 配色规范
适用范围:`ui/wxapp_escort/` 全部页面。本文只规定**颜色**;布局、间距、圆角、触控尺寸属界面规范,另行处理。
---
## 一、总原则
**全站只有一个色相**——暖橙,承载品牌、交互、强调。第二色不是新色相,而是**暖墨文字层**(暖偏棕的深灰),只用来拉开层级,不与暖橙争彩。浅橙三档(描边、浅底、深字)都是主色同色阶。状态色只在**表达状态**时出现,不做装饰。
判断一个颜色能否用:既不是暖橙同色阶、也不是暖墨、也不是明确状态色的,就不该出现。灰金 `#D4A853`、亮橙 `#FF8500`、青灰、翠绿均为违反项。
---
## 二、核心色板
令牌集中在 `app.wxss` 的 `page{}` 内,是**全站唯一来源——改配色只改这一处**。注入顺序 app.wxss 先、页面 wxss 后,同特异度页面胜出,某页确需例外时可在自己 `page{}` 覆盖同名变量。
**四处硬编码走不了变量,改色须一并手改**(逐文件见 §7.3):`t-icon` 的 `color`、`app.json` 的 `tabBar.selectedColor`、首页 base64 线图标的 `stroke`、着色的位图(`images/home-ink.png`)。
**`t-icon` 的 `name` 必须命中 tdesign 图标名表**(`miniprogram_npm/tdesign-miniprogram/icon/icon.wxss` 里的 `.t-icon-{name}`),写错不报错、只是渲染为空:`list` 并不存在(只有 `list-numbered`、`list-bug` 等),`info-circle`、`error-circle`、`user-business`、`chart-bar` 等均存在。
迁移进度:`home/index`、`escort/itemlist`、`escort/guide`、`attendant/*` 副本已删;`itemdetail`、`mine/contact` 两页仍各带副本(停在旧值 `#C2410C`),待重构时按同一方式删。
### 2.1 第一色:暖橙色阶
主色于 2026-10-04 由 `#C2410C`(H18°)折中右移到下表值(H25°)。沿革与回滚见 §七。
| 令牌 | 色值 | 用途 | 对比度 |
|---|---|---|---|
| `--brand-strong` | `#B8520A` | 主按钮、价格数字、选中态、实心强调块 | 纸面 4.66:1,白卡 4.94:1;白字压其上 4.94:1 |
| `--brand-ink` | `#9B4508` | 标签文字、文字链、暖色小标题、图标 | 浅橙底 5.96:1,纸面 6.10:1,白卡 6.46:1 |
| `--brand-line` | `#FFE0C2` | 浅橙块描边、浅橙档的状态描边 | 仅做描边 |
| `--brand-soft` | `#FFF4E8` | 浅橙底:说明砖、图标衬底、按钮按下态 | 仅做底 |
用法边界:
- `--brand-strong` 是唯一可当"实心大色块"的值;全页同类实心块不超过一处。
- `--brand-soft` 只能当底,不能当文字色或描边色。
- 浅橙底上的文字一律走 `--brand-ink`(`--brand-strong` 落其上仅 4.56:1,余量小)。
- 例外(已登记):`escort/itemlist` 价格数字改走 `--muted` + 字重 500,让「预约」空心胶囊独占焦点;同页价格列只用这一个色值、一种字重。
- 例外(已登记):`escort/itemlist`「预约」按钮走**空心胶囊**——3rpx `--brand-strong` 环 + 28rpx 满圆角 + `--brand-ink` 字 30rpx/500,无填充无阴影,按下填 `--brand-line`。同行规格签已是"浅橙底 + 6rpx 圆角",按钮若同族会与之撞形;**同一行只允许一个填充物**,按钮独占"环"形态。该页因此无实心大色块。
### 2.2 第二色:暖墨文字层
| 令牌 | 色值 | 用途 | 对比度 |
|---|---|---|---|
| `--ink` | `#2B2521` | 标题、需最重的正文 | 纸面 14.26:1 |
| `--ink-2` | `#4A4038` | 正文 | 纸面 9.52:1 |
| `--muted` | `#6F655C` | 次要文字、元信息、说明、未选中态 | 纸面 5.37:1,白卡 5.69:1,浅橙底 5.24:1 |
用法边界:
- 三档只表示文字层级,不表示状态或可点击性。
- `--muted` 是最浅一档,不得再浅——它是全站文字对比度底线。历史值 `#7A7068`(纸面 4.56:1,压线无余量)已废弃,硬编码需全部替换。
- `t-icon` 的 `color` 读不到 CSS 变量,只能硬编码,且必须与令牌同步(当前为 `#9B4508`、`#6F655C`、`#B8520A` 三者之一)。
### 2.3 底与线
| 令牌 | 色值 | 用途 |
|---|---|---|
| `--white` | `#FFFFFF` | 卡片、面板 |
| `--paper` | `#FAF8F5` | 页面底色(暖白纸面) |
| `--line` | `#ECE3D6` | 发丝线:卡片内部分隔、区块切分 |
| `--sep` | `#E5DACC` | 分隔线:竖线、浅橙底上的线 |
用法边界:
- 线是切分工具,不表意,不上主色或状态色。浅橙底上必须用 `--sep`(`--brand-line` 落 `--brand-soft` 上仅 1.16:1,肉眼看不出)。
- `--paper` 与 `--brand-soft` 明度差仅约 1.03:1,浅橙块落纸面须靠 **2rpx `--brand-line` 描边**托形,不加阴影。
- **白卡一律走中性阴影** `--shadow-card: 0 2rpx 10rpx rgba(63, 43, 25, 0.07)`,圆角 28rpx。彩色(暖橙)阴影不得用在 `--white` 面上;它只允许用于实心 CTA、品牌印记等小体量元素(`--shadow-cta: 0 2rpx 8rpx rgba(184, 82, 10, 0.16)`)。
- 例外(已登记):`escort/itemlist` 两个服务分组做成**通栏白底块**——`--white` + 上下各 2rpx `--line` + `--shadow-card`,**圆角 0**;做法 `margin: 36rpx -32rpx 0` + `padding: 28rpx 32rpx`,行宽仍为 686rpx(若内缩,卡的左右内距会白吃 48rpx 行宽,长名称 + 右区更易挤出)。圆角必须为 0,否则满宽块的圆角会切在屏幕边上。页首 `.notice` 仍是内缩 28rpx 圆角白卡。
- 例外(已登记):`escort/itemlist` 的**人工客服旁路卡**做浅橙面(`--brand-soft` + 2rpx `--brand-line` + 28rpx 圆角 + 去阴影),与首页 `.quick-item-full` 同源,补回该页"暖色只剩线、没有面"的那一档。位置在**页首披露卡下方、清单上方**(原为页尾的"收口卡",已上移):文案走本页"情形 + 动作"两段式(muted「不想线上预约?」+ 暖橙链「直接联系人工客服」)。页尾不设卡,改由一行**文档级元信息**收尾——细竖线分隔的「服务指南 │ 用户协议」(从页首披露卡下移,不加卡、不加 chevron,文字链自身即点击暗示);披露卡因此退回纯声明,只留城市与费用披露。
- 例外(已登记):`mine/about` 的「联系我们」做成**浅橙入口卡**(`--brand-soft` + 2rpx `--brand-line` + 28rpx 圆角 + 去阴影,同首页 `.quick-item-full` 配方),是该页尾部唯一的暖色面。卡内**不再平铺联系方式**——热线/微信/邮箱/工作时间四项与 `mine/contact` 页逐项重合,平铺即"同一意图两个入口";只留「联系我们」+ 一行摘要(「人工客服」,与首页同卡同文案)+ muted chevron,整卡可点跳 `mine/contact`。另注:该页品牌印记(`home-w.png` 白色线稿)必须落 `--brand-strong` 实心底,不能用 `--brand-soft`,白色线稿在浅橙底上看不见。
- 例外(已登记):`mine/mine` 的菜单与「退出登录」做成**通栏白底块**(`--white` + 上下各 2rpx `--line` + `--shadow-card`,圆角 0)。其中「退出登录」是**动作而非导航**,与菜单行不同族:单独一块、一行居中、**无图标无 chevron**、字色 `--muted`。状态色不得用于按钮(§三),退出因此不走红/橙,区分只靠结构与位置。
---
## 三、状态色
状态色只用于订单、记录这类**有明确状态字段**处,同页同类状态只允许一种颜色。
| 状态 | 底色 | 描边 | 字色 | 对比度 |
|---|---|---|---|---|
| 待服务 | `#ECF7F4` | `#C7E5DF` | `#0F766E` | 5.00:1 |
| 服务中 | `#FFF4E8` | `#FFE0C2` | `#B8520A` | 4.56:1 |
| 已完成 | `#EAF6EE` | `#CDE9D7` | `#1F7A4D` | 4.79:1 |
| 已取消 | `#FCF0EE` | `#F2D6D1` | `#B4231A` | 5.89:1 |
用法边界:
- **不得仅用颜色传达状态**(WCAG 1.4.1):状态胶囊必须带文字,颜色只做强化。
- 青绿(待服务)是全站唯一冷色,只给"等你去处理"这一个语义。
- 服务中复用主色浅档,字色跟随该页 `--brand-strong`(已迁移页 `#B8520A`,未迁移页 `#C2410C`)。
- 状态色不得用于区块标题、图标衬底、按钮、装饰条,只包住状态文字本身。
- 表单错误复用已取消档(`#B4231A` 字 + `#FCF0EE` 底),错误必须带文字。
- 禁用态不用暖橙:`--muted` 字 + `--sep` 描边 + 透明底。
---
## 四、硬约束(可验证)
1. 所有文字对底色对比度 ≥ WCAG AA 4.5:1;中文最小字号不低于 24rpx(12px)。
2. 图标对衬底对比度 ≥ WCAG 非文本 3:1。
3. 不得新增色相;需区分时先改结构(分组、留白、换线),不要加颜色。
4. 不得使用渐变色。
5. 卡片、面板、说明砖的填充必须中性(`--white` / `--paper` / `--brand-soft`)。
6. 暖橙以外的暖色(灰金、亮橙)不得出现。
7. 同页同一含义只能对应一个色值。
8. 不得仅用颜色传达信息(WCAG 1.4.1)。
---
## 五、历史遗留收口清单
以下为当前与规范冲突的位置,**本文档阶段不执行**,仅登记供后续代码阶段按表替换。
### 5.1 页面级
| 范围 | 现状 | 替换为 |
|---|---|---|
| `mine/addressedit.wxml`(`switch` 属性) | 旧金色 | `#B8520A`(属性值需硬编码) |
| `hospital/contact.wxss`、`hospital/ranking.wxss` | 底 `#F5F7F6`、字 `#1F2937`、绿灰系 | 整体并入暖橙体系 |
已完成(2026-10-06):`health/profilelist`、`health/profileedit` 已按本节并入暖橙体系——两页 `.wxss` 的旧金色 `#D4A853` 连同冷灰文字 `#1F2937`/`#374151`/`#6B7280`/`#9CA3AF`、冷灰线 `#F3F4F6`、旧底 `#FAF6F1`/`#FDF8EE` 一并换成暖橙令牌与暖墨阶。列表页改「浅橙说明砖 + 通栏白块」,每条主体整块可点进编辑(补 chevron 点击暗示,删除动作下沉到卡内操作行、走 `--muted`),空态与「邮寄地址」同语言(`--faint` 图标 + `--muted` 说明);表单页改通栏白块,标签左走 `--muted`、值右走 `--ink` 700,性别选中态用软橙底 + 实心橙描边,健康备注独立一块。两页 `page{}` 均不留令牌副本;`profilelist.js` 的 `confirmColor` 硬编码改 `#B8520A`,`profilelist.json` 补注册既已使用的 `t-loading`(原只在 `.wxml` 里引用、未注册,渲染为空)。
已完成(2026-10-06):`escort/guide` 已按本节并入暖橙体系——`.wxss` 里的 page 级令牌副本(停在旧值 `#C2410C` / `#9A3412`)整块删除,改用 `app.wxss` 唯一来源;`.wxml` 四处 `t-icon` 硬编码随之改值(三个卡片头图标 `#FFFFFF`→`#9B4508`、底部客服 `call` `#9A3412`→`#9B4508`)。同页三处收口:卡片头标识由「实心橙方块 + 白图标」改「`--brand-soft` + 2rpx `--brand-line` 描边 + 暖橙图标」,实心块只留底部 CTA 一处(§2.1);CTA 阴影由 `0 6rpx 16rpx rgba(194,65,12,.22)` 收为 `--shadow-cta`;三处 `font-weight: 600` 改 `700`(中文系统字体只有 400/700 两档)。内容同步:服务流程与 `services.js` 各服务的 flow 对齐(预约 → 沟通信息 → 支付费用 → 准备资料 → 全程陪诊 → 服务完成),删去不在任何 flow 里的「选择陪诊师」;温馨提示的改期句统一为「如需改期或取消,请至少提前4小时联系客服」。
已完成(2026-10-06):`escort/agreement.wxss` 已按本节并入暖橙体系——底 `#FAF6F1` 转 `--paper`,顶部白→暖白渐变去掉(直接落纸面),#`D4A853` 系连三处同色渐变与同色大阴影一并换掉:文件图标衬底转 `--brand-strong` + `--shadow-cta`(白色图标需深底),章节序号转「`--brand-soft` 衬底 + 2rpx `--brand-line` 描边 + `--brand-ink` 字」(全页实心块只留顶部一个),圆点转 `--brand-strong`;冷灰文字 `#1F2937`/`#4B5563`/`#6B7280` 转 `--ink`/`--ink-2`/`--muted`,冷线 `#F0E6D8`/`#E5E7EB` 转 `--line`/`--sep`(浅橙底上用 `--sep`);正文块改通栏白底块(上下 2rpx `--line` + 圆角 0 + `--shadow-card`)。违约金表表头不再铺色(`--brand-line` 只作描边)。另删 7 条死规则 `flow-steps`/`flow-step`/`step-badge`/`step-info`/`step-title`/`step-desc`/`step-line`——WXML 无任何引用。
已完成(2026-10-04):`escort/recordlist`、`escort/recorddetail` 已按本节并入暖橙体系——两页删去旧金色副本与全部渐变,状态一律走 §三 四档;`recorddetail` 另在 `page{ }` 登记 `--shadow-bar`(底栏上向阴影,不在全局色板内)。两页 `json` 原本 `usingComponents` 为空却已用 `t-icon`/`t-loading`,一并补注册。
已完成(2026-10-06):`mine/about.wxss` 已按本节并入暖橙体系——灰金 `#D4A853`、亮橙 `#FF8500`、冷灰底 `#F5F5F5`、品牌区与印记的两处渐变、6×28rpx 的渐变竖条全部换掉:底色转 `--paper`,印记转 `--brand-strong` + `--shadow-cta`(白色线稿需深底),竖条转 8×34rpx 实色 `--brand-strong`。同页两处违规一并修正:`.icp` 由 22rpx 提到 24rpx(硬约束 1 最小字号),元信息与标签统一 `--muted`、正文统一 `--ink-2`。死代码 `.version`(页面已无版本号展示)删除。白卡按 §2.3 补 2rpx `--line` 发丝边 + `--shadow-card` + 28rpx 圆角。同页「联系我们」由平铺的四项联系方式收成一张入口卡(配方见 §2.3 例外)——那四项与 `mine/contact` 逐项重合,平铺属"同一意图两个入口",且该页每行还少一个「拨打/复制」动作词。
已完成(2026-10-06):`escort/attendantlist` 4 文件迁至 `attendant/attendantlist`,同目录新增 `attendant/attendantdetail`(4 文件),两页一并并入暖橙体系——`attendantlist.wxss` 的 page 级令牌副本(停在旧值 `#C2410C` / `#9A3412`)整块删除,改用 `app.wxss` 唯一来源,`page{}` 只留 `background-color: var(--paper)`(同 `guide`);`.wxml` 的 `t-icon` 硬编码 `#9A3412`→`#9B4508`,两处竖分隔线 `#E5DACC`→`--sep`。结构:列表卡右侧补 `chevron-right`(`#6F655C`)作点击暗示,整卡可点进详情;详情页按国标 4.2.1.5 分区——主卡(头像 / 脱敏名 / 已核验徽标 / 服务年限 · 累计服务次数,居中)+ 擅长场景(全量,不截断)+ 服务信息(性别 / 服务区域 / 服务语言,空项整行隐藏)+ 个人简介(未填整块隐藏),全页无实心色块、不新增色相,说明行仍是「公示信息,不含联系方式」。入口仍在首页介绍卡信任行(`goToAttendants`),`app.json` 两条路由同步改路径。同日按国标 4.2.1.5 补全公示项:详情页加「资质与培训」(健康证明有效期 + 培训记录)与「过往服务评价」两个分区,两区均无数据时整块隐藏;区块内条目用 `--line` 发丝线分隔,评分用 48rpx `--ink` 大字 + `--muted` 小数(`/ 5`)与条数,无实心色块。
### 5.2 系统级(不在页面里,最易漏)
| 位置 | 现状 | 应改为 |
|---|---|---|
| `app.json` tabBar 选中图标 | `home-green.png` / `ai-green.png` / `mine-green.png`(绿色图片) | 暖橙 `#B8520A` 版本,与 `selectedColor` 一致 |
| `app.json` tabBar `color` | `#999999` | `--muted` 等价色 `#6F655C` |
| `app.wxss` 全局变量 | `--td-brand-color-1..10` 整套翠绿(基准 `#22A45D`)、`--c-ink #1c1917` | 已确认业务页面零引用,是死代码,可整体重写或删除 |
| `custom-tab-bar/index.wxss`、`index.js` | 未选中色硬编码 `#7A7068` | `#6F655C` |
### 5.3 通用色值映射表
| 旧值 | 新值 | 说明 |
|---|---|---|
| `#D4A853` | `#9B4508` 或 `#B8520A` | 灰金转暖橙,按"文字/图标"或"实心"分 |
| `#FF8500` | `#B8520A` | 亮橙转主色 |
| `#FF9B33` / `#FF7A33` | `#B8520A` + `#FFF4E8` | 去渐变,拆成字色与底色 |
| `#22A45D` / `#6B8E7B` / `#2D6A4F` / `#4CAF50` / `#45A049` | `#B8520A`;语义为"已完成"则 `#1F7A4D` | 绿系转暖橙,仅状态语义保留绿 |
| `#FAF6F1` / `#F5F7F6` / `#F5F5F5` | `#FAF8F5` 或 `#FFFFFF` | 旧底转纸面或卡片 |
| `#F3F4F6` / `#EEEEEE` / `#E5E5E5` / `#E5E7EB` | `#ECE3D6`(浅橙底上用 `#E5DACC`) | 冷灰线转暖线 |
| `#1F2937` / `#333333` | `#2B2521` | 冷黑转暖墨 |
| `#6B7280` / `#9CA3AF` / `#999999` / `#7A7068` | `#6F655C` | 各版"次要灰"统一 |
---
## 六、一句话检验
1. 页面去色(灰度化)后层级还清楚吗?去掉颜色就散架 = 在用颜色凑层级。
2. 数一下色相:超过"暖橙 + 暖墨 + 至多一个状态色"就有问题。
3. 最浅的那行字是 `--muted` 或更深吗?比它更浅的要拉回来。
---
## 七、主题色沿革与回滚
主色做过一次色相右移。照 §7.3 倒着改即可整体回滚。
### 7.1 三套值
| 版本 | `--brand-strong` | HSL | `--brand-ink` | HSL | 状态 |
|---|---|---|---|---|---|
| **现行** | `#B8520A` | H25° · S90% · L38% | `#9B4508` | H25° · S90% · L32% | 首页、`escort/itemlist`、自定义 tabBar 已落地 |
| **之前** | `#C2410C` | H18° · S88% · L40% | `#9A3412` | H15° · S79% · L34% | 其余页面仍是此值 |
| 已否候选 | `#A85A00` | H32° · S100% · L33% | — | — | 为凑白字 AA 把明度压到 33% 致画面发闷,仅登记 |
`--brand-soft #FFF4E8`、`--brand-line #FFE0C2` 全程未动,回滚无需处理。
### 7.2 为什么离开旧值
旧值 `#C2410C`(H18° 偏红、饱和偏高)大面积铺开会读成"锈橙 ≈ 干血",与就医语境不合。折中右移到 H25°,明度只让 40%→38%、饱和 88%→90%,保住"眼前一亮"的抓力。若日后仍嫌血色,**正解是收缩橙色面积,不是继续调暗**。
### 7.3 回滚清单
回滚或再改主色只需改第 1 行(`app.wxss`);其余 10 处是 CSS 变量读不到的地方(`t-icon` color、base64 stroke、位图、`app.json`、自绘阴影),须一并手改。`--brand-soft` / `--brand-line` 未变,不在表内。
| # | 文件 | 位置 | 现行 | 回滚为 |
|---|---|---|---|---|
| 1 | `app.wxss` | `page{}` 内 `--brand-strong` / `--brand-ink`(全站唯一来源) | `#B8520A` / `#9B4508` | `#C2410C` / `#9A3412` |
| 2 | `app.wxss` | `page{}` 内 `--shadow-cta` | `rgba(184, 82, 10, 0.16)` | `rgba(194, 65, 12, 0.16)` |
| 3 | `pages/home/index.wxss` | `.brand-mark` 的 `box-shadow` | `rgba(184, 82, 10, 0.16)` | `rgba(194, 65, 12, 0.16)` |
| 4 | `pages/home/index.wxss` | 8 个 base64 线图标的 `stroke` | `#B8520A` | `#C2410C` |
| 5 | `pages/home/index.wxml` | 第 119 行 `t-icon` 的 `color` | `#9B4508` | `#9A3412` |
| 6 | `pages/escort/itemlist.wxml` | 第 25 / 30 / 96 行 `t-icon` 的 `color` | `#9B4508` | `#9A3412` |
| 7 | `custom-tab-bar/index.js` | 第 8 行 `activeColor` | `#B8520A` | `#C2410C` |
| 8 | `custom-tab-bar/index.wxss` | 第 39 行 `.tab-item.is-active .tab-text` | `#B8520A` | `#C2410C` |
| 9 | `app.json` | 第 30 行 `tabBar.selectedColor` | `#B8520A` | `#C2410C` |
| 10 | `images/ai-ink.png` | 整图纯色(AI客服选中态位图) | `#9B4508` | `#8A4B08`(位图需重上色,不能按文本替换) |
| 11 | `images/home-ink.png` | 整图纯色(「我的」默认头像位图,由灰色 `home.png` 重上色) | `#9B4508` | `#8A4B08`(同上) |
**无需回滚**:其余页面从未迁移。仍定义旧值 `#C2410C` / `#9A3412` 的是 `itemdetail`、`mine/contact` 两页四文件(各含 `.wxss` 令牌与 `.wxml` 里 `t-icon` 硬编码),本就是回滚后的目标态(`guide` 已于 2026-10-06 迁移,`attendant/*` 于同日迁移并新增详情页,见 §5.1);`agreement`、`recordlist`、`recorddetail`、`mine/*` 等页走更早的金色体系(`#D4A853`),见 §5.1。
注:`custom-tab-bar` 未选中灰硬编码 `#7A7068` 是独立历史遗留项(应改 `#6F655C`,见 §5.2),与本次主色调整无关。
+60
View File
@@ -0,0 +1,60 @@
# 暖橙陪诊小程序
陪诊服务的微信小程序,基于微信原生框架 + TDesign 组件库。
## 技术栈
- 微信小程序原生框架
- `tdesign-miniprogram` ^1.9.2(依赖 `package.json`,构建产物在 `miniprogram_npm/`)
- 基础库 3.15.2(`project.config.json`),最低 ≥ 2.12.0
## 运行
1. `npm install`
2. 微信开发者工具导入本项目目录 `ui/wxapp_escort`
3. 工具栏 `工具 → 构建 npm`
4. 编译预览
## 目录结构
```
app.js / app.json / app.wxss 全局入口、页面与 tabBar 配置、色板令牌
custom-tab-bar/ 自定义底部导航(fixed 在底部,各 tab 页需自备底部占位)
pages/ 页面(清单见下)
utils/
request.js HTTP 封装(基址、appId、token 头)
api.js 接口定义
chatmsg.js AI 客服 WebSocket
doc/
DESIGN.md 配色规范(全站唯一色板来源)
PROJECT_GUIDE.md 本文件
```
## 页面
| 路径 | 说明 |
|---|---|
| `pages/home/index` | 首页 |
| `pages/ai/aichat` | AI 客服 |
| `pages/escort/itemlist` | 陪诊服务列表 |
| `pages/escort/itemdetail` | 服务详情 / 下单 |
| `pages/attendant/attendantlist` | 陪诊师团队(公示列表) |
| `pages/attendant/attendantdetail` | 陪诊师详情(公示) |
| `pages/escort/recordlist` | 订单记录 |
| `pages/escort/recorddetail` | 订单详情 |
| `pages/escort/agreement` | 用户协议 |
| `pages/escort/guide` | 服务指南 |
| `pages/health/profilelist` | 就诊人列表 |
| `pages/health/profileedit` | 就诊人编辑 |
| `pages/mine/mine` | 我的 |
| `pages/mine/about` | 关于 |
| `pages/mine/contact` | 联系我们 |
| `pages/mine/business` | 合作与入驻(商务合作 / 陪诊师入驻 / 陪诊师培训,入口自首页与「我的」页页脚) |
| `pages/home/webview` | 网页容器 |
## 约定
- **配色**:见 `doc/DESIGN.md`。色板令牌集中在 `app.wxss` 的 `page{}`,改配色只改这一处。
- **接口**:统一走 `utils/request.js`,基址 `https://api.huashengtec.com`(本地调试可改用文件内注释的 `127.0.0.1:9004`);请求自动携带 `appId=wxapp-escort` 与登录 token。
- **登录**:`app.js` 的 `onShow` 调 `wx.login` 换 token,存于 `globalData.user`。
- **全局数据**:服务列表 / 协议在 `onLaunch` 预取,挂到 `globalData` 供各页取用。
+83
View File
@@ -0,0 +1,83 @@
# 页面重构进度台账
**用途**:记录哪些页面已并入暖橙体系、哪些还停在旧体系,以及下一步的推进顺序。
**分工**:配色标准、令牌表、状态色、回滚方法一律以 [DESIGN.md](./DESIGN.md) 为准(本文不重复);本文只管「进度 + 顺序 + 每页动作」。
---
## 一、已完成(6 页)
| 页面 | 完成 | 主要动作 |
|---|---|---|
| `home/index`(首页) | 更早 | 暖白纸面 + 白卡语言重建:hero(大标题 / 场景行 / 通栏主 CTA)→ 陪诊服务(白卡宫格 + 浅橙介绍卡)→ 常用功能(青绿待服务条 + 双列 / 通栏卡)→ 页脚文字链。页内旧令牌副本已删 |
| `escort/itemlist`(陪诊服务列表) | 更早 | 页首短横色标 + 引导,说明白卡(开通城市 / 费用披露 + 两个入口),三组「通栏白底 + 章线」价目表,空心环「预约」按钮,浅橙收口页脚卡。页内旧令牌副本已删 |
| `mine/mine`(我的) | 2026-10-04 | 并入暖橙体系 + 首页白卡语言:纸面底、头像与昵称直接落纸面、菜单白卡(图标走 `--brand-ink`)、页脚细竖线分隔。默认头像改用暖墨品牌标记 `images/home-ink.png`。删掉一批死样式(`.user-phone`、`.avatar-btn`、昵称输入等) |
| `ai/aichat`(AI 陪诊助手) | 2026-10-04 | 整页重设计:纸面底 + 消息列表(头像行在上、气泡在下,用户消息整条靠右并把时间镜像到头像左侧);AI 与用户头像统一底座(浅橙底 + 暖橙描边),身份只由图形区分(品牌标记 / 人像);AI 声明由页底常驻行改为挂在每条 AI 气泡下方;空态图标改用 `images/ai-ink.png`;清空入口移到输入框下方做成空心描边小按钮,并在其旁增加「常见问题」入口——点击把常见问题清单整块铺进会话流(行间以横线分隔,可重复点选),空会话欢迎区复用同一清单块样式;全页圆角统一 20rpx。附带修复滚动布局(`.message-list` 补 `min-height: 0`,消息超一屏后输入区不再被顶出视口) |
| `mine/profileedit`(个人信息) | 2026-10-04 | 由 `mine` 页上的 `comp_profile` 浮层改为真页面(不再用 fixed 浮层,返回键交给页面栈)。表单沿用 `mine` 的通栏白块语言:标签左走 `--muted`、值右走 `--ink`,选中态用软橙底 + 实心橙描边;保存是本页唯一实心橙块 |
| `mine/addressedit`(邮寄地址) | 2026-10-04 | 由 `comp_address` 浮层改为真页面,列表 / 表单两态同页切换并同步导航栏标题。地址卡走白卡 + chevron 点击暗示,默认地址用图形 + 文字双通道传达状态;表单态取消走空心、保存走实心橙 |
> DESIGN.md §5.1 已登记 `mine/mine.wxss`、`ai/aichat.wxss` 两页迁移完成;`mine/profileedit.wxss`、`mine/addressedit.wxss` 待补登。
---
## 二、待重构(11 页 / 19 个文件)
按"离规范的距离"分三档,**建议从上往下推进**——同档内先易后难。
### A. 旧暖橙副本(最接近,只差删副本 + 对值)|4 页 8 文件
页内各带一份 `page{}` 令牌副本,停在 `#C2410C` / `#9A3412`;结构基本可用。
| 页面 | 文件 | 动作 |
|---|---|---|
| `escort/itemdetail` | `.wxss` `.wxml` | 删页内令牌副本(改读 app.wxss),`t-icon` 的 `color` 手改 `#9B4508` |
| `attendant/attendantlist` | `.wxss` `.wxml` | 已完成(2026-10-06,见 DESIGN.md §5.1);同目录新增 `attendantdetail` |
| `escort/guide` | `.wxss` `.wxml` | 同上 |
| `mine/contact` | `.wxss` `.wxml` | 同上 |
### B. 旧金色体系(`#D4A853` 系,改动最大)|7 页 + 1 组件/JS
| 页面 | 文件 | 动作 |
|---|---|---|
| `mine/about` | `.wxss` | 按 §5.3 映射表整体换色 |
| `health/profilelist` | `.wxss` `.wxml` `.js`(`confirmColor`) | 同上 |
| `health/profileedit` | `.wxss` | 同上 |
| `escort/recordlist` | `.wxss` | 换色 + 状态四档 |
| `escort/recorddetail` | `.wxss` `.wxml` | 换色 + 状态四档 |
| `escort/agreement` | `.wxss` | 底 `#FAF6F1` → `--paper`,其余按映射表 |
### C. 绿灰系(另一套冷色,需整体并入)|2 页
| 页面 | 文件 | 动作 |
|---|---|---|
| `hospital/contact` | `.wxss` | 底 `#F5F7F6`、字 `#1F2937`、绿灰线一并换成纸面 / 暖墨 / 暖线 |
| `hospital/ranking` | `.wxss` | 同上 |
### D. 无需处理
| 页面 | 说明 |
|---|---|
| `home/webview` | 仅一个 `<web-view>`,无色值 |
### 组件与 JS 里的硬编码(易漏)
`addressedit.wxml` 的 `switch` 属性、`profilelist.js` 的 `confirmColor` 走的是**属性值**,读不到 CSS 变量,必须硬编码暖橙(`mine/addressedit` 迁移时已按此处理,`health/profilelist` 待处理)。
---
## 三、系统级收口(不属任何页面)
沿用 DESIGN.md §5.2,共 4 项:`app.json` 的 tabBar 绿色选中图标、tabBar `color: #999999`、`app.wxss` 里整套翠绿死代码(`--td-brand-color-1..10`、`--c-ink`)、`custom-tab-bar` 未选中灰 `#7A7068`。建议放在页面重构全部完成后一次做完,避免边改边漏。
---
## 四、每页收工自检
1. 灰度化后层级是否仍清楚(去掉颜色不散架)。
2. 色相数量:暖橙 + 暖墨 + 至多一个状态色。
3. 最浅的那行字是否 `--muted` 或更深。
4. 中文最小 24rpx、正文对比度 ≥ 4.5:1(大字 ≥ 3:1)、图标 ≥ 3:1。
5. 可点项是否有显性暗示,热区是否 ≥ 56rpx。
6. 页面是否还有 `page{}` 级令牌副本;有则删掉,回归 app.wxss 唯一来源。
> 详细判据见 DESIGN.md「六、一句话检验」。
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.
@@ -67,11 +67,16 @@ export default class ActionSheet extends SuperComponent {
event: string; event: string;
}[]; }[];
observers: { observers: {
'visible, items'(visible: boolean): void; items(): void;
globalConfig(): void;
};
lifetimes: {
ready(): void;
}; };
methods: { methods: {
init(): void; init(): void;
memoInitialData(): void; memoInitialData(): void;
updateInitialData(): void;
splitGridThemeActions(): void; splitGridThemeActions(): void;
show(options: any): void; show(options: any): void;
close(): void; close(): void;
@@ -1 +1 @@
import{__decorate}from"tslib";import{chunk}from"../common/utils";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import{ActionSheetTheme,show}from"./show";import props from"./props";import useCustomNavbar from"../mixins/using-custom-navbar";const{prefix:prefix}=config,name=`${prefix}-action-sheet`;let ActionSheet=class extends SuperComponent{constructor(){super(...arguments),this.behaviors=[useCustomNavbar],this.externalClasses=[`${prefix}-class`,`${prefix}-class-content`,`${prefix}-class-cancel`],this.properties=Object.assign({},props),this.data={prefix:prefix,classPrefix:name,gridThemeItems:[],currentSwiperIndex:0,defaultPopUpProps:{},defaultPopUpzIndex:11500},this.controlledProps=[{key:"visible",event:"visible-change"}],this.observers={"visible, items"(e){e&&this.init()}},this.methods={init(){this.memoInitialData(),this.splitGridThemeActions()},memoInitialData(){this.initialData=Object.assign(Object.assign({},this.properties),this.data)},splitGridThemeActions(){this.data.theme===ActionSheetTheme.Grid&&this.setData({gridThemeItems:chunk(this.data.items,this.data.count)})},show(e){this.setData(Object.assign(Object.assign(Object.assign({},this.initialData),e),{visible:!0})),this.splitGridThemeActions(),this.autoClose=!0,this._trigger("visible-change",{visible:!0})},close(){this.triggerEvent("close",{trigger:"command"}),this._trigger("visible-change",{visible:!1})},onPopupVisibleChange({detail:e}){e.visible||(this.triggerEvent("close",{trigger:"overlay"}),this._trigger("visible-change",{visible:!1})),this.autoClose&&(this.setData({visible:!1}),this.autoClose=!1)},onSwiperChange(e){const{current:t}=e.detail;this.setData({currentSwiperIndex:t})},onSelect(e){const{currentSwiperIndex:t,items:i,gridThemeItems:s,count:o,theme:r}=this.data,{index:n}=e.currentTarget.dataset,a=r===ActionSheetTheme.Grid,h=a?s[t][n]:i[n],c=a?n+t*o:n;h&&(this.triggerEvent("selected",{selected:h,index:c}),h.disabled||(this.triggerEvent("close",{trigger:"select"}),this._trigger("visible-change",{visible:!1})))},onCancel(){this.triggerEvent("cancel"),this.autoClose&&(this.setData({visible:!1}),this.autoClose=!1)}}}};ActionSheet.show=show,ActionSheet=__decorate([wxComponent()],ActionSheet);export default ActionSheet; import{__decorate}from"tslib";import{chunk}from"../common/utils";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import{ActionSheetTheme,show}from"./show";import props from"./props";import useCustomNavbar from"../mixins/using-custom-navbar";import usingConfig from"../mixins/using-config";const{prefix:prefix}=config,componentName="action-sheet";let ActionSheet=class extends SuperComponent{constructor(){super(...arguments),this.behaviors=[useCustomNavbar,usingConfig({componentName:componentName})],this.externalClasses=[`${prefix}-class`,`${prefix}-class-content`,`${prefix}-class-cancel`],this.properties=Object.assign({},props),this.data={prefix:prefix,classPrefix:`${prefix}-${componentName}`,gridThemeItems:[],currentSwiperIndex:0,defaultPopUpProps:{},defaultPopUpzIndex:11500},this.controlledProps=[{key:"visible",event:"visible-change"}],this.observers={items(){this.splitGridThemeActions()},globalConfig(){this.updateInitialData()}},this.lifetimes={ready(){this.init()}},this.methods={init(){this.memoInitialData(),this.splitGridThemeActions()},memoInitialData(){this.updateInitialData()},updateInitialData(){this.initialData=Object.assign(Object.assign({},this.properties),this.data)},splitGridThemeActions(){this.data.theme===ActionSheetTheme.Grid&&this.setData({gridThemeItems:chunk(this.data.items,this.data.count)})},show(e){this.setData(Object.assign(Object.assign(Object.assign({},this.initialData),e),{visible:!0})),this.splitGridThemeActions(),this.autoClose=!0,this._trigger("visible-change",{visible:!0})},close(){this.triggerEvent("close",{trigger:"command"}),this._trigger("visible-change",{visible:!1})},onPopupVisibleChange({detail:e}){e.visible||(this.triggerEvent("close",{trigger:"overlay"}),this._trigger("visible-change",{visible:!1})),this.autoClose&&(this.setData({visible:!1}),this.autoClose=!1)},onSwiperChange(e){const{current:t}=e.detail;this.setData({currentSwiperIndex:t})},onSelect(e){const{currentSwiperIndex:t,items:i,gridThemeItems:s,count:o,theme:n}=this.data,{index:a}=e.currentTarget.dataset,r=n===ActionSheetTheme.Grid,h=r?s[t][a]:i[a],c=r?a+t*o:a;h&&(this.triggerEvent("selected",{selected:h,index:c}),h.disabled||(this.triggerEvent("close",{trigger:"select"}),this._trigger("visible-change",{visible:!1})))},onCancel(){this.triggerEvent("cancel"),this.autoClose&&(this.setData({visible:!1}),this.autoClose=!1)}}}};ActionSheet.show=show,ActionSheet=__decorate([wxComponent()],ActionSheet);export default ActionSheet;
@@ -1 +1 @@
<wxs src="./action-sheet.wxs" module="_this"/><wxs src="../common/utils.wxs" module="_"/><import src="./template/list.wxml"/><import src="./template/grid.wxml"/><view id="{{classPrefix}}" style="{{_._style([style, customStyle])}}" class="{{classPrefix}} class {{prefix}}-class"><t-popup visible="{{visible}}" placement="bottom" usingCustomNavbar="{{usingCustomNavbar}}" bind:visible-change="onPopupVisibleChange" show-overlay="{{showOverlay}}" z-index="{{ popupProps.zIndex || defaultPopUpzIndex }}" overlay-props="{{ popupProps.overlayProps || defaultPopUpProps }}"><view class="{{_.cls(classPrefix + '__content', [['grid', gridThemeItems.length]])}} {{prefix}}-class-content" tabindex="0"><view wx:if="{{description}}" tabindex="0" class="{{_.cls(classPrefix + '__description', [align])}}">{{description}}</view><block wx:if="{{gridThemeItems.length}}"><template is="grid" data="{{classPrefix, prefix, gridThemeItems, count, currentSwiperIndex}}"/></block><view wx:elif="{{items && items.length}}" class="{{classPrefix}}__list"><block wx:for="{{ items }}" wx:key="index"><template is="list" data="{{index, classPrefix, listThemeItemClass: _.cls(classPrefix + '__list-item', [align, [disabled, item.disabled]]), item}}"/></block></view></view><slot/><view wx:if="{{showCancel}}" class="{{classPrefix}}__footer"><view class="{{classPrefix}}__gap-{{theme}}"/><view class="{{classPrefix}}__cancel {{prefix}}-class-cancel" hover-class="{{classPrefix}}__cancel--hover" hover-stay-time="70" bind:tap="onCancel" aria-role="button">{{ cancelText || '取消' }}</view></view></t-popup></view> <wxs src="./action-sheet.wxs" module="_this"/><wxs src="../common/utils.wxs" module="_"/><import src="./template/grid.wxml"/><import src="../common/template/icon.wxml"/><view id="{{classPrefix}}" style="{{_._style([style, customStyle])}}" class="{{_.cls(classPrefix, [align, theme, ['no-description', !description]])}} class {{prefix}}-class"><t-popup visible="{{visible}}" placement="bottom" usingCustomNavbar="{{usingCustomNavbar}}" bind:visible-change="onPopupVisibleChange" show-overlay="{{showOverlay}}" z-index="{{ popupProps.zIndex || defaultPopUpzIndex }}" overlay-props="{{ popupProps.overlayProps || defaultPopUpProps }}"><view class="{{classPrefix}}__content {{prefix}}-class-content" tabindex="0"><view wx:if="{{description}}" tabindex="0" class="{{classPrefix}}__description">{{description}}</view><block wx:if="{{gridThemeItems.length}}"><template is="grid" data="{{classPrefix, prefix, gridThemeItems, count, currentSwiperIndex}}"/></block><view wx:elif="{{items && items.length}}" class="{{classPrefix}}__list"><block wx:for="{{ items }}" wx:key="index"><view data-index="{{index}}" style="{{ item.color ? 'color: ' + item.color : '' }}" class="{{_.cls(classPrefix + '__list-item', [['disabled', item.disabled]])}}" bind:tap="onSelect" aria-role="{{ariaRole || 'button'}}" aria-label="{{item.label || item}}" tabindex="0"><view class="{{classPrefix}}__list-item-content"><template wx:if="{{_this.getIconData(item.icon)}}" is="icon" data="{{tClass: classPrefix + '__list-item-icon', ..._this.getIconData(item.icon)}}"/><view class="{{classPrefix}}__list-item-text">{{item.label || item}}</view><template wx:if="{{_this.getIconData(item.suffixIcon)}}" is="icon" data="{{tClass: classPrefix + '__list-item-icon--suffix', ..._this.getIconData(item.suffixIcon)}}"/></view><view wx:if="{{item.description}}" class="{{classPrefix}}__list-item-desc">{{item.description}}</view></view></block></view></view><slot/><view wx:if="{{showCancel}}" class="{{classPrefix}}__footer"><view class="{{classPrefix}}__gap-{{theme}}"/><view class="{{classPrefix}}__cancel {{prefix}}-class-cancel" hover-class="{{classPrefix}}__cancel--hover" hover-stay-time="70" bind:tap="onCancel" aria-role="button">{{ cancelText || globalConfig.cancel }}</view></view></t-popup></view>
@@ -1,3 +1,5 @@
var utils = require('../common/utils.wxs');
var getListThemeItemClass = function (props) { var getListThemeItemClass = function (props) {
var classPrefix = props.classPrefix; var classPrefix = props.classPrefix;
var item = props.item; var item = props.item;
@@ -9,11 +11,24 @@ var getListThemeItemClass = function (props) {
return classList.join(' '); return classList.join(' ');
}; };
var getIconData = function (icon) {
if (utils.isString(icon)) {
return { name: icon };
}
if (utils.isNoEmptyObj(icon)) {
return icon;
}
return null;
};
var isImage = function (name) { var isImage = function (name) {
return name.indexOf('/') !== -1; return name.indexOf('/') !== -1;
}; };
module.exports = { module.exports = {
getListThemeItemClass: getListThemeItemClass, getListThemeItemClass: getListThemeItemClass,
getIconData: getIconData,
isImage: isImage, isImage: isImage,
}; };
@@ -1 +1,33 @@
@import '../common/style/index.wxss';.t-action-sheet__content{color:var(--td-action-sheet-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));border-top-left-radius:var(--td-action-sheet-border-radius,var(--td-radius-extra-large,24rpx));border-top-right-radius:var(--td-action-sheet-border-radius,var(--td-radius-extra-large,24rpx));background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));overflow:hidden}.t-action-sheet__content--grid{padding-top:16rpx}.t-action-sheet__content:focus{outline:0}.t-action-sheet__grid{padding-bottom:16rpx}.t-action-sheet__grid--swiper{padding-bottom:48rpx}.t-action-sheet__description{color:var(--td-action-sheet-description-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));line-height:44rpx;font-size:28rpx;text-align:var(--td-action-sheet-text-align,center);padding:24rpx 32rpx;position:relative}.t-action-sheet__description:focus{outline:0}.t-action-sheet__description::after{content:'';display:block;position:absolute;top:unset;bottom:0;left:unset;right:unset;background-color:var(--td-action-sheet-border-color,var(--td-border-level-1-color,var(--td-gray-color-3,#e7e7e7)))}.t-action-sheet__description::after{height:1px;left:0;right:0;transform:scaleY(.5)}.t-action-sheet__description--left{text-align:left}.t-action-sheet__description--left::after{left:32rpx}.t-action-sheet__list-item{display:flex;align-items:center;justify-content:center;position:relative;height:var(--td-action-sheet-list-item-height,112rpx);padding:0 32rpx}.t-action-sheet__list-item::after{content:'';display:block;position:absolute;top:unset;bottom:0;left:unset;right:unset;background-color:var(--td-action-sheet-border-color,var(--td-border-level-1-color,var(--td-gray-color-3,#e7e7e7)))}.t-action-sheet__list-item::after{height:1px;left:0;right:0;transform:scaleY(.5)}.t-action-sheet__list-item:focus{outline:0}.t-action-sheet__list-item--left{justify-content:start}.t-action-sheet__list-item--left::after{left:32rpx}.t-action-sheet__list-item--disabled{color:var(--td-action-sheet-list-item-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))))}.t-action-sheet__list-item-text{font-size:var(--td-font-size-m,32rpx);word-wrap:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-action-sheet__list-item-icon{margin-right:16rpx}.t-action-sheet__list-item-icon--suffix{margin-left:auto}.t-action-sheet__swiper-wrap{margin-top:8rpx;position:relative}.t-action-sheet__footer{background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff))}.t-action-sheet__gap-list{height:16rpx;background-color:var(--td-action-sheet-gap-color,var(--td-bg-color-page,var(--td-gray-color-1,#f3f3f3)))}.t-action-sheet__gap-grid{height:1rpx;background-color:var(--td-action-sheet-border-color,var(--td-border-level-1-color,var(--td-gray-color-3,#e7e7e7)))}.t-action-sheet__cancel{display:flex;align-items:center;justify-content:center;color:var(--td-action-sheet-cancel-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));height:var(--td-action-sheet-cancel-height,96rpx)}.t-action-sheet__dots{position:absolute;left:50%;bottom:32rpx;transform:translateX(-50%);display:flex;flex-direction:row}.t-action-sheet__dots-item{width:16rpx;height:16rpx;background-color:#dcdcdc;border-radius:50%;margin:0 16rpx;transition:all .4s ease-in}.t-action-sheet__dots-item.t-is-active{background-color:#0052d9} @import '../common/style/index.wxss';.t-action-sheet__content{color:var(--td-action-sheet-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));border-top-left-radius:var(--td-action-sheet-border-radius,var(--td-radius-extraLarge,24rpx));border-top-right-radius:var(--td-action-sheet-border-radius,var(--td-radius-extraLarge,24rpx));background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));overflow:hidden;}
.t-action-sheet__content:focus{outline:0;}
.t-action-sheet--grid{padding-top:var(--td-spacer,16rpx);}
.t-action-sheet--grid .t-action-sheet__description::after{display:none;}
.t-action-sheet--left .t-action-sheet__description{text-align:left;}
.t-action-sheet--left .t-action-sheet__list-item-content,.t-action-sheet--left .t-action-sheet__list-item-desc{justify-content:start;}
.t-action-sheet--left .t-action-sheet__list-item-icon--suffix{margin-left:auto;}
.t-action-sheet__grid{padding-bottom:16rpx;}
.t-action-sheet__grid--swiper{padding-bottom:48rpx;}
.t-action-sheet__description{color:var(--td-action-sheet-description-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font:var(--td-action-sheet-description-font,var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));text-align:center;padding:var(--td-spacer-1,24rpx) var(--td-spacer-2,32rpx);position:relative;}
.t-action-sheet__description:focus{outline:0;}
.t-action-sheet__description::after{content:'';display:block;position:absolute;top:unset;bottom:0;left:unset;right:unset;background-color:var(--td-action-sheet-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));}
.t-action-sheet__description::after{height:1px;left:0;right:0;transform:scaleY(.5);}
.t-action-sheet__list-item{flex-direction:column;padding:var(--td-spacer-2,32rpx);display:flex;align-items:center;justify-content:center;}
.t-action-sheet__list-item:not(:last-child){position:relative;}
.t-action-sheet__list-item:not(:last-child)::after{content:'';display:block;position:absolute;top:unset;bottom:0;left:unset;right:unset;background-color:var(--td-action-sheet-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));}
.t-action-sheet__list-item:not(:last-child)::after{height:1px;left:0;right:0;transform:scaleY(.5);}
.t-action-sheet__list-item:focus{outline:0;}
.t-action-sheet__list-item--disabled{color:var(--td-action-sheet-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
.t-action-sheet__list-item-content,.t-action-sheet__list-item-desc{width:100%;display:flex;align-items:center;justify-content:center;}
.t-action-sheet__list-item-text{font:var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
.t-action-sheet__list-item-desc{font:var(--td-font-body-small,24rpx / 40rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));color:var(--td-action-sheet-description-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));margin-top:var(--td-spacer,16rpx);}
.t-action-sheet__list-item-desc,.t-action-sheet__list-item-text{word-wrap:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.t-action-sheet__list-item-icon{font-size:48rpx;margin-right:var(--td-spacer,16rpx);}
.t-action-sheet__list-item-icon--suffix{margin-right:0;margin-left:var(--td-spacer,16rpx);}
.t-action-sheet__swiper-wrap{margin-top:8rpx;position:relative;}
.t-action-sheet__footer{background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));}
.t-action-sheet__gap-list{height:16rpx;background-color:var(--td-action-sheet-gap-color,var(--td-bg-color-page,var(--td-gray-color-1,#f3f3f3)));}
.t-action-sheet__gap-grid{height:1rpx;background-color:var(--td-action-sheet-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));}
.t-action-sheet__cancel{padding:var(--td-spacer-1,24rpx) var(--td-spacer-2,32rpx);font:var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));color:var(--td-action-sheet-cancel-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));display:flex;align-items:center;justify-content:center;}
.t-action-sheet__dots{position:absolute;left:50%;bottom:var(--td-spacer-2,32rpx);transform:translateX(-50%);display:flex;flex-direction:row;}
.t-action-sheet__dots-item{width:var(--td-action-sheet-dot-size,16rpx);height:var(--td-action-sheet-dot-size,16rpx);background-color:var(--td-action-sheet-dot-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));border-radius:50%;margin:0 var(--td-spacer,16rpx);transition:all .4s ease-in;}
.t-action-sheet__dots-item.t-is-active{background-color:var(--td-action-sheet-dot-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
@@ -1 +1 @@
<template name="grid"><block wx:if="{{gridThemeItems.length === 1}}"><t-grid align="center" t-class="{{classPrefix}}__grid" column="{{count / 2}}" class="{{classPrefix}}__single-wrap"><t-grid-item t-class="{{classPrefix}}__grid-item" class="{{classPrefix}}__square" wx:for="{{gridThemeItems[0]}}" wx:key="index" bind:tap="onSelect" data-index="{{index}}" icon="{{ { name: item.icon, color: item.color } }}" text="{{item.label || ''}}" image="{{item.image || ''}}" style="--td-grid-item-text-color: {{item.color}}"></t-grid-item></t-grid></block><block wx:elif="{{gridThemeItems.length > 1}}"><view class="{{classPrefix}}__swiper-wrap"><swiper style="height: 456rpx" autoplay="{{false}}" current="{{currentSwiperIndex}}" bindchange="onSwiperChange"><swiper-item wx:for="{{gridThemeItems}}" wx:key="index"><t-grid align="center" t-class="{{classPrefix}}__grid {{classPrefix}}__grid--swiper" column="{{count / 2}}"><t-grid-item t-class="{{classPrefix}}__grid-item" class="{{classPrefix}}__square" wx:for="{{item}}" wx:key="index" data-index="{{index}}" bind:tap="onSelect" icon="{{ { name: item.icon, color: item.color } }}" text="{{item.label || ''}}" image="{{item.image || ''}}" style="--td-grid-item-text-color: {{item.color}}"></t-grid-item></t-grid></swiper-item></swiper><view class="{{classPrefix}}__nav"><view class="{{classPrefix}}__dots"><view wx:for="{{gridThemeItems.length}}" wx:key="index" class="{{classPrefix}}__dots-item {{index === currentSwiperIndex ? prefix + '-is-active' : ''}}"/></view></view></view></block></template> <wxs src="../action-sheet.wxs" module="_this"/><template name="grid"><block wx:if="{{gridThemeItems.length === 1}}"><t-grid align="center" t-class="{{classPrefix}}__grid" column="{{count / 2}}" class="{{classPrefix}}__single-wrap"><t-grid-item t-class="{{classPrefix}}__grid-item" class="{{classPrefix}}__square" wx:for="{{gridThemeItems[0]}}" wx:key="index" bind:tap="onSelect" data-index="{{index}}" icon="{{ { color: item.color, ..._this.getIconData(item.icon) } }}" text="{{item.label || ''}}" description="{{item.description || ''}}" image="{{item.image || ''}}" style="--td-grid-item-text-color: {{item.color}}"></t-grid-item></t-grid></block><block wx:elif="{{gridThemeItems.length > 1}}"><view class="{{classPrefix}}__swiper-wrap"><swiper style="height: 456rpx" autoplay="{{false}}" current="{{currentSwiperIndex}}" bindchange="onSwiperChange"><swiper-item wx:for="{{gridThemeItems}}" wx:key="index"><t-grid align="center" t-class="{{classPrefix}}__grid {{classPrefix}}__grid--swiper" column="{{count / 2}}"><t-grid-item t-class="{{classPrefix}}__grid-item" class="{{classPrefix}}__square" wx:for="{{item}}" wx:key="index" data-index="{{index}}" bind:tap="onSelect" icon="{{ { color: item.color, ..._this.getIconData(item.icon) } }}" text="{{item.label || ''}}" description="{{item.description || ''}}" image="{{item.image || ''}}" style="--td-grid-item-text-color: {{item.color}}"></t-grid-item></t-grid></swiper-item></swiper><view class="{{classPrefix}}__nav"><view class="{{classPrefix}}__dots"><view wx:for="{{gridThemeItems.length}}" wx:key="index" class="{{classPrefix}}__dots-item {{index === currentSwiperIndex ? prefix + '-is-active' : ''}}"/></view></view></view></block></template>
@@ -1 +0,0 @@
<template name="list"><view data-index="{{index}}" style="{{ item.color ? 'color: ' + item.color : '' }}" class="{{listThemeItemClass}}" bind:tap="onSelect" aria-role="{{ariaRole || 'button'}}" aria-label="{{item.label || item}}" tabindex="0"><t-icon wx:if="{{item.icon}}" name="{{item.icon}}" class="{{classPrefix}}__list-item-icon" size="48rpx"></t-icon><view class="{{classPrefix}}__list-item-text">{{item.label || item}}</view><t-icon wx:if="{{item.suffixIcon}}" name="{{item.suffixIcon}}" class="{{classPrefix}}__list-item-icon {{classPrefix}}__list-item-icon--suffix" size="48rpx"></t-icon></view></template>
+3 -2
View File
@@ -52,8 +52,9 @@ export interface TdActionSheetProps {
} }
export interface ActionSheetItem { export interface ActionSheetItem {
label: string; label: string;
description?: string;
color?: string; color?: string;
disabled?: boolean; disabled?: boolean;
icon?: string; icon?: string | object;
suffixIcon?: string; suffixIcon?: string | object;
} }
@@ -0,0 +1,52 @@
import { SuperComponent } from '../../../components/common/src/index';
import { TdAttachmentsProps } from './type';
export interface AttachmentsProps extends TdAttachmentsProps {
}
export default class Attachments extends SuperComponent {
behaviors: string[];
options: {
multipleSlots: boolean;
};
properties: {
inChat: {
type: BooleanConstructor;
value: boolean;
};
imageViewer?: {
type: BooleanConstructor;
value?: boolean;
};
items: {
type: ArrayConstructor;
value?: import("./type").FileItem[];
required?: boolean;
};
removable?: {
type: BooleanConstructor;
value?: boolean;
};
};
data: {
classPrefix: string;
files: any[];
};
observers: {
items(): void;
};
methods: {
onFileWrapTap(e: any): void;
onRemoveTap(e: any): void;
handleFileClick(item: any): void;
handleRemove(item: any, index: any): void;
renderDesc(item: any): string;
renderIcon(item: any): any;
renderFileType(item: any): any;
renderExtension(item: any): any;
setFiles(): void;
};
lifetimes: {
created(): void;
attached(): void;
detached(): void;
};
}
@@ -0,0 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import usingConfig from"../mixins/using-config";const{prefix:prefix}=config,componentName="attachments";let Attachments=class extends SuperComponent{constructor(){super(...arguments),this.behaviors=[usingConfig({componentName:"attachments"})],this.options={multipleSlots:!0},this.properties=Object.assign(Object.assign({},props),{inChat:{type:Boolean,value:!1}}),this.data={classPrefix:`${prefix}-attachments`,files:[]},this.observers={items(){this.setFiles()}},this.methods={onFileWrapTap(e){var i;const{index:t}=e.currentTarget.dataset||{},o=null===(i=this.data.files)||void 0===i?void 0:i[t];o&&this.handleFileClick(o)},onRemoveTap(e){var i;const{index:t}=e.currentTarget.dataset||{},o=null===(i=this.data.files)||void 0===i?void 0:i[t];"function"==typeof(null==e?void 0:e.stopPropagation)&&e.stopPropagation(),void 0!==o&&this.handleRemove(o,t)},handleFileClick(e){this.data.imageViewer&&"image"===e.fileType&&wx.previewImage({urls:[e.url]}),this.triggerEvent("fileClick",{item:e})},handleRemove(e,i){this.triggerEvent("remove",{item:e,index:i})},renderDesc(e){const i=e.size||0;let t,o;if(i<1024)t=i,o="B";else if(i<1048576){const e=i/1024;t=e%1==0?e:e.toFixed(2),o="KB"}else{const e=i/1048576;t=e%1==0?e:e.toFixed(2),o="MB"}return`${t} ${o}`},renderIcon(e){const i={file:{name:"file-zip-filled",color:"#E37318"},video:{name:"video-filled",color:"#D54941"},pdf:{name:"file-pdf-filled",color:"#D54941"},doc:{name:"file-word-filled",color:"#0052d9"},excel:{name:"file-excel-filled",color:"#2BA471"},ppt:{name:"file-powerpoint-filled",color:"#E37318"},audio:{name:"video-filled",color:"#D54941"}};return i[e.fileType]||i.file},renderFileType(e){if(e.fileType)return e.fileType;if(["image","video","audio","pdf","doc","ppt","txt","excel"].includes(e.type))return e.fileType;const i=e.url||"",t=i.lastIndexOf(".");return{jpg:"image",jpeg:"image",png:"image",gif:"image",bmp:"image",webp:"image",mp4:"video",mov:"video",avi:"video",mkv:"video",webm:"video",mp3:"audio",wav:"audio",ogg:"audio",aac:"audio",pdf:"pdf",doc:"doc",docx:"doc",ppt:"ppt",pptx:"ppt",xls:"excel",xlsx:"excel",txt:"txt"}[-1!==t?i.substring(t+1).toLowerCase():""]||""},renderExtension(e){if(e.extension)return e.extension;return e.extension||(e.url?e.url.split(".").pop().toLowerCase():"")},setFiles(){this.setData({files:this.properties.items.map(e=>Object.assign(Object.assign({},e),{fileType:this.data.renderFileType(e),desc:this.data.renderDesc(e),fileIcon:this.data.renderIcon(e)}))})}},this.lifetimes={created(){this.data.handleFileClick=this.handleFileClick.bind(this),this.data.handleRemove=this.handleRemove.bind(this),this.data.renderDesc=this.renderDesc.bind(this),this.data.renderIcon=this.renderIcon.bind(this),this.data.renderFileType=this.renderFileType.bind(this),this.data.renderExtension=this.renderExtension.bind(this)},attached(){this.setFiles()},detached(){}}}};Attachments=__decorate([wxComponent()],Attachments);export default Attachments;
@@ -0,0 +1 @@
{"component":true,"styleIsolation":"apply-shared","usingComponents":{"t-icon":"../icon/icon","t-image":"../image/image","t-loading":"../loading/loading"}}
@@ -0,0 +1 @@
<wxs src="./attachments.wxs" module="_this"/><wxs src="../common/utils.wxs" module="_"/><view class="{{classPrefix}} {{[inChat ? classPrefix + '--chatting' : '', _this.getFileTypeClass(inChat, files)]}}" style="{{_._style([style, customStyle])}}"><view class="{{classPrefix}}__left"><view class="{{classPrefix}}__scrollable scroll-x"><block wx:for="{{files}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view class="{{classPrefix}}__files" bindtap="onFileWrapTap" data-index="{{index}}"><block wx:if="{{item.fileType==='image'}}"><view class="file-image {{classPrefix}}__file {{removable ? classPrefix + '__file--removable' : ''}}"><block wx:if="{{item.status==='pending' || item.status==='fail' || item.status==='error'}}"><view class="{{item.status}} {{classPrefix}}__file--{{item.status}}"><t-loading theme="circular" size="48rpx"/></view></block><block wx:else><image class="image" src="{{item.url}}" mode="{{_this.getImageMode(item)}}" lazy-load="false" style="{{inChat ? _this.imageStyle(item) : ''}}"></image></block><view wx:if="{{removable}}" class="{{classPrefix}}__remove"><t-icon data-index="{{index}}" name="multiply" size="16px" catchtap="onRemoveTap"/></view></view></block><block wx:else><view class="file {{classPrefix}}__file {{removable ? classPrefix + '__file--removable' : ''}}"><view class="image"><block wx:if="{{item.status==='pending'}}"><view class="loading {{classPrefix}}__file--pending"><t-loading theme="circular" size="48rpx"/></view></block><block wx:elif="{{item.status==='fail'}}"><view class="fail {{classPrefix}}__file--fail"><t-loading theme="circular" size="48rpx"/></view></block><block wx:elif="{{item.status==='error'}}"><view class="error {{classPrefix}}__file--error"><t-loading theme="circular" size="48rpx"/></view></block><block wx:else><t-icon name="{{item.fileIcon.name}}" color="{{item.fileIcon.color}}" size="48rpx"></t-icon></block></view><view class="{{classPrefix}}__content"><view class="{{classPrefix}}__title">{{item.name}}</view><block><view wx:if="{{item.status==='pending'}}" class="{{classPrefix}}__desc">{{globalConfig.status['pending']}} {{item.progress || 0+"%"}}</view><view wx:elif="{{item.status==='fail'}}" class="{{classPrefix}}__desc">{{globalConfig.status['fail']}}</view><view wx:elif="{{item.status==='error'}}" class="{{classPrefix}}__desc">{{item.errorMessage}}</view><view wx:else class="{{classPrefix}}__desc">{{item.desc}}</view></block></view><view wx:if="{{removable}}" class="{{classPrefix}}__remove"><t-icon data-index="{{index}}" name="multiply" size="16px" catchtap="onRemoveTap"/></view></view></block></view></block></view></view></view>
@@ -0,0 +1,53 @@
var utils = require('../common/utils.wxs');
function imageStyle(imageProps) {
if (imageProps && imageProps.width && imageProps.height) {
return utils._style({
width: utils.addUnit(imageProps.width),
height: utils.addUnit(imageProps.height),
});
}
// 兜底逻辑:没有传入 width 和 height 时,使用默认最大宽高尺寸
return utils._style({
width: '400rpx',
height: '400rpx',
});
}
function getImageMode(imageProps) {
if (imageProps && imageProps.width && imageProps.height) {
return imageProps.width > imageProps.height ? 'widthFix' : 'heightFix';
}
// 兜底逻辑:没有传入 width 和 height 时,使用 aspectFit 保持图片比例
return imageProps && imageProps.mode ? imageProps.mode : 'scaleToFill';
}
function getFileTypeClass(inChat, files) {
// 如果 inChat 不为 true,返回空字符串
if (!inChat) {
return '';
}
// 如果 files 为空或不存在,返回空字符串
if (!files || files.length === 0) {
return '';
}
// 检查是否所有文件的 fileType 都是 'image'
var allImages = true;
for (var i = 0; i < files.length; i++) {
if (files[i].fileType !== 'image') {
allImages = false;
break;
}
}
// 根据判断结果返回相应的类名
return allImages ? 'all_images' : 'all_files';
}
module.exports = {
imageStyle: imageStyle,
getImageMode: getImageMode,
getFileTypeClass: getFileTypeClass,
};
@@ -0,0 +1,33 @@
@import '../common/style/index.wxss';.t-attachments{display:flex;width:100%;height:auto;}
.t-attachments__scrollable{height:100%;display:flex;align-items:center;justify-content:flex-start;}
.t-attachments .scroll-x{white-space:nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;-ms-overflow-style:none;}
.t-attachments .scroll-x::-webkit-scrollbar{display:none;}
.t-attachments .wrap{flex-wrap:wrap;overflow-x:hidden;}
.t-attachments__left{flex:1;overflow:hidden;}
.t-attachments__file--error,.t-attachments__file--fail,.t-attachments__file--pending,.t-attachments__file--success{position:absolute;width:100%;height:100%;top:0;left:0;border-radius:var(--td-radius-extraLarge,24rpx);display:flex;flex-direction:column;align-items:center;justify-content:center;}
.t-attachments__files{box-sizing:border-box;margin-left:16rpx;}
.t-attachments__files:first-of-type{margin-left:0;}
.t-attachments__file{border-radius:var(--td-radius-extraLarge,24rpx);display:block;position:relative;background-color:var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3));overflow:visible;}
.t-attachments__file--removable{margin-top:12rpx;margin-right:8rpx;}
.t-attachments__file .t-attachments__remove{background-color:var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9)));color:var(--td-bg-color-container,var(--td-font-white-1,#fff));border-radius:var(--td-radius-circle,50%);position:absolute;right:-8rpx;top:-8rpx;}
.t-attachments__file.file-image{width:104rpx;height:104rpx;}
.t-attachments__file.file-image .image{width:100%;height:100%;border-radius:var(--td-radius-extraLarge,24rpx);}
.t-attachments__file.file{width:256rpx;height:104rpx;display:flex;align-items:stretch;justify-content:flex-start;padding:0 24rpx;}
.t-attachments__file.file .image{width:64rpx;height:auto;box-sizing:border-box;overflow:hidden;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;}
.t-attachments__file.file .image image{width:100%;height:100%;}
.t-attachments__file.file .t-attachments__content{flex:1;overflow:hidden;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin-left:16rpx;}
.t-attachments__file.file .t-attachments__content .t-attachments__title{width:100%;color:var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9)));font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));font-style:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-bottom:-2rpx;padding:0;}
.t-attachments__file.file .t-attachments__content .t-attachments__desc{width:100%;color:var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4)));font:var(--td-font-body-small,24rpx / 40rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));font-style:normal;margin-top:-4rpx;}
.t-attachments--chatting.all_images{width:100%;}
.t-attachments--chatting.all_images .file-image.t-attachments__file{background-color:transparent!important;}
.t-attachments--chatting.all_images .file-image{width:auto;height:auto;}
.t-attachments--chatting.all_images .file-image .image{max-width:400rpx;max-height:400rpx;border-radius:var(--td-radius-extraLarge,24rpx);}
.t-attachments--chatting.all_files{width:auto;}
.t-attachments--chatting.all_files .t-attachments__files:not(:last-child){margin-bottom:16rpx;}
.t-attachments--chatting.all_files .file-image.t-attachments__file{background-color:transparent!important;}
.t-attachments--chatting.all_files .file-image{width:auto;height:auto;}
.t-attachments--chatting.all_files .file-image .image{max-width:400rpx;max-height:400rpx;border-radius:var(--td-radius-extraLarge,24rpx);}
.t-attachments--chatting.all_files .t-attachments__files{margin-left:0;}
.t-attachments--chatting.all_files .t-attachments__scrollable{display:contents;}
.t-attachments--chatting.all_files .file.t-attachments__file{width:352rpx;}
.t-chat__inner.right .t-attachments--chatting .file-image.t-attachments__file{text-align:right;}
@@ -0,0 +1,3 @@
export * from './props';
export * from './type';
export * from './attachments';
@@ -0,0 +1 @@
export*from"./props";export*from"./type";export*from"./attachments";
@@ -0,0 +1,3 @@
import { TdAttachmentsProps } from './type';
declare const props: TdAttachmentsProps;
export default props;
@@ -0,0 +1 @@
const props={imageViewer:{type:Boolean,value:!0},items:{type:Array,value:[],required:!0},removable:{type:Boolean,value:!0}};export default props;
@@ -0,0 +1,28 @@
export interface TdAttachmentsProps {
imageViewer?: {
type: BooleanConstructor;
value?: boolean;
};
items: {
type: ArrayConstructor;
value?: FileItem[];
required?: boolean;
};
removable?: {
type: BooleanConstructor;
value?: boolean;
};
}
export interface FileItem {
fileType: 'image' | 'video' | 'audio' | 'pdf' | 'doc' | 'ppt' | 'txt';
name: string;
url: string;
size: number;
status?: 'success' | 'fail' | 'pending' | 'error';
progress?: number;
errorMessage?: string;
fileIcon?: string;
width?: number;
height?: number;
mode?: 'aspectFit' | 'aspectFill' | 'widthFix' | 'heightFix' | 'scaleToFill';
}
@@ -0,0 +1 @@
export{};
@@ -1 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import avatarGroupProps from"./props";const{prefix:prefix}=config,name=`${prefix}-avatar-group`;let AvatarGroup=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-content`,`${prefix}-class-image`],this.properties=avatarGroupProps,this.data={prefix:prefix,classPrefix:name,hasChild:!0,length:0,className:""},this.options={multipleSlots:!0},this.relations={"../avatar/avatar":{type:"descendant"}},this.lifetimes={attached(){this.setClass()},ready(){this.setData({length:this.$children.length}),this.handleMax()}},this.observers={"cascading, size"(){this.setClass()}},this.methods={setClass(){const{cascading:e,size:t}=this.properties,s=e.split("-")[0],a=[name,`${prefix}-class`,`${name}-offset-${s}`,`${name}-offset-${s}-${t.indexOf("px")>-1?"medium":t||"medium"}`];this.setData({className:a.join(" ")})},handleMax(){const{max:e}=this.data,t=this.$children.length;if(!e||e>t)return;this.$children.splice(e,t-e).forEach((e=>{e.hide()}))},onCollapsedItemClick(e){this.triggerEvent("collapsed-item-click",e.detail)}}}};AvatarGroup=__decorate([wxComponent()],AvatarGroup);export default AvatarGroup; import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import avatarGroupProps from"./props";const{prefix:prefix}=config,name=`${prefix}-avatar-group`;let AvatarGroup=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-content`,`${prefix}-class-image`],this.properties=avatarGroupProps,this.data={prefix:prefix,classPrefix:name,hasChild:!0,length:0,className:""},this.options={multipleSlots:!0},this.relations={"../avatar/avatar":{type:"descendant"}},this.lifetimes={attached(){this.setClass()},ready(){this.setData({length:this.$children.length}),this.handleMax()}},this.observers={"cascading, size"(){this.setClass()}},this.methods={setClass(){const{cascading:e,size:t}=this.properties,s=e.split("-")[0],a=[name,`${prefix}-class`,`${name}-offset-${s}`,`${name}-offset-${s}-${t.indexOf("px")>-1?"medium":t||"medium"}`];this.setData({className:a.join(" ")})},handleMax(){const{max:e}=this.data,t=this.$children.length;if(!e||e>t)return;this.$children.splice(e,t-e).forEach(e=>{e.hide()})},onCollapsedItemClick(e){this.triggerEvent("collapsed-item-click",e.detail)}}}};AvatarGroup=__decorate([wxComponent()],AvatarGroup);export default AvatarGroup;
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -9,7 +9,7 @@ export default class Avatar extends SuperComponent {
classPrefix: string; classPrefix: string;
isShow: boolean; isShow: boolean;
zIndex: number; zIndex: number;
systemInfo: WechatMiniprogram.WindowInfo | WechatMiniprogram.SystemInfo; windowWidth: number;
}; };
relations: RelationsOptions; relations: RelationsOptions;
observers: { observers: {
@@ -1 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import avatarProps from"./props";import{setIcon,systemInfo}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-avatar`;let Avatar=class extends SuperComponent{constructor(){super(...arguments),this.options={multipleSlots:!0},this.externalClasses=[`${prefix}-class`,`${prefix}-class-image`,`${prefix}-class-icon`,`${prefix}-class-alt`,`${prefix}-class-content`],this.properties=avatarProps,this.data={prefix:prefix,classPrefix:name,isShow:!0,zIndex:0,systemInfo:systemInfo},this.relations={"../avatar-group/avatar-group":{type:"ancestor",linked(t){this.parent=t,this.setData({shape:this.data.shape||t.data.shape||"circle",size:this.data.size||t.data.size,bordered:!0})}}},this.observers={icon(t){const s=setIcon("icon",t,"");this.setData(Object.assign({},s))}},this.methods={hide(){this.setData({isShow:!1})},onLoadError(t){this.properties.hideOnLoadFailed&&this.setData({isShow:!1}),this.triggerEvent("error",t.detail)}}}};Avatar=__decorate([wxComponent()],Avatar);export default Avatar; import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import avatarProps from"./props";import{setIcon,systemInfo}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-avatar`;let Avatar=class extends SuperComponent{constructor(){super(...arguments),this.options={multipleSlots:!0},this.externalClasses=[`${prefix}-class`,`${prefix}-class-image`,`${prefix}-class-icon`,`${prefix}-class-alt`,`${prefix}-class-content`],this.properties=avatarProps,this.data={prefix:prefix,classPrefix:name,isShow:!0,zIndex:0,windowWidth:systemInfo.windowWidth},this.relations={"../avatar-group/avatar-group":{type:"ancestor",linked(t){this.parent=t,this.setData({shape:this.data.shape||t.data.shape||"circle",size:this.data.size||t.data.size,bordered:!0})}}},this.observers={icon(t){const e=setIcon("icon",t,"");this.setData(Object.assign({},e))}},this.methods={hide(){this.setData({isShow:!1})},onLoadError(t){this.properties.hideOnLoadFailed&&this.setData({isShow:!1}),this.triggerEvent("error",t.detail)}}}};Avatar=__decorate([wxComponent()],Avatar);export default Avatar;
@@ -1 +1 @@
<import src="../common/template/icon.wxml"/><wxs src="../common/utils.wxs" module="_"/><wxs src="./avatar.wxs" module="_this"/><view class="{{classPrefix}}__wrapper class {{prefix}}-class" style="{{_._style([_this.getStyles(isShow), style, customStyle])}}"><t-badge color="{{badgeProps.color || ''}}" content="{{badgeProps.content || ''}}" count="{{badgeProps.count || 0}}" dot="{{badgeProps.dot || false}}" max-count="{{badgeProps.maxCount || 99}}" offset="{{badgeProps.offset || []}}" shape="{{badgeProps.shape || 'circle'}}" show-zero="{{badgeProps.showZero || false}}" size="{{badgeProps.size || 'medium'}}" t-class="{{badgeProps.tClass}}" t-class-content="{{badgeProps.tClassContent}}" t-class-count="{{badgeProps.tClassCount}}"><view class="{{_this.getClass(classPrefix, size || 'medium', shape, bordered)}} {{prefix}}-class-image" style="{{_this.getSize(size, systemInfo)}}" aria-label="{{ ariaLabel || alt ||'头像'}}" aria-role="{{ ariaRole || 'img'}}" aria-hidden="{{ ariaHidden }}"><t-image wx:if="{{image}}" t-class="{{prefix}}-image {{classPrefix}}__image" t-class-load="{{prefix}}-class-alt" style="{{imageProps && imageProps.style || ''}}" src="{{image}}" mode="{{imageProps && imageProps.mode || 'aspectFill'}}" lazy="{{imageProps && imageProps.lazy || false}}" loading="{{imageProps && imageProps.loading || 'default'}}" shape="{{imageProps && imageProps.shape || 'round'}}" webp="{{imageProps && imageProps.webp || false}}" error="{{alt || 'default'}}" bind:error="onLoadError"/><template wx:elif="{{iconName || _.isNoEmptyObj(iconData)}}" is="icon" data="{{tClass: classPrefix + '__icon ' + prefix + '-class-icon', name: iconName, ...iconData}}"/><view wx:else class="{{classPrefix}}__text {{prefix}}-class-content"><slot/></view></view></t-badge></view> <import src="../common/template/icon.wxml"/><wxs src="../common/utils.wxs" module="_"/><wxs src="./avatar.wxs" module="_this"/><view class="{{classPrefix}}__wrapper class {{prefix}}-class" style="{{_._style([_this.getStyles(isShow), style, customStyle])}}"><t-badge color="{{badgeProps.color || ''}}" content="{{badgeProps.content || ''}}" count="{{badgeProps.count || 0}}" dot="{{badgeProps.dot || false}}" max-count="{{badgeProps.maxCount || 99}}" offset="{{badgeProps.offset || []}}" shape="{{badgeProps.shape || 'circle'}}" show-zero="{{badgeProps.showZero || false}}" size="{{badgeProps.size || 'medium'}}" t-class="{{badgeProps.tClass}}" t-class-content="{{badgeProps.tClassContent}}" t-class-count="{{badgeProps.tClassCount}}"><view class="{{_this.getClass(classPrefix, size || 'medium', shape, bordered)}} {{prefix}}-class-image" style="{{_this.getSize(size, windowWidth)}}" aria-label="{{ ariaLabel || alt ||'头像'}}" aria-role="{{ ariaRole || 'img'}}" aria-hidden="{{ ariaHidden }}"><t-image wx:if="{{image}}" t-class="{{prefix}}-image {{classPrefix}}__image" t-class-load="{{prefix}}-class-alt" style="{{imageProps && imageProps.style || ''}}" src="{{image}}" mode="{{imageProps && imageProps.mode || 'aspectFill'}}" lazy="{{imageProps && imageProps.lazy || false}}" loading="{{imageProps && imageProps.loading || 'default'}}" shape="{{imageProps && imageProps.shape || 'round'}}" webp="{{imageProps && imageProps.webp || false}}" error="{{alt || 'default'}}" bind:error="onLoadError"/><template wx:elif="{{iconName || _.isNoEmptyObj(iconData)}}" is="icon" data="{{tClass: classPrefix + '__icon ' + prefix + '-class-icon', name: iconName, ...iconData}}"/><view wx:else class="{{classPrefix}}__text {{prefix}}-class-content"><slot/></view></view></t-badge></view>
@@ -11,13 +11,13 @@ module.exports = {
return classNames.join(' '); return classNames.join(' ');
}, },
getSize: function (size = 'medium', systemInfo) { getSize: function (size = 'medium', windowWidth) {
var res = getRegExp('^([0-9]+)(px|rpx)$').exec(size); var res = getRegExp('^([0-9]+)(px|rpx)$').exec(size);
if (res && res.length >= 3) { if (res && res.length >= 3) {
var px = res[1]; var px = res[1];
if (res[2] === 'rpx') { if (res[2] === 'rpx') {
px = Math.floor((systemInfo.windowWidth * res[1]) / 750); px = Math.floor((windowWidth * res[1]) / 750);
} }
return 'width:' + size + ';height:' + size + ';font-size:' + ((px / 8) * 3 + 2) + 'px'; return 'width:' + size + ';height:' + size + ';font-size:' + ((px / 8) * 3 + 2) + 'px';
@@ -1 +1,17 @@
@import '../common/style/index.wxss';.t-avatar{display:flex;align-items:center;justify-content:center;box-sizing:border-box;background-color:var(--td-avatar-bg-color,var(--td-brand-color-light-active,var(--td-primary-color-2,#d9e1ff)));color:var(--td-avatar-content-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)))}.t-avatar__wrapper{display:inline-flex;position:relative;vertical-align:top;margin-left:var(--td-avatar-margin-left,0)}.t-avatar--large{width:var(--td-avatar-large-width,128rpx);height:var(--td-avatar-large-width,128rpx);font-size:var(--td-avatar-text-large-font-size,var(--td-font-size-xl,40rpx))}.t-avatar--large .t-avatar__icon{font-size:var(--td-avatar-icon-large-font-size,64rpx)}.t-avatar--medium{width:var(--td-avatar-medium-width,96rpx);height:var(--td-avatar-medium-width,96rpx);font-size:var(--td-avatar-text-medium-font-size,var(--td-font-size-m,32rpx))}.t-avatar--medium .t-avatar__icon{font-size:var(--td-avatar-icon-medium-font-size,48rpx)}.t-avatar--small{width:var(--td-avatar-small-width,80rpx);height:var(--td-avatar-small-width,80rpx);font-size:var(--td-avatar-text-small-font-size,var(--td-font-size-base,28rpx))}.t-avatar--small .t-avatar__icon{font-size:var(--td-avatar-icon-small-font-size,40rpx)}.t-avatar .t-image,.t-avatar__image{width:100%;height:100%}.t-avatar--circle{border-radius:var(--td-avatar-circle-border-radius,var(--td-radius-circle,50%));overflow:hidden}.t-avatar--round{border-radius:var(--td-avatar-round-border-radius,var(--td-radius-default,12rpx));overflow:hidden}.t-avatar__icon,.t-avatar__text{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.t-avatar__icon:empty,.t-avatar__text:empty{width:0;height:0}.t-avatar--border{border-color:var(--td-avatar-border-color,#fff);border-style:solid}.t-avatar--border-small{border-width:var(--td-avatar-border-width-small,2rpx)}.t-avatar--border-medium{border-width:var(--td-avatar-border-width-medium,4rpx)}.t-avatar--border-large{border-width:var(--td-avatar-border-width-large,6rpx)} @import '../common/style/index.wxss';.t-avatar{display:flex;align-items:center;justify-content:center;box-sizing:border-box;background-color:var(--td-avatar-bg-color,var(--td-brand-color-light-active,var(--td-primary-color-2,#d9e1ff)));color:var(--td-avatar-content-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-avatar__wrapper{display:inline-flex;position:relative;vertical-align:top;margin-left:var(--td-avatar-margin-left,0);}
.t-avatar--large{width:var(--td-avatar-large-width,128rpx);height:var(--td-avatar-large-width,128rpx);font-size:var(--td-avatar-text-large-font-size,var(--td-font-size-xl,40rpx));}
.t-avatar--large .t-avatar__icon{font-size:var(--td-avatar-icon-large-font-size,64rpx);}
.t-avatar--medium{width:var(--td-avatar-medium-width,96rpx);height:var(--td-avatar-medium-width,96rpx);font-size:var(--td-avatar-text-medium-font-size,var(--td-font-size-m,32rpx));}
.t-avatar--medium .t-avatar__icon{font-size:var(--td-avatar-icon-medium-font-size,48rpx);}
.t-avatar--small{width:var(--td-avatar-small-width,80rpx);height:var(--td-avatar-small-width,80rpx);font-size:var(--td-avatar-text-small-font-size,var(--td-font-size-base,28rpx));}
.t-avatar--small .t-avatar__icon{font-size:var(--td-avatar-icon-small-font-size,40rpx);}
.t-avatar .t-image,.t-avatar__image{width:100%;height:100%;}
.t-avatar--circle{border-radius:var(--td-avatar-circle-border-radius,var(--td-radius-circle,50%));overflow:hidden;}
.t-avatar--round{border-radius:var(--td-avatar-round-border-radius,var(--td-radius-default,12rpx));overflow:hidden;}
.t-avatar__icon,.t-avatar__text{width:100%;height:100%;display:flex;align-items:center;justify-content:center;}
.t-avatar__icon:empty,.t-avatar__text:empty{width:0;height:0;}
.t-avatar--border{border-color:var(--td-avatar-border-color,#fff);border-style:solid;}
.t-avatar--border-small{border-width:var(--td-avatar-border-width-small,2rpx);}
.t-avatar--border-medium{border-width:var(--td-avatar-border-width-medium,4rpx);}
.t-avatar--border-large{border-width:var(--td-avatar-border-width-large,6rpx);}
@@ -1 +1,10 @@
@import '../common/style/index.wxss';.t-back-top{display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:transparent;overflow:hidden;box-sizing:border-box;transition:height .2s;height:auto}.t-back-top--fixed{position:fixed;right:var(--td-spacer,16rpx);bottom:calc(var(--td-spacer-2,32rpx) + env(safe-area-inset-bottom))}.t-back-top--round,.t-back-top--round-dark{width:96rpx;height:96rpx;border-radius:var(--td-back-top-round-border-radius,var(--td-radius-circle,50%))}.t-back-top--half-round,.t-back-top--round{color:var(--td-back-top-round-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));border:1rpx solid var(--td-back-top-round-border-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));background-color:var(--td-back-top-round-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)))}.t-back-top--half-round-dark,.t-back-top--round-dark{color:var(--td-back-top-round-dark-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));background-color:var(--td-back-top-round-dark-bg-color,var(--td-gray-color-13,#242424))}.t-back-top--half-round,.t-back-top--half-round-dark{width:120rpx;height:80rpx;border-radius:0;border-top-left-radius:var(--td-back-top-half-round-border-radius,var(--td-radius-round,999px));border-bottom-left-radius:var(--td-back-top-half-round-border-radius,var(--td-radius-round,999px));flex-direction:row;right:0}.t-back-top__text--half-round,.t-back-top__text--half-round-dark,.t-back-top__text--round,.t-back-top__text--round-dark{font-size:var(--td-font-size,20rpx);line-height:24rpx}.t-back-top__text--half-round,.t-back-top__text--half-round-dark{width:48rpx}.t-back-top__icon:not(:empty)+.t-back-top__text--half-round,.t-back-top__icon:not(:empty)+.t-back-top__text--half-round-dark{margin-left:8rpx}.t-back-top__icon{display:flex;justify-content:center;align-items:center;font-size:44rpx} @import '../common/style/index.wxss';.t-back-top{display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:transparent;overflow:hidden;box-sizing:border-box;transition:height .2s;height:auto;}
.t-back-top--fixed{position:fixed;right:var(--td-spacer,16rpx);bottom:calc(var(--td-spacer-2,32rpx) + env(safe-area-inset-bottom));}
.t-back-top--round,.t-back-top--round-dark{width:96rpx;height:96rpx;border-radius:var(--td-back-top-round-border-radius,var(--td-radius-circle,50%));}
.t-back-top--half-round,.t-back-top--round{color:var(--td-back-top-round-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));border:1rpx solid var(--td-back-top-round-border-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));background-color:var(--td-back-top-round-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));}
.t-back-top--half-round-dark,.t-back-top--round-dark{color:var(--td-back-top-round-dark-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));background-color:var(--td-back-top-round-dark-bg-color,var(--td-gray-color-13,#242424));}
.t-back-top--half-round,.t-back-top--half-round-dark{width:120rpx;height:80rpx;border-radius:0;border-top-left-radius:var(--td-back-top-half-round-border-radius,var(--td-radius-round,999px));border-bottom-left-radius:var(--td-back-top-half-round-border-radius,var(--td-radius-round,999px));flex-direction:row;right:0;}
.t-back-top__text--half-round,.t-back-top__text--half-round-dark,.t-back-top__text--round,.t-back-top__text--round-dark{font-weight:600;font-size:var(--td-font-size,20rpx);line-height:24rpx;}
.t-back-top__text--half-round,.t-back-top__text--half-round-dark{width:48rpx;}
.t-back-top__icon:not(:empty)+.t-back-top__text--half-round,.t-back-top__icon:not(:empty)+.t-back-top__text--half-round-dark{margin-left:8rpx;}
.t-back-top__icon{display:flex;justify-content:center;align-items:center;font-size:44rpx;}
@@ -1 +1 @@
const props={fixed:{type:Boolean,value:!0},icon:{type:null,value:!0},scrollTop:{type:Number,value:0},style:{type:String,value:""},text:{type:String,value:""},theme:{type:String,value:"round"},visibilityHeight:{type:Number,value:200}};export default props; const props={fixed:{type:Boolean,value:!0},icon:{type:null,value:!0},scrollTop:{type:Number,value:0},text:{type:String,value:""},theme:{type:String,value:"round"},visibilityHeight:{type:Number,value:200}};export default props;
@@ -11,10 +11,6 @@ export interface TdBackTopProps {
type: NumberConstructor; type: NumberConstructor;
value?: number; value?: number;
}; };
style?: {
type: StringConstructor;
value?: string;
};
text?: { text?: {
type: StringConstructor; type: StringConstructor;
value?: string; value?: string;
+4
View File
@@ -14,8 +14,12 @@ export default class Badge extends SuperComponent {
value: string; value: string;
labelID: string; labelID: string;
descriptionID: string; descriptionID: string;
useOuterClass: boolean;
}; };
lifetimes: { lifetimes: {
ready(): void; ready(): void;
}; };
methods: {
checkForActualContent(): Promise<void>;
};
} }
@@ -1 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{uniqueFactory}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-badge`,getUniqueID=uniqueFactory("badge");let Badge=class extends SuperComponent{constructor(){super(...arguments),this.options={multipleSlots:!0},this.externalClasses=[`${prefix}-class`,`${prefix}-class-count`,`${prefix}-class-content`],this.properties=props,this.data={prefix:prefix,classPrefix:name,value:"",labelID:"",descriptionID:""},this.lifetimes={ready(){const e=getUniqueID();this.setData({labelID:`${e}_label`,descriptionID:`${e}_description`})}}}};Badge=__decorate([wxComponent()],Badge);export default Badge; import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{uniqueFactory,getRect}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-badge`,getUniqueID=uniqueFactory("badge");let Badge=class extends SuperComponent{constructor(){super(...arguments),this.options={multipleSlots:!0},this.externalClasses=[`${prefix}-class`,`${prefix}-class-count`,`${prefix}-class-content`],this.properties=props,this.data={prefix:prefix,classPrefix:name,value:"",labelID:"",descriptionID:"",useOuterClass:!1},this.lifetimes={ready(){const e=getUniqueID();this.setData({labelID:`${e}_label`,descriptionID:`${e}_description`}),this.checkForActualContent()}},this.methods={checkForActualContent(){if(!this.properties.content&&["ribbon","ribbon-right","ribbon-left","triangle-right","triangle-left"].includes(this.properties.shape))return getRect(this,`.${name}__content`).then(e=>{const t=e.width>0||e.height>0;this.setData({useOuterClass:!t})});this.setData({useOuterClass:!1})}}}};Badge=__decorate([wxComponent()],Badge);export default Badge;
@@ -1 +1 @@
<wxs src="./badge.wxs" module="_this"/><wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle])}}" class="{{_this.getBadgeOuterClass({shape})}} class {{prefix}}-class" aria-labelledby="{{labelID}}" aria-describedby="{{descriptionID}}" aria-role="{{ ariaRole || 'option'}}"><view id="{{labelID}}" class="{{classPrefix}}__content {{prefix}}-class-content" aria-hidden="true"><slot wx:if="{{!content}}" class="{{classPrefix}}__content-slot"/><text wx:else class="{{classPrefix}}__content-text">{{content}}</text></view><view aria-hidden="true" aria-label="{{ ariaLabel || _.getBadgeAriaLabel({dot, count, maxCount}) }}" wx:if="{{_this.isShowBadge({dot,count,showZero})}}" id="{{descriptionID}}" class="{{_this.getBadgeInnerClass({dot, size, shape, count})}} {{prefix}}-has-count {{prefix}}-class-count" style="{{_._style([_this.getBadgeStyles({color, offset})])}}" aria-hidden="true" aria-label="{{ ariaLabel || _.getBadgeAriaLabel({dot, count, maxCount}) }}">{{ _this.getBadgeValue({dot, count, maxCount}) }}</view><slot name="count"/></view> <wxs src="./badge.wxs" module="_this"/><wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle])}}" class="{{classPrefix}} {{ useOuterClass? classPrefix + '__' + shape + '-outer': '' }} class {{prefix}}-class" aria-labelledby="{{labelID}}" aria-describedby="{{descriptionID}}" aria-role="{{ ariaRole || 'option'}}"><view id="{{labelID}}" class="{{classPrefix}}__content {{prefix}}-class-content" aria-hidden="true"><slot wx:if="{{!content}}" class="{{classPrefix}}__content-slot"/><text wx:else class="{{classPrefix}}__content-text">{{content}}</text></view><view aria-hidden="true" aria-label="{{ ariaLabel || _.getBadgeAriaLabel({dot, count, maxCount}) }}" wx:if="{{_this.isShowBadge({dot,count,showZero}) || count === null}}" id="{{descriptionID}}" class="{{_this.getBadgeInnerClass({classPrefix, dot, size, shape, count})}} {{prefix}}-has-count {{prefix}}-class-count" style="{{_._style([_this.getBadgeStyles({color, offset})])}}" aria-hidden="true" aria-label="{{ ariaLabel || _.getBadgeAriaLabel({dot, count, maxCount}) }}"><view class="{{classPrefix}}__count"><block wx:if="{{_this.isShowBadge({dot,count,showZero})}}">{{ _this.getBadgeValue({dot, count, maxCount}) }}</block><slot else name="count"/></view></view></view>
@@ -35,20 +35,14 @@ var getBadgeStyles = function (props) {
return styleStr; return styleStr;
}; };
var getBadgeOuterClass = function (props) {
var baseClass = 't-badge';
var classNames = [baseClass, props.shape === 'ribbon' ? baseClass + '__ribbon-outer' : ''];
return classNames.join(' ');
};
var getBadgeInnerClass = function (props) { var getBadgeInnerClass = function (props) {
var baseClass = 't-badge'; var baseClass = props.classPrefix;
var classNames = [ var classNames = [
baseClass + '--basic', baseClass + '--basic',
props.dot ? baseClass + '--dot' : '', props.dot ? baseClass + '--dot' : '',
baseClass + '--' + props.size, baseClass + '--' + props.size,
baseClass + '--' + props.shape, baseClass + '--' + props.shape,
!props.dot && props.count ? baseClass + '--count' : '', !props.dot ? baseClass + '--count' : '',
]; ];
return classNames.join(' '); return classNames.join(' ');
}; };
@@ -66,6 +60,5 @@ var isShowBadge = function (props) {
module.exports.getBadgeValue = getBadgeValue; module.exports.getBadgeValue = getBadgeValue;
module.exports.getBadgeStyles = getBadgeStyles; module.exports.getBadgeStyles = getBadgeStyles;
module.exports.getBadgeOuterClass = getBadgeOuterClass;
module.exports.getBadgeInnerClass = getBadgeInnerClass; module.exports.getBadgeInnerClass = getBadgeInnerClass;
module.exports.isShowBadge = isShowBadge; module.exports.isShowBadge = isShowBadge;
@@ -1 +1,26 @@
@import '../common/style/index.wxss';.t-badge{position:relative;display:inline-flex;align-items:start}.t-badge--basic{z-index:100;padding:0 var(--td-badge-basic-padding,8rpx);font-size:var(--td-badge-font-size,var(--td-font-size-xs,var(--td-font-size,20rpx)));color:var(--td-badge-text-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));background-color:var(--td-badge-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941)));text-align:center;height:var(--td-badge-basic-height,32rpx);line-height:var(--td-badge-basic-height,32rpx);font-weight:var(--td-badge-font-weight,600);border-radius:var(--td-badge-border-radius,4rpx)}.t-badge--dot{height:var(--td-badge-dot-size,16rpx);border-radius:50%;min-width:var(--td-badge-dot-size,16rpx);padding:0}.t-badge--count{min-width:var(--td-badge-basic-width,32rpx);white-space:nowrap;box-sizing:border-box}.t-badge--circle{border-radius:calc(var(--td-badge-basic-height,32rpx)/ 2)}.t-badge__ribbon-outer{position:absolute;top:0;right:0}.t-badge--ribbon{position:relative;display:inline-block;transform-origin:center center;transform:translate(calc(50% - var(--td-badge-basic-height,32rpx) + 1rpx),calc(-50% + var(--td-badge-basic-height,32rpx) - 1rpx)) rotate(45deg);border-radius:0}.t-badge--ribbon::after,.t-badge--ribbon::before{content:'';position:absolute;width:0;height:0;bottom:0;border-bottom:var(--td-badge-basic-height,32rpx) solid var(--td-badge-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941)));font-size:0}.t-badge--ribbon::before{left:calc(-1 * var(--td-badge-basic-height,32rpx) + 1rpx);border-left:var(--td-badge-basic-height,32rpx) solid transparent}.t-badge--ribbon::after{right:calc(-1 * var(--td-badge-basic-height,32rpx) + 1rpx);border-right:var(--td-badge-basic-height,32rpx) solid transparent}.t-badge--bubble{border-radius:var(--td-badge-bubble-border-radius,20rpx 20rpx 20rpx 1px)}.t-badge--large{font-size:var(--td-badge-large-font-size,var(--td-font-size-s,24rpx));height:var(--td-badge-large-height,40rpx);min-width:var(--td-badge-large-height,40rpx);line-height:var(--td-badge-large-height,40rpx);padding:0 var(--td-badge-large-padding,10rpx)}.t-badge--large.t-badge--circle{border-radius:calc(var(--td-badge-large-height,40rpx)/ 2)}.t-badge__content:not(:empty)+.t-has-count{transform-origin:center center;transform:translate(-50%,-50%);position:absolute;left:100%;top:0}.t-badge__content-text{display:block;line-height:48rpx;color:var(--td-badge-content-text-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))))} @import '../common/style/index.wxss';.t-badge{position:relative;display:inline-flex;align-items:start;}
.t-badge--basic{z-index:100;padding:0 var(--td-badge-basic-padding,8rpx);font:var(--td-badge-font,var(--td-font-mark-extraSmall,600 20rpx / 32rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));color:var(--td-badge-text-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));background-color:var(--td-badge-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941)));text-align:center;height:var(--td-badge-basic-height,32rpx);border-radius:var(--td-badge-border-radius,4rpx);}
.t-badge--dot{height:var(--td-badge-dot-size,16rpx);border-radius:50%;min-width:var(--td-badge-dot-size,16rpx);padding:0;}
.t-badge--count{min-width:var(--td-badge-basic-width,32rpx);white-space:nowrap;box-sizing:border-box;}
.t-badge--circle{border-radius:calc(var(--td-badge-basic-height,32rpx)/ 2);}
.t-badge__ribbon-left-outer,.t-badge__ribbon-outer,.t-badge__ribbon-right-outer,.t-badge__triangle-left-outer,.t-badge__triangle-right-outer{position:absolute;top:0;}
.t-badge__ribbon-outer,.t-badge__ribbon-right-outer,.t-badge__triangle-right-outer{right:0;}
.t-badge__ribbon-left-outer,.t-badge__triangle-left-outer{left:0;}
.t-badge--bubble{border-radius:var(--td-badge-bubble-border-radius,20rpx 20rpx 20rpx 1px);}
.t-badge--ribbon,.t-badge--ribbon-left,.t-badge--ribbon-right,.t-badge--triangle-left,.t-badge--triangle-right{width:calc(var(--td-badge-basic-height,32rpx) * 2);height:calc(var(--td-badge-basic-height,32rpx) * 2);border-radius:0;padding:0;position:absolute;top:0;display:flex;align-items:center;justify-content:center;overflow:hidden;}
.t-badge--ribbon,.t-badge--ribbon-right{background:linear-gradient(45deg,transparent 50%,var(--td-badge-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941))) 50%,var(--td-badge-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941))) 85%,transparent 85%);}
.t-badge--triangle-right{background:linear-gradient(45deg,transparent 50%,var(--td-badge-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941))) 50%);}
.t-badge--ribbon,.t-badge--ribbon-right,.t-badge--triangle-right{right:0;}
.t-badge--ribbon .t-badge__count,.t-badge--ribbon-right .t-badge__count,.t-badge--triangle-right .t-badge__count{transform:rotate(45deg) translateY(calc(-1 * var(--td-line-height-mark-extraSmall,32rpx)/ 2 + 1rpx));}
.t-badge--ribbon-left{background:linear-gradient(-45deg,transparent 50%,var(--td-badge-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941))) 50%,var(--td-badge-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941))) 85%,transparent 85%);}
.t-badge--triangle-left{background:linear-gradient(-45deg,transparent 50%,var(--td-badge-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941))) 50%);}
.t-badge--ribbon-left,.t-badge--triangle-left{left:0;}
.t-badge--ribbon-left .t-badge__count,.t-badge--triangle-left .t-badge__count{transform:rotate(-45deg) translateY(calc(-1 * var(--td-line-height-mark-extraSmall,32rpx)/ 2 + 1rpx));}
.t-badge--large{font:var(--td-badge-large-font,var(--td-font-mark-small,600 24rpx / 40rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));height:var(--td-badge-large-height,40rpx);min-width:var(--td-badge-large-height,40rpx);padding:0 var(--td-badge-large-padding,10rpx);}
.t-badge--large.t-badge--circle{border-radius:calc(var(--td-badge-large-height,40rpx)/ 2);}
.t-badge--large.t-badge--ribbon,.t-badge--large.t-badge--ribbon-left,.t-badge--large.t-badge--ribbon-right,.t-badge--large.t-badge--triangle-left,.t-badge--large.t-badge--triangle-right{width:calc(var(--td-badge-large-height,40rpx) * 2);height:calc(var(--td-badge-large-height,40rpx) * 2);padding:0;}
.t-badge--large.t-badge--ribbon .t-badge__count,.t-badge--large.t-badge--ribbon-right .t-badge__count,.t-badge--large.t-badge--triangle-right .t-badge__count{transform:rotate(45deg) translateY(calc(-1 * var(--td-line-height-mark-small,40rpx)/ 2 + 3rpx));}
.t-badge--large.t-badge--ribbon-left .t-badge__count,.t-badge--large.t-badge--triangle-left .t-badge__count{transform:rotate(-45deg) translateY(calc(-1 * var(--td-line-height-mark-small,40rpx)/ 2 + 3rpx));}
.t-badge__content:not(:empty)+.t-badge--bubble.t-has-count,.t-badge__content:not(:empty)+.t-badge--circle.t-has-count,.t-badge__content:not(:empty)+.t-badge--square.t-has-count{transform-origin:center center;transform:translate(-50%,-50%);position:absolute;top:0;left:100%;}
.t-badge__content-text{display:block;font:var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));color:var(--td-badge-content-text-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
.t-badge__count:empty{display:none;}
@@ -1 +1 @@
const props={color:{type:String,value:""},content:{type:String,value:""},count:{type:null,value:0},dot:{type:Boolean,value:!1},externalClasses:{type:Array},maxCount:{type:Number,value:99},offset:{type:Array},shape:{type:String,value:"circle"},showZero:{type:Boolean,value:!1},size:{type:String,value:"medium"}};export default props; const props={color:{type:String,value:""},content:{type:String,value:""},count:{type:null,value:0},dot:{type:Boolean,value:!1},maxCount:{type:Number,value:99},offset:{type:Array},shape:{type:String,value:"circle"},showZero:{type:Boolean,value:!1},size:{type:String,value:"medium"}};export default props;
+1 -5
View File
@@ -15,10 +15,6 @@ export interface TdBadgeProps {
type: BooleanConstructor; type: BooleanConstructor;
value?: boolean; value?: boolean;
}; };
externalClasses?: {
type: ArrayConstructor;
value?: ['t-class', 't-class-content', 't-class-count'];
};
maxCount?: { maxCount?: {
type: NumberConstructor; type: NumberConstructor;
value?: number; value?: number;
@@ -29,7 +25,7 @@ export interface TdBadgeProps {
}; };
shape?: { shape?: {
type: StringConstructor; type: StringConstructor;
value?: 'circle' | 'square' | 'bubble' | 'ribbon'; value?: 'circle' | 'square' | 'bubble' | 'ribbon' | 'ribbon-right' | 'ribbon-left' | 'triangle-right' | 'triangle-left';
}; };
showZero?: { showZero?: {
type: BooleanConstructor; type: BooleanConstructor;
@@ -25,7 +25,9 @@ export default class Button extends SuperComponent {
setClass(): void; setClass(): void;
getuserinfo(e: any): void; getuserinfo(e: any): void;
contact(e: any): void; contact(e: any): void;
createliveactivity(e: any): void;
getphonenumber(e: any): void; getphonenumber(e: any): void;
getrealtimephonenumber(e: any): void;
error(e: any): void; error(e: any): void;
opensetting(e: any): void; opensetting(e: any): void;
launchapp(e: any): void; launchapp(e: any): void;
@@ -1 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{canIUseFormFieldButton}from"../common/version";import{calcIcon}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-button`;let Button=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-icon`,`${prefix}-class-loading`],this.behaviors=canIUseFormFieldButton()?["wx://form-field-button"]:[],this.properties=props,this.options={multipleSlots:!0},this.data={prefix:prefix,className:"",classPrefix:name},this.observers={"theme, size, plain, block, shape, disabled, loading, variant"(){this.setClass()},icon(t){this.setData({_icon:calcIcon(t,"")})}},this.lifetimes={attached(){this.setClass()}},this.methods={setClass(){const t=[name,`${prefix}-class`,`${name}--${this.data.variant||"base"}`,`${name}--${this.data.theme||"default"}`,`${name}--${this.data.shape||"rectangle"}`,`${name}--size-${this.data.size||"medium"}`];this.data.block&&t.push(`${name}--block`),this.data.disabled&&t.push(`${name}--disabled`),this.data.ghost&&t.push(`${name}--ghost`),this.setData({className:t.join(" ")})},getuserinfo(t){this.triggerEvent("getuserinfo",t.detail)},contact(t){this.triggerEvent("contact",t.detail)},getphonenumber(t){this.triggerEvent("getphonenumber",t.detail)},error(t){this.triggerEvent("error",t.detail)},opensetting(t){this.triggerEvent("opensetting",t.detail)},launchapp(t){this.triggerEvent("launchapp",t.detail)},chooseavatar(t){this.triggerEvent("chooseavatar",t.detail)},agreeprivacyauthorization(t){this.triggerEvent("agreeprivacyauthorization",t.detail)},handleTap(t){this.data.disabled||this.data.loading||this.triggerEvent("tap",t)}}}};Button=__decorate([wxComponent()],Button);export default Button; import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{canIUseFormFieldButton}from"../common/version";import{calcIcon}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-button`;let Button=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-icon`,`${prefix}-class-loading`],this.behaviors=canIUseFormFieldButton()?["wx://form-field-button"]:[],this.properties=props,this.options={multipleSlots:!0},this.data={prefix:prefix,className:"",classPrefix:name},this.observers={"theme, size, plain, block, shape, disabled, loading, variant"(){this.setClass()},icon(t){this.setData({_icon:calcIcon(t,"")})}},this.lifetimes={attached(){this.setClass()}},this.methods={setClass(){const t=[name,`${prefix}-class`,`${name}--${this.data.variant||"base"}`,`${name}--${this.data.theme||"default"}`,`${name}--${this.data.shape||"rectangle"}`,`${name}--size-${this.data.size||"medium"}`];this.data.block&&t.push(`${name}--block`),this.data.disabled&&t.push(`${name}--disabled`),this.data.ghost&&t.push(`${name}--ghost`),this.setData({className:t.join(" ")})},getuserinfo(t){this.triggerEvent("getuserinfo",t.detail)},contact(t){this.triggerEvent("contact",t.detail)},createliveactivity(t){this.triggerEvent("createliveactivity",t.detail)},getphonenumber(t){this.triggerEvent("getphonenumber",t.detail)},getrealtimephonenumber(t){this.triggerEvent("getrealtimephonenumber",t.detail)},error(t){this.triggerEvent("error",t.detail)},opensetting(t){this.triggerEvent("opensetting",t.detail)},launchapp(t){this.triggerEvent("launchapp",t.detail)},chooseavatar(t){this.triggerEvent("chooseavatar",t.detail)},agreeprivacyauthorization(t){this.triggerEvent("agreeprivacyauthorization",t.detail)},handleTap(t){this.data.disabled||this.data.loading||this.triggerEvent("tap",t)}}}};Button=__decorate([wxComponent()],Button);export default Button;
@@ -1 +1 @@
<import src="../common/template/icon.wxml"/><wxs src="../common/utils.wxs" module="_"/><button id="{{tId}}" style="{{_._style([style, customStyle])}}" data-custom="{{ customDataset }}" class="class {{className}}" form-type="{{disabled || loading ? '' : type}}" open-type="{{disabled || loading ? '' : openType}}" hover-stop-propagation="{{hoverStopPropagation}}" hover-start-time="{{hoverStartTime}}" hover-stay-time="{{hoverStayTime}}" lang="{{lang}}" session-from="{{sessionFrom}}" hover-class="{{disabled || loading ? '' : (hoverClass || classPrefix + '--hover')}}" send-message-title="{{sendMessageTitle}}" send-message-path="{{sendMessagePath}}" send-message-img="{{sendMessageImg}}" app-parameter="{{appParameter}}" show-message-card="{{showMessageCard}}" catch:tap="handleTap" bind:getuserinfo="getuserinfo" bind:contact="contact" bind:getphonenumber="getphonenumber" bind:error="error" bind:opensetting="opensetting" bind:launchapp="launchapp" bind:chooseavatar="chooseavatar" bind:agreeprivacyauthorization="agreeprivacyauthorization" aria-label="{{ariaLabel}}"><template wx:if="{{_icon}}" is="icon" data="{{tClass: classPrefix + '__icon ' + prefix + '-class-icon', ariaHidden: true, name: iconName, ..._icon}}"/><t-loading wx:if="{{loading}}" delay="{{loadingProps.delay || 0}}" duration="{{loadingProps.duration || 800}}" indicator="{{loadingProps.indicator || true}}" inheritColor="{{loadingProps.inheritColor || true}}" layout="{{loadingProps.layout || 'horizontal'}}" pause="{{loadingProps.pause || false}}" progress="{{loadingProps.progress || 0}}" reverse="{{loadingProps.reverse || false}}" size="{{loadingProps.size || '40rpx'}}" text="{{loadingProps.text || '' }}" theme="{{loadingProps.theme || 'circular'}}" loading t-class="{{classPrefix}}__loading {{classPrefix}}__loading--wrapper" t-class-indicator="{{classPrefix}}__loading--indicator {{prefix}}-class-loading"/><view class="{{classPrefix}}__content"><slot name="content"/><block wx:if="{{content}}">{{content}}</block><slot/></view><slot name="suffix"/></button> <import src="../common/template/icon.wxml"/><wxs src="../common/utils.wxs" module="_"/><button id="{{tId}}" style="{{_._style([style, customStyle])}}" data-custom="{{customDataset}}" class="class {{className}}" activity-type="{{activityType ? activityType : ''}}" entrance-path="{{entrancePath}}" form-type="{{disabled || loading ? '' : type}}" open-type="{{disabled || loading ? '' : openType}}" hover-stop-propagation="{{hoverStopPropagation}}" hover-start-time="{{hoverStartTime}}" hover-stay-time="{{hoverStayTime}}" lang="{{lang}}" need-show-entrance="{{needShowEntrance}}" session-from="{{sessionFrom}}" hover-class="{{disabled || loading ? '' : (hoverClass || classPrefix + '--hover')}}" send-message-title="{{sendMessageTitle}}" send-message-path="{{sendMessagePath}}" send-message-img="{{sendMessageImg}}" app-parameter="{{appParameter}}" show-message-card="{{showMessageCard}}" catch:tap="handleTap" bind:getuserinfo="getuserinfo" bind:contact="contact" bind:createliveactivity="createliveactivity" bind:getphonenumber="getphonenumber" bind:getrealtimephonenumber="getrealtimephonenumber" bind:error="error" bind:opensetting="opensetting" bind:launchapp="launchapp" bind:chooseavatar="chooseavatar" bind:agreeprivacyauthorization="agreeprivacyauthorization" aria-label="{{ariaLabel}}"><template wx:if="{{_icon}}" is="icon" data="{{tClass: classPrefix + '__icon ' + prefix + '-class-icon', ariaHidden: true, name: iconName, ..._icon}}"/><t-loading wx:if="{{loading}}" delay="{{loadingProps.delay || 0}}" duration="{{loadingProps.duration || 800}}" indicator="{{loadingProps.indicator || true}}" inheritColor="{{loadingProps.inheritColor || true}}" layout="{{loadingProps.layout || 'horizontal'}}" pause="{{loadingProps.pause || false}}" progress="{{loadingProps.progress || 0}}" reverse="{{loadingProps.reverse || false}}" size="{{loadingProps.size || '40rpx'}}" text="{{loadingProps.text || '' }}" theme="{{loadingProps.theme || 'circular'}}" loading t-class="{{classPrefix}}__loading {{classPrefix}}__loading--wrapper" t-class-indicator="{{classPrefix}}__loading--indicator {{prefix}}-class-loading"/><view class="{{classPrefix}}__content"><slot name="content"/><block wx:if="{{content}}">{{content}}</block><slot/></view><slot name="suffix"/></button>
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
const props={appParameter:{type:String,value:""},block:{type:Boolean,value:!1},content:{type:String},customDataset:{type:null},disabled:{type:null,value:void 0},ghost:{type:Boolean,value:!1},hoverClass:{type:String,value:""},hoverStartTime:{type:Number,value:20},hoverStayTime:{type:Number,value:70},hoverStopPropagation:{type:Boolean,value:!1},icon:{type:null},lang:{type:String},loading:{type:Boolean,value:!1},loadingProps:{type:Object},openType:{type:String},phoneNumberNoQuotaToast:{type:Boolean,value:!0},sendMessageImg:{type:String,value:"截图"},sendMessagePath:{type:String,value:"当前分享路径"},sendMessageTitle:{type:String,value:"当前标题"},sessionFrom:{type:String,value:""},shape:{type:String,value:"rectangle"},showMessageCard:{type:Boolean,value:!1},size:{type:String,value:"medium"},style:{type:String,value:""},tId:{type:String,value:""},theme:{type:String,value:"default"},type:{type:String},variant:{type:String,value:"base"}};export default props; const props={activityType:{type:Number},appParameter:{type:String,value:""},block:{type:Boolean,value:!1},content:{type:String},customDataset:{type:null},disabled:{type:null,value:void 0},entrancePath:{type:String,value:""},ghost:{type:Boolean,value:!1},hoverClass:{type:String,value:""},hoverStartTime:{type:Number,value:20},hoverStayTime:{type:Number,value:70},hoverStopPropagation:{type:Boolean,value:!1},icon:{type:null},lang:{type:String},loading:{type:Boolean,value:!1},loadingProps:{type:Object},needShowEntrance:{type:Boolean,value:!0},openType:{type:String},phoneNumberNoQuotaToast:{type:Boolean,value:!0},sendMessageImg:{type:String,value:"截图"},sendMessagePath:{type:String,value:"当前分享路径"},sendMessageTitle:{type:String,value:"当前标题"},sessionFrom:{type:String,value:""},shape:{type:String,value:"rectangle"},showMessageCard:{type:Boolean,value:!1},size:{type:String,value:"medium"},tId:{type:String,value:""},theme:{type:String,value:"default"},type:{type:String},variant:{type:String,value:"base"}};export default props;
+12 -4
View File
@@ -1,5 +1,9 @@
import { LoadingProps } from '../loading/index'; import { LoadingProps } from '../loading/index';
export interface TdButtonProps { export interface TdButtonProps {
activityType?: {
type: NumberConstructor;
value?: number;
};
appParameter?: { appParameter?: {
type: StringConstructor; type: StringConstructor;
value?: string; value?: string;
@@ -20,6 +24,10 @@ export interface TdButtonProps {
type: BooleanConstructor; type: BooleanConstructor;
value?: boolean; value?: boolean;
}; };
entrancePath?: {
type: StringConstructor;
value?: string;
};
ghost?: { ghost?: {
type: BooleanConstructor; type: BooleanConstructor;
value?: boolean; value?: boolean;
@@ -56,6 +64,10 @@ export interface TdButtonProps {
type: ObjectConstructor; type: ObjectConstructor;
value?: LoadingProps; value?: LoadingProps;
}; };
needShowEntrance?: {
type: BooleanConstructor;
value?: boolean;
};
openType?: { openType?: {
type: StringConstructor; type: StringConstructor;
value?: 'contact' | 'share' | 'getPhoneNumber' | 'getUserInfo' | 'launchApp' | 'openSetting' | 'feedback' | 'chooseAvatar' | 'agreePrivacyAuthorization'; value?: 'contact' | 'share' | 'getPhoneNumber' | 'getUserInfo' | 'launchApp' | 'openSetting' | 'feedback' | 'chooseAvatar' | 'agreePrivacyAuthorization';
@@ -92,10 +104,6 @@ export interface TdButtonProps {
type: StringConstructor; type: StringConstructor;
value?: 'extra-small' | 'small' | 'medium' | 'large'; value?: 'extra-small' | 'small' | 'medium' | 'large';
}; };
style?: {
type: StringConstructor;
value?: string;
};
tId?: { tId?: {
type: StringConstructor; type: StringConstructor;
value?: string; value?: string;
@@ -1 +1 @@
<wxs src="../common/utils.wxs" module="_"/><template name="calendar-header"><view class="{{class}} {{classPrefix}} {{switchMode !== 'none' ? classPrefix + '__with-action' : ''}}" id="{{tId}}"><view class="{{classPrefix}}__action" wx:if="{{switchMode !== 'none'}}"><view wx:if="{{switchMode === 'year-month'}}" class="{{_.cls(classPrefix + '__icon', [['disabled', preYearBtnDisable]])}}" data-disabled="{{preYearBtnDisable}}" data-type="pre-year" bindtap="handleSwitchModeChange"><t-icon name="chevron-left-double"/></view><view class="{{_.cls(classPrefix + '__icon', [['disabled', prevMonthBtnDisable]])}}" data-disabled="{{prevMonthBtnDisable}}" data-type="pre-month" bindtap="handleSwitchModeChange"><t-icon name="chevron-left"/></view></view><view class="{{classPrefix}}__title">{{ title }}</view><view class="{{classPrefix}}__action" wx:if="{{switchMode !== 'none'}}"><view class="{{_.cls(classPrefix + '__icon', [['disabled', nextMonthBtnDisable]])}}" data-disabled="{{nextMonthBtnDisable}}" data-type="next-month" bindtap="handleSwitchModeChange"><t-icon name="chevron-right"/></view><view wx:if="{{switchMode === 'year-month'}}" class="{{_.cls(classPrefix + '__icon', [['disabled', nextYearBtnDisable]])}}" data-disabled="{{nextYearBtnDisable}}" data-type="next-year" bindtap="handleSwitchModeChange"><t-icon name="chevron-right-double"/></view></view></view></template> <wxs src="../common/utils.wxs" module="_"/><template name="calendar-header"><view class="{{tClass}} {{classPrefix}} {{switchMode !== 'none' ? classPrefix + '__with-action' : ''}}" id="{{tId}}"><view class="{{classPrefix}}__action" wx:if="{{switchMode !== 'none'}}"><view wx:if="{{switchMode === 'year-month'}}" class="{{_.cls(classPrefix + '__icon', [['disabled', preYearBtnDisable]])}}" data-disabled="{{preYearBtnDisable}}" data-type="pre-year" bindtap="handleSwitchModeChange"><t-icon name="chevron-left-double"/></view><view class="{{_.cls(classPrefix + '__icon', [['disabled', prevMonthBtnDisable]])}}" data-disabled="{{prevMonthBtnDisable}}" data-type="pre-month" bindtap="handleSwitchModeChange"><t-icon name="chevron-left"/></view></view><view class="{{classPrefix}}__title">{{ title }}</view><view class="{{classPrefix}}__action" wx:if="{{switchMode !== 'none'}}"><view class="{{_.cls(classPrefix + '__icon', [['disabled', nextMonthBtnDisable]])}}" data-disabled="{{nextMonthBtnDisable}}" data-type="next-month" bindtap="handleSwitchModeChange"><t-icon name="chevron-right"/></view><view wx:if="{{switchMode === 'year-month'}}" class="{{_.cls(classPrefix + '__icon', [['disabled', nextYearBtnDisable]])}}" data-disabled="{{nextYearBtnDisable}}" data-type="next-year" bindtap="handleSwitchModeChange"><t-icon name="chevron-right-double"/></view></view></view></template>
+4 -1
View File
@@ -32,7 +32,10 @@ export default class Calendar extends SuperComponent {
ready(): void; ready(): void;
}; };
observers: { observers: {
localeText(): void;
globalConfig(): void;
type(v: any): void; type(v: any): void;
allowSameDay(v: any): void;
confirmBtn(v: any): void; confirmBtn(v: any): void;
'firstDayOfWeek,minDate,maxDate'(firstDayOfWeek: any, minDate: any, maxDate: any): void; 'firstDayOfWeek,minDate,maxDate'(firstDayOfWeek: any, minDate: any, maxDate: any): void;
value(v: any): void; value(v: any): void;
@@ -47,7 +50,7 @@ export default class Calendar extends SuperComponent {
month: number; month: number;
}; };
updateActionButton(value: Date): void; updateActionButton(value: Date): void;
updateCurrentMonth(): void; updateCurrentMonth(newValue?: any): void;
calcCurrentMonth(newValue?: any): void; calcCurrentMonth(newValue?: any): void;
calcMonths(): void; calcMonths(): void;
close(trigger: any): void; close(trigger: any): void;
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
const props={autoClose:{type:Boolean,value:!0},confirmBtn:{type:null,value:""},firstDayOfWeek:{type:Number,value:0},format:{type:null},localeText:{type:Object},maxDate:{type:Number},minDate:{type:Number},switchMode:{type:String,value:"none"},title:{type:String},type:{type:String,value:"single"},usePopup:{type:Boolean,value:!0},usingCustomNavbar:{type:Boolean,value:!1},value:{type:null,value:null},defaultValue:{type:null},visible:{type:Boolean,value:!1}};export default props; const props={allowSameDay:{type:Boolean,value:!1},autoClose:{type:Boolean,value:!0},confirmBtn:{type:null,value:""},firstDayOfWeek:{type:Number,value:0},format:{type:null},localeText:{type:Object},maxDate:{type:Number},minDate:{type:Number},readonly:{type:Boolean},switchMode:{type:String,value:"none"},title:{type:String},type:{type:String,value:"single"},usePopup:{type:Boolean,value:!0},usingCustomNavbar:{type:Boolean,value:!1},value:{type:null,value:null},defaultValue:{type:null},visible:{type:Boolean,value:!1}};export default props;
@@ -1 +1 @@
<wxs src="./calendar.wxs" module="_this"/><wxs src="../common/utils.wxs" module="_"/><import src="../common/template/button.wxml"/><import src="./calendar-header.wxml"/><view class="{{_.cls(classPrefix, [['popup', usePopup]])}} {{classPrefix}}-switch-mode--{{switchMode}} class {{prefix}}-class" style="{{_._style([style, customStyle])}}"><view class="{{classPrefix}}__title" tabindex="0"><slot name="title"/><text wx:if="{{title || realLocalText.title}}">{{ title || realLocalText.title }}</text></view><t-icon wx:if="{{usePopup}}" name="close" class="{{classPrefix}}__close-btn" size="48rpx" aria-role="button" aria-label="关闭" bind:tap="handleClose"/><template wx:if="{{switchMode !== 'none'}}" is="calendar-header" data="{{ classPrefix: classPrefix + '-header', switchMode, ...actionButtons, title: _this.getMonthTitle(currentMonth[0].year, realLocalText.months[currentMonth[0].month], realLocalText.monthTitle)}}"/><view aria-hidden class="{{classPrefix}}__days"><view wx:for="{{days}}" wx:key="index" class="{{classPrefix}}__days-item">{{ item }}</view></view><scroll-view class="{{classPrefix}}__months" scroll-into-view="{{scrollIntoView}}" scroll-y enhanced show-scrollbar="{{false}}" bindscroll="onScroll"><block wx:for="{{ switchMode === 'none' ? months : currentMonth}}" wx:key="index"><template wx:if="{{switchMode === 'none'}}" is="calendar-header" data="{{class: classPrefix + '__month', classPrefix: classPrefix + '-header', tId: 'year_' + item.year + '_month_' + item.month, switchMode, ...actionButtons, title: _this.getMonthTitle(item.year, realLocalText.months[item.month], realLocalText.monthTitle) }}"/><view class="{{classPrefix}}__dates"><view wx:for="{{(item.weekdayOfFirstDay - firstDayOfWeek + 7) % 7}}" wx:key="index"/><block wx:for="{{item.months}}" wx:for-index="dateIndex" wx:for-item="dateItem" wx:key="dateIndex"><view class="{{classPrefix}}__dates-item {{dateItem.className}} {{classPrefix}}__dates-item--{{dateItem.type}}" data-year="{{item.year}}" data-month="{{item.month}}" data-date="{{dateItem}}" aria-role="button" aria-label="{{_this.getDateLabel(item, dateItem)}}" aria-disabled="{{dateItem.type === 'disabled'}}" bind:tap="handleSelect"><view wx:if="{{dateItem.prefix}}" class="{{classPrefix}}__dates-item-prefix">{{ dateItem.prefix }}</view>{{ dateItem.day }}<view wx:if="{{dateItem.suffix}}" class="{{classPrefix}}__dates-item-suffix {{classPrefix}}__dates-item-suffix--{{dateItem.type}}">{{ dateItem.suffix }}</view></view></block></view></block></scroll-view><view wx:if="{{innerConfirmBtn != null && usePopup}}" class="{{classPrefix}}__footer"><slot wx:if="{{innerConfirmBtn === 'slot'}}" name="confirm-btn"/><block wx:elif="{{innerConfirmBtn}}"><template is="button" data="{{ block: true, theme: 'primary', rootClass: 't-calendar__confirm-btn', content: realLocalText.confirm, ...innerConfirmBtn }}"/></block></view></view> <wxs src="./calendar.wxs" module="_this"/><wxs src="../common/utils.wxs" module="_"/><import src="../common/template/button.wxml"/><import src="./calendar-header.wxml"/><view class="{{_.cls(classPrefix, [['popup', usePopup]])}} {{classPrefix}}-switch-mode--{{switchMode}} class {{prefix}}-class" style="{{_._style([style, customStyle])}}"><view class="{{classPrefix}}__title" tabindex="0"><slot name="title"/><text wx:if="{{title || realLocalText.title}}">{{ title || realLocalText.title }}</text></view><t-icon wx:if="{{usePopup}}" name="close" class="{{classPrefix}}__close-btn" size="48rpx" aria-role="button" aria-label="关闭" bind:tap="handleClose"/><template wx:if="{{switchMode !== 'none'}}" is="calendar-header" data="{{ classPrefix: classPrefix + '-header', switchMode, ...actionButtons, title: _this.getMonthTitle(currentMonth[0].year, realLocalText.months[currentMonth[0].month], realLocalText.monthTitle)}}"/><view aria-hidden class="{{classPrefix}}__days"><view wx:for="{{days}}" wx:key="index" class="{{classPrefix}}__days-item">{{ item }}</view></view><scroll-view class="{{classPrefix}}__months" scroll-into-view="{{scrollIntoView}}" scroll-y enhanced show-scrollbar="{{false}}" bindscroll="onScroll"><block wx:for="{{ switchMode === 'none' ? months : currentMonth}}" wx:key="index"><template wx:if="{{switchMode === 'none'}}" is="calendar-header" data="{{tClass: classPrefix + '__month', classPrefix: classPrefix + '-header', tId: 'year_' + item.year + '_month_' + item.month, switchMode, ...actionButtons, title: _this.getMonthTitle(item.year, realLocalText.months[item.month], realLocalText.monthTitle) }}"/><view class="{{classPrefix}}__dates"><view wx:for="{{(item.weekdayOfFirstDay - firstDayOfWeek + 7) % 7}}" wx:key="index"/><block wx:for="{{item.months}}" wx:for-index="dateIndex" wx:for-item="dateItem" wx:key="dateIndex"><view class="{{classPrefix}}__dates-item {{dateItem.className}} {{classPrefix}}__dates-item--{{dateItem.type}}" data-year="{{item.year}}" data-month="{{item.month}}" data-date="{{dateItem}}" aria-role="button" aria-label="{{_this.getDateLabel(item, dateItem)}}" aria-disabled="{{dateItem.type === 'disabled'}}" bind:tap="handleSelect"><view wx:if="{{dateItem.prefix}}" class="{{classPrefix}}__dates-item-prefix">{{ dateItem.prefix }}</view>{{ dateItem.day }}<view wx:if="{{dateItem.suffix}}" class="{{classPrefix}}__dates-item-suffix {{classPrefix}}__dates-item-suffix--{{dateItem.type}}">{{ dateItem.suffix }}</view></view></block></view></block></scroll-view><view wx:if="{{innerConfirmBtn != null && usePopup}}" class="{{classPrefix}}__footer"><slot wx:if="{{innerConfirmBtn === 'slot'}}" name="confirm-btn"/><block wx:elif="{{innerConfirmBtn}}"><template is="button" data="{{ block: true, theme: 'primary', rootClass: 't-calendar__confirm-btn', content: realLocalText.confirm, ...innerConfirmBtn }}"/></block></view></view>
+9 -1
View File
@@ -1,5 +1,9 @@
import { ButtonProps } from '../button/index'; import { ButtonProps } from '../button/index';
export interface TdCalendarProps { export interface TdCalendarProps {
allowSameDay?: {
type: BooleanConstructor;
value?: boolean;
};
autoClose?: { autoClose?: {
type: BooleanConstructor; type: BooleanConstructor;
value?: boolean; value?: boolean;
@@ -28,6 +32,10 @@ export interface TdCalendarProps {
type: NumberConstructor; type: NumberConstructor;
value?: number; value?: number;
}; };
readonly?: {
type: BooleanConstructor;
value?: boolean;
};
switchMode?: { switchMode?: {
type: StringConstructor; type: StringConstructor;
value?: 'none' | 'month' | 'year-month'; value?: 'none' | 'month' | 'year-month';
@@ -62,7 +70,7 @@ export interface TdCalendarProps {
}; };
} }
export declare type CalendarFormatType = (day: TDate) => TDate; export declare type CalendarFormatType = (day: TDate) => TDate;
export declare type TDateType = 'selected' | 'disabled' | 'start' | 'centre' | 'end' | ''; export declare type TDateType = 'selected' | 'disabled' | 'start' | 'start-end' | 'centre' | 'end' | '';
export interface TDate { export interface TDate {
date: Date; date: Date;
day: number; day: number;
@@ -1 +1 @@
export function getMonthByOffset(t,e){const n=new Date(t);return n.setMonth(n.getMonth()+e),n.setDate(1),n}export function getYearByOffset(t,e){const n=new Date(t);return n.setFullYear(n.getFullYear()+e),n.setDate(1),n}export const getPrevMonth=t=>getMonthByOffset(t,-1);export const getNextMonth=t=>getMonthByOffset(t,1);export const getPrevYear=t=>getYearByOffset(t,-1);export const getNextYear=t=>getYearByOffset(t,1); export function getMonthByOffset(t,e){const n=new Date(t);return n.setMonth(n.getMonth()+e),n}export function getYearByOffset(t,e){const n=new Date(t);return n.setFullYear(n.getFullYear()+e),n}export const getPrevMonth=t=>getMonthByOffset(t,-1);export const getNextMonth=t=>getMonthByOffset(t,1);export const getPrevYear=t=>getYearByOffset(t,-1);export const getNextYear=t=>getYearByOffset(t,1);
+2 -1
View File
@@ -4,6 +4,7 @@ import { TdCascaderProps } from './type';
export interface CascaderProps extends TdCascaderProps { export interface CascaderProps extends TdCascaderProps {
} }
export default class Cascader extends SuperComponent { export default class Cascader extends SuperComponent {
behaviors: string[];
externalClasses: string[]; externalClasses: string[];
options: WechatMiniprogram.Component.ComponentOptions; options: WechatMiniprogram.Component.ComponentOptions;
properties: TdCascaderProps<import("../common/common").TreeOptionData<string | number>>; properties: TdCascaderProps<import("../common/common").TreeOptionData<string | number>>;
@@ -20,7 +21,7 @@ export default class Cascader extends SuperComponent {
}; };
data: { data: {
prefix: string; prefix: string;
name: string; classPrefix: string;
stepIndex: number; stepIndex: number;
selectedIndexes: any[]; selectedIndexes: any[];
selectedValue: any[]; selectedValue: any[];
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
<wxs src="../common/utils.wxs" module="_"/><t-popup class="class" visible="{{visible}}" placement="bottom" bind:visible-change="onVisibleChange"><view style="{{_._style([style, customStyle])}}" class="{{name}}"><view class="{{name}}__title"><slot name="title"/>{{title}}</view><view class="{{name}}__close-btn" bind:tap="onClose"><slot name="close-btn"/><t-icon wx:if="{{closeBtn}}" size="48rpx" name="close"/></view><slot name="header"/><view class="{{name}}__content"><block wx:if="{{steps && steps.length}}"><view wx:if="{{theme == 'step'}}" class="{{name}}__steps"><view wx:for="{{steps}}" wx:key="index" class="{{name}}__step" bind:tap="onStepClick" data-index="{{index}}"><view class="{{name}}__step-dot {{name}}__step-dot--{{item !== placeholder ? 'active' : ''}} {{name}}__step-dot--{{index === steps.length - 1 ? 'last' : ''}}"></view><view class="{{name}}__step-label {{name}}__step-label--{{index === stepIndex ? 'active' : ''}}">{{ item }}</view><t-icon name="chevron-right" size="44rpx" t-class="{{name}}__step-arrow"/></view></view><block wx:if="{{theme == 'tab'}}"><t-tabs id="tabs" value="{{stepIndex}}" bind:change="onTabChange" space-evenly="{{false}}"><t-tab-panel wx:for="{{steps}}" wx:key="index" value="{{index}}" label="{{item}}"/></t-tabs></block></block><view wx:if="{{ subTitles && subTitles[stepIndex] }}" class="{{name}}__options-title">{{subTitles[stepIndex]}}</view><view class="{{name}}__options-container" style="width: {{items.length + 1}}00vw; transform: translateX(-{{stepIndex}}00vw)"><scroll-view wx:for="{{items}}" wx:for-item="options" wx:key="index" class="{{name}}__options" scroll-y scroll-top="{{scrollTopList[index]}}" type="list" style="height: {{_optionsHeight}}px"><view class="cascader-radio-group-{{index}}"><t-radio-group value="{{selectedValue[index]}}" keys="{{keys}}" options="{{options}}" bind:change="handleSelect" data-level="{{index}}" placement="right" icon="line" borderless></t-radio-group></view></scroll-view></view></view></view></t-popup> <wxs src="../common/utils.wxs" module="_"/><t-popup class="class" visible="{{visible}}" placement="bottom" bind:visible-change="onVisibleChange"><view style="{{_._style([style, customStyle])}}" class="{{classPrefix}}"><view class="{{classPrefix}}__title"><slot name="title"/>{{title || globalConfig.title}}</view><view class="{{classPrefix}}__close-btn" bind:tap="onClose"><slot name="close-btn"/><t-icon wx:if="{{closeBtn}}" size="48rpx" name="close"/></view><slot name="header"/><view class="{{classPrefix}}__content"><block wx:if="{{steps && steps.length}}"><view wx:if="{{theme == 'step'}}" class="{{classPrefix}}__steps"><view wx:for="{{steps}}" wx:key="index" class="{{classPrefix}}__step" bind:tap="onStepClick" data-index="{{index}}"><view class="{{classPrefix}}__step-dot {{classPrefix}}__step-dot--{{item !== placeholder ? 'active' : ''}} {{classPrefix}}__step-dot--{{index === steps.length - 1 ? 'last' : ''}}"></view><view class="{{classPrefix}}__step-label {{classPrefix}}__step-label--{{index === stepIndex ? 'active' : ''}}">{{ item }}</view><t-icon name="chevron-right" size="44rpx" t-class="{{classPrefix}}__step-arrow"/></view></view><block wx:if="{{theme == 'tab'}}"><t-tabs id="tabs" value="{{stepIndex}}" bind:change="onTabChange" space-evenly="{{false}}"><t-tab-panel wx:for="{{steps}}" wx:key="index" value="{{index}}" label="{{item}}"/></t-tabs></block></block><slot name="middle-content"/><view wx:if="{{ subTitles && subTitles[stepIndex] }}" class="{{classPrefix}}__options-title">{{subTitles[stepIndex]}}</view><view class="{{classPrefix}}__options-container" style="width: {{items.length + 1}}00vw; transform: translateX(-{{stepIndex}}00vw)"><scroll-view wx:for="{{items}}" wx:for-item="options" wx:key="index" class="{{classPrefix}}__options" scroll-y scroll-top="{{scrollTopList[index]}}" type="list" style="height: {{_optionsHeight}}px"><view class="cascader-radio-group-{{index}}"><t-radio-group value="{{selectedValue[index]}}" keys="{{keys}}" options="{{options}}" bind:change="handleSelect" data-level="{{index}}" placement="right" icon="line" borderless></t-radio-group></view></scroll-view></view></view></view></t-popup>
@@ -1 +1,17 @@
@import '../common/style/index.wxss';.t-cascader{display:flex;flex-direction:column;background-color:var(--td-cascader-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));color:var(--td-cascader-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));border-radius:var(--td-radius-extra-large,24rpx) var(--td-radius-extra-large,24rpx) 0 0;--td-radio-icon-checked-color:var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));--td-tab-item-active-color:var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));--td-tab-track-color:var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)))}.t-cascader__close-btn{right:32rpx;top:24rpx;position:absolute}.t-cascader__title{position:relative;font-weight:700;text-align:center;line-height:var(--td-cascader-title-height,26rpx);padding:var(--td-cascader-title-padding,var(--td-spacer-2,32rpx));font-size:var(--td-cascder-title-font-size,36rpx)}.t-cascader__content{width:100%;height:var(--td-cascader-content-height,78vh);display:flex;flex-direction:column}.t-cascader__options{width:100vw}.t-cascader__options-title{color:var(--td-cascader-options-title-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font-size:var(--td-font-size-base,28rpx);line-height:44rpx;padding-top:40rpx;padding-left:var(--td-spacer-2,32rpx);box-sizing:border-box}.t-cascader__options-container{flex:1;display:flex;transition:all ease .3s}.t-cascader__step{display:flex;align-items:center;height:var(--td-cascader-step-height,88rpx)}.t-cascader__steps{padding:0 32rpx 10rpx;position:relative}.t-cascader__steps::after{content:'';display:block;position:absolute;top:unset;bottom:0;left:unset;right:unset;background-color:var(--td-cascader-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)))}.t-cascader__steps::after{height:1px;left:0;right:0;transform:scaleY(.5)}.t-cascader__step-dot{position:relative;width:var(--td-cascader-step-dot-size,16rpx);height:var(--td-cascader-step-dot-size,16rpx);border-radius:50%;border:2rpx solid var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));box-sizing:border-box}.t-cascader__step-dot:not(.t-cascader__step-dot--last)::after{content:'';display:block;position:absolute;left:50%;top:calc(var(--td-cascader-step-dot-size,16rpx) + 14rpx);height:36rpx;width:2rpx;background:var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));transform:translateX(-50%)}.t-cascader__step-dot--active{background:var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));border-color:var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)))}.t-cascader__step-label{padding-left:var(--td-spacer-2,32rpx);font-size:var(--td-font-size-m,32rpx)}.t-cascader__step-label--active{color:var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));font-weight:600}.t-cascader__step-arrow{color:var(--td-cascader-step-arrow-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));margin-left:auto} @import '../common/style/index.wxss';.t-cascader{display:flex;flex-direction:column;background-color:var(--td-cascader-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));color:var(--td-cascader-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));border-radius:var(--td-radius-extraLarge,24rpx) var(--td-radius-extraLarge,24rpx) 0 0;--td-radio-icon-checked-color:var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));--td-tab-item-active-color:var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));--td-tab-track-color:var(--td-cascader-active-color, var(--td-brand-color, var(--td-primary-color-7, #0052d9)));}
.t-cascader__close-btn{right:var(--td-spacer-2,32rpx);top:var(--td-spacer-2,32rpx);position:absolute;}
.t-cascader__title{position:relative;font:var(--td-cascader-title-font,var(--td-font-title-large,600 36rpx / 52rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));text-align:center;padding:var(--td-cascader-title-padding,var(--td-spacer-2,32rpx));}
.t-cascader__content{width:100%;height:var(--td-cascader-content-height,78vh);display:flex;flex-direction:column;}
.t-cascader__options{width:100vw;}
.t-cascader__options-title{color:var(--td-cascader-options-title-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));padding-top:40rpx;padding-left:var(--td-spacer-2,32rpx);box-sizing:border-box;}
.t-cascader__options-container{flex:1;display:flex;transition:all ease .3s;}
.t-cascader__step{display:flex;align-items:center;height:var(--td-cascader-step-height,88rpx);}
.t-cascader__steps{padding:0 32rpx 10rpx;position:relative;}
.t-cascader__steps::after{content:'';display:block;position:absolute;top:unset;bottom:0;left:unset;right:unset;background-color:var(--td-cascader-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));}
.t-cascader__steps::after{height:1px;left:0;right:0;transform:scaleY(.5);}
.t-cascader__step-dot{position:relative;width:var(--td-cascader-step-dot-size,16rpx);height:var(--td-cascader-step-dot-size,16rpx);border-radius:50%;border:2rpx solid var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));box-sizing:border-box;}
.t-cascader__step-dot:not(.t-cascader__step-dot--last)::after{content:'';display:block;position:absolute;left:50%;top:calc(var(--td-cascader-step-dot-size,16rpx) + 14rpx);height:36rpx;width:2rpx;background:var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));transform:translateX(-50%);}
.t-cascader__step-dot--active{background:var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));border-color:var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-cascader__step-label{padding-left:var(--td-spacer-2,32rpx);font:var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular));}
.t-cascader__step-label--active{color:var(--td-cascader-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));font-weight:600;}
.t-cascader__step-arrow{color:var(--td-cascader-step-arrow-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));margin-left:auto;}
@@ -1 +1 @@
const props={checkStrictly:{type:Boolean,value:!1},closeBtn:{type:Boolean,value:!0},keys:{type:Object},options:{type:Array,value:[]},placeholder:{type:String,value:"选择选项"},subTitles:{type:Array,value:[]},theme:{type:String,value:"step"},title:{type:String},value:{type:null,value:null},defaultValue:{type:null,value:null},visible:{type:Boolean,value:!1}};export default props; const props={checkStrictly:{type:Boolean,value:!1},closeBtn:{type:Boolean,value:!0},keys:{type:Object},options:{type:Array,value:[]},placeholder:{type:String,value:""},subTitles:{type:Array,value:[]},theme:{type:String,value:"step"},title:{type:String},value:{type:null,value:null},defaultValue:{type:null,value:null},visible:{type:Boolean,value:!1}};export default props;
+3 -2
View File
@@ -1,4 +1,4 @@
import { TreeOptionData, KeysType } from '../common/common'; import { TreeOptionData, TreeKeysType } from '../common/common';
export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOptionData> { export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOptionData> {
checkStrictly?: { checkStrictly?: {
type: BooleanConstructor; type: BooleanConstructor;
@@ -10,7 +10,7 @@ export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOpt
}; };
keys?: { keys?: {
type: ObjectConstructor; type: ObjectConstructor;
value?: KeysType; value?: CascaderKeysType;
}; };
options?: { options?: {
type: ArrayConstructor; type: ArrayConstructor;
@@ -45,3 +45,4 @@ export interface TdCascaderProps<CascaderOption extends TreeOptionData = TreeOpt
value?: boolean; value?: boolean;
}; };
} }
export declare type CascaderKeysType = TreeKeysType;
@@ -1 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";const{prefix:prefix}=config,name=`${prefix}-cell-group`;let CellGroup=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-title`],this.relations={"../cell/cell":{type:"child",linked(){this.updateLastChid()},unlinked(){this.updateLastChid()}}},this.properties=props,this.data={prefix:prefix,classPrefix:name},this.methods={updateLastChid(){const e=this.$children;e.forEach(((t,o)=>t.setData({isLastChild:o===e.length-1})))}}}};CellGroup=__decorate([wxComponent()],CellGroup);export default CellGroup; import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";const{prefix:prefix}=config,name=`${prefix}-cell-group`;let CellGroup=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-title`],this.relations={"../cell/cell":{type:"child",linked(){this.updateLastChid()},unlinked(){this.updateLastChid()}}},this.properties=props,this.data={prefix:prefix,classPrefix:name},this.methods={updateLastChid(){const e=this.$children;e.forEach((t,o)=>t.setData({isLastChild:o===e.length-1}))}}}};CellGroup=__decorate([wxComponent()],CellGroup);export default CellGroup;
@@ -1 +1,5 @@
@import '../common/style/index.wxss';.t-cell-group{position:relative}.t-cell-group__title{font-family:PingFangSC-Regular;font-size:var(--td-cell-group-title-font-size,28rpx);color:var(--td-cell-group-title-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));text-align:left;line-height:var(--td-cell-group-title-line-height,90rpx);background-color:var(--td-cell-group-title-bg-color,var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3)));padding-left:var(--td-cell-group-title-padding-left,32rpx)}.t-cell-group--bordered::before{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;left:0;top:0;border-top:1px solid var(--td-cell-group-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));transform:scaleY(.5);transform-origin:0 0;transform-origin:top;z-index:1}.t-cell-group--bordered::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;left:0;bottom:0;border-bottom:1px solid var(--td-cell-group-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));transform:scaleY(.5);transform-origin:bottom;z-index:1}.t-cell-group--card{margin:0 32rpx;border-radius:var(--td-radius-large,18rpx);overflow:hidden} @import '../common/style/index.wxss';.t-cell-group{position:relative;}
.t-cell-group__title{font-family:PingFangSC-Regular;font-size:var(--td-cell-group-title-font-size,28rpx);color:var(--td-cell-group-title-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));text-align:left;line-height:var(--td-cell-group-title-line-height,90rpx);background-color:var(--td-cell-group-title-bg-color,var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3)));padding-left:var(--td-cell-group-title-padding-left,32rpx);}
.t-cell-group--bordered::before{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;left:0;top:0;border-top:1px solid var(--td-cell-group-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));transform:scaleY(.5);transform-origin:0 0;transform-origin:top;z-index:1;}
.t-cell-group--bordered::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;left:0;bottom:0;border-bottom:1px solid var(--td-cell-group-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));transform:scaleY(.5);transform-origin:bottom;z-index:1;}
.t-cell-group--card{margin:0 32rpx;border-radius:var(--td-radius-large,18rpx);overflow:hidden;}
@@ -1 +1 @@
<import src="../common/template/icon.wxml"/><wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle])}}" class="class {{prefix}}-class {{_.cls(classPrefix, [['borderless', !bordered || isLastChild]])}}" hover-class="{{ hover ? classPrefix + '--hover' : ''}}" hover-stay-time="70" bind:tap="onClick" aria-role="{{ariaRole || (arrow ? 'button' : '')}}" aria-label="{{ariaLabel}}"><view class="{{classPrefix}}__left {{prefix}}-class-left"><template wx:if="{{_leftIcon}}" is="icon" data="{{tClass: classPrefix + '__left-icon ' + prefix + '-class-left-icon', ..._leftIcon }}"/><slot name="left-icon"/><t-image wx:if="{{ image }}" shape="round" t-class="{{classPrefix}}__left-image {{prefix}}-class-image" src="{{ image }}"/><slot name="image"/></view><view class="{{classPrefix}}__title {{prefix}}-class-center"><view class="{{classPrefix}}__title-text {{prefix}}-class-title"><block wx:if="{{ title }}">{{ title}}</block><slot name="title"/><block wx:if="{{required}}"><text decode class="{{classPrefix}}--required">&nbsp;*</text></block></view><view class="{{classPrefix}}__description {{prefix}}-class-description"><view wx:if="{{ description }}" class="{{classPrefix}}__description-text">{{description}}</view><slot name="description"/></view></view><view class="{{classPrefix}}__note {{prefix}}-class-note"><text wx:if="{{ note }}">{{note}}</text><slot name="note"/></view><view class="{{_.cls(classPrefix + '__right', [align])}} {{prefix}}-class-right"><template wx:if="{{_arrow}}" is="icon" data="{{tClass: classPrefix + '__right-icon ' + prefix + '-class-right-icon', ..._arrow }}"/><block wx:else><template wx:if="{{_rightIcon}}" is="icon" data="{{tClass: classPrefix + '__right-icon ' + prefix + '-class-right-icon', ..._rightIcon }}"/><slot name="right-icon"/></block></view></view> <import src="../common/template/icon.wxml"/><wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle])}}" class="class {{prefix}}-class {{_.cls(classPrefix, [['bordered', bordered && !isLastChild]])}}" hover-class="{{ hover ? classPrefix + '--hover' : ''}}" hover-stay-time="70" bind:tap="onClick" aria-role="{{ariaRole || (arrow ? 'button' : '')}}" aria-label="{{ariaLabel}}"><view class="{{classPrefix}}__left {{prefix}}-class-left"><template wx:if="{{_leftIcon}}" is="icon" data="{{tClass: classPrefix + '__left-icon ' + prefix + '-class-left-icon', ..._leftIcon }}"/><slot name="left-icon"/><t-image wx:if="{{ image }}" shape="round" t-class="{{classPrefix}}__left-image {{prefix}}-class-image" src="{{ image }}"/><slot name="image"/></view><view class="{{classPrefix}}__title {{prefix}}-class-center"><view class="{{classPrefix}}__title-text {{prefix}}-class-title"><block wx:if="{{ title }}">{{ title}}</block><slot name="title"/><block wx:if="{{required}}"><text decode class="{{classPrefix}}--required">&nbsp;*</text></block></view><view class="{{classPrefix}}__description {{prefix}}-class-description"><view wx:if="{{ description }}" class="{{classPrefix}}__description-text">{{description}}</view><slot name="description"/></view></view><view class="{{classPrefix}}__note {{prefix}}-class-note"><text wx:if="{{ note }}">{{note}}</text><slot name="note"/></view><view class="{{_.cls(classPrefix + '__right', [align])}} {{prefix}}-class-right"><template wx:if="{{_arrow}}" is="icon" data="{{tClass: classPrefix + '__right-icon ' + prefix + '-class-right-icon', ..._arrow }}"/><block wx:else><template wx:if="{{_rightIcon}}" is="icon" data="{{tClass: classPrefix + '__right-icon ' + prefix + '-class-right-icon', ..._rightIcon }}"/><slot name="right-icon"/></block></view></view>
@@ -1 +1,21 @@
@import '../common/style/index.wxss';.t-cell{position:relative;display:flex;box-sizing:border-box;width:100%;padding:var(--td-cell-vertical-padding,32rpx) var(--td-cell-horizontal-padding,32rpx);line-height:var(--td-cell-line-height,48rpx);height:var(--td-cell-height,auto);background-color:var(--td-cell-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)))}.t-cell::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;left:0;bottom:0;border-bottom:var(--td-cell-border-width,1px) solid var(--td-cell-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));transform:scaleY(.5);transform-origin:bottom;left:var(--td-cell-border-left-space,var(--td-cell-horizontal-padding,32rpx));right:var(--td-cell-border-right-space,0)}.t-cell--borderless::after{display:none}.t-cell__description{font-size:var(--td-cell-description-font-size,var(--td-font-size-base,28rpx));line-height:var(--td-cell-description-line-height,44rpx);color:var(--td-cell-description-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))))}.t-cell__description-text{margin-top:calc(var(--td-spacer,16rpx)/ 2)}.t-cell__note{display:flex;align-items:center;justify-content:flex-end;color:var(--td-cell-note-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font-size:var(--td-cell-note-font-size,var(--td-font-size-m,32rpx))}.t-cell__title{margin-right:var(--td-spacer-2,32rpx)}.t-cell__note,.t-cell__title{flex:1 1 auto}.t-cell__note:empty,.t-cell__title:empty{display:none}.t-cell__title-text{display:flex;font-size:var(--td-cell-title-font-size,var(--td-font-size-m,32rpx));color:var(--td-cell-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));font-weight:400}.t-cell__left,.t-cell__right{align-self:stretch}.t-cell__left:not(:empty){margin-right:var(--td-spacer-1,24rpx)}.t-cell__left-icon{color:var(--td-cell-left-icon-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));font-size:var(--td-cell-left-icon-font-size,48rpx)}.t-cell__left-image{height:var(--td-cell-image-height,96rpx);width:var(--td-cell-image-width,96rpx)}.t-cell__note:not(:empty)+.t-cell__right{margin-left:calc(var(--td-spacer,16rpx)/ 2)}.t-cell__right{display:flex}.t-cell__right-icon{color:var(--td-cell-right-icon-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font-size:var(--td-cell-right-icon-font-size,48rpx)}.t-cell__right--middle{align-items:center}.t-cell__right--top{align-items:flex-start}.t-cell__right--bottom{align-items:flex-end}.t-cell--hover{background-color:var(--td-cell-hover-color,var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3)))}.t-cell--required{font-size:var(--td-cell-required-font-size,var(--td-font-size-m,32rpx));color:var(--td-cell-required-color,var(--td-error-color,var(--td-error-color-6,#d54941)))} @import '../common/style/index.wxss';.t-cell{position:relative;display:flex;box-sizing:border-box;width:100%;padding:var(--td-cell-vertical-padding,32rpx) var(--td-cell-horizontal-padding,32rpx);height:var(--td-cell-height,auto);background-color:var(--td-cell-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));}
.t-cell--bordered::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;left:0;bottom:0;border-bottom:var(--td-cell-border-width,1px) solid var(--td-cell-border-color,var(--td-component-stroke,var(--td-gray-color-3,#e7e7e7)));transform:scaleY(.5);transform-origin:bottom;left:var(--td-cell-border-left-space,var(--td-cell-horizontal-padding,32rpx));right:var(--td-cell-border-right-space,0);}
.t-cell__description{font:var(--td-cell-description-font,var(--td-font-body-medium,28rpx / 44rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));color:var(--td-cell-description-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));}
.t-cell__description-text{margin-top:calc(var(--td-spacer,16rpx)/ 2);}
.t-cell__note{display:flex;align-items:center;justify-content:flex-end;color:var(--td-cell-note-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font-size:var(--td-cell-note-font-size,var(--td-font-size-m,32rpx));}
.t-cell__title{margin-right:var(--td-spacer-2,32rpx);}
.t-cell__note,.t-cell__title{flex:1 1 auto;}
.t-cell__note:empty,.t-cell__title:empty{display:none;}
.t-cell__title-text{display:flex;font:var(--td-cell-title-font,var(--td-font-body-large,32rpx / 48rpx var(--td-font-family,PingFang SC,Microsoft YaHei,Arial Regular)));color:var(--td-cell-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
.t-cell__left,.t-cell__right{align-self:stretch;}
.t-cell__left:not(:empty){margin-right:var(--td-spacer-1,24rpx);}
.t-cell__left-icon{color:var(--td-cell-left-icon-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));font-size:var(--td-cell-left-icon-size,48rpx);}
.t-cell__left-image{height:var(--td-cell-image-height,96rpx);width:var(--td-cell-image-width,96rpx);}
.t-cell__note:not(:empty)+.t-cell__right{margin-left:calc(var(--td-spacer,16rpx)/ 2);}
.t-cell__right{display:flex;}
.t-cell__right-icon{color:var(--td-cell-right-icon-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));font-size:var(--td-cell-right-icon-size,48rpx);}
.t-cell__right--middle{align-items:center;}
.t-cell__right--top{align-items:flex-start;}
.t-cell__right--bottom{align-items:flex-end;}
.t-cell--hover{background-color:var(--td-cell-hover-color,var(--td-bg-color-secondarycontainer,var(--td-gray-color-1,#f3f3f3)));}
.t-cell--required{font-size:var(--td-cell-required-font-size,var(--td-font-size-m,32rpx));color:var(--td-cell-required-color,var(--td-error-color,var(--td-error-color-6,#d54941)));}
@@ -0,0 +1,47 @@
import { SuperComponent, ComponentsOptionsType } from '../../../components/common/src/index';
export default class ChatActionbar extends SuperComponent {
behaviors: string[];
options: ComponentsOptionsType;
properties: import("./type").TdChatActionbarProps;
data: {
actions: any[];
classPrefix: string;
pComment: string;
iconMap: {
good: string;
bad: string;
replay: string;
copy: string;
share: string;
quote: string;
};
iconActiveMap: {
good: string;
bad: string;
};
widthStyle: string;
popoverStyle: string;
popoverPosition: string;
longpressVisible: boolean;
};
observers: {
comment(newVal: any): void;
'actionBar, pComment, placement'(): void;
longPressPosition(newVal: any): void;
};
methods: {
filterSpecialChars(content: string): string;
handleActionClick(e: any): void;
handleCopy(): void;
setActions(): void;
setPComment(newVal: any): void;
showPopover(pos: any): void;
hidePopover(): void;
onVisibleChange(e: any): void;
};
lifetimes: {
created(): void;
attached(): void;
detached(): void;
};
}
@@ -0,0 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import usingConfig from"../mixins/using-config";const{prefix:prefix}=config,componentName="chat-actionbar";let ChatActionbar=class extends SuperComponent{constructor(){super(...arguments),this.behaviors=[usingConfig({componentName:componentName})],this.options={multipleSlots:!0},this.properties=props,this.data={actions:[],classPrefix:`${prefix}-${componentName}`,pComment:"",iconMap:{good:"thumb-up",bad:"thumb-down",replay:"refresh",copy:"copy",share:"share-1",quote:"enter"},iconActiveMap:{good:"thumb-up-filled",bad:"thumb-down-filled"},widthStyle:"",popoverStyle:"transition: none;position: fixed;",popoverPosition:"",longpressVisible:!1},this.observers={comment(t){this.setPComment(t)},"actionBar, pComment, placement"(){this.setActions()},longPressPosition(t){"longpress"===this.properties.placement&&(t?this.showPopover(t):this.hidePopover())}},this.methods={filterSpecialChars(t){let e=t;const i=[];e=e.replace(/^(\s*\|.*\|.*\n\s*\|[-: ]+\|.*\n(\s*\|.*\|.*\n)*)/gm,t=>{const e=t.replace(/\[\d+(?:,\d+)*\]\(@ref\)/g,"").replace(/(\*\*|__)(.*?)\1|(\*|_)(.*?)\3/g,"$2$4").replace(/<br\s*\/?>/gi,"\n");return i.push(e),`%%TABLE${i.length-1}%%`}),e=e.replace(/^(\s*)#{1,6}\s+/gm,"$1"),e=e.replace(/(\*\*|__)(.*?)\1|(\*|_)(.*?)\3/g,"$2$4"),e=e.replace(/!\[.*?\]\(.*?\)/g,""),e=e.replace(/\[\d+(?:,\d+)*\]\(@ref\)/g,"");return e=e.replace(/(\\|`|\{|\}|\[|\]|\(|\)|\||!|@ref|\([@#]\w+\))/g,""),e=e.replace(/\[\d+\]/g,""),e=e.replace(/<br\s*\/?>/gi,"\n"),e=e.replace(/%%TABLE(\d+)%%/g,(t,e)=>i[parseInt(e,10)]||""),e.replace(/\n{3,}/g,"\n\n").trim()},handleActionClick(t){const{name:e}=t.currentTarget.dataset;if("copy"===e&&this.data.content)this.data.handleCopy();else if("good"===e){const t="good"===this.data.pComment;this.setData({pComment:t?void 0:"good"}),this.triggerEvent("actions",{name:e,active:!t,chatId:this.properties.chatId})}else if("bad"===e){const t="bad"===this.data.pComment;this.setData({pComment:t?void 0:"bad"}),this.triggerEvent("actions",{name:e,active:!t,chatId:this.properties.chatId})}else this.triggerEvent("actions",{name:e,chatId:this.properties.chatId});this.onVisibleChange({detail:{visible:!1}})},handleCopy(){if(!this.data.content)return;const t="markdown"===this.data.copyMode?this.data.content:this.data.filterSpecialChars(this.data.content);this.triggerEvent("actions",{name:"copy",data:t})},setActions(){const{globalConfig:t}=this.data,e=[];let i=[];"longpress"===this.properties.placement?i=["quote","copy","share"]:Array.isArray(this.properties.actionBar)&&(i=this.properties.actionBar),i.forEach(i=>{var o,s;"good"===i||"bad"===i?e.push({name:i,isActive:this.data.pComment===i,text:(null===(o=t.actionBar)||void 0===o?void 0:o[i])||i}):e.push({name:i,isActive:!1,text:(null===(s=t.actionBar)||void 0===s?void 0:s[i])||i})}),this.setData({actions:e})},setPComment(t){this.setData({pComment:t||""})},showPopover(t){this.setData({widthStyle:`width: ${128*this.data.actions.length+8*(this.data.actions.length-1)}rpx`,popoverPosition:`top:${t.y}px;left:${t.x}px`,longpressVisible:!0}),setTimeout(()=>{const t=this.selectComponent(".popover"),e=this.createSelectorQuery().in(t);e.select(".t-popover").boundingClientRect(),e.exec(t=>{const[e]=t,{screenWidth:i}=wx.getWindowInfo();e.left+e.width>i?this.setData({popoverStyle:"transition: none;position:fixed; left: unset !important; right: 16rpx !important;"}):e.left<=0&&this.setData({popoverStyle:"transition: none;position:fixed; left: 16rpx !important;"})})},200)},hidePopover(){this.onVisibleChange({detail:{visible:!1}})},onVisibleChange(t){const{visible:e}=t.detail;this.setData({longpressVisible:e}),e||setTimeout(()=>{this.setData({popoverPosition:"",popoverStyle:"transition: none;position: fixed;"})},200)}},this.lifetimes={created(){this.data.filterSpecialChars=this.filterSpecialChars.bind(this),this.data.handleActionClick=this.handleActionClick.bind(this),this.data.handleCopy=this.handleCopy.bind(this),this.data.showPopover=this.showPopover.bind(this),this.data.hidePopover=this.hidePopover.bind(this),this.data.setPComment=this.setPComment.bind(this)},attached(){this.setData({pComment:this.properties.comment||""}),this.setActions()},detached(){}}}};ChatActionbar=__decorate([wxComponent()],ChatActionbar);export default ChatActionbar;

Some files were not shown because too many files have changed in this diff Show More