Rap 原分销系统代码Web
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

99 linhas
3.4KB

  1. <template>
  2. <el-dialog :visible.sync="dialog" :close-on-click-modal="false" title="七牛云配置" append-to-body width="580px">
  3. <el-form ref="form" :model="form" :rules="rules" style="margin-top: 6px;" size="small" label-width="110px">
  4. <el-form-item label="Access Key" prop="accessKey">
  5. <el-input v-model="form.accessKey" style="width: 95%" placeholder="accessKey,在安全中心,秘钥管理中查看" />
  6. </el-form-item>
  7. <el-form-item label="Secret Key" prop="secretKey">
  8. <el-input v-model="form.secretKey" type="password" style="width: 95%;" placeholder="secretKey,在安全中心,秘钥管理中查看" />
  9. </el-form-item>
  10. <el-form-item label="空间名称" prop="bucket">
  11. <el-input v-model="form.bucket" style="width: 95%;" placeholder="存储空间名称作为唯一的 Bucket 识别符" />
  12. </el-form-item>
  13. <el-form-item label="外链域名" prop="host">
  14. <el-input v-model="form.host" style="width: 95%;" placeholder="外链域名,可自定义,需在七牛云绑定" />
  15. </el-form-item>
  16. <el-form-item label="存储区域">
  17. <el-select v-model="form.zone" placeholder="请选择存储区域">
  18. <el-option
  19. v-for="item in zones"
  20. :key="item"
  21. :label="item"
  22. :value="item"
  23. />
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="空间类型" prop="type">
  27. <el-radio v-model="form.type" label="公开">公开</el-radio>
  28. <el-radio v-model="form.type" label="私有">私有</el-radio>
  29. </el-form-item>
  30. </el-form>
  31. <div slot="footer" class="dialog-footer">
  32. <el-button type="text" @click="dialog = false">取消</el-button>
  33. <el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
  34. </div>
  35. </el-dialog>
  36. </template>
  37. <script>
  38. import { get, update } from '@/api/tools/qiniu'
  39. export default {
  40. data() {
  41. return {
  42. zones: ['华东', '华北', '华南', '北美', '东南亚'], dialog: false,
  43. loading: false, form: { accessKey: '', secretKey: '', bucket: '', host: '', zone: '', type: '' },
  44. rules: {
  45. accessKey: [
  46. { required: true, message: '请输入accessKey', trigger: 'blur' }
  47. ],
  48. secretKey: [
  49. { required: true, message: '请输入secretKey', trigger: 'blur' }
  50. ],
  51. bucket: [
  52. { required: true, message: '请输入空间名称', trigger: 'blur' }
  53. ],
  54. host: [
  55. { required: true, message: '请输入外链域名', trigger: 'blur' }
  56. ],
  57. type: [
  58. { required: true, message: '空间类型不能为空', trigger: 'blur' }
  59. ]
  60. }
  61. }
  62. },
  63. methods: {
  64. init() {
  65. get().then(res => {
  66. this.form = res
  67. })
  68. },
  69. doSubmit() {
  70. this.$refs['form'].validate((valid) => {
  71. if (valid) {
  72. this.loading = true
  73. update(this.form).then(res => {
  74. this.$notify({
  75. title: '修改成功',
  76. type: 'success',
  77. duration: 2500
  78. })
  79. this.$parent.crud.toQuery()
  80. this.loading = false
  81. this.dialog = false
  82. }).catch(err => {
  83. this.loading = false
  84. console.log(err.response.data.message)
  85. })
  86. } else {
  87. return false
  88. }
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style scoped>
  95. </style>