Compare commits

..

No commits in common. "master" and "v2026.04" have entirely different histories.

18 changed files with 23 additions and 145 deletions

5
.env
View File

@ -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

View File

@ -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": {

View File

@ -253,8 +253,8 @@
.message-container {
width: 100%;
/* 倒置滚动区内,容器高度只需要撑满聊天区域 */
min-height: v-bind(chatScrollHeight);
/* 确保容器至少有一屏高度 */
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: flex-end;

View File

@ -105,7 +105,7 @@
return;
}
state.pagination.pageNo++;
getRankList();
getList();
}
//

View File

@ -229,7 +229,7 @@
}
let openid;
if (state.accountInfo.type === '5') {
openid = await sheep.$platform.useProvider('wechat').getOpenid(true);
openid = await sheep.$platform.useProvider('wechat').getOpenid();
// openid
if (!openid) {
goBindWeixin();

View File

@ -24,7 +24,7 @@
:key="index"
>
<radio
:checked="formData.way === item.value"
:checked="formData.type === item.value"
color="var(--ui-BG-Main)"
style="transform: scale(0.8)"
:value="item.value"
@ -159,10 +159,6 @@
//
async function submit() {
if (!formData.way) {
sheep.$helper.toast('请选择售后类型');
return;
}
let data = {
orderItemId: state.itemId,
refundPrice: state.item.payPrice,

View File

@ -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>

View File

@ -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配置文件是否存在');

View File

@ -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;
}

View File

@ -9,7 +9,6 @@ import $helper from '@/sheep/helper';
import AuthUtil from '@/sheep/api/member/auth';
let configSuccess = false;
let configAppId = ''; // JSSDK 初始化所使用的公众号 appId确认收款时需要
export default {
// 判断是否在微信中
@ -48,11 +47,9 @@ export default {
'updateAppMessageShareData',
'updateTimelineShareData',
'scanQRCode',
// 'requestMerchantTransfer', // TODO @使用者:如果需要微信商家转账功能,请打开该注释;
], // TODO 芋艿:后续可以设置更多权限;
openTagList: data.openTagList,
});
configAppId = data.appId;
} else {
console.log('请求 JSSDK 配置失败,错误码:', code);
}
@ -198,50 +195,4 @@ export default {
});
});
},
// 商家转账用户确认收款H5 / 公众号)
// 可见 https://pay.weixin.qq.com/doc/v3/merchant/4012716430 文档
requestMerchantTransfer(data, callback) {
const invoke = () => {
// WeixinJSBridge 内置对象,仅在微信客户端中有效
if (typeof WeixinJSBridge === 'undefined') {
callback.fail && callback.fail({ errMsg: '请在微信客户端中打开页面后再确认收款' });
return;
}
WeixinJSBridge.invoke(
'requestMerchantTransfer',
{
mchId: data.mchId,
appId: data.appId || configAppId,
package: data.package,
},
function (res) {
if (res.err_msg === 'requestMerchantTransfer:ok') {
callback.success && callback.success(res);
} else if (res.err_msg === 'requestMerchantTransfer:cancel') {
callback.cancel && callback.cancel(res);
} else {
callback.fail && callback.fail(res);
}
},
);
};
this.isReady(() => {
// 校验微信客户端是否支持 requestMerchantTransfer
jweixin.checkJsApi({
jsApiList: ['requestMerchantTransfer'],
success: function (res) {
if (res.checkResult && res.checkResult['requestMerchantTransfer']) {
invoke();
} else {
callback.fail && callback.fail({ errMsg: '你的微信版本过低,请更新至最新版本' });
}
},
fail: function () {
// checkJsApi 失败时,兜底直接尝试调用
invoke();
},
});
});
},
};

View File

@ -2,7 +2,6 @@ import $wxsdk from '@/sheep/libs/sdk-h5-weixin';
import { getRootUrl } from '@/sheep/helper';
import AuthUtil from '@/sheep/api/member/auth';
import SocialApi from '@/sheep/api/member/social';
import sheep from '@/sheep';
const socialType = 31; // 社交类型 - 微信公众号
@ -95,30 +94,6 @@ async function getInfo() {
return data;
}
// 商家转账用户确认模式下,拉起页面请求用户确认收款 Transfer
// 入参与小程序保持一致:(mchId, packageInfo, successCallback, failCallback)
function requestMerchantTransfer(mchId, packageInfo, successCallback, failCallback) {
$wxsdk.requestMerchantTransfer(
{
mchId,
package: packageInfo,
},
{
success: (res) => {
successCallback && successCallback({ result: 'success', ...res });
},
cancel: (res) => {
sheep.$helper.toast('确认收款已取消');
failCallback && failCallback({ result: 'cancel', errMsg: '确认收款已取消', ...res });
},
fail: (res) => {
sheep.$helper.toast(res.errMsg || '确认收款失败');
failCallback && failCallback({ result: 'fail', ...res });
},
},
);
}
export default {
load,
login,
@ -126,6 +101,5 @@ export default {
unbind,
getInfo,
getOpenid,
requestMerchantTransfer,
jsWxSdk: $wxsdk,
};

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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: {

View File

@ -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: [], // 已选列表

View File

@ -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, // 分享弹框

View File

@ -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', // 明亮模式、暗黑模式(暂未支持)

View File

@ -36,7 +36,8 @@ const defaultNumData = {
},
};
const user = defineStore('user', {
const user = defineStore({
id: 'user',
state: () => ({
userInfo: clone(defaultUserInfo), // 用户信息
userWallet: clone(defaultUserWallet), // 用户钱包信息