Ver Fonte

feat: 实现用户操作手册

zhouyuhao há 1 ano atrás
pai
commit
b54c25c2a6

+ 3 - 1
src/api/index.ts

@@ -2,6 +2,7 @@ import * as booking from './module/booking'
 import * as tracking from './module/tracking'
 import * as common from './module/common'
 import * as login from './module/login'
+import * as other from './module/other'
 /**
  * api 对象接口定义
  */
@@ -17,7 +18,8 @@ const apis = generateApiMap({
   ...booking,
   ...tracking,
   ...common,
-  ...login
+  ...login,
+  ...other
 })
 export default {
   ...apis // 取出所有可遍历属性赋值在新的对象上

+ 16 - 0
src/api/module/other.ts

@@ -0,0 +1,16 @@
+import HttpAxios from '@/utils/axios'
+import axios, { type AxiosInstance, type AxiosRequestConfig, type AxiosResponse } from 'axios'
+
+const base = import.meta.env.VITE_API_HOST
+const baseUrl = `${base}/main_new_version.php`
+/**
+ * user guide
+ */
+export const getUserGuide = () => {
+  return axios.get(baseUrl, {
+    params: {
+      action: 'user_guide'
+    },
+    responseType: 'blob'
+  })
+}

+ 13 - 1
src/views/Layout/src/components/Header/HeaderView.vue

@@ -103,6 +103,18 @@ const handleChangePassword = () => {
   changePasswordDialogRef.value.openDialog()
 }
 
+const handleUserManual = () => {
+  $api.getUserGuide().then(async (res) => {
+    console.log(res.data.data)
+    // 创建一个 Blob 对象
+    const blob = new Blob([res.data.data], { type: 'application/pdf' })
+
+    const url = URL.createObjectURL(blob)
+    // 在新标签页中打开 PDF
+    window.open(url, '_blank')
+  })
+}
+
 const logoutDialogRef = ref()
 
 const handleLogout = () => {
@@ -149,7 +161,7 @@ const handleLogin = () => {
             <span class="font_family icon-icon_password_b"></span>
             Change Password
           </div>
-          <div class="item" @click="handleChangePassword">
+          <div class="item" @click="handleUserManual">
             <span class="font_family icon-icon_password_b"></span>
             User Manual
           </div>