q-koa 10.6.3 → 10.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
name: '后台导航',
|
|
3
|
+
belongs: 'auth',
|
|
4
|
+
multiple: false,
|
|
5
|
+
availableSort: true,
|
|
6
|
+
order: [],
|
|
7
|
+
select: [],
|
|
8
|
+
excludes: [],
|
|
9
|
+
limit: 40,
|
|
10
|
+
defaultOrder: [{ sort: 'ascending', type: 'sortOrder' }],
|
|
11
|
+
comment: {},
|
|
12
|
+
sortOrder: 1,
|
|
13
|
+
reference: [],
|
|
14
|
+
excludeAuth: [],
|
|
15
|
+
initList: [],
|
|
16
|
+
personal: [{ key: 'init_routes', name: '初始化', width: 200, common: true }],
|
|
17
|
+
}
|
|
@@ -129,6 +129,25 @@ exports.extra = {
|
|
|
129
129
|
is_mock: false,
|
|
130
130
|
defaultValue: {},
|
|
131
131
|
sortOrder: 9,
|
|
132
|
+
set: function (value) {
|
|
133
|
+
try {
|
|
134
|
+
const dataValue = typeof value === 'object' ? value : JSON.parse(value)
|
|
135
|
+
this.setDataValue('extra', dataValue)
|
|
136
|
+
console.log(dataValue)
|
|
137
|
+
} catch {
|
|
138
|
+
throw new Error('extra值不合法')
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
get: function () {
|
|
142
|
+
try {
|
|
143
|
+
const value = this.getDataValue('extra')
|
|
144
|
+
const dataValue =
|
|
145
|
+
typeof value === 'object' ? value || {} : JSON.parse(value)
|
|
146
|
+
return dataValue
|
|
147
|
+
} catch {
|
|
148
|
+
return {}
|
|
149
|
+
}
|
|
150
|
+
},
|
|
132
151
|
extra: {
|
|
133
152
|
type: 'json-editor',
|
|
134
153
|
},
|
|
@@ -248,6 +248,11 @@ exports.initData = async ({ includes, excludes, app, ctx }) => {
|
|
|
248
248
|
[item]: app.cache.get(`${model}`),
|
|
249
249
|
})
|
|
250
250
|
}
|
|
251
|
+
if (!app.model[model] || !app.model[model][fn]) {
|
|
252
|
+
return Promise.resolve({
|
|
253
|
+
[item]: [],
|
|
254
|
+
})
|
|
255
|
+
}
|
|
251
256
|
return app.model[model][fn]({
|
|
252
257
|
include: app.include[model],
|
|
253
258
|
...(app.config[model] ? app.config[model].autoData : {}),
|
|
@@ -143,17 +143,13 @@ exports.login = async (ctx) => {
|
|
|
143
143
|
),
|
|
144
144
|
}
|
|
145
145
|
result = await app.model.user.findOne({
|
|
146
|
-
where
|
|
147
|
-
id: result.id,
|
|
148
|
-
},
|
|
146
|
+
where,
|
|
149
147
|
attributes,
|
|
150
148
|
include,
|
|
151
149
|
})
|
|
152
150
|
} else {
|
|
153
151
|
result = await app.model.user.findOne({
|
|
154
|
-
where
|
|
155
|
-
id: result.id,
|
|
156
|
-
},
|
|
152
|
+
where,
|
|
157
153
|
include: includeDefault,
|
|
158
154
|
})
|
|
159
155
|
}
|