瀏覽代碼

feat:移动端物业专版增加有权限按钮文案和提示

yangfeng 1 月之前
父節點
當前提交
fd77a1ab45

+ 44 - 3
src/jfw/modules/app/src/web/templates/frontRouter/property/free/index.html

@@ -128,13 +128,54 @@
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/public/js/utils.js?v={{Msg "seo" "version"}}'></script>
 <script src=//cdn-common.jianyu360.com/cdn/lib/jquery/3.6.0/jquery.min.js></script>
 <script>
-
+  function toastFn(text, duration) {
+    if(!duration) {
+      duration = 2000
+    }
+    if($('.custom-toast')){
+      $('.custom-toast').remove()
+    }
+    var _html = ""
+    _html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
+    _html+='<span>' + text + '</span></div></div>'
+    $('body').append(_html)
+    setTimeout(function(){
+      $(".custom-toast").fadeOut().remove();
+    }, duration)
+  }
+  function checkPower(list) {
+    var power = 'bi_yx_wyzb'
+    return Array.isArray(list) && list.indexOf(power) !== -1
+  }
+  function getPowerList() {
+    var _this = this
+    $.ajax({
+      url: '/jyapi/resourceCenter/haspowers',
+      type: 'POST',
+      success: function(res) {
+        if (res && Array.isArray(res.data)) {
+          if (checkPower(res.data)) {
+            $('.property-btn').text('请去PC端使用').attr('power', 'bi_yx_wyzb')
+          } else {
+            $('.property-btn').text('立即咨询物业专版').removeAttr('power')
+          }
+        }
+      }
+    })
+  }
   $(function () {
+    getPowerList()
     $('.property-btn').click(function () {
       var loginFlag = {{if .T.loginFlag}}{{.T.loginFlag}}{{else}}false{{end}}
       if(loginFlag){
-        const source = utils.$envs.inH5 ? 'h5_property_consult' : 'app_property_consult'
-        window.location.href="/jyapp/frontPage/bigmember/free/perfect_info?source=" + source
+        var source = utils.$envs.inH5 ? 'h5_property_consult' : 'app_property_consult'
+        var power = $(this).attr('power')
+        if(power) {
+          // console.log('请去pc端使用');
+          toastFn('请去PC端使用', 2000)
+        } else {
+          window.location.href="/jyapp/frontPage/bigmember/free/perfect_info?source=" + source
+        }
       }else{
         window.location.href= "/jyapp/free/login?url=/jyapp/frontPage/bigmember/free/perfect_info?source=" + source
       }

+ 14 - 0
src/web/staticres/common-module/property/css/index.css

@@ -165,4 +165,18 @@
   padding: .16rem 0;
   font-size: .4rem;
   line-height: .56rem;
+}
+.custom-toast .toast-container{
+  /* display: none; */
+  position: fixed;
+  top: 50%;
+  left: 50%;
+  width: auto;
+  padding: 16px 32px;
+  font-size: 16px;
+  background: rgba(0, 0, 0, 0.65);
+  border-radius: 8px;
+  color: #fff;
+  transform: translateX(-50%) translateY(-50%);
+  z-index: 3001;
 }