dusenyao пре 3 година
родитељ
комит
53c13f6222

+ 55 - 1
src/App.vue

@@ -1,7 +1,12 @@
 <template>
-  <div id="app">
+  <div id="app" :dir="dir">
     <router-view />
     <progress-bar />
+    <div v-if="userAgentTipShow" class="userAgentTips">
+      <img src="./assets/userAgentWarning.png" width="32px" />
+      <span>当前浏览器可能与网站不兼容!建议使用 chrome 浏览器获得最佳使用体验。</span>
+      <img src="./assets/userAgentClose.png" width="16px" @click="handleClickUserAgent" />
+    </div>
   </div>
 </template>
 
@@ -11,6 +16,55 @@ import ProgressBar from '@/common/progress_bar/index.vue';
 export default {
   components: {
     ProgressBar
+  },
+  data() {
+    return {
+      dir: 'ltr',
+      userAgentTipShow: false
+    };
+  },
+  created() {
+    const lang_type = this.$store.state.user.language_type;
+    if (lang_type === 'AR') {
+      this.dir = 'rtl';
+    }
+    this.handleUserAgentRoot();
+  },
+  methods: {
+    handleUserAgentRoot() {
+      if (!sessionStorage.getItem('useragent_root_close') && navigator.userAgent.indexOf('Chrome') === -1) {
+        this.userAgentTipShow = true;
+      }
+    },
+    handleClickUserAgent() {
+      sessionStorage.setItem('useragent_root_close', true);
+      this.userAgentTipShow = false;
+    }
   }
 };
 </script>
+
+<style lang="scss" scoped>
+.userAgentTips {
+  position: fixed;
+  top: 62px;
+  left: 50%;
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  padding: 12px 16px 12px 8px;
+  margin-left: -312px;
+  font-size: 16px;
+  line-height: 24px;
+  background: #fff;
+  border-radius: 8px;
+
+  :nth-child(1) {
+    margin-right: 8px;
+  }
+
+  :nth-child(3) {
+    cursor: pointer;
+  }
+}
+</style>

BIN
src/assets/userAgentClose.png


BIN
src/assets/userAgentWarning.png


+ 1 - 0
src/layouts/components/LayoutHeader.vue

@@ -137,6 +137,7 @@ export default {
     },
     QuitLogin() {
       removeToken();
+      sessionStorage.removeItem('useragent_root_close');
       this.userShow = false;
       this.userMessage = null;
       window.location.href = '/';

+ 6 - 1
src/router/index.js

@@ -22,7 +22,12 @@ const routes = [
       store
         .dispatch('user/enterSys')
         .then(() => {
-          next('/');
+          const { tab, enter, dateStamp } = to.query;
+          if (enter) {
+            next(`/${enter}?tab=${tab}&dateStamp=${dateStamp}`);
+          } else {
+            next('/');
+          }
         })
         .catch(() => {
           store.dispatch('user/signOut');

+ 8 - 1
src/views/main/TaskList.vue

@@ -4,7 +4,12 @@
       <!-- 菜单 -->
       <main-menu cur-tab="TaskList" />
       <!-- 日历 -->
-      <monthly-calendar ref="calendar" @changeTimeUnit="changeTimeUnit" @changeDate="changeDate" />
+      <monthly-calendar
+        ref="calendar"
+        :date-stamp="dateStamp"
+        @changeTimeUnit="changeTimeUnit"
+        @changeDate="changeDate"
+      />
       <!-- 通知 -->
       <div class="notice">
         <div class="notice-title">
@@ -131,7 +136,9 @@ export default {
     MainMenu
   },
   data() {
+    const date = this.$route.query.dateStamp;
     return {
+      dateStamp: date ? new Date(date) : undefined,
       colorMatching,
       buttonColorList,
       taskTimeList,

+ 20 - 9
src/views/main/components/MonthlyCalendar.vue

@@ -82,6 +82,14 @@ import { weekList, modeList, monthList } from './calendarData';
 import { GetMyTaskDailyDistribution } from '@/api/user';
 
 export default {
+  props: {
+    dateStamp: {
+      type: Date,
+      default: () => {
+        return new Date();
+      }
+    }
+  },
   data() {
     return {
       focusDate: 0,
@@ -90,8 +98,8 @@ export default {
       weekList,
       monthList,
       date: '',
-      curYear: new Date().getFullYear(),
-      curMonth: new Date().getMonth() + 1,
+      curYear: this.dateStamp.getFullYear(),
+      curMonth: this.dateStamp.getMonth() + 1,
       time_unit: modeList[0].type,
       DAY: modeList[0].type,
       MONTH: modeList[1].type,
@@ -133,16 +141,17 @@ export default {
     }
   },
   created() {
-    this.date = `${new Date().getFullYear()}-${new Date().getMonth() + 1}`;
+    this.date = `${this.dateStamp.getFullYear()}-${this.dateStamp.getMonth() + 1}`;
     this.getDateArr();
-    this.focusDate = new Date().getDate();
+    this.focusDate = this.dateStamp.getDate();
   },
   methods: {
     // 返回今天
     backToday() {
-      this.date = `${new Date().getFullYear()}-${new Date().getMonth() + 1}`;
-      this.focusDate = new Date().getDate();
-      this.focusMonth = new Date().getMonth();
+      const date = new Date();
+      this.date = `${date.getFullYear()}-${date.getMonth() + 1}`;
+      this.focusDate = date.getDate();
+      this.focusMonth = date.getMonth();
       this.$emit('changeDate');
       this.getDateArr();
     },
@@ -191,13 +200,15 @@ export default {
 
     // 得到日历所需数组
     getDateArr() {
-      const curDate = new Date().getDate();
       const daysInMonth = dayjs(this.date).daysInMonth();
       const dayOfWeek = dayjs(`${this.date}-1`).day();
       const curMonth = dayjs(this.date).month();
       const curYear = dayjs(this.date).year();
       const lastDays = dayjs(curMonth === 0 ? `${curYear - 1}-12` : `${curYear}-${curMonth}`).daysInMonth();
-      const isThisMonth = curMonth === new Date().getMonth() && curYear === new Date().getFullYear();
+
+      const date = new Date();
+      const curDate = date.getDate();
+      const isThisMonth = curMonth === date.getMonth() && curYear === date.getFullYear();
 
       const arr = [];
       // 是否有上个月