Bläddra i källkod

app use new dwan api pre-auth popup
https://dev.wormwood.com.sg/zentao/task-view-336.html

vbea 1 år sedan
förälder
incheckning
6d09811ceb

+ 1 - 0
Strides-APP/app.json

@@ -7,6 +7,7 @@
   "debug": true,
   "isWhitelabel": true,
   "isLumiWhitelabel": false,
+  "enableVAPTSecure": false,
   "modules": {
     "i18n": false,
     "bookmarks": true,

+ 13 - 0
Strides-APP/app/api/apiPayment.js

@@ -0,0 +1,13 @@
+import { get, post } from "./http";
+
+const prefix = 'devicesApi/dawn/api/v1/';
+
+export default apiPayment = {
+  /**
+   * 获取按次付费的提醒内容
+   * @returns Promise
+   */
+  getPayPerUseAlter() {
+    return get(prefix + "pay-per-use-alert-content")
+  }
+}

+ 1 - 1
Strides-APP/app/components/Dialog.js

@@ -259,7 +259,7 @@ const iosStyle = StyleSheet.create({
   message: {
     color: textPrimary,
     fontSize: 14,
-    paddingTop: 4,
+    paddingTop: 8,
     paddingLeft: 20,
     paddingRight: 20
   },

+ 50 - 36
Strides-APP/app/pages/chargingV2/DialogPayPerUse.js

@@ -1,39 +1,56 @@
-import React from 'react';
-import { StyleSheet } from 'react-native';
-import { Modal } from 'react-native';
-import { Text, View } from 'react-native';
+import React, { useEffect, useState } from 'react';
+import { Modal, View, StyleSheet } from 'react-native';
+import apiPayment from '../../api/apiPayment';
 import Button from '../../components/Button';
 import Dialog from '../../components/Dialog';
 import TextView from '../../components/TextView';
+import { i18nUtil } from '../../i18n';
 
 const DialogPayPerUse = ({
   amount="",
   visible,
   onClose
-}) => (
-  <Modal
-    visible={visible}
-    transparent={true}>
-    <View style={styles.container}>
-      <View style={styles.content}>
-        <TextView style={styles.title}>{$t("payment.titleNote")}</TextView>
-        <TextView style={styles.message}>{$t("payment.tipsPayPerUseAmount").replace("{mm}", amount)}</TextView>
-        <View style={ui.flexc}>
-          <Button
-            style={styles.cancelButton}
-            text={$t("nav.cancel")}
-            textColor={textPrimary}
-            onClick={() => onClose(false)}/>
-          <Button
-            style={styles.confirmButton}
-            text={$t("nav.confirm")}
-            borderRadius={0}
-            onClick={() => onClose(true)}/>
+}) => {
+  const [content, setContent] = useState();
+  useEffect(() => {
+    if (i18nUtil.isChinese()) {
+      setContent($t("payment.tipsPayPerUseAmount").replace("{mm}", amount));
+    } else {
+      apiPayment.getPayPerUseAlter().then(res => {
+        if (res.data) {
+          setContent(res.data);
+        }
+      }).catch(err => {
+        setContent($t("payment.tipsPayPerUseAmount").replace("{mm}", amount));
+      });
+    }
+  }, []);
+  return (
+    <Modal
+      visible={visible}
+      transparent={true}>
+      <View style={styles.container}>
+        <View style={styles.content}>
+          <TextView style={styles.title}>{$t("payment.titleNote")}</TextView>
+          <TextView style={styles.message}>{content}</TextView>
+          <View style={styles.buttonsDivide}></View>
+          <View style={ui.flexc}>
+            <Button
+              style={styles.cancelButton}
+              text={$t("nav.cancel")}
+              textColor={textPrimary}
+              onClick={() => onClose(false)}/>
+            <Button
+              style={styles.confirmButton}
+              text={$t("nav.confirm")}
+              borderRadius={0}
+              onClick={() => onClose(true)}/>
+          </View>
         </View>
       </View>
-    </View>
-  </Modal>
-);
+    </Modal>
+  )
+};
 
 export default DialogPayPerUse;
 
@@ -42,39 +59,36 @@ const styles = StyleSheet.create({
     flex: 1,
     alignItems: 'center',
     justifyContent: 'center',
-    backgroundColor: 'rgba(0,0,0,.3)'
+    backgroundColor: 'rgba(0,0,0,.5)'
   },
   content: {
     width: Dialog.dialogWidth,
-    borderRadius: 4,
+    borderRadius: 16,
     overflow: 'hidden',
     backgroundColor: colorLight
   },
   title: {
-    paddingTop: 16,
-    paddingLeft: 16,
+    paddingTop: 24,
+    paddingLeft: 24,
     color: textPrimary,
     fontSize: 16,
     fontWeight: 'bold'
   },
   message: {
-    padding: 16,
     color: textPrimary,
     fontSize: 14,
     paddingTop: 16,
+    paddingLeft: 24,
+    paddingRight: 24,
     paddingBottom: 32
   },
   cancelButton: {
     flex: 1,
-    borderColor: '#EEE',
-    borderWidth: 1,
     borderRadius: 0,
-    backgroundColor: textButton
+    backgroundColor: "#F0F0F0"
   },
   confirmButton: {
     flex: 1,
-    borderColor: colorAccent,
-    borderWidth: 1,
     borderRadius: 0,
     backgroundColor: colorAccent
   }

+ 1 - 1
Strides-APP/app/pages/chargingV3/ChargingPage.js

@@ -16,7 +16,7 @@ import StepCharging from './StepCharging';
 import StepStart from './StepStart';
 import StepStop from './StepStop';
 import PagerUtil from '../chargeV2/PagerUtil';
-import DialogPayPerUse from './DialogPayPerUse';
+import DialogPayPerUse from '../chargingV2/DialogPayPerUse';
 import utils from '../../utils/utils';
 
 export default class ChargingPageV4 extends Component {

+ 0 - 66
Strides-APP/app/pages/chargingV3/DialogPayPerUse.js

@@ -1,66 +0,0 @@
-import React from 'react';
-import { StyleSheet } from 'react-native';
-import { Modal } from 'react-native';
-import { Text, View } from 'react-native';
-import Button from '../../components/Button';
-import Dialog from '../../components/Dialog';
-import TextView from '../../components/TextView';
-
-const DialogPayPerUse = ({
-  amount="",
-  visible,
-  onClose
-}) => (
-  <Modal
-    visible={visible}
-    transparent={true}>
-    <View style={styles.container}>
-      <View style={styles.content}>
-        <TextView style={styles.title}>{$t("payment.titleNote")}</TextView>
-        <TextView style={styles.message}>{$t("payment.tipsPayPerUseAmount").replace("{mm}", amount)}</TextView>
-        <Button
-          text={$t("nav.confirm")}
-          onClick={() => onClose(true)}/>
-        <Button
-          style={styles.cancelButton}
-          text={$t("nav.cancel")}
-          textColor={textPrimary}
-          onClick={() => onClose(false)}/>
-      </View>
-    </View>
-  </Modal>
-);
-
-export default DialogPayPerUse;
-
-const styles = StyleSheet.create({
-  container: {
-    flex: 1,
-    alignItems: 'center',
-    justifyContent: 'center',
-    backgroundColor: 'rgba(0,0,0,.4)'
-  },
-  content: {
-    width: Dialog.dialogWidth,
-    padding: 16,
-    borderRadius: 4,
-    backgroundColor: colorLight
-  },
-  title: {
-    color: textPrimary,
-    fontSize: 16,
-    fontWeight: 'bold'
-  },
-  message: {
-    color: textPrimary,
-    fontSize: 14,
-    paddingTop: 16,
-    paddingBottom: 32
-  },
-  cancelButton: {
-    marginTop: 8,
-    borderColor: '#EEE',
-    borderWidth: 1,
-    backgroundColor: textButton
-  }
-})

+ 8 - 1
Strides-APP/app/pages/my/ProfileV2.js

@@ -64,7 +64,14 @@ export default class ProfileV2 extends Component {
       }, 500);*/
     }).catch(err => {
       Dialog.dismissLoading();
-      toastShort(err)
+      //toastShort(err)
+      setTimeout(() => {
+        Dialog.showDialog({
+          title: $t("common.error"),
+          message: err.msg,
+          showCancel: false
+        });
+      }, 500);
     })
   }
 

+ 4 - 1
Strides-APP/app/pages/my/ProfileV3.js

@@ -73,7 +73,10 @@ export default class ProfileV3 extends Component {
       }, 500);*/
     }).catch(err => {
       Dialog.dismissLoading();
-      toastShort(err)
+      //toastShort(err)
+      setTimeout(() => {
+        Dialog.showResultDialog(err.msg);
+      }, 500);
     })
   }