Explorar el Código

Merge branch 'dev_g' of United_Software/k_online_ui into dev

Jack Zhou hace 6 meses
padre
commit
536aaad1ba
Se han modificado 2 ficheros con 32 adiciones y 1 borrados
  1. 14 0
      src/api/module/system.ts
  2. 18 1
      src/views/SystemSettings/src/SystemSettings.vue

+ 14 - 0
src/api/module/system.ts

@@ -143,4 +143,18 @@ export const EditMonitoringTable = (params: any, config: any) => {
     },
     config
   )
+}
+/**
+ * 第一次点击设置页面
+ */
+export const FirstInitSubscribe = (params: any, config: any) => {
+  return HttpAxios.post(
+    `${baseUrl}`,
+    {
+      action: 'system_setting',
+      operate: 'subscribe_notification_default_init',
+      ...params
+    },
+    config
+  )
 }

+ 18 - 1
src/views/SystemSettings/src/SystemSettings.vue

@@ -4,6 +4,7 @@ import AddRSettingTableules from './components/SettingTable'
 import MonitoringTable from './components/MonitoringTable'
 import { useRouter, useRoute } from 'vue-router'
 import PersonalProfile from './components/PersonalProfile.vue'
+import moment from 'moment-timezone'
 
 const router = useRouter()
 const route = useRoute()
@@ -134,6 +135,22 @@ const SubShipmentsColumns = ref([
 const SubShipmentsTable = ref()
 const AddRulesTable = ref()
 const subscribeInit = ref({})
+
+const DefaultTimeZone = ref()
+const isInitSystem = JSON.parse(localStorage.getItem('userInfo')).subscribe_notification_default_init
+DefaultTimeZone.value = 'UTC' + moment().tz(moment.tz.guess()).format('Z')
+const FirstInitSubscribe = () => {
+  if(isInitSystem) {
+    $api.FirstInitSubscribe({
+      default_time_zone: DefaultTimeZone.value
+    }).then((res:any) => {
+      getsubscribe()
+    })
+  } else {
+    getsubscribe()
+  }
+}
+
 const getsubscribe = () => {
   $api.getsubscribe({}).then((res: any) => {
     if (res.code === 200) {
@@ -214,7 +231,7 @@ const gettabledatalength = (val: any) => {
 }
 
 onMounted(() => {
-  getsubscribe()
+  FirstInitSubscribe()
   if (sessionStorage.getItem('activeTab') != null) {
     TabActive.value = sessionStorage.getItem('activeTab')
     sessionStorage.removeItem('activeTab')