Compare commits
23 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
41211d17b3 | |
|
|
164551a22e | |
|
|
6587fb15c6 | |
|
|
d6f272ad75 | |
|
|
2c489b2cab | |
|
|
5ccddfa082 | |
|
|
be05df9d91 | |
|
|
ef6ba21a56 | |
|
|
c6c240115d | |
|
|
a6c4179611 | |
|
|
75eed2ba19 | |
|
|
9e7ef1e9f1 | |
|
|
3a27171cda | |
|
|
014b0dd508 | |
|
|
c034b59a7b | |
|
|
0533985189 | |
|
|
43d2d02e8e | |
|
|
b6b0ca3dbd | |
|
|
0d0017eac7 | |
|
|
5c2377b482 | |
|
|
1346f8bf3b | |
|
|
d18d67dd62 | |
|
|
f2bfb2d79b |
5
.env
5
.env
|
|
@ -1,9 +1,12 @@
|
|||
# 版本号
|
||||
SHOPRO_VERSION=v2.4.1
|
||||
|
||||
# 后端接口 - 正式环境(通过 process.env.NODE_ENV 非 development)
|
||||
# 后端接口 - 正式环境(通过 process.env.NODE_ENV 非 development -生产环境-release)
|
||||
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.01",
|
||||
"versionName": "2026.04",
|
||||
"versionCode": "183",
|
||||
"transformPx": false,
|
||||
"app-plus": {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"id": "shopro",
|
||||
"name": "shopro",
|
||||
"displayName": "芋道商城",
|
||||
"version": "2026.01",
|
||||
"version": "2026.04",
|
||||
"description": "芋道商城,一套代码,同时发行到iOS、Android、H5、微信小程序多个平台,请使用手机扫码快速体验强大功能",
|
||||
"scripts": {
|
||||
"prettier": "prettier --write \"{pages,sheep}/**/*.{js,json,tsx,css,less,scss,vue,html,md}\""
|
||||
|
|
@ -94,6 +94,7 @@
|
|||
"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++;
|
||||
getList();
|
||||
getRankList();
|
||||
}
|
||||
|
||||
// 上拉加载更多
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@
|
|||
<text class="num font-color">{{ item.brokerageUserCount || 0 }} </text>人
|
||||
</view>
|
||||
<view>
|
||||
<text class="num">{{ item.orderCount || 0 }}</text
|
||||
<text class="num">{{ item.brokerageOrderCount || 0 }}</text
|
||||
>单</view
|
||||
>
|
||||
<view>
|
||||
|
|
@ -320,6 +320,7 @@
|
|||
|
||||
function setType(e) {
|
||||
state.pagination.list = [];
|
||||
state.pagination.pageNo = 1;
|
||||
state.level = e + '';
|
||||
getTeamList();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@
|
|||
>
|
||||
<uni-easyinput
|
||||
:inputBorder="false"
|
||||
:value="state.accountInfo.bankName"
|
||||
:value="bankNameLabel"
|
||||
placeholder="请选择银行"
|
||||
suffixIcon="right"
|
||||
disabled
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onBeforeMount, reactive } from 'vue';
|
||||
import { onBeforeMount, reactive, computed } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import accountTypeSelect from './components/account-type-select.vue';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
|
|
@ -199,6 +199,14 @@
|
|||
bankListSelectedIndex: '', // 选中银行 bankList 的 index
|
||||
});
|
||||
|
||||
const bankNameLabel = computed(() => {
|
||||
if (!state.accountInfo.bankName || !state.bankList || state.bankList.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const item = state.bankList.find((it) => it.value === state.accountInfo.bankName);
|
||||
return item ? item.label : '';
|
||||
});
|
||||
|
||||
// 打开提现方式的弹窗
|
||||
const onAccountSelect = (e) => {
|
||||
state.accountSelect = e;
|
||||
|
|
@ -300,7 +308,8 @@
|
|||
function bankChange(e) {
|
||||
const value = e.detail.value;
|
||||
state.bankListSelectedIndex = value;
|
||||
state.accountInfo.bankName = state.bankList[value].label;
|
||||
const item = state.bankList[value];
|
||||
state.accountInfo.bankName = item ? item.value : undefined;
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
:color="color"
|
||||
:tools="tools"
|
||||
:opacityBgUi="opacityBgUi"
|
||||
:backgroundColor="navbarBackgroundColor"
|
||||
@search="(e) => emits('search', e)"
|
||||
:defaultSearch="defaultSearch"
|
||||
/>
|
||||
|
|
@ -80,6 +81,11 @@
|
|||
type: String,
|
||||
default: 'bg-white',
|
||||
},
|
||||
// 顶部导航栏背景颜色(仅在 navbar === 'normal' 时生效)
|
||||
navbarBackgroundColor: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '',
|
||||
|
|
@ -213,16 +219,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,4 +1,5 @@
|
|||
import packageInfo from '@/package.json';
|
||||
import { getWxEnvVersion } from '@/sheep/helper/env';
|
||||
|
||||
const { version } = packageInfo;
|
||||
|
||||
|
|
@ -7,7 +8,21 @@ export let baseUrl;
|
|||
if (process.env.NODE_ENV === 'development') {
|
||||
baseUrl = import.meta.env.SHOPRO_DEV_BASE_URL;
|
||||
} else {
|
||||
baseUrl = import.meta.env.SHOPRO_BASE_URL;
|
||||
// 非本地 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;
|
||||
}
|
||||
}
|
||||
if (typeof baseUrl === 'undefined') {
|
||||
console.error('请检查.env配置文件是否存在');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* 微信小程序运行环境: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,8 +30,9 @@ export default {
|
|||
}
|
||||
|
||||
// 调用后端接口,获得 JSSDK 初始化所需的签名
|
||||
const url = location.origin;
|
||||
const { code, data } = await AuthUtil.createWeixinMpJsapiSignature(url);
|
||||
// 微信要求签名 URL 与当前页面去掉 hash 后完全一致;不能直接用 location.origin(会丢子路径与 query)
|
||||
const signUrl = location.href.split('#')[0];
|
||||
const { code, data } = await AuthUtil.createWeixinMpJsapiSignature(signUrl);
|
||||
if (code === 0) {
|
||||
jweixin.config({
|
||||
debug: false,
|
||||
|
|
@ -57,7 +58,11 @@ export default {
|
|||
configSuccess = true;
|
||||
jweixin.error((err) => {
|
||||
configSuccess = false;
|
||||
console.error('微信 JSSDK 初始化失败', err);
|
||||
console.error('[wx-jssdk] config error', err, {
|
||||
href: location.href,
|
||||
signUrl,
|
||||
data,
|
||||
});
|
||||
$helper.toast('微信JSSDK:' + err.errMsg);
|
||||
});
|
||||
jweixin.ready(() => {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ const buildSpmLink = (query, linkAddress = '') => {
|
|||
};
|
||||
|
||||
// 解析Spm
|
||||
const decryptSpm = (spm) => {
|
||||
const decryptSpm = async (spm) => {
|
||||
const user = $store('user');
|
||||
let shareParamsArray = spm.split('.');
|
||||
let shareParams = {
|
||||
|
|
@ -168,7 +168,7 @@ const decryptSpm = (spm) => {
|
|||
uni.setStorageSync('shareId', shareParams.shareId);
|
||||
// 已登录 绑定推广员
|
||||
if (!!user.isLogin) {
|
||||
bindBrokerageUser(shareParams.shareId);
|
||||
await bindBrokerageUser(shareParams.shareId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,12 +230,14 @@ 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,8 +8,7 @@ import user from './user';
|
|||
import sys from './sys';
|
||||
import { baseUrl, h5Url } from '@/sheep/config';
|
||||
|
||||
const app = defineStore({
|
||||
id: 'app',
|
||||
const app = defineStore('app', {
|
||||
state: () => ({
|
||||
paramsForTabbar: {}, // 为全局tabbar跳转传参用。原因是 tabbar 无法传参,只能通过全局状态传递
|
||||
info: {
|
||||
|
|
@ -74,7 +73,7 @@ const app = defineStore({
|
|||
this.info = {
|
||||
name: '芋道商城',
|
||||
logo: 'https://static.iocoder.cn/ruoyi-vue-pro-logo.png',
|
||||
version: '2026.01',
|
||||
version: '2026.04',
|
||||
copyright: '全部开源,个人与企业可 100% 免费使用',
|
||||
copytime: 'Copyright© 2018-2025',
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import { defineStore } from 'pinia';
|
||||
import CartApi from '@/sheep/api/trade/cart';
|
||||
|
||||
const cart = defineStore({
|
||||
id: 'cart',
|
||||
const cart = defineStore('cart', {
|
||||
state: () => ({
|
||||
list: [], // 购物车列表(invalidList + validList)
|
||||
selectedIds: [], // 已选列表
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { defineStore } from 'pinia';
|
||||
|
||||
const modal = defineStore({
|
||||
id: 'modal',
|
||||
const modal = defineStore('modal', {
|
||||
state: () => ({
|
||||
auth: '', // 授权弹框 accountLogin|smsLogin|resetPassword|changeMobile|changePassword|changeUsername
|
||||
share: false, // 分享弹框
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import { defineStore } from 'pinia';
|
||||
import app from './app';
|
||||
|
||||
const sys = defineStore({
|
||||
id: 'sys',
|
||||
const sys = defineStore('sys', {
|
||||
state: () => ({
|
||||
theme: '', // 主题,
|
||||
mode: 'light', // 明亮模式、暗黑模式(暂未支持)
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ const defaultNumData = {
|
|||
},
|
||||
};
|
||||
|
||||
const user = defineStore({
|
||||
id: 'user',
|
||||
const user = defineStore('user', {
|
||||
state: () => ({
|
||||
userInfo: clone(defaultUserInfo), // 用户信息
|
||||
userWallet: clone(defaultUserWallet), // 用户钱包信息
|
||||
|
|
|
|||
Loading…
Reference in New Issue