diff --git a/android/app/build.gradle b/android/app/build.gradle
index 3f4e7beb..0981cf9f 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -98,6 +98,8 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5'
+
implementation fileTree(include: ['*.aar'], dir: 'libs')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
diff --git a/android/app/libs/wechat-sdk-android-without-mta-6.6.5.aar b/android/app/libs/wechat-sdk-android-without-mta-6.6.5.aar
deleted file mode 100644
index 43719c13..00000000
Binary files a/android/app/libs/wechat-sdk-android-without-mta-6.6.5.aar and /dev/null differ
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 1fcdf9a2..b4781f76 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -60,12 +60,19 @@
+
+ android:launchMode="singleTop" >
+
+
+
+
+
+
+
diff --git a/android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt b/android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt
index 0c183201..3a0174fc 100644
--- a/android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt
+++ b/android/app/src/main/kotlin/com/zsw/huixiang/wxapi/WXPayEntryActivity.kt
@@ -1,29 +1,86 @@
package com.zsw.huixiang.wxapi
+import android.content.Intent
+import android.content.pm.PackageManager
import android.os.Bundle
import android.util.Log
+import com.jarvan.fluwx.handlers.FluwxRequestHandler
+import com.jarvan.fluwx.handlers.FluwxResponseHandler
+import com.jarvan.fluwx.handlers.WXAPiHandler
import com.tencent.mm.opensdk.modelbase.BaseReq
import com.tencent.mm.opensdk.modelbase.BaseResp
import io.dcloud.feature.payment.weixin.AbsWXPayCallbackActivity
class WXPayEntryActivity : AbsWXPayCallbackActivity() {
-
-
+
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
+ try {
+ if (!WXAPiHandler.wxApiRegistered) {
+ var appInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
+ val wechatAppId = appInfo.metaData.getString("weChatAppId")
+ if (wechatAppId != null ){
+ WXAPiHandler.setupWxApi(wechatAppId, this)
+ WXAPiHandler.setCoolBool(true)
+ io.flutter.Log.d("fluwx", "weChatAppId:$wechatAppId")
+ }else {
+ io.flutter.Log.e("fluwx", "can't load meta-data weChatAppId")
+ }
+ }
+ WXAPiHandler.wxApi?.handleIntent(intent, this)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ startSpecifiedActivity(defaultFlutterActivityAction())
+ finish()
+ }
Log.e("WXPayEntryActivity", "onCreate")
}
- override fun onReq(req: BaseReq?) {
+ override fun onNewIntent(intent: Intent) {
+ super.onNewIntent(intent)
+
+ setIntent(intent)
+
+ try {
+ WXAPiHandler.wxApi?.handleIntent(intent, this)
+ } catch (e: Exception) {
+ e.printStackTrace()
+ startSpecifiedActivity(defaultFlutterActivityAction())
+ finish()
+ }
+ }
+
+ override fun onReq(req: BaseReq) {
super.onReq(req)
+ FluwxRequestHandler.onReq(req, this)
Log.e("WXPayEntryActivity", "req: $req")
}
- override fun onResp(resp: BaseResp?) {
+ override fun onResp(resp: BaseResp) {
+ FluwxResponseHandler.handleResponse(resp)
super.onResp(resp)
Log.e("WXPayEntryActivity", "resp: $resp")
}
+
+
+ private fun startSpecifiedActivity(action: String, bundle: Bundle? = null, bundleKey: String? = null) {
+ Intent(action).run {
+ bundleKey?.let {
+ putExtra(bundleKey, bundle)
+ }
+ addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
+ packageManager?.let {
+ resolveActivity(packageManager)?.also {
+ startActivity(this)
+ finish()
+ }
+ }
+ }
+ }
+
+ private fun defaultFlutterActivityAction(): String = "$packageName.FlutterActivity"
+
}
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index bbf553e6..0490457c 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,5 +1,5 @@
buildscript {
- ext.kotlin_version = '1.3.50'
+ ext.kotlin_version = '1.4.10'
repositories {
maven {
url 'https://maven.aliyun.com/repository/google'
diff --git a/assets/image/2x/icon_permission_storage.png b/assets/image/2x/icon_permission_storage.png
new file mode 100644
index 00000000..0791f431
Binary files /dev/null and b/assets/image/2x/icon_permission_storage.png differ
diff --git a/assets/image/3x/icon_permission_storage.png b/assets/image/3x/icon_permission_storage.png
new file mode 100644
index 00000000..61efb027
Binary files /dev/null and b/assets/image/3x/icon_permission_storage.png differ
diff --git a/assets/image/icon_permission_storage.png b/assets/image/icon_permission_storage.png
new file mode 100644
index 00000000..44d1f544
Binary files /dev/null and b/assets/image/icon_permission_storage.png differ
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index c568140b..eef3b171 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -11,6 +11,9 @@ PODS:
- AMapLocation (2.6.8):
- AMapFoundation (~> 1.6.4)
- Flutter (1.0.0)
+ - fluwx (0.0.1):
+ - Flutter
+ - WechatOpenSDK (= 1.8.7.1)
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
@@ -39,11 +42,13 @@ PODS:
- Flutter
- webview_flutter (0.0.1):
- Flutter
+ - WechatOpenSDK (1.8.7.1)
DEPENDENCIES:
- amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`)
- amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`)
- Flutter (from `Flutter`)
+ - fluwx (from `.symlinks/plugins/fluwx/ios`)
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
@@ -63,6 +68,7 @@ SPEC REPOS:
- AMapLocation
- FMDB
- TOCropViewController
+ - WechatOpenSDK
EXTERNAL SOURCES:
amap_flutter_location:
@@ -71,6 +77,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/amap_flutter_map/ios"
Flutter:
:path: Flutter
+ fluwx:
+ :path: ".symlinks/plugins/fluwx/ios"
image_cropper:
:path: ".symlinks/plugins/image_cropper/ios"
image_picker:
@@ -101,6 +109,7 @@ SPEC CHECKSUMS:
AMapFoundation: c7da72b42a713f1429c88af1858d623dde88934b
AMapLocation: dad27669c4ca68e395ce7532ff614b7d4d45f7b7
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
+ fluwx: 07a55ed66bf3a4961e836a2a411b02dcada32902
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_cropper: f1668dd8d2cad2d357955caad15a40547856edcb
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
@@ -114,6 +123,7 @@ SPEC CHECKSUMS:
video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e
wakelock: bfc7955c418d0db797614075aabbc58a39ab5107
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96
+ WechatOpenSDK: 6a4d1436c15b3b5fe2a0bd383f3046010186da44
PODFILE CHECKSUM: 3dec887221b0cf3fccf2bbd3f50f36c0ad0bcbeb
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 7adc16ef..7215222f 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -2,6 +2,10 @@
+ CFBundleURLSchemes
+
+ wx3b269e795ed23e5f
+
CFBundleDevelopmentRegion
$(DEVELOPMENT_LANGUAGE)
CFBundleDisplayName
diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart
index d91146cb..a8bb0b32 100644
--- a/lib/generated/intl/messages_en.dart
+++ b/lib/generated/intl/messages_en.dart
@@ -104,6 +104,8 @@ class MessageLookup extends MessageLookupByLibrary {
"chuangjianshijian" : m2,
"chuangshirendegushi" : MessageLookupByLibrary.simpleMessage("创始人的故事"),
"code_error" : MessageLookupByLibrary.simpleMessage("验证码输入错误"),
+ "cunchu" : MessageLookupByLibrary.simpleMessage("存储"),
+ "cunchutishixinxi" : MessageLookupByLibrary.simpleMessage("为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限"),
"daifukuan" : MessageLookupByLibrary.simpleMessage("待付款"),
"daipeisong" : MessageLookupByLibrary.simpleMessage("待配送"),
"daiqucan" : MessageLookupByLibrary.simpleMessage("待取餐"),
@@ -139,7 +141,6 @@ class MessageLookup extends MessageLookupByLibrary {
"duihuanlishi" : MessageLookupByLibrary.simpleMessage("兑换历史"),
"duihuanshangpinxiangqing" : MessageLookupByLibrary.simpleMessage("兑换商品详情"),
"duihuanxinxi" : MessageLookupByLibrary.simpleMessage("兑换信息"),
- "faceidtishixinxi" : MessageLookupByLibrary.simpleMessage("为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID"),
"fanhuiduihuanlishi" : MessageLookupByLibrary.simpleMessage("返回兑换历史"),
"fankui" : MessageLookupByLibrary.simpleMessage("反馈"),
"fantizhongwen" : MessageLookupByLibrary.simpleMessage("繁体中文"),
@@ -267,7 +268,7 @@ class MessageLookup extends MessageLookupByLibrary {
"qianwanghuixiangmendianduihuanhexiao" : MessageLookupByLibrary.simpleMessage("前往一心回乡旗下任意门店对工作人员出示商品兑换码,核实无误后,可领取对应商品"),
"qinglihuancun" : MessageLookupByLibrary.simpleMessage("清理缓存"),
"qingshurubeizhuyaoqiu" : MessageLookupByLibrary.simpleMessage("请输入备注要求"),
- "qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("输入充值金额(元)"),
+ "qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("请输入充值金额"),
"qingshurushoujihao" : MessageLookupByLibrary.simpleMessage("请输入手机号"),
"qingshuruyanzhengma" : MessageLookupByLibrary.simpleMessage("请输入验证码"),
"qingshuruzhifumima" : MessageLookupByLibrary.simpleMessage("请输入支付密码"),
@@ -405,6 +406,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yishiming" : MessageLookupByLibrary.simpleMessage("已实名"),
"yishixiao" : MessageLookupByLibrary.simpleMessage("已失效"),
"yishiyong" : MessageLookupByLibrary.simpleMessage("已使用"),
+ "yishouquan" : MessageLookupByLibrary.simpleMessage("已授权"),
"yisongda" : MessageLookupByLibrary.simpleMessage("已送达"),
"yituikuan" : MessageLookupByLibrary.simpleMessage("已退款"),
"yiwancheng" : MessageLookupByLibrary.simpleMessage(" 已完成 "),
diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart
index 24a85387..d514940a 100644
--- a/lib/generated/intl/messages_zh_CN.dart
+++ b/lib/generated/intl/messages_zh_CN.dart
@@ -104,6 +104,8 @@ class MessageLookup extends MessageLookupByLibrary {
"chuangjianshijian" : m2,
"chuangshirendegushi" : MessageLookupByLibrary.simpleMessage("创始人的故事"),
"code_error" : MessageLookupByLibrary.simpleMessage("验证码输入错误"),
+ "cunchu" : MessageLookupByLibrary.simpleMessage("存储"),
+ "cunchutishixinxi" : MessageLookupByLibrary.simpleMessage("为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限"),
"daifukuan" : MessageLookupByLibrary.simpleMessage("待付款"),
"daipeisong" : MessageLookupByLibrary.simpleMessage("待配送"),
"daiqucan" : MessageLookupByLibrary.simpleMessage("待取餐"),
@@ -139,7 +141,6 @@ class MessageLookup extends MessageLookupByLibrary {
"duihuanlishi" : MessageLookupByLibrary.simpleMessage("兑换历史"),
"duihuanshangpinxiangqing" : MessageLookupByLibrary.simpleMessage("兑换商品详情"),
"duihuanxinxi" : MessageLookupByLibrary.simpleMessage("兑换信息"),
- "faceidtishixinxi" : MessageLookupByLibrary.simpleMessage("为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID"),
"fanhuiduihuanlishi" : MessageLookupByLibrary.simpleMessage("返回兑换历史"),
"fankui" : MessageLookupByLibrary.simpleMessage("反馈"),
"fantizhongwen" : MessageLookupByLibrary.simpleMessage("繁体中文"),
@@ -266,7 +267,7 @@ class MessageLookup extends MessageLookupByLibrary {
"qianwanghuixiangmendianduihuanhexiao" : MessageLookupByLibrary.simpleMessage("前往一心回乡旗下任意门店对工作人员出示商品兑换码,核实无误后,可领取对应商品"),
"qinglihuancun" : MessageLookupByLibrary.simpleMessage("清理缓存"),
"qingshurubeizhuyaoqiu" : MessageLookupByLibrary.simpleMessage("请输入备注要求"),
- "qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("输入充值金额(元)"),
+ "qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("请输入充值金额"),
"qingshurushoujihao" : MessageLookupByLibrary.simpleMessage("请输入手机号"),
"qingshuruyanzhengma" : MessageLookupByLibrary.simpleMessage("请输入验证码"),
"qingshuruzhifumima" : MessageLookupByLibrary.simpleMessage("请输入支付密码"),
@@ -404,6 +405,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yishiming" : MessageLookupByLibrary.simpleMessage("已实名"),
"yishixiao" : MessageLookupByLibrary.simpleMessage("已失效"),
"yishiyong" : MessageLookupByLibrary.simpleMessage("已使用"),
+ "yishouquan" : MessageLookupByLibrary.simpleMessage("已授权"),
"yisongda" : MessageLookupByLibrary.simpleMessage("已送达"),
"yituikuan" : MessageLookupByLibrary.simpleMessage("已退款"),
"yiwancheng" : MessageLookupByLibrary.simpleMessage(" 已完成 "),
diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart
index 8f66d586..7163f24d 100644
--- a/lib/generated/intl/messages_zh_TW.dart
+++ b/lib/generated/intl/messages_zh_TW.dart
@@ -104,6 +104,8 @@ class MessageLookup extends MessageLookupByLibrary {
"chuangjianshijian" : m2,
"chuangshirendegushi" : MessageLookupByLibrary.simpleMessage("創始人的故事"),
"code_error" : MessageLookupByLibrary.simpleMessage("驗證碼輸入錯誤"),
+ "cunchu" : MessageLookupByLibrary.simpleMessage("存儲"),
+ "cunchutishixinxi" : MessageLookupByLibrary.simpleMessage("為了獲得照片使用、緩存等功能,推薦您使用期間打開存儲權限"),
"daifukuan" : MessageLookupByLibrary.simpleMessage("待付款"),
"daipeisong" : MessageLookupByLibrary.simpleMessage("待配送"),
"daiqucan" : MessageLookupByLibrary.simpleMessage("待取餐"),
@@ -139,7 +141,6 @@ class MessageLookup extends MessageLookupByLibrary {
"duihuanlishi" : MessageLookupByLibrary.simpleMessage("兌換歷史"),
"duihuanshangpinxiangqing" : MessageLookupByLibrary.simpleMessage("兑换商品详情"),
"duihuanxinxi" : MessageLookupByLibrary.simpleMessage("兑换信息"),
- "faceidtishixinxi" : MessageLookupByLibrary.simpleMessage("為了更好的保護帳戶安全支付更便捷,推薦您在使用期間讓我們使用Face ID "),
"fanhuiduihuanlishi" : MessageLookupByLibrary.simpleMessage("返回兌換歷史"),
"fankui" : MessageLookupByLibrary.simpleMessage("反饋"),
"fantizhongwen" : MessageLookupByLibrary.simpleMessage("繁体中文"),
@@ -266,7 +267,7 @@ class MessageLookup extends MessageLookupByLibrary {
"qianwanghuixiangmendianduihuanhexiao" : MessageLookupByLibrary.simpleMessage("前往一心回乡旗下任意门店对工作人员出示商品兑换码,核实无误后,可领取对应商品"),
"qinglihuancun" : MessageLookupByLibrary.simpleMessage("清理緩存"),
"qingshurubeizhuyaoqiu" : MessageLookupByLibrary.simpleMessage("請輸入備注要求"),
- "qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("輸入充值金額(元)"),
+ "qingshuruchongzhijine" : MessageLookupByLibrary.simpleMessage("請輸入充值金額"),
"qingshurushoujihao" : MessageLookupByLibrary.simpleMessage("請輸入手機號碼"),
"qingshuruyanzhengma" : MessageLookupByLibrary.simpleMessage("請輸入驗證碼"),
"qingshuruzhifumima" : MessageLookupByLibrary.simpleMessage("請輸入支付密碼"),
@@ -404,6 +405,7 @@ class MessageLookup extends MessageLookupByLibrary {
"yishiming" : MessageLookupByLibrary.simpleMessage("已实名"),
"yishixiao" : MessageLookupByLibrary.simpleMessage("已失效"),
"yishiyong" : MessageLookupByLibrary.simpleMessage("已使用"),
+ "yishouquan" : MessageLookupByLibrary.simpleMessage("已授權"),
"yisongda" : MessageLookupByLibrary.simpleMessage("已送達"),
"yituikuan" : MessageLookupByLibrary.simpleMessage("已退款"),
"yiwancheng" : MessageLookupByLibrary.simpleMessage(" 已完成 "),
diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart
index 56bc1274..1b6865e2 100644
--- a/lib/generated/l10n.dart
+++ b/lib/generated/l10n.dart
@@ -1165,11 +1165,21 @@ class S {
);
}
- /// `为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID`
- String get faceidtishixinxi {
+ /// `为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限`
+ String get cunchutishixinxi {
return Intl.message(
- '为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID',
- name: 'faceidtishixinxi',
+ '为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限',
+ name: 'cunchutishixinxi',
+ desc: '',
+ args: [],
+ );
+ }
+
+ /// `存储`
+ String get cunchu {
+ return Intl.message(
+ '存储',
+ name: 'cunchu',
desc: '',
args: [],
);
@@ -2195,10 +2205,10 @@ class S {
);
}
- /// `输入充值金额(元)`
+ /// `请输入充值金额`
String get qingshuruchongzhijine {
return Intl.message(
- '输入充值金额(元)',
+ '请输入充值金额',
name: 'qingshuruchongzhijine',
desc: '',
args: [],
@@ -3705,6 +3715,16 @@ class S {
);
}
+ /// `已授权`
+ String get yishouquan {
+ return Intl.message(
+ '已授权',
+ name: 'yishouquan',
+ desc: '',
+ args: [],
+ );
+ }
+
/// `并使用本机号码登录`
String get privacy_policy4 {
return Intl.message(
diff --git a/lib/home/activity_list_page.dart b/lib/home/activity_list_page.dart
index 5615e50d..35a204c2 100644
--- a/lib/home/activity_list_page.dart
+++ b/lib/home/activity_list_page.dart
@@ -1,7 +1,6 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
-import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
@@ -11,6 +10,8 @@ import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_footer.dart';
+import 'package:keframe/frame_separate_widget.dart';
+import 'package:keframe/size_cache_widget.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -30,7 +31,8 @@ class _ActivityListPage extends State
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
- apiService = ApiService(Dio(), context: context, token: value.getString('token')),
+ apiService = ApiService(Dio(),
+ context: context, token: value.getString('token')),
queryActivity(),
});
@@ -74,36 +76,60 @@ class _ActivityListPage extends State
Widget build(BuildContext context) {
super.build(context);
return Container(
- child: SmartRefresher(
- controller: _refreshController,
- enablePullDown: true,
- enablePullUp: false,
- header: MyHeader(),
- physics: BouncingScrollPhysics(),
- footer: CustomFooter(
- builder: (context, mode) {
- return MyFooter(mode);
- },
- ),
- onRefresh: queryActivity,
- child: ListView.builder(
- itemCount: activityList == null ? 0 : activityList.length,
- itemBuilder: (context, position) {
- return InkWell(
- onTap: () {
- Navigator.of(context)
- .pushNamed('/router/store_detail_page', arguments: {
- "html": activityList[position].content,
- "title": activityList[position].mainTitle,
- "time": activityList[position].createTime,
- "storeId": activityList[position].storeId,
- "author": activityList[position].storeName
- });
+ child: SizeCacheWidget(
+ child: SmartRefresher(
+ controller: _refreshController,
+ enablePullDown: true,
+ enablePullUp: false,
+ header: MyHeader(),
+ physics: BouncingScrollPhysics(),
+ footer: CustomFooter(
+ builder: (context, mode) {
+ return MyFooter(mode);
},
- child: activityItem(activityList[position]),
- );
- },
- ),
+ ),
+ onRefresh: queryActivity,
+ child: ListView.builder(
+ itemCount: activityList == null ? 0 : activityList.length,
+ physics: NeverScrollableScrollPhysics(),
+ itemBuilder: (context, position) {
+ return InkWell(
+ onTap: () {
+ Navigator.of(context)
+ .pushNamed('/router/store_detail_page', arguments: {
+ "html": activityList[position].content,
+ "title": activityList[position].mainTitle,
+ "time": activityList[position].createTime,
+ "storeId": activityList[position].storeId,
+ "author": activityList[position].storeName
+ });
+ },
+ child: FrameSeparateWidget(
+ child: activityItem(activityList[position]),
+ placeHolder: AspectRatio(
+ aspectRatio: 1.34,
+ child: Container(
+ margin: EdgeInsets.only(
+ left: 16.w, right: 16.w, top: 8.h, bottom: 8.h),
+ decoration: BoxDecoration(
+ color: Colors.white,
+ boxShadow: [
+ BoxShadow(
+ color: Colors.black.withAlpha(12),
+ offset: Offset(0, 3),
+ blurRadius: 14,
+ spreadRadius: 0,
+ )
+ ],
+ borderRadius: BorderRadius.circular(8),
+ ),
+ ),
+ ),
+ ),
+ );
+ },
+ ),
+ ),
),
);
}
@@ -139,7 +165,8 @@ class _ActivityListPage extends State
fadeSrc: "assets/image/default_2_1.png",
),
Container(
- padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 12.h),
+ padding: EdgeInsets.only(
+ left: 16.w, right: 16.w, top: 8.h, bottom: 12.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart
index 6509e50b..9741cae9 100644
--- a/lib/home/home_page.dart
+++ b/lib/home/home_page.dart
@@ -158,66 +158,68 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin {
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: queryHome,
- child: ListView(
+ child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
- children: [
- banner(),
- ItemTitle(
- text: S.of(context).jinrihuiyuanrenwu,
- imgPath: "assets/image/icon_today_task.png",
- moreText: S.of(context).renwuzhongxin,
- onTap: () {
- SharedPreferences.getInstance().then((value) {
- if (value.getString('token') == null) {
- loginTips();
- } else {
- Navigator.of(context).pushNamed('/router/integral_page');
- }
- });
- },
- ),
- InkWell(
- onTap: () {
- SharedPreferences.getInstance().then((value) {
- if (value.getString('token') == null) {
- loginTips();
- } else {
- Navigator.of(context).pushNamed('/router/integral_page');
- }
- });
- },
- child: signIn(),
- ),
- ItemTitle(
- text: S.of(context).remenwenzhangshipin,
- imgPath: "assets/image/icon_today_video.png",
- moreText: S.of(context).chakangengduo,
- onTap: () {
- Navigator.of(context).pushNamed('/router/hot_article_page');
- },
- ),
- hotList(),
- ItemTitle(
- text: S.of(context).chuangshirendegushi,
- imgPath: "assets/image/icon_founder.png",
- ),
- GestureDetector(
- onTap: () {
- Navigator.of(context).pushNamed('/router/founder_story_page');
- },
- child: founderStore(),
- ),
- ItemTitle(
- text: S.of(context).pinpaijieshao,
- imgPath: "assets/image/icon_brand_introduction.png",
- ),
- brands(),
- ItemTitle(
- text: S.of(context).jifenshangcheng,
- imgPath: "assets/image/icon_points_mall.png",
- ),
- integralStore(),
- ],
+ child: Column(
+ children: [
+ banner(),
+ ItemTitle(
+ text: S.of(context).jinrihuiyuanrenwu,
+ imgPath: "assets/image/icon_today_task.png",
+ moreText: S.of(context).renwuzhongxin,
+ onTap: () {
+ SharedPreferences.getInstance().then((value) {
+ if (value.getString('token') == null) {
+ loginTips();
+ } else {
+ Navigator.of(context).pushNamed('/router/integral_page');
+ }
+ });
+ },
+ ),
+ InkWell(
+ onTap: () {
+ SharedPreferences.getInstance().then((value) {
+ if (value.getString('token') == null) {
+ loginTips();
+ } else {
+ Navigator.of(context).pushNamed('/router/integral_page');
+ }
+ });
+ },
+ child: signIn(),
+ ),
+ ItemTitle(
+ text: S.of(context).remenwenzhangshipin,
+ imgPath: "assets/image/icon_today_video.png",
+ moreText: S.of(context).chakangengduo,
+ onTap: () {
+ Navigator.of(context).pushNamed('/router/hot_article_page');
+ },
+ ),
+ hotList(),
+ ItemTitle(
+ text: S.of(context).chuangshirendegushi,
+ imgPath: "assets/image/icon_founder.png",
+ ),
+ GestureDetector(
+ onTap: () {
+ Navigator.of(context).pushNamed('/router/founder_story_page');
+ },
+ child: founderStore(),
+ ),
+ ItemTitle(
+ text: S.of(context).pinpaijieshao,
+ imgPath: "assets/image/icon_brand_introduction.png",
+ ),
+ brands(),
+ ItemTitle(
+ text: S.of(context).jifenshangcheng,
+ imgPath: "assets/image/icon_points_mall.png",
+ ),
+ integralStore(),
+ ],
+ ),
),
),
);
diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb
index bbfd2f47..9c8378ad 100644
--- a/lib/l10n/intl_en.arb
+++ b/lib/l10n/intl_en.arb
@@ -112,7 +112,8 @@
"weizhitishixinxi": "为了向您推荐附近的门店信息,推荐您在使用HISAPP时让我们使用位置信息",
"tongzhitishixinxi": "为了您可以及时收到我们的活动信息,推荐您在使用HISAPP时打开通知的接收",
"xiangjitishixinxi": "为了您可以在使用过程中进行分享,希望您使用HISAPP时让我们使用相机功能",
- "faceidtishixinxi": "为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID",
+ "cunchutishixinxi": "为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限",
+ "cunchu": "存储",
"wodejifenzhi": "我的积分值",
"mingxi": "明细",
"qiandaolingjifen": "签到领积分",
@@ -383,6 +384,8 @@
"qudenglu": "去登录",
"weidenglu": "未登录",
"youkedenglu": "游客登录",
+ "yishouquan": "已授权",
+ "qingshuruchongzhijine": "请输入充值金额",
diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb
index 1762a863..225e9147 100644
--- a/lib/l10n/intl_zh_CN.arb
+++ b/lib/l10n/intl_zh_CN.arb
@@ -112,7 +112,8 @@
"weizhitishixinxi": "为了向您推荐附近的门店信息,推荐您在使用HISAPP时让我们使用位置信息",
"tongzhitishixinxi": "为了您可以及时收到我们的活动信息,推荐您在使用HISAPP时打开通知的接收",
"xiangjitishixinxi": "为了您可以在使用过程中进行分享,希望您使用HISAPP时让我们使用相机功能",
- "faceidtishixinxi": "为了更好的保护账户安全支付更便捷,推荐您在使用期间让我们使用Face ID",
+ "cunchutishixinxi": "为了获得照片使用、缓存等功能,推荐您在使用期间打开存储权限",
+ "cunchu": "存储",
"wodejifenzhi": "我的积分值",
"mingxi": "明细",
"qiandaolingjifen": "签到领积分",
@@ -384,6 +385,8 @@
"qudenglu": "去登录",
"weidenglu": "未登录",
"youkedenglu": "游客登录",
+ "yishouquan": "已授权",
+ "qingshuruchongzhijine": "请输入充值金额",
diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb
index c1c245d8..7edba753 100644
--- a/lib/l10n/intl_zh_TW.arb
+++ b/lib/l10n/intl_zh_TW.arb
@@ -115,7 +115,8 @@
"weizhitishixinxi": "為了向您推薦附近的門店資訊,推薦您在使用HISAPP時讓我們使用位置資訊",
"tongzhitishixinxi": "為了您可以及時收到我們的活動資訊,推薦您在使用HISAPP時打開通知的接收 ",
"xiangjitishixinxi": "為了您可以在使用過程中進行分享,希望您使用HISAPP時讓我們使用相機功能 ",
- "faceidtishixinxi": "為了更好的保護帳戶安全支付更便捷,推薦您在使用期間讓我們使用Face ID ",
+ "cunchutishixinxi": "為了獲得照片使用、緩存等功能,推薦您使用期間打開存儲權限",
+ "cunchu": "存儲",
"wodejifenzhi": "我的積分值",
"wodehuiyuandengji": "我的會員等級",
"mingxi": "明細",
@@ -376,6 +377,8 @@
"qudenglu": "去登錄",
"weidenglu": "未登錄",
"youkedenglu": "遊客登錄",
+ "yishouquan": "已授權",
+ "qingshuruchongzhijine": "請輸入充值金額",
"privacy_policy4": "并使用本機號碼登錄"
diff --git a/lib/mine/mine_wallet_page.dart b/lib/mine/mine_wallet_page.dart
index 74ea50a0..4cc11ea5 100644
--- a/lib/mine/mine_wallet_page.dart
+++ b/lib/mine/mine_wallet_page.dart
@@ -42,7 +42,7 @@ class _MineWalletPage extends State {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
userInfo =
UserInfo.fromJson(jsonDecode(sharedPreferences.getString('user')));
- mBalance = double.tryParse(userInfo.money).toInt();
+ mBalance = double.tryParse(userInfo.money);
if (mounted) setState(() {});
String token = sharedPreferences.getString("token");
@@ -59,9 +59,8 @@ class _MineWalletPage extends State {
BaseData baseData = await apiService.queryInfo();
if (baseData != null && baseData.isSuccess) {
userInfo = UserInfo.fromJson(baseData.data);
- mBalance = double.tryParse(userInfo.money).toInt();
- if (mounted)
- setState(() {});
+ mBalance = double.tryParse(userInfo.money);
+ if (mounted) setState(() {});
}
}
@@ -211,11 +210,11 @@ class _MineWalletPage extends State {
// ],
// ),
Container(
- margin: EdgeInsets.only(top: 14),
+ margin: EdgeInsets.only(top: 14.h),
child: ListView.builder(
itemCount: userBills != null ? userBills.length : 0,
shrinkWrap: true,
- padding: EdgeInsets.only(bottom: 20),
+ padding: EdgeInsets.only(bottom: 20.h),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return historyItem(userBills[position], position);
@@ -228,23 +227,23 @@ class _MineWalletPage extends State {
Widget historyItem(UserBill userBill, position) {
return Container(
- margin: EdgeInsets.only(top: 10, bottom: 10),
+ margin: EdgeInsets.only(top: 10.h, bottom: 10.h),
child: Row(
children: [
Image.asset(
userBill.pm == 0
? "assets/image/icon_wallet_withdrawal.png"
: "assets/image/icon_wallet_recharge.png",
- width: 34,
- height: 34,
+ width: 34.w,
+ height: 34.h,
),
SizedBox(
- width: 12,
+ width: 12.w,
),
Expanded(
flex: 1,
child: Container(
- height: 34,
+ height: 34.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -253,7 +252,7 @@ class _MineWalletPage extends State {
userBill.name,
style: TextStyle(
color: Colors.black,
- fontSize: 12,
+ fontSize: 12.sp,
),
),
Text(
@@ -277,7 +276,8 @@ class _MineWalletPage extends State {
? "-${userBill.number}"
: "+${userBill.number}",
style: TextStyle(
- color: Colors.black,
+ color: Color(0xFF20662A),
+ fontWeight: FontWeight.bold,
fontSize: 12.sp,
),
),
@@ -299,43 +299,53 @@ class _MineWalletPage extends State {
Widget balance() {
return Container(
width: double.infinity,
- margin: EdgeInsets.fromLTRB(16, 16, 16, 8),
- padding: EdgeInsets.fromLTRB(24, 24, 24, 24),
+ margin: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 8.h),
+ padding: EdgeInsets.fromLTRB(24.w, 24.h, 24.w, 24.h),
decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(8)),
- boxShadow: [
- BoxShadow(
- color: Colors.black.withAlpha(12),
- offset: Offset(0, 3),
- blurRadius: 14,
- spreadRadius: 0)
- ]),
+ color: Colors.white,
+ borderRadius: BorderRadius.all(Radius.circular(8)),
+ boxShadow: [
+ BoxShadow(
+ color: Colors.black.withAlpha(12),
+ offset: Offset(0, 3),
+ blurRadius: 14,
+ spreadRadius: 0,
+ )
+ ],
+ ),
child: Column(
children: [
Text(
S.of(context).zhanghuyue,
style: TextStyle(
- fontWeight: FontWeight.bold,
- color: Color(0xFF353535),
- fontSize: 16),
+ fontWeight: FontWeight.bold,
+ color: Color(0xFF353535),
+ fontSize: 16.sp,
+ ),
+ ),
+ SizedBox(
+ height: 16.h,
),
Text(
"$mBalance",
style: TextStyle(
- fontWeight: FontWeight.bold,
- color: Color(0xFF353535),
- fontSize: 60),
+ fontWeight: FontWeight.w500,
+ color: Color(0xFF353535),
+ fontSize: 50.sp,
+ ),
+ ),
+ SizedBox(
+ height: 4.h,
),
Text(
S.of(context).keyongyue,
style: TextStyle(
color: Color(0xFF20662A),
- fontSize: 16,
+ fontSize: 16.sp,
),
),
SizedBox(
- height: 24,
+ height: 24.h,
),
InkWell(
onTap: () {
@@ -350,8 +360,8 @@ class _MineWalletPage extends State {
textColor: Colors.white,
radius: 15,
backgroup: Color(0xFF20662A),
- fontSize: 12,
- padding: EdgeInsets.fromLTRB(12, 4, 12, 4),
+ fontSize: 12.sp,
+ padding: EdgeInsets.fromLTRB(12.w, 4.h, 12.w, 4.h),
),
),
],
@@ -368,17 +378,18 @@ class _MineWalletPage extends State {
Navigator.of(context).pushNamed('/router/recharge_page');
},
child: Container(
- margin: EdgeInsets.fromLTRB(16, 16, 16, 16),
- padding: EdgeInsets.fromLTRB(0, 7, 0, 7),
+ margin: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
+ padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
decoration: BoxDecoration(
color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(8)),
+ borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
- color: Colors.black.withAlpha(12),
- offset: Offset(0, 3),
- blurRadius: 14,
- spreadRadius: 0)
+ color: Colors.black.withAlpha(12),
+ offset: Offset(0, 3),
+ blurRadius: 14,
+ spreadRadius: 0,
+ )
]),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -386,15 +397,16 @@ class _MineWalletPage extends State {
children: [
Image.asset(
"assets/image/icon_wallet_recharge.png",
- width: 40,
- height: 40,
+ width: 40.w,
+ height: 40.h,
),
Text(
S.of(context).chongzhi,
style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 16,
- color: Colors.black),
+ fontWeight: FontWeight.bold,
+ fontSize: 16.sp,
+ color: Colors.black,
+ ),
)
],
),
@@ -404,8 +416,8 @@ class _MineWalletPage extends State {
),
Expanded(
child: Container(
- margin: EdgeInsets.fromLTRB(16, 16, 16, 16),
- padding: EdgeInsets.fromLTRB(0, 7, 0, 7),
+ margin: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
+ padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
@@ -422,15 +434,16 @@ class _MineWalletPage extends State {
children: [
Image.asset(
"assets/image/icon_wallet_withdrawal.png",
- width: 40,
- height: 40,
+ width: 40.w,
+ height: 40.w,
),
Text(
S.of(context).tixian,
style: TextStyle(
- fontWeight: FontWeight.bold,
- fontSize: 16,
- color: Colors.black),
+ fontWeight: FontWeight.bold,
+ fontSize: 16.sp,
+ color: Colors.black,
+ ),
)
],
),
diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart
index 7b3e3ae3..a905346b 100644
--- a/lib/mine/recharge_page.dart
+++ b/lib/mine/recharge_page.dart
@@ -1,11 +1,19 @@
+import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
+import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart';
+import 'package:huixiang/retrofit/data/base_data.dart';
+import 'package:huixiang/retrofit/data/wx_pay.dart';
+import 'package:huixiang/retrofit/retrofit_api.dart';
+import 'package:huixiang/utils/min.dart';
import 'package:huixiang/view_widget/item_input_widget.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/round_button.dart';
+import 'package:shared_preferences/shared_preferences.dart';
class RechargePage extends StatefulWidget {
-
@override
State createState() {
return _RechargePage();
@@ -13,10 +21,22 @@ class RechargePage extends StatefulWidget {
}
class _RechargePage extends State {
- TextEditingController controller;
+ ApiService apiService;
+
+ TextEditingController controller = TextEditingController();
Color color = Colors.black;
+ @override
+ void initState() {
+ super.initState();
+
+ SharedPreferences.getInstance().then((value) {
+ apiService = ApiService(Dio(),
+ context: context, token: value.getString("token"), pay: true);
+ });
+ }
+
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -26,7 +46,7 @@ class _RechargePage extends State {
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
- fontSize: 18,
+ fontSize: 18.sp,
),
),
centerTitle: false,
@@ -38,7 +58,7 @@ class _RechargePage extends State {
},
child: Container(
alignment: Alignment.centerRight,
- margin: EdgeInsets.only(left: 10),
+ margin: EdgeInsets.only(left: 10.w),
padding: EdgeInsets.all(6),
child: Icon(
Icons.arrow_back_ios,
@@ -48,7 +68,7 @@ class _RechargePage extends State {
),
),
titleSpacing: 2,
- leadingWidth: 56,
+ leadingWidth: 56.w,
),
body: SingleChildScrollView(
physics: BouncingScrollPhysics(),
@@ -67,9 +87,13 @@ class _RechargePage extends State {
errorTextColor: Color(0xFF32A060),
radius: 8,
style: TextStyle(
- fontWeight: FontWeight.bold, fontSize: 30.sp, color: color),
- inputLimit: 16,
+ fontWeight: FontWeight.bold,
+ fontSize: 30.sp,
+ color: color,
+ ),
+ inputLimit: 12,
textInputType: TextInputType.number,
+ textInputFormatter: FilteringTextInputFormatter.digitsOnly,
onChanged: (value) {
if (value != null &&
value != "" &&
@@ -83,10 +107,18 @@ class _RechargePage extends State {
),
Container(
width: double.infinity,
- margin:
- EdgeInsets.only(left: 20, right: 20, top: 12, bottom: 4),
- padding:
- EdgeInsets.only(left: 20, right: 16, top: 20, bottom: 20),
+ margin: EdgeInsets.only(
+ left: 20.w,
+ right: 20.w,
+ top: 12.h,
+ bottom: 4.h,
+ ),
+ padding: EdgeInsets.only(
+ left: 20.w,
+ right: 16.w,
+ top: 20.h,
+ bottom: 20.h,
+ ),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
@@ -105,73 +137,94 @@ class _RechargePage extends State {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
- padding: EdgeInsets.only(bottom: 16),
+ padding: EdgeInsets.only(bottom: 16.h),
child: Text(
S.of(context).zhifufangshi,
style: TextStyle(
- fontSize: 16,
+ fontSize: 16.sp,
color: color,
fontWeight: FontWeight.bold,
),
),
),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Image.asset("assets/image/icon_alipay.png"),
- Expanded(
- flex: 1,
- child: Padding(
- padding: EdgeInsets.only(left: 8, bottom: 20),
- child: Text(S.of(context).zhifubao,
+ GestureDetector(
+ onTap: () {
+ setState(() {
+ checkIndex = 0;
+ });
+ },
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image.asset("assets/image/icon_alipay.png"),
+ Expanded(
+ flex: 1,
+ child: Padding(
+ padding: EdgeInsets.only(left: 8.w, bottom: 20.h),
+ child: Text(
+ S.of(context).zhifubao,
style: TextStyle(
- fontSize: 14,
+ fontSize: 14.sp,
color: Color(0xff353535),
- )),
+ ),
+ ),
+ ),
),
- ),
- checkView(0),
- ],
+ checkView(0),
+ ],
+ ),
),
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Image.asset("assets/image/icon_we_chat.png"),
- Expanded(
- flex: 1,
- child: Padding(
- padding: EdgeInsets.only(left: 8),
- child: Text(S.of(context).weixinzhifu,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff353535),
- )),
+ GestureDetector(
+ onTap: () {
+ setState(() {
+ checkIndex = 1;
+ });
+ },
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image.asset("assets/image/icon_we_chat.png"),
+ Expanded(
+ flex: 1,
+ child: Padding(
+ padding: EdgeInsets.only(left: 8.w),
+ child: Text(S.of(context).weixinzhifu,
+ style: TextStyle(
+ fontSize: 14.sp,
+ color: Color(0xff353535),
+ )),
+ ),
),
- ),
- checkView(1),
- ],
- )
+ checkView(1),
+ ],
+ ),
+ ),
],
),
),
- Container(
- margin: EdgeInsets.only(left: 20, right: 20, top: 26),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- RoundButton(
- width: double.infinity,
- height: 46,
- text:S.of(context).querenchongzhi,
- textColor: Colors.white,
- fontSize: 14,
- backgroup: Color(0xff32A060),
- fontWeight: FontWeight.bold,
- ),
- ],
+ InkWell(
+ onTap: () {
+ recharge();
+ },
+ child: Container(
+ margin: EdgeInsets.only(left: 20.w, right: 20.w, top: 26.h),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ RoundButton(
+ width: double.infinity,
+ height: 46.h,
+ text: S.of(context).querenchongzhi,
+ textColor: Colors.white,
+ fontSize: 14.sp,
+ backgroup: Color(0xff32A060),
+ fontWeight: FontWeight.bold,
+ ),
+ ],
+ ),
),
),
],
@@ -180,25 +233,55 @@ class _RechargePage extends State {
),
);
}
+
var checkIndex = 0;
Widget checkView(var index) {
- return GestureDetector(
- onTap: () {
- setState(() {
- checkIndex = index;
- });
- },
- child: Container(
- padding: EdgeInsets.only(right: 16),
- alignment: Alignment.center,
- child: Image.asset(
- checkIndex != index
- ? "assets/image/icon_radio_unselected.png"
- : "assets/image/icon_radio_selected.png",
- width: 15,
- height: 15,
- )),
+ return Container(
+ padding: EdgeInsets.only(right: 16.w),
+ alignment: Alignment.center,
+ child: Image.asset(
+ checkIndex != index
+ ? "assets/image/icon_radio_unselected.png"
+ : "assets/image/icon_radio_selected.png",
+ width: 15.w,
+ height: 15.h,
+ ),
);
}
+
+ recharge() async {
+ String money = controller.text;
+ if (money == null || money == "") {
+ SmartDialog.showToast(S.of(context).qingshuruchongzhijine);
+ return;
+ }
+ int amount = int.tryParse(money);
+ if (checkIndex == 1) {
+ if (!(await Min.isInitialize())) {
+ // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调,
+ // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针,
+ // 故而在此初始化一下
+ await Min.initialize();
+ }
+
+ BaseData baseData =
+ await apiService.recharge({"amount": amount, "rechargeType": 2});
+ if (baseData != null && baseData.isSuccess) {
+ WxPay wxPay = WxPay.fromJson(baseData.data);
+ await registerWxApi(appId: wxPay.appId, doOnAndroid: true, universalLink: "https://hx.lotus-wallet.com/app/");
+ payWithWeChat(
+ appId: wxPay.appId,
+ partnerId: wxPay.partnerId,
+ prepayId: wxPay.prepayId,
+ packageValue: wxPay.packageValue,
+ nonceStr: wxPay.nonceStr,
+ timeStamp: int.tryParse(wxPay.timeStamp),
+ sign: wxPay.sign);
+ weChatResponseEventHandler.listen((event) async {
+ print("payCallback: ${event.errCode}");
+ });
+ }
+ }
+ }
}
diff --git a/lib/retrofit/data/banner.dart b/lib/retrofit/data/banner.dart
index acada831..fbde6463 100644
--- a/lib/retrofit/data/banner.dart
+++ b/lib/retrofit/data/banner.dart
@@ -2,6 +2,7 @@
class BannerData {
String content;
String createTime;
+ String contentType;
String createUser;
String id;
String imgUrl;
@@ -12,11 +13,12 @@ class BannerData {
String updateTime;
String updateUser;
- BannerData({this.content, this.createTime, this.createUser, this.id, this.imgUrl, this.isDelete, this.storeId, this.tenantCode, this.type, this.updateTime, this.updateUser});
+ BannerData({this.content, this.createTime, this.contentType, this.createUser, this.id, this.imgUrl, this.isDelete, this.storeId, this.tenantCode, this.type, this.updateTime, this.updateUser});
factory BannerData.fromJson(Map json) => BannerData(
content: json['content'] as String,
createTime: json['createTime'] as String,
+ contentType: json['contentType'] as String,
createUser: json['createUser'] as String,
id: json['id'] as String,
imgUrl: json['imgUrl'] as String,
@@ -31,6 +33,7 @@ class BannerData {
Map toJson() => {
'content': this.content,
'createTime': this.createTime,
+ 'contentType': this.contentType,
'createUser': this.createUser,
'id': this.id,
'imgUrl': this.imgUrl,
diff --git a/lib/retrofit/data/wx_pay.dart b/lib/retrofit/data/wx_pay.dart
new file mode 100644
index 00000000..17017d8a
--- /dev/null
+++ b/lib/retrofit/data/wx_pay.dart
@@ -0,0 +1,65 @@
+/// appId : ""
+/// nonceStr : ""
+/// packageValue : ""
+/// partnerId : ""
+/// prepayId : ""
+/// sign : ""
+/// timeStamp : ""
+
+class WxPay {
+ String _appId;
+ String _nonceStr;
+ String _packageValue;
+ String _partnerId;
+ String _prepayId;
+ String _sign;
+ String _timeStamp;
+
+ String get appId => _appId;
+ String get nonceStr => _nonceStr;
+ String get packageValue => _packageValue;
+ String get partnerId => _partnerId;
+ String get prepayId => _prepayId;
+ String get sign => _sign;
+ String get timeStamp => _timeStamp;
+
+ WxPay({
+ String appId,
+ String nonceStr,
+ String packageValue,
+ String partnerId,
+ String prepayId,
+ String sign,
+ String timeStamp}){
+ _appId = appId;
+ _nonceStr = nonceStr;
+ _packageValue = packageValue;
+ _partnerId = partnerId;
+ _prepayId = prepayId;
+ _sign = sign;
+ _timeStamp = timeStamp;
+}
+
+ WxPay.fromJson(dynamic json) {
+ _appId = json["appId"];
+ _nonceStr = json["nonceStr"];
+ _packageValue = json["packageValue"];
+ _partnerId = json["partnerId"];
+ _prepayId = json["prepayId"];
+ _sign = json["sign"];
+ _timeStamp = json["timeStamp"];
+ }
+
+ Map toJson() {
+ var map = {};
+ map["appId"] = _appId;
+ map["nonceStr"] = _nonceStr;
+ map["packageValue"] = _packageValue;
+ map["partnerId"] = _partnerId;
+ map["prepayId"] = _prepayId;
+ map["sign"] = _sign;
+ map["timeStamp"] = _timeStamp;
+ return map;
+ }
+
+}
\ No newline at end of file
diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart
index 672a3c6b..2e2c6963 100644
--- a/lib/retrofit/retrofit_api.dart
+++ b/lib/retrofit/retrofit_api.dart
@@ -7,9 +7,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
-import 'package:huixiang/login/login_page.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
-import 'package:huixiang/view_widget/loading_view.dart';
import 'package:huixiang/view_widget/login_tips.dart';
import 'package:retrofit/retrofit.dart';
import 'package:shared_preferences/shared_preferences.dart';
@@ -17,8 +15,8 @@ import 'package:shared_preferences/shared_preferences.dart';
part 'retrofit_api.g.dart';
const base_url = "http://platform.test.api.lotus-wallet.com/app/";
-const baseUrl = "http://platform.test.api.lotus-wallet.com/app/";
-// const baseUrl = "http://192.168.10.236:8766/app/";
+// const baseUrl = "http://platform.test.api.lotus-wallet.com/app/";
+const baseUrl = "http://192.168.10.236:8766/app/";
// const baseUrl = "http://192.168.10.129:8766/app/";
@RestApi(baseUrl: baseUrl)
@@ -28,9 +26,12 @@ abstract class ApiService {
{String baseUrl,
BuildContext context,
String token,
- bool showLoading = true}) {
+ bool showLoading = true, bool pay = false}) {
Map headers =
(token == null || token == "") ? {} : {'token': "Bearer $token"};
+ if (pay) {
+ headers["Environment"] = "app";
+ }
dio.options = BaseOptions(
connectTimeout: 60000,
receiveTimeout: 60000,
@@ -165,7 +166,7 @@ abstract class ApiService {
Future signIn();
///会员充值
- @POST("/member/recharge")
+ @POST("/wallet/recharge")
Future recharge(@Body() Map param);
///领取优惠券
diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart
index 9584b822..38a0d24a 100644
--- a/lib/retrofit/retrofit_api.g.dart
+++ b/lib/retrofit/retrofit_api.g.dart
@@ -9,7 +9,7 @@ part of 'retrofit_api.dart';
class _ApiService implements ApiService {
_ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio');
- baseUrl ??= 'http://platform.test.api.lotus-wallet.com/app/';
+ baseUrl ??= 'http://192.168.10.236:8766/app/';
}
final Dio _dio;
@@ -221,7 +221,7 @@ class _ApiService implements ApiService {
final queryParameters = {};
final _data = {};
_data.addAll(param ?? {});
- final _result = await _dio.request