xieruidong 2 年之前
父节点
当前提交
2326a56d6d

+ 6 - 6
application/admin/controller/general/Profile.php

@@ -52,23 +52,23 @@ class Profile extends Backend
             $params = $this->request->post("row/a");
             $params = array_filter(array_intersect_key(
                 $params,
-                array_flip(array('phone', 'nickname', 'password', 'avatar','wx_qr'))
+                array_flip(array('email', 'nickname', 'password', 'avatar'))
             ));
             unset($v);
-           /* if (!Validate::is($params['email'], "email")) {
+            if (!Validate::is($params['email'], "email")) {
                 $this->error(__("Please input correct email"));
-            }*/
+            }
             if (isset($params['password'])) {
-                if (!Validate::is($params['password'], "/^[\S]{6,16}$/")) {
+                if (!Validate::is($params['password'], "/^[\S]{6,30}$/")) {
                     $this->error(__("Please input correct password"));
                 }
                 $params['salt'] = Random::alnum();
                 $params['password'] = md5(md5($params['password']) . $params['salt']);
             }
-            /*$exist = Admin::where('email', $params['email'])->where('id', '<>', $this->auth->id)->find();
+            $exist = Admin::where('email', $params['email'])->where('id', '<>', $this->auth->id)->find();
             if ($exist) {
                 $this->error(__("Email already exists"));
-            }*/
+            }
             if ($params) {
                 $admin = Admin::get($this->auth->id);
                 $admin->save($params);

+ 11 - 22
application/admin/view/general/profile/index.html

@@ -39,7 +39,7 @@
 </style>
 <div class="row animated fadeInRight">
     <div class="col-md-4">
-        <div class="box box-success">
+        <div class="box box-primary">
             <div class="panel-heading">
                 {:__('Profile')}
             </div>
@@ -56,17 +56,19 @@
                             <button type="button" id="faupload-avatar" class="faupload" data-input-id="c-avatar"><i class="fa fa-upload"></i> {:__('Upload')}</button>
                         </div>
 
-                        <h3 class="profile-username text-center">{$admin.username|htmlentities}</h3>
+                        <h3 class="profile-username text-center">{$admin.nickname|htmlentities}</h3>
 
-                        <p class="text-muted text-center">{$admin.email|htmlentities}</p>
                         <div class="form-group">
                             <label for="username" class="control-label">{:__('Username')}:</label>
                             <input type="text" class="form-control" id="username" name="row[username]" value="{$admin.username|htmlentities}" disabled/>
                         </div>
-                        {if condition="$admin['is_manager']"}
                         <div class="form-group">
-                            <label for="phone" class="control-label">{:__('手机号')}:</label>
-                            <input type="text" class="form-control" id="phone" name="row[phone]" value="{$admin.phone|htmlentities}" data-rule="required;mobile"/>
+                            <label for="mobile" class="control-label">{:__('Mobile')}:</label>
+                            <input type="text" class="form-control" id="mobile" name="row[mobile]" value="{$admin.mobile|htmlentities}" disabled/>
+                        </div>
+                        <div class="form-group">
+                            <label for="email" class="control-label">{:__('Email')}:</label>
+                            <input type="text" class="form-control" id="email" name="row[email]" value="{$admin.email|htmlentities}" data-rule="required;email"/>
                         </div>
                         <div class="form-group">
                             <label for="nickname" class="control-label">{:__('Nickname')}:</label>
@@ -76,24 +78,11 @@
                             <label for="password" class="control-label">{:__('Password')}:</label>
                             <input type="password" class="form-control" id="password" placeholder="{:__('Leave password blank if dont want to change')}" autocomplete="new-password" name="row[password]" value="" data-rule="password"/>
                         </div>
-                        {/if}
-                        {if condition="$auth->check('admin/_allow_wx_qr_power') and $admin['is_sub']"}
                         <div class="form-group">
-                            <label class="control-label" style="display: block;">{:__('微信二维码')}:</label>
-                                <div class="input-group">
-                                    <input id="c-wx_qr" class="form-control" size="50" name="row[wx_qr]" type="text" value="{$admin.wx_qr|htmlentities}">
-                                    <div class="input-group-addon no-border no-padding">
-                                        <span><button type="button" id="faupload-wx_qr" class="btn btn-danger faupload" data-input-id="c-wx_qr" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-wx_qr"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
-                                    </div>
-                                    <span class="msg-box n-right" for="c-wx_qr"></span>
-                                </div>
-                            <ul class="row list-inline faupload-preview" id="p-wx_qr"></ul>
-                        </div>
-                        {/if}
-                        <div class="form-group">
-                            <button type="submit" class="btn btn-success">{:__('Submit')}</button>
+                            <button type="submit" class="btn btn-primary">{:__('Submit')}</button>
                             <button type="reset" class="btn btn-default">{:__('Reset')}</button>
                         </div>
+
                     </div>
                 </form>
             </div>
@@ -114,7 +103,7 @@
                             <div id="toolbar" class="toolbar">
                                 {:build_toolbar('refresh')}
                             </div>
-                            <table id="table" class="table table-striped table-bordered table-hover" width="100%">
+                            <table id="table" class="table table-striped table-bordered table-hover table-nowrap" width="100%">
 
                             </table>
 

+ 4 - 4
public/assets/js/backend/general/profile.js

@@ -24,10 +24,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'upload'], function (
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 columns: [
                     [
-                        //{field: 'id', title: 'ID'},
-                        {field: 'title', title: __('操作内容')},
-                        //{field: 'url', title: __('Url'), formatter: Table.api.formatter.url},
-                        {field: 'ip', title: __('IP')},
+                        {field: 'id', title: 'ID'},
+                        {field: 'title', title: __('Title')},
+                        {field: 'url', title: __('Url'), align: 'left', formatter: Table.api.formatter.url},
+                        {field: 'ip', title: __('ip'), formatter:Table.api.formatter.search},
                         {field: 'createtime', title: __('Createtime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                     ]
                 ],