Commit 3967d642 by Sweet Zhang

分享好友海报有订单计入销售佣金,菜单调整

parent 115c9a77
<template>
<view class="pdf-container">
<!-- 顶部导航 -->
<view class="pdf-header">
<button class="back-btn" @click="onBack">
<uni-icons type="back" size="28" color="#333"></uni-icons>
</button>
<text class="pdf-title">{{ title }}</text>
<view class="empty-btn"></view> <!-- 占位,使标题居中 -->
</view>
<!-- PDF查看区域 -->
<view class="pdf-content">
<template v-if="isLoading">
<view class="loading">
<uni-loading-icon type="spin" size="40"></uni-loading-icon>
<text class="loading-text">加载中...</text>
</view>
</template>
<template v-else-if="errorMsg">
<view class="error">
<uni-icons type="error" size="40" color="#f53f3f"></uni-icons>
<text class="error-text">{{ errorMsg }}</text>
</view>
</template>
<template v-else>
<web-view
:src="pdfUrl"
@message="handleMessage"
class="web-view"
></web-view>
</template>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onLoad, onReady } from 'vue';
import { onBackPress } from '@dcloudio/uni-app';
// 接收参数
const title = ref('');
const url = ref('');
const isLoading = ref(true);
const errorMsg = ref('');
const pdfUrl = ref('');
// 页面加载时获取参数
onLoad((options: { title?: string; url?: string }) => {
if (options.title) {
title.value = decodeURIComponent(options.title);
}
if (options.url) {
url.value = decodeURIComponent(options.url);
loadPdf();
} else {
errorMsg.value = '未找到PDF文件';
isLoading.value = false;
}
});
// 加载PDF文件
const loadPdf = () => {
// 使用PDF.js viewer加载PDF,并禁用下载功能
// 注意:需将pdfjs的web/viewer.html放入项目的static目录
const viewerPath = '/static/pdfjs/web/viewer.html';
const fileUrl = `${viewerPath}?file=${encodeURIComponent(url.value)}&disableDownload=true`;
// 本地PDF需要转换为网络路径
if (url.value.startsWith('/static/')) {
// 转换为绝对路径
const absoluteUrl = `${location.origin}${url.value}`;
pdfUrl.value = `${viewerPath}?file=${encodeURIComponent(absoluteUrl)}&disableDownload=true`;
} else {
pdfUrl.value = fileUrl;
}
isLoading.value = false;
};
// 处理web-view消息
const handleMessage = (e: any) => {
const data = e.detail.data[0];
if (data.action === 'error') {
errorMsg.value = data.message || 'PDF加载失败';
isLoading.value = false;
}
};
// 返回按钮
const onBack = () => {
uni.navigateBack();
};
// 监听物理返回键
onBackPress(() => {
onBack();
return true;
});
</script>
<style scoped>
.pdf-container {
display: flex;
flex-direction: column;
height: 100vh;
background-color: #000;
}
.pdf-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 30rpx;
background-color: #fff;
border-bottom: 1px solid #eee;
}
.back-btn {
width: 60rpx;
height: 60rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
background-color: transparent;
}
.pdf-title {
font-size: 32rpx;
font-weight: 500;
color: #333;
flex: 1;
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 20rpx;
}
.empty-btn {
width: 60rpx;
height: 60rpx;
}
.pdf-content {
flex: 1;
position: relative;
}
.web-view {
width: 100%;
height: 100%;
}
.loading {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
}
.loading-text {
color: #fff;
font-size: 28rpx;
margin-top: 20rpx;
}
.error {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
padding: 0 40rpx;
text-align: center;
}
.error-text {
color: #fff;
font-size: 28rpx;
margin-top: 20rpx;
}
</style>
......@@ -49,7 +49,7 @@ const config = {
stage,
prod
}
let env = 'dev';
let env = 'prod';
let baseURL = config[env].base_url;
let apiURL = config[env].api_url;
......
......@@ -476,13 +476,6 @@
}
},
{
"path" : "components/pdf-viewer/pdf-viewer",
"style" :
{
"navigationBarTitleText" : "查看"
}
},
{
"path" : "pages/personalCenter/detail",
"style" :
{
......
......@@ -299,6 +299,7 @@
},
data() {
return {
sharePosterObj:{},
userInfo: {},
wayType:'1', //登陆的类型
partnerType:'',//是否是合伙人
......@@ -1370,6 +1371,10 @@
},
onLoad(option) {
this.sharePosterObj = uni.getStorageSync('sharePosterObj') || {};
// console.log('sharePosterObj======',this.sharePosterObj);
// 如果通过海报分享进入系统,海报分享人为合伙人且普通客户完成购买了,那么海报分享人可以获得销售佣金
this.shareUserId = this.sharePosterObj.inviteUserId || '';
if(companyInfo.companyType == '1'){
this.companyLogo='../../static/myteam/Group1633.png';
}else if(this.companyType == '2'){
......
......@@ -220,10 +220,14 @@
],
},{id:'03',categoryName:'学习研讨',
children:[
{title:'公司介绍',icon:'icon-gongsi',link:'/pages/personalCenter/detail',isOpen:true,isShow:true,identity:true,type:1},
{title:'案例分享',icon:'icon-shiyongjiaocheng',link:'/pages/personalCenter/detail',isOpen:true,isShow:true,identity: true,type:2},
{title:'产品分析',icon:'icon-shujufenxi',link:'/pages/personalCenter/detail',isOpen:true,isShow:true,identity: true,type:3},
{title:'制度',icon:'icon-xiaoshoue',link:'/pages/personalCenter/detail',isOpen:true,isShow:true,identity: true,type:4},
{key:'company-intro',title:'公司介绍',icon:'icon-gongsi',link:'/pages/personalCenter/detail',isOpen:true,isShow:true,identity:true,type:1},
{key:'policies',title:'制度',icon:'icon-xiaoshoue',link:'/pages/personalCenter/detail',isOpen:true,isShow:false,identity: true,type:4},
{key:'products',title:'产品分析',icon:'icon-shujufenxi',link:'/pages/personalCenter/detail',isOpen:true,isShow:false,identity: true,type:3},
{key:'cases',title:'案例分享',icon:'icon-shiyongjiaocheng',link:'/pages/personalCenter/detail',isOpen:true,isShow:false,identity: true,type:2},
],
},{id:'04',categoryName:'海外资产配置',
children:[
{title:'积分明细',icon:'icon-yongjin',link:'/pages/personalCenter/helpCenter',isOpen:false,isShow:true,islogin:true}
],
},
{id:'02',categoryName:'帮助',
......@@ -619,11 +623,48 @@
}
});
},
setSpecificMenuIsShow(mainMenus,permKeys){
// 找到id=03的主菜单
const targetMenu = mainMenus.find(menu => menu.id === '03');
if(permKeys){
// 提取权限数组中的key
const validKeys = permKeys.map(item => item.key);
if (targetMenu && targetMenu.children) {
// 只遍历该菜单的children
targetMenu.children.forEach(subMenu => {
if (subMenu.key && validKeys.includes(subMenu.key)) {
subMenu.isShow = true;
}else{
subMenu.isShow = false;
}
});
}
}else{
if (targetMenu && targetMenu.children) {
// 只遍历该菜单的children
targetMenu.children.forEach(subMenu => {
// 只有当key不是'company-intro'时,才设置isShow为false
if (subMenu.key !== 'company-intro') {
subMenu.isShow = false;
}
});
}
}
return mainMenus;
},
// 查询个人资料
queryInfo(){
api.queryInfo({userId:uni.getStorageSync('cffp_userId')}).then(res=>{
if(res['success']){
this.customerBasicInfo = res['data'];
// id=03的权限设置
// 执行处理
const result = this.setSpecificMenuIsShow(this.mainMenuLists, this.customerBasicInfo.accessPermission);
// 输出结果(仅展示id=03的children验证效果)
// console.log('处理后的"学习研讨"子菜单:',
// JSON.stringify(result.find(menu => menu.id === '03')?.children, null, 2));
let name = this.customerBasicInfo.realName || this.customerBasicInfo.nickName
if(name && name.length>4){
this.showMyName = name.substring(0, 4) + '...'
......
......@@ -48,8 +48,8 @@
<!-- 分享明细 -->
<view class="saleDetailContent" :style="{flex:userCourses.length<=0 || userShareCourseOrders.length <=0 ?'1':''}">
<view class="courseTab">
<text :class="{'actived':tabType===1}" @click="switchTab(1)">我的订单</text>
<text :class="{'actived':tabType===2}" @click="switchTab(2)">分享订单</text>
<text :class="{'actived':tabType===1}" @click="switchTab(1)">我的订单</text>
</view>
<view class="totalCountBox">合计(单):<text>{{userCourseCountNum}}</text></view>
<h4 class="noListTip" v-if="!userCourses || userCourses.length<=0 && tabType===1">暂无购买记录!</h4>
......@@ -134,7 +134,7 @@
userShareCourseOrders:[],
userCourseCountNum:0,
userShareCourseCount:0,
tabType:1,
tabType:2,
partnerType:''
}
},
......
......@@ -5914,6 +5914,7 @@ body.wait::before{
.toolbar{
z-index:2;
display:none !important;
}
#toolbarSidebar{
......
......@@ -114,7 +114,8 @@ const whiteApiList = [`${apiURL}/authorize/obtainToken`,
export const interceptor = () => {
uni.addInterceptor('request', {
// 请求拦截器
invoke(args) {
invoke(args) {
// alert(JSON.stringify(args))
// 当本地没有token,并且接口地址没在白名单内,需要重新获取token
if (!uni.getStorageSync('uni-token') && !whiteApiList.includes(args.url)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment