Pārlūkot izejas kodu

1.修复微信调起小程序的bug

tags/0.0.9+2
“yanghuaxuan” pirms 3 gadiem
vecāks
revīzija
8389ea1514
4 mainītis faili ar 41 papildinājumiem un 32 dzēšanām
  1. +24
    -22
      lib/pages/goods_share_page/goods_share_miniprogram/goods_share_miniprogram.dart
  2. +2
    -1
      lib/pages/goods_share_page/goods_share_page.dart
  3. +6
    -6
      lib/pages/goods_share_page/widgets/goods_share_miniprogram_widget.dart
  4. +9
    -3
      lib/widgets/share/share_alert.dart

+ 24
- 22
lib/pages/goods_share_page/goods_share_miniprogram/goods_share_miniprogram.dart Parādīt failu

@@ -10,6 +10,8 @@ import 'package:zhiying_base_widget/widgets/public/custom_button/custom_bottom.d
import 'package:zhiying_base_widget/widgets/public/custom_button/custom_button_model.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:sharesdk_plugin/sharesdk_plugin.dart';
import 'package:fluwx/fluwx.dart';

class GoodsShareMiniprogram extends StatefulWidget {
final Map<String, dynamic> model;
@@ -17,9 +19,7 @@ class GoodsShareMiniprogram extends StatefulWidget {

final String shareType;

const GoodsShareMiniprogram(this.model, this.params, this.shareType,
{Key key})
: super(key: key);
const GoodsShareMiniprogram(this.model, this.params, this.shareType, {Key key}) : super(key: key);

@override
_GoodsShareMiniprogramState createState() => _GoodsShareMiniprogramState();
@@ -30,8 +30,7 @@ class _GoodsShareMiniprogramState extends State<GoodsShareMiniprogram> {
Widget build(BuildContext context) {
return BlocProvider<GoodsShareContentBloc>(
bloc: GoodsShareContentBloc(),
child: _GoodsShareMiniprogramContent(
widget.model, widget.params, widget.shareType),
child: _GoodsShareMiniprogramContent(widget.model, widget.params, widget.shareType),
);
}
}
@@ -41,18 +40,13 @@ class _GoodsShareMiniprogramContent extends StatefulWidget {
final Map<String, dynamic> params;
final String shareType;

const _GoodsShareMiniprogramContent(this.model, this.params, this.shareType,
{Key key})
: super(key: key);
const _GoodsShareMiniprogramContent(this.model, this.params, this.shareType, {Key key}) : super(key: key);

@override
_GoodsShareMiniprogramContentState createState() =>
_GoodsShareMiniprogramContentState();
_GoodsShareMiniprogramContentState createState() => _GoodsShareMiniprogramContentState();
}

class _GoodsShareMiniprogramContentState
extends State<_GoodsShareMiniprogramContent>
with AutomaticKeepAliveClientMixin {
class _GoodsShareMiniprogramContentState extends State<_GoodsShareMiniprogramContent> with AutomaticKeepAliveClientMixin {
GoodsShareImageModel _style;
Map<int, String> _images = Map();
List<Widget> widgets = List();
@@ -86,11 +80,7 @@ class _GoodsShareMiniprogramContentState
child: Container(
margin: EdgeInsets.only(bottom: 4),
padding: EdgeInsets.only(top: 10),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8))),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.only(bottomLeft: Radius.circular(8), bottomRight: Radius.circular(8))),
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -127,8 +117,7 @@ class _GoodsShareMiniprogramContentState
}
// CustomButtonModel btnCopy = CustomButtonModel.fromJson(
// Map<String, dynamic>.from(shareImages['copy_btn']));
CustomButtonModel btnShare = CustomButtonModel.fromJson(
Map<String, dynamic>.from(shareImages['share_btn']));
CustomButtonModel btnShare = CustomButtonModel.fromJson(Map<String, dynamic>.from(shareImages['share_btn']));
return SafeArea(
child: Container(
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4),
@@ -147,8 +136,8 @@ class _GoodsShareMiniprogramContentState
),
child: CustomButton(btnShare)),
onTap: () {
print(data);
LauncherWxMiniProgram.open(data.toJson());
print(data.toJson());
_shareMini(data);
},
),
],
@@ -156,4 +145,17 @@ class _GoodsShareMiniprogramContentState
),
);
}

void _shareMini(GoodsShareTempDataModel data) {
WeChatShareMiniProgramModel shareMiniProgramModel = WeChatShareMiniProgramModel(
miniProgramType: WXMiniProgramType.RELEASE,
userName: data?.userName,
webPageUrl: data?.page,
path: data?.page,
title: data?.miniAppTitle,
thumbnail: WeChatImage.network(data?.imageUrl));

shareToWeChat(shareMiniProgramModel);

}
}

+ 2
- 1
lib/pages/goods_share_page/goods_share_page.dart Parādīt failu

@@ -49,9 +49,10 @@ class _GoodsShareContainerState extends State<_GoodsShareContainer>
// Map<String, dynamic> data =
// Map<String, dynamic>.from(convert.jsonDecode(d));
Map<String, dynamic> data = widget.model;
Logger.debug(data['share_url_args'].toString());
Logger.debug(data.toString());
_bloc = BlocProvider.of<GoodsShareBloc>(context);
_params = data['share_url_args'];
_params['good_id']=data['good_id'];
_bloc.loadData('taobao', _params);
super.initState();
}


+ 6
- 6
lib/pages/goods_share_page/widgets/goods_share_miniprogram_widget.dart Parādīt failu

@@ -56,12 +56,12 @@ class GoodsShareMiniprogramWidget extends StatelessWidget {
),
Row(
children: <Widget>[
Container(
margin: EdgeInsets.only(right: 6),
width: 15,
height: 15,
// color: Colors.redAccent,
),
// Container(
// margin: EdgeInsets.only(right: 6),
// width: 15,
// height: 15,
// // color: Colors.redAccent,
// ),
Text(
'小程序',
style: TextStyle(fontSize: 11, color: Color(0xff333333)),


+ 9
- 3
lib/widgets/share/share_alert.dart Parādīt failu

@@ -270,9 +270,9 @@ class _ShareAlertContentState extends State<_ShareAlertContent> {
} else {
var type = SSDKContentTypes.auto;

if (widget?.model?.image?.length!=0 && widget.model?.url != null) {
if (widget?.model?.image?.length != 0 && widget.model?.url != null) {
type = SSDKContentTypes.webpage;
} else if (widget?.model?.image?.length!=0) {
} else if (widget?.model?.image?.length != 0) {
type = SSDKContentTypes.image;
} else if (widget?.model?.title != null || widget.model?.content != null) {
type = SSDKContentTypes.text;
@@ -282,12 +282,18 @@ class _ShareAlertContentState extends State<_ShareAlertContent> {
type = SSDKContentTypes.message;
}

var isExistImage = false;

if (widget?.model?.image != null && widget?.model?.image?.length > 0) {
isExistImage = true;
}

params = SSDKMap()
..setGeneral(
widget.model?.title ?? '',
widget?.model?.content ?? '',
Platform.isIOS ? widget.model.image : null,
Platform.isAndroid ? widget?.model?.image?.first : null,
Platform.isAndroid ? (isExistImage ? widget?.model?.image?.first : null) : null,
null,
widget.model.url,
null,


Notiek ielāde…
Atcelt
Saglabāt