Просмотр исходного кода

refactor(dialog): confirm dialog style

Casper Dai 3 лет назад
Родитель
Сommit
f0183cddcb

+ 1 - 1
src/api/base.js

@@ -96,7 +96,7 @@ export function messageSend (config, message, service = request) {
 }
 
 export function confirm (message) {
-  return MessageBox.confirm(message)
+  return MessageBox.confirm(message, { type: 'warning' })
 }
 
 export function confirmAndSend (type, tip, config, service = request) {

+ 5 - 1
src/components/Schedule/mixins/event.js

@@ -21,7 +21,10 @@ export default {
   },
   methods: {
     onRemove (eventProxy) {
-      this.$confirm(`移除 ${eventProxy.origin.target.name} ?`).then(() => {
+      this.$confirm(
+        `移除 ${eventProxy.origin.target.name} ?`,
+        { type: 'warning' }
+      ).then(() => {
         this.removeEventProxy(eventProxy)
         this.correct()
       })
@@ -162,6 +165,7 @@ export default {
         return this.$confirm(
           '存在过期或将要过期(<=60s)节目,是否移除?',
           {
+            type: 'warning',
             distinguishCancelAndClose: true,
             confirmButtonText: '移除',
             cancelButtonText: '保留'

+ 2 - 1
src/utils/upload.js

@@ -113,7 +113,8 @@ function analyzeByWorker (obj) {
             if (videoTrack && videoTrack.Format !== 'AVC') {
               return MessageBox.confirm(
                 `视频 ${obj.name} 非H264编码将无法预览`,
-                '继续上传'
+                '继续上传',
+                { type: 'warning' }
               ).then(resolve, reject)
             }
           }

+ 4 - 1
src/views/device/detail/components/DeviceInvoke/DeviceReboot.vue

@@ -40,7 +40,10 @@ export default {
         })
         return
       }
-      this.$confirm(`重启 ${this.device.name} ?`).then(() => {
+      this.$confirm(
+        `重启 ${this.device.name} ?`,
+        { type: 'warning' }
+      ).then(() => {
         send('/restart/ask').then(
           () => {
             this.rebooting = true

+ 4 - 1
src/views/device/detail/components/DeviceInvoke/DeviceRestore.vue

@@ -24,7 +24,10 @@ export default {
         })
         return
       }
-      this.$confirm(`将 ${this.device.name} 恢复出厂?`).then(() => {
+      this.$confirm(
+        `将 ${this.device.name} 恢复出厂?`,
+        { type: 'warning' }
+      ).then(() => {
         send('/restore/ask').catch(() => {
           this.$message({
             type: 'warning',

+ 8 - 2
src/views/device/detail/components/DeviceInvoke/ScreenNetwork/index.vue

@@ -154,7 +154,10 @@ export default {
           })
         }
       }
-      this.$confirm('将有线网络设置为配置内容?').then(() => {
+      this.$confirm(
+        '将有线网络设置为配置内容?',
+        { type: 'warning' }
+      ).then(() => {
         done()
         this.sendTopic('wiredNetwork', inputs)
       })
@@ -181,7 +184,10 @@ export default {
           value: JSON.stringify({ status: -1 })
         })
       }
-      this.$confirm('将无线网络设置为配置内容?').then(() => {
+      this.$confirm(
+        '将无线网络设置为配置内容?',
+        { type: 'warning' }
+      ).then(() => {
         done()
         this.sendTopic('wirelessFidelity', inputs)
       })

+ 4 - 1
src/views/device/detail/components/DeviceInvoke/mixins/simple-task.js

@@ -28,7 +28,10 @@ export default {
       this.show = true
     },
     onInvoke () {
-      this.$confirm(`将${this.type}设置为${this.taskValue}%?`).then(() => {
+      this.$confirm(
+        `将${this.type}设置为${this.taskValue}%?`,
+        { type: 'warning' }
+      ).then(() => {
         this.sendTopic(this.functionKey, this.createProps(this.taskValue))
       })
     },

+ 4 - 1
src/views/device/detail/components/DeviceInvoke/mixins/switch-task.js

@@ -39,7 +39,10 @@ export default {
       this.show = true
     },
     onSwitch (open) {
-      this.$confirm(`立即${open ? '开机' : '关机'}?`).then(() => {
+      this.$confirm(
+        `立即${open ? '开机' : '关机'}?`,
+        { type: 'warning' }
+      ).then(() => {
         this.sendTopic(open ? 'bootDevice' : 'shutdownDevice')
       })
     }

+ 4 - 1
src/views/device/index.vue

@@ -202,7 +202,10 @@ export default {
       this.$refs.eventTargetDialog.show()
     },
     onChoosen ({ value, done }) {
-      this.$confirm(`将设备 ${this.$device.name} 的默认播放设置为 ${value.name} ?`).then(() => {
+      this.$confirm(
+        `将设备 ${this.$device.name} 的默认播放设置为 ${value.name} ?`,
+        { type: 'warning' }
+      ).then(() => {
         return publish(
           [this.$device.id],
           {

+ 2 - 1
src/views/platform/profile/index.vue

@@ -268,7 +268,8 @@ export default {
       if (this.wechat) {
         this.$confirm(
           '解除绑定后将无法再收到消息推送',
-          '解绑微信'
+          '解绑微信',
+          { type: 'warning' }
         ).then(() => {
           this.changeAttribute('wechat', this.wechat = '', '解绑微信')
         })

+ 16 - 4
src/views/realm/user/Settings.vue

@@ -264,19 +264,28 @@ export default {
       })
     },
     onResetPassword () {
-      this.$confirm(`将${this.user.username}的密码重置为默认密码?`).then(() => {
+      this.$confirm(
+        `将${this.user.username}的密码重置为默认密码?`,
+        { type: 'warning' }
+      ).then(() => {
         resetPassword(this.user)
       })
     },
     onResetOTP () {
-      this.$confirm(`将${this.user.username}当前绑定的OTP重置?`).then(() => {
+      this.$confirm(
+        `将${this.user.username}当前绑定的OTP重置?`,
+        { type: 'warning' }
+      ).then(() => {
         deleteUserCredentials(this.user.id, this.credentials.otp.id).then(() => {
           this.credentials.otp = null
         })
       })
     },
     onDel () {
-      this.$confirm(`注销账号${this.user.username}?`).then(() => {
+      this.$confirm(
+        `注销账号${this.user.username}?`,
+        { type: 'warning' }
+      ).then(() => {
         const loading = this.$showLoading()
         unbindDevices(`${this.group.path}/${this.user.id}`).then(() => {
           return deleteUser(this.user).then(() => {
@@ -327,7 +336,10 @@ export default {
         })
         return
       }
-      this.$confirm(`将${this.user.username}移动至${this.$group.label}?`).then(() => {
+      this.$confirm(
+        `将${this.user.username}移动至${this.$group.label}?`,
+        { type: 'warning' }
+      ).then(() => {
         const loading = this.$showLoading()
         updateBindDevices(`${this.$group.path}/${this.user.id}`, `${this.group.path}/${this.user.id}`).then(() => {
           moveUserGroup(this.user.id, this.group, this.$group).then(() => {

+ 2 - 1
src/views/schedule/deploy/index.vue

@@ -370,7 +370,8 @@ export default {
       const devices = this.selectedDevices
       this.$confirm(
         `对设备 ${devices.map(device => device.name)}`,
-        `发布 ${this.typeMsg} ${this.eventTarget.name}`
+        `发布 ${this.typeMsg} ${this.eventTarget.name}`,
+        { type: 'warning' }
       ).then(() => {
         return publish(
           devices.map((device) => device.id),