浏览代码

feat(env): __PLACEHOLDER__ -> __FEATURE__

add __PHONE_NOTE__, __EMAIL__ and adjust some styles
Casper Dai 2 年之前
父节点
当前提交
69c6a5814f
共有 11 个文件被更改,包括 55 次插入12 次删除
  1. 6 2
      .env
  2. 3 0
      .env.fujian
  3. 4 0
      .env.inspur
  4. 4 0
      .env.rc
  5. 4 0
      .env.staging
  6. 3 1
      feature.js
  7. 0 3
      src/app.js
  8. 2 2
      src/constant.js
  9. 14 4
      src/layout/components/Navbar/Profile/index.vue
  10. 6 0
      src/views/device/index.vue
  11. 9 0
      src/views/realm/device/index.vue

+ 6 - 2
.env

@@ -4,12 +4,16 @@ PLATFORM = 'inspur'
 
 LOGGER = 'disabled'
 
-# 未开发的功能组件
-__PLACEHOLDER__ = 'disabled'
+# 预览功能
+__FEATURE__ = 'disabled'
 # 备份设备
 __SUB_DEVICE__ = 'disabled'
 # 设备接管
 __TAKEOVER__ = 'disabled'
+# 短信
+__PHONE_NOTE__ = 'disabled'
+# 邮件
+__EMAIL__ = 'disabled'
 # 微信
 __WECHAT__ = 'disabled'
 # 跳审

+ 3 - 0
.env.fujian

@@ -4,6 +4,9 @@ ENV = 'fujian'
 
 PLATFORM = 'fujian'
 
+# 短信
+__PHONE_NOTE__ = 'enabled'
+
 VUE_APP_NAME = '万福千屏户外安播云平台'
 
 VUE_APP_THUMBNAIL_ORIGIN = 'http://192.168.63.114'

+ 4 - 0
.env.inspur

@@ -2,6 +2,10 @@ NODE_ENV = 'production'
 
 ENV = 'inspur'
 
+# 短信
+__PHONE_NOTE__ = 'enabled'
+# 邮件
+__EMAIL__ = 'enabled'
 # 微信
 __WECHAT__ = 'enabled'
 

+ 4 - 0
.env.rc

@@ -4,6 +4,10 @@ ENV = 'rc'
 
 LOGGER = 'enabled'
 
+# 短信
+__PHONE_NOTE__ = 'enabled'
+# 邮件
+__EMAIL__ = 'enabled'
 # 微信
 __WECHAT__ = 'enabled'
 

+ 4 - 0
.env.staging

@@ -4,6 +4,10 @@ ENV = 'staging'
 
 LOGGER = 'enabled'
 
+# 短信
+__PHONE_NOTE__ = 'enabled'
+# 邮件
+__EMAIL__ = 'enabled'
 # 微信
 __WECHAT__ = 'enabled'
 

+ 3 - 1
feature.js

@@ -21,9 +21,11 @@ module.exports = {
     __VERSION__: JSON.stringify(`v${require('./package.json').version}.${getTimestamp()}`),
     __DEV__: !isProd,
     __STAGING__: isStaging,
-    ...createFeature('__PLACEHOLDER__'),
+    ...createFeature('__FEATURE__'),
     ...createFeature('__SUB_DEVICE__'),
     ...createFeature('__TAKEOVER__'),
+    ...createFeature('__PHONE_NOTE__'),
+    ...createFeature('__EMAIL__'),
     ...createFeature('__WECHAT__'),
     ...createFeature('__JUMP_REVIEW__')
   }

+ 0 - 3
src/app.js

@@ -45,9 +45,6 @@ export default async function startApp (keycloak, auth) {
     throw (err || 'custom reject')
   }
 
-  Vue.prototype.__PLACEHOLDER__ = __PLACEHOLDER__
-  Vue.prototype.__WECHAT__ = __WECHAT__
-
   Vue.prototype.$keycloak = keycloak
   Vue.prototype.$showLoading = showLoading
   Vue.prototype.$closeLoading = closeLoading

+ 2 - 2
src/constant.js

@@ -316,8 +316,8 @@ export const AlarmLevelInfo = {
 }
 
 export const AlarmStrategies = [
-  { key: 'note', label: '短信', support: true },
-  { key: 'email', label: '邮件', support: true },
+  { key: 'note', label: '短信', support: __PHONE_NOTE__ },
+  { key: 'email', label: '邮件', support: __EMAIL__ },
   { key: 'wechat', label: '微信', support: __WECHAT__ },
   { key: 'wechatApplet', label: '小程序', support: __WECHAT__ }
 ]

+ 14 - 4
src/layout/components/Navbar/Profile/index.vue

@@ -59,7 +59,7 @@
       >
         <template v-if="active === 'settings'">
           <user-info-item
-            v-if="user"
+            v-if="user && supportFeature.note"
             key="phone"
             class="c-sibling-item--v"
             type="phone"
@@ -67,7 +67,7 @@
             @update="onChangePhone"
           />
           <user-info-item
-            v-if="user"
+            v-if="user && supportFeature.email"
             key="email"
             class="c-sibling-item--v"
             type="email"
@@ -75,7 +75,7 @@
             @update="onChangeEmail"
           />
           <div
-            v-if="__WECHAT__"
+            v-if="supportFeature.wechat"
             class="l-flex--row center c-sibling-item--v farther"
           >
             <div
@@ -154,7 +154,10 @@ import {
   getWechatQr,
   getAppletQr
 } from '@/api/user'
-import { GATEWAY } from '@/constant'
+import {
+  GATEWAY,
+  SupportedAlarmStrategies
+} from '@/constant'
 import UserInfoItem from './components/UserInfoItem'
 import ResetPassword from './components/ResetPassword'
 
@@ -199,6 +202,13 @@ export default {
       const avatar = this.avatar
       return avatar ? { backgroundImage: `url("${avatar}")` } : null
     },
+    supportFeature () {
+      const map = {}
+      SupportedAlarmStrategies.forEach(({ key, support }) => {
+        map[key] = support
+      })
+      return map
+    },
     phone () {
       return this.getOrCreateAttribute(this.user, 'phone')
     },

+ 6 - 0
src/views/device/index.vue

@@ -31,7 +31,13 @@ export default {
         keepalive: true,
         autoRefreshEachPage: true,
         list: this.getDevicesByQuery,
+        condition: { activate: 1 },
         filters: [
+          { key: 'onlineStatus', type: 'select', placeholder: '在线状态', options: [
+            { value: 1, label: '在线' },
+            { value: 2, label: '离线' },
+            { value: 0, label: '待接入' }
+          ] },
           { key: 'name', type: 'search', placeholder: '设备名称' },
           { type: 'refresh' }
         ],

+ 9 - 0
src/views/realm/device/index.vue

@@ -114,6 +114,15 @@ export default {
         //   'row-click': this.onRowClick
         // },
         filters: [
+          { key: 'activate', type: 'select', placeholder: '激活状态', options: [
+            { value: 1, label: '已激活' },
+            { value: 0, label: '未激活' }
+          ] },
+          { key: 'onlineStatus', type: 'select', placeholder: '在线状态', options: [
+            { value: 1, label: '在线' },
+            { value: 2, label: '离线' },
+            { value: 0, label: '待接入' }
+          ] },
           { key: 'name', type: 'search', placeholder: '设备名称' }
         ],
         buttons: [