实现用户注册/审核功能

This commit is contained in:
GoEdgeLab
2022-01-05 10:45:28 +08:00
parent ac20b32bd5
commit 6b02f3f812
17 changed files with 226 additions and 28 deletions

View File

@@ -31,5 +31,15 @@ Vue.component("micro-basic-label", {
// 灰色的Label
Vue.component("grey-label", {
template: `<span class="ui label basic grey tiny" style="margin-top: 0.4em; font-size: 0.7em; border: 1px solid #ddd!important; font-weight: normal;"><slot></slot></span>`
props: ["color"],
data: function () {
let color = "grey"
if (this.color != null && this.color.length > 0) {
color = "red"
}
return {
labelColor: color
}
},
template: `<span class="ui label basic tiny" :class="labelColor" style="margin-top: 0.4em; font-size: 0.7em; border: 1px solid #ddd!important; font-weight: normal;"><slot></slot></span>`
})

View File

@@ -31,13 +31,13 @@
</div>
<div class="ui field">
<div class="ui left icon input">
<i class="ui user icon"></i>
<i class="ui user icon small"></i>
<input type="text" name="username" v-model="username" placeholder="请输入用户名" maxlength="200" ref="usernameRef" @input="changeUsername"/>
</div>
</div>
<div class="ui field">
<div class="ui left icon input">
<i class="ui lock icon"></i>
<i class="ui lock icon small"></i>
<input type="password" v-model="password" placeholder="请输入密码" maxlength="200" @input="changePassword()" ref="passwordRef"/>
</div>
</div>

View File

@@ -71,8 +71,14 @@
<p class="comment">显示在系统界面上的图标请使用PNG格式。</p>
</td>
</tr>
<tr>
<td>注册设置</td>
<td>
<a href="/users/setting">修改用户注册相关设置 &raquo;</a>
</td>
</tr>
</table>
<p class="comment">修改后,可能需要等待数分钟才会生效。</p>
<p class="comment">修改后,在3分钟内生效。</p>
<submit-btn></submit-btn>
</form>

View File

@@ -18,7 +18,15 @@
</tr>
</thead>
<tr v-for="user in users">
<td :class="{disabled:!user.isOn}"><a :href="'/users/user?userId=' + user.id">{{user.username}}</a></td>
<td :class="{disabled:!user.isOn}">
<a :href="'/users/user?userId=' + user.id">{{user.username}}</a>
<div v-if="!user.isVerified">
<grey-label color="red">未审核</grey-label>
</div>
<div v-if="user.isRejected">
<grey-label color="red">已拒绝</grey-label>
</div>
</td>
<td :class="{disabled:!user.isOn}">{{user.fullname}}</td>
<td>
<span v-if="user.cluster != null">{{user.cluster.name}} <link-icon :href="'/clusters/cluster?clusterId=' + user.cluster.id"></link-icon></span>

View File

@@ -0,0 +1,9 @@
.feature-boxes .feature-box {
margin-bottom: 1em;
width: 24em;
float: left;
}
.feature-boxes .feature-box:hover label {
font-weight: bold;
}
/*# sourceMappingURL=index_plus.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["index_plus.less"],"names":[],"mappings":"AAAA,cACC;EACC,kBAAA;EACA,WAAA;EACA,WAAA;;AAJF,cAOC,aAAY,MACX;EACC,iBAAA","file":"index_plus.css"}

View File

@@ -0,0 +1,13 @@
.feature-boxes {
.feature-box {
margin-bottom: 1em;
width: 24em;
float: left;
}
.feature-box:hover {
label {
font-weight: bold;
}
}
}

View File

@@ -5,7 +5,16 @@
<tr>
<td>状态</td>
<td>
<label-on :v-is-on="user.isOn"></label-on>
<span v-if="!user.isVerified" class="red">
未审核 &nbsp; <a href="" @click.prevent="verify">[审核]</a>
</span>
<span v-else-if="user.isRejected" class="red">已拒绝
&nbsp; <a href="" @click.prevent="verify">[重新审核]</a>
</span>
<span v-else>
<label-on :v-is-on="user.isOn"></label-on>
</span>
<p class="comment" v-if="user.isVerified && user.isRejected && user.rejectReason.length > 0">拒绝原因:{{user.rejectReason}}</p>
</td>
</tr>
<tr>
@@ -55,4 +64,12 @@
<span v-else class="disabled">-</span>
</td>
</tr>
<tr>
<td>注册IP</td>
<td>
<span v-if="user.registeredIP.length == 0" class="disabled">-</span>
<span v-else-if="user.registeredRegion.length == 0">{{user.registeredIP}}</span>
<span v-else>{{user.registeredIP}}<span class="grey small">{{user.registeredRegion}}</span></span>
</td>
</tr>
</table>

View File

@@ -0,0 +1,11 @@
Tea.context(function () {
this.verify = function () {
teaweb.popup(".verifyPopup?userId=" + this.user.id, {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
}
})
}
})

View File

@@ -0,0 +1,31 @@
{$layout "layout_popup"}
<h3>审核</h3>
<form class="ui form" data-tea-success="success" data-tea-action="$">
<csrf-token></csrf-token>
<input type="hidden" name="userId" :value="userId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">审核结果</td>
<td>
<select class="ui dropdown auto-width" name="result" v-model="result">
<option value="pass">通过</option>
<option value="reject">拒绝</option>
<option value="delete">拒绝并删除</option>
</select>
<p class="comment" v-if="result == 'pass'">通过后,用户可正常创建服务。</p>
<p class="comment" v-if="result == 'reject'">拒绝后,用户不可创建服务。</p>
<p class="comment" v-if="result == 'delete'">将删除当前用户信息。</p>
</td>
</tr>
<tr v-if="result == 'reject' || result == 'delete'">
<td>拒绝原因</td>
<td>
<textarea rows="2" name="rejectReason"></textarea>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.result = "pass"
})