更新天气获取方式;更新关于我们和操作说明地址配置
This commit is contained in:
@@ -50,4 +50,8 @@ class ServiceConstant {
|
||||
|
||||
static const String policy_url =
|
||||
"https://vsbst-api.he-info.cn/vsbs_sotrage/privacy-scheme/"; //协议地址
|
||||
|
||||
static const String weather_url =
|
||||
"/api/weather/info"; //天气信息
|
||||
|
||||
}
|
||||
|
||||
@@ -54,8 +54,9 @@ class AppConstants {
|
||||
|
||||
//系统参数
|
||||
//运行打包APP模式
|
||||
int ent_type = APPPackageType.MHT.code; //1.默认太和 2.欢睡 3.眠花糖
|
||||
// int ent_type = APPPackageType.TH.code; //1.默认太和 2.欢睡 3.眠花糖
|
||||
// int ent_type = APPPackageType.MHT.code; //1.默认太和 2.欢睡 3.眠花糖
|
||||
int ent_type = APPPackageType.TH.code; //1.默认太和 2.欢睡 3.眠花糖
|
||||
// int ent_type = APPPackageType.HUANSHUI.code; //1.默认太和 2.欢睡 3.眠花糖
|
||||
int text_length = 8;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,11 @@ import 'package:geocoding/geocoding.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:path/path.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||
@@ -59,8 +61,8 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
|
||||
|
||||
try {
|
||||
await _getCurrentLocation();
|
||||
_weatherTimer = Timer.periodic(Duration(seconds: 5), (timer) {
|
||||
getCurrentWeather(); // 每 5 秒更新一次天气
|
||||
_weatherTimer = Timer.periodic(Duration(minutes: 10), (timer) {
|
||||
getCurrentWeather(); // 每 60 秒更新一次天气
|
||||
});
|
||||
|
||||
_locationTimer = Timer.periodic(Duration(minutes: 10), (timer) {
|
||||
@@ -92,7 +94,7 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
|
||||
}
|
||||
|
||||
String? language = "zh_CN";
|
||||
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
||||
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
@@ -188,7 +190,7 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
|
||||
try {
|
||||
weatherFactory.language = Language.CHINESE_SIMPLIFIED;
|
||||
String? language = "zh_CN";
|
||||
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
||||
if (AppConstants().ent_type == APPPackageType.MHT.code) {
|
||||
if (mhLanguageController.selectLanguage != null) {
|
||||
language = mhLanguageController.selectLanguage.value!.language_code;
|
||||
}
|
||||
@@ -202,19 +204,40 @@ class WeatherModelController extends GetControllerEx<WeatherModel> {
|
||||
} else {
|
||||
weatherFactory.language = Language.ENGLISH;
|
||||
}
|
||||
Weather weather = await weatherFactory.currentWeatherByLocation(
|
||||
model.latitude!, model.longitude!);
|
||||
|
||||
model.weather_info = weather.weatherDescription;
|
||||
model.min_temperature = weather.tempMin?.celsius?.toInt();
|
||||
model.max_temperature = weather.tempMax?.celsius?.toInt();
|
||||
model.current_temperature = weather.temperature?.celsius?.toInt();
|
||||
model.wind_speed = weather.windSpeed?.toInt();
|
||||
model.weatherIcon = weather.weatherIcon;
|
||||
if (model.weatherIcon != null) {
|
||||
model.weatherIconurl =
|
||||
"https://openweathermap.org/img/w/${model.weatherIcon}.png";
|
||||
}
|
||||
// Weather weather = await weatherFactory.currentWeatherByLocation(
|
||||
// model.latitude!, model.longitude!);
|
||||
String location = "${model.longitude},${model.latitude}";
|
||||
String serviceAddress = ServiceConstant.service_address;
|
||||
String serviceName = ServiceConstant.server_service;
|
||||
String serviceApi = ServiceConstant.weather_url;
|
||||
String queryUrl =
|
||||
"${serviceAddress}${serviceName}${serviceApi}?location=$location";
|
||||
await requestWithLog(
|
||||
logTitle: "获取天气信息",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
print(res.data);
|
||||
model.weather_info = res.data["info"];
|
||||
model.current_temperature = int.parse(res.data["temp"]);
|
||||
if (res.data['icon'] != null) {
|
||||
model.weatherIconurl = "${res.data['icon']}";
|
||||
}
|
||||
model.cityName = res.data["city"];
|
||||
},
|
||||
onFailure: (res) {
|
||||
print(res.data);
|
||||
});
|
||||
// model.weather_info = weather.weatherDescription;
|
||||
// model.min_temperature = weather.tempMin?.celsius?.toInt();
|
||||
// model.max_temperature = weather.tempMax?.celsius?.toInt();
|
||||
// model.current_temperature = weather.temperature?.celsius?.toInt();
|
||||
// model.wind_speed = weather.windSpeed?.toInt();
|
||||
// model.weatherIcon = weather.weatherIcon;
|
||||
// if (model.weatherIcon != null) {
|
||||
// model.weatherIconurl =
|
||||
// "https://openweathermap.org/img/w/${model.weatherIcon}.png";
|
||||
// }
|
||||
updateAll(); // 更新 UI
|
||||
} catch (e) {
|
||||
EasyDartModule.logger.error("获取天气失败: $e");
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
@@ -13,6 +14,7 @@ import 'package:vbvs_app/controller/mh_controller/mh_language_controller.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/WebSocketMessage.dart';
|
||||
import 'package:vbvs_app/pages/common/bezier_bottom_navigation_bar.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/MattressControl.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/mht_sleep_report_page.dart';
|
||||
import 'package:vbvs_app/pages/mh_page/homepage/new_Home_page.dart';
|
||||
|
||||
@@ -6,8 +6,9 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/WebViewWidget.dart';
|
||||
|
||||
class HelpPage extends StatefulWidget {
|
||||
String url;
|
||||
late MyWebView webView;
|
||||
HelpPage({super.key});
|
||||
HelpPage({super.key, required this.url});
|
||||
|
||||
@override
|
||||
State<HelpPage> createState() => _HelpPageState();
|
||||
@@ -21,9 +22,10 @@ class _HelpPageState extends State<HelpPage> {
|
||||
super.initState();
|
||||
// pdfController.loadPdf();
|
||||
widget.webView = MyWebView(
|
||||
url: AppConstants().ent_type == 1
|
||||
? "https://mp.weixin.qq.com/s/hBo0FMYrpe04I2WV6wbcxQ"
|
||||
: "https://mp.weixin.qq.com/s/tOnQjYa7foFLgic-RMAb7Q",
|
||||
// url: AppConstants().ent_type == 1
|
||||
// ? "https://mp.weixin.qq.com/s/hBo0FMYrpe04I2WV6wbcxQ"
|
||||
// : "https://mp.weixin.qq.com/s/tOnQjYa7foFLgic-RMAb7Q",
|
||||
url: widget.url,
|
||||
onLoad: () {
|
||||
print('网页载入完毕');
|
||||
},
|
||||
|
||||
@@ -122,7 +122,7 @@ class _HomePageState extends State<HomePage> {
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(height: 35.rpx),
|
||||
|
||||
|
||||
ClickableContainer(
|
||||
padding: EdgeInsets.symmetric(vertical: 10.rpx),
|
||||
backgroundColor: Colors.transparent,
|
||||
@@ -375,11 +375,11 @@ class _HomePageState extends State<HomePage> {
|
||||
BoxDecoration(
|
||||
shape: BoxShape
|
||||
.circle),
|
||||
child: Image.network(
|
||||
weatherModelController
|
||||
.model
|
||||
.weatherIconurl!,
|
||||
fit: BoxFit.cover,
|
||||
child: SvgPicture.asset(
|
||||
"assets/images/weather/${weatherModelController.model.weatherIconurl}-fill.svg",
|
||||
// fit: BoxFit.cover,
|
||||
color: themeController
|
||||
.currentColor.sc4,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
|
||||
@@ -3,9 +3,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
@@ -14,6 +16,7 @@ import 'package:vbvs_app/controller/login/login_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||
import 'package:vbvs_app/enum/LoginStatus.dart';
|
||||
|
||||
class MinePage extends StatefulWidget {
|
||||
@@ -430,7 +433,7 @@ class _MinePageState extends State<MinePage> {
|
||||
.currentColor.sc21, // 点击时的背景色
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
onTap: () {
|
||||
onTap: () async {
|
||||
UserInfoController userInfoController =
|
||||
Get.find();
|
||||
if (userInfoController.model.login !=
|
||||
@@ -449,7 +452,38 @@ class _MinePageState extends State<MinePage> {
|
||||
// textColor:
|
||||
// themeController.currentColor.sc2,
|
||||
// );
|
||||
Get.toNamed("/helpPage");
|
||||
String url =
|
||||
"https://mp.weixin.qq.com/s/kwfTxy8d_cDU0j10mZWMgA";
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName =
|
||||
ServiceConstant.server_service;
|
||||
String serviceApi =
|
||||
ServiceConstant.user_setting;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
String type = "app_op_desc";
|
||||
String code = "th";
|
||||
if (AppConstants().ent_type ==
|
||||
APPPackageType.TH.code) {
|
||||
code = "th";
|
||||
} else if (AppConstants().ent_type ==
|
||||
APPPackageType.HUANSHUI.code) {
|
||||
code = "hs";
|
||||
} else {
|
||||
code = 'th';
|
||||
}
|
||||
queryUrl =
|
||||
"$queryUrl?type=$type&code=$code";
|
||||
await requestWithLog(
|
||||
logTitle: "查询操作说明",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
url = res.data['url'];
|
||||
},
|
||||
);
|
||||
Get.toNamed("/helpPage", arguments: url);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
@@ -588,9 +622,7 @@ class _MinePageState extends State<MinePage> {
|
||||
themeController.currentColor.sc9,
|
||||
);
|
||||
Get.toNamed("/loginPage");
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {}
|
||||
},
|
||||
child: Container(
|
||||
child: Padding(
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/controller/device/body_device_controller.dart';
|
||||
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
|
||||
import 'package:vbvs_app/controller/weather/weather_controller.dart';
|
||||
import 'package:vbvs_app/language/AppLanguage.dart';
|
||||
@@ -138,6 +139,11 @@ class _LanguageSettingState extends State<LanguageSetting> {
|
||||
Get.find();
|
||||
weatherModelController
|
||||
.getCurrentWeather();
|
||||
BodyDeviceController
|
||||
bodyDeviceController =
|
||||
Get.find();
|
||||
await bodyDeviceController
|
||||
.getSleepReport();
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,9 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/WebViewWidget.dart';
|
||||
|
||||
class AboutUsPage extends StatefulWidget {
|
||||
String url;
|
||||
late MyWebView webView;
|
||||
AboutUsPage({super.key});
|
||||
AboutUsPage({super.key, required this.url});
|
||||
|
||||
@override
|
||||
State<AboutUsPage> createState() => _AboutUsPageState();
|
||||
@@ -20,9 +21,10 @@ class _AboutUsPageState extends State<AboutUsPage> {
|
||||
// pdfController.loadPdf();
|
||||
|
||||
widget.webView = MyWebView(
|
||||
url: AppConstants().ent_type == 1
|
||||
? "https://mp.weixin.qq.com/s/IAr4RNBy0hGJXGKyMxe7eQ"
|
||||
: "https://mp.weixin.qq.com/s/7BvvprVDqX1eOzM3Lms8dg",
|
||||
// url: AppConstants().ent_type == 1
|
||||
// ? "https://mp.weixin.qq.com/s/IAr4RNBy0hGJXGKyMxe7eQ"
|
||||
// : "https://mp.weixin.qq.com/s/7BvvprVDqX1eOzM3Lms8dg",
|
||||
url:widget.url,
|
||||
onLoad: () {
|
||||
print('网页载入完毕');
|
||||
},
|
||||
|
||||
@@ -2,10 +2,12 @@ import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/ServiceConstant.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/color/app_uri_status.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.dart';
|
||||
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
@@ -14,6 +16,7 @@ import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/enum/APPPackageType.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
|
||||
class SettingPage extends StatefulWidget {
|
||||
@@ -295,9 +298,40 @@ class _SettingPageState extends State<SettingPage> {
|
||||
.currentColor.sc21, // 点击时的背景色
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
onTap: () {
|
||||
onTap: () async {
|
||||
String url =
|
||||
"https://mp.weixin.qq.com/s/IAr4RNBy0hGJXGKyMxe7eQ";
|
||||
String serviceAddress =
|
||||
ServiceConstant.service_address;
|
||||
String serviceName =
|
||||
ServiceConstant.server_service;
|
||||
String serviceApi =
|
||||
ServiceConstant.user_setting;
|
||||
String queryUrl =
|
||||
"$serviceAddress$serviceName$serviceApi";
|
||||
String type = "app_about_us";
|
||||
String code = "th";
|
||||
if (AppConstants().ent_type ==
|
||||
APPPackageType.TH.code) {
|
||||
code = "th";
|
||||
} else if (AppConstants().ent_type ==
|
||||
APPPackageType.HUANSHUI.code) {
|
||||
code = "hs";
|
||||
} else {
|
||||
code = 'th';
|
||||
}
|
||||
queryUrl =
|
||||
"$queryUrl?type=$type&code=$code";
|
||||
await requestWithLog(
|
||||
logTitle: "查询操作说明",
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: queryUrl,
|
||||
onSuccess: (res) {
|
||||
url = res.data['url'];
|
||||
},
|
||||
);
|
||||
print('点击了容器');
|
||||
Get.toNamed("/aboutUsPage");
|
||||
Get.toNamed("/aboutUsPage", arguments: url);
|
||||
},
|
||||
child: Container(
|
||||
child: Padding(
|
||||
|
||||
@@ -72,7 +72,7 @@ var routes = {
|
||||
"/wifiPagePerson": (contxt, {arguments}) => WifiPagePerson(type: arguments),
|
||||
"/updateUserPage": (contxt) => UpdateUserPage(),
|
||||
"/settingPage": (contxt) => SettingPage(),
|
||||
"/aboutUsPage": (contxt) => AboutUsPage(),
|
||||
"/aboutUsPage": (contxt, {arguments}) => AboutUsPage(url: arguments),
|
||||
"/bodyDevice": (contxt, {arguments}) => BodyDeviceWidget(type: arguments),
|
||||
"/deviceTypeList": (contxt) => DeviceTypeListPage(),
|
||||
"/deviceDetail": (contxt, {arguments}) => DeviceDetailPage(device: arguments),
|
||||
@@ -90,7 +90,7 @@ var routes = {
|
||||
CalibrationPersonPage(type: arguments),
|
||||
"/applyRepairPage": (contxt) => ApplyRepairPage(),
|
||||
"/languageSetting": (contxt) => LanguageSetting(),
|
||||
"/helpPage": (contxt) => HelpPage(),
|
||||
"/helpPage": (contxt, {arguments}) => HelpPage( url: arguments,),
|
||||
"/followPage": (contxt) => FollowPage(),
|
||||
"/repairListPage": (contxt) => RepairListPage(),
|
||||
"/newSleepReportPage": (contxt, {arguments}) =>
|
||||
|
||||
Reference in New Issue
Block a user