Compare commits
No commits in common. "master" and "v2026.03" have entirely different histories.
5
.env
5
.env
|
|
@ -1,12 +1,9 @@
|
|||
# 版本号
|
||||
SHOPRO_VERSION=v2.4.1
|
||||
|
||||
# 后端接口 - 正式环境(通过 process.env.NODE_ENV 非 development -生产环境-release)
|
||||
# 后端接口 - 正式环境(通过 process.env.NODE_ENV 非 development)
|
||||
SHOPRO_BASE_URL=http://api-dashboard.yudao.iocoder.cn
|
||||
|
||||
# 后端接口 - 体验环境(通过 process.env.NODE_ENV 非 development -体验环境-trial)
|
||||
SHOPRO_TRIAL_BASE_URL=http://api-dashboard.yudao.iocoder.cn/trial
|
||||
|
||||
# 后端接口 - 测试环境(通过 process.env.NODE_ENV = development)
|
||||
SHOPRO_DEV_BASE_URL=http://127.0.0.1:48080
|
||||
### SHOPRO_DEV_BASE_URL=http://10.171.1.188:48080
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "芋道商城",
|
||||
"appid": "__UNI__460BC4C",
|
||||
"description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。",
|
||||
"versionName": "2026.04",
|
||||
"versionName": "2026.03",
|
||||
"versionCode": "183",
|
||||
"transformPx": false,
|
||||
"app-plus": {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id": "shopro",
|
||||
"name": "shopro",
|
||||
"displayName": "芋道商城",
|
||||
"version": "2026.04",
|
||||
"version": "2026.03",
|
||||
"description": "芋道商城,一套代码,同时发行到iOS、Android、H5、微信小程序多个平台,请使用手机扫码快速体验强大功能",
|
||||
"scripts": {
|
||||
"prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
|
||||
|
|
@ -94,7 +94,6 @@
|
|||
"luch-request": "^3.0.8",
|
||||
"pinia": "^2.0.33",
|
||||
"pinia-plugin-persist-uni": "^1.2.0",
|
||||
"vue": "^3.5.11",
|
||||
"weixin-js-sdk": "^1.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@
|
|||
return;
|
||||
}
|
||||
state.pagination.pageNo++;
|
||||
getRankList();
|
||||
getList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
:color="color"
|
||||
:tools="tools"
|
||||
:opacityBgUi="opacityBgUi"
|
||||
:backgroundColor="navbarBackgroundColor"
|
||||
@search="(e) => emits('search', e)"
|
||||
:defaultSearch="defaultSearch"
|
||||
/>
|
||||
|
|
@ -81,11 +80,6 @@
|
|||
type: String,
|
||||
default: 'bg-white',
|
||||
},
|
||||
// 顶部导航栏背景颜色(仅在 navbar === 'normal' 时生效)
|
||||
navbarBackgroundColor: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '',
|
||||
|
|
@ -219,16 +213,16 @@
|
|||
// #endif
|
||||
|
||||
// 组件中使用 onMounted 监听页面加载,不是页面组件不使用 onShow
|
||||
onMounted(() => {
|
||||
onMounted(()=>{
|
||||
// #ifdef MP-ALIPAY
|
||||
uni.setNavigationBarTitle({
|
||||
title: '',
|
||||
title: "",
|
||||
});
|
||||
// #endif
|
||||
if (!isEmpty(shareInfo.value)) {
|
||||
sheep.$platform.share.updateShareInfo(shareInfo.value);
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import packageInfo from '@/package.json';
|
||||
import { getWxEnvVersion } from '@/sheep/helper/env';
|
||||
|
||||
const { version } = packageInfo;
|
||||
|
||||
|
|
@ -8,21 +7,7 @@ export let baseUrl;
|
|||
if (process.env.NODE_ENV === 'development') {
|
||||
baseUrl = import.meta.env.SHOPRO_DEV_BASE_URL;
|
||||
} else {
|
||||
// 非本地 dev 模式开发环境,判断是体验版还是正式版
|
||||
const wxEnvVersion = getWxEnvVersion();
|
||||
|
||||
if (wxEnvVersion === 'trial') {
|
||||
// 体验版使用体验版服务器地址
|
||||
baseUrl = import.meta.env.SHOPRO_TRIAL_BASE_URL || import.meta.env.SHOPRO_BASE_URL;
|
||||
console.log('当前运行环境:体验版');
|
||||
} else if (wxEnvVersion === 'release') {
|
||||
// 正式版使用生产服务器地址
|
||||
baseUrl = import.meta.env.SHOPRO_BASE_URL;
|
||||
console.log('当前运行环境:正式版');
|
||||
} else {
|
||||
// 其他平台或获取失败,使用默认地址
|
||||
baseUrl = import.meta.env.SHOPRO_BASE_URL;
|
||||
}
|
||||
baseUrl = import.meta.env.SHOPRO_BASE_URL;
|
||||
}
|
||||
if (typeof baseUrl === 'undefined') {
|
||||
console.error('请检查.env配置文件是否存在');
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
/**
|
||||
* 微信小程序运行环境:develop / trial / release
|
||||
* 其它平台默认 release,整个 App 生命周期内不会变,缓存一次
|
||||
*/
|
||||
let cachedEnvVersion;
|
||||
|
||||
export function getWxEnvVersion() {
|
||||
if (cachedEnvVersion) return cachedEnvVersion;
|
||||
// #ifdef MP-WEIXIN
|
||||
try {
|
||||
cachedEnvVersion = wx.getAccountInfoSync().miniProgram.envVersion;
|
||||
} catch (e) {
|
||||
console.log('获取微信小程序环境失败', e);
|
||||
cachedEnvVersion = 'release';
|
||||
}
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
cachedEnvVersion = 'release';
|
||||
// #endif
|
||||
return cachedEnvVersion;
|
||||
}
|
||||
|
|
@ -30,9 +30,8 @@ export default {
|
|||
}
|
||||
|
||||
// 调用后端接口,获得 JSSDK 初始化所需的签名
|
||||
// 微信要求签名 URL 与当前页面去掉 hash 后完全一致;不能直接用 location.origin(会丢子路径与 query)
|
||||
const signUrl = location.href.split('#')[0];
|
||||
const { code, data } = await AuthUtil.createWeixinMpJsapiSignature(signUrl);
|
||||
const url = location.origin;
|
||||
const { code, data } = await AuthUtil.createWeixinMpJsapiSignature(url);
|
||||
if (code === 0) {
|
||||
jweixin.config({
|
||||
debug: false,
|
||||
|
|
@ -58,11 +57,7 @@ export default {
|
|||
configSuccess = true;
|
||||
jweixin.error((err) => {
|
||||
configSuccess = false;
|
||||
console.error('[wx-jssdk] config error', err, {
|
||||
href: location.href,
|
||||
signUrl,
|
||||
data,
|
||||
});
|
||||
console.error('微信 JSSDK 初始化失败', err);
|
||||
$helper.toast('微信JSSDK:' + err.errMsg);
|
||||
});
|
||||
jweixin.ready(() => {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ const buildSpmLink = (query, linkAddress = '') => {
|
|||
};
|
||||
|
||||
// 解析Spm
|
||||
const decryptSpm = async (spm) => {
|
||||
const decryptSpm = (spm) => {
|
||||
const user = $store('user');
|
||||
let shareParamsArray = spm.split('.');
|
||||
let shareParams = {
|
||||
|
|
@ -168,7 +168,7 @@ const decryptSpm = async (spm) => {
|
|||
uni.setStorageSync('shareId', shareParams.shareId);
|
||||
// 已登录 绑定推广员
|
||||
if (!!user.isLogin) {
|
||||
await bindBrokerageUser(shareParams.shareId);
|
||||
bindBrokerageUser(shareParams.shareId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,14 +230,12 @@ const refreshToken = async (config) => {
|
|||
|
||||
// 如果未认证,并且未进行刷新令牌,说明可能是访问令牌过期了
|
||||
if (!isRefreshToken) {
|
||||
isRefreshToken = true;
|
||||
// 1. 如果获取不到刷新令牌,则只能执行登出操作
|
||||
const refreshToken = getRefreshToken();
|
||||
if (!refreshToken) {
|
||||
return handleAuthorized();
|
||||
}
|
||||
// 只有真正发起刷新时才标记刷新中,避免无刷新令牌时状态一直卡住,后续 401 不再弹登录框
|
||||
// https://github.com/yudaocode/yudao-mall-uniapp/issues/38
|
||||
isRefreshToken = true;
|
||||
// 2. 进行刷新访问令牌
|
||||
try {
|
||||
const refreshTokenResult = await AuthUtil.refreshToken(refreshToken);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import user from './user';
|
|||
import sys from './sys';
|
||||
import { baseUrl, h5Url } from '@/sheep/config';
|
||||
|
||||
const app = defineStore('app', {
|
||||
const app = defineStore({
|
||||
id: 'app',
|
||||
state: () => ({
|
||||
paramsForTabbar: {}, // 为全局tabbar跳转传参用。原因是 tabbar 无法传参,只能通过全局状态传递
|
||||
info: {
|
||||
|
|
@ -73,7 +74,7 @@ const app = defineStore('app', {
|
|||
this.info = {
|
||||
name: '芋道商城',
|
||||
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
|
||||
version: '2026.04',
|
||||
version: '2026.03',
|
||||
copyright: '全部开源,个人与企业可 100% 免费使用',
|
||||
copytime: 'Copyright© 2018-2025',
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { defineStore } from 'pinia';
|
||||
import CartApi from '@/sheep/api/trade/cart';
|
||||
|
||||
const cart = defineStore('cart', {
|
||||
const cart = defineStore({
|
||||
id: 'cart',
|
||||
state: () => ({
|
||||
list: [], // 购物车列表(invalidList + validList)
|
||||
selectedIds: [], // 已选列表
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { defineStore } from 'pinia';
|
||||
|
||||
const modal = defineStore('modal', {
|
||||
const modal = defineStore({
|
||||
id: 'modal',
|
||||
state: () => ({
|
||||
auth: '', // 授权弹框 accountLogin|smsLogin|resetPassword|changeMobile|changePassword|changeUsername
|
||||
share: false, // 分享弹框
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { defineStore } from 'pinia';
|
||||
import app from './app';
|
||||
|
||||
const sys = defineStore('sys', {
|
||||
const sys = defineStore({
|
||||
id: 'sys',
|
||||
state: () => ({
|
||||
theme: '', // 主题,
|
||||
mode: 'light', // 明亮模式、暗黑模式(暂未支持)
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@ const defaultNumData = {
|
|||
},
|
||||
};
|
||||
|
||||
const user = defineStore('user', {
|
||||
const user = defineStore({
|
||||
id: 'user',
|
||||
state: () => ({
|
||||
userInfo: clone(defaultUserInfo), // 用户信息
|
||||
userWallet: clone(defaultUserWallet), // 用户钱包信息
|
||||
|
|
|
|||
Loading…
Reference in New Issue