Merge branch 'master' of https://git.code.tencent.com/beijing-rtss-test/bj-rtss-client
This commit is contained in:
commit
a47a0730ea
@ -16,7 +16,7 @@ export async function createSimulation(data: { mapId: number }) {
|
||||
* @param simulationId 仿真id
|
||||
*/
|
||||
export async function destroySimulation(data: { simulationId: string }) {
|
||||
const response = await api.post(`${UriBase}/destroy`, data);
|
||||
const response = await api.post(`${UriBase}/destroy/${data.simulationId}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
|
@ -42,12 +42,18 @@ interface LoginInfo {
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface LoginRes {
|
||||
code: number;
|
||||
expire: string;
|
||||
token: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* @param loginInfo
|
||||
* @returns
|
||||
*/
|
||||
export async function login(loginInfo: LoginInfo): Promise<string> {
|
||||
export async function login(loginInfo: LoginInfo): Promise<LoginRes> {
|
||||
const info = { ...loginInfo, password: encryptPassword(loginInfo.password) };
|
||||
const response = await api.post(`${UserUriBase}/login`, info);
|
||||
return response.data.token;
|
||||
|
@ -11,3 +11,11 @@ export function getJwtToken(): string | null {
|
||||
export function clearJwtToken(): void {
|
||||
sessionStorage.removeItem(JwtTokenKey);
|
||||
}
|
||||
|
||||
export function getOnlyToken(): string | null {
|
||||
// 去除token前的Bearer
|
||||
let t = sessionStorage.getItem(JwtTokenKey);
|
||||
const Rxg = /^Bearer /;
|
||||
t = t ? t.replace(Rxg, '') : '';
|
||||
return t;
|
||||
}
|
||||
|
@ -4,7 +4,8 @@ function getHost(): string {
|
||||
// return '192.168.3.37:9091';
|
||||
// return '192.168.3.15:9091';
|
||||
// return '192.168.3.5:9091';
|
||||
return '192.168.3.233:9091';
|
||||
return '192.168.3.37:9091';
|
||||
// return '192.168.3.233:9091';
|
||||
// return 'test.joylink.club/bjrtss-server';
|
||||
}
|
||||
|
||||
@ -15,7 +16,8 @@ export function getHttpBase() {
|
||||
|
||||
export function getWebsocketUrl() {
|
||||
const host = '192.168.3.233';
|
||||
const port = 8000;
|
||||
// return `ws://${host}/ws-bj`;
|
||||
return `ws://${host}/connection/websocket`;
|
||||
return `ws://${host}:${port}/connection/websocket`;
|
||||
// return `wss://${getHost()}/ws-bj`;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ import { graphicData } from 'src/protos/stationLayoutGraphics';
|
||||
import { useLineStore } from 'src/stores/line-store';
|
||||
import { toUint8Array } from 'js-base64';
|
||||
import { getWebsocketUrl } from 'src/configs/UrlManage';
|
||||
import { getJwtToken } from 'src/configs/TokenManage';
|
||||
import { getOnlyToken } from 'src/configs/TokenManage';
|
||||
import { state } from 'src/protos/device_state';
|
||||
import {
|
||||
AxleCounting,
|
||||
@ -311,11 +311,12 @@ export async function loadLineDatas(app: GraphicApp) {
|
||||
app.enableWsMassaging({
|
||||
engine: ClientEngine.Centrifugo,
|
||||
wsUrl: `${getWebsocketUrl()}`,
|
||||
token: getJwtToken() as string,
|
||||
token: getOnlyToken() as string,
|
||||
});
|
||||
|
||||
app.subscribe({
|
||||
destination: `/simulation/${simulationId}/devices/status`,
|
||||
// destination: `/simulation/${simulationId}/devices/status`,
|
||||
destination: `simulation-${simulationId}-devices-status`,
|
||||
messageConverter: (message: Uint8Array) => {
|
||||
const states: GraphicState[] = [];
|
||||
const storage = state.PushedDevicesStatus.deserialize(message);
|
||||
|
@ -195,7 +195,7 @@
|
||||
<q-input
|
||||
outlined
|
||||
label="草稿名称"
|
||||
v-model.number="saveAsName"
|
||||
v-model="saveAsName"
|
||||
:rules="[(val) => val.trim() != '' || '草稿名称不能为空']"
|
||||
/>
|
||||
</q-card-section>
|
||||
|
@ -209,15 +209,15 @@ const columnDefs: QTableColumn[] = [
|
||||
// align: 'center',
|
||||
// },
|
||||
{
|
||||
name: 'createdAt',
|
||||
name: 'created_at',
|
||||
label: '创建时间',
|
||||
field: 'createdAt',
|
||||
field: 'created_at',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'updateAt',
|
||||
name: 'update_at',
|
||||
label: '更新时间',
|
||||
field: 'updateAt',
|
||||
field: 'update_at',
|
||||
align: 'center',
|
||||
},
|
||||
{ name: 'operations', label: '操作', field: 'operations', align: 'center' },
|
||||
|
@ -80,9 +80,9 @@ const columnDefs: QTableColumn[] = [
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
name: 'publishAt',
|
||||
name: 'publish_at',
|
||||
label: '发布时间',
|
||||
field: 'publishAt',
|
||||
field: 'publish_at',
|
||||
align: 'center',
|
||||
},
|
||||
{ name: 'operations', label: '操作', field: 'operations', align: 'center' },
|
||||
|
@ -70,7 +70,7 @@ const loginInfo = reactive({
|
||||
async function doLogin() {
|
||||
try {
|
||||
clearJwtToken();
|
||||
const token = await login(loginInfo);
|
||||
const { token } = await login(loginInfo);
|
||||
saveJwtToken(token);
|
||||
router.push({ name: 'home' });
|
||||
} catch (err) {
|
||||
|
@ -105,9 +105,9 @@ const columnDefs: QTableColumn[] = [
|
||||
},
|
||||
{ name: 'id', label: '用户ID', field: 'id', align: 'center' },
|
||||
{
|
||||
name: 'registerTime',
|
||||
name: 'register_time',
|
||||
label: '创建时间',
|
||||
field: 'registerTime',
|
||||
field: 'register_time',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
@ -116,7 +116,7 @@ const columnDefs: QTableColumn[] = [
|
||||
field: 'mobile',
|
||||
align: 'center',
|
||||
},
|
||||
{ name: 'operations', label: '操作', field: 'operations', align: 'center' },
|
||||
// { name: 'operations', label: '操作', field: 'operations', align: 'center' },
|
||||
];
|
||||
|
||||
const operateDisabled = ref(false);
|
||||
|
Loading…
Reference in New Issue
Block a user