|
@@ -54,9 +54,11 @@
|
|
|
<textarea name="publicKey" title="publicKey" rows="3" class="form-control" readonly
|
|
<textarea name="publicKey" title="publicKey" rows="3" class="form-control" readonly
|
|
|
v-model="appInfo.publicKey"></textarea>
|
|
v-model="appInfo.publicKey"></textarea>
|
|
|
<ul class="help-block x-menu">
|
|
<ul class="help-block x-menu">
|
|
|
- <li>点击<a class="btn-create" href="javascript:void(0)">生成密钥对</a></li>
|
|
|
|
|
|
|
+ <li>点击<a class="btn-create" href="javascript:void(0)" @click="generateSecret()">生成密钥对</a></li>
|
|
|
<li>账户中心只保留公钥用于校验,请将私钥配置到程序中,并妥善保管</li>
|
|
<li>账户中心只保留公钥用于校验,请将私钥配置到程序中,并妥善保管</li>
|
|
|
- <li style="display:none"><a class="btn-download" target="_blank" href="/api/secret/private">下载私钥</a></li>
|
|
|
|
|
|
|
+ <li v-show="canDownload">
|
|
|
|
|
+ <a class="btn-download" target="_blank" href="/api/app/private//download">下载私钥</a>
|
|
|
|
|
+ </li>
|
|
|
</ul>
|
|
</ul>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -207,7 +209,8 @@ export default {
|
|
|
return {
|
|
return {
|
|
|
appVisible: false,
|
|
appVisible: false,
|
|
|
isAdd: true,
|
|
isAdd: true,
|
|
|
- appInfo: {}
|
|
|
|
|
|
|
+ appInfo: {},
|
|
|
|
|
+ canDownload: false
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
@@ -238,9 +241,19 @@ export default {
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
saveAppInfo () {
|
|
saveAppInfo () {
|
|
|
- if (this.appInfo.type === 'control') {
|
|
|
|
|
|
|
+ // Validation
|
|
|
|
|
+ if (!this.appInfo.uid) {
|
|
|
|
|
+ this.showRequiredError({message: '应用唯一标识不能为空'})
|
|
|
|
|
+ return 0
|
|
|
|
|
+ } else if (!this.appInfo.description) {
|
|
|
|
|
+ this.showRequiredError({message: '应用描述不能为空'})
|
|
|
|
|
+ return 0
|
|
|
|
|
+ } else if (this.appInfo.type === 'control' && !this.appInfo.userControl) {
|
|
|
this.appInfo.userControl = this.appInfo.userControl || ' '
|
|
this.appInfo.userControl = this.appInfo.userControl || ' '
|
|
|
|
|
+ this.showRequiredError({message: '级联应用的唯一标识不能为空'})
|
|
|
|
|
+ return 0
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
const appInfo = _.omit(this.appInfo, 'type')
|
|
const appInfo = _.omit(this.appInfo, 'type')
|
|
|
console.log(appInfo)
|
|
console.log(appInfo)
|
|
|
|
|
|
|
@@ -266,6 +279,24 @@ export default {
|
|
|
const error = response => { this.showAddError({ message: response }) }
|
|
const error = response => { this.showAddError({ message: response }) }
|
|
|
|
|
|
|
|
axios.delete(`/api/app/${uid}/deleteApp`).then(success).catch(error)
|
|
axios.delete(`/api/app/${uid}/deleteApp`).then(success).catch(error)
|
|
|
|
|
+ },
|
|
|
|
|
+ generateSecret () {
|
|
|
|
|
+ console.log(1)
|
|
|
|
|
+ const success = (publicKey) => {
|
|
|
|
|
+ console.log(publicKey)
|
|
|
|
|
+ if (publicKey) {
|
|
|
|
|
+ this.canDownload = true
|
|
|
|
|
+ this.appInfo.publicKey = publicKey
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.canDownload = false
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ const error = response => {
|
|
|
|
|
+ this.canDownload = false
|
|
|
|
|
+ this.showAddError({ message: response })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ axios.get('/api/app/secret//generate').then(success).catch(error)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -281,6 +312,10 @@ export default {
|
|
|
title: 'Add Failed',
|
|
title: 'Add Failed',
|
|
|
message: 'Failed to add app info',
|
|
message: 'Failed to add app info',
|
|
|
type: 'error'
|
|
type: 'error'
|
|
|
|
|
+ },
|
|
|
|
|
+ showRequiredError: {
|
|
|
|
|
+ message: 'Required',
|
|
|
|
|
+ type: 'error'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|