Skip to content

Commit e0d6724

Browse files
committed
实现单独指定数据库账号及密码;解决登录、退出登录接口调用报错
1 parent 1b3046a commit e0d6724

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

js/main.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3198,6 +3198,7 @@
31983198

31993199
const req = {
32003200
type: 0, // 登录方式,非必须 0-密码 1-验证码
3201+
asDBAccount: ! isAdminOperation, // 直接 /execute 接口传 account, password
32013202
phone: this.account,
32023203
password: this.password,
32033204
version: 1, // 全局默认版本号,非必须
@@ -3267,10 +3268,10 @@
32673268
// this.showUrl(isAdminOperation, '/login')
32683269

32693270
// vInput.value = JSON.stringify(req, null, ' ')
3270-
this.type = REQUEST_TYPE_JSON
3271-
this.showTestCase(false, this.isLocalShow)
3272-
this.onChange(false)
3273-
this.send(isAdminOperation, function (url, res, err) {
3271+
// this.type = REQUEST_TYPE_JSON
3272+
// this.showTestCase(false, this.isLocalShow)
3273+
// this.onChange(false)
3274+
this.request(isAdminOperation, REQUEST_TYPE_JSON, this.server + '/login', req, {},function (url, res, err) {
32743275
if (callback) {
32753276
callback(url, res, err)
32763277
return
@@ -3401,11 +3402,11 @@
34013402
}
34023403
else {
34033404
this.showUrl(isAdminOperation, '/logout')
3404-
vInput.value = JSON.stringify(req, null, ' ')
3405-
this.type = REQUEST_TYPE_JSON
3405+
// vInput.value = JSON.stringify(req, null, ' ')
3406+
// this.type = REQUEST_TYPE_JSON
34063407
this.showTestCase(false, this.isLocalShow)
34073408
this.onChange(false)
3408-
this.send(isAdminOperation, callback)
3409+
this.request(isAdminOperation, REQUEST_TYPE_JSON, this.server + '/logout', req, {}, callback)
34093410
}
34103411
},
34113412

@@ -3867,6 +3868,19 @@
38673868
header['Apijson-Delegate-Id'] = this.delegateId
38683869
}
38693870

3871+
var curUser = isAdminOperation ? null : this.getCurrentAccount()
3872+
if (curUser != null) {
3873+
if (req == null) {
3874+
req = {}
3875+
}
3876+
if (req.account == null) {
3877+
req.account = curUser.phone
3878+
}
3879+
if (req.password == null) {
3880+
req.password = curUser.password
3881+
}
3882+
}
3883+
38703884
// axios.defaults.withcredentials = true
38713885
axios({
38723886
method: (type == REQUEST_TYPE_PARAM ? 'get' : 'post'),

0 commit comments

Comments
 (0)