43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
/**
|
|
* 二维码状态管理
|
|
*/
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
qrCodeUrl: null,
|
|
qrCodeOosUrl: null,
|
|
qrCodeCountdown: 0,
|
|
qrCodeCountdownActive: false,
|
|
qrCodeRefreshCount: 0,
|
|
qrCodeExpired: false
|
|
},
|
|
mutations: {
|
|
SET_QR_CODE_URL(state, { url, oosUrl }) {
|
|
state.qrCodeUrl = url;
|
|
state.qrCodeOosUrl = oosUrl || null;
|
|
},
|
|
SET_QR_CODE_COUNTDOWN(state, { countdown, isActive, refreshCount, isExpired }) {
|
|
state.qrCodeCountdown = countdown || 0;
|
|
state.qrCodeCountdownActive = isActive || false;
|
|
state.qrCodeRefreshCount = refreshCount || 0;
|
|
state.qrCodeExpired = isExpired || false;
|
|
},
|
|
CLEAR_QR_CODE(state) {
|
|
state.qrCodeUrl = null;
|
|
state.qrCodeOosUrl = null;
|
|
}
|
|
},
|
|
actions: {
|
|
setQrCode({ commit }, { url, oosUrl }) {
|
|
commit('SET_QR_CODE_URL', { url, oosUrl });
|
|
},
|
|
setQrCodeCountdown({ commit }, data) {
|
|
commit('SET_QR_CODE_COUNTDOWN', data);
|
|
},
|
|
clearQrCode({ commit }) {
|
|
commit('CLEAR_QR_CODE');
|
|
}
|
|
}
|
|
};
|
|
|