chenhao 4 年之前
父节点
当前提交
09d16a96c2

+ 7 - 0
application/admin/controller/Userapp.php

@@ -32,10 +32,17 @@ class Userapp extends Controller
      */
     public function index()
     {
+        $where = [];
         $id = $this->request->get('id');
+        $type = $this->request->get('type');
         $this->uid=$id;
         $where['uid'] = $id;
         $this->title = '线上预约';
+        if ($type==1) {
+            unset($where['uid']);
+
+//            $where['type'] = 1;
+        }
         $query = $this->_query($this->table)->where($where)->like('name,phone,status');
         $query->dateBetween('login_at,create_at')->where($where)->order('id desc')->page();
 

+ 8 - 0
application/admin/controller/Userweixiu.php

@@ -44,6 +44,13 @@ class Userweixiu extends Controller
 
             $where['type'] = 1;
         }
+        $where['type'] = $type;
+        if ($type==4) {
+            unset($where['uid']);
+
+            $where['type'] = 2;
+        }
+
         $this->title = '维修与报备';
         $query = $this->_query($this->table)->where($where)->like('name,phone,status');
         $query->dateBetween('login_at,create_at')->where($where)->order('id desc')->page();
@@ -150,6 +157,7 @@ class Userweixiu extends Controller
      */
     public function resume()
     {
+
         $data = $this->request->get();
         $this->applyCsrfToken();
         $this->_save($this->table, ['status' => '1']);

+ 43 - 0
application/admin/controller/Uuser.php

@@ -94,6 +94,49 @@ class Uuser extends Controller
     }
 
     /**
+     * 编辑系统用户修改其他信息
+     * @auth true
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     * @throws \think\exception\PDOException
+     */
+    public function edits()
+    {
+
+
+        $this->applyCsrfToken();
+        if ($this->request->isGet()) {
+            $this->verify = false;
+            $this->_form($this->table, 'edits');
+        } else {
+
+            $post = $this->request->post();
+
+            $data = [];
+            if (isset($post['pwd']) && !empty($post['pwd'])) {
+                if ($post['pwd'] != $post['repassword']) return $this->error('两次密码输入不一致');
+
+                $data['pwd'] = md5(md5($post['pwd']));
+            }
+
+            $data['username'] = $post['username'];
+            $data['mobile'] = $post['mobile'];
+            $data['avatar'] = $post['avatar'];
+
+            $upd = Db::name('user')->where('id',$post['id'])->update($data);
+
+            if ($upd) {
+                return $this->success('编辑成功');
+            } else {
+                return $this->error('编辑失败');
+            }
+//            $upd = Db::name('where')
+        }
+
+    }
+    /**
      * 修改用户密码
      * @auth true
      * @throws \think\Exception

+ 57 - 0
application/admin/view/uuser/edits.html

@@ -0,0 +1,57 @@
+<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
+    <div class="layui-card-body padding-left-40">
+        <div class="layui-form-item">
+            <label class="relative block">
+                <span class="color-green font-w7">头像</span>
+                <span class="color-desc margin-left-5"></span>
+                <input name="avatar" type="hidden" value="{$vo.avatar|default=''}">
+                <script>$('[name="avatar"]').uploadOneImage()</script>
+            </label>
+            <p class="help-block">登录用户账号创建</p>
+        </div>
+        <div class="layui-form-item">
+            <label class="relative block">
+                <span class="color-green font-w7">登录用户账号</span>
+                <span class="color-desc margin-left-5">Username</span>
+                <input name="username" value='{$vo.username|default=""}' required pattern="^.{4,}$" placeholder="请输入4位及以上字符登录用户账号" class="layui-input">
+            </label>
+            <p class="help-block">登录用户账号创建</p>
+        </div>
+        <div class="layui-form-item">
+            <label class="relative block">
+                <span class="color-green font-w7">用户联系手机</span>
+                <span class="color-desc margin-left-5">Phone</span>
+                <input type="tel" maxlength="11" autocomplete="off" autofocus name="mobile" value='{$vo.mobile|default=""}' pattern="^1[3-9][0-9]{9}$" placeholder="请输入用户联系手机" class="layui-input">
+            </label>
+            <p class="color-desc">可选,用户联系手机号码,需要填写正确的格式</p>
+        </div>
+
+        <div class="layui-form-item">
+            <label class="relative block">
+                <span class="color-green font-w7">新的登录密码</span>
+                <span class="color-desc margin-left-5">New Password</span>
+                <input type="password" name="pwd" maxlength="32" pattern="^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,32}$"  placeholder="请输入新的登录密码(不修改不输入)" class="layui-input">
+            </label>
+            <p class="color-desc">密码必需包含大小写字母、数字、符号的任意两者组合。</p>
+        </div>
+
+        <div class="layui-form-item">
+            <label class="relative block">
+                <span class="color-green font-w7">重复登录密码</span>
+                <span class="color-desc margin-left-5">Retype Password</span>
+                <input type="password" name="repassword" maxlength="32" pattern="^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{6,32}$"  placeholder="请输入重复登录密码(不修改不输入)" class="layui-input">
+            </label>
+            <p class="color-desc">密码必需包含大小写字母、数字、符号的任意两者组合。</p>
+        </div>
+
+    </div>
+
+    <div class="hr-line-dashed"></div>
+    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}
+
+    <div class="layui-form-item text-center">
+        <button class="layui-btn" type='submit'>保存数据</button>
+        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗?" data-close>取消编辑</button>
+    </div>
+
+</form>

+ 1 - 0
application/admin/view/uuser/index.html

@@ -91,6 +91,7 @@
 <!--                {elseif $vo.is_deleted eq 0 and auth("resume")}-->
 <!--                <a class="layui-btn layui-btn-sm layui-btn-warm" data-action="{:url('resume')}" data-value="id#{$vo.id};is_delete#1" data-csrf="{:systoken('resume')}">启 用</a>-->
 <!--                {/if}-->
+                <a data-dbclick class="layui-btn layui-btn-sm" data-title="修改信息" data-modal='{:url("edits")}?id={$vo.id}&type=2'>修改信息</a>
 
                 {if auth("remove")}
                 <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除该用户吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>

+ 1 - 1
application/index/controller/Index.php

@@ -68,7 +68,7 @@ class Index extends Controller
 
         if ($isReg) return $this->error('该手机号已被注册');
 
-        $data['avatar'] = 'uploads/avatar.png';
+        $data['avatar'] = 'http://degao.hdlkeji.com/uploads/avatar.png';
 
         $register = Db::name('user')->insert($data);