首次完整推送,
V:1.20240808.006
This commit is contained in:
28
uni_modules/uni-cms-article/common/parse-scan-result.uts
Normal file
28
uni_modules/uni-cms-article/common/parse-scan-result.uts
Normal file
@ -0,0 +1,28 @@
|
||||
function parseScanResult (scanText: string): void {
|
||||
const match = scanText.match(/^(.*?):\/\/(.*)/)
|
||||
|
||||
if (!match || match.length < 1) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '未能识别到有效信息'
|
||||
})
|
||||
}
|
||||
|
||||
const [, protocol, path] = match
|
||||
|
||||
switch (protocol) {
|
||||
case "internallink":
|
||||
uni.navigateTo({
|
||||
url: `/${path.replace(/^\//, '')}`,
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
icon: "none",
|
||||
title: "访问的路径不存在"
|
||||
})
|
||||
}
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
export default parseScanResult
|
Reference in New Issue
Block a user