Browse Source

去除遥控器默认密码

李富豪 1 year ago
parent
commit
d0a688600c

+ 2 - 2
Web/src/pages/page-pilot/pilot-index.vue

@@ -41,8 +41,8 @@ import djiLogo from '/@/assets/icons/dji_logo.png'
 const root = getRoot()
 
 const formState: UnwrapRef<LoginBody> = reactive({
-  username: 'pilot',
-  password: 'pilot123',
+  username: '',
+  password: '',
   flag: EUserType.Pilot,
   gateway_sn: apiPilot.getRemoteControllerSN()
 })

+ 23 - 9
Web/src/pages/page-web/projects/member/index.vue

@@ -6,9 +6,12 @@
         @change="refreshData" :rowClassName="rowClassName" :dataSource="state.list" :pagination="paginationConfig">
         <!-- 操作 -->
         <template #action="{ record }">
-          <a-tooltip title="查看密码">
+          <a-tooltip title="显示密码" v-if="!record.password">
             <EyeOutlined style="color: #2d8cf0;" @click="onClickLookPassword(record.user_id)" />
           </a-tooltip>
+          <a-tooltip title="隐藏密码" v-else>
+            <EyeInvisibleOutlined style="color: #2d8cf0;" @click="onClickClosePassword(record.user_id)" />
+          </a-tooltip>
         </template>
       </a-table>
     </div>
@@ -19,7 +22,7 @@
 
 <script lang="ts" setup>
 import { onMounted, reactive } from 'vue';
-import { EyeOutlined } from '@ant-design/icons-vue';
+import { EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons-vue';
 import Search from './components/Search.vue';
 import AddModal from './components/AddModal.vue';
 import { getAllUsersInfo } from '/@/api/manage';
@@ -117,9 +120,9 @@ const columns = [
   {
     title: '密码',
     dataIndex: 'password',
-    width: 150,
+    width: 100,
     customRender: ({ text }: any) => {
-      return text || '--';
+      return text || '****';
     }
   },
   {
@@ -178,15 +181,26 @@ const onClickReset = async (query: any) => {
 const onClickLookPassword = async (id: string) => {
   try {
     const res = await apis.fetchPilotPassword({ userId: id });
-    const item = state.list.find((item) => item.user_id === id);
-    if (!item) {
-      return;
-    }
-    item.password = res.data;
+    const list = state.list.map(item => {
+      return {
+        ...item,
+        password: item.user_id === id ? res.data : '',// 显示当前密码,关闭其他密码
+      }
+    })
+    state.list = list;
   } catch (e) {
     console.error(e);
   }
 }
+
+// 点击关闭密码
+const onClickClosePassword = (id: string) => {
+  const item = state.list.find((item) => item.user_id === id);
+  if (!item) {
+    return;
+  }
+  item.password = '';
+}
 </script>
 
 <style lang="scss">

+ 7 - 0
Web/src/utils/index.ts

@@ -1,3 +1,5 @@
+import { ELocalStorageKey } from "../types";
+
 export const getTextByModeCode = (code: number) => {
     let text = '';
     switch (code) {
@@ -62,4 +64,9 @@ export const getTextByModeCode = (code: number) => {
             break;
     }
     return text;
+}
+
+// 获取项目ID
+export const getWorkspaceId = () => {
+    return localStorage.getItem(ELocalStorageKey.WorkspaceId) || '';
 }