瀏覽代碼

Change text at initialization page
https://dev.wormwood.com.sg/zentao/task-view-294.html

vbea 1 年之前
父節點
當前提交
2880793ac8

+ 6 - 2
Strides-APP/app/components/ToolbarUgly.js

@@ -6,6 +6,7 @@ export default ToolbarUgly = ({
   title,
   scope,
   showBack=true,
+  rightIcon,
   onBackPress
 }) => (
   <View style={styles.toolbarUgly}>
@@ -26,13 +27,16 @@ export default ToolbarUgly = ({
       </TouchableOpacity>
     }
     <TextView style={styles.titleText}>{scope ? $t(scope) : title}</TextView>
-    { showBack &&
-      <View style={styles.uglyIcon}>
+    { rightIcon
+    ? rightIcon()
+    : showBack
+    ? <View style={styles.uglyIcon}>
         <MaterialIcons
           name={'arrow-back-ios'}
           size={16}
           color={'transparent'} />
       </View>
+    : <></>
     }
   </View>
 )

+ 2 - 2
Strides-APP/app/i18n/locales/en.js

@@ -331,10 +331,10 @@ export default {
     stepAuthenticated: "Authenticated",
     stepAuthenticatedDesc: "Press START CHARGING to begin.",
     stepAuthenticating: "Authenticating",
-    stepAuthenticatingDesc: "Please wait while we authenticate your connection.",
+    stepAuthenticatingDesc: "Please wait while we authenticate your connection.\nPress \"Back\" to retry if takes too long.",
     stepChargingDesc: "Your vehicle is charging.\nPress STOP CHARGING to end charge",
     stepInitializing: "Initializing",
-    stepInitializingDesc: "Please wait while we prepare to start charging...",
+    stepInitializingDesc: "Preparing to start charging.\nPress \"Back\" to retry if takes too long.",
     stepStoppingCharge: "Stopping Charge",
     stepStoppingChargeDesc: "Please wait while we stop your charging...",
     stepStoppedCharge: "Charge Has Ended",

+ 1 - 1
Strides-APP/app/pages/RouterV2.js

@@ -54,7 +54,7 @@ const Title = (title, opt = {}, titleScope) => {
     ...opt
   }
   if (titleScope && $t) {
-    options.header = () => <ToolbarUgly scope={titleScope}/>
+    options.header = () => <ToolbarUgly scope={titleScope} rightIcon={options?.headerRight}/>
     //options.headerTitle = () => <HeaderTitle scope={titleScope}/>
   } else {
     options.title = title

+ 30 - 4
Strides-APP/app/pages/chargeV2/PaymentListV2.js

@@ -129,6 +129,9 @@ export default class PaymentListV2 extends Component {
               checked={true}
               size={35}/>
           }
+          { (this.state.isSelect && this.state.options.length > 1) &&
+            <TextView style={styles.numberDot}>{this.state.options.length}</TextView>
+          }
           <View style={styles.paymentView}>
             <TextView
               style={styles.valueText}
@@ -160,7 +163,7 @@ export default class PaymentListV2 extends Component {
                   style={styles.itemPayment}
                   onPress={() => this.changeMethod(index)}>
                     <View style={ui.flex1}>
-                      <TextView style={styles.valueText}>{item.name}</TextView>
+                      <TextView style={styles.labelText}>{item.name}</TextView>
                       <TextView style={styles.descText}>{item.desc}</TextView>
                     </View>
                     { item.def &&
@@ -214,15 +217,24 @@ const styles = StyleSheet.create({
     paddingBottom: 18
   },
   valueText: {
+    flex: 1,
     color: textPrimary,
-    fontSize: 15,
-    fontWeight: 'bold'
+    fontSize: 14,
+    fontWeight: 'bold',
+    paddingLeft: 16
   },
   paymentText: {
+    flex: 1,
     color: textSecondary,
     fontSize: 12,
     paddingLeft: 8,
-    paddingRight: 16
+    paddingRight: 16,
+    textAlign: 'center'
+  },
+  labelText: {
+    color: textPrimary,
+    fontSize: 14,
+    fontWeight: 'bold'
   },
   descText: {
     color: colorAccent,
@@ -252,5 +264,19 @@ const styles = StyleSheet.create({
   defButton: {
     flex: 1,
     backgroundColor: colorPrimary
+  },
+  numberDot: {
+    top: 10,
+    left: 32,
+    width: 16,
+    height: 16,
+    color: textButton,
+    fontSize: 10,
+    fontWeight: 'bold',
+    borderRadius: 32,
+    position: 'absolute',
+    alignItems: 'center',
+    justifyContent: 'center',
+    backgroundColor: colorAccent
   }
 })

+ 18 - 3
Strides-APP/app/utils/utils.js

@@ -156,6 +156,11 @@ export default {
       return '00:00';
     }
   },
+  /**
+   * 判断指定对象是否为空
+   * @param {*} str 判定对象(字符串、数字、JSON)
+   * @param {Boolean} encNo 是否判定数字(为true则数字0判定为空)
+   */
   isEmpty(str, encNo=false) {
     if (typeof str == 'number') {
       if (encNo) {
@@ -192,6 +197,11 @@ export default {
     }
     return params;
   },
+  /**
+   * 将数组以指定分隔符组装为字符串
+   * @param {Array} arrays 源数组
+   * @param {String} spect 分隔符
+   */
   join(arrays=[], spect="") {
     let str = ''
     if (arrays) {
@@ -207,8 +217,8 @@ export default {
   },
   /**
    * 将给定数字保留任意位小数
-   * @param {*} text 
-   * @param {number} scape 
+   * @param {number} text 源数字
+   * @param {number} scape 小数位
    * @returns 小数
    */
   toFixed(text, scape) {
@@ -221,7 +231,7 @@ export default {
   /**
    * 16进制颜色转为RGB
    * @param {*} value 16进制颜色
-   * @returns RGB数据
+   * @returns {Array} RGB数据
    */
   hexColorToRgb(value) {
     let sColor = value.toLowerCase()
@@ -256,6 +266,11 @@ export default {
     }
     return sColor
   },
+  /**
+   * 给颜色值添加透明度
+   * @param {Array} colors 10进制颜色
+   * @param {Number} alpha 透明度(0-1)
+   */
   getRgbaColor(colors, alpha=1) {
     if (colors.length == 3) {
       return "rgba(" + this.join(colors, ",") + "," +alpha + ")";