Skip to content

Commit f3a57ea

Browse files
committed
1. 管理员删除的bug
2. 会员信息修改的bug
1 parent 6407930 commit f3a57ea

File tree

10 files changed

+40
-23
lines changed

10 files changed

+40
-23
lines changed

app/controller/manage/adminUser.js

+18-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: doramart
33
* @Date: 2019-06-20 18:55:40
44
* @Last Modified by: doramart
5-
* @Last Modified time: 2019-11-24 12:12:53
5+
* @Last Modified time: 2020-01-21 23:41:43
66
*/
77
const Controller = require('egg').Controller;
88
const {
@@ -215,8 +215,23 @@ class AdminUserController extends Controller {
215215
service
216216
} = this;
217217
try {
218-
let targetIds = ctx.query.ids;
219-
await ctx.service.adminUser.safeDelete(ctx, targetIds);
218+
let targetId = ctx.query.ids;
219+
// TODO 目前只针对删除单一管理员逻辑
220+
let oldUser = await ctx.service.adminUser.item(ctx, {
221+
query: {
222+
_id: targetId
223+
}
224+
});
225+
let leftAdminUser = await ctx.service.adminUser.count();
226+
if (!_.isEmpty(oldUser)) {
227+
if (oldUser._id === ctx.session.adminUserInfo._id ||
228+
leftAdminUser == 1) {
229+
throw new Error("当前场景不允许删除该管理员用户");
230+
}
231+
} else {
232+
throw new Error(ctx.__('validate_error_params'));
233+
}
234+
await ctx.service.adminUser.removes(ctx, targetId);
220235
ctx.helper.renderSuccess(ctx);
221236

222237
} catch (err) {

backstage/adminUser/src/views/adminUser/userForm.vue

+4-3
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ export default {
275275
],
276276
comments: [
277277
{
278+
required: true,
278279
message: this.$t("validate.inputNull", {
279280
label: this.$t("adminUser.lb_comments")
280281
}),
@@ -319,7 +320,7 @@ export default {
319320
return (isJPG || isPNG || isGIF) && isLt2M;
320321
},
321322
confirm() {
322-
this.$store.dispatch("hideAdminUserForm");
323+
this.$store.dispatch("adminUser/hideAdminUserForm");
323324
},
324325
submitForm(formName) {
325326
this.$refs[formName].validate(valid => {
@@ -345,8 +346,8 @@ export default {
345346
// 新增
346347
addAdminUser(params).then(result => {
347348
if (result.status === 200) {
348-
this.$store.dispatch("hideAdminUserForm");
349-
this.$store.dispatch("getAdminUserList");
349+
this.$store.dispatch("adminUser/hideAdminUserForm");
350+
this.$store.dispatch("adminUser/getAdminUserList");
350351
this.$message({
351352
message: this.$t("main.addSuccess"),
352353
type: "success"

backstage/contentCategory/src/views/contentCategory/categoryForm.vue

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export default {
141141
],
142142
comments: [
143143
{
144+
required: true,
144145
message: this.$t("validate.inputNull", {
145146
label: this.$t("main.comments_label")
146147
}),

backstage/contentTags/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "adminresource",
2+
"name": "contenttags",
33
"version": "0.1.0",
44
"private": true,
55
"scripts": {

backstage/dist/adminUser/js/app.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backstage/dist/contentCategory/js/app.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backstage/dist/contentTags/js/app.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backstage/dist/regUser/js/app.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backstage/regUser/src/views/regUser/dataTable.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div
1717
v-if="scope.row.countryCode&&scope.row.phoneNum"
1818
>{{scope.row.countryCode + ' ' + scope.row.phoneNum}}</div>
19-
<div v-else-if="scope.row.deviceId">{{scope.row.deviceId}}</div>
19+
<div v-else-if="scope.row.phoneNum">{{scope.row.phoneNum}}</div>
2020
<div v-else></div>
2121
</template>
2222
</el-table-column>

backstage/regUser/src/views/regUser/userForm.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
></el-switch>
4949
</el-form-item>
5050
<el-form-item :label="$t('regUser.phoneNum')" prop="phoneNum">
51-
<el-input size="small" v-model.number="dialogState.formData.phoneNum"></el-input>
51+
<el-input size="small" v-model="dialogState.formData.phoneNum"></el-input>
5252
</el-form-item>
5353
<el-form-item :label="$t('regUser.email')" prop="email">
54-
<el-input size="small" v-model="dialogState.formData.email"></el-input>
54+
<el-input :disabled="true" size="small" v-model="dialogState.formData.email"></el-input>
5555
</el-form-item>
5656
<el-form-item :label="$t('regUser.comments')" prop="comments">
5757
<el-input size="small" type="textarea" v-model="dialogState.formData.comments"></el-input>

0 commit comments

Comments
 (0)