2024-05-20 01:18:27 +08:00
|
|
|
import { defineStore } from "pinia";
|
|
|
|
// import $platform from "@/peach/platform";
|
|
|
|
// import $router from '@/peach/router'
|
|
|
|
// import user from "./user";
|
|
|
|
// import sys from "./sys";
|
2024-04-30 17:45:03 +08:00
|
|
|
|
|
|
|
const app = defineStore({
|
2024-05-20 01:18:27 +08:00
|
|
|
id: "app",
|
|
|
|
state: () => ({
|
|
|
|
info: {
|
|
|
|
// 应用信息
|
|
|
|
name: "", // 商城名称
|
|
|
|
logo: "", // logo
|
|
|
|
version: "", // 版本号
|
|
|
|
copyright: "", // 版权信息 I
|
|
|
|
copytime: "", // 版权信息 II
|
2024-04-30 17:45:03 +08:00
|
|
|
|
2024-05-20 01:18:27 +08:00
|
|
|
cdnurl: "", // 云存储域名
|
|
|
|
filesystem: "", // 云存储平台
|
|
|
|
},
|
|
|
|
platform: {
|
|
|
|
share: {
|
|
|
|
methods: [], // 支持的分享方式
|
|
|
|
forwardInfo: {}, // 默认转发信息
|
|
|
|
posterInfo: {}, // 海报信息
|
|
|
|
linkAddress: "", // 复制链接地址
|
|
|
|
},
|
|
|
|
bind_mobile: 0, // 登陆后绑定手机号提醒 (弱提醒,可手动关闭)
|
|
|
|
},
|
|
|
|
chat: {},
|
|
|
|
shareInfo: {}, // 全局分享信息
|
|
|
|
has_wechat_trade_managed: 0, // 小程序发货信息管理 0 没有 || 1 有
|
|
|
|
}),
|
|
|
|
actions: {
|
|
|
|
// 获取应用配置
|
|
|
|
async init() {
|
|
|
|
// 检查网络
|
|
|
|
// const networkStatus = await $platform.checkNetwork();
|
|
|
|
// if (!networkStatus) {
|
|
|
|
// $router.error("NetworkError");
|
|
|
|
// }
|
2024-04-30 17:45:03 +08:00
|
|
|
|
2024-05-20 01:18:27 +08:00
|
|
|
if (true) {
|
|
|
|
this.info = {
|
|
|
|
name: "🍑商城",
|
|
|
|
logo: "https://static.iocoder.cn/ruoyi-vue-pro-logo.png",
|
|
|
|
version: "1.0.0",
|
|
|
|
copyright: "全部开源,个人与企业可 100% 免费使用",
|
|
|
|
copytime: "Copyright© 2018-2024",
|
2024-04-30 17:45:03 +08:00
|
|
|
|
2024-05-20 01:18:27 +08:00
|
|
|
cdnurl: "https://file.sheepjs.com", // 云存储域名
|
|
|
|
filesystem: "qcloud", // 云存储平台
|
|
|
|
};
|
|
|
|
this.platform = {
|
|
|
|
share: {
|
|
|
|
methods: ["poster", "link"],
|
|
|
|
linkAddress: "https://shopro.sheepjs.com/#/",
|
|
|
|
posterInfo: {
|
|
|
|
user_bg: "/static/img/shop/config/user-poster-bg.png",
|
|
|
|
goods_bg: "/static/img/shop/config/goods-poster-bg.png",
|
|
|
|
groupon_bg: "/static/img/shop/config/groupon-poster-bg.png",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
bind_mobile: 0,
|
|
|
|
};
|
|
|
|
this.chat = {
|
|
|
|
chat_domain: "https://api.shopro.sheepjs.com/chat",
|
|
|
|
room_id: "admin",
|
|
|
|
};
|
|
|
|
this.has_wechat_trade_managed = 0;
|
2024-04-30 17:45:03 +08:00
|
|
|
|
2024-05-20 01:18:27 +08:00
|
|
|
// 加载主题
|
|
|
|
const sysStore = sys();
|
|
|
|
sysStore.setTheme();
|
2024-04-30 17:45:03 +08:00
|
|
|
|
2024-05-20 01:18:27 +08:00
|
|
|
// 模拟用户登录
|
|
|
|
const userStore = user();
|
|
|
|
if (userStore.isLogin) {
|
|
|
|
userStore.loginAfter();
|
|
|
|
}
|
|
|
|
return Promise.resolve(true);
|
|
|
|
} else {
|
|
|
|
// $router.error("InitError", res.msg || "加载失败");
|
|
|
|
}
|
2024-04-30 17:45:03 +08:00
|
|
|
},
|
2024-05-20 01:18:27 +08:00
|
|
|
},
|
|
|
|
persist: {
|
|
|
|
enabled: true,
|
|
|
|
strategies: [
|
|
|
|
{
|
|
|
|
key: "app-store",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|
2024-04-30 17:45:03 +08:00
|
|
|
|
2024-05-20 01:18:27 +08:00
|
|
|
export default app;
|