Explorar o código

fix(admin): 创建规划师admin时phone为null导致username为空

Xiaogang Liao hai 2 meses
pai
achega
1dcace9d7d

+ 2 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/admin/AdminController.java

@@ -613,8 +613,9 @@ public class AdminController {
                 .eq(Admin::getPhone, user.getPhone()));
         if (admin == null) {
             admin = new Admin();
+            String usernameVal = user.getPhone() != null ? user.getPhone() : ("teacher_" + user.getId());
             admin.setPhone(user.getPhone());
-            admin.setUsername(user.getPhone());
+            admin.setUsername(usernameVal);
             admin.setRealName(user.getRealName());
             admin.setNickname(user.getNickname());
             admin.setRole("teacher");

+ 4 - 4
cfc-web/src/views/admin/review/ArticleAudit.vue

@@ -44,7 +44,7 @@
 </template>
 
 <script>
-import { articleList, articleAudit } from '@/api/article'
+import { adminArticleList, adminArticleAudit } from '@/api/article'
 
 export default {
   name: 'ArticleAudit',
@@ -69,7 +69,7 @@ export default {
     async loadData() {
       this.loading = true
       try {
-        const res = await articleList({
+        const res = await adminArticleList({
           page: this.page,
           size: this.size,
           status: 'draft',
@@ -93,7 +93,7 @@ export default {
     async handleAudit(row, action) {
       try {
         await this.$confirm(action === 'approved' ? '确认通过审核?' : '确认驳回?', '提示', { type: 'warning' })
-        await articleAudit({ id: row.id, action })
+        await adminArticleAudit({ id: row.id, auditStatus: action })
         this.$message.success(action === 'approved' ? '已通过' : '已驳回')
         this.loadData()
       } catch (e) {
@@ -109,7 +109,7 @@ export default {
       if (!this.rejectReason.trim()) return this.$message.warning('请填写驳回原因')
       this.rejectDialogVisible = false
       try {
-        await articleAudit({ id: this.currentRow.id, action: 'rejected', reason: this.rejectReason })
+        await adminArticleAudit({ id: this.currentRow.id, auditStatus: 'rejected', auditReason: this.rejectReason })
         this.$message.success('已驳回')
         this.loadData()
       } catch (e) {