Merge remote-tracking branch 'origin/master-vue3' into master-vue3

This commit is contained in:
owen
2023-12-23 22:29:33 +08:00
49 changed files with 906 additions and 900 deletions
-13
View File
@@ -13,19 +13,6 @@ export default {
showLoading: false,
},
}),
// 同步客户端页面到后端
pageSync: (pages) =>
request({
url: 'pageSync',
method: 'POST',
data: {
pages,
},
custom: {
showError: false,
showLoading: false,
},
}),
// 自定义页面
page: (id) =>
request({
+68 -62
View File
@@ -1,65 +1,71 @@
import request from '@/sheep/request';
export default {
// 分销商详情
agent: () =>
request({
url: 'commission/agent',
method: 'GET',
custom: {
showLoading: false,
showError: false,
},
}),
// 分销表单
form: () =>
request({
url: 'commission/agent/form',
method: 'GET',
}),
// 申请分销商
apply: (data) =>
request({
url: 'commission/agent/apply',
method: 'POST',
data,
custom: {
showSuccess: true,
},
}),
// 分销动态
log: (params) =>
request({
url: 'commission/log',
method: 'GET',
params,
}),
// 分销订单
order: (params) =>
request({
url: 'commission/order',
method: 'GET',
params,
}),
// 分销商品
goods: (params) =>
request({
url: 'commission/goods',
method: 'GET',
params,
}),
// 我的团队
team: (params) =>
request({
url: 'commission/agent/team',
method: 'GET',
params,
}),
// 佣金转余额
transfer: (data) =>
request({
url: 'commission/agent/transfer',
method: 'POST',
data,
}),
};
// 分销商详情
agent: () =>
request({
url: 'commission/agent',
method: 'GET',
custom: {
showLoading: false,
showError: false,
},
}),
// 分销表单
form: () =>
request({
url: 'commission/agent/form',
method: 'GET',
}),
// 申请分销商
apply: (data) =>
request({
url: 'commission/agent/apply',
method: 'POST',
data,
custom: {
showSuccess: true,
},
}),
// 分销动态
log: (params) =>
request({
url: 'commission/log',
method: 'GET',
params,
}),
// 分销订单
order: (params) =>
request({
url: 'commission/order',
method: 'GET',
params,
}),
// 分销商品
goods: (params) =>
request({
url: '/app-api/product/spu/page',
method: 'GET',
params,
}),
// 我的团队
team: (params) =>
request({
url: 'commission/agent/team',
method: 'GET',
params,
}),
// 佣金转余额
transfer: (data) =>
request({
url: 'commission/agent/transfer',
method: 'POST',
data,
}),
getSummary: (data) =>
request({
url: '/app-api/trade/brokerage-user/get-summary',
method: 'GET',
}),
};
+14
View File
@@ -37,6 +37,20 @@ const AuthUtil = {
method: 'POST',
});
},
// 创建微信 JS SDK 初始化所需的签名
createWeixinMpJsapiSignature: (url) => {
return request({
url: '/app-api/member/auth/create-weixin-jsapi-signature',
method: 'POST',
params: {
url
},
custom: {
showError: false,
showLoading: false,
},
})
},
};
export default AuthUtil;
-12
View File
@@ -75,18 +75,6 @@ export default {
},
}),
// 网页jssdk
jssdk: (data) =>
request({
url: 'third/wechat/jssdk',
method: 'GET',
data,
custom: {
showError: false,
showLoading: false,
},
}),
// 小程序订阅消息
subscribeTemplate: (params) =>
request({
@@ -51,7 +51,7 @@
<image
class="auto-login-img"
:src="sheep.$url.static('/static/img/shop/platform/wechat.png')"
></image>
/>
</button>
<!-- iOS登录 -->
+1
View File
@@ -1,3 +1,4 @@
<!-- 装修组件容器 -->
<template>
<view :style="[elStyles, elBackground]"><slot /></view>
</template>
@@ -1,4 +1,4 @@
<!-- 优惠券 -->
<!-- 装修营销组件优惠券 -->
<template>
<scroll-view class="scroll-box" scroll-x scroll-anchoring>
<view class="coupon-box ss-flex">
@@ -1,3 +1,4 @@
<!-- 装修用户组件用户卡券 -->
<template>
<view class="ss-coupon-menu-wrap ss-flex ss-col-center">
<view class="menu-item ss-flex-col ss-row-center ss-col-center" v-for="item in props.list" :key="item.title"
@@ -41,13 +42,13 @@
path: '/pages/coupon/list',
type: 'expired',
},
// {
// title: '领券中心',
// value: '0',
// icon: '/static/img/shop/order/all_coupon.png',
// path: '/pages/coupon/list',
// type: 'all',
// },
{
title: '领券中心',
value: '0',
icon: '/static/img/shop/order/all_coupon.png',
path: '/pages/coupon/list',
type: 'all',
},
];
},
},
@@ -1,3 +1,4 @@
<!-- 顶部导航栏 -->
<template>
<navbar
:alway="isAlway"
@@ -1,3 +1,4 @@
<!-- 装修基础组件悬浮按钮 -->
<template>
<!-- 模态背景展开时显示点击后折叠 -->
<view class="modal-bg" v-if="fabRef?.isShow" @click="handleCollapseFab"></view>
@@ -1,3 +1,4 @@
<!-- 装修商品组件商品卡片 -->
<template>
<!-- 商品卡片 -->
<view>
@@ -1,3 +1,4 @@
<!-- 装修商品组件商品栏 -->
<template>
<view>
<!-- 布局1. 两列商品图片左文案右 -->
@@ -27,7 +28,7 @@
:bottomRadius="data.borderRadiusBottom"
:titleWidth="(454 - marginRight * 2 - data.space * 2 - marginLeft * 2) / 2"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
></s-goods-column>
/>
</view>
</view>
<!-- 布局. 三列商品图片上文案下 -->
@@ -56,7 +57,7 @@
:topRadius="data.borderRadiusTop"
:bottomRadius="data.borderRadiusBottom"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
></s-goods-column>
/>
</view>
</view>
@@ -79,7 +80,7 @@
:titleColor="data.fields.name?.color"
:titleWidth="(750 - marginRight * 2 - data.space * 4 - marginLeft * 2) / 3"
@click="sheep.$router.go('/pages/goods/index', { id: item.id })"
></s-goods-column>
/>
</view>
</view>
</scroll-view>
@@ -1,3 +1,4 @@
<!-- 装修图文组件热区 -->
<template>
<view class="hotzone-wrap">
<image :src="sheep.$url.cdn(data.imgUrl)" style="width: 100%" mode="widthFix"></image>
@@ -1,3 +1,4 @@
<!-- 装修图文组件图片轮播 -->
<template>
<su-swiper
:list="imgList"
@@ -1,6 +1,7 @@
<!-- 装修图文组件图片展示 -->
<template>
<view @tap="sheep.$router.go(data?.url)">
<su-image :src="sheep.$url.cdn(data.imgUrl)" mode="widthFix"></su-image>
<su-image :src="sheep.$url.cdn(data.imgUrl)" mode="widthFix" />
</view>
</template>
@@ -1,3 +1,4 @@
<!-- 装修图文组件广告魔方 -->
<template>
<view class="ss-cube-wrap" :style="[parseAdWrap]">
<view v-for="(item, index) in data.list" :key="index">
@@ -1,3 +1,4 @@
<!-- 装修基础组件分割线 -->
<template>
<su-subline v-bind="data"></su-subline>
</template>
@@ -1,3 +1,4 @@
<!-- 装修基础组件菜单导航金刚区 -->
<template>
<!-- 包裹层 -->
<view
@@ -1,3 +1,4 @@
<!-- 装修基础组件宫格导航 -->
<template>
<uni-grid :showBorder="Boolean(data.border)" :column="data.column">
<uni-grid-item
@@ -1,3 +1,4 @@
<!-- 装修基础组件列表导航 -->
<template>
<view class="menu-list-wrap">
<uni-list :border="true">
@@ -11,7 +11,7 @@
:speed="50"
:color="data.textColor"
@tap="sheep.$router.go(data.contents[0].url)"
></su-notice-bar>
/>
</view>
</template>
@@ -1,3 +1,4 @@
<!-- 装修用户组件用户订单 -->
<template>
<view class="ss-order-menu-wrap ss-flex ss-col-center">
<view
@@ -1,3 +1,4 @@
<!-- 装修营销组件营销文章 -->
<template>
<view
:style="[
@@ -16,6 +17,7 @@
<script setup>
import { reactive, onMounted } from 'vue';
import ArticleApi from '@/sheep/api/promotion/article';
const props = defineProps({
data: {
type: Object,
@@ -26,9 +28,11 @@
default() {},
},
});
const state = reactive({
content: '',
});
onMounted(async () => {
const { data } = await ArticleApi.getArticle(props.data.id);
state.content = data.content;
@@ -1,4 +1,4 @@
<!-- 页面 -->
<!-- 装修商品组件标题栏 -->
<template>
<view
class="ss-title-wrap ss-flex ss-col-center"
+2 -2
View File
@@ -1,4 +1,4 @@
<!-- 页面 -->
<!-- 装修用户组件用户卡片 -->
<template>
<view class="ss-user-info-wrap ss-p-t-50">
<view class="ss-flex ss-col-center ss-row-between ss-m-b-20">
@@ -23,7 +23,7 @@
</view>
</view>
<!-- TODO @芋艿用户接入 -->
<!-- 提示绑定手机号 先隐藏 yudao 需要再修改 -->
<!-- <view
class="bind-mobile-box ss-flex ss-row-between ss-col-center"
@@ -1,4 +1,4 @@
<!-- -->
<!-- 装修图文组件视频播放 -->
<template>
<su-video
class="sss"
@@ -1,3 +1,4 @@
<!-- 装修用户组件用户资产 -->
<template>
<!-- TODO @惠智造代码合并有问题可以看看 -->
<view class="ss-wallet-menu-wrap ss-flex ss-col-center">
+2 -1
View File
@@ -46,8 +46,9 @@ function ShoproDebug() {
// });
// #endif
// TODO 芋艿:可以打印路由
// 同步前端页面到后端
$api.app.pageSync(ROUTES);
// console.log(ROUTES)
}
export default sheep;
+26 -29
View File
@@ -3,70 +3,67 @@
* 更多微信网页开发sdk方法,详见:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
*/
import jweixin from 'weixin-js-sdk';
import jweixin, { ready } from 'weixin-js-sdk';
import $helper from '@/sheep/helper';
import third from '@/sheep/api/third';
import AuthUtil from '@/sheep/api/member/auth';
let configSuccess = false;
export default {
//判断是否在微信中
// 判断是否在微信中
isWechat() {
const ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/micromessenger/i) == 'micromessenger') {
return true;
} else {
return false;
}
// noinspection EqualityComparisonWithCoercionJS
return ua.match(/micromessenger/i) == 'micromessenger';
},
isReady(api) {
jweixin.ready(api);
},
// 初始化JSSDK
// 初始化 JSSDK
async init(callback) {
if (!this.isWechat()) {
$helper.toast('请使用微信网页浏览器打开');
return;
}
// 调用后端接口,获得 JSSDK 初始化所需的签名
const url = location.href.split('#')[0];
const { error, data } = await third.wechat.jssdk({
platform: 'officialAccount',
payload: encodeURIComponent(
JSON.stringify({
url,
}),
),
});
if (error === 0) {
const { code, data } = await AuthUtil.createWeixinMpJsapiSignature(url);
if (code === 0) {
jweixin.config({
debug: false,
appId: data.appId,
timestamp: data.timestamp,
nonceStr: data.nonceStr,
signature: data.signature,
jsApiList: data.jsApiList,
openTagList: data.openTagList,
jsApiList: ['chooseWXPay'], // TODO 芋艿:后续可以设置更多权限;
openTagList: data.openTagList
});
}
// 监听结果
configSuccess = true;
jweixin.error((err) => {
configSuccess = false;
console.error('微信 JSSDK 初始化失败', err);
// $helper.toast('微信JSSDK:' + err.errMsg);
});
jweixin.ready(() => {
if (configSuccess) {
console.log('微信 JSSDK 初始化成功');
}
})
// 回调
if (callback) {
callback(data);
}
},
//在需要定位页面调用
//在需要定位页面调用 TODO 芋艿:未测试
getLocation(callback) {
this.isReady(() => {
jweixin.getLocation({
@@ -81,7 +78,7 @@ export default {
});
},
//获取微信收货地址
//获取微信收货地址 TODO 芋艿:未测试
openAddress(callback) {
this.isReady(() => {
jweixin.openAddress({
@@ -97,7 +94,7 @@ export default {
});
},
// 微信扫码
// 微信扫码 TODO 芋艿:未测试
scanQRCode(callback) {
this.isReady(() => {
jweixin.scanQRCode({
@@ -113,7 +110,7 @@ export default {
});
},
// 更新微信分享信息
// 更新微信分享信息 TODO 芋艿:未测试
updateShareInfo(data, callback = null) {
this.isReady(() => {
const shareData = {
@@ -137,7 +134,7 @@ export default {
});
},
// 打开坐标位置
// 打开坐标位置 TODO 芋艿:未测试
openLocation(data, callback) {
this.isReady(() => {
jweixin.openLocation({
@@ -148,7 +145,7 @@ export default {
});
},
// 选择图片
// 选择图片 TODO 芋艿:未测试
chooseImage(callback) {
this.isReady(() => {
jweixin.chooseImage({
@@ -162,7 +159,7 @@ export default {
});
},
//微信支付
//微信支付 TODO 芋艿:未测试
wxpay(data, callback) {
this.isReady(() => {
jweixin.chooseWXPay({
+13 -13
View File
@@ -8,7 +8,7 @@ import PayOrderApi from '@/sheep/api/pay/order';
/**
* 支付
*
* @param {String} payment = ['wechat','alipay','wallet','offline'] - 支付方式
* @param {String} payment = ['wechat','alipay','wallet','mock'] - 支付方式
* @param {String} orderType = ['goods','recharge','groupon'] - 订单类型
* @param {String} id - 订单号
*/
@@ -33,8 +33,8 @@ export default class SheepPay {
wallet: () => {
this.walletPay();
},
offline: () => {
this.offlinePay();
mock: () => {
this.mockPay();
}
},
WechatMiniProgram: {
@@ -47,8 +47,8 @@ export default class SheepPay {
wallet: () => {
this.walletPay();
},
offline: () => {
this.offlinePay();
mock: () => {
this.mockPay();
}
},
App: {
@@ -61,8 +61,8 @@ export default class SheepPay {
wallet: () => {
this.walletPay();
},
offline: () => {
this.offlinePay();
mock: () => {
this.mockPay();
}
},
H5: {
@@ -75,8 +75,8 @@ export default class SheepPay {
wallet: () => {
this.walletPay();
},
offline: () => {
this.offlinePay();
mock: () => {
this.mockPay();
}
},
};
@@ -182,10 +182,10 @@ export default class SheepPay {
code === 0 && this.payResult('success');
}
// 货到付款 TODO 芋艿:待接入
async offlinePay() {
const { error } = await this.prepay();
error === 0 && this.payResult('success');
// 模拟支付
async mockPay() {
const { code } = await this.prepay('mock');
code === 0 && this.payResult('success');
}
// 支付宝复制链接支付 TODO 芋艿:待接入
@@ -20,6 +20,7 @@ async function load() {
// 微信公众号登陆
async function login(code = '') {
// 获取登陆地址
debugger
if (!code) {
const loginResult = await getLoginUrl();
if (loginResult.error === 0 && loginResult.data.login_url) {
@@ -38,6 +39,7 @@ async function login(code = '') {
// 微信公众号绑定
async function bind(code = '') {
debugger
// 获取绑定地址
if (code === '') {
const loginResult = await getLoginUrl('bind');
@@ -57,6 +59,7 @@ async function bind(code = '') {
// 微信公众号解除绑定
async function unbind() {
debugger
const { error } = await third.wechat.unbind({
platform: 'officialAccount',
});
@@ -65,6 +68,7 @@ async function unbind() {
// 获取公众号登陆地址
function getLoginUrl(event = 'login') {
debugger
let page = getRootUrl() + 'pages/index/login';
return third.wechat.oauthLogin({
@@ -80,6 +84,7 @@ function getLoginUrl(event = 'login') {
// 此处使用前端发送code在后端解密,防止用户在后端过长时间停留
function loginByCode(code) {
debugger
return third.wechat.login({
platform: 'officialAccount',
shareInfo: uni.getStorageSync('shareLog') || {},
@@ -93,6 +98,7 @@ function loginByCode(code) {
// 此处使用前端发送code在后端解密,防止用户在后端过长时间停留
function bindByCode(code) {
debugger
return third.wechat.bind({
platform: 'officialAccount',
payload: encodeURIComponent(
@@ -1,5 +1,4 @@
// 登录
import { isEmpty } from 'lodash';
import third from '@/sheep/api/third';
const load = async () => {};
@@ -11,6 +10,7 @@ const login = () => {
provider: 'weixin',
onlyAuthorize: true,
});
debugger
if (loginRes.errMsg == 'login:ok') {
const res = await third.wechat.login({
platform: 'openPlatform',
+2 -2
View File
@@ -95,8 +95,8 @@ http.interceptors.request.use(
if (config.url.indexOf('/app-api/') !== -1) {
config.header['Accept'] = '*/*'
config.header['tenant-id'] = '1';
config.header['terminal'] = '20';
config.header['Authorization'] = 'Bearer test247';
config.header['terminal'] = '20';
config.header['Authorization'] = 'Bearer test247';
}
return config;
},
+5 -2
View File
@@ -61,18 +61,21 @@ const app = defineStore({
$router.error('NetworkError');
}
// 加载装修配置
await adaptTemplate(this.template, templateId)
const res = await appApi.init(templateId);
if (res.error === 0) {
this.info = res.data.app;
this.platform = res.data.platform;
// TODO 芋艿:未接入
// this.template = res.data.template;
this.has_wechat_trade_managed = res.data.has_wechat_trade_managed;
// this.has_wechat_trade_managed = res.data.has_wechat_trade_managed;
// if (!res.data.template) {
// $router.error('TemplateError');
// }
this.chat = res.data.chat;
// TODO 芋艿:未接入
// this.chat = res.data.chat;
// 加载主题
const sysStore = sys();
+1
View File
@@ -1,3 +1,4 @@
<!-- 自定义导航栏 -->
<template>
<view class="uni-navbar" :class="{ 'uni-dark': dark }">
<view
+1
View File
@@ -1,3 +1,4 @@
<!-- 公告栏组件 -->
<template>
<view
v-if="show"
+1 -1
View File
@@ -1,10 +1,10 @@
<!-- 自定义状态栏 -->
<template>
<view :style="{ height: statusBarHeight }" class="uni-status-bar"><slot /></view>
</template>
<script setup>
import sheep from '@/sheep';
import { computed } from 'vue';
const statusBarHeight = sheep.$platform.device.statusBarHeight + 'px';
</script>
@@ -1,3 +1,4 @@
<!-- 自定义底部导航项 -->
<template>
<view class="u-tabbar-item" :style="[addStyle(customStyle)]">
<view v-if="isCenter" class="tabbar-center-item">
+1
View File
@@ -1,3 +1,4 @@
<!-- 底部导航栏 -->
<template>
<view class="u-tabbar">
<view