Browse Source

登录页增加推荐门店注册来源;

new_revision_app
wurong 2 years ago
parent
commit
1273e233c3
  1. BIN
      assets/image/2x/login_channel.webp
  2. BIN
      assets/image/2x/login_store.webp
  3. BIN
      assets/image/3x/login_channel.webp
  4. BIN
      assets/image/3x/login_store.webp
  5. BIN
      assets/image/login_channel.webp
  6. BIN
      assets/image/login_store.webp
  7. 174
      lib/login/login_store_select.dart
  8. 46
      lib/login/new_login_page.dart
  9. 3
      lib/main.dart
  10. 155
      lib/retrofit/data/channels_list.dart
  11. 5
      lib/retrofit/retrofit_api.dart
  12. 21
      lib/retrofit/retrofit_api.g.dart

BIN
assets/image/2x/login_channel.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 996 B

BIN
assets/image/2x/login_store.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
assets/image/3x/login_channel.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
assets/image/3x/login_store.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
assets/image/login_channel.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

BIN
assets/image/login_store.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

174
lib/login/login_store_select.dart

@ -0,0 +1,174 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import '../generated/l10n.dart';
import '../retrofit/data/base_data.dart';
import '../retrofit/data/channels_list.dart';
import '../retrofit/retrofit_api.dart';
import '../utils/flutter_utils.dart';
class LoginStoreSelect extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _LoginStoreSelect();
}
}
class _LoginStoreSelect extends State<LoginStoreSelect> {
ApiService apiService;
ChannelsList channelsList;
int channelIndex = 0;
@override
void initState() {
super.initState();
EasyLoading.show(status: S.current.zhengzaijiazai);
queryChannels();
}
queryChannels() async{
apiService = ApiService(Dio(), context: context);
BaseData<ChannelsList> baseData = await apiService.appChannels().catchError((error) {
print(error.message);
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
});
if (baseData != null && baseData.isSuccess) {
channelsList = baseData.data;
setState((){});
EasyLoading.dismiss();
} else {
if (baseData?.msg != null)
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: MyAppBar(
title: "渠道来源",
titleColor: Colors.black,
titleSize: 18.sp,
background: Color(0xFFFFFFFF),
leadingColor: Colors.black,
),
body: Container(
color: Color(0xFFFFFFFF),
height: double.infinity,
child: Column(
children: [
Padding(padding:EdgeInsets.only(top:18.h,bottom:20.h,left:18.w),
child: Row(
children: [
Image.asset(
"assets/image/login_channel.webp",
fit: BoxFit.fill,
width:24,
height:24,
),
SizedBox(width:12.w),
Text(
"Hi,您是通过什么途径了解到这款APP的?",
style: TextStyle(
fontWeight: MyFontWeight.bold,
fontSize: 15.sp,
color: Color(0xFF181818),
),
),
],
)),
Expanded(child: ListView.builder(
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
setState(() {
channelIndex = position;
});
},
child: channelItem(position),
);
},
itemCount:(channelsList != null && (channelsList?.channels?.length ?? 0) > 0) ? channelsList.channels.length : 0,
)),
if(channelsList != null && (channelsList.channels.length) > 0)
GestureDetector(
onTap: () {
Navigator.pop(context,channelsList.channels[channelIndex]);
},
child: Container(
width: double.infinity,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(27),
),
margin: EdgeInsets.only(
left: 16, right: 16, bottom: 21),
padding: EdgeInsets.symmetric(vertical:18.h),
child: Text(
S.of(context).queren,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
)
],
),
),
);
}
Widget channelItem(index){
return Container(
height:52 ,
margin: EdgeInsets.only(bottom: 12,left: 14,right: 14),
child: Stack(
alignment: Alignment.bottomRight,
children: [
Container(
height: 52.h,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: new BorderRadius.circular(6),
border: Border.all(
color: channelIndex == index ? Color(0xFF32A060) : Color(0xFFF7F7F7),
width: channelIndex == index ? 1 : 0,
),
color:channelIndex == index ? Color(0xFFF0FAF4) : Color(0xFFF7F7F7),
),
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 12,),
child: Text(
channelsList.channels[index],
style: TextStyle(
fontWeight: MyFontWeight.bold,
fontSize: 14.sp,
color: channelIndex == index ? Color(0xFF32A060) : Colors.black,
),
),
),
if (index == channelIndex)
Image.asset(
"assets/image/recharge.webp",
width: 20,
height: 20,
fit: BoxFit.fill,
),
],
),
);
}
}

46
lib/login/new_login_page.dart

