feat(admin): scope page
This commit is contained in:
parent
8bf8ab40ab
commit
811957b468
6 changed files with 17 additions and 3 deletions
BIN
js/dist/admin.js
generated
vendored
BIN
js/dist/admin.js
generated
vendored
Binary file not shown.
BIN
js/dist/admin.js.map
generated
vendored
BIN
js/dist/admin.js.map
generated
vendored
Binary file not shown.
BIN
js/dist/forum.js
generated
vendored
BIN
js/dist/forum.js
generated
vendored
Binary file not shown.
BIN
js/dist/forum.js.map
generated
vendored
BIN
js/dist/forum.js.map
generated
vendored
Binary file not shown.
|
@ -82,7 +82,9 @@ export default class ScopesPage extends Page {
|
|||
className: 'Button Button--block',
|
||||
onclick: () => {
|
||||
const scope = app.store.createRecord('oauth-scopes');
|
||||
scope.save({}).then(this.scopes.push(scope));
|
||||
scope.save({
|
||||
'scope': 'Scope.' + this.randomString(8),
|
||||
}).then(this.scopes.push(scope));
|
||||
},
|
||||
}, app.translator.trans(this.translationPrefix + 'add_button')))),
|
||||
]),
|
||||
|
@ -92,7 +94,17 @@ export default class ScopesPage extends Page {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
randomString(len) {
|
||||
len = len || 8;
|
||||
let $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||||
let maxPos = $chars.length;
|
||||
let str = '';
|
||||
for (let i = 0; i < len; i++) {
|
||||
//0~32的整数
|
||||
str += $chars.charAt(Math.floor(Math.random() * (maxPos + 1)));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
saveScopeInfo(index, key, value) {
|
||||
console.log(index, key, value);
|
||||
this.scopes[index].save({
|
||||
|
|
|
@ -20,6 +20,8 @@ class CreateScopeController extends AbstractListController
|
|||
|
||||
$attributes = Arr::get($request->getParsedBody(), 'data.attributes');
|
||||
|
||||
return Scope::create([]);
|
||||
return Scope::create([
|
||||
'scope' => Arr::get($attributes, 'scope'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue