Commit 48fcc5b2 by LiuJunYi

后台手机号修改

parent 759edfce
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
namespace app\admin\controller; namespace app\admin\controller;
use app\admin\controller\AuthBase; use app\admin\controller\AuthBase;
use app\admin\controller\OutputExcel; use app\admin\controller\OutputExcel;
use think\Exception;
class User extends AuthBase class User extends AuthBase
{ {
...@@ -114,4 +115,16 @@ class User extends AuthBase ...@@ -114,4 +115,16 @@ class User extends AuthBase
$obj = new OutputExcel(); $obj = new OutputExcel();
$obj->export($mulit_arr,$filename,$title,$Subject,$Description,$Keywords,$Category); $obj->export($mulit_arr,$filename,$title,$Subject,$Description,$Keywords,$Category);
} }
public function changePhone()
{
if(request()->isAjax()){
try{
\app\common\model\User::update(input('post.'));
}catch (Exception $e){
return json(['code'=>1,'msg'=>'手机号重复,修改失败']);
}
return json(['code'=>0,'msg'=>'修改成功']);
}
}
} }
\ No newline at end of file
...@@ -7,25 +7,31 @@ ...@@ -7,25 +7,31 @@
<div class="row margin-bottom"> <div class="row margin-bottom">
<div class="col-md-12"> <div class="col-md-12">
<form class="form-inline pull-left" method="GET" action="{:url('admin/user/index')}" > <form class="form-inline pull-left" method="GET" action="{:url('admin/user/index')}">
<div class="form-group margin-right"> <div class="form-group margin-right">
<input class="form-control" type="text" name="phone" id="phone" value="{:input('phone')}" placeholder="手机号"/> <input class="form-control" type="text" name="phone" id="phone" value="{:input('phone')}"
placeholder="手机号"/>
</div> </div>
<div class="form-group margin-right"> <div class="form-group margin-right">
<input class="form-control" type="text" name="nickname" id="nickname" value="{:input('nickname')}" placeholder="昵称"/> <input class="form-control" type="text" name="nickname" id="nickname" value="{:input('nickname')}"
placeholder="昵称"/>
</div> </div>
<div class="form-group margin-right"> <div class="form-group margin-right">
<select name="is_vip" id="is_vip" class="form-control"> <select name="is_vip" id="is_vip" class="form-control">
<option value="">是否会员</option> <option value="">是否会员</option>
<option value="1" {if condition="input('is_vip')==1"}selected{/if}>会员</option> <option value="1" {if condition="input('is_vip')==1" }selected{
<option value="0" {if condition="input('is_vip')==='0'"}selected{/if}>非会员</option> /if}>会员</option>
<option value="0" {if condition="input('is_vip')==='0'" }selected{
/if}>非会员</option>
</select> </select>
</div> </div>
<div class="form-group margin-right"> <div class="form-group margin-right">
<label for="">注册时间:</label> <label for="">注册时间:</label>
<input class="form-control" type="date" name="start_time" id="start_time" value="{:input('start_time')}" placeholder="起始"/> <input class="form-control" type="date" name="start_time" id="start_time"
value="{:input('start_time')}" placeholder="起始"/>
-- --
<input class="form-control" type="date" name="end_time" id="end_time" value="{:input('end_time')}" placeholder="结束"/> <input class="form-control" type="date" name="end_time" id="end_time" value="{:input('end_time')}"
placeholder="结束"/>
</div> </div>
<button type="submit" class="btn btn-primary">搜索</button> <button type="submit" class="btn btn-primary">搜索</button>
</form> </form>
...@@ -38,11 +44,11 @@ ...@@ -38,11 +44,11 @@
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
<!--<colgroup>--> <!--<colgroup>-->
<!--<col style="width: 2%;">--> <!--<col style="width: 2%;">-->
<!--<col style="width: 80%;">--> <!--<col style="width: 80%;">-->
<!--<col style="width: 5%;">--> <!--<col style="width: 5%;">-->
<!--<col style="width: 5%;">--> <!--<col style="width: 5%;">-->
<!--<col style="width: 10%;">--> <!--<col style="width: 10%;">-->
<!--</colgroup>--> <!--</colgroup>-->
<thead> <thead>
<tr> <tr>
...@@ -66,38 +72,41 @@ ...@@ -66,38 +72,41 @@
<tr id="tr_{$vo.id}"> <tr id="tr_{$vo.id}">
<td>{$vo.id}</td> <td>{$vo.id}</td>
<td> <td>
<img src="{$vo.avatar}" onerror="this.src='/static/img/default_avatar.png'" alt="" style="width:40px;margin-right: 5px">{$vo.nickname} <img src="{$vo.avatar}" onerror="this.src='/static/img/default_avatar.png'" alt=""
style="width:40px;margin-right: 5px">{$vo.nickname}
</td> </td>
<td>{$vo.name}</td> <td>{$vo.name}</td>
<td> <td>
<!--{$vo.gender}--> <!--{$vo.gender}-->
{if condition="$vo.gender == 1"} {if condition="$vo.gender == 1"}
{elseif condition="$vo.gender == 2"/} {elseif condition="$vo.gender == 2"/}
{else/} {else/}
未知 未知
{/if} {/if}
</td> </td>
<td>{$vo.phone}</td> <td>
<input type="text" name="phone" value="{$vo.phone}" onchange="changePhone(this,'{$vo.id}')">
</td>
<td>{$vo.province} {$vo.city}</td> <td>{$vo.province} {$vo.city}</td>
<td> <td>
{if condition="$vo.is_vip == 1"} {if condition="$vo.is_vip == 1"}
<span style="color: goldenrod;font-weight: bold;font-size: 16px;">VIP</span>会员 <span style="color: goldenrod;font-weight: bold;font-size: 16px;">VIP</span>会员
{else/} {else/}
非会员 非会员
{/if} {/if}
</td> </td>
<td> <td>
{if condition="$vo.is_vip == 1"} {if condition="$vo.is_vip == 1"}
{$vo.vip_number} {$vo.vip_number}
{/if} {/if}
</td> </td>
<td>{$vo.wx_number}</td> <td>{$vo.wx_number}</td>
<td>{$vo.address}</td> <td>{$vo.address}</td>
<td> <td>
{if condition="$vo.is_vip == 1"} {if condition="$vo.is_vip == 1"}
{$vo.vip_endtime} {$vo.vip_endtime}
{/if} {/if}
</td> </td>
<td> <td>
...@@ -105,8 +114,8 @@ ...@@ -105,8 +114,8 @@
</td> </td>
<td>{$vo.created_at}</td> <td>{$vo.created_at}</td>
<!--<td>--> <!--<td>-->
<!--<a href="{:url('admin/project/editTag',['id'=>$vo.id])}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>--> <!--<a href="{:url('admin/project/editTag',['id'=>$vo.id])}" class="btn btn-xs btn-primary"><i class="fa fa-pencil"></i></a>-->
<!--<a href="javascript:" oid="{$vo.id}" class="btn btn-xs btn-danger btn-delete"><i class="fa fa-trash"></i></a>--> <!--<a href="javascript:" oid="{$vo.id}" class="btn btn-xs btn-danger btn-delete"><i class="fa fa-trash"></i></a>-->
<!--</td>--> <!--</td>-->
</tr> </tr>
{/volist} {/volist}
...@@ -124,27 +133,27 @@ ...@@ -124,27 +133,27 @@
<script type="text/javascript"> <script type="text/javascript">
// 文档加载完毕之后,会进入该方法 // 文档加载完毕之后,会进入该方法
$(function(){ $(function () {
// $(".btn-delete").click(function(){ // $(".btn-delete").click(function(){
// var _this = $(this); // var _this = $(this);
// var url = "{:url('admin/project/deleteTag')}"; // var url = "{:url('admin/project/deleteTag')}";
// var oid = _this.attr('oid'); // var oid = _this.attr('oid');
// showDialog("提示", "确定删除该标签吗?", function(){ // showDialog("提示", "确定删除该标签吗?", function(){
// // ajax post 方法 // // ajax post 方法
// $.post(url, {id:oid}, function (res) { // $.post(url, {id:oid}, function (res) {
// // var res = JSON.parse(res); // // var res = JSON.parse(res);
// if(res.code == 1){ // if(res.code == 1){
// // javascript 的默认弹出提示方法 // // javascript 的默认弹出提示方法
// _this.remove(); // _this.remove();
// $("#tr_"+oid).fadeOut(); // $("#tr_"+oid).fadeOut();
// }else{ // }else{
// alert(res.msg); // alert(res.msg);
// } // }
// }); // });
// }); // });
// }); // });
$("#output").click(function () { $("#output").click(function () {
$(this).attr("disabled",true); $(this).attr("disabled", true);
// $nickname = input('get.nickname'); // $nickname = input('get.nickname');
// $is_vip = input('get.is_vip'); // $is_vip = input('get.is_vip');
// $start_time = input('get.start_time'); // $start_time = input('get.start_time');
...@@ -153,9 +162,16 @@ ...@@ -153,9 +162,16 @@
var is_vip = $("#is_vip").val(); var is_vip = $("#is_vip").val();
var start_time = $("#start_time").val(); var start_time = $("#start_time").val();
var end_time = $("#end_time").val(); var end_time = $("#end_time").val();
console.log("{:url('admin/user/userOutput')}"+'?nickname='+nickname+'&is_vip='+is_vip+'&start_time='+start_time+'&end_time='+end_time); console.log("{:url('admin/user/userOutput')}" + '?nickname=' + nickname + '&is_vip=' + is_vip + '&start_time=' + start_time + '&end_time=' + end_time);
window.location.href="{:url('admin/user/userOutput')}"+'?nickname='+nickname+'&is_vip='+is_vip+'&start_time='+start_time+'&end_time='+end_time; window.location.href = "{:url('admin/user/userOutput')}" + '?nickname=' + nickname + '&is_vip=' + is_vip + '&start_time=' + start_time + '&end_time=' + end_time;
$(this).removeAttr('disabled'); $(this).removeAttr('disabled');
}); });
}); });
function changePhone(obj,id) {
let phone = $(obj).val();
$.post("{:url('changePhone')}", {id:id,phone: phone}, function (res) {
layer.msg(res.msg)
});
}
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment