Explorar o código

Merge remote-tracking branch 'origin/master'

guojing %!s(int64=5) %!d(string=hai) anos
pai
achega
81552b5803

+ 17 - 7
whepi-ui/templates/yeweihui/tgPublish.ftl

@@ -15,7 +15,7 @@
         <p class="weui-media-box__desc" style="margin-top: 1vh;">套餐:</p>
         <p class="weui-media-box__desc" style="margin-top: 1vh;">套餐:</p>
         <input id="tg_input_goods" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
         <input id="tg_input_goods" class="weui-input" autofocus="" type="text" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
         <p class="weui-media-box__desc" style="margin-top: 1vh;">单价(元):</p>
         <p class="weui-media-box__desc" style="margin-top: 1vh;">单价(元):</p>
-        <input id="tg_input_price" class="weui-input" autofocus="" type="number" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
+        <input id="tg_input_price" onkeyup="clearNoNum(this)" class="weui-input" autofocus="" type="number" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
         <p class="weui-media-box__desc" style="margin-top: 1vh;">最低起送(份):</p>
         <p class="weui-media-box__desc" style="margin-top: 1vh;">最低起送(份):</p>
         <input id="tg_input_minnum" class="weui-input" autofocus="" type="number" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
         <input id="tg_input_minnum" class="weui-input" autofocus="" type="number" placeholder="请输入" maxlength="50" style="border: 1px solid rgba(0,0,0,.2);box-sizing:border-box; border-radius: 5px; height: 5vh;" />
         <p class="weui-media-box__desc" style="margin-top: 1vh;">最大订量(份):</p>
         <p class="weui-media-box__desc" style="margin-top: 1vh;">最大订量(份):</p>
@@ -49,6 +49,16 @@
         window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
         window.location.href = "/yeweihui/home.html?show=tuangou&userId=" + userId;
     }
     }
 
 
+    function clearNoNum(obj){
+        obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符
+        obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的
+        obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
+        obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3');//只能输入两个小数
+        if(obj.value.indexOf(".")< 0 && obj.value !=""){//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
+            obj.value= parseFloat(obj.value);
+        }
+    }
+
     $("#tg_publish").on('click', function () {
     $("#tg_publish").on('click', function () {
 
 
         let title = $("#tg_input_title").val();
         let title = $("#tg_input_title").val();
@@ -104,12 +114,12 @@
             return;
             return;
         }
         }
 
 
-        if (/^[0-9]+$/.test(price) == false) {
-            $.alert("价格请输入整数");
-            return;
-        }
-        if (price.length > 4) {
-            $.alert("价格最大为9999");
+        // if (/^-?(([1-9]{1}\d*)|(0{1}))(\.\d{2})?$/.test(price) == false) {
+        //     $.alert("价格保留两位小数");
+        //     return;
+        // }
+        if (parseFloat(price) > 10000) {
+            $.alert("价格最大为10000");
             return;
             return;
         }
         }
 
 

+ 4 - 4
whepi-web/src/main/java/com/bofeng/wx/controller/UserOpenController.java

@@ -65,10 +65,10 @@ public class UserOpenController {
                              @RequestParam(value = "userType", required = false, defaultValue = "0") Integer userType) throws JsonProcessingException {
                              @RequestParam(value = "userType", required = false, defaultValue = "0") Integer userType) throws JsonProcessingException {
         List<UserRole> list = new ArrayList<>();
         List<UserRole> list = new ArrayList<>();
         if (userId == 0) {
         if (userId == 0) {
-           /* UserOpen userOpen = homeService.getUserOpen();
-            list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());*/
-            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
-            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
+           UserOpen userOpen = homeService.getUserOpen();
+            list = userRoleMapper.getUserRoleByUserId(userOpen.getUserId());
+//            list = userRoleMapper.getUserRoleByUserId(1225321682867105793L);
+//            UserOpen userOpen = userOpenMapper.selectByUserId(1225321682867105793L);
             userId = userOpen.getUserId();
             userId = userOpen.getUserId();
             model.put("user", userOpen);
             model.put("user", userOpen);
             model.put("user_id", "\"" + userOpen.getUserId() + "\"");
             model.put("user_id", "\"" + userOpen.getUserId() + "\"");

+ 1 - 1
whepi-web/src/main/resources/application.yml

@@ -43,7 +43,7 @@ endpoints:
 #  whitelabel.enabled: false
 #  whitelabel.enabled: false
 
 
 spring:
 spring:
-  profiles.active: guojing
+  profiles.active: lll
 
 
   application:
   application:
     name: bofeng-web
     name: bofeng-web