yzx 5 mesi fa
parent
commit
456ee797df

+ 3 - 1
app/mobile/controller/Temporary.php

@@ -287,6 +287,9 @@ class Temporary extends BaseController
         if (request()->isAjax()) {
 
             $param = request()->param();
+            if( !isset($param['openid'])){
+                return to_assign(1, '您还没有关注公众号,请先关注后再次扫码!');
+            }
             // halt($param);
             if(!isset($param['id'])|| !isset($param['openid']) ){
                 return to_assign(1, '参数错误请重试');
@@ -295,7 +298,6 @@ class Temporary extends BaseController
             $res = Db::name('follow_project')->where('project_id',$param['id'])->where('openid',$param['openid'])->find();
             if($res == null){
                 $isTrue =Db::name('follow_project')->insert(['project_id'=>$param['id'] , 'openid'=>$param['openid']]);
-
                 if($isTrue){
                     return to_assign(0, '关注成功!!');
                 }else{

+ 44 - 2
app/mobile/view/temporary/detail.html

@@ -56,6 +56,8 @@
                         </div>
 
                         <div>
+
+
                             <button id="followBtn">关注项目</button>
                         </div>
                     </div>
@@ -944,9 +946,49 @@
                 method: 'GET',
                 data: { code: code },
                 success: function(response) {
+                    // layer.open({
+                    //   type: 1, // page 层类型
+                    //   area: ['500px', '300px'],
+                    //   title: 'Hello layer',
+                    //   shade: 0.6, // 遮罩透明度
+                    //   shadeClose: true, // 点击遮罩区域,关闭弹层
+                    //   maxmin: true, // 允许全屏最小化
+                    //   anim: 0, // 0-6 的动画形式,-1 不开启
+                    //   content: '<div style="padding: 32px;">'+ JSON.stringify(response)  +'</div>'
+                    // });
+
                     if(response.subscribe == 0){
-                        var Url = 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzk0ODYwMzUwNg==#wechat_redirect';
-                        window.location.href = Url;
+                        //                     <a href="https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzk0ODYwMzUwNg==&scene=110#wechat_redirect"
+                        //   >A标签-跳转微信关注</a>
+                        layer.open({
+                            type: 1,
+                            title: false, // 禁用标题栏
+                            closeBtn: false, // 禁用默认关闭按钮
+                            area: ['100%', '100%'],
+                            scrollbar: false, // 暂时屏蔽浏览器滚动条
+                            anim: -1, // 禁用弹出动画
+                            isOutAnim: false, // 禁用关闭动画
+                            resize: false,  // 禁用右下角拉伸尺寸
+                            content: `
+                                <div style="
+                                    display: flex;
+                                    justify-content: center;
+                                    align-items: center;
+                                    flex-direction: column;
+                                    width: 100%;
+                                    height: 100%;
+                                    box-sizing: border-box;
+                                    padding: 16px;
+                                    text-align: center;
+                                ">
+                                    <p>请先关注公众号</p>
+                                    <img src="/static/mobile/img/公众号二维码.jpg" alt="公众号二维码" style="max-width: 90%; height: auto; margin: 0 auto;">
+                                </div>
+                            `
+                        });
+
+                        // var Url = 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzk0ODYwMzUwNg==#wechat_redirect';
+                        // window.location.href = Url;
                     }
                     openid = response.openid
                     var id = urlParams.get('id');