Browse Source

小程序接口 操作 token修改

dart3_last
fff 3 days ago
parent
commit
b4aa9354c4
  1. 4
      lib/home/help_farmers/help_farmers_page.dart
  2. 3
      lib/home/home_view/home_recommend_goods.dart
  3. 4
      lib/home/home_view/top_selling_list.dart
  4. 15
      lib/im/chat_details_page.dart
  5. 7
      lib/im/im_view/im_page.dart
  6. 3
      lib/mine/mine_shop_details.dart
  7. 3
      lib/mine/mine_shop_recharge.dart
  8. 4
      lib/mine/mine_view/mine_view.dart
  9. 3
      lib/mine/vip_detail_page.dart
  10. 3
      lib/order/order_history_page.dart
  11. 3
      lib/order/order_view/order_address.dart
  12. 17
      lib/retrofit/min_api.dart
  13. 2
      lib/retrofit/min_api.g.dart
  14. 5
      lib/retrofit/retrofit_api.dart
  15. 2
      lib/store/scan.dart
  16. 13
      lib/store/shop/shop_scroll_coordinator.dart
  17. 2
      lib/store/shop_details_page.dart
  18. 3
      lib/store/store_order.dart
  19. 8
      lib/store/store_view/store_order_list.dart
  20. 3
      lib/union/union_list.dart
  21. 5
      lib/utils/app_util.dart
  22. 2
      lib/utils/shared_preference.dart
  23. 6
      lib/view_widget/login_tips.dart
  24. 3
      lib/view_widget/selector_store_dialog.dart
  25. 3
      lib/vip/vip_view/vip_goods_discount.dart
  26. 6
      lib/web/web_view/web_content.dart
  27. 4
      pubspec.lock
  28. 2
      pubspec.yaml

4
lib/home/help_farmers/help_farmers_page.dart

