用户列表页增加手机号绑定状态及筛选

This commit is contained in:
GoEdgeLab
2024-05-14 15:06:18 +08:00
parent 9a1b40887f
commit cbaff053ee
3 changed files with 31 additions and 11 deletions

View File

@@ -16,11 +16,13 @@ func (this *IndexAction) Init() {
} }
func (this *IndexAction) RunGet(params struct { func (this *IndexAction) RunGet(params struct {
Keyword string Keyword string
Verifying bool Verifying bool
MobileIsVerified int32 `default:"-1"`
}) { }) {
this.Data["keyword"] = params.Keyword this.Data["keyword"] = params.Keyword
this.Data["isVerifying"] = params.Verifying this.Data["isVerifying"] = params.Verifying
this.Data["mobileIsVerified"] = params.MobileIsVerified
// 未审核的总数量 // 未审核的总数量
countVerifyingUsersResp, err := this.RPC().UserRPC().CountAllEnabledUsers(this.AdminContext(), &pb.CountAllEnabledUsersRequest{ countVerifyingUsersResp, err := this.RPC().UserRPC().CountAllEnabledUsers(this.AdminContext(), &pb.CountAllEnabledUsersRequest{
@@ -34,8 +36,9 @@ func (this *IndexAction) RunGet(params struct {
// 当前匹配的数量 // 当前匹配的数量
countResp, err := this.RPC().UserRPC().CountAllEnabledUsers(this.AdminContext(), &pb.CountAllEnabledUsersRequest{ countResp, err := this.RPC().UserRPC().CountAllEnabledUsers(this.AdminContext(), &pb.CountAllEnabledUsersRequest{
Keyword: params.Keyword, Keyword: params.Keyword,
IsVerifying: params.Verifying, IsVerifying: params.Verifying,
MobileIsVerified: params.MobileIsVerified,
}) })
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
@@ -46,10 +49,11 @@ func (this *IndexAction) RunGet(params struct {
this.Data["page"] = page.AsHTML() this.Data["page"] = page.AsHTML()
usersResp, err := this.RPC().UserRPC().ListEnabledUsers(this.AdminContext(), &pb.ListEnabledUsersRequest{ usersResp, err := this.RPC().UserRPC().ListEnabledUsers(this.AdminContext(), &pb.ListEnabledUsersRequest{
Keyword: params.Keyword, Keyword: params.Keyword,
IsVerifying: params.Verifying, IsVerifying: params.Verifying,
Offset: page.Offset, MobileIsVerified: params.MobileIsVerified,
Size: page.Size, Offset: page.Offset,
Size: page.Size,
}) })
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
@@ -86,6 +90,7 @@ func (this *IndexAction) RunGet(params struct {
"isVerified": user.IsVerified, "isVerified": user.IsVerified,
"isRejected": user.IsRejected, "isRejected": user.IsRejected,
"identityIsSubmitted": identityIsSubmitted, "identityIsSubmitted": identityIsSubmitted,
"verifiedMobile": user.VerifiedMobile,
}) })
} }
this.Data["users"] = userMaps this.Data["users"] = userMaps

View File

@@ -16,10 +16,17 @@
<div class="ui field"> <div class="ui field">
<input type="text" placeholder="用户名、全名、手机号..." name="keyword" v-model="keyword"/> <input type="text" placeholder="用户名、全名、手机号..." name="keyword" v-model="keyword"/>
</div> </div>
<div class="ui field" v-show="teaIsPlus">
<select class="ui dropdown" name="mobileIsVerified" v-model="mobileIsVerified">
<option value="-1">[手机号绑定状态]</option>
<option value="1">已绑定</option>
<option value="0">未绑定</option>
</select>
</div>
<div class="ui field"> <div class="ui field">
<button type="submit" class="ui button">搜索</button> <button type="submit" class="ui button">搜索</button>
&nbsp; &nbsp;
<a :href="'/users?verifying=' + (isVerifying ? 1 : 0)" v-if="keyword.length > 0">[清除条件]</a> <a :href="'/users?verifying=' + (isVerifying ? 1 : 0)" v-if="keyword.length > 0 || mobileIsVerified != -1">[清除条件]</a>
</div> </div>
</div> </div>
</form> </form>
@@ -31,9 +38,10 @@
<th>用户名</th> <th>用户名</th>
<th>全名</th> <th>全名</th>
<th>关联集群</th> <th>关联集群</th>
<th>手机号</th> <th>绑定手机号</th>
<th v-if="windowWidth > columnWidth1">联系手机号</th>
<th>注册时间</th> <th>注册时间</th>
<th class="center width10">状态</th> <th class="center" style="width: 6em">状态</th>
<th class="two op">操作</th> <th class="two op">操作</th>
</tr> </tr>
</thead> </thead>
@@ -60,6 +68,10 @@
<span v-else class="disabled">-</span> <span v-else class="disabled">-</span>
</td> </td>
<td :class="{disabled:!user.isOn}"> <td :class="{disabled:!user.isOn}">
<span v-if="user.verifiedMobile.length > 0">{{user.verifiedMobile}}</span>
<span v-else class="disabled">-</span>
</td>
<td :class="{disabled:!user.isOn}" v-if="windowWidth > columnWidth1">
<span v-if="user.mobile.length > 0"><keyword :v-word="keyword">{{user.mobile}}</keyword></span> <span v-if="user.mobile.length > 0"><keyword :v-word="keyword">{{user.mobile}}</keyword></span>
<span v-else class="disabled">-</span> <span v-else class="disabled">-</span>
</td> </td>

View File

@@ -1,4 +1,7 @@
Tea.context(function () { Tea.context(function () {
this.windowWidth = window.innerWidth
this.columnWidth1 = 1000
this.createUser = function () { this.createUser = function () {
teaweb.popup(Tea.url(".createPopup"), { teaweb.popup(Tea.url(".createPopup"), {
height: "30em", height: "30em",