Compare commits

129 Commits

Author SHA1 Message Date
Felix
5bab1d76fc fix code 2026-01-27 19:57:56 +08:00
Felix
2a3d47e3c9 add microphone bar 2026-01-27 11:25:10 +08:00
Felix
dc65893293 fix scroll view 2026-01-27 10:21:55 +08:00
Felix
96b0a20fa0 fix code 2026-01-26 17:52:22 +08:00
Felix
1bffa69aea fix code 2026-01-25 22:12:29 +08:00
Felix
4607db2721 fix code 2026-01-23 16:26:34 +08:00
Felix
107283a69a fix code 2026-01-23 15:51:01 +08:00
Felix
2ae39a4eaa fix code 2026-01-23 12:52:31 +08:00
Felix
0a36bebde5 fix code 2026-01-23 12:02:07 +08:00
Felix
9d8f6d73ef add conversation 2026-01-21 13:29:15 +08:00
Felix
751b2ae087 add subscribe 2026-01-18 11:48:03 +08:00
Felix
90057c8ddb add variation 2026-01-13 20:50:02 +08:00
Felix
78b7964860 add confetti 2026-01-09 12:29:07 +08:00
Felix
bdf0112046 fix code 2026-01-05 11:50:51 +08:00
Felix
827b939299 add avatar 2026-01-03 15:47:49 +08:00
Felix
0aab0e2172 fix code 2026-01-02 13:49:47 +08:00
Felix
a99bf39dfb add qa 2025-12-30 20:37:59 +08:00
Felix
9b83e83f3b fix code 2025-12-23 21:14:29 +08:00
Felix
4f1aff4a62 fix code 2025-12-23 17:33:05 +08:00
Felix
023b30ec87 fix code 2025-12-22 15:47:39 +08:00
Felix
9ce8044e2a fix code 2025-12-21 21:18:57 +08:00
Felix
c006a2c4c7 fix ui 2025-12-21 16:17:36 +08:00
Felix
0b0582572d add sentence 2025-12-19 17:16:24 +08:00
Felix
c82070c3b7 fix code 2025-12-12 20:32:59 +08:00
Felix
02dcd7897f fix log 2025-12-12 20:23:28 +08:00
Felix
d293a334e4 fix ui 2025-12-12 19:45:50 +08:00
Felix
9df2e00e80 fix ui 2025-12-11 19:21:50 +08:00
Felix
1d58147622 fix ui 2025-12-11 18:55:47 +08:00
Felix
44aaec2bcc fix code 2025-12-11 13:55:11 +08:00
Felix
9b62e6a346 fix code 2025-12-11 12:22:23 +08:00
Felix
1fa9349e6d fix ui 2025-12-11 10:53:22 +08:00
Felix
e5abc263b8 fix ui 2025-12-11 08:59:08 +08:00
Felix
43e3565d69 fix ui 2025-12-10 20:13:03 +08:00
Felix
f4079961ca fix ui 2025-12-10 19:39:31 +08:00
Felix
dda6290b15 fix ui 2025-12-10 16:16:34 +08:00
Felix
fd1d94477c fix code 2025-12-09 18:54:35 +08:00
Felix
d61dd28654 fix upload 2025-12-09 18:20:17 +08:00
Felix
4a7c1e0907 fix ui 2025-12-09 14:34:10 +08:00
Felix
0e45ccf09a fix assessment 2025-12-09 13:32:43 +08:00
Felix
54da7d0a04 fix code 2025-12-08 22:19:39 +08:00
Felix
0e4a6b3a8d fix code 2025-12-08 10:44:14 +08:00
Felix
028c82f284 add wxpay 2025-12-08 10:40:01 +08:00
Felix
9cc48e1972 fix code 2025-12-06 21:25:24 +08:00
Felix
7dd17b1c08 fix audio 2025-12-06 20:20:25 +08:00
Felix
29064351aa fix ui 2025-12-06 19:23:15 +08:00
Felix
156e6eca6f fix code 2025-12-06 17:47:09 +08:00
Felix
f860f4782d fix code 2025-12-06 13:47:00 +08:00
Felix
d67c77c250 fix ui 2025-12-06 10:05:18 +08:00
Felix
1409d05771 fix auth 2025-12-05 21:08:43 +08:00
Felix
586557935d fix code 2025-12-05 10:16:55 +08:00
Felix
b70cf8a2fb fix config 2025-12-04 17:28:42 +08:00
Felix
a99a648036 fix microphone 2025-12-04 08:27:29 +08:00
Felix
6ca691ec6b add wxpay 2025-12-03 22:10:30 +08:00
Felix
4722978753 fix ui 2025-12-03 11:15:04 +08:00
Felix
cc46cfbd79 fix ui 2025-12-02 19:31:00 +08:00
Felix
fdbe14b7de fix ui 2025-12-02 18:45:39 +08:00
Felix
973ef03a20 fix ui 2025-12-01 14:01:23 +08:00
Felix
43cb68ecdc fix ui 2025-12-01 13:45:42 +08:00
Felix
46d06779cb fix ui 2025-12-01 10:45:46 +08:00
Felix
2060a8c154 fix ui 2025-12-01 10:27:29 +08:00
Felix
d5bbaad29e fix ui 2025-11-30 21:39:10 +08:00
Felix
292b011052 fix ui 2025-11-30 20:47:13 +08:00
Felix
766c0400e6 fix ui 2025-11-30 19:18:39 +08:00
felix
560ca94fc4 Merge pull request 'fix ui' (#17) from lisa into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/17
2025-11-30 06:12:47 +00:00
chenlisha02
643be5284d fix ui 2025-11-30 13:54:56 +08:00
Felix
e915f45ee9 fix ui 2025-11-29 14:03:35 +08:00
Felix
a949eef388 fix ui 2025-11-29 13:29:29 +08:00
Felix
a3d28e99e3 add subtile animation 2025-11-29 10:53:00 +08:00
Felix
3bac35bdbb fix ui 2025-11-29 09:31:44 +08:00
Felix
f1d6220831 fix ui 2025-11-28 17:34:13 +08:00
Felix
315f5e9468 Merge branch 'main' of https://gitea.xhzone.cn/felix/miniprogram-1
merge
2025-11-27 16:46:03 +08:00
Felix
953392ac2f fix code 2025-11-27 16:30:58 +08:00
felix
8231c5f151 fix code 2025-11-27 16:30:19 +08:00
felix
788297a38b Merge pull request '[lisa]fix: add camera' (#16) from lisa into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/16
2025-11-27 03:54:38 +00:00
chenlisha02
49a693eb14 [lisa]fix: add camera 2025-11-27 11:50:43 +08:00
Felix
82ed8d63bf add back btn 2025-11-26 16:43:05 +08:00
felix
d5eee76163 Merge pull request 'lisa' (#15) from lisa into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/15
2025-11-26 01:25:35 +00:00
chenlisha02
c4114a44da merge main 2025-11-25 20:43:29 +08:00
chenlisha02
bceeba9f3b Merge branch 'main' nto lisa 2025-11-25 20:42:43 +08:00
chenlisha02
43972d964e [lisa]fix: page 2025-11-25 20:40:05 +08:00
Felix
2fa040560f add coupon page 2025-11-25 19:46:31 +08:00
Felix
63010a509e add coupon page 2025-11-25 19:45:35 +08:00
chenlisha02
44f0a6ff2b Merge branch 'main' of https://gitea.xhzone.cn/felix/miniprogram-1 into lisa 2025-11-10 12:16:52 +08:00
Felix
fe59bbdfa9 fix today summary 2025-11-10 11:01:29 +08:00
Felix
e58f5558a2 remove audio duration 2025-11-09 21:59:29 +08:00
Felix
5f50092d9c fix audio file api 2025-11-09 21:56:00 +08:00
Felix
8616ff3dcf fix icon 2025-11-09 21:39:14 +08:00
chenlisha02
471557a885 Merge branch 'main' of https://gitea.xhzone.cn/felix/miniprogram-1 into lisa 2025-11-09 20:55:18 +08:00
chenlisha02
2088340254 [lisa]fix: ui 2025-11-09 20:55:13 +08:00
Felix
fb7f8764ca add more btn 2025-11-09 20:51:53 +08:00
felix
f7431f7793 Merge pull request '[lisa]fix: ui' (#14) from lisa into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/14
2025-11-09 12:26:46 +00:00
chenlisha02
f47e0dd2e8 Merge branch 'main' of https://gitea.xhzone.cn/felix/miniprogram-1 into lisa 2025-11-09 20:19:52 +08:00
chenlisha02
651a50585c [lisa]fix: ui 2025-11-09 20:19:46 +08:00
Felix
4a061bb4ba fix wxml index key 2025-11-09 20:17:36 +08:00
felix
af24d9e838 Merge pull request '[lisa]fix: bugs' (#13) from lisa into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/13
2025-11-09 11:53:24 +00:00
chenlisha02
2a56c1ef0b [lisa]fix: bugs 2025-11-09 19:53:02 +08:00
Felix
6a5026aeba fix audio file api 2025-11-09 19:49:40 +08:00
Felix
23e4d673f4 fix image file api 2025-11-09 19:27:39 +08:00
Felix
9bc07ccbec add file api 2025-11-09 19:14:16 +08:00
felix
c4f649f595 Merge pull request '[lisa]fix: bugs' (#12) from lisa into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/12
2025-11-09 06:40:52 +00:00
chenlisha02
d6d0aed9e6 [lisa]fix: bugs 2025-11-09 14:40:30 +08:00
Felix
4debc59871 fix ui 2025-11-09 14:38:03 +08:00
Felix
da167a1336 fix dictionary 2025-11-09 13:01:08 +08:00
Felix
0682577d53 fix daily summary 2025-11-09 11:43:58 +08:00
Felix
c2c8b9a02a change privacy 2025-11-08 20:52:58 +08:00
felix
1f40c0410a Merge pull request '[lisa]feat: improve ui' (#11) from lisa into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/11
2025-11-08 12:50:55 +00:00
chenlisha02
8a46c6e6bc [lisa]feat: improve ui 2025-11-08 20:40:16 +08:00
Felix
e9af707187 fix UI and add coupon 2025-11-08 20:38:43 +08:00
Felix
003ca1effb add icon 2025-11-07 18:14:03 +08:00
Felix
6c5df5faf9 fix ui 2025-11-05 22:12:02 +08:00
felix
ebbaf04cfa Merge pull request '[lisa-feat]feat: improve ui' (#9) from lisa-feat into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/9
2025-11-05 12:41:43 +00:00
chenlisha02
1a8b242db9 [lisa-feat]feat: improve ui 2025-11-05 20:39:40 +08:00
Felix
148d87277b add word search 2025-11-05 19:30:51 +08:00
felix
5070cbfb48 Merge pull request 'fix structure' (#8) from lisa-feat into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/8
2025-11-04 09:45:39 +00:00
felix
0c790f0fbe Merge pull request '[lisa-feat]feat: 增加image_id' (#7) from lisa-feat into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/7
2025-11-04 09:39:30 +00:00
chenlisha02
1a1ee52ac5 fix structure 2025-11-04 17:38:43 +08:00
chenlisha02
4aae48a317 [lisa-feat]feat: 增加image_id 2025-10-21 18:10:00 +08:00
felix
ffa8681abe Merge pull request '[lisa-feat]fix: 接口错误' (#6) from lisa-feat into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/6
2025-10-19 11:32:46 +00:00
chenlisha02
1a68551e92 [lisa-feat]fix: 接口错误 2025-10-19 19:32:26 +08:00
felix
627483770f Merge pull request '[lisa-feat]feat: 接口调整' (#5) from lisa-feat into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/5
2025-10-19 08:38:45 +00:00
chenlisha02
7686bb6c1b [lisa-feat]feat: 接口调整 2025-10-19 16:38:11 +08:00
felix
7eb48b9445 Merge pull request '[lisa-feat]feat: 风格调整' (#4) from lisa-feat into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/4
2025-10-16 11:43:10 +00:00
chenlisha02
9005de2bb4 [lisa-feat]feat: 风格调整 2025-10-16 17:33:19 +08:00
felix
5a7496d642 Merge pull request 'lisa-feat' (#3) from lisa-feat into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/3
2025-10-15 10:24:54 +00:00
chenlisha02
09edeaa755 [lisa-feat]feat: 调整标准语音播放 2025-10-15 12:27:43 +08:00
chenlisha02
4465afc7ba [lisa-feat]feat: 增加标准语音播放 2025-10-14 18:05:17 +08:00
felix
fc51ae49d2 Merge pull request '[lisa-feat]feat: 增加音标处理' (#2) from lisa-feat into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/2
2025-10-11 10:14:51 +00:00
chenlisha02
48d82d83d2 [lisa-feat]feat: 增加音标处理 2025-10-11 16:51:49 +08:00
felix
790086d40e Merge pull request '[lisa-feat]feat: 页面优化以及更新' (#1) from lisa-feat into main
Reviewed-on: http://gitea.xhzone.cn/felix/miniprogram-1/pulls/1
2025-10-10 09:49:01 +00:00
1013 changed files with 17039 additions and 17173 deletions

View File

@@ -0,0 +1 @@
{"containers":[],"config":{}}

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.history
.DS_Store
miniprogram/static/.DS_Store
miniprogram/miniprogram_npm
node_modules
.vscode
.cloudbase

View File

@@ -1,51 +1,31 @@
{
"pages": [
"pages/upload/upload",
"pages/result/result",
"pages/result_show/result_show",
"pages/assessment/assessment",
"pages/profile/profile",
"pages/index/index",
"pages/logs/logs",
"pages/history/history",
"pages/terms/terms",
"pages/privacy/privacy"
"pages/privacy/privacy",
"pages/analyze/analyze",
"pages/coupon/coupon",
"pages/order/order",
"pages/scene_sentence/scene_sentence",
"pages/qa_exercise/qa_exercise",
"pages/avatar_crop/avatar_crop"
],
"window": {
"navigationBarTextStyle": "black",
"navigationStyle": "default",
"navigationBarTitleText": "图片识别",
"navigationBarTitleText": "",
"backgroundColor": "#ffffff",
"backgroundTextStyle": "light"
},
"tabBar": {
"color": "#666666",
"selectedColor": "#007AFF",
"backgroundColor": "#ffffff",
"borderStyle": "black",
"list": [
{
"pagePath": "pages/upload/upload",
"text": "识别"
},
{
"pagePath": "pages/profile/profile",
"text": "我的"
}
]
},
"permission": {
"scope.camera": {
"desc": "需要使用相机拍照识别图片"
},
"scope.writePhotosAlbum": {
"desc": "需要访问相册选择图片"
}
},
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents",
"useExtendedLib" : {
"weui": true
}
}
}

View File

@@ -1,17 +1,20 @@
// app.ts
import { IAppOption } from './types/app'
import apiManager from './utils/api'
import { cloudConfig } from './utils/cloud.config'
App<IAppOption>({
globalData: {
isLoggedIn: false,
userInfo: undefined,
token: undefined,
dictLevel: undefined // 新增字段,用户词典等级配置
dictLevel: undefined, // 新增字段,用户词典等级配置
pendingReferrerId: undefined
},
onLaunch() {
console.log('小程序启动')
wx.cloud.init()
// 初始化登录状态
this.initLoginStatus()
@@ -22,6 +25,40 @@ App<IAppOption>({
wx.setStorageSync('logs', logs)
},
async call(obj: any, number: number = 0) {
const that: any = this
if (!that.cloud) {
const cloud = new wx.cloud.Cloud({
resourceAppid: cloudConfig.resourceAppid || wx.getAccountInfoSync()?.miniProgram?.appId || '',
resourceEnv: cloudConfig.env
})
that.cloud = cloud
await that.cloud.init()
}
try {
const result = await that.cloud.callContainer({
path: obj.path,
method: obj.method || 'GET',
header: {
'X-WX-SERVICE': cloudConfig.service
},
data: obj.data || {}
})
return result.data
} catch (e) {
const error = String(e)
if (error.indexOf("Cloud API isn't enabled") !== -1 && number < 3) {
return new Promise((resolve) => {
setTimeout(() => {
resolve(this.call(obj, number + 1))
}, 300)
})
} else {
throw new Error(error)
}
}
},
onShow() {
console.log('小程序显示')
},
@@ -42,15 +79,23 @@ App<IAppOption>({
this.globalData.token = authInfo.token
this.globalData.userInfo = authInfo.userInfo
// 初始化词典等级
this.globalData.dictLevel = authInfo.dictLevel || 'PRIMARY'
this.globalData.dictLevel = authInfo.dictLevel || 'level1'
console.log('登录状态有效,自动登录')
} else {
console.log('Token 已过期,清理本地数据')
this.clearLoginData()
// 尝试重新登录(携带 referrerId
if (this.globalData.pendingReferrerId) {
apiManager.login(0, this.globalData.pendingReferrerId)
}
}
} else {
console.log('未找到登录信息')
this.globalData.isLoggedIn = false
// 尝试登录(携带 referrerId
if (this.globalData.pendingReferrerId) {
apiManager.login(0, this.globalData.pendingReferrerId)
}
}
} catch (error) {
console.error('初始化登录状态失败:', error)
@@ -65,7 +110,7 @@ App<IAppOption>({
this.globalData.token = loginData.access_token
this.globalData.userInfo = loginData.userInfo
// 更新词典等级
this.globalData.dictLevel = loginData.dict_level || 'PRIMARY'
this.globalData.dictLevel = loginData.dict_level || 'level1'
// 存储到本地
wx.setStorageSync('token', loginData.access_token)
@@ -113,4 +158,4 @@ App<IAppOption>({
console.error('清理登录数据失败:', error)
}
}
})
})

View File

@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"t-image": "tdesign-miniprogram/image/image",
"t-skeleton": "tdesign-miniprogram/skeleton/skeleton"
}
}

View File

@@ -0,0 +1,98 @@
import apiManager from '../../utils/api';
// Global memory cache for image URLs
const urlCache = new Map<string, string>();
// Track pending requests to avoid duplicate fetches for the same fileId
const pendingRequests = new Map<string, Promise<string>>();
Component({
virtualHost: true,
properties: {
fileId: {
type: String,
observer: 'loadUrl'
},
width: {
type: String,
value: '100%'
},
height: {
type: String,
value: '100%'
},
mode: {
type: String,
value: 'widthFix'
},
radius: {
type: String,
value: '0'
}
},
data: {
imageUrl: '',
isLoading: true,
isError: false
},
methods: {
async loadUrl(this: any, fileId: string) {
if (!fileId) {
this.setData({ imageUrl: '', isLoading: false });
return;
}
// Check cache first
if (urlCache.has(fileId)) {
this.setData({
imageUrl: urlCache.get(fileId),
isLoading: false,
isError: false
});
return;
}
this.setData({ isLoading: true, isError: false });
try {
let promise = pendingRequests.get(fileId);
if (!promise) {
promise = apiManager.getFileDisplayUrl(fileId);
pendingRequests.set(fileId, promise);
}
const url = await promise;
urlCache.set(fileId, url);
pendingRequests.delete(fileId);
// Ensure the fileId hasn't changed while we were fetching
if (this.data.fileId === fileId) {
console.log('[CloudImage] Loaded url for', fileId, url)
this.setData({
imageUrl: url,
isLoading: false
});
}
} catch (e) {
console.error('Failed to load image url for fileId:', fileId, e);
if (this.data.fileId === fileId) {
this.setData({
isLoading: false,
isError: true
});
}
pendingRequests.delete(fileId);
}
},
onLoad(this: any, e: any) {
this.triggerEvent('load', e);
},
onError(this: any, e: any) {
this.setData({ isError: true, isLoading: false });
this.triggerEvent('error', e);
}
}
});

View File

@@ -0,0 +1,24 @@
<view class="cloud-image" style="width: {{width}}; height: {{height}}; border-radius: {{radius}}; overflow: hidden; position: relative;">
<t-skeleton
wx:if="{{isLoading}}"
row-col="{{[{ width: '100%', height: '100%', borderRadius: radius }]}}"
loading
class="skeleton"
style="width: 100%; height: 100%; display: block;"
></t-skeleton>
<t-image
wx:if="{{!isLoading && imageUrl}}"
src="{{imageUrl}}"
mode="{{mode}}"
class="image"
t-class="image"
style="width: 100%; height: {{mode === 'widthFix' ? 'auto' : '100%'}}; display: block;"
bind:error="onError"
bind:load="onLoad"
/>
<view wx:if="{{isError}}" class="error-placeholder" style="width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: #f5f5f5; color: #999;">
<text style="font-size: 24rpx;">加载失败</text>
</view>
</view>

View File

@@ -0,0 +1,34 @@
:host {
display: block;
width: 100%;
height: 100%;
}
.cloud-image {
position: relative;
overflow: hidden;
width: 100%;
height: 100%;
}
.skeleton {
width: 100%;
height: 100%;
}
.image {
width: 100%;
height: 100%;
display: block;
}
.error-placeholder {
width: 100%;
height: 100%;
background-color: #f5f5f5;
display: flex;
align-items: center;
justify-content: center;
color: #ccc;
font-size: 24rpx;
}

View File

@@ -1,5 +1,7 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon"
}
}

View File

@@ -100,6 +100,11 @@ Component({
})
}
this.triggerEvent('back', { delta: data.delta }, {})
},
goProfile() {
wx.navigateTo({
url: '/pages/profile/profile'
})
}
},
})

View File

@@ -1,20 +1,12 @@
<view class="weui-navigation-bar {{extClass}}">
<view class="weui-navigation-bar__inner {{ios ? 'ios' : 'android'}}" style="color: {{color}}; background: {{background}}; {{displayStyle}}; {{innerPaddingRight}}; {{safeAreaTop}};">
<!-- 左侧按钮 -->
<view class='weui-navigation-bar__left' style="{{leftWidth}};">
<block wx:if="{{back || homeButton}}">
<!-- 返回上一页 -->
<block wx:if="{{back}}">
<view class="weui-navigation-bar__buttons weui-navigation-bar__buttons_goback">
<view
bindtap="back"
class="weui-navigation-bar__btn_goback_wrapper"
hover-class="weui-active"
hover-stay-time="100"
aria-role="button"
aria-label="返回"
>
<view bindtap="back" class="weui-navigation-bar__btn_goback_wrapper" hover-class="weui-active" hover-stay-time="100" aria-role="button" aria-label="返回">
<view class="weui-navigation-bar__button weui-navigation-bar__btn_goback"></view>
</view>
</view>
@@ -22,13 +14,7 @@
<!-- 返回首页 -->
<block wx:if="{{homeButton}}">
<view class="weui-navigation-bar__buttons weui-navigation-bar__buttons_home">
<view
bindtap="home"
class="weui-navigation-bar__btn_home_wrapper"
hover-class="weui-active"
aria-role="button"
aria-label="首页"
>
<view bindtap="home" class="weui-navigation-bar__btn_home_wrapper" hover-class="weui-active" aria-role="button" aria-label="首页">
<view class="weui-navigation-bar__button weui-navigation-bar__btn_home"></view>
</view>
</view>
@@ -38,15 +24,10 @@
<slot name="left"></slot>
</block>
</view>
<!-- 标题 -->
<view class='weui-navigation-bar__center'>
<view wx:if="{{loading}}" class="weui-navigation-bar__loading" aria-role="alert">
<view
class="weui-loading"
aria-role="img"
aria-label="加载中"
></view>
<view class="weui-loading" aria-role="img" aria-label="加载中"></view>
</view>
<block wx:if="{{title}}">
<text>{{title}}</text>
@@ -55,10 +36,9 @@
<slot name="center"></slot>
</block>
</view>
<!-- 右侧留空 -->
<view class='weui-navigation-bar__right'>
<slot name="right"></slot>
</view>
</view>
</view>
</view>

View File

@@ -14,7 +14,7 @@
}
.weui-navigation-bar__inner {
position: relative;
position: fixed;
top: 0;
left: 0;
height: calc(var(--height) + env(safe-area-inset-top));
@@ -32,7 +32,7 @@
padding-left: var(--left);
display: flex;
flex-direction: row;
align-items: flex-start;
align-items: center;
height: 100%;
box-sizing: border-box;
}

View File

@@ -0,0 +1,9 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-tag": "tdesign-miniprogram/tag/tag"
}
}

View File

@@ -0,0 +1,38 @@
Component({
properties: {
visible: { type: Boolean, value: false },
hasScoreInfo: { type: Boolean, value: false },
sentence: { type: Object, value: null },
totalScore: { type: Number, value: 0 },
accuracyScore: { type: Number, value: 0 },
completenessScore: { type: Number, value: 0 },
fluencyScore: { type: Number, value: 0 },
circleProgressStyle: { type: String, value: '' },
accuracyCircleStyle: { type: String, value: '' },
completenessCircleStyle: { type: String, value: '' },
fluencyCircleStyle: { type: String, value: '' },
wordScores: { type: Array, value: [] },
matchTagLegend: {
type: Array,
value: [
{ tag: 0, description: '匹配', color: '#ffffff' },
{ tag: 1, description: '新增', color: '#ffebee' },
{ tag: 2, description: '缺少', color: '#e3f2fd' },
{ tag: 3, description: '错读', color: '#fff3e0' },
{ tag: 4, description: '未录入', color: '#f5f5f5' }
]
},
playIconName: { type: String, value: 'sound-low' }
},
methods: {
noop() {},
onClose() {
const self = this as any
self.triggerEvent('close')
},
onPlay() {
const self = this as any
self.triggerEvent('play')
}
}
})

View File

@@ -0,0 +1,75 @@
<view wx:if="{{hasScoreInfo}}">
<view class="score-modal-content {{visible ? 'show' : ''}}">
<view class="score-modal-header">
<view class="score-modal-title"></view>
<t-icon name="close" class="score-modal-close" size="40rpx" bindtap="onClose" />
</view>
<scroll-view class="score-container" scroll-y="true">
<view class="score-image-container">
<t-icon wx:if="{{sentence && sentence.file_id}}" name="{{playIconName}}" class="score-modal-play" size="60rpx" bindtap="onPlay"></t-icon>
<view class="score-text">{{sentence.content}}</view>
</view>
<view class="score-overview">
<view class="score-circles">
<view class="circle-item">
<view class="circle-progress" style="{{circleProgressStyle}}">
<text class="total-score-value">{{totalScore}}</text>
<text class="total-score-label">总分</text>
</view>
</view>
<view class="circle-item">
<view class="circle-progress" style="{{accuracyCircleStyle}}">
<text class="total-score-value">{{accuracyScore}}</text>
<text class="total-score-label">准确性</text>
</view>
</view>
<view class="circle-item">
<view class="circle-progress" style="{{completenessCircleStyle}}">
<text class="total-score-value">{{completenessScore}}</text>
<text class="total-score-label">完整性</text>
</view>
</view>
<view class="circle-item">
<view class="circle-progress" style="{{fluencyCircleStyle}}">
<text class="total-score-value">{{fluencyScore}}</text>
<text class="total-score-label">流利度</text>
</view>
</view>
</view>
</view>
<view class="match-tag-legend">
<view class="legend-header">
<view class="legend-items">
<view class="legend-item" wx:for="{{matchTagLegend}}" wx:key="tag">
<view class="color-box" style="background-color: {{item.color}}"></view>
<text class="legend-text">{{item.description}}</text>
</view>
</view>
</view>
</view>
<view class="word-scores-list">
<view class="word-score-item" wx:for="{{wordScores}}" wx:key="word" style="background-color: {{matchTagLegend[item.matchTag || 0].color}}">
<view class="word-header">
<text class="word-text">{{item.word}}</text>
<view class="word-score-details">
<view class="word-score-row">
<text class="word-score-label">准确性</text>
<text class="word-score-value">{{item.pronAccuracy}}</text>
</view>
<view class="word-score-row">
<text class="word-score-label">流利度</text>
<text class="word-score-value">{{item.pronFluency}}</text>
</view>
</view>
</view>
<view class="phone-infos" wx:if="{{item.phoneInfos && item.phoneInfos.length > 0}}">
<view class="phone-info-item" wx:for="{{item.phoneInfos}}" wx:for-item="phoneInfo" wx:key="phone" style="background-color: {{matchTagLegend[phoneInfo.matchTag || 0].color}}">
<text class="phone-text">[{{phoneInfo.phone}}]</text>
<text class="phone-score">{{phoneInfo.pronAccuracy}}</text>
</view>
</view>
</view>
</view>
</scroll-view>
</view>
</view>

View File

@@ -0,0 +1,52 @@
.score-modal-content {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #f8fafc;
z-index: 999;
padding: 0 12rpx;
transform: translateY(100%);
transition: transform 0ms ease-out;
}
.score-modal-content.show { transform: translateY(0); }
.score-modal-header {
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
height: 48rpx;
}
.score-modal-title { display: flex; align-items: center; gap: 16rpx; }
.score-modal-close { position: absolute; top: 12rpx; right: 12rpx; color: #666; }
.score-container { height: 100vh; }
.score-image-container { display: flex; align-items: center; padding: 0 0 0 12rpx; min-height: 120rpx; }
.score-text { flex: 1; font-size: 30rpx; line-height: 42rpx; color: #001858; font-weight: 600; word-break: break-word; text-transform: capitalize;}
.score-modal-play { flex-shrink: 0; margin-right: 20rpx; }
.score-overview {}
.score-circles { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 24rpx; }
.circle-item { display: flex; justify-content: center; background-color: #eee; border-radius: 50%; }
.circle-progress { width: 120rpx; height: 120rpx; border-radius: 50%; background: #f7f7f7; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; }
.circle-progress::before { content: ''; position: absolute; width: 100rpx; height: 100rpx; top: 10rpx; left: 10rpx; border-radius: 50%; background: #ffffff; }
.total-score-value { font-size: 28rpx; color: #001858; font-weight: 600; position: relative; z-index: 1; line-height: 28rpx; }
.total-score-label { font-size: 20rpx; color: #666666; position: relative; z-index: 1; margin-top: 8rpx; line-height: 20rpx; }
.match-tag-legend { padding: 24rpx; }
.legend-header { display: flex; align-items: center; gap: 16rpx; }
.legend-items { display: flex; flex-wrap: wrap; gap: 16rpx; }
.legend-item { display: flex; align-items: center; gap: 8rpx; }
.color-box { width: 20rpx; height: 20rpx; border: 1rpx solid #e0e0e0; border-radius: 4rpx; }
.legend-text { font-size: 22rpx; color: #666; }
.word-scores-list { display: flex; flex-direction: column; overflow-y: auto; border-radius: 24rpx; padding-bottom: calc(20px + env(safe-area-inset-bottom));}
.word-score-item { display: flex; flex-direction: column; gap: 12rpx; padding: 20rpx; border-bottom: 2rpx solid #eee; }
.word-score-item:last-child { border-bottom: none; }
.word-header { display: flex; justify-content: space-between; align-items: center; }
.phone-infos { display: flex; flex-wrap: wrap; gap: 8rpx; }
.phone-info-item { display: flex; align-items: center; gap: 8rpx; padding: 6rpx 10rpx; border-radius: 8rpx; border: 1rpx solid rgba(0,0,0,0.06); }
.phone-text { font-size: 24rpx; line-height: 24rpx; color: #333; }
.phone-score { font-size: 24rpx; line-height: 24rpx; color: #666; }
.word-text { font-size: 28rpx; color: #333; font-weight: 500; }
.word-score-details { display: flex; gap: 24rpx; }
.word-score-row { display: flex; align-items: center; gap: 8rpx; justify-content: flex-end; }
.word-score-label { font-size: 22rpx; color: #666; }
.word-score-value { font-size: 22rpx; color: #333; font-weight: 500; text-align: right; }

View File

@@ -0,0 +1,448 @@
// canvas-confetti.js - 微信小程序兼容版本
// 基于 https://github.com/catdad/canvas-confetti
Component({
properties: {
width: {
type: Number,
value: 300
},
height: {
type: Number,
value: 300
},
id: {
type: String,
value: 'confettiCanvas'
}
},
data: {
canvasId: '',
isCanvasReady: false,
canvasInitPromise: null,
animationFrameId: null,
animatingFettis: [],
defaults: {
particleCount: 50,
angle: 90,
spread: 45,
startVelocity: 45,
decay: 0.9,
gravity: 1,
drift: 0,
ticks: 200,
x: 0.5,
y: 0.5,
shapes: ['square', 'circle'],
colors: [
'#26ccff',
'#a25afd',
'#ff5e7e',
'#88ff5a',
'#fcff42',
'#ffa62d',
'#ff36ff'
],
scalar: 1,
flat: false
}
},
lifetimes: {
attached() {
this.setData({
canvasId: this.properties.id
});
// 创建初始化Promise
this.data.canvasInitPromise = new Promise((resolve) => {
this._canvasReadyResolver = resolve;
});
},
ready() {
// 在组件准备好后初始化canvas
this.initCanvas();
},
detached() {
this.reset();
}
},
methods: {
initCanvas() {
const query = this.createSelectorQuery();
query.select(`#${this.data.canvasId}`)
.fields({ node: true, size: true })
.exec((res) => {
if (res && res[0]) {
const canvas = res[0].node;
const ctx = canvas.getContext('2d');
// 设置canvas大小
canvas.width = this.properties.width;
canvas.height = this.properties.height;
// 优化真机显示 - 考虑设备像素比
try {
const deviceInfo = wx.getDeviceInfo();
const dpr = deviceInfo.pixelRatio || 1;
canvas.width = this.properties.width * dpr;
canvas.height = this.properties.height * dpr;
ctx.scale(dpr, dpr);
} catch (e) {
console.error('设置DPR失败', e);
}
this.canvas = canvas;
this.ctx = ctx;
// 标记canvas已准备好
this.setData({ isCanvasReady: true });
// 解析初始化Promise
if (this._canvasReadyResolver) {
this._canvasReadyResolver();
}
console.log('Canvas 已初始化完成', this.canvas.width, this.canvas.height);
} else {
console.error('Canvas 节点未找到', this.data.canvasId);
// 如果找不到canvas200ms后重试
setTimeout(() => {
this.initCanvas();
}, 200);
}
});
},
// 等待canvas初始化完成
async waitForCanvasReady() {
if (this.data.isCanvasReady && this.canvas && this.ctx) {
return true;
}
try {
await this.data.canvasInitPromise;
return true;
} catch (err) {
console.error('Canvas 初始化失败', err);
return false;
}
},
// 核心方法,触发五彩纸屑效果
async fire(options = {}) {
// 等待canvas初始化完成
const isReady = await this.waitForCanvasReady();
if (!isReady || !this.canvas || !this.ctx) {
console.error('Canvas 未初始化');
return Promise.reject('Canvas 未初始化');
}
return this.fireConfetti(options);
},
// 重置,停止当前动画
reset() {
this.cancelAnimation();
if (this.ctx && this.canvas) {
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
}
this.setData({
animatingFettis: []
});
},
// 取消动画帧
cancelAnimation() {
if (this.data.animationFrameId) {
if (wx.canIUse('cancelAnimationFrame')) {
cancelAnimationFrame(this.data.animationFrameId);
} else {
clearTimeout(this.data.animationFrameId);
}
this.setData({
animationFrameId: null
});
}
},
// 请求动画帧
requestFrame(callback) {
if (wx.canIUse('requestAnimationFrame')) {
return requestAnimationFrame(callback);
} else {
return setTimeout(callback, 1000 / 60);
}
},
// 转换属性
convert(val, transform) {
return transform ? transform(val) : val;
},
// 检查值是否有效
isOk(val) {
return !(val === null || val === undefined);
},
// 获取配置属性
prop(options, name, transform) {
return this.convert(
options && this.isOk(options[name]) ? options[name] : this.data.defaults[name],
transform
);
},
// 将十六进制颜色转为RGB
hexToRgb(str) {
const val = String(str).replace(/[^0-9a-f]/gi, '');
const hex = val.length < 6
? val[0] + val[0] + val[1] + val[1] + val[2] + val[2]
: val;
return {
r: parseInt(hex.substring(0, 2), 16),
g: parseInt(hex.substring(2, 4), 16),
b: parseInt(hex.substring(4, 6), 16)
};
},
// 颜色数组转RGB
colorsToRgb(colors) {
return colors.map(color => this.hexToRgb(color));
},
// 只接受正整数
onlyPositiveInt(number) {
return number < 0 ? 0 : Math.floor(number);
},
// 生成随机整数
randomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
},
// 获取原点配置
getOrigin(options) {
const origin = this.prop(options, 'origin', Object) || {};
origin.x = this.isOk(origin.x) ? origin.x : this.data.defaults.x;
origin.y = this.isOk(origin.y) ? origin.y : this.data.defaults.y;
return origin;
},
// 创建随机物理属性
randomPhysics(opts) {
const radAngle = opts.angle * (Math.PI / 180);
const radSpread = opts.spread * (Math.PI / 180);
return {
x: opts.x,
y: opts.y,
wobble: Math.random() * 10,
wobbleSpeed: Math.min(0.11, Math.random() * 0.1 + 0.05),
velocity: (opts.startVelocity * 0.5) + (Math.random() * opts.startVelocity),
angle2D: -radAngle + ((0.5 * radSpread) - (Math.random() * radSpread)),
tiltAngle: (Math.random() * (0.75 - 0.25) + 0.25) * Math.PI,
color: opts.color,
shape: opts.shape,
tick: 0,
totalTicks: opts.ticks,
decay: opts.decay,
drift: opts.drift,
random: Math.random() + 2,
tiltSin: 0,
tiltCos: 0,
wobbleX: 0,
wobbleY: 0,
gravity: opts.gravity * 3,
ovalScalar: 0.6,
scalar: opts.scalar,
flat: opts.flat
};
},
// 微信小程序不支持Path2D和标准的ellipse创建一个ellipse方法
ellipse(context, x, y, radiusX, radiusY, rotation, startAngle, endAngle) {
context.save();
context.translate(x, y);
context.rotate(rotation);
context.scale(radiusX, radiusY);
context.arc(0, 0, 1, startAngle, endAngle, false);
context.restore();
},
// 更新单个五彩纸屑
updateFetti(context, fetti) {
fetti.x += Math.cos(fetti.angle2D) * fetti.velocity + fetti.drift;
fetti.y += Math.sin(fetti.angle2D) * fetti.velocity + fetti.gravity;
fetti.velocity *= fetti.decay;
if (fetti.flat) {
fetti.wobble = 0;
fetti.wobbleX = fetti.x + (10 * fetti.scalar);
fetti.wobbleY = fetti.y + (10 * fetti.scalar);
fetti.tiltSin = 0;
fetti.tiltCos = 0;
fetti.random = 1;
} else {
fetti.wobble += fetti.wobbleSpeed;
fetti.wobbleX = fetti.x + ((10 * fetti.scalar) * Math.cos(fetti.wobble));
fetti.wobbleY = fetti.y + ((10 * fetti.scalar) * Math.sin(fetti.wobble));
fetti.tiltAngle += 0.1;
fetti.tiltSin = Math.sin(fetti.tiltAngle);
fetti.tiltCos = Math.cos(fetti.tiltAngle);
fetti.random = Math.random() + 2;
}
const progress = (fetti.tick++) / fetti.totalTicks;
const x1 = fetti.x + (fetti.random * fetti.tiltCos);
const y1 = fetti.y + (fetti.random * fetti.tiltSin);
const x2 = fetti.wobbleX + (fetti.random * fetti.tiltCos);
const y2 = fetti.wobbleY + (fetti.random * fetti.tiltSin);
context.fillStyle = `rgba(${fetti.color.r}, ${fetti.color.g}, ${fetti.color.b}, ${1 - progress})`;
context.beginPath();
if (fetti.shape === 'circle') {
this.ellipse(
context,
fetti.x,
fetti.y,
Math.abs(x2 - x1) * fetti.ovalScalar,
Math.abs(y2 - y1) * fetti.ovalScalar,
Math.PI / 10 * fetti.wobble,
0,
2 * Math.PI
);
} else if (fetti.shape === 'star') {
let rot = Math.PI / 2 * 3;
const innerRadius = 4 * fetti.scalar;
const outerRadius = 8 * fetti.scalar;
const x = fetti.x;
const y = fetti.y;
let spikes = 5;
const step = Math.PI / spikes;
while (spikes--) {
let xTemp = x + Math.cos(rot) * outerRadius;
let yTemp = y + Math.sin(rot) * outerRadius;
context.lineTo(xTemp, yTemp);
rot += step;
xTemp = x + Math.cos(rot) * innerRadius;
yTemp = y + Math.sin(rot) * innerRadius;
context.lineTo(xTemp, yTemp);
rot += step;
}
} else {
// square (default)
context.moveTo(Math.floor(fetti.x), Math.floor(fetti.y));
context.lineTo(Math.floor(fetti.wobbleX), Math.floor(y1));
context.lineTo(Math.floor(x2), Math.floor(y2));
context.lineTo(Math.floor(x1), Math.floor(fetti.wobbleY));
}
context.closePath();
context.fill();
return fetti.tick < fetti.totalTicks;
},
// 动画函数
animate(fettis) {
const animatingFettis = [...fettis];
const context = this.ctx;
const canvas = this.canvas;
const update = () => {
context.clearRect(0, 0, canvas.width, canvas.height);
const stillAlive = [];
for (let i = 0; i < animatingFettis.length; i++) {
if (this.updateFetti(context, animatingFettis[i])) {
stillAlive.push(animatingFettis[i]);
}
}
if (stillAlive.length) {
this.setData({
animatingFettis: stillAlive,
animationFrameId: this.requestFrame(() => update())
});
} else {
this.setData({
animatingFettis: [],
animationFrameId: null
});
}
};
this.setData({
animationFrameId: this.requestFrame(() => update())
});
},
// 发射五彩纸屑
fireConfetti(options) {
return new Promise((resolve) => {
const particleCount = this.prop(options, 'particleCount', this.onlyPositiveInt.bind(this));
const angle = this.prop(options, 'angle', Number);
const spread = this.prop(options, 'spread', Number);
const startVelocity = this.prop(options, 'startVelocity', Number);
const decay = this.prop(options, 'decay', Number);
const gravity = this.prop(options, 'gravity', Number);
const drift = this.prop(options, 'drift', Number);
const colors = this.prop(options, 'colors', this.colorsToRgb.bind(this));
const ticks = this.prop(options, 'ticks', Number);
const shapes = this.prop(options, 'shapes');
const scalar = this.prop(options, 'scalar');
const flat = !!this.prop(options, 'flat');
const origin = this.getOrigin(options);
let temp = particleCount;
const fettis = [];
const startX = this.canvas.width * origin.x;
const startY = this.canvas.height * origin.y;
while (temp--) {
fettis.push(
this.randomPhysics({
x: startX,
y: startY,
angle: angle,
spread: spread,
startVelocity: startVelocity,
color: colors[temp % colors.length],
shape: shapes[this.randomInt(0, shapes.length)],
ticks: ticks,
decay: decay,
gravity: gravity,
drift: drift,
scalar: scalar,
flat: flat
})
);
}
// 合并已有和新的五彩纸屑
const allFettis = [...this.data.animatingFettis, ...fettis];
this.setData({
animatingFettis: allFettis
}, () => {
// 如果已经有动画在运行,不需要再次启动
if (!this.data.animationFrameId) {
this.animate(allFettis);
}
resolve();
});
});
}
}
});

View File

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

View File

@@ -0,0 +1 @@
<canvas type="2d" id="{{canvasId}}" style="width: {{width}}px; height: {{height}}px;"></canvas>

View File

@@ -0,0 +1,12 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {
"t-icon": "tdesign-miniprogram/icon/icon",
"t-tag": "tdesign-miniprogram/tag/tag",
"t-cell": "tdesign-miniprogram/cell/cell",
"t-tabs": "tdesign-miniprogram/tabs/tabs",
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel",
"t-skeleton": "tdesign-miniprogram/skeleton/skeleton"
}
}

View File

@@ -0,0 +1,225 @@
import apiManager from '../../utils/api'
Component({
properties: {
visible: { type: Boolean, value: false },
expanded: { type: Boolean, value: false },
loading: { type: Boolean, value: false },
wordDict: { type: Object, value: {} },
showBackIcon: { type: Boolean, value: false },
prototypeWord: { type: String, value: '' },
forceHidePrototype: { type: Boolean, value: false },
isWordEmptyResult: { type: Boolean, value: false },
dictDefaultTabValue: { type: String, value: '0' },
activeWordAudioType: { type: String, value: '' },
wordAudioPlaying: { type: Boolean, value: false },
wordAudioIconName: { type: String, value: 'sound' }
},
methods: {
async queryWord(word: string) {
const self = this as any
const raw = String(word || '')
const cleaned = raw.replace(/[.,?!*;:'"()]/g, '').trim()
if (!cleaned) return
// Clear previous word data before showing loading state
self.setData({
visible: true,
loading: true,
wordDict: {},
prototypeWord: '',
isWordEmptyResult: false
})
try {
const detail: any = await apiManager.getWordDetail(cleaned)
const collins = detail['collins']
let processedCollins = collins
if (collins && collins.collins_entries) {
const cloned = JSON.parse(JSON.stringify(collins))
cloned.collins_entries.forEach((entry: any) => {
if (entry.entries && entry.entries.entry) {
entry.entries.entry.forEach((entryItem: any) => {
if (entryItem.tran_entry) {
entryItem.tran_entry.forEach((tranEntry: any) => {
if (tranEntry.tran) {
const parts = tranEntry.tran.split(/(<b>.*?<\/b>)/g).filter(Boolean)
const processed: Array<{ text: string; bold: boolean }> = []
parts.forEach((part: string) => {
if (part.startsWith('<b>') && part.endsWith('</b>')) {
const text = part.substring(3, part.length - 4)
processed.push({ text, bold: true })
} else {
processed.push({ text: part, bold: false })
}
})
tranEntry.tranParts = processed
tranEntry.originalTran = tranEntry.tran
}
})
}
})
}
})
processedCollins = cloned
}
const rawRelWord = detail['rel_word']
let sanitizedRelWord = rawRelWord
if (rawRelWord && rawRelWord.rels && Array.isArray(rawRelWord.rels)) {
sanitizedRelWord = {
...rawRelWord,
rels: rawRelWord.rels.map((entry: any) => {
const rel = entry.rel || {}
const pos = rel.pos
const cleanPos = typeof pos === 'string' ? pos.replace(/\[|\]/g, '') : pos
return { ...entry, rel: { ...rel, pos: cleanPos } }
})
}
}
const hasEE = !!detail['ee']
const hasEC = !!(detail['ec'] && detail['ec'].word && detail['ec'].word.length > 0)
const hasCollins = !!(processedCollins && processedCollins.collins_entries && processedCollins.collins_entries.length > 0)
const isEmpty = !(hasEE || hasEC || hasCollins)
const hasPhrs = !!(detail['phrs'] && detail['phrs'].phrs && detail['phrs'].phrs.length > 0)
const hasPastExam = !!(detail['individual'] && detail['individual'].pastExamSents && detail['individual'].pastExamSents.length > 0)
const defaultTab = hasCollins ? '0' : (hasPhrs ? '1' : (hasPastExam ? '2' : '3'))
const protoTemp = detail.ee?.word?.['return-phrase']?.['l']?.['i'] || ''
const proto = protoTemp != '' && protoTemp.toLowerCase() != word.toLowerCase() ? protoTemp : (detail?.ec?.word?.[0]?.prototype || '')
const hideProto = !!self.data.forceHidePrototype
self.setData({
wordDict: {
ee: detail['ee'], ec: detail['ec'], expandEc: detail['expand_ec'],
simple: detail['simple'], phrs: detail['phrs'], etym: detail['etym'],
individual: detail['individual'], collins: processedCollins,
relWord: sanitizedRelWord, syno: detail['syno'],
discriminate: detail['discriminate']
},
dictDefaultTabValue: defaultTab,
isWordEmptyResult: isEmpty,
prototypeWord: hideProto ? '' : proto,
loading: false,
visible: true
})
} catch (err) {
self.setData({ loading: false })
self.triggerEvent('error', { message: 'queryFailed' })
}
},
onClose() {
const self = this as any
try { self.wordAudioContext && self.wordAudioContext.stop() } catch (e) {}
try {
if (self.wordAudioContext) {
self.wordAudioContext.offPlay()
self.wordAudioContext.offEnded()
self.wordAudioContext.offError()
self.wordAudioContext.destroy()
self.wordAudioContext = undefined
}
} catch (e) {}
if (self.wordAudioIconTimer) {
clearInterval(self.wordAudioIconTimer)
self.wordAudioIconTimer = undefined
}
self.setData({ wordAudioPlaying: false, wordAudioIconName: 'sound', activeWordAudioType: '' })
self.triggerEvent('close')
},
onMore() {
const self = this as any
self.triggerEvent('more')
},
onTabsChange(e: any) {
const self = this as any
self.triggerEvent('tabsChange', { value: e?.detail?.value })
},
onTabsClick(e: any) {
const self = this as any
self.triggerEvent('tabsClick', { value: e?.detail?.value })
},
onPlayWordAudio(e: any) {
const dataset = e?.currentTarget?.dataset || {}
const type = dataset.type
const audio = dataset.audio
const self = this as any
if (!audio) return
if (self.data.wordAudioPlaying && self.data.activeWordAudioType === type) {
try { self.wordAudioContext && self.wordAudioContext.stop() } catch (err) {}
try {
if (self.wordAudioContext) {
self.wordAudioContext.offPlay()
self.wordAudioContext.offEnded()
self.wordAudioContext.offError()
self.wordAudioContext.destroy()
self.wordAudioContext = undefined
}
} catch (err) {}
if (self.wordAudioIconTimer) {
clearInterval(self.wordAudioIconTimer)
self.wordAudioIconTimer = undefined
}
self.setData({ wordAudioPlaying: false, wordAudioIconName: 'sound', activeWordAudioType: '' })
return
}
try { self.wordAudioContext && self.wordAudioContext.stop() } catch (err) {}
try {
if (self.wordAudioContext) {
self.wordAudioContext.offPlay()
self.wordAudioContext.offEnded()
self.wordAudioContext.offError()
self.wordAudioContext.destroy()
self.wordAudioContext = undefined
}
} catch (err) {}
if (self.wordAudioIconTimer) {
clearInterval(self.wordAudioIconTimer)
self.wordAudioIconTimer = undefined
}
const audioUrl = `https://dict.youdao.com/dictvoice?audio=${audio}`
self.wordAudioContext = wx.createInnerAudioContext()
try { (self.wordAudioContext as any).autoplay = false } catch (err) {}
self.wordAudioContext.onPlay(() => {
const seq = ['sound', 'sound-low']
let i = 0
self.setData({ wordAudioPlaying: true, activeWordAudioType: type, wordAudioIconName: seq[0] })
self.wordAudioIconTimer = setInterval(() => {
i = (i + 1) % seq.length
self.setData({ wordAudioIconName: seq[i] })
}, 400) as any
})
const finalize = () => {
if (self.wordAudioIconTimer) {
clearInterval(self.wordAudioIconTimer)
self.wordAudioIconTimer = undefined
}
self.setData({ wordAudioPlaying: false, wordAudioIconName: 'sound', activeWordAudioType: '' })
try {
if (self.wordAudioContext) {
self.wordAudioContext.offPlay()
self.wordAudioContext.offEnded()
self.wordAudioContext.offError()
self.wordAudioContext.destroy()
self.wordAudioContext = undefined
}
} catch (err) {}
}
self.wordAudioContext.onEnded(() => { finalize() })
self.wordAudioContext.onError(() => {
wx.showToast({ title: '播放失败', icon: 'none' })
finalize()
})
self.wordAudioContext.src = audioUrl
self.wordAudioContext.play()
},
onBack() {
const self = this as any
self.triggerEvent('back')
},
onWordTap(e: any) {
const self = this as any
const dsWord = e && e.currentTarget && e.currentTarget.dataset ? e.currentTarget.dataset.word : ''
const propWord = (self.data && self.data.prototypeWord) ? self.data.prototypeWord : ''
const word = dsWord || propWord || ''
if (!word) return
const prev = (self.data && self.data.wordDict && self.data.wordDict.simple && self.data.wordDict.simple.query) ? self.data.wordDict.simple.query : ''
self.triggerEvent('wordTap', { word, previousWord: prev })
}
}
})

View File

@@ -0,0 +1,136 @@
<view class="word-popup {{expanded ? 'expanded' : ''}}" wx:if="{{visible}}">
<view class="popup-header">
<view class="frequency-tags">
<t-tag wx:if="{{wordDict.ec.exam_type && wordDict.ec.exam_type.length > 0}}" wx:for="{{wordDict.ec.exam_type}}" wx:key="index" variant="light" theme="success">
{{item}}
</t-tag>
</view>
<view class="close-btn" bindtap="onClose">
<t-icon name="close" size="36rpx" />
</view>
</view>
<t-skeleton wx:if="{{loading}}" theme="paragraph" animation="gradient" loading="{{true}}"></t-skeleton>
<view wx:if="{{!loading}}" class="popup-header">
<view wx:if="{{wordDict.simple.query}}" class="word-title">
<t-icon wx:if="{{showBackIcon}}" name="chevron-left" size="40rpx" bindtap="onBack"></t-icon>
{{wordDict.simple.query}}
</view>
<view class="word-source" wx:if="{{prototypeWord && prototypeWord !== ''}}">词源: <t-tag variant="light" theme="primary" data-word="{{prototypeWord}}" bindtap="onWordTap">{{prototypeWord}}</t-tag></view>
<view class="more-btn" wx:if="{{!isWordEmptyResult}}" bindtap="onMore">
<text wx:if="{{!expanded}}">More</text>
<t-icon wx:if="{{!expanded}}" name="chevron-up" size="48rpx"></t-icon>
</view>
</view>
<view class="pronounce" wx:if="{{!loading}}">
<view class="pron-item" wx:if="{{wordDict.simple && wordDict.simple.word && wordDict.simple.word.length > 0}}">
<span class="pron-item-text" wx:if="{{wordDict.simple.word[0].ukphone}}">
UK:[{{wordDict.simple.word[0].ukphone}}]
</span>
<t-icon class="ipa-audio" wx:if="{{wordDict.simple.word[0].ukspeech}}" bind:tap="onPlayWordAudio" data-type="uk" data-audio="{{wordDict.simple.word[0].ukspeech}}" name="{{(activeWordAudioType === 'uk' && wordAudioPlaying) ? wordAudioIconName : 'sound'}}" size="30rpx" />
</view>
<view class="pron-item" wx:if="{{wordDict.simple && wordDict.simple.word && wordDict.simple.word.length > 0}}">
<span class="pron-item-text" wx:if="{{wordDict.simple.word[0].usphone}}">
US:[{{wordDict.simple.word[0].usphone}}]
</span>
<t-icon class="ipa-audio" wx:if="{{wordDict.simple.word[0].usspeech}}" bind:tap="onPlayWordAudio" data-type="us" data-audio="{{wordDict.simple.word[0].usspeech}}" name="{{(activeWordAudioType === 'us' && wordAudioPlaying) ? wordAudioIconName : 'sound'}}" size="30rpx" />
</view>
</view>
<view wx:if="{{!loading}}" class="word-meanings">
<block wx:if="{{wordDict.ec && wordDict.ec.word && wordDict.ec.word.length > 0}}">
<block wx:for="{{wordDict.ec.word[0].trs}}" wx:key="index">
<block wx:for="{{item.tr}}" wx:key="index">
<block wx:for="{{item.l.i}}" wx:key="index">
<text>{{item}}</text>
</block>
</block>
</block>
</block>
</view>
<t-tabs class="t-tabs" animation="{{ { duration: 0.1 } }}" defaultValue="{{dictDefaultTabValue}}" bind:change="onTabsChange" bind:click="onTabsClick" wx:if="{{expanded}}">
<t-tab-panel label="使用" value="0" wx:if="{{wordDict.collins && wordDict.collins.collins_entries && wordDict.collins.collins_entries.length > 0 && wordDict.collins.collins_entries[0].entries && wordDict.collins.collins_entries[0].entries.entry}}">
<view class="dictionary">
<block wx:for="{{wordDict.collins.collins_entries[0].entries.entry}}" wx:key="index">
<block wx:if="{{item.tran_entry && item.tran_entry.length > 0}}">
<view class="dictionary-content" wx:for="{{item.tran_entry}}" wx:key="tindex">
<view class="dictionary-pos" wx:if="{{item.pos_entry && item.pos_entry.pos && item.pos_entry.pos_tips}}">
<t-tag variant="light" theme="primary">
{{item.pos_entry.pos}} {{item.pos_entry.pos_tips}}
</t-tag>
</view>
<view class="dictionary-tran" wx:if="{{item.tranParts && item.tranParts.length > 0}}">
<block wx:for="{{item.tranParts}}" wx:key="pindex">
<text wx:if="{{!item.bold}}" class="normal-text">{{item.text}}</text>
<text wx:if="{{item.bold}}" class="dictionary-tran-bold">{{item.text}}</text>
</block>
</view>
<view class="dictionary-tran" wx:elif="{{item.tran}}">{{item.tran}}</view>
<view class="dictionary-list" wx:if="{{item.exam_sents && item.exam_sents.sent && item.exam_sents.sent.length > 0}}">
<block wx:for="{{item.exam_sents.sent}}" wx:key="index">
<view class="word-sent-en" wx:if="{{item.eng_sent}}">{{item.eng_sent}}</view>
<view class="word-sent-zh" wx:if="{{item.chn_sent}}">{{item.chn_sent}}</view>
</block>
</view>
</view>
</block>
</block>
</view>
</t-tab-panel>
<t-tab-panel wx:if="{{wordDict.phrs && wordDict.phrs.phrs && wordDict.phrs.phrs.length > 0}}" label="短语" value="1">
<block wx:for="{{wordDict.phrs.phrs}}" wx:key="index">
<t-cell title="{{item.phr.headword.l.i}}" description="{{item.phr.trs[0].tr.l.i}}" />
</block>
</t-tab-panel>
<t-tab-panel wx:if="{{wordDict.individual && wordDict.individual.pastExamSents && wordDict.individual.pastExamSents.length > 0}}" label="真题" value="2">
<view wx:for="{{wordDict.individual.pastExamSents}}" wx:key="index" class="exam-sent">
<view class="exam-sent-en">{{item.en}}</view>
<view class="exam-sent-zh">{{item.zh}}</view>
<view class="exam-sent-source">--摘自《{{item.source}}》</view>
</view>
</t-tab-panel>
<t-tab-panel wx:if="{{wordDict.relWord && wordDict.relWord.rels && wordDict.relWord.rels.length > 0}}" label="相关" value="3">
<view wx:if="{{(wordDict.syno && wordDict.syno.synos && wordDict.syno.synos.length > 0) || (wordDict.relWord && wordDict.relWord.rels && wordDict.relWord.rels.length > 0) || (wordDict.discriminate && wordDict.discriminate.data && wordDict.discriminate.data.length > 0)}}">
<view class="syno" wx:if="{{wordDict.syno && wordDict.syno.synos && wordDict.syno.synos.length > 0}}">
<view class="syno-title">同义词</view>
<view class="syno-list" wx:for="{{wordDict.syno.synos}}" wx:key="index">
<view class="syno-pos">
<t-tag wx:if="{{item.syno.pos}}" variant="light" theme="primary">
{{item.syno.pos}}
</t-tag>
<view class="syno-tran">{{item.syno.tran}}</view>
</view>
<t-tag class="syno-item" wx:for="{{item.syno.ws}}" wx:key="w" variant="light">
{{item.w}}
</t-tag>
</view>
</view>
<view class="rel-word" wx:if="{{wordDict.relWord && wordDict.relWord.rels && wordDict.relWord.rels.length > 0}}">
<view class="rel-word-title">相关单词</view>
<view class="rel-word-list" wx:for="{{wordDict.relWord.rels}}" wx:key="index">
<view class="rel-word-pos">
<t-tag wx:if="{{item.rel.pos}}" variant="light" theme="primary">
{{item.rel.pos}}
</t-tag>
</view>
<view class="rel-word-item" wx:for="{{item.rel.words}}" wx:key="word">
<view class="rel-word-tran">{{item.tran}}</view>
<view class="rel-word-word">{{item.word}}</view>
</view>
</view>
</view>
<view class="discriminate" wx:if="{{wordDict.discriminate && wordDict.discriminate.data && wordDict.discriminate.data.length > 0}}">
<view class="discriminate-title">区分单词</view>
<view class="discriminate-list" wx:for="{{wordDict.discriminate.data}}" wx:key="index">
<view class="discriminate-item" wx:for="{{item.usages}}" wx:key="headword">
<view class="discriminate-tran">{{item.usage}}</view>
<view class="discriminate-headword">{{item.headword}}</view>
</view>
</view>
</view>
</view>
<view wx:else class="no-related-words">
<text class="no-related-words-text">暂无相关单词信息</text>
</view>
</t-tab-panel>
</t-tabs>
<view class="no-word" wx:if="{{isWordEmptyResult}}">没有更多内容</view>
</view>

View File

@@ -0,0 +1,197 @@
.word-popup {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: #fff;
border-top-left-radius: 12rpx;
border-top-right-radius: 12rpx;
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.1);
padding: 0 20rpx;
box-sizing: border-box;
transition: all 0.3s ease;
z-index: 100;
overflow-y: scroll;
min-height: 600rpx;
}
.word-popup.expanded {
height: 100vh;
border-top-left-radius: 0rpx;
border-top-right-radius: 0rpx;
}
.popup-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-top: 20rpx;
position: relative;
}
.word-title {
display: flex;
align-items: center;
font-size: 40rpx;
font-weight: bold;
}
.word-source {
font-size: 24rpx;
}
.frequency-tags {
flex: 1;
display: flex;
flex-wrap: wrap;
gap: 12rpx;
min-height: 48rpx;
}
.close-btn {
flex-shrink: 0;
margin-left: 20rpx;
}
.more-btn {
display: flex;
font-size: 30rpx;
}
.pronounce {
display: flex;
align-items: center;
flex-wrap: wrap;
margin-bottom: 20rpx;
}
.pron-item {
display: flex;
align-items: center;
margin-right: 20rpx;
font-size: 24rpx;
line-height: 30rpx;
}
.pron-item-text {
padding-right: 8rpx;
}
.word-meanings {
display: flex;
flex-direction: column;
margin-bottom: 20rpx;
font-size: 24rpx;
}
.dictionary {
padding: 20rpx 0;
}
.dictionary-content {
margin-bottom: 20rpx;
font-size: 28rpx;
border-bottom: 1rpx solid #f5f5f5;
}
.dictionary-pos {
display: inline;
color: #33272a;
}
.dictionary-tran {
display: inline;
padding-left: 16rpx;
vertical-align: middle;
}
.dictionary-tran-bold {
font-weight: bold;
}
.dictionary-list {
padding: 16rpx 0;
margin-left: 16rpx;
}
.exam-sent {
padding: 10rpx 0;
border-bottom: 1rpx solid #e0e0e0;
}
.exam-sent-en {
font-size: 32rpx;
color: #333;
margin-bottom: 6rpx;
}
.exam-sent-zh {
font-size: 28rpx;
color: #909090;
margin-bottom: 6rpx;
}
.exam-sent-source {
font-size: 24rpx;
color: #ccc;
text-align: right;
}
.syno {
margin-bottom: 20rpx;
}
.syno-title {
font-size: 32rpx;
line-height: 32rpx;
font-weight: bold;
color: #333;
padding: 20rpx 0;
}
.syno-list {
padding-bottom: 20rpx;
border-bottom: 1rpx solid #e0e0e0;
margin-bottom: 20rpx;
}
.syno-pos {
font-size: 26rpx;
color: #666;
margin-bottom: 10rpx;
}
.syno-tran {
font-size: 28rpx;
color: #333;
margin: 12rpx 0;
display: inline;
vertical-align: middle;
padding-left: 16rpx;
}
.syno-item {
display: inline-block;
margin-right: 15rpx;
}
.rel-word {
margin-bottom: 30rpx;
}
.rel-word-title {
font-size: 32rpx;
line-height: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
}
.rel-word-list {
padding: 20rpx;
background: #f9f9f9;
border-radius: 24rpx;
margin-bottom: 24rpx;
}
.rel-word-pos {
font-size: 28rpx;
color: #666;
margin-bottom: 10rpx;
}
.rel-word-item {
display: flex;
justify-content: space-between;
padding: 15rpx 0;
border-bottom: 1rpx solid #eee;
}
.rel-word-item:last-child {
border-bottom: none;
}
.rel-word-tran {
font-size: 28rpx;
color: #333;
flex: 1;
}
.rel-word-word {
font-size: 28rpx;
}
.no-related-words-text {
font-size: 28rpx;
color: #909090;
}
.no-word {
text-align: center;
font-size: 28rpx;
color: #909090;
padding: 40rpx 0;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,85 +0,0 @@
import { SuperComponent } from '../common/src/index';
export default class ActionSheet extends SuperComponent {
static show: (options: import("./show").ActionSheetShowOption) => WechatMiniprogram.Component.TrivialInstance;
behaviors: string[];
externalClasses: string[];
properties: {
align?: {
type: StringConstructor;
value?: "left" | "center";
};
cancelText?: {
type: StringConstructor;
value?: string;
};
count?: {
type: NumberConstructor;
value?: number;
};
description?: {
type: StringConstructor;
value?: string;
};
items: {
type: ArrayConstructor;
value?: (string | import("./type").ActionSheetItem)[];
required?: boolean;
};
popupProps?: {
type: ObjectConstructor;
value?: import("../popup").TdPopupProps;
};
showCancel?: {
type: BooleanConstructor;
value?: boolean;
};
showOverlay?: {
type: BooleanConstructor;
value?: boolean;
};
theme?: {
type: StringConstructor;
value?: "list" | "grid";
};
usingCustomNavbar?: {
type: BooleanConstructor;
value?: boolean;
};
visible?: {
type: BooleanConstructor;
value?: boolean;
};
defaultVisible?: {
type: BooleanConstructor;
value?: boolean;
};
};
data: {
prefix: string;
classPrefix: string;
gridThemeItems: any[];
currentSwiperIndex: number;
defaultPopUpProps: {};
defaultPopUpzIndex: number;
};
controlledProps: {
key: string;
event: string;
}[];
observers: {
'visible, items'(visible: boolean): void;
};
methods: {
init(): void;
memoInitialData(): void;
splitGridThemeActions(): void;
show(options: any): void;
close(): void;
onPopupVisibleChange({ detail }: {
detail: any;
}): void;
onSwiperChange(e: WechatMiniprogram.TouchEvent): void;
onSelect(event: WechatMiniprogram.TouchEvent): void;
onCancel(): void;
};
}

View File

@@ -1 +0,0 @@
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;

View File

@@ -1 +0,0 @@
{"component":true,"styleIsolation":"apply-shared","usingComponents":{"t-icon":"../icon/icon","t-popup":"../popup/popup","t-grid":"../grid/grid","t-grid-item":"../grid-item/grid-item"}}

View File

@@ -1 +0,0 @@
<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>

View File

@@ -1,19 +0,0 @@
var getListThemeItemClass = function (props) {
var classPrefix = props.classPrefix;
var item = props.item;
var prefix = props.prefix;
var classList = [classPrefix + '__list-item'];
if (item.disabled) {
classList.push(prefix + '-is-disabled');
}
return classList.join(' ');
};
var isImage = function (name) {
return name.indexOf('/') !== -1;
};
module.exports = {
getListThemeItemClass: getListThemeItemClass,
isImage: isImage,
};

View File

@@ -1,29 +0,0 @@
@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--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;}

View File

@@ -1,8 +0,0 @@
/// <reference types="miniprogram-api-typings" />
import { ActionSheetItem, ActionSheetTheme, ActionSheetShowOption } from './show';
export { ActionSheetItem, ActionSheetTheme, ActionSheetShowOption };
declare const _default: {
show(options: ActionSheetShowOption): WechatMiniprogram.Component.TrivialInstance;
close(options: ActionSheetShowOption): void;
};
export default _default;

View File

@@ -1 +0,0 @@
import{show,close,ActionSheetTheme}from"./show";export{ActionSheetTheme};export default{show:e=>show(e),close:e=>close(e)};

View File

@@ -1,3 +0,0 @@
import { TdActionSheetProps } from './type';
declare const props: TdActionSheetProps;
export default props;

View File

@@ -1 +0,0 @@
const props={align:{type:String,value:"center"},cancelText:{type:String,value:""},count:{type:Number,value:8},description:{type:String,value:""},items:{type:Array,required:!0},popupProps:{type:Object,value:{}},showCancel:{type:Boolean,value:!0},showOverlay:{type:Boolean,value:!0},theme:{type:String,value:"list"},usingCustomNavbar:{type:Boolean,value:!1},visible:{type:Boolean,value:null},defaultVisible:{type:Boolean,value:!1}};export default props;

View File

@@ -1,26 +0,0 @@
/// <reference types="miniprogram-api-typings" />
/// <reference types="miniprogram-api-typings" />
import { ActionSheetItem } from './type';
export { ActionSheetItem };
declare type Context = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
export declare enum ActionSheetTheme {
List = "list",
Grid = "grid"
}
interface ActionSheetProps {
align: 'center' | 'left';
cancelText?: string;
count?: number;
description: string;
items: Array<string | ActionSheetItem>;
showCancel?: boolean;
theme?: ActionSheetTheme;
visible: boolean;
defaultVisible?: boolean;
}
export interface ActionSheetShowOption extends Omit<ActionSheetProps, 'visible'> {
context?: Context;
selector?: string;
}
export declare const show: (options: ActionSheetShowOption) => WechatMiniprogram.Component.TrivialInstance;
export declare const close: (options: ActionSheetShowOption) => void;

View File

@@ -1 +0,0 @@
import{__rest}from"tslib";import{getInstance}from"../common/utils";export var ActionSheetTheme;!function(t){t.List="list",t.Grid="grid"}(ActionSheetTheme||(ActionSheetTheme={}));export const show=function(t){const e=Object.assign({},t),{context:o,selector:n="#t-action-sheet"}=e,c=__rest(e,["context","selector"]),s=getInstance(o,n);if(s)return s.show(Object.assign({},c)),s;console.error("未找到组件,请确认 selector && context 是否正确")};export const close=function(t){const{context:e,selector:o="#t-action-sheet"}=Object.assign({},t),n=getInstance(e,o);n&&n.close()};

View File

@@ -1 +0,0 @@
<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>

View File

@@ -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>

View File

@@ -1,59 +0,0 @@
import { PopupProps } from '../popup/index';
export interface TdActionSheetProps {
align?: {
type: StringConstructor;
value?: 'center' | 'left';
};
cancelText?: {
type: StringConstructor;
value?: string;
};
count?: {
type: NumberConstructor;
value?: number;
};
description?: {
type: StringConstructor;
value?: string;
};
items: {
type: ArrayConstructor;
value?: Array<string | ActionSheetItem>;
required?: boolean;
};
popupProps?: {
type: ObjectConstructor;
value?: PopupProps;
};
showCancel?: {
type: BooleanConstructor;
value?: boolean;
};
showOverlay?: {
type: BooleanConstructor;
value?: boolean;
};
theme?: {
type: StringConstructor;
value?: 'list' | 'grid';
};
usingCustomNavbar?: {
type: BooleanConstructor;
value?: boolean;
};
visible?: {
type: BooleanConstructor;
value?: boolean;
};
defaultVisible?: {
type: BooleanConstructor;
value?: boolean;
};
}
export interface ActionSheetItem {
label: string;
color?: string;
disabled?: boolean;
icon?: string;
suffixIcon?: string;
}

View File

@@ -1,28 +0,0 @@
import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class AvatarGroup extends SuperComponent {
externalClasses: string[];
properties: import("./type").TdAvatarGroupProps;
data: {
prefix: string;
classPrefix: string;
hasChild: boolean;
length: number;
className: string;
};
options: {
multipleSlots: boolean;
};
relations: RelationsOptions;
lifetimes: {
attached(): void;
ready(): void;
};
observers: {
'cascading, size'(): void;
};
methods: {
setClass(): void;
handleMax(): void;
onCollapsedItemClick(e: WechatMiniprogram.CustomEvent): void;
};
}

View File

@@ -1 +0,0 @@
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;

View File

@@ -1 +0,0 @@
{"component":true,"styleIsolation":"shared","usingComponents":{"t-avatar":"../avatar/avatar"}}

View File

@@ -1 +0,0 @@
<wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle])}}" class="{{className}} class"><slot/><view class="{{classPrefix}}__collapse--slot"><slot name="collapse-avatar"/></view><view class="{{classPrefix}}__collapse--default" wx:if="{{max && (max < length)}}" bindtap="onCollapsedItemClick"><t-avatar t-class-image="{{prefix}}-avatar--border {{prefix}}-avatar--border-{{size}} {{prefix}}-class-image" t-class-content="{{prefix}}-class-content" size="{{size}}" shape="{{shape}}" icon="{{ collapseAvatar ? '' : 'user-add'}}" aria-role="none">{{collapseAvatar}}</t-avatar></view></view>

View File

@@ -1,59 +0,0 @@
@import '../common/style/index.wxss';.t-avatar-group{display:inline-flex;flex-wrap:wrap;align-items:center;}
.t-avatar-group-offset-left .t-avatar__wrapper,.t-avatar-group-offset-right .t-avatar__wrapper{padding:var(--td-avatar-group-line-spacing,4rpx) 0;}
.t-avatar-group-offset-left-small,.t-avatar-group-offset-right-small{--td-avatar-margin-left:var(--td-avatar-group-margin-left-small, -16rpx);}
.t-avatar-group-offset-left-medium,.t-avatar-group-offset-right-medium{--td-avatar-margin-left:var(--td-avatar-group-margin-left-medium, -16rpx);}
.t-avatar-group-offset-left-large,.t-avatar-group-offset-right-large{--td-avatar-margin-left:var(--td-avatar-group-margin-left-large, -16rpx);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(1){z-index:calc(var(--td-avatar-group-init-z-index,50) - 1);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(2){z-index:calc(var(--td-avatar-group-init-z-index,50) - 2);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(3){z-index:calc(var(--td-avatar-group-init-z-index,50) - 3);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(4){z-index:calc(var(--td-avatar-group-init-z-index,50) - 4);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(5){z-index:calc(var(--td-avatar-group-init-z-index,50) - 5);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(6){z-index:calc(var(--td-avatar-group-init-z-index,50) - 6);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(7){z-index:calc(var(--td-avatar-group-init-z-index,50) - 7);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(8){z-index:calc(var(--td-avatar-group-init-z-index,50) - 8);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(9){z-index:calc(var(--td-avatar-group-init-z-index,50) - 9);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(10){z-index:calc(var(--td-avatar-group-init-z-index,50) - 10);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(11){z-index:calc(var(--td-avatar-group-init-z-index,50) - 11);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(12){z-index:calc(var(--td-avatar-group-init-z-index,50) - 12);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(13){z-index:calc(var(--td-avatar-group-init-z-index,50) - 13);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(14){z-index:calc(var(--td-avatar-group-init-z-index,50) - 14);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(15){z-index:calc(var(--td-avatar-group-init-z-index,50) - 15);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(16){z-index:calc(var(--td-avatar-group-init-z-index,50) - 16);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(17){z-index:calc(var(--td-avatar-group-init-z-index,50) - 17);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(18){z-index:calc(var(--td-avatar-group-init-z-index,50) - 18);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(19){z-index:calc(var(--td-avatar-group-init-z-index,50) - 19);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(20){z-index:calc(var(--td-avatar-group-init-z-index,50) - 20);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(21){z-index:calc(var(--td-avatar-group-init-z-index,50) - 21);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(22){z-index:calc(var(--td-avatar-group-init-z-index,50) - 22);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(23){z-index:calc(var(--td-avatar-group-init-z-index,50) - 23);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(24){z-index:calc(var(--td-avatar-group-init-z-index,50) - 24);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(25){z-index:calc(var(--td-avatar-group-init-z-index,50) - 25);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(26){z-index:calc(var(--td-avatar-group-init-z-index,50) - 26);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(27){z-index:calc(var(--td-avatar-group-init-z-index,50) - 27);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(28){z-index:calc(var(--td-avatar-group-init-z-index,50) - 28);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(29){z-index:calc(var(--td-avatar-group-init-z-index,50) - 29);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(30){z-index:calc(var(--td-avatar-group-init-z-index,50) - 30);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(31){z-index:calc(var(--td-avatar-group-init-z-index,50) - 31);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(32){z-index:calc(var(--td-avatar-group-init-z-index,50) - 32);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(33){z-index:calc(var(--td-avatar-group-init-z-index,50) - 33);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(34){z-index:calc(var(--td-avatar-group-init-z-index,50) - 34);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(35){z-index:calc(var(--td-avatar-group-init-z-index,50) - 35);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(36){z-index:calc(var(--td-avatar-group-init-z-index,50) - 36);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(37){z-index:calc(var(--td-avatar-group-init-z-index,50) - 37);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(38){z-index:calc(var(--td-avatar-group-init-z-index,50) - 38);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(39){z-index:calc(var(--td-avatar-group-init-z-index,50) - 39);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(40){z-index:calc(var(--td-avatar-group-init-z-index,50) - 40);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(41){z-index:calc(var(--td-avatar-group-init-z-index,50) - 41);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(42){z-index:calc(var(--td-avatar-group-init-z-index,50) - 42);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(43){z-index:calc(var(--td-avatar-group-init-z-index,50) - 43);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(44){z-index:calc(var(--td-avatar-group-init-z-index,50) - 44);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(45){z-index:calc(var(--td-avatar-group-init-z-index,50) - 45);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(46){z-index:calc(var(--td-avatar-group-init-z-index,50) - 46);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(47){z-index:calc(var(--td-avatar-group-init-z-index,50) - 47);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(48){z-index:calc(var(--td-avatar-group-init-z-index,50) - 48);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(49){z-index:calc(var(--td-avatar-group-init-z-index,50) - 49);}
.t-avatar-group-offset-left .t-avatar__wrapper:nth-child(50){z-index:calc(var(--td-avatar-group-init-z-index,50) - 50);}
.t-avatar-group__collapse--default,.t-avatar-group__collapse--slot{z-index:0;font-weight:600;}
.t-avatar-group__collapse--slot{float:left;}
.t-avatar-group__collapse--slot:not(:empty)+.t-avatar-group__collapse--default{display:none;float:left;}
.t-avatar-group__collapse--slot:empty+.t-avatar-group__collapse--default{display:block;float:left;}

View File

@@ -1,3 +0,0 @@
import { TdAvatarGroupProps } from './type';
declare const props: TdAvatarGroupProps;
export default props;

View File

@@ -1 +0,0 @@
const props={cascading:{type:String,value:"left-up"},collapseAvatar:{type:String},max:{type:Number},shape:{type:String},size:{type:String,value:""}};export default props;

View File

@@ -1,24 +0,0 @@
import { ShapeEnum } from '../common/common';
export interface TdAvatarGroupProps {
cascading?: {
type: StringConstructor;
value?: CascadingValue;
};
collapseAvatar?: {
type: StringConstructor;
value?: string;
};
max?: {
type: NumberConstructor;
value?: number;
};
shape?: {
type: StringConstructor;
value?: ShapeEnum;
};
size?: {
type: StringConstructor;
value?: string;
};
}
export declare type CascadingValue = 'left-up' | 'right-up';

View File

@@ -1,22 +0,0 @@
/// <reference types="miniprogram-api-typings" />
import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class Avatar extends SuperComponent {
options: WechatMiniprogram.Component.ComponentOptions;
externalClasses: string[];
properties: import("./type").TdAvatarProps;
data: {
prefix: string;
classPrefix: string;
isShow: boolean;
zIndex: number;
systemInfo: WechatMiniprogram.WindowInfo | WechatMiniprogram.SystemInfo;
};
relations: RelationsOptions;
observers: {
icon(icon: any): void;
};
methods: {
hide(): void;
onLoadError(e: WechatMiniprogram.CustomEvent): void;
};
}

View File

@@ -1 +0,0 @@
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;

View File

@@ -1 +0,0 @@
{"component":true,"styleIsolation":"shared","usingComponents":{"t-icon":"../icon/icon","t-badge":"../badge/badge","t-image":"../image/image"}}

View File

@@ -1 +0,0 @@
<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>

View File

@@ -1,30 +0,0 @@
module.exports = {
getClass: function (classPrefix, size, shape, bordered) {
var hasPx = (size || '').indexOf('px') > -1;
var borderSize = hasPx ? 'medium' : size;
var classNames = [
classPrefix,
classPrefix + (shape === 'round' ? '--round' : '--circle'),
bordered ? classPrefix + '--border' + ' ' + classPrefix + '--border-' + borderSize : '',
hasPx ? '' : classPrefix + '--' + size,
];
return classNames.join(' ');
},
getSize: function (size = 'medium', systemInfo) {
var res = getRegExp('^([0-9]+)(px|rpx)$').exec(size);
if (res && res.length >= 3) {
var px = res[1];
if (res[2] === 'rpx') {
px = Math.floor((systemInfo.windowWidth * res[1]) / 750);
}
return 'width:' + size + ';height:' + size + ';font-size:' + ((px / 8) * 3 + 2) + 'px';
}
},
getStyles: function (isShow) {
return isShow ? '' : 'display: none;';
},
};

View File

@@ -1,17 +0,0 @@
@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);}

View File

@@ -1,3 +0,0 @@
import { TdAvatarProps } from './type';
declare const props: TdAvatarProps;
export default props;

View File

@@ -1 +0,0 @@
const props={alt:{type:String,value:""},badgeProps:{type:Object},bordered:{type:Boolean,value:!1},hideOnLoadFailed:{type:Boolean,value:!1},icon:{type:null},image:{type:String,value:""},imageProps:{type:Object},shape:{type:String},size:{type:String,value:""}};export default props;

View File

@@ -1,41 +0,0 @@
import { BadgeProps } from '../badge/index';
import { ImageProps } from '../image/index';
import { ShapeEnum } from '../common/common';
export interface TdAvatarProps {
alt?: {
type: StringConstructor;
value?: string;
};
badgeProps?: {
type: ObjectConstructor;
value?: BadgeProps;
};
bordered?: {
type: BooleanConstructor;
value?: boolean;
};
hideOnLoadFailed?: {
type: BooleanConstructor;
value?: boolean;
};
icon?: {
type: null;
value?: string | object;
};
image?: {
type: StringConstructor;
value?: string;
};
imageProps?: {
type: ObjectConstructor;
value?: ImageProps;
};
shape?: {
type: StringConstructor;
value?: ShapeEnum;
};
size?: {
type: StringConstructor;
value?: string;
};
}

View File

@@ -1,26 +0,0 @@
import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class BackTop extends SuperComponent {
externalClasses: string[];
options: {
multipleSlots: boolean;
};
properties: import("./type").TdBackTopProps;
relations: RelationsOptions;
data: {
prefix: string;
classPrefix: string;
_icon: any;
hidden: boolean;
};
observers: {
icon(): void;
scrollTop(value: number): void;
};
lifetimes: {
ready(): void;
};
methods: {
setIcon(v: any): void;
toTop(): void;
};
}

View File

@@ -1 +0,0 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import{calcIcon}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-back-top`;let BackTop=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-icon`,`${prefix}-class-text`],this.options={multipleSlots:!0},this.properties=props,this.relations={"../pull-down-refresh/pull-down-refresh":{type:"ancestor"}},this.data={prefix:prefix,classPrefix:name,_icon:null,hidden:!0},this.observers={icon(){this.setIcon()},scrollTop(o){const{visibilityHeight:t}=this.properties;this.setData({hidden:o<t})}},this.lifetimes={ready(){const{icon:o}=this.properties;this.setIcon(o)}},this.methods={setIcon(o){this.setData({_icon:calcIcon(o,"backtop")})},toTop(){var o;this.triggerEvent("to-top"),this.$parent?(null===(o=this.$parent)||void 0===o||o.setScrollTop(0),this.setData({hidden:!0})):wx.pageScrollTo({scrollTop:0,duration:300})}}}};BackTop=__decorate([wxComponent()],BackTop);export default BackTop;

View File

@@ -1 +0,0 @@
{"component":true,"styleIsolation":"apply-shared","usingComponents":{"t-icon":"../icon/icon"}}

View File

@@ -1 +0,0 @@
<import src="../common/template/icon.wxml"/><wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle])}}" class="class {{prefix}}-class {{_.cls(classPrefix, [['fixed', fixed], theme])}}" bindtap="toTop" aria-role="button" hidden="{{hidden}}"><view class="{{classPrefix}}__icon" aria-hidden><slot name="icon"/><template wx:if="{{_icon}}" is="icon" data="{{tClass: prefix + '-class-icon', ..._icon }}"/></view><view wx:if="{{!!text}}" class="{{classPrefix}}__text--{{theme}} {{prefix}}-class-text">{{text}}</view><slot/></view>

View File

@@ -1,10 +0,0 @@
@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;}

View File

@@ -1,3 +0,0 @@
import { TdBackTopProps } from './type';
declare const props: TdBackTopProps;
export default props;

View File

@@ -1 +0,0 @@
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;

View File

@@ -1,30 +0,0 @@
export interface TdBackTopProps {
fixed?: {
type: BooleanConstructor;
value?: boolean;
};
icon?: {
type: null;
value?: string | boolean | object;
};
scrollTop?: {
type: NumberConstructor;
value?: number;
};
style?: {
type: StringConstructor;
value?: string;
};
text?: {
type: StringConstructor;
value?: string;
};
theme?: {
type: StringConstructor;
value?: 'round' | 'half-round' | 'round-dark' | 'half-round-dark';
};
visibilityHeight?: {
type: NumberConstructor;
value?: number;
};
}

View File

@@ -1,21 +0,0 @@
import { SuperComponent } from '../common/src/index';
import type { TdBadgeProps } from './type';
export interface BadgeProps extends TdBadgeProps {
}
export default class Badge extends SuperComponent {
options: {
multipleSlots: boolean;
};
externalClasses: string[];
properties: TdBadgeProps;
data: {
prefix: string;
classPrefix: string;
value: string;
labelID: string;
descriptionID: string;
};
lifetimes: {
ready(): void;
};
}

View File

@@ -1 +0,0 @@
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;

View File

@@ -1 +0,0 @@
{"component":true,"styleIsolation":"apply-shared","usingComponents":{}}

View File

@@ -1 +0,0 @@
<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>

View File

@@ -1,71 +0,0 @@
var getBadgeValue = function (props) {
if (props.dot) {
return '';
}
if (isNaN(props.count) || isNaN(props.maxCount)) {
return props.count;
}
return parseInt(props.count) > props.maxCount ? props.maxCount + '+' : props.count;
};
var hasUnit = function (unit) {
return (
unit.indexOf('px') > 0 ||
unit.indexOf('rpx') > 0 ||
unit.indexOf('em') > 0 ||
unit.indexOf('rem') > 0 ||
unit.indexOf('%') > 0 ||
unit.indexOf('vh') > 0 ||
unit.indexOf('vm') > 0
);
};
var getBadgeStyles = function (props) {
var styleStr = '';
if (props.color) {
styleStr += 'background:' + props.color + ';';
}
if (props.offset[0]) {
styleStr +=
'left: calc(100% + ' + (hasUnit(props.offset[0].toString()) ? props.offset[0] : props.offset[0] + 'px') + ');';
}
if (props.offset[1]) {
styleStr += 'top:' + (hasUnit(props.offset[1].toString()) ? props.offset[1] : props.offset[1] + 'px') + ';';
}
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 baseClass = 't-badge';
var classNames = [
baseClass + '--basic',
props.dot ? baseClass + '--dot' : '',
baseClass + '--' + props.size,
baseClass + '--' + props.shape,
!props.dot && props.count ? baseClass + '--count' : '',
];
return classNames.join(' ');
};
var isShowBadge = function (props) {
if (props.dot) {
return true;
}
if (!props.showZero && !isNaN(props.count) && parseInt(props.count) === 0) {
return false;
}
if (props.count == null) return false;
return true;
};
module.exports.getBadgeValue = getBadgeValue;
module.exports.getBadgeStyles = getBadgeStyles;
module.exports.getBadgeOuterClass = getBadgeOuterClass;
module.exports.getBadgeInnerClass = getBadgeInnerClass;
module.exports.isShowBadge = isShowBadge;

View File

@@ -1,15 +0,0 @@
@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))));}

View File

@@ -1,3 +0,0 @@
export * from './type';
export * from './props';
export * from './badge';

View File

@@ -1 +0,0 @@
export*from"./type";export*from"./props";export*from"./badge";

View File

@@ -1,3 +0,0 @@
import { TdBadgeProps } from './type';
declare const props: TdBadgeProps;
export default props;

View File

@@ -1 +0,0 @@
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;

View File

@@ -1,42 +0,0 @@
export interface TdBadgeProps {
color?: {
type: StringConstructor;
value?: string;
};
content?: {
type: StringConstructor;
value?: string;
};
count?: {
type: null;
value?: string | number;
};
dot?: {
type: BooleanConstructor;
value?: boolean;
};
externalClasses?: {
type: ArrayConstructor;
value?: ['t-class', 't-class-content', 't-class-count'];
};
maxCount?: {
type: NumberConstructor;
value?: number;
};
offset?: {
type: ArrayConstructor;
value?: Array<string | number>;
};
shape?: {
type: StringConstructor;
value?: 'circle' | 'square' | 'bubble' | 'ribbon';
};
showZero?: {
type: BooleanConstructor;
value?: boolean;
};
size?: {
type: StringConstructor;
value?: 'medium' | 'large';
};
}

View File

@@ -1,38 +0,0 @@
import { SuperComponent } from '../common/src/index';
import type { TdButtonProps } from './type';
export interface ButtonProps extends TdButtonProps {
}
export default class Button extends SuperComponent {
externalClasses: string[];
behaviors: string[];
properties: TdButtonProps;
options: {
multipleSlots: boolean;
};
data: {
prefix: string;
className: string;
classPrefix: string;
};
observers: {
'theme, size, plain, block, shape, disabled, loading, variant'(): void;
icon(icon: any): void;
};
lifetimes: {
attached(): void;
};
methods: {
setClass(): void;
getuserinfo(e: any): void;
contact(e: any): void;
createliveactivity(e: any): void;
getphonenumber(e: any): void;
getrealtimephonenumber(e: any): void;
error(e: any): void;
opensetting(e: any): void;
launchapp(e: any): void;
chooseavatar(e: any): void;
agreeprivacyauthorization(e: any): void;
handleTap(e: any): void;
};
}

View File

@@ -1 +0,0 @@
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;

View File

@@ -1 +0,0 @@
{"component":true,"styleIsolation":"apply-shared","usingComponents":{"t-icon":"../icon/icon","t-loading":"../loading/loading"}}

View File

@@ -1 +0,0 @@
<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: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>

View File

@@ -1,129 +0,0 @@
@import '../common/style/index.wxss';.t-button--size-extra-small{font-size:var(--td-button-extra-small-font-size,var(--td-font-size-base,28rpx));padding-left:var(--td-button-extra-small-padding-horizontal,16rpx);padding-right:var(--td-button-extra-small-padding-horizontal,16rpx);height:var(--td-button-extra-small-height,56rpx);line-height:var(--td-button-extra-small-height,56rpx);}
.t-button--size-extra-small .t-button__icon{font-size:var(--td-button-extra-small-icon-font-size,36rpx);}
.t-button--size-small{font-size:var(--td-button-small-font-size,var(--td-font-size-base,28rpx));padding-left:var(--td-button-small-padding-horizontal,24rpx);padding-right:var(--td-button-small-padding-horizontal,24rpx);height:var(--td-button-small-height,64rpx);line-height:var(--td-button-small-height,64rpx);}
.t-button--size-small .t-button__icon{font-size:var(--td-button-small-icon-font-size,36rpx);}
.t-button--size-medium{font-size:var(--td-button-medium-font-size,var(--td-font-size-m,32rpx));padding-left:var(--td-button-medium-padding-horizontal,32rpx);padding-right:var(--td-button-medium-padding-horizontal,32rpx);height:var(--td-button-medium-height,80rpx);line-height:var(--td-button-medium-height,80rpx);}
.t-button--size-medium .t-button__icon{font-size:var(--td-button-medium-icon-font-size,40rpx);}
.t-button--size-large{font-size:var(--td-button-large-font-size,var(--td-font-size-m,32rpx));padding-left:var(--td-button-large-padding-horizontal,40rpx);padding-right:var(--td-button-large-padding-horizontal,40rpx);height:var(--td-button-large-height,96rpx);line-height:var(--td-button-large-height,96rpx);}
.t-button--size-large .t-button__icon{font-size:var(--td-button-large-icon-font-size,48rpx);}
.t-button--default{color:var(--td-button-default-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));background-color:var(--td-button-default-bg-color,var(--td-bg-color-component,var(--td-gray-color-3,#e7e7e7)));border-color:var(--td-button-default-border-color,var(--td-bg-color-component,var(--td-gray-color-3,#e7e7e7)));}
.t-button--default::after{border-width:var(--td-button-border-width,4rpx);border-color:var(--td-button-default-border-color,var(--td-bg-color-component,var(--td-gray-color-3,#e7e7e7)));}
.t-button--default.t-button--hover{z-index:0;}
.t-button--default.t-button--hover,.t-button--default.t-button--hover::after{background-color:var(--td-button-default-active-bg-color,var(--td-bg-color-component-active,var(--td-gray-color-6,#a6a6a6)));border-color:var(--td-button-default-active-border-color,var(--td-bg-color-component-active,var(--td-gray-color-6,#a6a6a6)));}
.t-button--default.t-button--disabled{color:var(--td-button-default-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));background-color:var(--td-button-default-disabled-bg,var(--td-bg-color-component-disabled,var(--td-gray-color-2,#eee)));}
.t-button--default.t-button--disabled,.t-button--default.t-button--disabled::after{border-color:var(--td-button-default-disabled-border-color,var(--td-bg-color-component-disabled,var(--td-gray-color-2,#eee)));}
.t-button--primary{color:var(--td-button-primary-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));background-color:var(--td-button-primary-bg-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));border-color:var(--td-button-primary-border-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-button--primary::after{border-width:var(--td-button-border-width,4rpx);border-color:var(--td-button-primary-border-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-button--primary.t-button--hover{z-index:0;}
.t-button--primary.t-button--hover,.t-button--primary.t-button--hover::after{background-color:var(--td-button-primary-active-bg-color,var(--td-brand-color-active,var(--td-primary-color-8,#003cab)));border-color:var(--td-button-primary-active-border-color,var(--td-brand-color-active,var(--td-primary-color-8,#003cab)));}
.t-button--primary.t-button--disabled{color:var(--td-button-primary-disabled-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));background-color:var(--td-button-primary-disabled-bg,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));}
.t-button--primary.t-button--disabled,.t-button--primary.t-button--disabled::after{border-color:var(--td-button-primary-disabled-border-color,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));}
.t-button--light{color:var(--td-button-light-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));background-color:var(--td-button-light-bg-color,var(--td-brand-color-light,var(--td-primary-color-1,#f2f3ff)));border-color:var(--td-button-light-border-color,var(--td-brand-color-light,var(--td-primary-color-1,#f2f3ff)));}
.t-button--light::after{border-width:var(--td-button-border-width,4rpx);border-color:var(--td-button-light-border-color,var(--td-brand-color-light,var(--td-primary-color-1,#f2f3ff)));}
.t-button--light.t-button--hover{z-index:0;}
.t-button--light.t-button--hover,.t-button--light.t-button--hover::after{background-color:var(--td-button-light-active-bg-color,var(--td-brand-color-light-active,var(--td-primary-color-2,#d9e1ff)));border-color:var(--td-button-light-active-border-color,var(--td-brand-color-light-active,var(--td-primary-color-2,#d9e1ff)));}
.t-button--light.t-button--disabled{color:var(--td-button-light-disabled-color,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));background-color:var(--td-button-light-disabled-bg,var(--td-brand-color-light,var(--td-primary-color-1,#f2f3ff)));}
.t-button--light.t-button--disabled,.t-button--light.t-button--disabled::after{border-color:var(--td-button-light-disabled-border-color,var(--td-brand-color-light,var(--td-primary-color-1,#f2f3ff)));}
.t-button--danger{color:var(--td-button-danger-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));background-color:var(--td-button-danger-bg-color,var(--td-error-color,var(--td-error-color-6,#d54941)));border-color:var(--td-button-danger-border-color,var(--td-error-color,var(--td-error-color-6,#d54941)));}
.t-button--danger::after{border-width:var(--td-button-border-width,4rpx);border-color:var(--td-button-danger-border-color,var(--td-error-color,var(--td-error-color-6,#d54941)));}
.t-button--danger.t-button--hover{z-index:0;}
.t-button--danger.t-button--hover,.t-button--danger.t-button--hover::after{background-color:var(--td-button-danger-active-bg-color,var(--td-error-color-active,var(--td-error-color-7,#ad352f)));border-color:var(--td-button-danger-active-border-color,var(--td-error-color-active,var(--td-error-color-7,#ad352f)));}
.t-button--danger.t-button--disabled{color:var(--td-button-danger-disabled-color,var(--td-font-white-1,#fff));background-color:var(--td-button-danger-disabled-bg,var(--td-error-color-3,#ffb9b0));}
.t-button--danger.t-button--disabled,.t-button--danger.t-button--disabled::after{border-color:var(--td-button-danger-disabled-border-color,var(--td-error-color-3,#ffb9b0));}
.t-button{display:inline-flex;align-items:center;justify-content:center;position:relative;white-space:nowrap;text-align:center;background-image:none;transition:all .3s;touch-action:manipulation;border-radius:var(--td-button-border-radius,var(--td-radius-default,12rpx));outline:0;font-family:PingFang SC,Microsoft YaHei,Arial Regular;font-weight:var(--td-button-font-weight,600);vertical-align:top;box-sizing:border-box;cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;-webkit-appearance:none;}
.t-button::after{border-radius:calc(var(--td-button-border-radius,var(--td-radius-default,12rpx)) * 2);}
.t-button--text{color:var(--td-button-default-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));background-color:transparent;}
.t-button--text,.t-button--text::after{border:0;}
.t-button--text.t-button--hover,.t-button--text.t-button--hover::after{background-color:var(--td-button-default-text-active-bg-color,var(--td-bg-color-container-active,var(--td-gray-color-3,#e7e7e7)));}
.t-button--text.t-button--primary{color:var(--td-button-primary-text-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));background-color:transparent;}
.t-button--text.t-button--primary.t-button--hover,.t-button--text.t-button--primary.t-button--hover::after{background-color:var(--td-button-primary-text-active-bg-color,var(--td-bg-color-container-active,var(--td-gray-color-3,#e7e7e7)));}
.t-button--text.t-button--primary.t-button--disabled{color:var(--td-button-primary-text-disabled-color,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));}
.t-button--text.t-button--danger{color:var(--td-button-danger-text-color,var(--td-error-color,var(--td-error-color-6,#d54941)));background-color:transparent;}
.t-button--text.t-button--danger.t-button--hover,.t-button--text.t-button--danger.t-button--hover::after{background-color:var(--td-button-danger-text-active-bg-color,var(--td-bg-color-container-active,var(--td-gray-color-3,#e7e7e7)));}
.t-button--text.t-button--danger.t-button--disabled{color:var(--td-button-danger-text-disabled-color,var(--td-button-danger-disabled-color,var(--td-font-white-1,#fff)));background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));}
.t-button--text.t-button--light{color:var(--td-button-light-text-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));background-color:transparent;}
.t-button--text.t-button--light.t-button--hover,.t-button--text.t-button--light.t-button--hover::after{background-color:var(--td-button-light-text-active-bg-color,var(--td-bg-color-container-active,var(--td-gray-color-3,#e7e7e7)));}
.t-button--text.t-button--disabled{color:var(--td-button-default-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
.t-button--outline{color:var(--td-button-default-outline-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));}
.t-button--outline,.t-button--outline::after{border-color:var(--td-button-default-outline-border-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));}
.t-button--outline.t-button--hover,.t-button--outline.t-button--hover::after{background-color:var(--td-button-default-outline-active-bg-color,var(--td-bg-color-container-active,var(--td-gray-color-3,#e7e7e7)));border-color:var(--td-button-default-outline-active-border-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));}
.t-button--outline.t-button--disabled{color:var(--td-button-default-outline-disabled-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));}
.t-button--outline.t-button--disabled,.t-button--outline.t-button--disabled::after{border-color:var(--td-button-default-outline-disabled-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));}
.t-button--outline.t-button--primary{color:var(--td-button-primary-outline-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-button--outline.t-button--primary,.t-button--outline.t-button--primary::after{border-color:var(--td-button-primary-outline-border-color,var(--td-button-primary-outline-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9))));}
.t-button--outline.t-button--primary.t-button--hover{color:var(--td-button-primary-outline-active-border-color,var(--td-brand-color-active,var(--td-primary-color-8,#003cab)));}
.t-button--outline.t-button--primary.t-button--hover::after{background-color:var(--td-button-primary-outline-active-bg-color,var(--td-bg-color-container-active,var(--td-gray-color-3,#e7e7e7)));border-color:var(--td-button-primary-outline-active-border-color,var(--td-brand-color-active,var(--td-primary-color-8,#003cab)));}
.t-button--outline.t-button--primary.t-button--disabled{background-color:transparent;color:var(--td-button-primary-outline-disabled-color,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));}
.t-button--outline.t-button--primary.t-button--disabled,.t-button--outline.t-button--primary.t-button--disabled::after{border-color:var(--td-button-primary-outline-disabled-color,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));}
.t-button--outline.t-button--danger{color:var(--td-button-danger-outline-color,var(--td-error-color,var(--td-error-color-6,#d54941)));}
.t-button--outline.t-button--danger,.t-button--outline.t-button--danger::after{border-color:var(--td-button-danger-outline-border-color,var(--td-button-danger-outline-color,var(--td-error-color,var(--td-error-color-6,#d54941))));}
.t-button--outline.t-button--danger.t-button--hover{color:var(--td-button-danger-outline-active-border-color,var(--td-error-color-active,var(--td-error-color-7,#ad352f)));}
.t-button--outline.t-button--danger.t-button--hover::after{background-color:var(--td-button-danger-outline-active-bg-color,var(--td-bg-color-container-active,var(--td-gray-color-3,#e7e7e7)));border-color:var(--td-button-danger-outline-active-border-color,var(--td-error-color-active,var(--td-error-color-7,#ad352f)));}
.t-button--outline.t-button--danger.t-button--disabled{background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));color:var(--td-button-danger-outline-disabled-color,var(--td-error-color-3,#ffb9b0));}
.t-button--outline.t-button--danger.t-button--disabled,.t-button--outline.t-button--danger.t-button--disabled::after{border-color:var(--td-button-danger-outline-disabled-color,var(--td-error-color-3,#ffb9b0));}
.t-button--outline.t-button--light{color:var(--td-button-light-outline-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));background-color:var(--td-button-light-outline-bg-color,var(--td-brand-color-light,var(--td-primary-color-1,#f2f3ff)));}
.t-button--outline.t-button--light,.t-button--outline.t-button--light::after{border-color:var(--td-button-light-outline-border-color,var(--td-button-light-outline-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9))));}
.t-button--outline.t-button--light.t-button--hover{color:var(--td-button-light-outline-active-border-color,var(--td-brand-color-active,var(--td-primary-color-8,#003cab)));}
.t-button--outline.t-button--light.t-button--hover,.t-button--outline.t-button--light.t-button--hover::after{background-color:var(--td-button-light-outline-active-bg-color,var(--td-brand-color-light-active,var(--td-primary-color-2,#d9e1ff)));border-color:var(--td-button-light-outline-active-border-color,var(--td-brand-color-active,var(--td-primary-color-8,#003cab)));}
.t-button--outline.t-button--light.t-button--disabled{background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));color:var(--td-button-light-outline-disabled-color,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));}
.t-button--outline.t-button--light.t-button--disabled,.t-button--outline.t-button--light.t-button--disabled::after{border-color:var(--td-button-light-outline-disabled-color,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));}
.t-button--dashed{background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));border-style:dashed;border-width:2rpx;}
.t-button--dashed::after{border:0;}
.t-button--dashed.t-button--hover,.t-button--dashed.t-button--hover::after{background-color:var(--td-button-default-outline-active-bg-color,var(--td-bg-color-container-active,var(--td-gray-color-3,#e7e7e7)));border-color:var(--td-button-default-outline-active-border-color,var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));}
.t-button--dashed.t-button--primary{color:var(--td-button-primary-dashed-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-button--dashed.t-button--primary,.t-button--dashed.t-button--primary::after{border-color:var(--td-button-primary-dashed-border-color,var(--td-button-primary-dashed-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9))));}
.t-button--dashed.t-button--primary.t-button--disabled{background-color:var(--td-bg-color-container,var(--td-font-white-1,#fff));color:var(--td-button-primary-dashed-disabled-color,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));}
.t-button--dashed.t-button--primary.t-button--disabled,.t-button--dashed.t-button--primary.t-button--disabled::after{border-color:var(--td-button-primary-dashed-disabled-color,var(--td-brand-color-disabled,var(--td-primary-color-3,#b5c7ff)));}
.t-button--dashed.t-button--danger{color:var(--td-button-danger-dashed-color,var(--td-error-color,var(--td-error-color-6,#d54941)));}
.t-button--dashed.t-button--danger,.t-button--dashed.t-button--danger::after{border-color:var(--td-button-danger-dashed-border-color,var(--td-button-danger-dashed-color,var(--td-error-color,var(--td-error-color-6,#d54941))));}
.t-button--dashed.t-button--danger.t-button--disabled{background-color:transparent;color:var(--td-button-danger-dashed-disabled-color,var(--td-button-danger-disabled-color,var(--td-font-white-1,#fff)));}
.t-button--dashed.t-button--danger.t-button--disabled::after{border-color:var(--td-button-danger-dashed-disabled-color,var(--td-button-danger-disabled-color,var(--td-font-white-1,#fff)));}
.t-button--ghost{background-color:transparent;color:var(--td-button-ghost-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));}
.t-button--ghost,.t-button--ghost::after{border-color:var(--td-button-ghost-border-color,var(--td-button-ghost-color,var(--td-text-color-anti,var(--td-font-white-1,#fff))));}
.t-button--ghost.t-button--default.t-button--hover{color:var(--td-button-ghost-hover-color,var(--td-font-white-2,rgba(255,255,255,.55)));}
.t-button--ghost.t-button--default.t-button--hover,.t-button--ghost.t-button--default.t-button--hover::after{background-color:transparent;border-color:var(--td-button-ghost-hover-color,var(--td-font-white-2,rgba(255,255,255,.55)));}
.t-button--ghost.t-button--primary{color:var(--td-button-ghost-primary-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-button--ghost.t-button--primary,.t-button--ghost.t-button--primary::after{border-color:var(--td-button-ghost-primary-border-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-button--ghost.t-button--primary.t-button--hover{color:var(--td-button-ghost-primary-hover-color,var(--td-brand-color-active,var(--td-primary-color-8,#003cab)));}
.t-button--ghost.t-button--primary.t-button--hover,.t-button--ghost.t-button--primary.t-button--hover::after{background-color:transparent;border-color:var(--td-button-ghost-primary-hover-color,var(--td-brand-color-active,var(--td-primary-color-8,#003cab)));}
.t-button--ghost.t-button--primary.t-button--text.t-button--hover,.t-button--ghost.t-button--primary.t-button--text.t-button--hover::after{background-color:var(--td-gray-color-10,#4b4b4b);}
.t-button--ghost.t-button--primary.t-button--disabled{background-color:transparent;color:var(--td-button-ghost-disabled-color,var(--td-font-white-4,rgba(255,255,255,.22)));}
.t-button--ghost.t-button--primary.t-button--disabled,.t-button--ghost.t-button--primary.t-button--disabled::after{border-color:var(--td-button-ghost-disabled-color,var(--td-font-white-4,rgba(255,255,255,.22)));}
.t-button--ghost.t-button--danger{color:var(--td-button-ghost-danger-color,var(--td-error-color,var(--td-error-color-6,#d54941)));}
.t-button--ghost.t-button--danger,.t-button--ghost.t-button--danger::after{border-color:var(--td-button-ghost-danger-border-color,var(--td-error-color,var(--td-error-color-6,#d54941)));}
.t-button--ghost.t-button--danger.t-button--hover{color:var(--td-button-ghost-danger-hover-color,var(--td-error-color-active,var(--td-error-color-7,#ad352f)));}
.t-button--ghost.t-button--danger.t-button--hover,.t-button--ghost.t-button--danger.t-button--hover::after{background-color:transparent;border-color:var(--td-button-ghost-danger-hover-color,var(--td-error-color-active,var(--td-error-color-7,#ad352f)));}
.t-button--ghost.t-button--danger.t-button--text.t-button--hover,.t-button--ghost.t-button--danger.t-button--text.t-button--hover::after{background-color:var(--td-gray-color-10,#4b4b4b);}
.t-button--ghost.t-button--danger.t-button--disabled{background-color:transparent;color:var(--td-button-ghost-disabled-color,var(--td-font-white-4,rgba(255,255,255,.22)));}
.t-button--ghost.t-button--danger.t-button--disabled,.t-button--ghost.t-button--danger.t-button--disabled::after{border-color:var(--td-button-ghost-disabled-color,var(--td-font-white-4,rgba(255,255,255,.22)));}
.t-button--ghost.t-button--default.t-button--text.t-button--hover,.t-button--ghost.t-button--default.t-button--text.t-button--hover::after{background-color:var(--td-gray-color-10,#4b4b4b);}
.t-button--ghost.t-button--default.t-button--disabled{background-color:transparent;color:var(--td-button-ghost-disabled-color,var(--td-font-white-4,rgba(255,255,255,.22)));}
.t-button--ghost.t-button--default.t-button--disabled,.t-button--ghost.t-button--default.t-button--disabled::after{border-color:var(--td-button-ghost-disabled-color,var(--td-font-white-4,rgba(255,255,255,.22)));}
.t-button__icon+.t-button__content:not(:empty),.t-button__loading+.t-button__content:not(:empty){margin-left:8rpx;}
.t-button__icon{border-radius:var(--td-button-icon-border-radius,8rpx);}
.t-button--round.t-button--size-large{border-radius:calc(var(--td-button-large-height,96rpx)/ 2);}
.t-button--round.t-button--size-large::after{border-radius:var(--td-button-large-height,96rpx);}
.t-button--round.t-button--size-medium{border-radius:calc(var(--td-button-medium-height,80rpx)/ 2);}
.t-button--round.t-button--size-medium::after{border-radius:var(--td-button-medium-height,80rpx);}
.t-button--round.t-button--size-small{border-radius:calc(var(--td-button-small-height,64rpx)/ 2);}
.t-button--round.t-button--size-small::after{border-radius:var(--td-button-small-height,64rpx);}
.t-button--round.t-button--size-extra-small{border-radius:calc(var(--td-button-extra-small-height,56rpx)/ 2);}
.t-button--round.t-button--size-extra-small::after{border-radius:var(--td-button-extra-small-height,56rpx);}
.t-button--square{padding:0;}
.t-button--square.t-button--size-large{width:var(--td-button-large-height,96rpx);}
.t-button--square.t-button--size-medium{width:var(--td-button-medium-height,80rpx);}
.t-button--square.t-button--size-small{width:var(--td-button-small-height,64rpx);}
.t-button--square.t-button--size-extra-small{width:var(--td-button-extra-small-height,56rpx);}
.t-button--circle{padding:0;border-radius:50%;}
.t-button--circle.t-button--size-large{width:var(--td-button-large-height,96rpx);}
.t-button--circle.t-button--size-large::after{border-radius:50%;}
.t-button--circle.t-button--size-medium{width:var(--td-button-medium-height,80rpx);}
.t-button--circle.t-button--size-medium::after{border-radius:50%;}
.t-button--circle.t-button--size-small{width:var(--td-button-small-height,64rpx);}
.t-button--circle.t-button--size-small::after{border-radius:50%;}
.t-button--circle.t-button--size-extra-small{width:var(--td-button-extra-small-height,56rpx);}
.t-button--circle.t-button--size-extra-small::after{border-radius:50%;}
.t-button--block{display:flex;width:100%;}
.t-button--disabled{cursor:not-allowed;}
.t-button__loading--wrapper{display:flex;align-items:center;justify-content:center;}
.t-button.t-button--hover::after{z-index:-1;}

View File

@@ -1,3 +0,0 @@
export * from './props';
export * from './type';
export * from './button';

View File

@@ -1 +0,0 @@
export*from"./props";export*from"./type";export*from"./button";

View File

@@ -1,3 +0,0 @@
import { TdButtonProps } from './type';
declare const props: TdButtonProps;
export default props;

View File

@@ -1 +0,0 @@
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"},tId:{type:String,value:""},theme:{type:String,value:"default"},type:{type:String},variant:{type:String,value:"base"}};export default props;

View File

@@ -1,111 +0,0 @@
import { LoadingProps } from '../loading/index';
export interface TdButtonProps {
appParameter?: {
type: StringConstructor;
value?: string;
};
block?: {
type: BooleanConstructor;
value?: boolean;
};
content?: {
type: StringConstructor;
value?: string;
};
customDataset?: {
type: null;
value?: null;
};
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
ghost?: {
type: BooleanConstructor;
value?: boolean;
};
hoverClass?: {
type: StringConstructor;
value?: string;
};
hoverStartTime?: {
type: NumberConstructor;
value?: number;
};
hoverStayTime?: {
type: NumberConstructor;
value?: number;
};
hoverStopPropagation?: {
type: BooleanConstructor;
value?: boolean;
};
icon?: {
type: null;
value?: string | object;
};
lang?: {
type: StringConstructor;
value?: 'en' | 'zh_CN' | 'zh_TW';
};
loading?: {
type: BooleanConstructor;
value?: boolean;
};
loadingProps?: {
type: ObjectConstructor;
value?: LoadingProps;
};
openType?: {
type: StringConstructor;
value?: 'contact' | 'share' | 'getPhoneNumber' | 'getUserInfo' | 'launchApp' | 'openSetting' | 'feedback' | 'chooseAvatar' | 'agreePrivacyAuthorization';
};
phoneNumberNoQuotaToast?: {
type: BooleanConstructor;
value?: boolean;
};
sendMessageImg?: {
type: StringConstructor;
value?: string;
};
sendMessagePath?: {
type: StringConstructor;
value?: string;
};
sendMessageTitle?: {
type: StringConstructor;
value?: string;
};
sessionFrom?: {
type: StringConstructor;
value?: string;
};
shape?: {
type: StringConstructor;
value?: 'rectangle' | 'square' | 'round' | 'circle';
};
showMessageCard?: {
type: BooleanConstructor;
value?: boolean;
};
size?: {
type: StringConstructor;
value?: 'extra-small' | 'small' | 'medium' | 'large';
};
tId?: {
type: StringConstructor;
value?: string;
};
theme?: {
type: StringConstructor;
value?: 'default' | 'primary' | 'danger' | 'light';
};
type?: {
type: StringConstructor;
value?: 'submit' | 'reset';
};
variant?: {
type: StringConstructor;
value?: 'base' | 'outline' | 'dashed' | 'text';
};
}

View File

@@ -1 +0,0 @@
<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>

View File

@@ -1,63 +0,0 @@
/// <reference types="miniprogram-api-typings" />
import { SuperComponent } from '../common/src/index';
import { TdCalendarProps } from './type';
export interface CalendarProps extends TdCalendarProps {
}
export default class Calendar extends SuperComponent {
behaviors: string[];
externalClasses: string[];
options: WechatMiniprogram.Component.ComponentOptions;
properties: TdCalendarProps;
data: {
prefix: string;
classPrefix: string;
months: any[];
scrollIntoView: string;
innerConfirmBtn: {};
realLocalText: {};
currentMonth: {};
actionButtons: {
preYearBtnDisable: boolean;
prevMonthBtnDisable: boolean;
nextMonthBtnDisable: boolean;
nextYearBtnDisable: boolean;
};
};
controlledProps: {
key: string;
event: string;
}[];
lifetimes: {
created(): void;
ready(): void;
};
observers: {
type(v: any): void;
confirmBtn(v: any): void;
'firstDayOfWeek,minDate,maxDate'(firstDayOfWeek: any, minDate: any, maxDate: any): void;
value(v: any): void;
visible(v: any): void;
format(v: any): void;
};
methods: {
initialValue(): void;
scrollIntoView(): void;
getCurrentYearAndMonth(v: Date): {
year: number;
month: number;
};
updateActionButton(value: Date): void;
updateCurrentMonth(newValue?: any): void;
calcCurrentMonth(newValue?: any): void;
calcMonths(): void;
close(trigger: any): void;
onVisibleChange(): void;
handleClose(): void;
handleSelect(e: any): void;
onTplButtonTap(): void;
toTime(val: any): any;
onScroll(e: any): void;
getCurrentDate(): any;
handleSwitchModeChange(e: any): void;
};
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
{"component":true,"styleIsolation":"apply-shared","usingComponents":{"t-popup":"../popup/popup","t-button":"../button/button","t-icon":"../icon/icon"}}

View File

@@ -1 +0,0 @@
<wxs src="./calendar.wxs" module="_this"/><wxs src="../common/utils.wxs" module="_"/><t-popup wx:if="{{usePopup}}" class="class" visible="{{visible}}" usingCustomNavbar="{{usingCustomNavbar}}" bind:visible-change="onVisibleChange" placement="bottom"><include src="./template.wxml"/></t-popup><block wx:else><include src="./template.wxml"/></block>

View File

@@ -1,44 +0,0 @@
function getDateLabel(monthItem, dateItem) {
var weekdayText = ['日', '一', '二', '三', '四', '五', '六'];
var weekday = (monthItem.weekdayOfFirstDay + dateItem.day - 1) % 7;
var label = monthItem.month + 1 + '月' + dateItem.day + '日, 星期' + weekdayText[weekday];
if (dateItem.type === 'start') {
label = '开始日期:' + label;
}
if (dateItem.type === 'end') {
label = '结束日期:' + label;
}
if (isDateSelected(dateItem)) {
label = '已选中, ' + label;
}
if (dateItem.prefix) {
label += ', ' + dateItem.prefix;
}
if (dateItem.suffix) {
label += ', ' + dateItem.suffix;
}
return label;
}
function isDateSelected(dateItem) {
return ['start', 'end', 'selected', 'centre'].indexOf(dateItem.type) >= 0;
}
function getMonthTitle(year, month, pattern = '') {
// prettier-ignore
var REGEXP = getRegExp('\{year\}|\{month\}', 'g');
return pattern.replace(REGEXP, function (match) {
var replacements = {
'{year}': year,
'{month}': month < 10 ? '0' + month : month,
};
return replacements[match] || match;
});
}
module.exports = {
getDateLabel: getDateLabel,
isDateSelected: isDateSelected,
getMonthTitle: getMonthTitle,
};

View File

@@ -1,39 +0,0 @@
@import '../common/style/index.wxss';.t-calendar{width:inherit;position:relative;z-index:9999;background:var(--td-calendar-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));overflow-x:hidden;}
.t-calendar--popup{border-top-left-radius:var(--td-calendar-radius,24rpx);border-top-right-radius:var(--td-calendar-radius,24rpx);}
.t-calendar__title{display:flex;align-items:center;justify-content:center;font-size:var(--td-calendar-title-font-size,18px);font-weight:600;color:var(--td-calendar-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));height:52rpx;padding:32rpx;}
.t-calendar__title:focus{outline:0;}
.t-calendar__close-btn{position:absolute;top:32rpx;right:32rpx;margin:-24rpx;padding:24rpx;color:var(--td-calendar-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
.t-calendar__days{display:grid;grid-template-columns:repeat(7,1fr);grid-column-gap:8rpx;padding:0 32rpx;text-align:center;line-height:92rpx;}
.t-calendar__days-item{height:92rpx;font-size:28rpx;color:var(--td-calendar-days-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));}
.t-calendar__content{min-height:400rpx;display:flex;flex-direction:column;}
.t-calendar__month{font-size:28rpx;color:var(--td-calendar-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));font-weight:600;padding:32rpx 0 0;}
.t-calendar__months{height:712rpx;padding:0 32rpx 32rpx;box-sizing:border-box;}
.t-calendar__months::-webkit-scrollbar{display:none;}
.t-calendar__dates{flex:1;display:grid;grid-template-columns:repeat(7,1fr);grid-column-gap:8rpx;}
.t-calendar__dates-item{position:relative;display:flex;align-items:center;justify-content:center;font-size:32rpx;border-radius:var(--td-calendar-selected-border-radius,var(--td-radius-default,12rpx));height:120rpx;line-height:48rpx;font-weight:600;margin-top:16rpx;color:var(--td-calendar-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));cursor:pointer;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;user-select:none;}
.t-calendar__dates-item-prefix,.t-calendar__dates-item-suffix{position:absolute;font-size:20rpx;line-height:32rpx;width:100%;text-align:center;font-weight:400;}
.t-calendar__dates-item-prefix{top:8rpx;}
.t-calendar__dates-item-suffix{bottom:8rpx;color:var(--td-calendar-item-suffix-color,var(--td-text-color-placeholder,var(--td-font-gray-3,rgba(0,0,0,.4))));}
.t-calendar__dates-item-suffix--end,.t-calendar__dates-item-suffix--selected,.t-calendar__dates-item-suffix--start{color:var(--td-calendar-selected-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));}
.t-calendar__dates-item-suffix--disabled{color:var(--td-calendar-item-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
.t-calendar__dates-item--end,.t-calendar__dates-item--selected,.t-calendar__dates-item--start{background:var(--td-calendar-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));color:var(--td-calendar-selected-color,var(--td-text-color-anti,var(--td-font-white-1,#fff)));border-radius:var(--td-calendar-selected-border-radius,var(--td-radius-default,12rpx));}
.t-calendar__dates-item--start{border-radius:var(--td-calendar-selected-border-radius,var(--td-radius-default,12rpx)) 0 0 var(--td-calendar-selected-border-radius,var(--td-radius-default,12rpx));}
.t-calendar__dates-item--end{border-radius:0 var(--td-calendar-selected-border-radius,var(--td-radius-default,12rpx)) var(--td-calendar-selected-border-radius,var(--td-radius-default,12rpx)) 0;}
.t-calendar__dates-item--start+.t-calendar__dates-item--end::before{content:'';display:block;position:absolute;top:0;width:8rpx;height:100%;background:var(--td-calendar-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-calendar__dates-item--start+.t-calendar__dates-item--end:before{left:-8rpx;}
.t-calendar__dates-item--centre{border-radius:0;background-color:var(--td-calendar-item-centre-color,var(--td-brand-color-light,var(--td-primary-color-1,#f2f3ff)));}
.t-calendar__dates-item--centre::after,.t-calendar__dates-item--centre::before{content:'';display:block;position:absolute;top:0;width:8rpx;height:100%;background-color:var(--td-calendar-item-centre-color,var(--td-brand-color-light,var(--td-primary-color-1,#f2f3ff)));}
.t-calendar__dates-item--centre:before{left:-8rpx;}
.t-calendar__dates-item--centre:after{right:-8rpx;}
.t-calendar__dates-item--disabled{color:var(--td-calendar-item-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));cursor:default;}
.t-calendar__footer{padding:32rpx;}
.t-calendar-switch-mode--none>.t-calendar__months{height:60vh;}
.t-calendar-header{display:flex;justify-content:space-between;align-items:center;line-height:44rpx;}
.t-calendar-header__with-action{padding:0rpx 32rpx 16rpx 32rpx;box-sizing:border-box;position:relative;}
.t-calendar-header__with-action::after{content:'';display:block;position:absolute;top:unset;bottom:0;left:unset;right:unset;background-color:var(--td-border-color,var(--td-gray-color-3,#e7e7e7));}
.t-calendar-header__with-action::after{height:1px;left:0;right:0;transform:scaleY(.5);}
.t-calendar-header__with-action .t-calendar-header__title{flex:1;text-align:center;font-size:28rpx;font-weight:600;}
.t-calendar-header__action{display:flex;font-size:40rpx;color:var(--td-calendar-switch-mode-icon-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));}
.t-calendar-header__icon{padding:16rpx;}
.t-calendar-header__icon--disabled{color:var(--td-calendar-switch-mode-icon-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
.t-calendar-header__title{text-align:left;}

View File

@@ -1,2 +0,0 @@
export * from './type';
export * from './calendar';

View File

@@ -1 +0,0 @@
export*from"./type";export*from"./calendar";

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