作者 王晓刚
1 个管道 的构建 通过 耗费 23 秒

合并分支 'wxg' 到 'master'

后无车页面优化



查看合并请求 !64
... ... @@ -5,6 +5,7 @@ namespace app\admin\controller\general;
use app\admin\model\Admin;
use app\common\controller\Backend;
use fast\Random;
use think\Db;
use think\Session;
use think\Validate;
... ... @@ -44,6 +45,8 @@ class Profile extends Backend
return json($result);
}
$row = Db::name('store')->where(['admin_id'=>$this->auth->id])->find();
$this->assign('row',$row);
return $this->view->fetch();
}
... ... @@ -55,14 +58,21 @@ class Profile extends Backend
if ($this->request->isPost()) {
$this->token();
$params = $this->request->post("row/a");
$money = $params['money'];
$freight = $params['freight'];
$phone = $params['phone'];
$address = $params['address'];
$lng = $params['lng'];
$lat = $params['lat'];
$content = $params['content'];
$params = array_filter(array_intersect_key(
$params,
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}$/")) {
$this->error(__("Please input correct password"));
... ... @@ -70,15 +80,19 @@ class Profile extends Backend
$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);
//因为个人资料面板读取的Session显示,修改自己资料后同时更新Session
Session::set("admin", $admin->toArray());
$store_id = Db::name('admin')->where(['id'=>$this->auth->id])->value('store_id');
if(!empty($store_id)){
echo Db::name('store')->where(['id'=>$store_id])->update(['money'=>$money,'freight'=>$freight,'phone'=>$phone,'address'=>$address,'lng'=>$lng,'lat'=>$lat,'content'=>$content]);
}
$this->success();
}
$this->error();
... ...
... ... @@ -63,10 +63,10 @@
<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>
<div class="form-group">
<!--<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>-->
<div class="form-group">
<label for="nickname" class="control-label">{:__('Nickname')}:</label>
<input type="text" class="form-control" id="nickname" name="row[nickname]" value="{$admin.nickname|htmlentities}" data-rule="required"/>
... ... @@ -75,6 +75,36 @@
<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>
{notempty name="$admin.store_id"}
<div class="form-group">
<label class="control-label">{:__('满免运费价格')}:</label>
<input id="c-money" data-rule="required" class="form-control" name="row[money]" type="text" value="{$row.money|htmlentities}">
</div>
<div class="form-group">
<label class="control-label">{:__('运费')}:</label>
<input id="c-freight" data-rule="required" class="form-control" name="row[freight]" type="text" value="{$row.freight|htmlentities}">
</div>
<div class="form-group">
<label class="control-label">{:__('联系电话')}:</label>
<input id="c-phone" data-rule="required" class="form-control" name="row[phone]" type="text" value="{$row.phone|htmlentities}">
</div>
<div class="form-group address">
<label class="control-label">{:__('详细地址')}:</label>
<input id="c-address" data-toggle="addresspicker" data-input-id="c-address" data-lat-id="c-latitude" data-lng-id="c-longitude" class="form-control" data-rule="required" name="row[address]" value="{$row.address|htmlentities}" type="text" readonly="true">
</div>
<div class="form-group hidden">
<label class="control-label">{:__('Lng')}:</label>
<input id="c-longitude" class="form-control" name="row[lng]" type="text" value="{$row.lng|htmlentities}">
</div>
<div class="form-group hidden">
<label class="control-label">{:__('Lat')}:</label>
<input id="c-latitude" class="form-control" name="row[lat]" type="text" value="{$row.lat|htmlentities}">
</div>
<div class="form-group">
<label class="control-label">{:__('Content')}:</label>
<textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
</div>
{/notempty}
<div class="form-group">
<button type="submit" class="btn btn-success">{:__('Submit')}</button>
<button type="reset" class="btn btn-default">{:__('Reset')}</button>
... ...
... ... @@ -623,7 +623,7 @@
val++;
$(self.closest('li').find('.contInput')[0]).val(val);
contPrice(self, val);
toast('操作成功');
// toast('操作成功');
}else{
toast(res.msg);
}
... ...