feat: 未登录时,跳转到单独的登录页
This commit is contained in:
@@ -5,7 +5,8 @@ SHOPRO_VERSION=v2.4.1
|
||||
SHOPRO_BASE_URL=http://api-dashboard.yudao.iocoder.cn
|
||||
|
||||
# 后端接口 - 测试环境(通过 process.env.NODE_ENV = development)
|
||||
SHOPRO_DEV_BASE_URL=http://127.0.0.1:48080
|
||||
SHOPRO_DEV_BASE_URL=http://114.215.197.144:8080
|
||||
# SHOPRO_DEV_BASE_URL=http://127.0.0.1:48080
|
||||
### SHOPRO_DEV_BASE_URL=http://10.171.1.188:48080
|
||||
### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
**严肃声明:现在、未来都不会有商业版本,所有代码全部开源!!**
|
||||
|
||||
**「我喜欢写代码,乐此不疲」**
|
||||
**「我喜欢做开源,以此为乐」**
|
||||
|
||||
我 🐶 在上海艰苦奋斗,早中晚在 top3 大厂认真搬砖,夜里为开源做贡献。
|
||||
|
||||
如果这个项目让你有所收获,记得 Star 关注哦,这对我是非常不错的鼓励与支持。
|
||||
|
||||
## 🐶 新手必读
|
||||
|
||||
* 演示地址:<https://doc.iocoder.cn/mall-preview/>
|
||||
* 启动文档:<https://doc.iocoder.cn/quick-start/>
|
||||
* 视频教程:<https://doc.iocoder.cn/video/>
|
||||
|
||||
## 🐯 商城简介
|
||||
|
||||
**芋道商城**,基于 [芋道开发平台](https://github.com/YunaiV/ruoyi-vue-pro) 构建,以开发者为中心,打造中国第一流的 Java 开源商城系统,全部开源,个人与企业可 100% 免费使用。
|
||||
|
||||
> 有任何问题,或者想要的功能,可以在 Issues 中提给艿艿。
|
||||
>
|
||||
> 😜 给项目点点 Star 吧,这对我们真的很重要!
|
||||
|
||||

|
||||
|
||||
* 基于 uni-app + Vue3 开发,支持微信小程序、微信公众号、H5 移动端,未来会支持支付宝小程序、抖音小程序等
|
||||
* 支持 SaaS 多租户,可满足商品、订单、支付、会员、优惠券、秒杀、拼团、砍价、分销、积分等多种经营需求
|
||||
|
||||
## 🔥 后端架构
|
||||
|
||||
支持 Spring Boot、Spring Cloud 两种架构:
|
||||
|
||||
① Spring Boot 单体架构:<https://doc.iocoder.cn>
|
||||
|
||||

|
||||
|
||||
② Spring Cloud 微服务架构:<https://cloud.iocoder.cn>
|
||||
|
||||

|
||||
|
||||
## 🐱 移动端预览
|
||||
|
||||

|
||||
|
||||
## 🐶 管理端预览
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "芋道商城",
|
||||
"name": "商城",
|
||||
"appid": "__UNI__460BC4C",
|
||||
"description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。",
|
||||
"versionName": "2025.09",
|
||||
@@ -223,7 +223,7 @@
|
||||
"async": {
|
||||
"timeout": 20000
|
||||
},
|
||||
"title": "芋道商城",
|
||||
"title": "商城",
|
||||
"optimization": {
|
||||
"treeShaking": {
|
||||
"enable": true
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"id": "shopro",
|
||||
"name": "shopro",
|
||||
"displayName": "芋道商城",
|
||||
"displayName": "商城",
|
||||
"version": "2025.09",
|
||||
"description": "芋道商城,一套代码,同时发行到iOS、Android、H5、微信小程序多个平台,请使用手机扫码快速体验强大功能",
|
||||
"description": "商城,一套代码,同时发行到iOS、Android、H5、微信小程序多个平台,请使用手机扫码快速体验强大功能",
|
||||
"scripts": {
|
||||
"prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
|
||||
},
|
||||
|
||||
+7
-1
@@ -82,6 +82,12 @@
|
||||
"title": "自定义页面",
|
||||
"group": "商城"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/login/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "登录"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [{
|
||||
@@ -672,7 +678,7 @@
|
||||
],
|
||||
"globalStyle": {
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationBarTitleText": "芋道商城",
|
||||
"navigationBarTitleText": "商城",
|
||||
"navigationBarBackgroundColor": "#FFFFFF",
|
||||
"backgroundColor": "#FFFFFF",
|
||||
"navigationStyle": "custom"
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<template>
|
||||
<view> 登录 </view>
|
||||
</template>
|
||||
|
||||
<script setup></script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
@@ -62,7 +62,15 @@
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
|
||||
<button v-if="!isLogin" class="ss-reset-button type-btn" @tap="showAuthModal('accountLogin')">
|
||||
<button
|
||||
v-if="!isLogin"
|
||||
class="ss-reset-button type-btn"
|
||||
@tap="
|
||||
() => {
|
||||
sheep.$router.go('/pages/login/index', {}, { redirect: true });
|
||||
}
|
||||
"
|
||||
>
|
||||
返回登录
|
||||
</button>
|
||||
</view>
|
||||
@@ -110,7 +118,7 @@
|
||||
return;
|
||||
}
|
||||
// 成功后,用户重新登录
|
||||
showAuthModal('accountLogin')
|
||||
sheep.$router.go('/pages/login/index', {}, { redirect: true });
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -3,7 +3,10 @@
|
||||
<view>
|
||||
<su-popup :show="state.showShareGuide" :showClose="false" @close="onCloseGuide" />
|
||||
<view v-if="state.showShareGuide" class="guide-wrap">
|
||||
<image class="guide-image" :src="sheep.$url.static('/static/img/shop/share/share_guide.png')" />
|
||||
<image
|
||||
class="guide-image"
|
||||
:src="sheep.$url.static('/static/img/shop/share/share_guide.png')"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<su-popup :show="show" round="10" :showClose="false" @close="closeShareModal">
|
||||
@@ -17,7 +20,11 @@
|
||||
open-type="share"
|
||||
@tap="onShareByForward"
|
||||
>
|
||||
<image class="share-img" :src="sheep.$url.static('/static/img/shop/share/share_wx.png')" mode="" />
|
||||
<image
|
||||
class="share-img"
|
||||
:src="sheep.$url.static('/static/img/shop/share/share_wx.png')"
|
||||
mode=""
|
||||
/>
|
||||
<text class="share-title">微信好友</text>
|
||||
</button>
|
||||
|
||||
@@ -41,7 +48,11 @@
|
||||
class="share-item share-btn ss-flex-col ss-col-center"
|
||||
@tap="onShareByCopyLink"
|
||||
>
|
||||
<image class="share-img" :src="sheep.$url.static('/static/img/shop/share/share_link.png')" mode="" />
|
||||
<image
|
||||
class="share-img"
|
||||
:src="sheep.$url.static('/static/img/shop/share/share_link.png')"
|
||||
mode=""
|
||||
/>
|
||||
<text class="share-title">复制链接</text>
|
||||
</button>
|
||||
</view>
|
||||
@@ -89,7 +100,8 @@
|
||||
const onShareByPoster = () => {
|
||||
closeShareModal();
|
||||
if (!sheep.$store('user').isLogin) {
|
||||
showAuthModal();
|
||||
// showAuthModal();
|
||||
sheep.$router.go('/pages/login/index', {}, { redirect: true });
|
||||
return;
|
||||
}
|
||||
unref(SharePosterRef).getPoster();
|
||||
|
||||
@@ -12,7 +12,7 @@ if (process.env.NODE_ENV === 'development') {
|
||||
if (typeof baseUrl === 'undefined') {
|
||||
console.error('请检查.env配置文件是否存在');
|
||||
} else {
|
||||
console.log(`[芋道商城 ${version}] https://doc.iocoder.cn`);
|
||||
|
||||
}
|
||||
|
||||
export const apiPath = import.meta.env.SHOPRO_API_PATH;
|
||||
|
||||
@@ -10,6 +10,7 @@ import $platform from '@/sheep/platform';
|
||||
import { showAuthModal } from '@/sheep/hooks/useModal';
|
||||
import AuthUtil from '@/sheep/api/member/auth';
|
||||
import { getTerminal } from '@/sheep/helper/const';
|
||||
import sheep from '@/sheep';
|
||||
|
||||
const options = {
|
||||
// 显示操作成功消息 默认不显示
|
||||
@@ -73,7 +74,8 @@ http.interceptors.request.use(
|
||||
(config) => {
|
||||
// 自定义处理【auth 授权】:必须登录的接口,则跳出 AuthModal 登录弹窗
|
||||
if (config.custom.auth && !$store('user').isLogin) {
|
||||
showAuthModal();
|
||||
// showAuthModal();
|
||||
sheep.$router.go('/pages/login/index', {}, { redirect: true });
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
@@ -280,7 +282,7 @@ const refreshToken = async (config) => {
|
||||
const handleAuthorized = () => {
|
||||
const userStore = $store('user');
|
||||
userStore.logout(true);
|
||||
showAuthModal();
|
||||
sheep.$router.go('/pages/login/index', {}, { redirect: true });
|
||||
// 登录超时
|
||||
return Promise.reject({
|
||||
code: 401,
|
||||
|
||||
@@ -59,7 +59,8 @@ const _go = (
|
||||
|
||||
// 页面登录拦截
|
||||
if (nextRoute.meta?.auth && !$store('user').isLogin) {
|
||||
showAuthModal();
|
||||
// showAuthModal();
|
||||
sheep.$router.go('/pages/login/index', {}, { redirect: true });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ const app = defineStore({
|
||||
// TODO 芋艿:【初始化优化】未来支持管理后台可配;对应 https://api.shopro.sheepjs.com/shop/api/init
|
||||
if (true) {
|
||||
this.info = {
|
||||
name: '芋道商城',
|
||||
name: '商城',
|
||||
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
|
||||
version: '2025.09',
|
||||
copyright: '全部开源,个人与企业可 100% 免费使用',
|
||||
|
||||
Reference in New Issue
Block a user