Commit e073acad by yuzhenWang

Merge branch 'feature-20261013wyz-解决加盟的问题' into 'test'

Feature 20261013wyz 解决加盟的问题

See merge request !137
parents 269725e0 5f9deeb6
......@@ -6,6 +6,18 @@
import api from './api/api';
import {hshare} from '@/util/fiveshare';
import dataHandling from "@/util/dataHandling";
import { useH5IdleExit } from '@/util/useH5IdleExit'
const idleExit = useH5IdleExit()
let isAllInOneEnv = false
function resolveAllInOne(options) {
const fromQuery = options?.query?.bagType || ''
if (fromQuery) return fromQuery === 'allinone'
const q = window.location.search || ''
const m = q.match(/[?&]bagType=([^&]+)/)
return m ? decodeURIComponent(m[1]) === 'allinone' : false
}
export default {
data() {
return {
......@@ -14,8 +26,16 @@
loginType:''
}
},
onLaunch: function() {
onLaunch: function(options) {
console.log('App Launch');
//----嵌入一体机开启超时自动退出-----
isAllInOneEnv = resolveAllInOne(options)
window.addEventListener('pagehide', () => idleExit.stop())
window.addEventListener('beforeunload', () => idleExit.stop())
//----嵌入一体机开启超时自动退出-----
if(uni.getStorageSync('loginType')){
this.loginType = uni.getStorageSync('loginType')
}
......@@ -73,6 +93,16 @@
},
onShow: function(options) {
//----嵌入一体机开启超时自动退出-----
isAllInOneEnv = resolveAllInOne(options)
if (isAllInOneEnv) {
idleExit.start()
idleExit.reset()
}
//----嵌入一体机开启超时自动退出-----
console.log('App Show', options);
// 每次进应用显示时检查用户状态
this.checkUserStatus();
......@@ -84,8 +114,13 @@
// #endif
},
onHide: function() {
// 切后台/息屏/H5 被隐藏:停掉,避免后台跑定时器
idleExit.stop()
console.log('App Hide')
},
onUnload() {
idleExit.stop()
},
methods: {
// 检查用户状态的方法 防止多端操作导致此用户不存在
......
......@@ -62,6 +62,7 @@
}
});
</script>
<title>银盾家办</title>
<link rel="stylesheet" href="./static/font/iconfont.css">
<link rel="shortcut icon" href="./static/suplogo.ico">
......@@ -70,6 +71,52 @@
<div id="app">
<!--app-html-->
</div>
<script>
(function() {
// 1. 判断是否在 App WebView 中
function isAppWebView() {
// 检测 5+ App(plus 对象)
if (typeof window.plus !== 'undefined') {
return true;
}
// 检测 UserAgent
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('html5plus') !== -1 || ua.indexOf('uni-app') !== -1) {
return true;
}
// 检测 uni-app 注入的全局对象(部分版本)
if (typeof window.__uni__ !== 'undefined') {
return true;
}
return false;
}
if (isAppWebView()) {
console.log('[环境] 检测到 App WebView,开始加载 uni.webview.js');
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = '/appYdhomeoffice/static/uni.webview.1.5.4.js';
script.onload = function() {
// 脚本加载成功后,执行原有逻辑(挂载 webViewJs)
var webViewJs = window.uni?.webView;
if (!webViewJs) {
console.error('uni.webview.js 加载成功但 webViewJs 不存在');
} else {
console.log('uni.webview.js 加载成功', webViewJs);
window.webViewJs = webViewJs;
console.log('window.webViewJs 已挂载', window);
}
};
script.onerror = function() {
console.error('uni.webview.js 加载失败,请检查路径');
};
document.head.appendChild(script);
} else {
console.log('[环境] 非 App WebView,跳过加载 uni.webview.js');
}
})();
</script>
<script type="module" src="/main.js"></script>
</body>
......
......@@ -74,7 +74,7 @@
<everyJoinPopup ref="everyJoinPopup" @continue="jumpPage" :showCanel="false" />
<!-- 成功加盟为合伙人提示弹窗组件 -->
<everyJoinPopup ref="successJoinPopup" @continue="jumpPage(e)" content="您已加盟为银盾家办合伙人"
twoContent='购买一单"财务健康智能体检"即可升级为新锐合伙人,享受组织利益' continueText="前往购买" cancelText="暂不购买,继续浏览" fontColor="#20279B"
twoContent='购买任一产品即可升级为新锐合伙人,享受组织利益' continueText="前往购买" cancelText="暂不购买,继续浏览" fontColor="#20279B"
:maskClick="false" icon="icon-dianzan" iconSize='80rpx' :showCanel="true" />
</view>
</template>
......@@ -120,7 +120,8 @@
restrictedOrCanelContent: '', //禁用/注销展示文本
sharePosterObj: { invitationCode: '', inviteUserId: '' }, //通过分享海报进来
showVerificationCode: false, //验证码是否展示,
miniShare:''//是否通过小程序分享邀请加盟进入
miniShare:'',//是否通过小程序分享邀请加盟进入
isInMiniProgram:dataHandling.h5RuntimeEnv()=="wechat-miniprogram"
}
},
......@@ -180,8 +181,12 @@
}, window.location.href);
// #endif
} else {
if(!this.isInMiniProgram){
this.showVerificationCode = true
}
// this.showVerificationCode = true
}
},
methods: {
......@@ -220,8 +225,9 @@
// uni.setStorageSync('loginType', 'visitor')
// return
// }
// 之前登录过,但和申请加盟的账号不一致
if (this.userInfo && (this.userInfo.mobile !== this.form.mobile)) {
// 没有运行在微信小程序内,才走这段
if (!this.isInMiniProgram&&this.userInfo && (this.userInfo.mobile !== this.form.mobile)) {
this.showVerificationCode = true
uni.setStorageSync('loginType', 'visitor')
this.loginType = 'visitor'
......
......@@ -7,6 +7,7 @@
<view class="introduct">
<!-- 名片标题 -->
<view class="introductTitle"></view>
{{environment}}
<view class="introductHeader">
<view class="left">
<view class="shield-bg"></view>
......@@ -242,9 +243,10 @@
<view class="codeBox">
<image v-if="cardInfo.qwQrcode" :src="cardInfo.qwQrcode" mode="widthFix"
style="width:250rpx !important;"></image>
<image v-else src="/myPackageA/assets/images/kefu.png" mode="widthFix"
<!-- <image v-else src="/myPackageA/assets/images/kefu.png" mode="widthFix"
style="width:250rpx !important;">
</image>
</image> -->
<image v-else style="width:250rpx !important;" :src=" `${shareURL}/static/images/kefu.png`" mode="widthFix"></image>
</view>
<view class="description">
长按识别二维码 保存或分享图片
......@@ -310,6 +312,7 @@
};
import { initJssdkShare, setWechatShare, hshare } from '@/util/fiveshare';
import { shareURL, companyInfo } from "@/environments/environment";
import api from "@/api/api";
import BootPage from "@/components/bootpage/bootpage.vue";
import dataHandling from "@/util/dataHandling";
......@@ -324,6 +327,7 @@
},
data() {
return {
shareURL: shareURL, // 或者简写为 shareURL,
visitorUuid: '',
sharelogin: false, //是否需要登录
isLogin: true, //登录状态
......
......@@ -515,6 +515,12 @@
result.forEach(item=>{
this.idTypesList.push({name:item.dropOptionName,id:item.dropOptionCode})
})
this.showUnbind = false
this.realInfo={
shiming:{},//实名信息
wx:{},// 微信信息
zhifubao:{}//支付宝信息
}
this.getImproveInfo()
}
})
......
......@@ -117,6 +117,7 @@
<script>
import api from '../../api/api';
import dataHandling from "@/util/dataHandling";
import wx from 'weixin-js-sdk'
export default{
data(){
......@@ -245,7 +246,17 @@
});
// #endif
// #ifndef MP-WEIXIN
// window.open('https://work.weixin.qq.com/kfid/kfc08c55f4170e7fc9e')
if (uni.getStorageSync('mpCffp') == '1') {
let d = {
corpId: 'ww43cac1cf9dd6a3d0', //企业微信ID
url: 'https://work.weixin.qq.com/kfid/kfc08c55f4170e7fc9e', //企业微信客户接入链接
}
let p = Object.keys(d).reduce((p, k, i) => p + `${i ? '&' : '?'}${k}=${d[k]}`, '');
wx.miniProgram.reLaunch({ url: `/pages/index/homePage${p}` }); //触发小程序刷新页面获取appId
} else {
window.open('https://work.weixin.qq.com/kfid/kfc08c55f4170e7fc9e')
}
// #endif
},
goBack() {
......@@ -294,17 +305,19 @@
//支付宝去提现
aliWithdrawal(){
this.readonlyFlag = true;
let aliWithdrawalResVOParam = {}
//#ifdef H5
let aliWithdrawalResVOParam = {
aliWithdrawalResVOParam = {
...this.aliWithdrawalResVO,
dataSource:2,
orderNo:this.partnerTradeNo,
amount:this.exchangeAmount,
userId:uni.getStorageSync('cffp_userId'),
desc:'大于5万',
}
//#endif
// #ifdef APP-PLUS
let aliWithdrawalResVOParam = {
aliWithdrawalResVOParam = {
...this.aliWithdrawalResVO,
dataSource:2,
orderNo:this.partnerTradeNo,
......
......@@ -938,12 +938,34 @@
color: #333333;
}
.position, .leavelName{
// padding: 10rpx 15rpx;
// border-radius: 5rpx;
// border: 1rpx solid #FFBB00;
// font-size: 26rpx;
// color: #FFBB00;
position: relative;
padding: 10rpx 15rpx;
border-radius: 5rpx;
border: 1rpx solid #FFBB00;
/* 去掉原来的 border */
border: none;
font-size: 26rpx;
color: #FFBB00;
}
.position::after,
.leavelName::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 200%;
height: 200%;
border: 2rpx solid #FFBB00;
border-radius: 10rpx; /* 圆角要放大一倍,缩放后才是 5rpx */
transform: scale(0.5);
transform-origin: 0 0;
box-sizing: border-box;
pointer-events: none; /* 不影响点击 */
}
.position{
margin: 0rpx 15rpx;
}
......@@ -1039,12 +1061,33 @@
}
.nameLevel{
// padding: 5rpx 15rpx;
// border-radius: 5rpx;
// border: 1px solid #FFBB00;
// font-size: 25rpx;
// color: #FFBB00;
position: relative;
padding: 5rpx 15rpx;
border-radius: 5rpx;
border: 1rpx solid #FFBB00;
/* 移除原来的 border,用伪元素模拟 */
border: none;
font-size: 25rpx;
color: #FFBB00;
}
.nameLevel::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 200%;
height: 200%;
border: 2rpx solid #FFBB00;
border-radius: 10rpx; /* 圆角也要相应放大,确保缩放后一致 */
transform: scale(0.5);
transform-origin: 0 0;
box-sizing: border-box;
pointer-events: none; /* 确保伪元素不影响点击 */
}
}
.bottom{
font-size: 24rpx;
......@@ -1057,6 +1100,8 @@
.right{
display: flex;
align-items: center;
justify-content: space-between;
width: 120rpx;
.rNum{
color: #333333;
font-size: 28rpx;
......
......@@ -656,6 +656,10 @@
url: featureItem.link
})
}else {
if (dataHandling.h5RuntimeEnv() == 'wechat-miniprogram') {
this.jumpMplogin()
return
}
uni.navigateTo({
url:'/myPackageA/login/login'
})
......@@ -829,6 +833,25 @@
})
uni.hideLoading()
},
jumpMplogin(){
let currentUrl =
`${shareURL}/pages/lanch/index?landingPage=index&noShare=1`;
let data = {
type:'login',
h5SystemType:'cffp',
link: encodeURIComponent(currentUrl),
}
wx.miniProgram.postMessage({
data:{
type:'login',
shareData:JSON.stringify(data)
}
})
wx.miniProgram.navigateBack({
delta:1
})
}
},
......
......@@ -98,6 +98,10 @@
visitorUuid:uni.getStorageSync('visitorUuid')?uni.getStorageSync('visitorUuid'):dataHandling.uuid()
}
api.loginVerification(params).then((res) => {
uni.hideLoading()
// uni.showModal({
// content:`${JSON.stringify(res)}`
// })
if (res['success']) {
// 账号禁用用户
if(res.data.userIsActive&&res.data.userIsActive==2){
......
......@@ -213,7 +213,8 @@
dataToken: '',
oldToken: '', //原始用户token
pollTimer: '',
runEnv: dataHandling.h5RuntimeEnv()
runEnv: dataHandling.h5RuntimeEnv(),
}
},
computed: {
......@@ -356,9 +357,10 @@
}
let _this = this
param.isPayOrAuth = 1;
uni.showToast({
content:`微信支付:${JSON.stringify(param)}`
})
// uni.showModal({
// content:`微信支付:${JSON.stringify(param)}`
// })
// return
api.wxAuthorize(param).then((res) => {
_this.paymentBtnDisabled = false;
......
......@@ -7,7 +7,7 @@
<text class="iconfont icon-youjiantou zuojiantou" @click="goBack()" style="top: 30rpx;"></text>
<!-- #endif -->
<view class="banner">
<view class="banner" id="banner">
<!--头部技术支持组件-->
<!-- <commonHead></commonHead> -->
<image src="../../static/images/childEduBanner.jpg" mode="widthFix"></image>
......@@ -106,12 +106,12 @@
</view>
</view>
<!-- 测算结果及建议 -->
<view class="title"><view>测算结果及建议</view></view>
<view class="title" id="resultTitle"><view>测算结果及建议</view></view>
<!-- 图表 -->
<!-- 为 ECharts 准备一个定义了宽高的 DOM -->
<!-- <view id="main" style="width:96vw;height:400px" v-if="resultInfo"></view> -->
<l-echart ref="chart" @finished="init" v-if="resultInfo"></l-echart>
<view class="summaryContent" v-if="resultInfo">
<l-echart ref="chart" @finished="init" v-if="resultInfo" style="height: 450rpx;width: 100%;"></l-echart>
<view class="summaryContent" v-if="resultInfo" id="summaryContent">
<view class="successInfo" v-if="resultInfo.code=='B001'">
<strong>恭喜您!</strong>
<text>经过测算,您的资金可以负担{{eduPlanParam.name}}同学从{{getClassesInfo(getEducationNo(eduPlanParam.startPlan))}}到{{getClassesInfo(getEducationNo(eduPlanParam.endPlan))}}阶段的上学费用。</text>
......@@ -130,13 +130,26 @@
</view>
</view>
</view>
<view class="backTop" @click="scrollToResult('#banner')">
<view class="backTxt">
回到顶部
</view>
</view>
</view>
<!-- 操作 -->
<view class="optionContent">
<button type="default" plain="true" form-type="reset"
@click="resetData()" >全部清空</button>
<button type="default" plain="true"
class="sfp_btn" @click="educationEstimate()">开始计算</button>
<button
type="default"
plain="true"
class="sfp_btn"
@click="educationEstimate()"
:loading="counting"
:disabled="counting"
>
{{ counting ? '计算中...' : '开始计算' }}
</button>
</view>
</scroll-view>
......@@ -185,6 +198,7 @@
},
data() {
return {
counting: false,
accountBalanceEnd:[],
currentYearExpenditure:[],
xAxisLists:[],
......@@ -298,43 +312,82 @@
// var myChart = echarts.init(document.getElementById('main'));
// 指定图表的配置项和数据
this.option = {
// title: {},
// tooltip: {
// trigger: 'axis',
// axisPointer: {
// type: 'cross',
// label: {
// backgroundColor: '#6a7985'
// }
// }
// },
// legend: {
// data: ['教育金账户', '学费现金流'],
// left:'1%'
// },
// grid: {
// left: '2%',
// containLabel: true
// },
// xAxis: [
// {
// type: 'category',
// boundaryGap: false,
// axisLabel:{
// interval:0,
// rotate:60
// },
// textStyle:{
// fontSize:10
// },
// data: this.xAxisLists
// }
// ],
// yAxis: [
// {
// type: 'value'
// }
// ],
title: {},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
label: { backgroundColor: '#6a7985' }
}
},
legend: {
data: ['教育金账户', '学费现金流'],
left:'1%'
top: 0, // 贴顶,别占多余空间
left: '1%',
itemHeight: 8, // 图例图标小一点
itemWidth: 14,
textStyle: { fontSize: 11 }
},
grid: {
left: '2%',
right: '3%',
top: 28, // 给 legend 留 28px 就够,别用默认 60
bottom: 8, // 底部只留一点,标签高度由 containLabel 自动算
containLabel: true
},
xAxis: [
{
xAxis: [{
type: 'category',
boundaryGap: false,
axisLabel:{
interval:0,
rotate:60
},
textStyle:{
fontSize:10
axisLabel: {
interval: 0,
rotate: 45, // 60 → 45,占高明显下降
fontSize: 10,
margin: 6 // 标签离轴线的距离,默认 8,改小更省
},
data: this.xAxisLists
}
],
yAxis: [
{
type: 'value'
}
],
}],
yAxis: [{
type: 'value',
axisLabel: { fontSize: 10 },
splitNumber: 4 // 减少水平网格线条数,视觉更清爽
}],
series: [
{
name: '教育金账户',
......@@ -430,6 +483,7 @@
return flated;
},
educationEstimate(){
if(this.counting) return;
this.flatEduGradeLists = JSON.parse(JSON.stringify(this.objFlat(this.schoolingLists)))
this.flatEduGradeLists.map((val,idx)=>{
val['educationNo'] = idx + 1;
......@@ -480,12 +534,15 @@
educationTuitionInfos:flatSchoolingLists,
initEducationFund:this.eduPlanParam.initEducationFund * Math.pow(10,4),
educationDeposit:this.eduPlanParam.educationDeposit * Math.pow(10,4),
userId:uni.getStorageSync('cffp_userId'),
// userId:uni.getStorageSync('cffp_userId'),
systemType:1
}
this.counting = true; // 校验通过后再开启,避免校验失败也转圈
api.educationEstimate(param).then(res=>{
this.counting = false;
this.resultInfo = res['data'];
if(res['success']){
uni.showToast({ title: '计算完成', icon: 'none', duration: 1000 });
this.currentYearExpenditure = [];
this.accountBalanceEnd = [];
this.xAxisLists = [];
......@@ -496,6 +553,7 @@
this.xAxisLists.push(result[i]['educationNo'] ? this.getClassesInfo(result[i]['educationNo']) : result[i]['planyear'])
}
setTimeout(()=>{this.drawLine()},0)
this.scrollToResult('#resultTitle')
}else{
this.currentYearExpenditure = [];
this.accountBalanceEnd = [];
......@@ -505,6 +563,21 @@
}
})
},
// 滚动到指定位置
scrollToResult(dom){
setTimeout(() => {
uni.createSelectorQuery().in(this)
.select(dom).boundingClientRect()
.selectViewport().scrollOffset()
.exec((res) => {
if (!res || !res[0] || !res[1]) return;
uni.pageScrollTo({
scrollTop: res[0].top + res[1].scrollTop - 20,
duration: 300
});
});
}, 100);
},
resetData(){
this.eduPlanParam = {
name:'',
......@@ -576,4 +649,23 @@
<style scoped>
@import '../sfpCommon.css';
@import url("childEdu.css");
.backTop{
width: 100%;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
margin: 30rpx 0;
.backTxt{
padding: 30rpx 50rpx;
border: 1px solid rgba(179, 179, 179, 1);
color: rgba(97, 97, 97, 1);
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50rpx;
}
}
</style>
......@@ -6,15 +6,15 @@
<text class="iconfont icon-youjiantou zuojiantou" @click="goBack()" style="top: 30rpx;"></text>
<!-- #endif -->
<view class="banner">
<view class="banner" id="banner">
<!--头部技术支持组件-->
<!-- <commonHead></commonHead> -->
<image src="../../static/images/banner.png" mode="widthFix"></image>
</view>
<scroll-view scroll-y="true" class="formInfoContainer" id="formInfoContainer">
<scroll-view scroll-y="true" class="formInfoContainer" id="formInfoContainer" >
<form>
<!--需求信息-->
<view class="demandInfo">
<view class="demandInfo" >
<view class="title">
<view>
需求信息
......@@ -143,12 +143,22 @@
<view class="optionContent">
<button type="default" plain="true" form-type="reset"
@click="resetData()" >全部清空</button>
<button type="default" plain="true"
class="sfp_btn" @click="startCount()">开始计算</button>
<!-- <button type="default" plain="true"
class="sfp_btn" @click="startCount()">开始计算</button> -->
<button
type="default"
plain="true"
class="sfp_btn"
@click="startCount()"
:loading="counting"
:disabled="counting"
>
{{ counting ? '计算中...' : '开始计算' }}
</button>
</view>
</form>
<!--测算结果-- v-show="resultFlag"-->
<view class="result_wrapper" v-if="resultFlag">
<!--测算结果 v-show="resultFlag"-->
<view class="result_wrapper" v-if="resultFlag" id="resultArea">
<!-- <view class="result_wrapper"> -->
<view class="suggestInfo">
<view class="title">
......@@ -168,7 +178,7 @@
</view>
<!-- <view style="height: 450rpx;width: 500rpx;border: 1rpx solid #c3c1c1;"> -->
<!-- <view id="myEcharts"></view> -->
<l-echart ref="chart" @finished="init"></l-echart>
<l-echart ref="chart" @finished="init" style="height: 450rpx;width: 100%;"></l-echart>
<!-- </view> -->
<!-- <view class="linechart">
<Echarts ref="echart" :option="option" style="height: 300px;"></Echarts>
......@@ -248,7 +258,13 @@
经过测算,距离实现您的{{getResultTitle(houseItem.priceType)}}目标还差{{Math.abs(formatFloat(houseItem.fvDifference/10000))}}万元。您可以参考我们给出的建议进行调整。
</view>
</view>
<view class="backTop" @click="scrollToResult('#banner')">
<view class="backTxt">
回到顶部
</view>
</view>
</view>
</scroll-view>
<!--底部技术支持组件-->
<!-- <foot></foot> -->
......@@ -285,6 +301,7 @@
export default{
data(){
return{
counting: false,
chartsLegendsCurrent: '1',
chartsLegends:[{
value: '1',
......@@ -319,7 +336,7 @@
cityName:null,
preOrderSize:null,//预购面积
targetPrice:null,//目标价格(现值)
downPaymentMin:30,//首付款最低成数(百分位)
downPaymentMin:15,//首付款最低成数(百分位)
newLoanYear:null,//新房贷款年限【必须大于0】
firstHouseAmount:null,//初期购房资金(单位万)
housePurchaseType:2,//购房用途
......@@ -524,10 +541,53 @@
}
}
}
// this.option = {
// legend: {}, // 若不需要图例可改成 legend: { show: false }
// grid: {
// left: '15%',
// right: '4%', // 右侧别留太多,否则柱子区被压窄
// top: 20, // 给 legend 留一点点就够(默认 60 太大)
// bottom: 10, // 底部只留一点,x 轴标签高度用 containLabel 自动算
// containLabel: true // 让 x 轴标签自动被算进 grid,不会被裁
// },
// xAxis: {
// type: 'category', // 建议显式写 type,更稳妥
// data: dataOption,
// axisTick: { show: false },
// axisLabel: {
// interval: 0, // 强制显示全部标签
// fontSize: 10,
// margin: 6 // 标签离轴线的距离,默认 8,改小省高度
// }
// },
// yAxis: {
// type: 'value',
// axisLabel: { fontSize: 10 },
// splitNumber: 4 // 少几条横向网格线,视觉更清爽
// },
// series: [
// {
// name: '',
// data: showLists,
// type: 'bar',
// barMaxWidth: 24, // 防止柱子过宽,视觉更饱满
// label: {
// show: true,
// position: 'inside',
// fontSize: 10
// }
// }
// ]
// };
this.option = {
legend: {},
grid: {
left: '20%', // 调整这个属性
// left: '20%', // 调整这个属性
left: '8%',
right: '4%', // 右侧别留太多,否则柱子区被压窄
top: 20, // 给 legend 留一点点就够(默认 60 太大)
bottom: 10, // 底部只留一点,x 轴标签高度用 containLabel 自动算
containLabel: true
},
xAxis: {
data: dataOption,
......@@ -586,7 +646,22 @@
housePurchase(id){
this.housePurchaseInfo.housePurchaseType = id;
},
scrollToResult(dom){
setTimeout(() => {
uni.createSelectorQuery().in(this)
.select(dom).boundingClientRect()
.selectViewport().scrollOffset()
.exec((res) => {
if (!res || !res[0] || !res[1]) return;
uni.pageScrollTo({
scrollTop: res[0].top + res[1].scrollTop - 20,
duration: 300
});
});
}, 100);
},
startCount(){
if(this.counting) return;
if(!this.housePurchaseInfo.nyear){
common.errorDialog(1,'请填写几年后购房')
return false;
......@@ -671,10 +746,14 @@
calcuteType:0,
decimal:4,
systemType:1,
userId:uni.getStorageSync('cffp_userId')
// userId:uni.getStorageSync('cffp_userId')
}
this.counting = true; // 校验通过后再开启,避免校验失败也转圈
api.housePurchasePlanAnalysis(param).then((res)=>{
this.counting = false;
if(res['success']){
// 👇 加这一行
uni.showToast({ title: '计算完成', icon: 'none', duration: 1000 });
this.resultFlag = true;
this.resultInfos = res['data'];
this.housePurchasePrices = res['data']['housePurchasePrices'];
......@@ -689,6 +768,8 @@
setTimeout(()=>{
this.drawLine(this.chartsLegendsCurrent)
});
// 计算完成后触发滚动
this.scrollToResult("#resultArea");
}else{
if(res['data']['code']==='E000'){
this.isNeedOfficialAccountQrcode = true;
......@@ -792,6 +873,24 @@
<style scoped lang="scss">
@import '../sfpCommon.css';
.wrapper{
.backTop{
width: 100%;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
margin: 30rpx 0;
.backTxt{
padding: 30rpx 50rpx;
border: 1px solid rgba(179, 179, 179, 1);
color: rgba(97, 97, 97, 1);
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50rpx;
}
}
.houseInfo .title{
padding-left: 0;
justify-content: space-between;
......
......@@ -595,7 +595,7 @@
withdrawalType:this.withdrawalType?'1':'2',
decimal: 5,
systemType:1,
userId:uni.getStorageSync('cffp_userId')
// userId:uni.getStorageSync('cffp_userId')
};
api.irrAndSimpleCalcute(params).then(res=>{
if(res.success === true){
......
......@@ -32,6 +32,7 @@ export function wrapTouch(event) {
return event;
}
export const devicePixelRatio = wx.getSystemInfoSync().pixelRatio
// export const devicePixelRatio = uni.getSystemInfoSync().pixelRatio
// #endif
// #ifdef APP-NVUE
export function base64ToPath(base64) {
......
......@@ -449,6 +449,6 @@ export default{
const v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
},
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ import dataHandling from './dataHandling'
import { initJssdkShare, setWechatShare } from '@/util/fiveshare';
import { shareURL } from "@/environments/environment";
import wx from 'weixin-js-sdk'
import { nanoid } from 'nanoid';
//只要是未登录状态,想要跳转到名单内的路径时,直接跳到登录页
// 页面白名单,不受拦截
const whiteList = [
......@@ -52,7 +53,8 @@ export default function initApp() {
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
shareData: JSON.stringify(shareInfo),
messageId: nanoid() // 唯一消息ID
}
})
......@@ -172,7 +174,8 @@ export default function initApp() {
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
shareData: JSON.stringify(shareInfo),
messageId: nanoid() // 唯一消息ID
}
})
......@@ -214,7 +217,8 @@ export default function initApp() {
wx.miniProgram.postMessage({
data: {
type: 'share',
shareData: JSON.stringify(shareInfo)
shareData: JSON.stringify(shareInfo),
messageId: nanoid() // 唯一消息ID
}
})
......
const IDLE_TIMEOUT = 30 * 60 * 1000
// const IDLE_TIMEOUT = 3 * 1000
const EXIT_COUNTDOWN = 30
const WATCH_INTERVAL = 10 * 1000
const ACTIVITY_THROTTLE = 300
const POSTER_URL = '/pages/index/launch'
const ACTIVITY_EVENTS = [
{ type: 'touchstart', opts: { passive: true } },
{ type: 'pointerdown', opts: { passive: true } },
{ type: 'click', opts: { passive: true } },
{ type: 'input', opts: { capture: true, passive: true } },
{ type: 'focusin', opts: { capture: true, passive: true } },
{ type: 'change', opts: { capture: true, passive: true } },
{ type: 'keydown', opts: { capture: true, passive: true } },
{ type: 'wheel', opts: { passive: true } },
{ type: 'scroll', opts: { capture: true, passive: true } }
]
export function useH5IdleExit() {
let idleTimer = null
let exitTimer = null
let watcher = null
let lastActive = Date.now()
let lastActivityCall = 0
let modalShowing = false
let started = false
const clearTimers = () => {
if (idleTimer) { clearTimeout(idleTimer); idleTimer = null }
if (exitTimer) { clearTimeout(exitTimer); exitTimer = null }
if (watcher) { clearInterval(watcher); watcher = null }
}
const resetIdle = () => {
lastActive = Date.now()
if (idleTimer) clearTimeout(idleTimer)
idleTimer = setTimeout(showIdleModal, IDLE_TIMEOUT)
}
const doExit = () => {
clearTimers()
modalShowing = false
try { uni.clearStorageSync() } catch (e) {}
const bridge = window.webViewJs
if (bridge && typeof bridge.reLaunch === 'function') {
bridge.reLaunch({ url: POSTER_URL })
} else {
console.warn('[useH5IdleExit] window.webViewJs 不存在,无法跳转海报页')
try { uni.reLaunch({ url: POSTER_URL }) } catch (e) {}
}
}
const showIdleModal = () => {
if (modalShowing) return
modalShowing = true
let settled = false
exitTimer = setTimeout(() => {
if (settled) return
settled = true
doExit()
}, EXIT_COUNTDOWN * 1000)
uni.showModal({
title: '温馨提示',
content: `系统检测到您长时间未操作,系统将在 ${EXIT_COUNTDOWN} 秒后自动退出`,
confirmText: '立即退出',
cancelText: '继续使用',
confirmColor: '#e74c3c',
success: (res) => {
if (settled) return
settled = true
if (exitTimer) { clearTimeout(exitTimer); exitTimer = null }
modalShowing = false
if (res.confirm) doExit()
else resetIdle()
},
fail: () => {
if (exitTimer) { clearTimeout(exitTimer); exitTimer = null }
modalShowing = false
}
})
}
const onActivity = () => {
if (modalShowing) return
const now = Date.now()
if (now - lastActivityCall < ACTIVITY_THROTTLE) return
lastActivityCall = now
resetIdle()
}
const startWatcher = () => {
if (watcher) clearInterval(watcher)
watcher = setInterval(() => {
if (!started || modalShowing) return
if (Date.now() - lastActive >= IDLE_TIMEOUT) showIdleModal()
}, WATCH_INTERVAL)
}
const onVisibilityChange = () => {
if (document.hidden) {
clearTimers()
} else {
if (!started) return
modalShowing = false
resetIdle()
startWatcher()
}
}
const onWindowFocus = () => {
if (!started || modalShowing) return
resetIdle()
}
const bindActivityEvents = () => {
ACTIVITY_EVENTS.forEach(({ type, opts }) => document.addEventListener(type, onActivity, opts))
window.addEventListener('focus', onWindowFocus)
window.addEventListener('pageshow', onWindowFocus)
}
const unbindActivityEvents = () => {
ACTIVITY_EVENTS.forEach(({ type, opts }) => {
document.removeEventListener(type, onActivity, opts.capture ? { capture: true } : false)
})
window.removeEventListener('focus', onWindowFocus)
window.removeEventListener('pageshow', onWindowFocus)
}
const start = () => {
if (started) return
started = true
bindActivityEvents()
document.addEventListener('visibilitychange', onVisibilityChange)
resetIdle()
startWatcher()
window.__h5StopIdle = () => {
if (!started) return 'not-started'
clearTimers()
modalShowing = false
console.log('[H5] __h5StopIdle 已执行')
return 'stopped'
}
window.__h5ResetIdle = () => {
if (!started) return 'not-started'
modalShowing = false
resetIdle()
startWatcher()
console.log('[H5] __h5ResetIdle 已执行')
return 'reset'
}
} // <--- ⚠️ 就是这里,补上了缺失的大括号!
const stop = () => {
clearTimers()
started = false
modalShowing = false
unbindActivityEvents()
document.removeEventListener('visibilitychange', onVisibilityChange)
window.__h5StopIdle = null
window.__h5ResetIdle = null
}
const reset = () => {
if (!started) return
modalShowing = false
resetIdle()
startWatcher()
}
return { start, stop, reset }
}
\ No newline at end of file
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