Skip to content

Commit 97ab064

Browse files
committed
feat(index): 添加 TIM 最新版本获取和分享功能
- 新增 getTimNewestLink 方法获取 TIM 最新版本下载链接 - 优化版本信息展示,添加下载链接和分享文案 - 调整版本卡片样式,增加复制链接和分享按钮 - 优化文本样式,使用 pre-wrap 和 break-all 保持空格和换行
1 parent c0afeee commit 97ab064

File tree

5 files changed

+84
-14
lines changed

5 files changed

+84
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ QQNT 技术架构是腾讯 QQ 客户端全新的跨平台技术架构体系。QQ
194194
195195
### 什么是 Kuikly?
196196
197-
Kuikly(Kotlin UI Kit)开发框架,是 TDS 腾讯端服务(Tencent Device-oriented Service)的一部分。Kuikly 通过自研 Kotlin MultiPlatform 逻辑与终端界面原生控件渲染映射协议层,并采用声明式与响应式设计,使采用 Kuikly 的 Kotlin 开发者能拥有原生高效的 Android 开发体验并构建具有原生性能的跨平台应用。Kuikly 更可依托于 [TDS 腾讯端服务 Shiply 容器与发布平台](https://shiply.tds.qq.com/),实现按页颗粒度的完备客户端界面动态化能力。
197+
Kuikly(Kotlin UI Kit)跨端开发框架,是 TDS 腾讯端服务(Tencent Device-oriented Service)的一部分。Kuikly 通过自研 Kotlin MultiPlatform 逻辑与终端界面原生控件渲染映射协议层,并采用声明式与响应式设计,使采用 Kuikly 的 Kotlin 开发者能拥有原生高效的 Android 开发体验并构建具有原生性能的跨平台应用。Kuikly 更可依托于 [TDS 腾讯端服务 Shiply 容器与发布平台](https://shiply.tds.qq.com/),实现按页颗粒度的完备客户端界面动态化能力。
198198
199199
## 其它
200200

source/app.wxss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
}
5252

5353
.t-result__description {
54-
word-break: break-word;
54+
white-space: pre-wrap;
55+
word-break: break-all;
5556
}
5657

5758
.t-message__text {
@@ -91,4 +92,3 @@ page {
9192
background-color: #181818;
9293
}
9394
}
94-

source/pages/index/index.js

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ Page({
7272
onWeTypeGet: false,
7373
expBackLinks: [],
7474
expBackJson: "",
75-
fontHeavySliderMarks: {0: 'Light', 1: 'Regular', 2: 'Bold'}
75+
fontHeavySliderMarks: {0: 'Light', 1: 'Regular', 2: 'Bold'},
76+
getTimNewestLinkLoading: false,
7677
}, onLoad: function () {
7778
this.setData({
7879
theme: wx.getAppBaseInfo().theme || 'light',
@@ -306,6 +307,7 @@ Page({
306307
let responseData = res.data;
307308
const jsonString = responseData.substring(responseData.indexOf('var params= ') + 12, responseData.lastIndexOf(";\n" + " typeof"));
308309
const jsonData = JSON.parse(jsonString);
310+
const androidLink = jsonData.app.download.androidLink;
309311
const timVersionList = [];
310312
timVersionList.push({
311313
version: jsonData.app.download.androidVersion,
@@ -320,7 +322,8 @@ Page({
320322
datetime: jsonData.app.download.androidDatetime,
321323
fix: "",
322324
new: ""
323-
}
325+
},
326+
link: ""
324327
});
325328

326329
// 从 latest 项中获取 Android 版本
@@ -336,7 +339,8 @@ Page({
336339
isKuiklyInside: semver.gte(item.version, getApp().globalData.EARLIEST_KUIKLY_FRAMEWORK_TIM_VERSION_STABLE),
337340
jsonString: {
338341
version: item.version, datetime: item.datetime, fix: item.fix, new: item.new
339-
}
342+
},
343+
link: ""
340344
});
341345
}
342346
});
@@ -358,7 +362,8 @@ Page({
358362
datetime: logItem.datetime,
359363
fix: logItem.fix,
360364
new: logItem.new
361-
}
365+
},
366+
link: ""
362367
});
363368
}
364369
});
@@ -368,6 +373,16 @@ Page({
368373
const uniqueTIMVersionList = [...new Map(timVersionList.map(item => [JSON.stringify(item.jsonString), item])).values()];
369374
if (uniqueTIMVersionList[0].version === uniqueTIMVersionList[1].version) uniqueTIMVersionList.shift()
370375

376+
uniqueTIMVersionList[0].link = androidLink
377+
const parsedJson = JSON.parse(JSON.stringify(uniqueTIMVersionList[0].jsonString));
378+
uniqueTIMVersionList[0].jsonString = {
379+
version: parsedJson.version,
380+
datetime: parsedJson.datetime,
381+
fix: parsedJson.fix,
382+
new: parsedJson.new,
383+
link: androidLink
384+
};
385+
371386
this.setData({
372387
timVersions: uniqueTIMVersionList
373388
});
@@ -1501,7 +1516,8 @@ Page({
15011516
expJsonBackTitle: "微信输入法测试通道获取结果",
15021517
expJsonBackResultTitle: "获取成功",
15031518
expBackStatus: "success",
1504-
getFromWeTypeLatestChannelLoading: false
1519+
getFromWeTypeLatestChannelLoading: false,
1520+
expShareText: ""
15051521
}); else this.setData({
15061522
successExpBackLink: url,
15071523
succeedExpBackFileSizeShare: "(似乎未成功访问此下载地址,可能是微信输入法当前测试版已撤包。)",
@@ -1510,7 +1526,8 @@ Page({
15101526
expJsonBackTitle: "微信输入法测试通道获取结果",
15111527
expJsonBackResultTitle: "疑似撤包",
15121528
expBackStatus: "default",
1513-
getFromWeTypeLatestChannelLoading: false
1529+
getFromWeTypeLatestChannelLoading: false,
1530+
expShareText: ""
15141531
});
15151532
}).catch(err => {
15161533
console.error(err);
@@ -1532,5 +1549,47 @@ Page({
15321549
this.setData({
15331550
expBackWithUrlOnlyVisible: e.detail.visible
15341551
})
1535-
},
1552+
}, getTimNewestLink() {
1553+
const url = this.data.timVersions[0].link
1554+
this.setData({
1555+
getTimNewestLinkLoading: true
1556+
});
1557+
this.fetchLink(url).then(isSuccess => {
1558+
if (isSuccess.exists && isSuccess.fileSize !== false) {
1559+
this.setData({
1560+
successExpBackLink: url,
1561+
succeedExpBackFileSizeShare: `(大小:${isSuccess.fileSize} MB)`,
1562+
expVisible: false,
1563+
expBackWithUrlOnlyVisible: true,
1564+
expJsonBackTitle: `TIM ${this.data.timVersions[0].version} 正式版`,
1565+
expJsonBackResultTitle: "获取成功",
1566+
expBackStatus: "success",
1567+
getTimNewestLinkLoading: false
1568+
});
1569+
this.setData({
1570+
expShareText: `Android TIM ${this.data.timVersions[0].version} 正式版${this.data.succeedExpBackFileSizeShare}\n\n下载地址:${url}`
1571+
})
1572+
} else {
1573+
this.setData({
1574+
successExpBackLink: url,
1575+
succeedExpBackFileSizeShare: "",
1576+
expVisible: false,
1577+
expBackWithUrlOnlyVisible: true,
1578+
expJsonBackTitle: `TIM ${this.data.timVersions[0].version} 正式版`,
1579+
expJsonBackResultTitle: "获取成功",
1580+
expBackStatus: "success",
1581+
getTimNewestLinkLoading: false
1582+
});
1583+
this.setData({
1584+
expShareText: `Android TIM ${this.data.timVersions[0].version} 正式版\n\n下载地址:${url}`
1585+
})
1586+
}
1587+
}).catch(err => {
1588+
console.error(err);
1589+
const errorMessage = err.errMsg;
1590+
this.setData({
1591+
errorText: errorMessage, errorVisible: true, getTimNewestLinkLoading: false
1592+
});
1593+
});
1594+
}
15361595
})

source/pages/index/index.wxml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ See the Mulan PubL v2 for more details.
4949
<t-icon name="" prefix="kuikly-logo-src" size="30rpx" slot="icon"
5050
style="margin-left: 6rpx;" wx:if="{{item.isKuiklyInside&&KuiklySwitch}}"/>
5151
</view>
52-
<view slot="note">
52+
<view slot="note" style="display: flex;justify-content: center;align-items: center">
53+
<t-button icon="link" shape="square" size="small" style="visibility: hidden"
54+
theme="light"/>
5355
<t-tag icon="{{null}}" size="small" style="margin-left: 12rpx;" theme="primary"
5456
variant="light" wx:if="{{item.isAccessibility}}">
5557
<t-icon name="accessibility_new" prefix="material-symbols-outlined" size="28rpx"
@@ -87,7 +89,10 @@ See the Mulan PubL v2 for more details.
8789
<t-icon name="" prefix="kuikly-logo-src" size="30rpx" slot="icon"
8890
style="margin-left: 6rpx;" wx:if="{{item.isKuiklyInside&&KuiklySwitch}}"/>
8991
</view>
90-
<view slot="note">
92+
<view slot="note" style="display: flex;justify-content: center;align-items: center">
93+
<t-button bind:tap="getTimNewestLink" disabled="{{getTimNewestLinkLoading===true}}" icon="link" shape="square"
94+
size="small"
95+
style="visibility: {{item.link===''?'hidden':'visible'}}" theme="light"/>
9196
<t-tag icon="{{null}}" size="small" style="margin-left: 12rpx;" theme="primary"
9297
variant="light" wx:if="{{item.isAccessibility}}">
9398
<t-icon name="accessibility_new" prefix="material-symbols-outlined" size="28rpx"
@@ -139,7 +144,7 @@ See the Mulan PubL v2 for more details.
139144
<view class="about-title" id="ability-about">关于</view>
140145
</view>
141146
<view class="about-text" style="margin: 0 48rpx 12rpx 48rpx;">QQ 版本列表 Vigor for WeChat MiniProgram</view>
142-
<view class="about-text" style="margin: 12rpx; padding: 0 36rpx;">版本:1.1.7</view>
147+
<view class="about-text" style="margin: 12rpx; padding: 0 36rpx;">版本:1.1.8</view>
143148
<view class="about-text" style="margin: 12rpx; padding: 0 36rpx;">作者:快乐小牛、有鲫雪狐</view>
144149
<view class="about-text" style="margin: 12rpx; padding: 0 36rpx 12rpx 36rpx;">Since 2024.03.12</view>
145150
<view class="TD_and_MulanPubLv2">
@@ -536,7 +541,8 @@ See the Mulan PubL v2 for more details.
536541
<view class="guess-success-title" id="ability-personalization">个性化</view>
537542
</view>
538543
<t-cell bordered title="版本卡片显示匹配的 TDS 腾讯端服务 Kuikly 开发框架标识">
539-
<t-switch bind:change="handleKuiklyChange" slot="note" style="margin: 0 0 0 48rpx;" value="{{KuiklySwitch}}"/>
544+
<t-switch bind:change="handleKuiklyChange" slot="note" style="margin: 0 0 0 48rpx;"
545+
value="{{KuiklySwitch}}"/>
540546
</t-cell>
541547
<t-cell bordered description="虚幻引擎内置情况以 QQ 正式版为判断来源" title="版本卡片显示匹配的虚幻引擎标识">
542548
<t-switch bind:change="handleUEChange" slot="note" style="margin: 0 0 0 48rpx;" value="{{UESwitch}}"/>
@@ -711,6 +717,10 @@ See the Mulan PubL v2 for more details.
711717
<t-result description="{{successExpBackLink+succeedExpBackFileSizeShare}}" theme="{{expBackStatus}}"
712718
title="{{expJsonBackResultTitle}}"/>
713719
</view>
720+
<view class="about-link" wx:if="{{expShareText!==''}}">
721+
<t-link bind:tap="copyExpBackShare" content="复制分享文案" hover prefix-icon="share" size="medium"
722+
theme="primary"/>
723+
</view>
714724
<view class="guess-success-button-top">
715725
<t-button bind:tap="copyExpBack" block size="large" theme="primary">复制链接</t-button>
716726
</view>

source/pages/index/index.wxss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158

159159
.json-text {
160160
white-space: pre-wrap;
161+
word-break: break-all;
161162
}
162163

163164
.header-title {

0 commit comments

Comments
 (0)