Prechádzať zdrojové kódy

feat: 接入system Management中保存接口

zhouyuhao 9 mesiacov pred
rodič
commit
33f76e9a70

+ 3 - 1
src/api/index.ts

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

+ 20 - 0
src/api/module/notificationMessage.ts

@@ -0,0 +1,20 @@
+import HttpAxios from '@/utils/axios'
+
+const base = import.meta.env.VITE_API_HOST
+const baseUrl = `${base}/main_new_version.php`
+
+/**
+ * 保存用户个人信息或日期和数字格式化配置
+ * @param save_model profile 代表基本信息的save, no_profile 代表格式信息的save
+ * @param user_name
+ * @param email
+ * @param date_fromat
+ * @param numbers_format
+ */
+export const saveUserInfo = (params: any) => {
+  return HttpAxios.get(`${baseUrl}`, {
+    action: 'system_setting',
+    operate: 'personal_profile_save',
+    ...params
+  })
+}

+ 4 - 7
src/views/Layout/src/components/Header/components/NotificationDrawer.vue

@@ -95,13 +95,7 @@ const notificationList = [
 </script>
 
 <template>
-  <el-drawer
-    class="notice-drawer"
-    :modal="false"
-    v-model="drawerModel"
-    direction="rtl"
-    size="432px"
-  >
+  <el-drawer class="notice-drawer" v-model="drawerModel" size="432px">
     <template #header>
       <el-select size="large" v-model="notificationType" class="notification-type">
         <el-option
@@ -217,6 +211,9 @@ div.layout-toolbar {
 </style>
 <style lang="scss">
 div.layout-toolbar {
+  .el-overlay {
+    background-color: transparent;
+  }
   .notice-drawer {
     top: 48px;
     height: calc(100% - 48px);

+ 42 - 8
src/views/SystemMessage/src/components/PersonalProfile.vue

@@ -4,11 +4,11 @@ import { isEuropean, getDateFormat } from '@/utils/tools'
 import ChangePasswordDialog from '@/views/Layout/src/components/Header/components/ChangePasswordDialog.vue'
 
 const form = reactive({
-  firstName: '',
-  lastName: '',
-  username: '',
-  email: 'Chud',
-  phone: ''
+  firstName: 'z',
+  lastName: 'index',
+  username: 'Chud',
+  email: 'caroline.hu@kerrylogistics.com',
+  password: '**************'
 })
 
 const segmented = ref('dateTime')
@@ -72,6 +72,28 @@ isSpecifyNumbersFormat()
 
 // 获取用户地区日期格式
 dateFormat.value = getDateFormat()
+
+const saveConfig = (model: string) => {
+  let params = {}
+  if (model === 'profile') {
+    params = {
+      save_model: 'profile',
+      user_name: form.username,
+      email: form.email
+    }
+  } else {
+    params = {
+      save_model: 'no_profile',
+      date_fromat: selectVModel.value,
+      number_format: numbersFormat.value
+    }
+  }
+  $api.saveUserInfo(params).then((res: any) => {
+    if (res.cdoe === 200) {
+      console.log(res)
+    }
+  })
+}
 </script>
 
 <template>
@@ -108,7 +130,13 @@ dateFormat.value = getDateFormat()
               <span style="margin-left: 4px; color: var(--color-theme)">4 day(s)</span>
             </p>
             <div class="password-change">
-              <el-input size="large" style="width: 330px" :disabled="true" v-model="form.phone" />
+              <el-input
+                size="large"
+                type="password"
+                style="width: 330px"
+                :disabled="true"
+                v-model="form.password"
+              />
               <el-button @click="handleChangePassword" class="el-button--main" plain size="large"
                 >Change Password</el-button
               >
@@ -116,7 +144,9 @@ dateFormat.value = getDateFormat()
           </div>
         </div>
         <div class="row">
-          <el-button class="el-button--dark save-icon" size="large">Save</el-button>
+          <el-button @click="saveConfig('profile')" class="el-button--dark save-icon" size="large"
+            >Save</el-button
+          >
         </div>
       </div>
     </div>
@@ -167,7 +197,11 @@ dateFormat.value = getDateFormat()
               </el-col>
 
               <el-col>
-                <el-button style="padding: 0 40px" class="el-button--dark save-icon" size="large"
+                <el-button
+                  @click="saveConfig('no_profile')"
+                  style="padding: 0 40px"
+                  class="el-button--dark save-icon"
+                  size="large"
                   >Save</el-button
                 >
               </el-col>