vali 6 lat temu
rodzic
commit
ad885b3aee

+ 4 - 7
application/admin/controller/User.php

@@ -65,15 +65,12 @@ class User extends AdminControl
         return $this->fetch();
     }
 
-    public function userInfo()
+    public function userinfo()
     {
         $uid = intval(input("uid", 0));
-        $model = new Userinfo();
-        $model = $model->findOne($uid, 1);
-        if (empty($model)) {
-            ds_json_encode(0, 'no user!');
-        }
-        ds_json_encode(1, 'success', $model);
+        $model = (new Userinfo())->findOne($uid, 1);
+        $this->assign('userinfo', $model);
+        return $this->fetch();
     }
 
 

+ 8 - 33
application/admin/view/user/index.html

@@ -120,42 +120,16 @@
 
     //用户详情
     function userInfo(uid) {
-        var retmsg = '';
-
-        function dodata(key, val) {
-            retmsg += key + " : " + val + "<br>";
-        }
-
-        layui.use('layer', function () {
-            $.ajax({
-                type: "get",
-                url: '/admin/user/userInfo',
-                data: {uid: uid},
-                dataType: "json",
-                success: function (msg) {
-                    if (msg.code == 1) {
-                        var datas = msg.result;
-                        for (var i in datas) {
-                            dodata(i, datas[i]);
-                        }
-                    }
-
-                    $("#layui-layer-content2").html(retmsg)
-                    $("#layui-layer3").attr("style", "display: block")
-                    $("#layui-layer-shade4").attr("style", "display: block")
-                },
-                error: function (d) {
-                    alert(d);
-                }
-            })
+       var url = '/admin/user/userinfo?uid='+uid;
+        parent.layer.open({
+            type: 2,
+            title: '用户详情',
+            area: ["900px","500px"],
+            fixed: false, //不固定
+            content: url
         });
     }
 
-    function makeTable(arr) {
-        var table = "";
-        table += "";
-
-    }
 
     function hiddenTips() {
         $("#layui-layer2").attr("style", "display: none")
@@ -193,6 +167,7 @@
     }
 
     layui.use('laydate', function () {
+
         var laydate = layui.laydate;
 
         //执行一个laydate实例

+ 24 - 0
application/admin/view/user/userinfo.html

@@ -0,0 +1,24 @@
+{extend name="layout:home" /}
+{block name="container"}
+    <table id="uinfotable" class="layui-table  lay-even">
+        <thead>
+        <tr>
+            <th>名称</th>
+            <th>值</th>
+        </tr>
+        </thead>
+        <tbody>
+        {if count($userinfo)}
+        {volist name="userinfo" id="user"}
+        <tr>
+            <td>{$key}</td>
+            <td>{$user}</td>
+        </tr>
+        {/volist}
+        {else}
+        <td>无数据</td>
+        {/if}
+        </tbody>
+    </table>
+{/block}
+