@ -50,8 +50,7 @@ class _HelpFarmersPage extends State<HelpFarmersPage> {
///
queryConfig() async {
try {
BaseListData<Farmers>? baseData =
await apiService?.getConfig().catchError((error) {
BaseListData<Farmers>? baseData = await apiService?.getConfig().catchError((error) {
networkStatus = -1;
refreshController.refreshFailed();
return BaseListData<Farmers>()..isSuccess = false;
@ -97,6 +96,7 @@ class _HelpFarmersPage extends State<HelpFarmersPage> {
SliverAppBar(
pinned: true,
backgroundColor: Color(0xFF32A060),
surfaceTintColor: Colors.transparent,
elevation: 0,
leading: GestureDetector(
onTap: () {

3
lib/home/home_view/home_recommend_goods.dart

@ -56,7 +56,8 @@ class _HomeRecommendGoods extends State<HomeRecommendGoods> {
return GestureDetector(
onTap: () {
String storeId = widget.homeRank!.CommodityZone![position].storeId ?? "";
miniLogin(apiService!, storeId, (token) {
String tenant = widget.homeRank!.CommodityZone![position].tenantCode ?? "";
miniLogin(apiService!, tenant, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

4
lib/home/home_view/top_selling_list.dart

@ -125,7 +125,9 @@ class _TopSellingList extends State<TopSellingList> {
onTap: () {
String storeId = widget.homeRank!.CommodityList![index]
.goodList![position].storeId ?? "";
miniLogin(apiService!, storeId, (token) {
String tenant = widget.homeRank!.CommodityList![index]
.goodList![position].tenantCode ?? "";
miniLogin(apiService!, tenant, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

15
lib/im/chat_details_page.dart

@ -346,7 +346,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
showCamera: false,
compressSize: 500,
uiConfig: UIConfig(
uiThemeColor: Color(0xFFFFFFFF),
uiThemeColor: Color(0xFFAAAAAA),
),
cropConfig: CropConfig(
enableCrop: false,
@ -834,6 +834,12 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Container(
alignment: Alignment.centerRight,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (message.state == 3)
Container(
@ -858,10 +864,7 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
SizedBox(
width: 12.w,
),
Expanded(
child: Container(
alignment: Alignment.centerRight,
child: InkWell(
InkWell(
onLongPress: () {
showMessageMenu(context, _buttonKey, message, index, loadanimatedListKey);
},
@ -895,6 +898,8 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
),
),
),
],
),
),
),
SizedBox(

7
lib/im/im_view/im_page.dart

@ -515,8 +515,11 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
width: 12.w,
),
Expanded(
child: SizedBox(
height: 54,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Row(
children: [
@ -548,9 +551,6 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
),
],
),
SizedBox(
height: 7.h,
),
Row(
children: [
Expanded(
@ -588,6 +588,7 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
],
),
),
),
],
),
),

3
lib/mine/mine_shop_details.dart

@ -681,7 +681,8 @@ class _MineShopDetails extends State<MineShopDetails> {
);
} else {
String storeId = store.id ?? "";
miniLogin(apiService!, storeId, (token) {
String tenant = store.tenantCode ?? "";
miniLogin(apiService!, tenant, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

3
lib/mine/mine_shop_recharge.dart

@ -840,7 +840,8 @@ class _MineShopRecharge extends State<MineShopRecharge> {
);
} else {
String storeId = store.id ?? "";
miniLogin(apiService!, storeId, (token) {
String tenant = store.tenantCode ?? "";
miniLogin(apiService!, tenant, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

4
lib/mine/mine_view/mine_view.dart

@ -196,8 +196,8 @@ class _MineView extends State<MineView> {
if (tableId != "" &&
tenantCode != "" &&
shopId != "") {
String storeId = shopId ?? "";
miniLogin(apiService!, storeId, (token) {
String storeId = shopId;
miniLogin(apiService!, tenantCode, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

3
lib/mine/vip_detail_page.dart

@ -445,7 +445,8 @@ class _VipDetailPage extends State<VipDetailPage> {
);
} else {
String storeId = store.id ?? "";
miniLogin(apiService!, storeId, (token) {
String tenant = store.tenantCode ?? "";
miniLogin(apiService!, tenant, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

3
lib/order/order_history_page.dart

@ -298,7 +298,8 @@ class _OrderHistoryList extends State<OrderHistoryList>
);
} else {
String storeId = orderInfo.storeVO?.id ?? "";
miniLogin(apiService!, storeId, (token) {
String tenant = orderInfo.tenantCode ?? "";
miniLogin(apiService!, tenant, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

3
lib/order/order_view/order_address.dart

@ -268,7 +268,8 @@ class _OrderAddress extends State<OrderAddress> {
Navigator.of(context).pop();
} else if (widget.jumpState == 2) {
String storeId = widget.orderInfo?.storeVO?.id ?? "";
miniLogin(widget.apiService!, storeId, (token) {
String tenant = widget.orderInfo?.tenantCode ?? "";
miniLogin(widget.apiService!, tenant, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

17
lib/retrofit/min_api.dart

@ -58,8 +58,8 @@ abstract class MinApiService {
baseUrl = kReleaseMode ? serviceMiniBaseUrl : localMiniBaseUrl;
headers["Environment"] = "app";
dio.options = BaseOptions(
connectTimeout: 18000.milliseconds,
receiveTimeout: 18000.milliseconds,
connectTimeout: 36000.milliseconds,
receiveTimeout: 36000.milliseconds,
headers: headers,
responseType: ResponseType.json,
);
@ -68,14 +68,11 @@ abstract class MinApiService {
RequestOptions options,
RequestInterceptorHandler handler,
) {
debugPrint(
"\n======================= Min_请求数据 =======================");
debugPrint("\n======================= Min_请求数据 =======================");
debugPrint("method = ${options.method.toString()}");
debugPrint("url = ${options.uri.toString()}");
debugPrint("headers = ${options.headers}");
if (showLoading &&
!SmartDialog.checkExist(
dialogTypes: {SmartAllDialogType.loading})) {
if (showLoading && !SmartDialog.checkExist(dialogTypes: {SmartAllDialogType.loading})) {
AppUtils.cancelCloseLoading();
//loading
S.current.zhengzaijiazai.loading;
@ -102,8 +99,7 @@ abstract class MinApiService {
if (map["code"] == 40005 || map["code"] == 40001) {
LoginTipsDialog.instance.show(context);
}
debugPrint(
"======================= Min_响应数据结束 =======================\n");
debugPrint("======================= Min_响应数据结束 =======================\n");
if (map["code"] == 0) {
handler.next(response);
} else {
@ -121,8 +117,7 @@ abstract class MinApiService {
if (SmartDialog.checkExist(dialogTypes: {SmartAllDialogType.loading})) {
AppUtils.closeLoading();
}
debugPrint(
"\n======================= Min_错误响应数据 =======================");
debugPrint("\n======================= Min_错误响应数据 =======================");
debugPrint("type = ${e.type}");
debugPrint("message = ${e.message}");
debugPrint("\n");

2
lib/retrofit/min_api.g.dart

@ -14,7 +14,7 @@ class _MinApiService implements MinApiService {
this.baseUrl,
this.errorLogger,
}) {
baseUrl ??= 'http://192.168.10.54:8765/app/';
baseUrl ??= serviceMiniBaseUrl;
}
final Dio _dio;

5
lib/retrofit/retrofit_api.dart

@ -73,7 +73,7 @@ import 'package:retrofit/retrofit.dart';
part 'retrofit_api.g.dart';
@RestApi(baseUrl: kDebugMode ? serviceBaseUrl : localBaseUrl)
@RestApi(baseUrl: kReleaseMode ? serviceBaseUrl : localBaseUrl)
abstract class ApiService {
factory ApiService(
Dio dio, {
@ -90,8 +90,7 @@ abstract class ApiService {
headers["Environment"] = "app";
}
print("软件当前运行的模式 kReleaseMode:" + (kReleaseMode ? "发布模式" : "调试模式"));
baseUrl = kDebugMode ? serviceBaseUrl : localBaseUrl;
if (kDebugMode) baseUrl = serviceBaseUrl;
baseUrl = kReleaseMode ? serviceBaseUrl : localBaseUrl;
if (isIp) baseUrl = ipBaseUrl;
dio.options = BaseOptions(
connectTimeout: 30000.milliseconds,

2
lib/store/scan.dart

@ -35,7 +35,7 @@ class Scan {
if (table?.isNotEmpty ?? false) {
int? tableId = int.tryParse(table!);
String storeId = id ?? "";
miniLogin(apiService!, storeId, (token) {
miniLogin(apiService, tenantCode, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

13
lib/store/shop/shop_scroll_coordinator.dart

@ -73,33 +73,28 @@ class ShopScrollCoordinator {
/// Header最大程度展开状态
PageExpandState pageExpand = PageExpandState.NotExpand;
set (PageExpandState value) {
pageExpand = value;
pageExpandChange?.call();
}
///
void onPointerUp(PointerUpEvent event) {
final double _pagePixels = _pageScrollPosition.pixels;
if (0.0 < _pagePixels && _pagePixels < (_pageInitialOffset ?? 0)) {
if (pageExpand == PageExpandState.NotExpand
&& (_pageInitialOffset ?? 0) - _pagePixels > _scrollRedundancy && _pageScrollPosition.userScrollDirection == ScrollDirection.forward) {
&& (_pageInitialOffset ?? 0) - _pagePixels > _scrollRedundancy) {
_pageScrollPosition.animateTo(
0.0,
duration: const Duration(milliseconds: 400),
curve: Curves.ease,
).then((_) => set(PageExpandState.Expanded));
} else if (pageExpand == PageExpandState.Expanded && _pageScrollPosition.userScrollDirection == ScrollDirection.reverse) {
);
} else if (pageExpand == PageExpandState.Expanded) {
pageExpand = PageExpandState.Expanding;
_pageScrollPosition.animateTo((_pageInitialOffset ?? 0),
duration: const Duration(milliseconds: 400),
curve: Curves.ease,
).then((_) => set(PageExpandState.NotExpand));
);
}
}
}
Function()? pageExpandChange;
///
void updateUserScrollDirection(ShopScrollPosition? position, ScrollDirection? value) {

2
lib/store/shop_details_page.dart

@ -1335,7 +1335,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
(tenantCode?.isNotEmpty ?? false) &&
(shopId?.isNotEmpty ?? false)) {
String storeId = shopId ?? "";
miniLogin(apiService!, storeId, (token) {
miniLogin(apiService!, tenantCode ?? "", storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

3
lib/store/store_order.dart

@ -87,6 +87,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
tabcontroller = TabController(length: 1, vsync: this);
_pageScrollController = _shopCoordinator.pageScrollController(0);
_shopCoordinator.pinnedHeaderSliverHeightBuilder = () {
return View.of(context).padding.top + 38;
};
apiService = ApiService(
Dio(),

8
lib/store/store_view/store_order_list.dart

@ -61,7 +61,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
List<FindMiniGroup>? appletProducts;
List<ProductListBean> productListBeans = [];
int currentIndex = 0;
double _viewportDimension = 0;
late ShopScrollCoordinator _shopCoordinator;
late ShopScrollController _listScrollController1;
@ -74,7 +74,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
_listScrollController1 = _shopCoordinator.newChildScrollController();
_listScrollController2 = _shopCoordinator.newChildScrollController();
_listScrollController2.addListener(() {
_viewportDimension = _listScrollController2.position.viewportDimension;
for (int i = 0; i < (appletProducts?.length ?? 0); i++) {
if (currentIndex != i && _listScrollController2.offset >= (appletProducts?[i].goodsIndex ?? 0) &&
(i == (appletProducts?.length ?? 0) - 1 || _listScrollController2.offset < (appletProducts?[i + 1].goodsIndex ?? 0))) {
@ -141,7 +141,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
width: 100,
child: ListView.builder(
itemCount: appletProducts?.length ?? 0,
physics: AlwaysScrollableScrollPhysics(),
physics: ClampingScrollPhysics(),
controller: _listScrollController1,
padding: EdgeInsets.only(top: 0, bottom: 12.h),
itemBuilder: (context, position) {
@ -154,7 +154,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
itemCount: appletProducts?.length ?? 0,
padding: EdgeInsets.only(top: 0),
controller: _listScrollController2,
physics: AlwaysScrollableScrollPhysics(),
physics: ClampingScrollPhysics(),
itemBuilder: (context, position) {
return rightOrderItem(position);
},

3
lib/union/union_list.dart

@ -133,7 +133,8 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
return InkWell(
onTap: () {
String storeId = storeList![position].id ?? "";
miniLogin(apiService!, storeId, (token) {
String tenant = storeList![position].tenantCode ?? "";
miniLogin(apiService!, tenant, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {

5
lib/utils/app_util.dart

@ -8,9 +8,12 @@ import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/shared_preference.dart';
miniLogin(ApiService apiService, String storeId, Function(String token) callback) async {
miniLogin(ApiService apiService, String tenant, String storeId, Function(String token) callback) async {
apiService.minLogin(storeId).then((baseData) async {
if (baseData.isSuccess ?? false) {
Map<String, dynamic> minStoreInfo = baseData.data;
String minToken = minStoreInfo["token"];
SharedInstance.instance.saveMini(minToken, tenant, storeId);
callback.call(baseData.data["token"]);
}
}, onError: (error) {

2
lib/utils/shared_preference.dart

@ -71,7 +71,7 @@ class SharedInstance {
}
void saveMini(minToken, tenant, storeId) {
_storage?.setString('minToken', minToken);
_storage?.setString('miniToken', minToken);
_storage?.setString('tenant', tenant);
_storage?.setString('storeId', storeId);
}

6
lib/view_widget/login_tips.dart

@ -21,13 +21,13 @@ class LoginTips extends StatelessWidget {
// width: 0.7867.sw,
// height: 0.7867.sw / (Platform.isAndroid ? 0.86 : 0.9),
width:double.infinity,
height:MediaQuery.of(context).size.width / 1,
margin: EdgeInsets.symmetric(horizontal:28.w),
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: IntrinsicHeight(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
@ -116,8 +116,10 @@ class LoginTips extends StatelessWidget {
),
),
),
),
onWillPop: () async {
return Future.value(false);
});
},
);
}
}

3
lib/view_widget/selector_store_dialog.dart

@ -151,7 +151,8 @@ class _SelectorStoreWidget extends State<SelectorStoreWidget> {
// }
else {
String storeId = widget.stores[selectIndex].id ?? "";
miniLogin(apiService!, storeId, (token) {
String tenant = widget.stores[selectIndex].tenantCode ?? "";
miniLogin(apiService!, tenant, storeId, (token) {
Navigator.of(context).pushReplacementNamed(
'/router/store_order',
arguments: {

3
lib/vip/vip_view/vip_goods_discount.dart

@ -173,7 +173,8 @@ class _VipGoodsDiscount extends State<VipGoodsDiscount> {
return GestureDetector(
onTap: () {
// String storeId = widget.vipCardHome.productVips?[position].storeId ?? "";
// miniLogin(apiService!, storeId, (token) {
// String tenant = widget.vipCardHome.productVips?[position].tenantCode ?? "";
// miniLogin(apiService!, tenant, storeId, (token) {
// Navigator.of(context).pushReplacementNamed(
// '/router/store_order',
// arguments: {

6
lib/web/web_view/web_content.dart

@ -69,7 +69,8 @@ class _WebContent extends State<WebContent> {
onLinkTap: (url, attributes, element) {
if(attributes.containsKey("storeid")){
String storeId = attributes["storeid"] ?? "";
miniLogin(widget.apiService!, storeId, (token) {
String tenant = attributes["tenantcode"] ?? "";
miniLogin(widget.apiService!, tenant, storeId, (token) {
Navigator.of(context).pushReplacementNamed(
'/router/store_order',
arguments: {
@ -85,7 +86,8 @@ class _WebContent extends State<WebContent> {
onAnchorTap: (url, attributes, element) {
if(attributes.containsKey("storeid")){
String storeId = attributes["storeid"] ?? "";
miniLogin(widget.apiService!, storeId, (token) {
String tenant = attributes["tenantcode"] ?? "";
miniLogin(widget.apiService!, tenant, storeId, (token) {
Navigator.of(context).pushReplacementNamed(
'/router/store_order',
arguments: {

4
pubspec.lock

@ -761,10 +761,10 @@ packages:
dependency: "direct main"
description:
name: image_pickers
sha256: "79de5abf134256eb148565d45c4e0bee406399f353b8d56de18b52c4c509faa6"
sha256: "43b3098d1d0cee1bbddd919814cee83582d40842f9fc41c1af3c7174dce5a3c9"
url: "https://pub.dev"
source: hosted
version: "2.0.4+8"
version: "2.0.5+2"
infinite_listview:
dependency: transitive
description:

2
pubspec.yaml

@ -95,7 +95,7 @@ dependencies:
url_launcher: ^6.3.1
#多图, 裁剪
image_pickers: 2.0.4+8
image_pickers: ^2.0.5+2
scan: ^1.6.0
path_provider: ^2.1.4

Loading…
Cancel
Save