first commit

This commit is contained in:
sexygoat
2026-04-11 14:42:14 +08:00
commit b962c9c716
62 changed files with 7323 additions and 0 deletions

35
store/asset.js Normal file
View File

@@ -0,0 +1,35 @@
import { reactive, ref } from 'vue';
const state = reactive({
assetInfo: null,
deviceRealtime: null,
currentPackage: null
});
export const useAssetStore = () => {
const setAssetInfo = (info) => {
state.assetInfo = info;
};
const setDeviceRealtime = (realtime) => {
state.deviceRealtime = realtime;
};
const setCurrentPackage = (pkg) => {
state.currentPackage = pkg;
};
const clearAsset = () => {
state.assetInfo = null;
state.deviceRealtime = null;
state.currentPackage = null;
};
return {
state,
setAssetInfo,
setDeviceRealtime,
setCurrentPackage,
clearAsset
};
};

2
store/index.js Normal file
View File

@@ -0,0 +1,2 @@
export { useUserStore } from './user.js';
export { useAssetStore } from './asset.js';

50
store/user.js Normal file
View File

@@ -0,0 +1,50 @@
import { reactive, ref } from 'vue';
const state = reactive({
token: uni.getStorageSync('token') || '',
assetToken: '',
identifier: uni.getStorageSync('identifier') || '',
isDevice: false,
realNameStatus: 0
});
export const useUserStore = () => {
const setToken = (token) => {
state.token = token;
uni.setStorageSync('token', token);
};
const setAssetToken = (assetToken) => {
state.assetToken = assetToken;
};
const setIdentifier = (identifier) => {
state.identifier = identifier;
uni.setStorageSync('identifier', identifier);
};
const setIsDevice = (isDevice) => {
state.isDevice = isDevice;
};
const setRealNameStatus = (status) => {
state.realNameStatus = status;
};
const clearUser = () => {
state.token = '';
state.assetToken = '';
uni.removeStorageSync('token');
uni.removeStorageSync('identifier');
};
return {
state,
setToken,
setAssetToken,
setIdentifier,
setIsDevice,
setRealNameStatus,
clearUser
};
};