Kaynağa Gözat

:bookmark: Releasing / Version tags. 3.3

冷冷 6 yıl önce
ebeveyn
işleme
8d7445e60b
5 değiştirilmiş dosya ile 123 ekleme ve 151 silme
  1. 2 2
      src/const/website.js
  2. 9 8
      src/filters/index.js
  3. 107 103
      src/page/index/tags.vue
  4. 3 37
      src/page/login/index.vue
  5. 2 1
      src/util/date.js

+ 2 - 2
src/const/website.js

@@ -2,12 +2,12 @@ export default {
   title: 'PigX',
   logo: 'PigX',
   key: 'pigx', // 配置主键,目前用于存储
-  indexTitle: 'PigX Pro 快速开发框架',
+  indexTitle: 'PigX 快速开发框架',
   whiteList: ['/login', '/404', '/401', '/lock'], // 配置无权限可以访问的页面
   whiteTagList: ['/login', '/404', '/401', '/lock'], // 配置不添加tags页面 ('/advanced-router/mutative-detail/*'——*为通配符)
   lockPage: '/lock',
   tokenTime: 6000,
-  infoTitle: 'PigX Pro 快速开发框架',
+  infoTitle: 'PigX 快速开发框架',
   statusWhiteList: [428],
   // 配置首页不可关闭
   isFirstPage: false,

+ 9 - 8
src/filters/index.js

@@ -1,4 +1,4 @@
-function pluralize (time, label) {
+function pluralize(time, label) {
   if (time === 1) {
     return time + label
   }
@@ -8,7 +8,8 @@ function pluralize (time, label) {
 /**
  * 日期格式化
  */
-export function dateFormat (date, format = 'yyyy-MM-dd hh:mm:ss') {
+export function dateFormat(date) {
+  let format = 'yyyy-MM-dd hh:mm:ss'
   if (date !== 'Invalid Date') {
     var o = {
       'M+': date.getMonth() + 1, // month
@@ -35,7 +36,7 @@ export function dateFormat (date, format = 'yyyy-MM-dd hh:mm:ss') {
   return ''
 }
 
-export function timeAgo (time) {
+export function timeAgo(time) {
   const between = Date.now() / 1000 - Number(time)
   if (between < 3600) {
     return pluralize(~~(between / 60), ' minute')
@@ -46,7 +47,7 @@ export function timeAgo (time) {
   }
 }
 
-export function parseTime (time, cFormat) {
+export function parseTime(time, cFormat) {
   if (arguments.length === 0) {
     return null
   }
@@ -82,7 +83,7 @@ export function parseTime (time, cFormat) {
   return time_str
 }
 
-export function formatTime (time, option) {
+export function formatTime(time, option) {
   time = +time * 1000
   const d = new Date(time)
   const now = Date.now()
@@ -106,7 +107,7 @@ export function formatTime (time, option) {
 }
 
 /* 数字 格式化 */
-export function nFormatter (num, digits) {
+export function nFormatter(num, digits) {
   const si = [
     { value: 1E18, symbol: 'E' },
     { value: 1E15, symbol: 'P' },
@@ -123,12 +124,12 @@ export function nFormatter (num, digits) {
   return num.toString()
 }
 
-export function html2Text (val) {
+export function html2Text(val) {
   const div = document.createElement('div')
   div.innerHTML = val
   return div.textContent || div.innerText
 }
 
-export function toThousandslsFilter (num) {
+export function toThousandslsFilter(num) {
   return (+num || 0).toString().replace(/^-?\d+/g, m => m.replace(/(?=(?!\b)(\d{3})+$)/g, ','))
 }

+ 107 - 103
src/page/index/tags.vue

@@ -9,10 +9,12 @@
       class="avue-tags__contentmenu">
       <div
         class="item"
-        @click="closeOthersTags">关闭其他</div>
+        @click="closeOthersTags">关闭其他
+      </div>
       <div
         class="item"
-        @click="closeAllTags">关闭全部</div>
+        @click="closeAllTags">关闭全部
+      </div>
     </div>
     <div
       :class="{'avue-tags__box--close':!website.isFirstPage}"
@@ -48,118 +50,120 @@
   </div>
 </template>
 <script>
-import { mapGetters, mapState } from 'vuex'
-export default {
-  name: 'Tags',
-  data() {
-    return {
-      active: '',
-      contentmenuX: '',
-      contentmenuY: '',
-      contextmenuFlag: false
-    }
-  },
-  watch: {
-    tag() {
-      this.setActive()
-    },
-    contextmenuFlag() {
-      window.addEventListener('mousedown', this.watchContextmenu)
-    }
-  },
-  created() {},
-  mounted() {
-    this.setActive()
-  },
-  computed: {
-    ...mapGetters(['tagWel', 'tagList', 'tag', 'website']),
-    ...mapState({
-      showTag: state => state.common.showTag
-    }),
-    tagLen() {
-      return this.tagList.length || 0
-    }
-  },
-  methods: {
-    watchContextmenu() {
-      if (!this.$el.contains(event.target) || event.button !== 0) {
-        this.contextmenuFlag = false
-      }
+  import { mapGetters, mapState } from 'vuex'
 
-      window.removeEventListener('mousedown', this.watchContextmenu)
-    },
-    handleContextmenu(event) {
-      let target = event.target
-      // 解决 https://github.com/d2-projects/d2-admin/issues/54
-      let flag = false
-      if (target.className.indexOf('el-tabs__item') > -1) flag = true
-      else if (target.parentNode.className.indexOf('el-tabs__item') > -1) {
-        target = target.parentNode
-        flag = true
+  export default {
+    name: 'Tags',
+    data() {
+      return {
+        active: '',
+        contentmenuX: '',
+        contentmenuY: '',
+        contextmenuFlag: false
       }
-      if (flag) {
-        event.preventDefault()
-        event.stopPropagation()
-        this.contentmenuX = event.clientX
-        this.contentmenuY = event.clientY
-        this.tagName = target.getAttribute('aria-controls').slice(5)
-        this.contextmenuFlag = true
+    },
+    watch: {
+      tag() {
+        this.setActive()
+      },
+      contextmenuFlag() {
+        window.addEventListener('mousedown', this.watchContextmenu)
       }
     },
-    // 激活当前选项
-    setActive() {
-      this.active = this.tag.value
+    created() {
     },
-    menuTag(value, action) {
-      if (action === 'remove') {
-        let { tag, key } = this.findTag(value)
-        this.$store.commit('DEL_TAG', tag)
-        if (tag.value === this.tag.value) {
-          tag = this.tagList[key === 0 ? key : key - 1] // 如果关闭本标签让前推一个
-          this.openTag(tag)
-        }
-      }
+    mounted() {
+      this.setActive()
     },
-    openTag(item) {
-      let tag
-      if (item.name) {
-        tag = this.findTag(item.name).tag
-      } else {
-        tag = item
+    computed: {
+      ...mapGetters(['tagWel', 'tagList', 'tag', 'website']),
+      ...mapState({
+        showTag: state => state.common.showTag
+      }),
+      tagLen() {
+        return this.tagList.length || 0
       }
-      this.$router.push({
-        path: this.$router.$avueRouter.getPath({
-          name: tag.label,
-          src: tag.value
-        }),
-        query: tag.query
-      })
-    },
-    closeOthersTags() {
-      this.contextmenuFlag = false
-      this.$store.commit('DEL_TAG_OTHER')
     },
-    findTag(value) {
-      let tag, key
-      this.tagList.map((item, index) => {
-        if (item.value === value) {
+    methods: {
+      watchContextmenu() {
+        if (!this.$el.contains(event.target) || event.button !== 0) {
+          this.contextmenuFlag = false
+        }
+
+        window.removeEventListener('mousedown', this.watchContextmenu)
+      },
+      handleContextmenu(event) {
+        let target = event.target
+        // 解决 https://github.com/d2-projects/d2-admin/issues/54
+        let flag = false
+        if (target.className.indexOf('el-tabs__item') > -1) flag = true
+        else if (target.parentNode.className.indexOf('el-tabs__item') > -1) {
+          target = target.parentNode
+          flag = true
+        }
+        if (flag) {
+          event.preventDefault()
+          event.stopPropagation()
+          this.contentmenuX = event.clientX
+          this.contentmenuY = event.clientY
+          this.tagName = target.getAttribute('aria-controls').slice(5)
+          this.contextmenuFlag = true
+        }
+      },
+      // 激活当前选项
+      setActive() {
+        this.active = this.tag.value
+      },
+      menuTag(value, action) {
+        if (action === 'remove') {
+          let { tag, key } = this.findTag(value)
+          this.$store.commit('DEL_TAG', tag)
+          if (tag.value === this.tag.value) {
+            tag = this.tagList[key === 0 ? key : key - 1] // 如果关闭本标签让前推一个
+            this.openTag(tag)
+          }
+        }
+      },
+      openTag(item) {
+        let tag
+        if (item.name) {
+          tag = this.findTag(item.name).tag
+        } else {
           tag = item
-          key = index
         }
-      })
-      return { tag: tag, key: key }
-    },
-    closeAllTags() {
-      this.contextmenuFlag = false
-      this.$store.commit('DEL_ALL_TAG')
-      this.$router.push({
-        path: this.$router.$avueRouter.getPath({
-          src: this.tagWel.value
-        }),
-        query: this.tagWel.query
-      })
+        this.$router.push({
+          path: this.$router.$avueRouter.getPath({
+            name: tag.label,
+            src: tag.value
+          }),
+          query: tag.query
+        })
+      },
+      closeOthersTags() {
+        this.contextmenuFlag = false
+        this.$store.commit('DEL_TAG_OTHER')
+      },
+      findTag(value) {
+        let tag, key
+        this.tagList.map((item, index) => {
+          if (item.value === value) {
+            tag = item
+            key = index
+          }
+        })
+        return { tag: tag, key: key }
+      },
+      closeAllTags() {
+        this.contextmenuFlag = false
+        this.$store.commit('DEL_ALL_TAG')
+        this.$router.push({
+          path: this.$router.$avueRouter.getPath({
+            src: this.tagWel.value
+          }),
+          query: this.tagWel.query
+        })
+      }
     }
   }
-}
 </script>
 

+ 3 - 37
src/page/login/index.vue

@@ -1,13 +1,9 @@
 <template>
   <div class="login-container"
        @keyup.enter.native="handleLogin">
-    <div class="login-time">
-      {{ time }}
-    </div>
     <div class="login-weaper  animated bounceInDown">
       <div class="login-logo">
-        <img src="/img/logo.png"
-             alt="">
+        <img src="/img/logo.png" alt="">
       </div>
       <p class="login-tip">{{ website.infoTitle}} v 3.3</p>
       <div class="login-border">
@@ -20,7 +16,7 @@
               <el-option v-for="tenant in tenantList"
                          :key="tenant.id"
                          :label="tenant.name"
-                         :value="tenant.id" />
+                         :value="tenant.id"></el-option>
             </el-select>
           </h4>
           <userLogin v-if="activeName==='user'" />
@@ -39,13 +35,7 @@
       </div>
     </div>
     <div class="login-copyright">
-
-      Copyright
-
-      2017-parent pig4cloud.com
-
-      @冷冷
-
+      Copyright © 2019 pig4cloud.com. All rights reserved.
     </div>
     <top-color v-show="false" />
   </div>
@@ -57,7 +47,6 @@ import codeLogin from './codelogin'
 import thirdLogin from './thirdlogin'
 import { mapGetters } from 'vuex'
 import { getStore, setStore } from '@/util/store'
-import { dateFormat } from '@/util/date'
 import topColor from '@/page/index/top/top-color'
 
 export default {
@@ -71,7 +60,6 @@ export default {
   data () {
     return {
       tenantList: [],
-      time: '',
       active: '',
       activeName: 'user',
       socialForm: {}
@@ -106,10 +94,6 @@ export default {
     this.watermark()
     this.getTenantList()
     this.active = getStore({ name: 'tenantId' })
-    this.getTime()
-    setInterval(() => {
-      this.getTime()
-    }, 1000)
   },
   mounted () {
   },
@@ -120,9 +104,6 @@ export default {
     handleCommand (command) {
       setStore({ name: 'tenantId', content: command })
     },
-    getTime () {
-      this.time = dateFormat(new Date(), 'hh:mm:ss')
-    },
     getTenantList () {
       request({
         url: '/admin/tenant/list',
@@ -242,21 +223,6 @@ export default {
   width: 140px;
 }
 
-.login-time {
-  display: flex;
-  justify-content: center;
-  align-items: center;
-  color: rgba(0, 0, 0, 0.03);
-  position: fixed;
-  left: 0;
-  top: 0;
-  width: 100%;
-  height: 100%;
-  opacity: 0.9;
-  font-size: 24em;
-  font-weight: bold;
-}
-
 .login-left .title {
   margin-top: 60px;
   text-align: center;

+ 2 - 1
src/util/date.js

@@ -25,7 +25,8 @@ export const calcDate = (date1, date2) => {
 /**
  * 日期格式化
  */
-export function dateFormat (date, format = 'yyyy-MM-dd hh:mm:ss') {
+export function dateFormat(date) {
+  let format = 'yyyy-MM-dd hh:mm:ss'
   if (date !== 'Invalid Date') {
     var o = {
       'M+': date.getMonth() + 1, // month