From 811957b46844b11328f890b2ee9c700096c7fee8 Mon Sep 17 00:00:00 2001 From: FoskyM Date: Sun, 1 Oct 2023 19:53:59 +0800 Subject: [PATCH] feat(admin): scope page --- js/dist/admin.js | Bin 10435 -> 10721 bytes js/dist/admin.js.map | Bin 31218 -> 32022 bytes js/dist/forum.js | Bin 6563 -> 6643 bytes js/dist/forum.js.map | Bin 21031 -> 21210 bytes js/src/admin/pages/ScopesPage.js | 16 ++++++++++++++-- src/Api/Controller/CreateScopeController.php | 4 +++- 6 files changed, 17 insertions(+), 3 deletions(-) diff --git a/js/dist/admin.js b/js/dist/admin.js index c6c1a95fdd76ad98c5595aa5b9f511ef17889461..567e5fe6c2e417e61a445d06923c0cfa1bbc3e08 100644 GIT binary patch delta 234 zcmX>c_%L__JDYb=YH@yPQF3a0L1IaUZKj5%USdf}QD#zUNvehtilmaJPO4sRYDq?Z z3c5Oo=w>FiJSN8A$%Pyy>=m{pdU+bbo7Zq;bFx-wXlmq7mJ?a9d5=&mBV)y8DUr|Y zT)to>u9`Yolew9vZeAlZlbO+XvICFE<|u{7j0(lc`30#~O2HsXPf5E(uP8AuB|kS9 z=(xOe4GYc5wo1v9cS*@HT1>trHF@$9r9?(Ipg~fb6_n4jFlJ5upgsvG(5&GA06w@+ AWB>pF delta 120 zcmaDDd^m6eJKN@PwoE3*ipd8#OxS~MOZ4(IDmMS&$mV1X*3i_*pPVPMU^9@sLV#4H5l|!~=#oVdYQzdESg=6?35iXYELebqM1c*e)QXw=+{RwCs_Mn_eRt;0 zoS8W@_x zK)vWW73FDBhV3WuSge(;!VN75Re-t#*t)Jy&uo`ZzRHnAynnHpkZ)y*Y_EGe?^wnjM#<6DR^ zK@XOLTc&p>3p)B_K9UCJ(=*q1s{@Znj)+ zu1Le783?ytp32LUArgmXH98oIs#{p1Ev{~30*V5?;%*opV%J-Qd#%^o>JGuDhr7%* zN)@T(fIkjzKhb(hLnm6z!Mv}y|4!SA(l&2IBg^Q9yJp`k?&wUfa9M$I2`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=4q~@Yp`ThmqoSz5DGS2;HBh3bG@b1Ii%f= zQ~iBrgn-AB7nKLhTeHEWW%5wS7?{@DZNzzU!kx}G9Sg_8Wz(*NTIY&fmtBYHHChRu z;Qf3Y9(E%1A$)qLwo{w7%Qp-JmhlSqyBT4Y*mRjEj>_aiN&clG=HcKzdAtOSI#Dst z11q?61`w>91@(BTm`-}bj*g8VMG1DF9~wU-6SSqlo8(PKFIIhY { 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 { ); } - + 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({ diff --git a/src/Api/Controller/CreateScopeController.php b/src/Api/Controller/CreateScopeController.php index e679155..df0ef23 100644 --- a/src/Api/Controller/CreateScopeController.php +++ b/src/Api/Controller/CreateScopeController.php @@ -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'), + ]); } }