@ -53,6 +53,7 @@ class _NewLoginPage extends State<NewLoginPage> {
Timer _timer; Timer _timer;
bool isShowLogin = false; bool isShowLogin = false;
String area = "+86"; String area = "+86";
String channelName;
@override @override
void initState() { void initState() {
@ -211,7 +212,8 @@ class _NewLoginPage extends State<NewLoginPage> {
"capcha": code, "capcha": code,
"mobile": mobile, "mobile": mobile,
"invite": invite, "invite": invite,
"areaCode": area "areaCode": area,
"regChannel":channelName ?? ""
}; };
EasyLoading.show(status: S.of(context).zhengzaijiazai); EasyLoading.show(status: S.of(context).zhengzaijiazai);
BaseData value = await apiService.memberLogin(param).catchError((error) { BaseData value = await apiService.memberLogin(param).catchError((error) {
@ -592,7 +594,47 @@ class _NewLoginPage extends State<NewLoginPage> {
), ),
), ),
SizedBox( SizedBox(
height: 51.h, height: 30.h,
),
GestureDetector(
onTap: (){
Navigator.of(context).pushNamed('/router/login_store_select').then((value) => {
setState(() {
if (value != null) channelName = value;
})
});
},
child:Container(
padding: EdgeInsets.only(left:12.w,right:12.w,top:16.h,bottom:16.h),
margin: EdgeInsets.only(bottom:30.h),
decoration: BoxDecoration(
color: Color(0xFFF1F1F1),
borderRadius: BorderRadius.circular(4),
),
child: Row(
children: [
Image.asset(
"assets/image/login_store.webp",
fit: BoxFit.fill,
width:14,
height:14,
),
SizedBox(width: 3.w,),
Expanded(child:Text(
channelName ?? "邀请来源(选填)",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(0xFF868686),
),
)),
Icon(
Icons.arrow_forward_ios,
size: 16,
),
],
),
),
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,

3
lib/main.dart

@ -95,6 +95,7 @@ import 'home/help_farmers/help_farmers_page.dart';
import 'home/home_view/activity_list.dart'; import 'home/home_view/activity_list.dart';
import 'home/welfare_exchange.dart'; import 'home/welfare_exchange.dart';
import 'home/welfare_page.dart'; import 'home/welfare_page.dart';
import 'login/login_store_select.dart';
import 'login/new_login_page.dart'; import 'login/new_login_page.dart';
import 'login/phone_address_page.dart'; import 'login/phone_address_page.dart';
import 'main_page.dart'; import 'main_page.dart';
@ -429,4 +430,6 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
SystemNotice(), SystemNotice(),
'/router/store_html': (context, {arguments}) => '/router/store_html': (context, {arguments}) =>
StoreHtml(arguments:arguments), StoreHtml(arguments:arguments),
'/router/login_store_select': (context, {arguments}) =>
LoginStoreSelect(),
}; };

155
lib/retrofit/data/channels_list.dart

@ -0,0 +1,155 @@
/// channels : ["海峡","回乡","boom"]
/// isOpen : true
/// preferentialList : [{"createTime":"2023-04-21 16:15:42","giftdMoney":"0.00","gitfdCouponId":null,"id":"1506553893994102784","isDeleted":0,"rechargeMoney":"0.01","rechargeType":0,"remark":"<p>充值说明:<br />平台充值根据用户在平台的会员等级享有不同的充值权益。<br />银卡用户享1.1倍充值会员权益,即充值100元账户110元。<br />金卡用户享1.2倍充值会员权益,即充值100元账户120元。<br />共创用户享1.3倍充值会员权益,即充值100元账户130元。<br />平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。<br />储值活动不与其他活动同享</p>","sortValue":1,"tenantCode":"admin"}]
class ChannelsList {
ChannelsList({
List<String> channels,
bool isOpen,
List<PreferentialList> preferentialList,}){
_channels = channels;
_isOpen = isOpen;
_preferentialList = preferentialList;
}
ChannelsList.fromJson(dynamic json) {
_channels = json['channels'] != null ? json['channels'].cast<String>() : [];
_isOpen = json['isOpen'];
if (json['preferentialList'] != null) {
_preferentialList = [];
json['preferentialList'].forEach((v) {
_preferentialList.add(PreferentialList.fromJson(v));
});
}
}
List<String> _channels;
bool _isOpen;
List<PreferentialList> _preferentialList;
ChannelsList copyWith({ List<String> channels,
bool isOpen,
List<PreferentialList> preferentialList,
}) => ChannelsList( channels: channels ?? _channels,
isOpen: isOpen ?? _isOpen,
preferentialList: preferentialList ?? _preferentialList,
);
List<String> get channels => _channels;
bool get isOpen => _isOpen;
List<PreferentialList> get preferentialList => _preferentialList;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['channels'] = _channels;
map['isOpen'] = _isOpen;
if (_preferentialList != null) {
map['preferentialList'] = _preferentialList.map((v) => v.toJson()).toList();
}
return map;
}
}
/// createTime : "2023-04-21 16:15:42"
/// giftdMoney : "0.00"
/// gitfdCouponId : null
/// id : "1506553893994102784"
/// isDeleted : 0
/// rechargeMoney : "0.01"
/// rechargeType : 0
/// remark : "<p>充值说明:<br />平台充值根据用户在平台的会员等级享有不同的充值权益。<br />银卡用户享1.1倍充值会员权益,即充值100元账户110元。<br />金卡用户享1.2倍充值会员权益,即充值100元账户120元。<br />共创用户享1.3倍充值会员权益,即充值100元账户130元。<br />平台充值金可在平台上所有品牌和门店使用,包含:农场火锅、海峡姐妹、前进麦味、百年川椒、农场煮意、一心回乡生态农场等。<br />储值活动不与其他活动同享</p>"
/// sortValue : 1
/// tenantCode : "admin"
class PreferentialList {
PreferentialList({
String createTime,
String giftdMoney,
dynamic gitfdCouponId,
String id,
num isDeleted,
String rechargeMoney,
num rechargeType,
String remark,
num sortValue,
String tenantCode,}){
_createTime = createTime;
_giftdMoney = giftdMoney;
_gitfdCouponId = gitfdCouponId;
_id = id;
_isDeleted = isDeleted;
_rechargeMoney = rechargeMoney;
_rechargeType = rechargeType;
_remark = remark;
_sortValue = sortValue;
_tenantCode = tenantCode;
}
PreferentialList.fromJson(dynamic json) {
_createTime = json['createTime'];
_giftdMoney = json['giftdMoney'];
_gitfdCouponId = json['gitfdCouponId'];
_id = json['id'];
_isDeleted = json['isDeleted'];
_rechargeMoney = json['rechargeMoney'];
_rechargeType = json['rechargeType'];
_remark = json['remark'];
_sortValue = json['sortValue'];
_tenantCode = json['tenantCode'];
}
String _createTime;
String _giftdMoney;
dynamic _gitfdCouponId;
String _id;
num _isDeleted;
String _rechargeMoney;
num _rechargeType;
String _remark;
num _sortValue;
String _tenantCode;
PreferentialList copyWith({ String createTime,
String giftdMoney,
dynamic gitfdCouponId,
String id,
num isDeleted,
String rechargeMoney,
num rechargeType,
String remark,
num sortValue,
String tenantCode,
}) => PreferentialList( createTime: createTime ?? _createTime,
giftdMoney: giftdMoney ?? _giftdMoney,
gitfdCouponId: gitfdCouponId ?? _gitfdCouponId,
id: id ?? _id,
isDeleted: isDeleted ?? _isDeleted,
rechargeMoney: rechargeMoney ?? _rechargeMoney,
rechargeType: rechargeType ?? _rechargeType,
remark: remark ?? _remark,
sortValue: sortValue ?? _sortValue,
tenantCode: tenantCode ?? _tenantCode,
);
String get createTime => _createTime;
String get giftdMoney => _giftdMoney;
dynamic get gitfdCouponId => _gitfdCouponId;
String get id => _id;
num get isDeleted => _isDeleted;
String get rechargeMoney => _rechargeMoney;
num get rechargeType => _rechargeType;
String get remark => _remark;
num get sortValue => _sortValue;
String get tenantCode => _tenantCode;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['createTime'] = _createTime;
map['giftdMoney'] = _giftdMoney;
map['gitfdCouponId'] = _gitfdCouponId;
map['id'] = _id;
map['isDeleted'] = _isDeleted;
map['rechargeMoney'] = _rechargeMoney;
map['rechargeType'] = _rechargeType;
map['remark'] = _remark;
map['sortValue'] = _sortValue;
map['tenantCode'] = _tenantCode;
return map;
}
}

5
lib/retrofit/retrofit_api.dart

@ -27,6 +27,7 @@ import 'data/app_update.dart';
import 'data/banner.dart'; import 'data/banner.dart';
import 'data/brand_data.dart'; import 'data/brand_data.dart';
import 'data/category_select_list.dart'; import 'data/category_select_list.dart';
import 'data/channels_list.dart';
import 'data/chapter.dart'; import 'data/chapter.dart';
import 'data/collect_class_list.dart'; import 'data/collect_class_list.dart';
import 'data/coupon_detail.dart'; import 'data/coupon_detail.dart';
@ -177,6 +178,10 @@ abstract class ApiService {
@POST("/auth/platform/memberLogin") @POST("/auth/platform/memberLogin")
Future<BaseData> memberLogin(@Body() Map<String, dynamic> param); Future<BaseData> memberLogin(@Body() Map<String, dynamic> param);
///APP门店推广渠道
@GET("/auth/appChannels")
Future<BaseData<ChannelsList>> appChannels();
/// ///
@GET("/auth/sendVerify/{areaCode}/{mobile}") @GET("/auth/sendVerify/{areaCode}/{mobile}")
Future<BaseData> sendVerify(@Path("areaCode") String areaCode, @Path("mobile") String mobile); Future<BaseData> sendVerify(@Path("areaCode") String areaCode, @Path("mobile") String mobile);

21
lib/retrofit/retrofit_api.g.dart

@ -98,6 +98,27 @@ class _ApiService implements ApiService {
return value; return value;
} }
@override
Future<BaseData<ChannelsList>> appChannels() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/auth/appChannels',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<ChannelsList>.fromJson(
_result.data,
(json) => ChannelsList.fromJson(json),
);
return value;
}
@override @override
Future<BaseData<dynamic>> sendVerify(areaCode,mobile) async { Future<BaseData<dynamic>> sendVerify(areaCode,mobile) async {
ArgumentError.checkNotNull(mobile, 'mobile'); ArgumentError.checkNotNull(mobile, 'mobile');

Loading…
Cancel
Save