try {
// http.post 调用 updatelogin 方法 http.get 调用 login 方法 const { data: res } = await this.$http.post('/TSM/login/', { _parameters: [this.loginForm.username, this.loginForm.password] });
// http.post http.get 都调用 login 方法 // const {data: res} = await this.$http.post( // `/TSM/login/${this.loginForm.username}/${this.loginForm.password}`); if(res.result[0].ret) return this.$message.success('登录成功'); this.$message.error('登录失败'); } catch (e) { this.$message.error(e.message); }
function TSM.login(UserName, Password: string): TJSONObject; begin Result := TJSONObject.Create; if (UserName='admin') and (Password='123456') then begin Result.AddPair('ret', TJSONTrue.Create); end else begin Result.AddPair('ret', TJSONFalse.Create); end; end; function TSM.updatelogin(UserName, Password: string): TJSONObject; begin Result := TJSONObject.Create; if (UserName='admin') and (Password='123456') then begin Result.AddPair('ret', TJSONTrue.Create); end else begin Result.AddPair('ret', TJSONFalse.Create); end; end;