Procházet zdrojové kódy

feat(成员管理): 新增用户时,会展示默认密码

fxs před 1 dnem
rodič
revize
56a57036c5
1 změnil soubory, kde provedl 99 přidání a 0 odebrání
  1. 99 0
      src/views/MemberManage/MemberTable.vue

+ 99 - 0
src/views/MemberManage/MemberTable.vue

@@ -51,6 +51,12 @@ const isEdit = ref(false)
 // 当前是否编辑的是管理员
 const isAdmin = ref(false)
 
+// 密码提示对话框可见性
+const passwordDialogVisible = ref<boolean>(false)
+
+// 新密码
+const newPassword = ref<string>('')
+
 // 控制模态框的显示与隐藏
 const dialogVisible = ref(false)
 // 模态框的标题
@@ -225,6 +231,10 @@ const saveMember = async () => {
 
     ElMessage.success(msg)
     dialogVisible.value = false
+    if (!isEdit.value) {
+      newPassword.value = res.data.password
+      passwordDialogVisible.value = true
+    }
   } catch (error) {
     ElMessage.error('操作失败')
   } finally {
@@ -261,6 +271,11 @@ const delMember = (row: any) => {
       memberTableRef.value?.updateTableData()
     })
 }
+
+const closePasswordDialog = () => {
+  passwordDialogVisible.value = false
+  newPassword.value = ''
+}
 </script>
 
 <template>
@@ -339,6 +354,46 @@ const delMember = (row: any) => {
         </span>
       </template>
     </el-dialog>
+    <!--    密码提示框-->
+    <el-dialog
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      v-model="passwordDialogVisible"
+      title="用户信息"
+      width="500"
+      @close="closePasswordDialog"
+    >
+      <div class="echoInfo">
+        <p>请妥善保管您的用户信息,请勿泄露</p>
+        <p>关闭弹窗后,将无法重新打开,请自行保存</p>
+        <div>
+          <p>
+            <span>账号:</span>
+            <span>{{ memberForm.account }}</span>
+          </p>
+          <p>
+            <span>密码:</span>
+            <span>{{ newPassword }}</span>
+          </p>
+        </div>
+      </div>
+    </el-dialog>
+    <!--    <el-dialog-->
+    <!--      v-model="passwordDialogVisible"-->
+    <!--      title="默认密码提示"-->
+    <!--      :close-on-click-modal="false"-->
+    <!--      width="300px"-->
+    <!--      center-->
+    <!--    >-->
+    <!--      <div class="password-content">-->
+    <!--        <p>您的账户已创建成功</p>-->
+    <!--        <div class="default-password">{{ newPassword }}</div>-->
+    <!--        <p class="note">请及时复制密码并妥善保存</p>-->
+    <!--        <el-button type="primary" @click="passwordDialogVisible = false" style="width: 100%">-->
+    <!--          确认-->
+    <!--        </el-button>-->
+    <!--      </div>-->
+    <!--    </el-dialog>-->
   </div>
 </template>
 
@@ -377,6 +432,7 @@ const delMember = (row: any) => {
 
 .operationBtn,
 .dialogFooterBtn {
+  cursor: pointer;
   margin-right: 10px;
 }
 
@@ -402,4 +458,47 @@ const delMember = (row: any) => {
   padding: 15px 20px;
   text-align: right;
 }
+
+.echoInfo {
+  padding: 16px;
+  background-color: #f9fafb; /* 浅灰色背景 */
+  border-radius: 8px;
+}
+
+.echoInfo p:first-child {
+  margin-bottom: 12px;
+  color: #8282ea; /* 提示信息颜色:红色 */
+  font-weight: 600;
+}
+
+.echoInfo p:nth-child(2) {
+  margin-bottom: 12px;
+
+  color: #dc2626; /* 提示信息颜色:红色 */
+  font-weight: 600;
+}
+
+.echoInfo div {
+  background: white;
+  padding: 12px;
+  border: 1px solid #e5e7eb;
+  border-radius: 8px;
+}
+
+.echoInfo > div > p {
+  display: flex;
+  justify-content: space-between;
+  margin: 8px 0;
+  color: #374151; /* 深灰色文本 */
+  font-size: 14px;
+}
+
+.echoInfo p span:first-child {
+  font-weight: 500;
+  color: #374151;
+}
+
+.echoInfo p span:last-child {
+  color: #1d4ed8; /* 蓝色文本 */
+}
 </style>