MyOAuth.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <el-main>
  3. <el-row class="movie-list">
  4. <el-col :md="20" style="padding-right: 5px; padding-left: 5px; padding-bottom: 5px">
  5. <el-card class="box-card">
  6. <div slot="header" class="clearfix">
  7. <span>我的应用</span>
  8. <el-button style="float: right; padding: 3px 0" type="text" @click="addAppDialog">添加</el-button>
  9. </div>
  10. <el-table
  11. :data="dataList"
  12. style="width: 100%"
  13. >
  14. <el-table-column
  15. prop="clientId"
  16. label="客户端 ID"
  17. />
  18. <el-table-column
  19. prop="resourceIds"
  20. label="资源 ID"
  21. />
  22. <el-table-column
  23. prop="scope"
  24. label="作用域"
  25. />
  26. <el-table-column
  27. prop="authorizedGrantTypes"
  28. label="授权类型"
  29. />
  30. <el-table-column
  31. prop="autoapprove "
  32. label="自动授权"
  33. >
  34. <template slot-scope="scope">
  35. <span v-if="scope.row.autoapprove">
  36. </span>
  37. <span v-else>
  38. </span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column
  42. prop="webServerRedirectUri"
  43. label="回调地址"
  44. />
  45. <el-table-column label="操作">
  46. <template slot-scope="scope">
  47. <el-button
  48. size="mini"
  49. @click="handleDetail(scope.$index, scope.row)"
  50. >详情</el-button>
  51. </template>
  52. </el-table-column>
  53. </el-table>
  54. </el-card>
  55. </el-col>
  56. </el-row>
  57. <el-dialog
  58. title="OAuth 应用"
  59. append-to-body
  60. :visible.sync="oauthDialog"
  61. width="30%"
  62. center
  63. >
  64. <el-form ref="form" :model="appForm">
  65. <el-form-item label="应用名">
  66. <el-input v-model="appForm.name" style="margin-left: 5px" />
  67. </el-form-item>
  68. <el-form-item label="主页 URL">
  69. <el-input v-model="appForm.homeUrl" style="margin-left: 5px" />
  70. </el-form-item>
  71. <el-form-item label="应用描述">
  72. <el-input v-model="appForm.description" style="margin-left: 5px" />
  73. </el-form-item>
  74. <el-form-item label="回调 URL">
  75. <el-input v-model="appForm.callbackUrl" style="margin-left: 5px" />
  76. </el-form-item>
  77. <el-form-item>
  78. <el-button
  79. type="primary"
  80. @click="addApp"
  81. >确定</el-button>
  82. </el-form-item>
  83. </el-form>
  84. </el-dialog>
  85. </el-main>
  86. </template>
  87. <script>
  88. import { createApp, getOAuth, getOAuthApps, getToken } from '@/api/account'
  89. export default {
  90. name: 'MyOAuth',
  91. data() {
  92. return {
  93. dataList: [],
  94. oauthDialog: false,
  95. appForm: {
  96. name: ''
  97. }
  98. }
  99. },
  100. created() {
  101. document.title = '我的 OAuth 应用'
  102. getOAuthApps().then(resp => {
  103. if (resp.code === 0) {
  104. this.dataList = resp.data
  105. }
  106. })
  107. },
  108. methods: {
  109. addAppDialog() {
  110. this.oauthDialog = true
  111. },
  112. addApp() {
  113. createApp(this.appForm).then(resp => {
  114. if (resp.code !== 0) {
  115. this.$notify.warning({
  116. message: resp.msg,
  117. type: 'warning',
  118. duration: 3000
  119. })
  120. }
  121. })
  122. this.oauthDialog = false
  123. }
  124. }
  125. }
  126. </script>
  127. <style scoped>
  128. </style>