Browse Source

1. 修改时区参数值 2. 防止重复message弹框 3. 添加login背景图 4. 调整文案和样式

wzl 2 years ago
parent
commit
0860a94d5e

+ 10 - 3
src/App.vue

@@ -1,5 +1,5 @@
 <template>
-  <div id="app">
+  <div id="app" :class="{'bgc': $route.name === 'login'}">
     <Header></Header>
     <div class="main">
       <Aside v-if="$route.name !== 'login'"></Aside>
@@ -39,7 +39,7 @@ export default class App extends Vue {
   flex-direction: column;
 }
 
-#app>.main {
+#app > .main {
   display: flex;
   width: 100%;
   height: 100%;
@@ -47,8 +47,15 @@ export default class App extends Vue {
   margin-top: 80px;
 }
 
+@media screen and (min-width: 430px) {
+  #app.bgc {
+    background: url('../static/images/common/background@2x.png') no-repeat;
+    background-size: cover;
+  }
+}
+
 @media screen and (max-width: 767px) {
-  #app>.main {
+  #app > .main {
     flex-direction: column;
     margin-top: 66px;
   }

+ 3 - 0
src/assets/scss/element-variables.scss

@@ -68,6 +68,9 @@ $--font-path: '~element-ui/lib/theme-chalk/fonts';
     font-size: 14px;
     color: #000;
   }
