用户区域设置和编辑标题颜色
This commit is contained in:
parent
23d38c406f
commit
f1c2af4087
@ -240,7 +240,7 @@ abstract class BaseController
|
|||||||
$user = Cache::get('user'.$id);
|
$user = Cache::get('user'.$id);
|
||||||
if(!$user){
|
if(!$user){
|
||||||
//1.查询用户
|
//1.查询用户
|
||||||
$user = Db::name('user')->field('id,name,nickname,user_img,sex,auth,city,email,sign,point,vip,create_time')->find($id);
|
$user = Db::name('user')->field('id,name,nickname,user_img,sex,area_id,auth,city,email,sign,point,vip,create_time')->find($id);
|
||||||
Cache::tag('user')->set('user'.$id,$user,600);
|
Cache::tag('user')->set('user'.$id,$user,600);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class User extends Model
|
|||||||
{
|
{
|
||||||
$userId = $data['user_id'];
|
$userId = $data['user_id'];
|
||||||
$user = User::where('id',$userId)->find();
|
$user = User::where('id',$userId)->find();
|
||||||
$result = $user->allowField(['email','nickname','sex','city','sign'])->save($data);
|
$result = $user->allowField(['email','nickname','sex','city','area_id','sign'])->save($data);
|
||||||
if($result){
|
if($result){
|
||||||
return 1;
|
return 1;
|
||||||
}else{
|
}else{
|
||||||
|
@ -72,7 +72,8 @@ class User extends BaseController
|
|||||||
public function set()
|
public function set()
|
||||||
{
|
{
|
||||||
if(Request::isAjax()){
|
if(Request::isAjax()){
|
||||||
$data = Request::only(['user_id','email','nickname','sex','city','sign']);
|
$data = Request::only(['user_id','email','nickname','sex','city','area_id','sign']);
|
||||||
|
var_dump($data);
|
||||||
$validate = new \app\common\validate\User;
|
$validate = new \app\common\validate\User;
|
||||||
$result = $validate->scene('Set')->check($data);
|
$result = $validate->scene('Set')->check($data);
|
||||||
if(!$result){
|
if(!$result){
|
||||||
@ -81,12 +82,15 @@ class User extends BaseController
|
|||||||
$user = new \app\common\model\User;
|
$user = new \app\common\model\User;
|
||||||
$result = $user->setNew($data);
|
$result = $user->setNew($data);
|
||||||
if($result==1){
|
if($result==1){
|
||||||
|
Cache::tag('user')->clear();
|
||||||
return ['code'=>0,'msg'=>'资料更新成功'];
|
return ['code'=>0,'msg'=>'资料更新成功'];
|
||||||
} else {
|
} else {
|
||||||
$this->error($result);
|
$this->error($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$area = Db::name('user_area')->select();
|
||||||
|
View::assign(['area'=>$area]);
|
||||||
return View::fetch();
|
return View::fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<label for="L_title" class="layui-form-label">标题</label>
|
<label for="L_title" class="layui-form-label">标题</label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
|
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$article.title}">
|
||||||
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input">
|
<input type="hidden" id="L_title_color" name="title_color" autocomplete="off" class="layui-input" value="{$article.title_color}">
|
||||||
<input type="hidden" name="user_id" value="{$article.user_id}">
|
<input type="hidden" name="user_id" value="{$article.user_id}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<a href="{:url('user/home',['id'=>$top.user_id])}" link>
|
<a href="{:url('user/home',['id'=>$top.user_id])}" link>
|
||||||
<i class="layui-badge layui-bg-green" title="来自哪简称">{:getAsing($top.user.area_id) ?: '无'}</i>
|
<i class="layui-badge layui-bg-green" title="来自哪简称">{:getAsing($top.user.area_id) ?: '无'}</i>
|
||||||
<cite>{$top.user.nickname ?: $top.user.name}</cite>
|
<cite>{$top.user.nickname ?: $top.user.name}</cite>
|
||||||
<i class="iconfont icon-renzheng" title="认证信息:XXX"></i>
|
<!--i class="iconfont icon-renzheng" title="认证信息:XXX"></i-->
|
||||||
{if($top.user.vip > 0)}
|
{if($top.user.vip > 0)}
|
||||||
<i class="layui-badge fly-badge-vip">VIP{$top.user.vip}</i>
|
<i class="layui-badge fly-badge-vip">VIP{$top.user.vip}</i>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -10,7 +10,9 @@
|
|||||||
{$u.nickname ?: $u.name}
|
{$u.nickname ?: $u.name}
|
||||||
{if($u.sex==0)}<i class="iconfont icon-nan"></i>
|
{if($u.sex==0)}<i class="iconfont icon-nan"></i>
|
||||||
{else}<i class="iconfont icon-nv"></i> {/if}
|
{else}<i class="iconfont icon-nv"></i> {/if}
|
||||||
|
{if($u.vip > 0)}
|
||||||
<i class="layui-badge fly-badge-vip">VIP{$u.vip}</i>
|
<i class="layui-badge fly-badge-vip">VIP{$u.vip}</i>
|
||||||
|
{/if}
|
||||||
<!--
|
<!--
|
||||||
<span style="color:#c00;">(管理员)</span>
|
<span style="color:#c00;">(管理员)</span>
|
||||||
<span style="color:#5FB878;">(社区之光)</span>
|
<span style="color:#5FB878;">(社区之光)</span>
|
||||||
|
@ -36,6 +36,17 @@
|
|||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input type="text" id="L_city" name="city" autocomplete="off" value="{$user.city}" class="layui-input" placeholder="{$user.city}">
|
<input type="text" id="L_city" name="city" autocomplete="off" value="{$user.city}" class="layui-input" placeholder="{$user.city}">
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label for="L_area" class="layui-form-label">区域</label>
|
||||||
|
<div class="layui-input-inline">
|
||||||
|
<select name="area_id" lay-filter="LAY-user-adminrole-type">
|
||||||
|
<option value="">无</option>
|
||||||
|
{volist name="area" id="vo"}
|
||||||
|
<option {if condition="$vo.id eq $user.area_id"} selected {/if} value="{$vo.id}">{$vo.asing}</option>
|
||||||
|
{/volist}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item layui-form-text">
|
<div class="layui-form-item layui-form-text">
|
||||||
<label for="L_sign" class="layui-form-label">签名</label>
|
<label for="L_sign" class="layui-form-label">签名</label>
|
||||||
|
Loading…
Reference in New Issue
Block a user