You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
450 lines
9.0 KiB
450 lines
9.0 KiB
"use strict";
|
|
const common_vendor = require("../common/vendor.js");
|
|
const stores_user = require("../stores/user.js");
|
|
const utils_cache = require("../utils/cache.js");
|
|
const enums_constantEnums = require("../enums/constantEnums.js");
|
|
const routes = [
|
|
{
|
|
"path": "/pages/index/index",
|
|
"aliasPath": "/",
|
|
"meta": {
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "首页",
|
|
"enablePullDownRefresh": false
|
|
}
|
|
},
|
|
{
|
|
"path": "/pages/ai_creation/ai_creation",
|
|
"meta": {
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "AI创作",
|
|
"enablePullDownRefresh": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/pages/skills/skills",
|
|
"meta": {
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "技能大全",
|
|
"disableScroll": true,
|
|
"enablePullDownRefresh": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/pages/app/app",
|
|
"meta": {
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "应用",
|
|
"enablePullDownRefresh": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/pages/empty/empty"
|
|
},
|
|
{
|
|
"path": "/pages/user/user",
|
|
"meta": {
|
|
"isTab": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "个人中心",
|
|
"navigationStyle": "custom",
|
|
"enablePullDownRefresh": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/pages/webview/webview"
|
|
},
|
|
{
|
|
"path": "/pages/login/login",
|
|
"meta": {
|
|
"white": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "登录"
|
|
}
|
|
},
|
|
{
|
|
"path": "/pages/pc_login/pc_login",
|
|
"meta": {
|
|
"white": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "扫码登录"
|
|
}
|
|
},
|
|
{
|
|
"path": "/uni_modules/vk-uview-ui/components/u-avatar-cropper/u-avatar-cropper",
|
|
"style": {
|
|
"navigationBarTitleText": "头像裁剪",
|
|
"navigationBarBackgroundColor": "#000000"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/square/square",
|
|
"meta": {
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "绘画广场"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/drawing/drawing",
|
|
"meta": {
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "AI绘图",
|
|
"enablePullDownRefresh": false,
|
|
"disableScroll": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/customer_service/customer_service",
|
|
"style": {
|
|
"navigationBarTitleText": "联系客服",
|
|
"enablePullDownRefresh": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/user_set/user_set",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "用户设置"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/follow_official/follow_official",
|
|
"style": {
|
|
"navigationBarTitleText": "关注公众号"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/task_center/task_center",
|
|
"meta": {
|
|
"auth": true,
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "任务中心",
|
|
"enablePullDownRefresh": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/collection/collection",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "我的收藏"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/chat/chat",
|
|
"meta": {
|
|
"auth": true,
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "",
|
|
"enablePullDownRefresh": false
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/as_us/as_us",
|
|
"style": {
|
|
"navigationBarTitleText": "关于我们"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/agreement/agreement",
|
|
"style": {
|
|
"navigationBarTitleText": "协议"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/404/404",
|
|
"name": "404",
|
|
"meta": {
|
|
"white": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "404"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/register/register",
|
|
"meta": {
|
|
"white": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "注册"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/change_password/change_password",
|
|
"meta": {
|
|
"white": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "修改密码"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/forget_pwd/forget_pwd",
|
|
"meta": {
|
|
"white": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "忘记密码"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/open_vip/open_vip",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "开通会员",
|
|
"navigationStyle": "custom"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/feedback/feedback",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "意见反馈"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/promotion_center/promotion_center",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "推广中心",
|
|
"enablePullDownRefresh": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/withdraw/withdraw",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "收益提现"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/withdraw_record/withdraw_record",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "提现记录"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/distribution_order/distribution_order",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "分销订单"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/earnings_detail/earnings_detail",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "佣金明细"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/team_fans/team_fans",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "团队粉丝"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/enlarge_user/enlarge_user",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "推广的用户"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/invite_poster/invite_poster",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "邀请海报",
|
|
"enablePullDownRefresh": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/cancelaccount/cancelaccount",
|
|
"meta": {
|
|
"auth": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "注销账号"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/article_list/article_list",
|
|
"meta": {
|
|
"auth": false,
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "资讯"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/article_detail/article_detail",
|
|
"meta": {
|
|
"auth": true,
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "资讯详情"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/create/create",
|
|
"meta": {
|
|
"auth": true,
|
|
"share": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "创作"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/create_history/create_history",
|
|
"meta": {
|
|
"auth": true,
|
|
"share": false
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "创作历史"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/recharge/recharge",
|
|
"meta": {
|
|
"auth": true,
|
|
"share": false
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "充值中心",
|
|
"enablePullDownRefresh": true
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/redeem_code/redeem_code",
|
|
"meta": {
|
|
"auth": true,
|
|
"share": false
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "卡密兑换"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/mind_map/mind_map",
|
|
"meta": {
|
|
"share": false
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "思维导图"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/mind_map/webview",
|
|
"meta": {
|
|
"share": false,
|
|
"webview": true
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "思维导图"
|
|
}
|
|
},
|
|
{
|
|
"path": "/packages/pages/qrcode/qrcode",
|
|
"meta": {
|
|
"share": false,
|
|
"auth": false
|
|
},
|
|
"style": {
|
|
"navigationBarTitleText": "艺术二维码"
|
|
}
|
|
}
|
|
];
|
|
const router = common_vendor.createRouter({
|
|
routes: [
|
|
...routes,
|
|
{
|
|
path: "*",
|
|
redirect() {
|
|
return {
|
|
name: "404"
|
|
};
|
|
}
|
|
}
|
|
],
|
|
debug: true,
|
|
//@ts-ignore
|
|
platform: "mp-weixin",
|
|
h5: {}
|
|
});
|
|
let isFirstEach = true;
|
|
router.beforeEach(async (to, from) => {
|
|
if (isFirstEach) {
|
|
const userStore = stores_user.useUserStore();
|
|
if (!userStore.isLogin && !to.meta.white) {
|
|
utils_cache.cache.set(enums_constantEnums.BACK_URL, to.fullPath);
|
|
}
|
|
isFirstEach = false;
|
|
}
|
|
});
|
|
router.afterEach((to, from) => {
|
|
const userStore = stores_user.useUserStore();
|
|
if (!userStore.isLogin && !to.meta.white) {
|
|
utils_cache.cache.set(enums_constantEnums.BACK_URL, to.fullPath);
|
|
}
|
|
});
|
|
router.beforeEach(async (to, from) => {
|
|
var _a, _b, _c;
|
|
const userStore = stores_user.useUserStore();
|
|
if (((_a = to.query) == null ? void 0 : _a.token) || ((_b = to.query) == null ? void 0 : _b.is_web_view)) {
|
|
userStore.token = ((_c = to.query) == null ? void 0 : _c.token) || null;
|
|
}
|
|
console.log(userStore.isLogin, to);
|
|
if (!userStore.isLogin && to.meta.auth) {
|
|
return "/pages/login/login";
|
|
}
|
|
});
|
|
exports.router = router;
|
|
|