+  .el-checkbox__input.is-checked + .el-checkbox__label {
+    color: #000;
+  }
 }
 // 登录框form错误提示
 .el-form-item.is-error .el-input__inner, .el-form-item.is-error .el-input__inner:focus, .el-form-item.is-error .el-textarea__inner, .el-form-item.is-error .el-textarea__inner:focus {

+ 2 - 0
src/main.ts

@@ -7,9 +7,11 @@ import 'element-ui/lib/theme-chalk/index.css'
 import '@/assets/scss/element-variables.scss'
 import '@/assets/scss/common.scss'
 import * as echarts from 'echarts'
+import { message } from '@/utils/resetMessage'
 
 Vue.config.productionTip = false
 Vue.use(ElementUI)
+Vue.prototype.$message = message
 Vue.prototype.$echarts = echarts
 
 new Vue({

+ 3 - 2
src/request/http.ts

@@ -2,11 +2,12 @@
  * axios封装
  * 请求拦截、相应拦截、错误统一处理
  */
+import Vue from 'vue'
 import axios from 'axios'
 import QS from 'qs'
 import pinia from '@/store/index'
 import { loginStore } from '@/store/loginStore'
-import { Message } from 'element-ui'
+// import { Message } from 'element-ui'
 import router from '../router'
 
 const store = loginStore(pinia)
@@ -50,7 +51,7 @@ axios.interceptors.response.use(
       //   forbidClick: true
       // })
       if (response.data.code === '703' || response.data.code === '702' || response.data.code === '704') {
-        Message.error('登录过期,请重新登录')
+        Vue.prototype.$message.error('登录过期,请重新登录')
         store.setAuth(false)
         store.clearToken()
         // 跳转登录页面,并将要浏览的页面fullPath传过去,登录成功后跳转需要访问的页面

+ 21 - 0
src/utils/resetMessage.js

@@ -0,0 +1,21 @@
+// 重置message,防止重复点击重复弹出message弹框
+import { Message } from 'element-ui'
+let messageInstance = null
+const resetMessage = (options) => {
+  if (messageInstance) {
+    messageInstance.close()
+  }
+  messageInstance = Message(options)
+}
+;['error', 'success', 'info', 'warning'].forEach(type => {
+  resetMessage[type] = options => {
+    if (typeof options === 'string') {
+      options = {
+        message: options
+      }
+    }
+    options.type = type
+    return resetMessage(options)
+  }
+})
+export const message = resetMessage

+ 1 - 1
src/views/accountSettings/security.vue

@@ -30,7 +30,7 @@
           <span v-show="showErrTipNotMatch" class="err-tip">Password confirmation doesn't match Password</span>
         </el-form-item>
         <el-form-item>
-          <el-button type="primary" :disabled="submitBtnState('ruleForm')" @click="submitPassword('ruleForm')">Save the Change</el-button>
+          <el-button type="primary" :disabled="submitBtnState('ruleForm')" @click="submitPassword('ruleForm')">Save the Changes</el-button>
         </el-form-item>
       </el-form>
     </div>

+ 3 - 1
src/views/projects/api/apiKeys.vue

@@ -83,7 +83,9 @@ export default class apikeys extends Vue {
 
   // 获取列表
   getKeysList () {
-    getProjectList({}).then((res: any) => {
+    getProjectList({
+      timeZone: (0 - new Date().getTimezoneOffset() / 60) === 8 ? '8' : '0'
+    }).then((res: any) => {
       if (res.code === '200') {
         this.tableData = []
         for (let i = 0; i < res.data.length; i++) {

+ 3 - 3
src/views/projects/dashboard.vue

@@ -523,7 +523,7 @@ export default class dashBoard extends Vue {
       queryType: this.timeSelected === 4 ? 1 : 0,
       projectId: this.projectValue,
       toolId: this.toolValue,
-      timeZone: 0 - new Date().getTimezoneOffset() / 60
+      timeZone: (0 - new Date().getTimezoneOffset() / 60) === 8 ? '8' : '0'
     }).then((res: any) => {
       if (res.code === '200') {
         this.analysisData = res.data
@@ -545,7 +545,7 @@ export default class dashBoard extends Vue {
       queryType: this.timeSelected === 4 ? 1 : 0,
       projectId: this.projectValue,
       toolId: this.toolValue,
-      timeZone: 0 - new Date().getTimezoneOffset() / 60
+      timeZone: (0 - new Date().getTimezoneOffset() / 60) === 8 ? '8' : '0'
     }).then((res: any) => {
       if (res.code === '200') {
         this.xData = []
@@ -578,7 +578,7 @@ export default class dashBoard extends Vue {
       queryType: this.timeSelected === 4 ? 1 : 0,
       projectId: this.projectValue,
       toolId: this.toolValue,
-      timeZone: 0 - new Date().getTimezoneOffset() / 60
+      timeZone: (0 - new Date().getTimezoneOffset() / 60) === 8 ? '8' : '0'
     }, {
       responseType: 'blob'
     }).then((res: any) => {

+ 115 - 104
src/views/projects/user/webhooks.vue

@@ -3,7 +3,7 @@
     <h1>Webhooks</h1>
     <div class="block">
       <router-view></router-view>
-      <div class="top" v-show="$route.meta.showfather">
+      <div class="top" v-show="showfather">
         <h2>Webhooks
           <el-tooltip class="item" effect="dark" content="Webhooks are reverse APIs that automatically send task or file information to the client you specify when our server updates it in the Webhooks paradigm. You can set up Webhooks to avoid periodic calls to APIs." placement="bottom">
             <img src="@/assets/images/common/info_black.svg" alt="info">
@@ -16,7 +16,7 @@
           </el-button>
         </router-link>
       </div>
-      <div class="keys-table" v-show="$route.meta.showfather">
+      <div class="keys-table" v-show="showfather">
         <el-table :data="tableData" style="width: 100%">
           <el-table-column prop="url" label="URL" min-width="140">
             <template slot-scope="scope">
@@ -77,122 +77,133 @@
   </div>
 </template>
 
-<script>
+<script lang="ts">
+import { Vue, Component, Watch } from 'vue-property-decorator'
 import { getWebhooksList, apiDeleteWebhook } from '@/request/api'
 import Clipboard from 'clipboard'
 import dayjs from 'dayjs'
 
-export default {
-  data () {
-    return {
-      tableData: [],
-      showEye: -1,
-      pageType: '',
-      passItem: {},
-      showTooltip: '',
-      isCopyActive: ''
-    }
-  },
+interface ItableData{
+  id: number,
+  userId: number,
+  projectId: number|null,
+  url: string,
+  secretToken: string,
+  status: number,
+  responseTime: string|null,
+  events: Array<string>
+}
+
+@Component
+export default class webhooks extends Vue {
+  tableData: Array<ItableData> = []
+  showEye = -1
+  pageType = ''
+  passItem = {}
+  showTooltip = ''
+  isCopyActive = ''
+
   created () {
     this.getList()
-  },
-  methods: {
-    // 获取列表
-    getList () {
-      getWebhooksList({}).then(res => {
+  }
+
+  get showfather () {
+    return (this as any).$route.meta.showfather
+  }
+
+  // 获取列表
+  getList () {
+    getWebhooksList({
+      timeZone: (0 - new Date().getTimezoneOffset() / 60) === 8 ? '8' : '0'
+    }).then((res: any) => {
+      if (res.code === '200') {
+        this.tableData = []
+        for (let i = 0; i < res.data.length; i++) {
+          this.tableData.push(res.data[i])
+        }
+      } else {
+        this.$message.error('Failed to connect.')
+      }
+    }).catch(err => {
+      console.log(err)
+      this.$message.error('Failed to connect.')
+    })
+  }
+
+  // 删除
+  handleDelete (index: number, row: any) {
+    this.$confirm('Are you sure you want to delete this information?', {
+      confirmButtonText: 'Delete',
+      cancelButtonText: 'Cancel',
+      customClass: 'message-box-delete'
+    }).then(() => {
+      apiDeleteWebhook(row.id).then((res: any) => {
         if (res.code === '200') {
-          this.tableData = []
-          for (let i = 0; i < res.data.length; i++) {
-            this.tableData.push(res.data[i])
-          }
+          this.$message({
+            type: 'success',
+            message: 'Deleted!'
+          })
+          this.tableData.splice(index, 1)
         } else {
-          this.$message.error('Failed to connect.')
+          this.$message.error('Deleted Failed.')
         }
       }).catch(err => {
         console.log(err)
-        this.$message.error('Failed to connect.')
-      })
-    },
-    // 删除
-    handleDelete (index, row) {
-      this.$confirm('Are you sure you want to delete this information?', {
-        confirmButtonText: 'Delete',
-        cancelButtonText: 'Cancel',
-        customClass: 'message-box-delete'
-      }).then(() => {
-        apiDeleteWebhook(row.id).then(res => {
-          if (res.code === '200') {
-            this.$message({
-              type: 'success',
-              message: 'Deleted!'
-            })
-            this.tableData.splice(index, 1)
-          } else {
-            this.$message.error('Deleted Failed.')
-          }
-        }).catch(err => {
-          console.log(err)
-          this.$message.error('Deleted Failed.')
-        })
-      }).catch(() => {
         this.$message.error('Deleted Failed.')
       })
-    },
-    // 显示小眼睛
-    toggleShowEye (index) {
-      this.showEye = this.showEye === index ? -1 : index
-    },
-    // 切换创建/编辑页
-    changePage (type, item) {
-      this.pageType = type
-      if (type === 'create') {
-        this.passItem = {}
-      } else {
-        this.passItem = item
-      }
-    },
-    // 点击复制input中的内容
-    copy (id) {
-      console.log(id)
-      var clipboard = new Clipboard(id)
-      clipboard.on('success', () => {
-        this.showTooltip = id
-        this.isCopyActive = id
-        setTimeout(() => {
-          this.showTooltip = ''
-          this.isCopyActive = ''
-        }, 1000)
-        clipboard.destroy()
-      })
-      clipboard.on('error', () => {
-        this.$message.error('Copied Failed.')
-        clipboard.destroy()
-      })
-    },
-    // 转换event标签首字母大写
-    changeEventTag (str) {
-      str = str.toLowerCase()
-      const arr = str.split('.')
-      let res = ''
-      for (const i in arr) {
-        res += arr[i].substring(0, 1).toUpperCase() + arr[i].substring(1) + ''
-      }
-      return res
-    },
-    // 日期自定格式
-    formatterDate (row, column) {
-      const val = row[column.property]
-      if (!val) return ''
-      return dayjs(val).format('MMM D,YYYY HH:mm')
-    },
-    // 用*隐藏值
-    formatterKey (key) {
-      let str = ''
-      for (let i = 0; i < key.length; i++) {
-        str += '*'
-      }
-      return str
+    }).catch(() => {
+      this.$message.error('Deleted Failed.')
+    })
+  }
+
+  // 显示小眼睛
+  toggleShowEye (index: number) {
+    this.showEye = this.showEye === index ? -1 : index
+  }
+
+  // 点击复制input中的内容
+  copy (id: string) {
+    var clipboard = new Clipboard(id)
+    clipboard.on('success', () => {
+      this.showTooltip = id
+      this.isCopyActive = id
+      setTimeout(() => {
+        this.showTooltip = ''
+        this.isCopyActive = ''
+      }, 1000)
+      clipboard.destroy()
+    })
+    clipboard.on('error', () => {
+      this.$message.error('Copied Failed.')
+      clipboard.destroy()
+    })
+  }
+
+  // 转换event标签首字母大写
+  changeEventTag (str: string) {
+    str = str.toLowerCase()
+    const arr = str.split('.')
+    let res = ''
+    for (const i in arr) {
+      res += arr[i].substring(0, 1).toUpperCase() + arr[i].substring(1) + ''
+    }
+    return res
+  }
+
+  // 日期自定格式
+  formatterDate (row: any, column: any) {
+    const val = row[column.property]
+    if (!val) return ''
+    return dayjs(val).format('MMM D,YYYY HH:mm')
+  }
+
+  // 用*隐藏值
+  formatterKey (key: string) {
+    let str = ''
+    for (let i = 0; i < key.length; i++) {
+      str += '*'
     }
+    return str
   }
 }
 </script>

BIN
static/images/common/background@2x.png