|
|
@@ -8,9 +8,14 @@ import {
|
|
|
YTLog,
|
|
|
yTRouter
|
|
|
} from 'basic'
|
|
|
-import { common, Want } from '@kit.AbilityKit'
|
|
|
+import { Want } from '@kit.AbilityKit'
|
|
|
import { BusinessError } from '@kit.BasicServicesKit'
|
|
|
import { BUNDLE_NAME } from 'BuildProfile'
|
|
|
+import { image } from '@kit.ImageKit'
|
|
|
+import { systemShare } from '@kit.ShareKit'
|
|
|
+import { common } from '@kit.AbilityKit'
|
|
|
+import { uniformTypeDescriptor } from '@kit.ArkData';
|
|
|
+
|
|
|
|
|
|
@Component
|
|
|
export struct Mine {
|
|
|
@@ -21,7 +26,7 @@ export struct Mine {
|
|
|
text: '分享给好友',
|
|
|
message: '去分享',
|
|
|
click: () => {
|
|
|
-
|
|
|
+ this.share()
|
|
|
},
|
|
|
src: $r('app.media.right_arrow')
|
|
|
},
|
|
|
@@ -63,6 +68,31 @@ export struct Mine {
|
|
|
}
|
|
|
]
|
|
|
|
|
|
+
|
|
|
+ private async share() {
|
|
|
+ try {
|
|
|
+ // 构造ShareData,需配置一条有效数据信息
|
|
|
+ const data = new systemShare.SharedData({
|
|
|
+ // utd: uniformTypeDescriptor.UniformDataType.HYPERLINK,
|
|
|
+ utd: uniformTypeDescriptor.UniformDataType.TEXT,
|
|
|
+ title: '朝暮日记',
|
|
|
+ content: 'http://appgallery.huawei.com/app/detail?id=6917582300519105855',
|
|
|
+ description: "http://appgallery.huawei.com/app/detail?id=6917582300519105855"
|
|
|
+ })
|
|
|
+ const controller = new systemShare.ShareController(data)
|
|
|
+ const context = this.getUIContext().getHostContext()! as common.UIAbilityContext;
|
|
|
+ // 进行分享面板显示
|
|
|
+ controller.show(context, {
|
|
|
+ previewMode: systemShare.SharePreviewMode.DEFAULT,
|
|
|
+ selectionMode: systemShare.SelectionMode.SINGLE,
|
|
|
+ // anchor: { windowOffset: { x: 0, y: 0 }, size: { width: this.breakWidth, height: 500 } }
|
|
|
+ })
|
|
|
+ } catch (error) {
|
|
|
+ IBestToast.show({ message: '当前设备不支持', duration: 500 })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private linearInfo: LinearGradientOptions = {
|
|
|
colors: [ ['#B9FD2A', 0.01], ['#F5FD6D', 1] ],
|
|
|
angle: 110
|
|
|
@@ -78,7 +108,7 @@ export struct Mine {
|
|
|
.height(212)
|
|
|
|
|
|
// 主体
|
|
|
- Column(){
|
|
|
+ Column({space: 20}){
|
|
|
// 头像 + 编辑按钮
|
|
|
Column(){
|
|
|
// 头像
|