用户区域设置和编辑标题颜色

This commit is contained in:
toogee 2020-05-23 09:51:24 +08:00
parent 23d38c406f
commit f1c2af4087
7 changed files with 22 additions and 5 deletions

View File

@ -240,7 +240,7 @@ abstract class BaseController
$user = Cache::get('user'.$id);
if(!$user){
//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);
}

View File

@ -117,7 +117,7 @@ class User extends Model
{
$userId = $data['user_id'];
$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){
return 1;
}else{

View File

@ -72,7 +72,8 @@ class User extends BaseController
public function set()
{
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;
$result = $validate->scene('Set')->check($data);
if(!$result){
@ -81,12 +82,15 @@ class User extends BaseController
$user = new \app\common\model\User;
$result = $user->setNew($data);
if($result==1){
Cache::tag('user')->clear();
return ['code'=>0,'msg'=>'资料更新成功'];
} else {
$this->error($result);
}
}
}
$area = Db::name('user_area')->select();
View::assign(['area'=>$area]);
return View::fetch();
}

View File

@ -31,7 +31,7 @@
<label for="L_title" class="layui-form-label">标题</label>
<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="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}">
</div>
</div>

View File

@ -10,7 +10,7 @@
<a href="{:url('user/home',['id'=>$top.user_id])}" link>
<i class="layui-badge layui-bg-green" title="来自哪简称">{:getAsing($top.user.area_id) ?: '无'}</i>
<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)}
<i class="layui-badge fly-badge-vip">VIP{$top.user.vip}</i>
{/if}

View File

@ -10,7 +10,9 @@
{$u.nickname ?: $u.name}
{if($u.sex==0)}<i class="iconfont icon-nan"></i>
{else}<i class="iconfont icon-nv"></i> {/if}
{if($u.vip > 0)}
<i class="layui-badge fly-badge-vip">VIP{$u.vip}</i>
{/if}
<!--
<span style="color:#c00;">(管理员)</span>
<span style="color:#5FB878;">(社区之光)</span>

View File

@ -36,6 +36,17 @@
<div class="layui-input-inline">
<input type="text" id="L_city" name="city" autocomplete="off" value="{$user.city}" class="layui-input" placeholder="{$user.city}">
</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 class="layui-form-item layui-form-text">
<label for="L_sign" class="layui-form-label">签名</label>