Commit ac4b20bc by 张立顺

fix 控制台报错修复

1 parent 09043764
Showing 86 changed files with 508 additions and 156 deletions
......@@ -319,12 +319,19 @@ module.exports = {
/**
* 员工登录日志记录保存
* @param {object} data
* @param {string} [name] 调用来源;`loading` 时静默失败,不弹 Toast
*/
loginRecordSave(data, name) {
// console.log(name, 'loginRecordSave');
// debugger
return api.post("dj.api.smartcarlife.staff.login.record.save", data);
//selectMerchantScene
const failTips = name !== "loading";
return api.post(
"dj.api.smartcarlife.staff.login.record.save",
data,
[],
undefined,
undefined,
failTips
);
},
// 获取侧边栏切换门店4s店列表
getCurShopList(data) {
......
//app.js
// 初始化sentry
import sentryInit from "~/utils/sentryConfig/sentryInit";
import { getSystemInfoSync } from "~/utils/systemInfo";
const sentry = sentryInit();
wx.$sendSentry = function (e) {
sentry.captureException(e);
......@@ -63,9 +64,19 @@ const debouncedReNoSignIn = debounce(function (noSignInUuid, that) {
removeSystemStorage();
that.login(false);
}
})
.catch((err) => {
const errMsg = err?.errMsg || String(err || "");
const isTimeout = /timeout/i.test(errMsg) || err?.errno === 5;
console.warn("[reNoSignIn fail]", { isTimeout, errMsg }, err);
// 网络超时等瞬时错误不强制登出,避免初始化阶段反复弹窗
if (!isTimeout) {
util.removeStorage();
removeSystemStorage();
that.login(false);
}
});
}, 0); // 设置防抖时间为 0 秒
// }, 0); // 设置防抖时间为 5 秒
}, 300);
// 定义一个防抖函数
function debounce(func, timeout) {
let timer;
......@@ -135,7 +146,7 @@ App({
// }
// }
if (options) {
console.log('options', options)
// console.log('options', options)
let res = checkScene(options);
// console.log(res, 'res')
......@@ -203,7 +214,7 @@ App({
},
globalData: {
statusBarHeight: wx.getSystemInfoSync()["statusBarHeight"], // 头部导航栏的高度
statusBarHeight: getSystemInfoSync().statusBarHeight, // 头部导航栏的高度
yqdInfo: {},
isYqdSuper: true,
isStaff: false,
......
......@@ -2,6 +2,7 @@
* @file 微信隐私授权弹窗(自 glsk-applet-component/GlsxPrivacy 内联,仅主包引用)
* 监听 wx.onNeedPrivacyAuthorization,在当前页展示用户隐私保护指引同意/拒绝 UI。
*/
import { getSystemInfo } from '~/utils/systemInfo'
let privacyHandler
const privacyResolves = new Set()
......@@ -53,7 +54,7 @@ Component({
}
closeOtherPagePopUpHooks.add(closePopUp)
this.closePopUp = closePopUp
wx.getSystemInfo({
getSystemInfo({
success: res => {
this.setData({
isIPad: res.screenWidth > 700
......
......@@ -59,7 +59,7 @@
<scroll-view wx:if="{{copyStoreList.length && searchSelectIndex == 0}}" scroll-y style="height: calc(100vh - var(--fontSize264) - var(--fontSize88));" enhanced="{{true}}" show-scrollbar="{{false}}">
<block wx:for="{{copyStoreList}}" wx:key="index" wx:for-index="index">
<view catch:tap="selectStore" data-item="{{item}}" data-selectindex="{{index}}" class="element {{item.actived ? 'active' : ''}}">
<view><image src="{{IMG_URL}}/store_icon_nobg.png"></image></view>
<view><image class="element-icon" src="{{IMG_URL}}/store_icon_nobg.png"></image></view>
<view class="text_box">
<view class="label">{{item.merchantName}}</view>
<view class="scene_label" wx:if="{{item.sceneName}}">场景:{{item.sceneName}}</view>
......@@ -72,7 +72,7 @@
<scroll-view wx:if="{{customStoreList.length && searchSelectIndex == 1 && userInfo.sceneType == 1}}" scroll-y style="height: calc(100vh - var(--fontSize264) - var(--fontSize88));" enhanced="{{true}}" show-scrollbar="{{false}}" bindscrolltolower="scrollonReachBottom">
<block wx:for="{{customStoreList}}" wx:key="index" wx:for-index="index">
<view catch:tap="selectStore" data-item="{{item}}" data-selectindex="{{index}}" class="element custom_element {{item.actived ? 'active' : ''}}">
<view><image src="{{IMG_URL}}/user_avatar.png"></image></view>
<view><image class="element-icon" src="{{IMG_URL}}/user_avatar.png"></image></view>
<view class="text_box">
<view class="custom_text">
<view class="name_phone">
......
......@@ -198,7 +198,8 @@
font-size: var(--fontSize28);
}
.wrapper .search_box image{
.wrapper .search_box .icon,
.wrapper .search_box .clear_icon{
width: var(--fontSize32);
height: var(--fontSize32);
}
......@@ -339,7 +340,7 @@
margin-top: 0;
}
.wrapper .element image{
.wrapper .element .element-icon{
width: var(--fontSize96);
height: var(--fontSize96);
margin-right: var(--fontSize30);
......@@ -417,7 +418,7 @@
.wrapper .element{
padding: var(--fontSize20);
}
.wrapper .element image{
.wrapper .element .element-icon{
width: var(--fontSize70);
height: var(--fontSize70);
}
......
// packageEquity/pages/carQuotation/components/skuGoods/Goods.js
import { getSystemInfoSync } from '~/utils/systemInfo'
Component({
/**
* 组件的属性列表
......@@ -227,7 +228,7 @@ Component({
attached() {
console.log(77777)
this.setData({
windowHight: wx.getSystemInfoSync().windowHeight
windowHight: getSystemInfoSync().windowHeight
})
}
}
......
......@@ -58,13 +58,13 @@
</view>
</view>
<view class="logout-box">
<view class="logout text-center" bindtap="changeAccount">切换账号</view>
<view class="logout logout-first text-center" bindtap="changeAccount">切换账号</view>
<view class="logout text-center" bindtap="logout">退出账号</view>
<view class="message-box">
<!-- <view class="message">为保障你的合法权益,请阅读并同意</view> -->
<text catchtap="jump" data-url="privacy">《隐私协议》</text>
<text class="agreement-link" catchtap="jump" data-url="privacy">《隐私协议》</text>
和
<text catchtap="jump" data-url="agreement">《用户协议》</text>
<text class="agreement-link" catchtap="jump" data-url="agreement">《用户协议》</text>
</view>
</view>
</view>
......
/* tabComponents/pages/index/index.wxss */
page {
background: #F7F8FA;
}
.pagedetail {
position: relative;
......@@ -10,6 +7,7 @@ page {
.layout_box {
height: 100%;
overflow: scroll;
background: #F7F8FA;
}
.main {
......@@ -387,7 +385,7 @@ page {
font-size: var(--fontSize28);
}
.logout-box :first-child {
.logout-box .logout-first {
border-bottom: 1rpx solid #E4E8EE;
}
......@@ -399,7 +397,7 @@ page {
transform: translateX(-50%);
}
.message-box text {
.message-box .agreement-link {
color: #5092FF;
}
.text-center {
......
......@@ -98,7 +98,6 @@ Component({
_btnTextColor: ['#A2A2A8', '#333333', '#303030'],
maskAnimate: [],
frameAnimate: [],
title: '', // 提示弹框
success: () => {}, // 成功
error: () => {} // 失败
},
......
import { IMG_URL } from '../../utils/imageBase.js'
// components/navigationBar/navigationBar.js
import util from '../../utils/util'
import { getSystemInfo, getSystemInfoSync } from '~/utils/systemInfo'
const app = getApp()
Component({
options: {
......@@ -47,11 +48,11 @@ Component({
*/
let _this = this
// 获取屏幕宽度和高度
const { windowWidth, windowHeight } = wx.getSystemInfoSync()
const { windowWidth, windowHeight } = getSystemInfoSync()
// 判断屏幕方向
const isLandscape = windowWidth > windowHeight // '横屏' : '竖屏'
wx.getSystemInfo({
getSystemInfo({
success(res) {
let {
fontSizeSetting,
......@@ -108,7 +109,7 @@ Component({
})
},
getFallbackNavBarRect() {
const sys = wx.getSystemInfoSync()
const sys = getSystemInfoSync()
const menu = wx.getMenuButtonBoundingClientRect()
const statusBarHeight =
sys.platform === 'ios' ? sys.safeArea?.top ?? sys.statusBarHeight : sys.statusBarHeight
......
......@@ -49,7 +49,7 @@
border-radius: 50%;
border: var(--fontSize2) solid #E3E3E6;
}
image{
.radio-icon{
width: var(--fontSize32);
height: var(--fontSize32);
}
......
......@@ -6,7 +6,7 @@
<view class="prompt_content">
<view class="select_item">
<block wx:if="{{infoData.payFlag == 1}}">
<image src="/components/images/radio.png" />
<image class="radio-icon" src="/components/images/radio.png" />
</block>
<block wx:else>
<view class="arc" bindtap="chooseParent" data-type="1" />
......@@ -18,7 +18,7 @@
</view>
<view class="select_item" style="border-bottom: 0rpx;">
<block wx:if="{{infoData.payFlag == 2}}">
<image src="/components/images/radio.png" />
<image class="radio-icon" src="/components/images/radio.png" />
</block>
<block wx:else>
<view class="arc" bindtap="chooseParent" data-type="2" />
......@@ -31,7 +31,7 @@
<view class="child_select_content" wx:if="{{infoData.payFlag == 2}}">
<view wx:for="{{payTypeList}}" class="child_select_item" wx:key="index">
<block wx:if="{{infoData.payType == item.value}}">
<image src="/components/images/radio.png" />
<image class="radio-icon" src="/components/images/radio.png" />
</block>
<block wx:else>
<view class="arc" bindtap="chooseChild" data-type="{{item.value}}" />
......
......@@ -99,7 +99,7 @@
color: #6C6F75;
font-size: var(--fontSize28);
margin: var(--fontSize32) calc(-1 * var(--fontSize19)) 0 calc(-1 * var(--fontSize19));
text{
.footer-highlight{
color: #347BFF;
}
}
......
......@@ -34,7 +34,7 @@
</view>
</view>
<view class="custom-content-footer">
请先完成<text>【{{customObj.title}}】</text>考试测评后会推荐适合您的课程
请先完成<text class="footer-highlight">【{{customObj.title}}】</text>考试测评后会推荐适合您的课程
</view>
</block>
</view>
......
......@@ -2,6 +2,7 @@
* 用来配置小程序项目的变量
* 统一管理
*/
import { getSystemInfoSync } from './utils/systemInfo.js'
// 配置预发布的小程序aapId
export const preReleaseAppId = "wx96c8f2a3e76907cb";
......@@ -20,7 +21,7 @@ export const appId = "wx570d9331f9ace0bd";
*/
let index = 2;
const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync();
const systemInfo = getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion;
//手动控制体验版环境的请求 true就依据下面index false就默认2
const manual = false;
......
// packageCrowdFunding/pages/activityPay/activityPay.js
import { getSystemInfoSync } from '~/utils/systemInfo'
// import { centsToyuan } from "~/utils/format";
import constantData from './constant/data'
......@@ -99,7 +100,7 @@ Page({
// console.log(text)
let size = 0
try {
const info = wx.getSystemInfoSync()
const info = getSystemInfoSync()
let scale = info.windowWidth / 750 //不同屏幕下QRcode的适配比例;设计稿是750宽
let width = 300 * scale
size = width
......
// pages/equity/index.js
import { IMG_URL } from '~/utils/imageBase.js'
import { getSystemInfoSync } from '~/utils/systemInfo'
import { get4SStoreList } from '~/store/index'
import { checkDailyReport } from '~/store/ModalToQueueControl'
import api from '~/api/api.js'
......@@ -83,7 +84,8 @@ Page({
isStaff: false,
storeRange: [],
showPage: false,
invoiceOrderInfo: {}
invoiceOrderInfo: {},
serviceCenterUnreadNum: 0
// hasMode:true
},
async navigator(e) {
......@@ -115,7 +117,7 @@ Page({
// 检测一下是否能微信端小程序登录
checkAgreeClient(loginUserObj) {
return new Promise((resolve, reject) => {
let sysInfo = wx.getSystemInfoSync()
let sysInfo = getSystemInfoSync()
// let { environment } = sysInfo
// 1企业微信 0微信
let envName = sysInfo.environment ? 1 : 0
......@@ -673,7 +675,7 @@ Page({
},
async checkServiceNotice() {
const unread = await fetchServiceCenterUnread()
this.setData({ serviceCenterUnreadNum: unread })
this.setData({ serviceCenterUnreadNum: Number(unread) || 0 })
const candidate = await resolveFirstUnreadNotice()
if (!candidate) return
......
import { getSystemInfoSync } from '~/utils/systemInfo'
const _ctx_ = Symbol('_ctx_')
const _pixelRatio_ = Symbol('_pixelRatio_')
const _canvas_ = Symbol('_canvas_')
......@@ -18,7 +19,7 @@ class DrawLineChart {
console.log(res)
const canvas = res[0].node,
ctx = canvas.getContext('2d'),
dpr = wx.getSystemInfoSync().pixelRatio,
dpr = getSystemInfoSync().pixelRatio,
width = res[0].width * dpr,
height = res[0].height * dpr
canvas.width = width
......
import { getSystemInfoSync } from '~/utils/systemInfo'
const _ctx_ = Symbol('_ctx_')
const _pixelRatio_ = Symbol('_pixelRatio_')
const _canvas_ = Symbol('_canvas_')
......@@ -17,7 +18,7 @@ class DrawPieChart {
}).exec((res) => {
const canvas = res[0].node,
ctx = canvas.getContext('2d'),
dpr = wx.getSystemInfoSync().pixelRatio,
dpr = getSystemInfoSync().pixelRatio,
width = res[0].width * dpr,
height = res[0].height * dpr
canvas.width = width
......
// packageEquity/pages/aiCheck/result/result.js
import { getSystemInfoSync } from '~/utils/systemInfo'
var wxCharts = require('./wxcharts')
import aiApi from '../../../aiApi'
import carLifeApi from '../../../carEquityApi'
......@@ -247,7 +248,7 @@ Page({
},
setDetail(reportItem) {
let seriesData = [],
imageWidth = wx.getSystemInfoSync().windowWidth
imageWidth = getSystemInfoSync().windowWidth
reportItem.map(e => {
seriesData.push(e.star)
e.starList = this.getStar(e.star)
......
import Dialog from "@vant/weapp/dialog/dialog";
import { getSystemInfoSync } from '~/utils/systemInfo'
import WebSocketUtil from "~/packageEquity/utils/aliyun/socket.js";
import carLifeApi from "../../../carEquityApi";
const { scoket_url } = require("~/config");
......@@ -547,7 +548,7 @@ Page({
*/
getChatH() {
// 获取屏幕宽度和高度
const { windowWidth, windowHeight } = wx.getSystemInfoSync();
const { windowWidth, windowHeight } = getSystemInfoSync();
// 判断屏幕方向
const isLandscape = windowWidth > windowHeight; // '横屏' : '竖屏'
......
// packageEquity/pages/beforeCreate/beforeCreate.js
import { getSystemInfo as fetchSystemInfo } from '~/utils/systemInfo'
Page({
/**
* 页面的初始数据
......@@ -28,7 +29,7 @@ Page({
});
},
});
wx.getSystemInfo({
fetchSystemInfo({
success(res) {
console.log(res);
const deviceOrientation = res.deviceOrientation;
......
......@@ -191,7 +191,7 @@
color: #222222;
}
.total-box text {
.total-box .total-text {
margin-right: var(--fontSize24);
}
......@@ -282,12 +282,12 @@
color: #999999;
}
.list .item .name image {
.list .item .name .name-icon {
width: var(--fontSize46);
height: var(--fontSize46);
}
.list .item.gray .name image {
.list .item.gray .name .name-icon {
filter: grayscale(100%);
}
......@@ -348,7 +348,7 @@
align-items: baseline;
}
.list .item .goods-list .goods .goods-price text {
.list .item .goods-list .goods .goods-price .goods-price-text {
font-size: var(--fontSize24);
color: #2A2A2A;
}
......@@ -361,13 +361,13 @@
align-items: center;
}
.list .item .goods-more text {
.list .item .goods-more .more-text {
font-size: var(--fontSize28);
color: #347BFF;
margin-right: var(--fontSize20);
}
.list .item.gray .goods-more text {
.list .item.gray .goods-more .more-text {
color: #666;
}
......
// packageEquity/pages/carQuotation/CarQuotationPay/CarQuotationPay.js
import { getSystemInfoSync } from '~/utils/systemInfo'
import { getOrderDetail, updateOrderStatus, getQuotationInfoById, createPayOrder } from '../../../api'
import { createQrcodeImage } from '~/api/api'
import qrcode from '~/utils/lib/wxqrcode'
......@@ -62,7 +63,7 @@ Page({
// console.log(text)
let size = 0
try {
const info = wx.getSystemInfoSync()
const info = getSystemInfoSync()
let scale = info.windowWidth / 750 //不同屏幕下QRcode的适配比例;设计稿是750宽
let width = 300 * scale
size = width
......@@ -104,7 +105,7 @@ Page({
console.log(text)
let size = 0
try {
const info = wx.getSystemInfoSync()
const info = getSystemInfoSync()
let scale = info.windowWidth / 750 //不同屏幕下QRcode的适配比例;设计稿是750宽
let width = 300 * scale
size = width
......
// packageEquity/pages/carQuotation/components/zyPayPopup/zyPayPopup.js
import { getSystemInfoSync } from '~/utils/systemInfo'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
import api from '~/api/api.js'
Component({
......@@ -14,7 +15,7 @@ Component({
observer: function(n) {
if (n) {
let { showZyTarget, updateZyFlag } = this.data
let sysInfo = wx.getSystemInfoSync()
let sysInfo = getSystemInfoSync()
// sysInfo.environment 1 企业微信打开 0微信打开
// sysInfo.platform === 'windows' || sysInfo.platform === 'mac' || sysInfo.platform === 'linux' 是否pc端打开
this.setData({
......
......@@ -8,7 +8,7 @@
padding: var(--fontSize40) 0 var(--fontSize32) 0;
font-size: var(--fontSize28);
color: #222222;
image{
.tips-icon{
flex-shrink: 0;
margin-top: var(--fontSize2);
width: var(--fontSize32);
......@@ -25,7 +25,7 @@
flex-flow: column;
align-items: center;
justify-content: center;
image{
.upload-icon{
width: var(--fontSize40);
height: var(--fontSize40);
}
......
......@@ -11,9 +11,9 @@
height="auto">
<view class="content">
<block wx:if="{{!fileList.length}}">
<view class="tips-text"><image src="{{IMG_URL}}zy_tips_icon.png"></image>上传完毕计入有效成交,订单才可参与提成/清分/积分发放!</view>
<view class="tips-text"><image class="tips-icon" src="{{IMG_URL}}zy_tips_icon.png"></image>上传完毕计入有效成交,订单才可参与提成/清分/积分发放!</view>
<view class="upload_content" bindtap="selectUplaodType">
<image src="{{IMG_URL}}zy-upload_icon.png"></image>
<image class="upload-icon" src="{{IMG_URL}}zy-upload_icon.png"></image>
<text class="text">图片或PDF</text>
</view>
</block>
......@@ -26,7 +26,7 @@
<image class="del_icon" src="{{IMG_URL}}zy_del_icon.png" mode="" bindtap="deleteFile" data-index="{{index}}" />
</view>
<view class="upload_content" bindtap="uploadImages" wx:if="{{fileList.length < 9}}">
<image src="{{IMG_URL}}zy-upload_icon.png"></image>
<image class="upload-icon" src="{{IMG_URL}}zy-upload_icon.png"></image>
<text class="text">最多9张</text>
</view>
</view>
......
// packageEquity/pages/carEquity/serviceInfo/serviceInfo.js quotationGoods
import { getSystemInfoSync } from '~/utils/systemInfo'
import {
// quotationPicture,
quotationAdd,
......@@ -2139,7 +2140,7 @@ Page({
onLoad(options) {
/*获取屏幕高度*/
this.setData({
windowHeight: wx.getSystemInfoSync().windowHeight,
windowHeight: getSystemInfoSync().windowHeight,
});
const that = this;
......
// import { commonApi, equityApi } from '../../api/api'
import { uploadImg } from '~/api/api'
import { getSystemInfoSync } from '~/utils/systemInfo'
import { quotationUpgrade, updateOrderStatus } from '../../../api'
import { ImgUrl } from '~/config'
const IMG_URL = ImgUrl + '/'
......@@ -35,7 +36,7 @@ Page({
})
},
onLoad(options) {
let { windowWidth, windowHeight } = wx.getSystemInfoSync()
let { windowWidth, windowHeight } = getSystemInfoSync()
if (options.writeOffCode) {
this.writeOffCode = options.writeOffCode
}
......
......@@ -356,12 +356,12 @@
color: #999999;
}
.list .item .name image {
.list .item .name .name-icon {
width: var(--fontSize46);
height: var(--fontSize46);
}
.list .item.gray .name image {
.list .item.gray .name .name-icon {
filter: grayscale(100%);
}
......@@ -422,7 +422,7 @@
align-items: baseline;
}
.list .item .goods-list .goods .goods-price text {
.list .item .goods-list .goods .goods-price .goods-price-text {
font-size: var(--fontSize24);
color: #2A2A2A;
}
......@@ -435,13 +435,13 @@
align-items: center;
}
.list .item .goods-more text {
.list .item .goods-more .more-text {
font-size: var(--fontSize28);
color: #347BFF;
margin-right: var(--fontSize20);
}
.list .item.gray .goods-more text {
.list .item.gray .goods-more .more-text {
color: #666;
}
......@@ -764,7 +764,7 @@
height: var(--fontSize136);
}
.fixed-btns .btn image {
.fixed-btns .btn .btn-icon {
width: var(--fontSize60);
height: var(--fontSize60);
flex-shrink: 0;
......@@ -803,7 +803,7 @@
padding: var(--fontSize48);
}
.modal text,
.modal .modal-text,
.modal {
font-size: var(--fontSize28);
color: #333333;
......
......@@ -376,7 +376,7 @@
<block wx:if="{{ !perm.hasPermission.isSuper(userInfo) && userInfo.userType == 2&&mode!=-1 && showIcon1 &&isOrder }}">
<view class="fixed-btns">
<view class="btn text-center" bindtap="handleClickOrderBtn" data-name="createOrder">
<image src="{{ IMG_URL2 }}upgrade/scancode_verification02.png" />
<image class="btn-icon" src="{{ IMG_URL2 }}upgrade/scancode_verification02.png" />
新增提单
</view>
<!-- <view class="btn text-center" bindtap="scan">
......@@ -405,12 +405,12 @@
<modal id="modal" class="modal" custom="true" btns="{{ ['返回','确定'] }}">
<view class="modatcontent">
<view class="orderCode">
<text class="code">订单编号:</text>
<text>{{showErrorId}}</text>
<text class="modal-text code">订单编号:</text>
<text class="modal-text">{{showErrorId}}</text>
</view>
<view class="tips">
若工单信息有误,确认操作可标记为
<text class="color">已失效</text>
<text class="modal-text color">已失效</text>
,并补录新工单以提供线下核对。
</view>
</view>
......
import { ImgUrl } from "~/config";
import { getSystemInfo as fetchSystemInfo } from '~/utils/systemInfo'
import {
quotationGoodsList,
defeatOrderCreate,
......@@ -71,7 +72,7 @@ Page({
});
},
});
wx.getSystemInfo({
fetchSystemInfo({
success(res) {
console.log(res);
const deviceOrientation = res.deviceOrientation;
......
// packageEquity/pages/beforeCreate/beforeCreate.js
import { getSystemInfo as fetchSystemInfo } from '~/utils/systemInfo'
Page({
/**
* 页面的初始数据
......@@ -25,7 +26,7 @@ Page({
});
},
});
wx.getSystemInfo({
fetchSystemInfo({
success(res) {
console.log(res);
const deviceOrientation = res.deviceOrientation;
......
......@@ -13,8 +13,7 @@ Component({
userInfo: { type: Object, value: {} },
showEmployeeName: { type: Boolean, value: false },
isShowDefeatBtn: { type: Boolean, value: true },
recordTabList: { type: Array, value: [] },
IMG_URL: { type: String, value: '' }
recordTabList: { type: Array, value: [] }
},
methods: {
onFilterTap() {
......
......@@ -2,11 +2,11 @@
<wxs src="../../../../../utils/permission.wxs" module="perm" />
<view class="receive-list">
<view class="screen-box {{ showScreen ? '' : 'sticky-screen' }} {{ isScrollTop ? 'bg-white' : '' }}">
<view>
<view class="screen-box-row">
<text class="name text-hide">{{ searchForm.merchantNames.length > 1 ? "部分门店" : searchForm.merchantNames.length ? filter.filterMerchantName(searchForm.merchantNames) : !perm.hasPermission.canViewViolation(userInfo) ? userInfo.default4SStoreInfo.merchantName || "全部门店" : "全部门店" }}</text>
</view>
<view bindtap="onFilterTap">
<text class="text">筛选</text><gl-image webp src="/equity/screen-icon.png" />
<view class="screen-box-row" bindtap="onFilterTap">
<text class="text">筛选</text><gl-image class="screen-icon" webp src="/equity/screen-icon.png" />
</view>
</view>
<view class="tab-box">
......
......@@ -23,7 +23,7 @@
.screen-box.bg-white {
background: #ffffff;
}
.screen-box view {
.screen-box .screen-box-row {
display: flex;
align-items: flex-end;
}
......@@ -41,7 +41,7 @@
font-size: var(--fontSize24);
color: #292d33;
}
.screen-box image {
.screen-box .screen-icon {
width: var(--fontSize36);
height: var(--fontSize36);
}
......
......@@ -22,7 +22,7 @@
<view class="list-box">
<view class="item flex-block">
<image src="{{ IMG_URL }}images/search.png" class="icon"></image>
<input placeholder="客户姓名/手机号" bindinput="input" value="{{customerName}}" type="text" />
<input class="search-input" placeholder="客户姓名/手机号" bindinput="input" value="{{customerName}}" type="text" />
</view>
</view>
</view>
......
......@@ -152,7 +152,7 @@
padding: 0 var(--fontSize24);
}
.box .list-box .item input{
.box .list-box .item .search-input{
width: calc(100% - var(--fontSize50));
text-align: left;
}
......
......@@ -4,7 +4,7 @@
<block wx:if="{{ !hideScore && itemInfo.checkHistoryFlag == 0 }}">
<view class="record-header new-record">
<view class="base-message">
<view>
<view class="base-message-row">
<view class="record-name text-hide">
<text class="value">{{ itemInfo.customerName }}</text>
<text class="order-name"
......@@ -52,7 +52,7 @@
</block>
<view class="record-header">
<view class="base-message">
<view>
<view class="base-message-row">
<view class="record-name text-hide">
<text class="value">{{ filter.desensitizeName(itemInfo.customerName) }}</text>
<text class="order-name"
......
......@@ -34,7 +34,7 @@
justify-content: space-between;
margin-bottom: var(--fontSize12);
}
.content .record-header .base-message view {
.content .record-header .base-message .base-message-row {
display: flex;
align-items: center;
}
......
......@@ -7,7 +7,7 @@
<view class="text">服务中心</view>
</view>
</view>
<swiper bindchange="onSwiperChange">
<swiper class="stats-swiper" bindchange="onSwiperChange">
<block wx:for="{{ 3 }}" wx:key="index">
<swiper-item>
<view class="swiper-item">
......
......@@ -40,7 +40,7 @@
top: 2rpx;
right: -8rpx;
}
.swiper-wrap swiper {
.swiper-wrap .stats-swiper {
background: #ffffff;
box-shadow: 0 24rpx 24rpx -12rpx rgba(211, 217, 230, 0.5019607843);
border-radius: var(--fontSize20);
......
......@@ -9,8 +9,7 @@ Component({
stodoList: { type: Array, value: [] },
missingRecordTodoList: { type: Array, value: [] },
ispopUp: { type: Boolean, value: true },
todos: { type: Object, value: {} },
IMG_URL: { type: String, value: '' }
todos: { type: Object, value: {} }
},
methods: {
onGoto(e) {
......
......@@ -8,7 +8,7 @@
wx:for="{{ ispopUp ? todoList : stodoList }}"
wx:for-index="idx">
<view class="todo-item-title">
<image src="{{ IMG_URL }}{{ item.taskType == '1' ? 'warn' : 'task' }}.png" />
<image class="todo-item-icon" src="{{ IMG_URL }}{{ item.taskType == '1' ? 'warn' : 'task' }}.png" />
<text>{{ todos[item.taskId] }}</text>
</view>
<view class="todo-item-info">{{ item.content }}</view>
......@@ -33,7 +33,7 @@
<block wx:if="{{ missingRecordTodoList.length }}">
<view class="todo-item">
<view class="todo-item-title">
<image src="{{ IMG_URL }}warn.png" /><text>接待缺失报备</text>
<image class="todo-item-icon" src="{{ IMG_URL }}warn.png" /><text>接待缺失报备</text>
</view>
<view class="todo-item-info">请报备缺失接待客户的原因</view>
<view class="todo-item-btn" bindtap="onMissing">去报备</view>
......@@ -43,7 +43,7 @@
<view class="pack-up {{ !ispopUp ? 'pack-up-active' : '' }}"
wx:if="{{ missingRecordTodoList.length + todoList.length > 2 }}"
bindtap="onPackup">
<image src="{{ IMG_URL }}pack-up.png" />
<image class="pack-up-icon" src="{{ IMG_URL }}pack-up.png" />
</view>
</view>
</block>
......@@ -30,7 +30,7 @@
font-size: var(--fontSize28);
color: #1a1a1a;
}
.todo-list .todo-items .todo-item .todo-item-title image {
.todo-list .todo-items .todo-item .todo-item-title .todo-item-icon {
width: var(--fontSize32);
height: var(--fontSize32);
margin-right: var(--fontSize11);
......@@ -58,7 +58,7 @@
left: 50%;
transform: translateX(-50%);
}
.todo-list .pack-up image {
.todo-list .pack-up .pack-up-icon {
width: 100%;
}
.todo-list .pack-up-active {
......
// components/OcrPhoto.js
import api from '~/api/api.js'
import { getSystemInfoSync } from '~/utils/systemInfo'
const { ocrImageUrl } = require('../../config/imageCdn.js')
Page({
/**
......@@ -364,7 +365,7 @@ Page({
// // 在组件实例进入页面节点树时执行
var that = this
that.ctx = wx.createCameraContext()
let { windowWidth, windowHeight } = wx.getSystemInfoSync()
let { windowWidth, windowHeight } = getSystemInfoSync()
this.setData({ windowWidth, windowHeight })
setTimeout(() => {
that.initCanvas()
......
import { getSystemInfoSync } from '~/utils/systemInfo'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
import { materialListApi, leavePageTrack } from "../../api/api"
import commonApi from "~/api/api";
......@@ -122,7 +123,7 @@ Component({
heightArr.push(s)
})
const last = heightArr.pop()
let systemInfo = wx.getSystemInfoSync()
let systemInfo = getSystemInfoSync()
const scroll_height = systemInfo.safeArea.height - last - navBarHeight
this.setData({
scroll_height
......
page {
.materials-page {
background: #F7F8FA;
}
.min-screen-close{
......
<view class="pos-container .max-screen-close">
<view class="pos-container materials-page .max-screen-close">
<view class="bg scroll_height_d_part"></view>
<view wx:if="{{showPage}}" class="main">
<view class="main-box">
......
import { getSystemInfoSync } from '~/utils/systemInfo'
import { enterPageTrack, leavePageTrack, materialDetail } from "../../api/api"
Page({
data: {
......@@ -15,7 +15,7 @@ Page({
getDetail(options) {
materialDetail({ id: options.id }).then((res) => {
console.log(res, 'result');
const sys = wx.getSystemInfoSync()
const sys = getSystemInfoSync()
const styleCss = `width:100%;height:100vh`
let { type, title, id } = options
let { materialDetailInfoList: _tempArr } = res.data
......
import { getSystemInfoSync } from '~/utils/systemInfo'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
import { materialListApi, leavePageTrack } from "./api/api"
let currentTabType = 'video'
......@@ -64,7 +65,7 @@ Page({
heightArr.push(s)
})
const last = heightArr.pop()
let systemInfo = wx.getSystemInfoSync()
let systemInfo = getSystemInfoSync()
const scroll_height = systemInfo.safeArea.height - last * 3
this.setData({
scroll_height
......
......@@ -4,7 +4,22 @@
export function setupWxMock(globalRef = globalThis) {
globalRef.wx = {
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'release' } }),
getSystemInfoSync: () => ({}),
getDeviceInfo: () => ({ platform: 'devtools' }),
getWindowInfo: () => ({
windowWidth: 375,
windowHeight: 667,
statusBarHeight: 20,
pixelRatio: 2,
screenWidth: 375,
screenHeight: 667,
safeArea: { top: 20, bottom: 667, height: 647 },
}),
getAppBaseInfo: () => ({
SDKVersion: '3.0.0',
host: 'WeChat',
version: '8.0.0',
language: 'zh_CN',
}),
$hasPermission: {
isSuper: u => !!u?.isSuper,
isNotMentor: u => u?.loginRole !== 6,
......
// packageStudyCenter/pages/myTask/components/RadarChart/RadarChart.js
import { getSystemInfoSync } from '~/utils/systemInfo'
import uCharts from '~/packageStudyCenter/ucharts/index.js'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
Component({
......@@ -107,7 +108,7 @@ Component({
try {
const ctx = canvas.getContext('2d');
const systemInfo = wx.getSystemInfoSync();
const systemInfo = getSystemInfoSync();
const pixelRatio = systemInfo.pixelRatio;
const actualWidth = res[0].width * pixelRatio;
......
// packageStudyCenter/pages/myTask/components/Task/Task.js
import { getSystemInfoSync } from '~/utils/systemInfo'
import api from "../../../../api"
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
const dayjs = require('dayjs');
......@@ -68,7 +69,7 @@ Component({
methods: {
calculateScrollViewHeight() {
const systemInfo = wx.getSystemInfoSync();
const systemInfo = getSystemInfoSync();
const { windowHeight, windowWidth } = systemInfo;
// 根据设计稿比例计算滚动区域高度
const baseHeight = 1334; // 设计稿高度
......
// packageUsedCar/pages/deliveryNote/components/step2/step2.js
import { getSystemInfoSync } from '~/utils/systemInfo'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/'
import newApi from '~/packageUsedCar/api'
import { uploadFile, getImageDisplayUrl } from "~/packageUsedCar/utils/oss/ossUpload.js";
......@@ -53,7 +54,7 @@ Component({
let _this = this
const { imgList, MAX_IMG_COUNT, MAX_IMAGE_SIZE } = _this.data
const count = MAX_IMG_COUNT - imgList.length
let sysInfo = wx.getSystemInfoSync()
let sysInfo = getSystemInfoSync()
if (count <= 0) {
wx.showToast({
title: '最多只能上传10张图片',
......
import api from "~/api/api";
import { getSystemInfoSync } from '~/utils/systemInfo'
import { uploadFile, getImageDisplayUrl } from "~/packageUsedCar/utils/oss/ossUpload.js";
const IMG_URL =
"https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/";
......@@ -383,7 +384,7 @@ Component({
});
}
}
let sysInfo = wx.getSystemInfoSync();
let sysInfo = getSystemInfoSync();
// 添加上传中的文件到列表
const uploadingFile = {
...file,
......@@ -646,7 +647,7 @@ Component({
if (isVideo) {
// 视频预览:判断是否是企业微信环境
const sysInfo = wx.getSystemInfoSync();
const sysInfo = getSystemInfoSync();
if (sysInfo.environment === "wxwork") {
// 企业微信环境,使用自定义弹窗播放视频
this.setData({
......@@ -733,7 +734,7 @@ Component({
if (isVideo) {
// 判断是否是企业微信环境
const sysInfo = wx.getSystemInfoSync();
const sysInfo = getSystemInfoSync();
if (sysInfo.environment === "wxwork") {
// 企业微信环境,使用自定义弹窗播放视频
const videoUrl = file.url || file.path || file.tempFilePath;
......
// packageUsedCar/pages/evaluationForm/confirmCar/confirmCar.js
import { getSystemInfoSync } from '~/utils/systemInfo'
const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/"
import dayjs from 'dayjs'
import api from '~/api/api.js'
......@@ -376,7 +377,7 @@ Page({
let _this = this
let count = field.maxCount - field?.uploadImages.length
const index = _this.data[type]?.findIndex(val => val.key == field.key )
let sysInfo = wx.getSystemInfoSync()
let sysInfo = getSystemInfoSync()
if (sysInfo.environment) { // 企微打开
if (field.video) {
const obj = _this.data[type]?.find(val => val.key == field.key)
......@@ -400,7 +401,7 @@ Page({
val.type = val.isVideo ? 'video': 'image',
val.poster = val.isVideo ? val.coverUrl : ''
})
let sysInfo = wx.getSystemInfoSync()
let sysInfo = getSystemInfoSync()
const hasVideo = media?.some(item => item.isVideo)
if (sysInfo.environment) { // 企微打开
if (hasVideo) {
......
// packageUsedCar/pages/evaluationForm/evaluationFormDetails/evaluationFormDetails.js
import { getSystemInfoSync } from '~/utils/systemInfo'
import newApi from "~/packageUsedCar/api";
import {
statusMap,
......@@ -686,7 +687,7 @@ Page({
} else if (type === 2 || type === "2") {
// 视频预览
// 判断是否是企业微信环境
const sysInfo = wx.getSystemInfoSync();
const sysInfo = getSystemInfoSync();
if (sysInfo.environment) {
// 企业微信环境,使用自定义弹窗播放
this.setData({
......@@ -789,7 +790,7 @@ Page({
);
// 计算是否需要两列布局(可根据实际需求调整逻辑)
const systemInfo = wx.getSystemInfoSync();
const systemInfo = getSystemInfoSync();
const shouldShowTwoColumns = systemInfo.windowWidth > 750;
this.setData({
......
// packageUsedCar/pages/evaluationForm/signInfo/signInfo.js
import { getSystemInfoSync } from '~/utils/systemInfo'
const IMG_URL = "https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/"
import dayjs from 'dayjs'
import api from '~/api/api.js'
......@@ -252,7 +253,7 @@ Page({
'formData.evalPrice': options.evalPrice,
'formData.handoverTime': dayjs().format('YYYY-MM-DD HH:mm:00'),
currentDate: new Date().getTime(),
sysInfo: wx.getSystemInfoSync()
sysInfo: getSystemInfoSync()
}, () => {
this.getEvalOrderSimpleDetail()
})
......
// components/OcrPhoto.js
import { getSystemInfoSync } from '~/utils/systemInfo'
import newApi from "~/packageUsedCar/api";
import api from "~/api/api";
Page({
......@@ -386,7 +387,7 @@ Page({
// // 在组件实例进入页面节点树时执行
var that = this;
that.ctx = wx.createCameraContext();
let { windowWidth, windowHeight } = wx.getSystemInfoSync();
let { windowWidth, windowHeight } = getSystemInfoSync();
this.setData({ windowWidth, windowHeight });
setTimeout(() => {
that.initCanvas();
......
import { IMG_URL } from '../../utils/imageBase.js'
// pages/accountItems/accountItems.js
import api from '~/api/api'
import { getSystemInfoSync } from '~/utils/systemInfo'
const app = getApp()
import { getYQorderInfo, get4SStoreList } from '~/store/index'
import { getShopSceneConfig } from '~/store/index'
......@@ -243,7 +244,7 @@ Page({
// 检测一下是否能微信端小程序登录
checkAgree() {
return new Promise((resolve, reject) => {
let sysInfo = wx.getSystemInfoSync()
let sysInfo = getSystemInfoSync()
// let { environment } = sysInfo
// 1企业微信 0微信
let envName = sysInfo.environment ? 1 : 0
......
......@@ -53,14 +53,16 @@ Page({
}, '', 0)
// 登录了更新用户权限
app.gobalCheckYqdSuper(userInfo)
/**scene有链接时跳转 */
let now = new Date()
/** 登录埋点:非关键路径,失败不阻断跳转 */
const now = new Date()
api.loginRecordSave({
staffUuid: userInfo.uuid,
loginTime: now.format('yyyy-MM-dd hh:mm:ss'),
merchantId: userInfo?.shopMerchantId,
merchantName: userInfo?.shopMerchantName,
}, 'loading')
}, 'loading').catch((err) => {
console.warn('[loading] loginRecordSave fail', err)
})
if (navigateParams && navigateParams.url) {
if (navigateParams.sceneType != null && navigateParams.shopMerchantId && (navigateParams.sceneType != userInfo.sceneType || navigateParams.shopMerchantId != userInfo.shopMerchantId)) {
return app.login(false, '请重新登录')
......
// tabComponents/pages/index/index.js
import api from '../../api.js'
import { mergeWorkSettingFromApi } from '../../services/workSetting.helpers.js'
const app = getApp()
import constantData from '~/pages/constant/data'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/dj-car-boutique-work-wechat/mine/'
......@@ -315,13 +316,15 @@ Page({
}
})
},
/**
* 拉取工位设置并合并到本地固定 5 时段模板(按时段匹配,避免接口条数越界)。
*/
getWorkSetting() {
let {
workItem,
saturdayFlag,
sundayFlag
} = this.data
let workCount = 0
api.getWorkSetting().then(res => {
wx.hideLoading()
let {
......@@ -329,14 +332,16 @@ Page({
data,
message
} = res
let workCount = 0
if (code == 0) {
if (data?.length > 0) {
data.map((e, index) => {
workItem[index].maxCount = e.maxCount
saturdayFlag = e.saturdayFlag == 'Y'
sundayFlag = e.sundayFlag == 'Y'
workCount += e.maxCount
const merged = mergeWorkSettingFromApi(workItem, data, {
saturdayFlag,
sundayFlag
})
saturdayFlag = merged.saturdayFlag
sundayFlag = merged.sundayFlag
workCount = merged.workCount
}
} else {
this.showToast(message)
......
/**
* @file 工位设置 API 数据与本地固定时段列表的合并逻辑(不调 setData、不请求接口)。
*/
/**
* 将接口工位设置合并到本地固定时段列表。
* 按 startTime/endTime 匹配而非数组下标,避免接口条数与本地 5 个固定时段不一致时越界。
* @param {Array<{startTime: string, endTime: string, maxCount?: number}>} workItem - 本地时段模板(原地更新 maxCount)
* @param {Array<{startTime: string, endTime: string, maxCount?: number, saturdayFlag?: string, sundayFlag?: string}>} apiList - 接口返回列表
* @param {{ saturdayFlag?: boolean, sundayFlag?: boolean }} [options] - 当前页面 flag 初始值
* @returns {{ workCount: number, saturdayFlag: boolean|undefined, sundayFlag: boolean|undefined }}
*/
export function mergeWorkSettingFromApi(workItem, apiList, options = {}) {
let saturdayFlag = options.saturdayFlag
let sundayFlag = options.sundayFlag
let workCount = 0
if (!Array.isArray(apiList) || apiList.length === 0) {
return { workCount, saturdayFlag, sundayFlag }
}
apiList.forEach((e) => {
if (e.saturdayFlag != null) saturdayFlag = e.saturdayFlag == 'Y'
if (e.sundayFlag != null) sundayFlag = e.sundayFlag == 'Y'
const item = workItem.find(
(w) => w.startTime === e.startTime && w.endTime === e.endTime
)
if (item) {
item.maxCount = e.maxCount
workCount += Number(e.maxCount) || 0
}
})
return { workCount, saturdayFlag, sundayFlag }
}
import { IMG_URL } from '../../utils/imageBase.js'
// pages/wxLogin/wxLogin.js
import api from '../../api/api.js'
import { getSystemInfoSync } from '~/utils/systemInfo'
import md5 from '~/utils/lib/md5.js'
import {
setNoSignInUuid,
......@@ -412,7 +413,7 @@ Page({
// 检测一下是否能微信端小程序登录
checkAgreeClient(loginUserObj) {
return new Promise((resolve, reject) => {
let sysInfo = wx.getSystemInfoSync()
let sysInfo = getSystemInfoSync()
// let { environment } = sysInfo
// 1企业微信 0微信
let envName = sysInfo.environment ? 1 : 0
......
{
"libVersion": "3.16.1",
"libVersion": "3.14.3",
"projectname": "dj-car-boutique-work-wechat",
"setting": {
"urlCheck": false,
......
......@@ -2,11 +2,12 @@ import api from '~/api/api.js'
import { envIndex } from '~/config'
import { removeSystemStorage } from '~/utils/cache/storageApi'
import util from '~/utils/util.js'
import { getSystemInfo } from '~/utils/systemInfo'
// console.log(wx)globalData
/** 判断是不是超管角色 */
export const checkYqdSuper = (userInfo, globalData) => {
console.log(userInfo, 'checkYqdSuper')
// console.log(userInfo, 'checkYqdSuper')
let merchantAccountType = userInfo.merchantAccountList.every(item => {
return item == 6 || item == 8
})
......@@ -241,7 +242,7 @@ export const checkScene = options => {
}
options.query = query
}
console.log(query, 'query')
// console.log(query, 'query')
let userInfo = wx.$util.getStorageSync('dj_boutique_user_info')
// 交车目标/日报
if (query && query.reportDate && query.hasOwnProperty('approvedSource')) {
......@@ -515,7 +516,7 @@ export const getServiceFilmRollSetting = yqMerchantId => {
/** 添加登录日志记录 */
export const loginLogAdd = options => {
wx.getSystemInfo({
getSystemInfo({
success(res) {
let {
// fontSizeSetting,
......
// subvehicleConversion/pages/supplementaryOrderPay/supplementaryOrderPay.js
import { getSystemInfoSync } from '~/utils/systemInfo'
import { getOrderDetail, createPayOrder, updateOrderRemark } from '~/subvehicleConversion/api'
import { createQrcodeImage } from '~/api/api'
import qrcode from '~/utils/lib/wxqrcode'
......@@ -77,7 +78,7 @@ Page({
async posPay(outTradeNo) {
let size = 0
try {
const info = wx.getSystemInfoSync()
const info = getSystemInfoSync()
let scale = info.windowWidth / 750 //不同屏幕下QRcode的适配比例;设计稿是750宽
let width = 300 * scale
size = width
......
......@@ -186,7 +186,7 @@
justify-content: center;
}
.item .select_value image {
.item .select_value .select-arrow {
width: var(--fontSize28);
height: var(--fontSize28);
}
......
......@@ -23,7 +23,7 @@
<view class="value price_value" wx:if="{{ subItem.type == 'price' }}">¥{{filter.priceFilter(item[subItem.prop])}}</view>
<view class="select_value" wx:if="{{ subItem.type == 'select' }}" catch:tap="selectTap" data-index="{{ index }}">
<text class="text-hide">{{filmOrderData[item.filmOrder]}}</text>
<image src="/components/images/arrow-x.png" mode="" />
<image class="select-arrow" src="/components/images/arrow-x.png" mode="" />
</view>
<view class="value" wx:if="{{ subItem.type !== 'price' && subItem.type !== 'select' }}">
{{item[subItem.prop]}}
......
......@@ -65,7 +65,8 @@ Page({
shopSideSelectPopup: false,
flag: true,
dateObj: {
beginDateStr: ''
beginDateStr: '',
today: ''
},
showPicker: false,
// showPicker: true
......@@ -95,7 +96,7 @@ Page({
showReportPopup: false,
reportTemplateList: [],
currentReportItem: null,
serviceCenterUnreadNum: 0,
maxDate: '',
},
onReportPopupCancel() {
this.setData({
......@@ -833,7 +834,8 @@ Page({
dataMonth,
pointUnit: 1, // 1日,2月,默认日
type: 'month',
label: month + 1 + '月份'
label: month + 1 + '月份',
today: data.format('yyyy-MM-dd')
}
})
},
......
......@@ -226,7 +226,7 @@
calenderColor="#347BFF"
vertical
minDate="2020-10-01"
maxDate="{{ dateObj.today }}"
maxDate="{{ dateObj.today || '' }}"
forceFullSucreen="{{ bottomLift>0?true:false }}"
isComponents
>
......
......@@ -3,6 +3,7 @@
*/
import api from '../api.js'
import commonApi from '../../api/api.js'
import { getSystemInfoSync } from '~/utils/systemInfo'
import {
shouldSkipOrderStaffPop,
shouldSkipAbnormalOrderPop
......@@ -110,7 +111,7 @@ export function checkAbnormalOrderLocal(page) {
/** 企微/微信登录环境校验 */
export function checkAgreeClient(page, loginUserObj) {
return new Promise(resolve => {
const sysInfo = wx.getSystemInfoSync()
const sysInfo = getSystemInfoSync()
const envName = sysInfo.environment ? 1 : 0
const { merchantId: yqMerchantId } = loginUserObj
......
......@@ -4,7 +4,22 @@
export function setupWxMock(globalRef = globalThis) {
globalRef.wx = {
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'release' } }),
getSystemInfoSync: () => ({}),
getDeviceInfo: () => ({ platform: 'devtools' }),
getWindowInfo: () => ({
windowWidth: 375,
windowHeight: 667,
statusBarHeight: 20,
pixelRatio: 2,
screenWidth: 375,
screenHeight: 667,
safeArea: { top: 20, bottom: 667, height: 647 },
}),
getAppBaseInfo: () => ({
SDKVersion: '3.0.0',
host: 'WeChat',
version: '8.0.0',
language: 'zh_CN',
}),
$hasPermission: {
isTechnician: u => u?.loginRole === 7,
isSuper: u => !!u?.isSuper,
......
......@@ -2,11 +2,12 @@ import { IMG_URL } from '../../../utils/imageBase.js'
// tabOperating/pages/operatingShow/operatingShow.js
import api from '../../api.js'
import { getYQInfo } from '~/store/index'
import { getSystemInfoSync } from '~/utils/systemInfo'
// import WXMLCanvas from '../../wxml-canvas/index'
//设计稿宽度,一般为750
const UI_Width = 750
//同步获取设备系统信息
const info = wx.getSystemInfoSync()
const info = getSystemInfoSync()
//设备像素密度
const dpr = info.pixelRatio
//计算比例
......@@ -304,7 +305,7 @@ Page({
this.setCanvasText(context, `数据统计日期:${dateObj.toadyforList}`, 280, 350, 10, '#666666', 'normal')
const dpr = wx.getSystemInfoSync().pixelRatio
const dpr = getSystemInfoSync().pixelRatio
// context.width = 710 * dpr
// context.height = 700 * dpr
......
// tabOperating/pages/index.js
import { getSystemInfoSync } from '~/utils/systemInfo'
const app = getApp()
Page({
......@@ -59,7 +60,7 @@ Page({
let webUrl = this.data;
let index = 2;
let accountInfo = wx.getAccountInfoSync();
let systemInfo = wx.getSystemInfoSync();
let systemInfo = getSystemInfoSync();
let envName = accountInfo.miniProgram.envVersion;
let {type} = this.data;
//手动控制体验版环境的请求 true就依据下面index false就默认2
......
// components/OrderPopup/OrderPopup.js
import qrcode from '~/utils/lib/wxqrcode'
import api from '~/api/api.js'
import { getSystemInfoSync } from '~/utils/systemInfo'
Component({
/**
* 组件的属性列表
......@@ -124,7 +125,7 @@ Component({
console.log(text)
let size = 0
try {
const info = wx.getSystemInfoSync()
const info = getSystemInfoSync()
let scale = info.windowWidth / 750 //不同屏幕下QRcode的适配比例;设计稿是750宽
let width = 300 * scale
size = width
......
// tabWorkOrder/pages/createOrder/createOrder.js
import { getSystemInfoSync } from '~/utils/systemInfo'
import { checkDailyReport, checkStudyTask } from '~/store/ModalToQueueControl'
import api from '../../api'
import {
......@@ -1753,7 +1754,7 @@ Page({
/*获取屏幕高度*/
this.setData({
windowHeight: wx.getSystemInfoSync().windowHeight
windowHeight: getSystemInfoSync().windowHeight
})
// console.log(app.globalData.YQorderSetting, 'app.globalData.YQorderSetting?.yqPhoneConfig')
......
// import { commonApi, equityApi } from '../../api/api'
import { uploadImg } from '~/api/api'
import { getSystemInfoSync } from '~/utils/systemInfo'
// import { quotationUpgrade, updateOrderStatus } from '../../../api'
Page({
data: {
......@@ -30,7 +31,7 @@ Page({
})
},
onLoad(options) {
let { windowWidth, windowHeight } = wx.getSystemInfoSync()
let { windowWidth, windowHeight } = getSystemInfoSync()
if (options.writeOffCode) {
this.writeOffCode = options.writeOffCode
}
......
// components/OcrPhoto.js
import api from '~/api/api.js'
import { getSystemInfoSync } from '~/utils/systemInfo'
Page({
/**
* 组件的属性列表
......@@ -373,7 +374,7 @@ Page({
// // 在组件实例进入页面节点树时执行
var that = this
that.ctx = wx.createCameraContext()
let { windowWidth, windowHeight } = wx.getSystemInfoSync()
let { windowWidth, windowHeight } = getSystemInfoSync()
this.setData({ windowWidth, windowHeight })
},
// 在页面首次渲染实现生命周期获取操作canvas的上下文对象
......
import { describe, it, beforeEach } from 'node:test'
import assert from 'node:assert/strict'
const deviceInfo = {
platform: 'ios',
brand: 'Apple',
model: 'iPhone',
system: 'iOS 16',
}
const windowInfo = {
windowWidth: 390,
windowHeight: 844,
statusBarHeight: 47,
pixelRatio: 3,
screenWidth: 390,
screenHeight: 844,
safeArea: { top: 47, bottom: 810, height: 763 },
deviceOrientation: 'portrait',
}
function setupWx(host = 'WeChat') {
globalThis.wx = {
getDeviceInfo: () => ({ ...deviceInfo }),
getWindowInfo: () => ({ ...windowInfo }),
getAppBaseInfo: () => ({
SDKVersion: '3.13.1',
host,
version: '8.0.0',
language: 'zh_CN',
fontSizeSetting: 16,
}),
}
}
describe('systemInfo', () => {
beforeEach(() => {
setupWx()
})
it('getSystemInfoSync merges device, window and app base info', async () => {
const { getSystemInfoSync } = await import('../utils/systemInfo.js')
const info = getSystemInfoSync()
assert.equal(info.platform, 'ios')
assert.equal(info.windowWidth, 390)
assert.equal(info.statusBarHeight, 47)
assert.equal(info.SDKVersion, '3.13.1')
assert.equal(info.fontSizeSetting, 16)
assert.equal(info.deviceOrientation, 'portrait')
})
it('maps wxwork host to environment wxwork', async () => {
setupWx('wxwork')
const { getSystemInfoSync } = await import('../utils/systemInfo.js')
const info = getSystemInfoSync()
assert.equal(info.environment, 'wxwork')
assert.equal(info.host, 'wxwork')
})
it('maps WeChat host to empty environment for legacy truthy checks', async () => {
setupWx('WeChat')
const { getSystemInfoSync } = await import('../utils/systemInfo.js')
const info = getSystemInfoSync()
assert.equal(info.environment, '')
})
it('getSystemInfo invokes success callback with merged info', async () => {
const { getSystemInfo } = await import('../utils/systemInfo.js')
let result = null
getSystemInfo({
success(res) {
result = res
},
})
assert.equal(result?.pixelRatio, 3)
assert.equal(result?.brand, 'Apple')
})
})
import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import { mergeWorkSettingFromApi } from '../pages/tabMine/services/workSetting.helpers.js'
function createWorkItem() {
return [
{ label: '上午 09:00-10:30', startTime: '09:00', endTime: '10:30', maxCount: 0 },
{ label: '上午 10:30-12:00', startTime: '10:30', endTime: '12:00', maxCount: 0 },
{ label: '下午 13:00-14:30', startTime: '13:00', endTime: '14:30', maxCount: 0 },
{ label: '下午 14:30-16:00', startTime: '14:30', endTime: '16:00', maxCount: 0 },
{ label: '下午 16:00-17:30', startTime: '16:00', endTime: '17:30', maxCount: 0 }
]
}
describe('mergeWorkSettingFromApi', () => {
it('merges 5 items in order', () => {
const workItem = createWorkItem()
const apiList = [
{ startTime: '09:00', endTime: '10:30', maxCount: 1, saturdayFlag: 'N', sundayFlag: 'N' },
{ startTime: '10:30', endTime: '12:00', maxCount: 2 },
{ startTime: '13:00', endTime: '14:30', maxCount: 3 },
{ startTime: '14:30', endTime: '16:00', maxCount: 4 },
{ startTime: '16:00', endTime: '17:30', maxCount: 5, saturdayFlag: 'Y', sundayFlag: 'Y' }
]
const result = mergeWorkSettingFromApi(workItem, apiList)
assert.deepEqual(workItem.map((item) => item.maxCount), [1, 2, 3, 4, 5])
assert.equal(result.workCount, 15)
assert.equal(result.saturdayFlag, true)
assert.equal(result.sundayFlag, true)
})
it('ignores extra api items beyond 5 slots without throwing', () => {
const workItem = createWorkItem()
const apiList = [
...createWorkItem().map((item, index) => ({
startTime: item.startTime,
endTime: item.endTime,
maxCount: index + 1
})),
{ startTime: '18:00', endTime: '19:30', maxCount: 99 },
{ startTime: '20:00', endTime: '21:30', maxCount: 88 }
]
const result = mergeWorkSettingFromApi(workItem, apiList)
assert.deepEqual(workItem.map((item) => item.maxCount), [1, 2, 3, 4, 5])
assert.equal(result.workCount, 15)
})
it('partially updates when api returns fewer than 5 items', () => {
const workItem = createWorkItem()
workItem[3].maxCount = 9
workItem[4].maxCount = 9
const result = mergeWorkSettingFromApi(workItem, [
{ startTime: '09:00', endTime: '10:30', maxCount: 2 },
{ startTime: '10:30', endTime: '12:00', maxCount: 3 }
])
assert.deepEqual(workItem.map((item) => item.maxCount), [2, 3, 0, 9, 9])
assert.equal(result.workCount, 5)
})
it('matches by time slot when api order is shuffled', () => {
const workItem = createWorkItem()
const apiList = [
{ startTime: '16:00', endTime: '17:30', maxCount: 5 },
{ startTime: '09:00', endTime: '10:30', maxCount: 1 },
{ startTime: '14:30', endTime: '16:00', maxCount: 4 },
{ startTime: '13:00', endTime: '14:30', maxCount: 3 },
{ startTime: '10:30', endTime: '12:00', maxCount: 2 }
]
const result = mergeWorkSettingFromApi(workItem, apiList)
assert.deepEqual(workItem.map((item) => item.maxCount), [1, 2, 3, 4, 5])
assert.equal(result.workCount, 15)
})
it('returns empty merge for empty api list', () => {
const workItem = createWorkItem()
const result = mergeWorkSettingFromApi(workItem, [], {
saturdayFlag: false,
sundayFlag: true
})
assert.equal(result.workCount, 0)
assert.equal(result.saturdayFlag, false)
assert.equal(result.sundayFlag, true)
})
})
// 实例化对象存储
import { Storage } from './storage'
import { getSystemInfo } from '~/utils/systemInfo'
const $Storage = new Storage()
// console.log($Storage)
/** */
......@@ -53,7 +54,7 @@ export function setSystem_info() {
// console.log($Storage.get)
// console.log(info, 'info')
!info &&
wx.getSystemInfo({
getSystemInfo({
success(res) {
// console.log(res)
$Storage.set('system_info', res)
......
/**
* @file 系统信息兼容层:合并微信新 API,替代已废弃的 wx.getSystemInfoSync / wx.getSystemInfo。
* 纯函数模块,不调 setData、不访问页面实例。
*/
/**
* 将 getAppBaseInfo().host 映射为旧版 environment 字段(企微判断依赖此值)
* @param {string} [host]
* @returns {string}
*/
function mapEnvironment(host) {
return host === 'wxwork' ? 'wxwork' : ''
}
/**
* 同步获取与旧版 getSystemInfoSync 兼容的系统信息对象
* @returns {WechatMiniprogram.SystemInfo}
*/
export function getSystemInfoSync() {
const deviceInfo = wx.getDeviceInfo()
const windowInfo = wx.getWindowInfo()
const appBaseInfo = wx.getAppBaseInfo()
return {
...deviceInfo,
...windowInfo,
...appBaseInfo,
environment: mapEnvironment(appBaseInfo.host),
}
}
/**
* 异步获取系统信息,行为对齐旧版 wx.getSystemInfo
* @param {WechatMiniprogram.GetSystemInfoOption} [options]
*/
export function getSystemInfo(options = {}) {
try {
const res = getSystemInfoSync()
options.success?.(res)
} catch (err) {
options.fail?.(err)
} finally {
options.complete?.()
}
}
......@@ -186,12 +186,12 @@ class TRACK {
.then(({ code, data, message }) => {
if (code == 0 && data) {
$Storage.set('recordList', [])
console.log(
'---------------- 埋点定时推送成功 ----------------',
new Date().format('yyyy-MM-dd hh:mm:ss'),
':',
recordList
)
// console.log(
// '---------------- 埋点定时推送成功 ----------------',
// new Date().format('yyyy-MM-dd hh:mm:ss'),
// ':',
// recordList
// )
} else
console.log(
'---------------- 埋点定时推送失败 ----------------',
......
import wxqrcode from '~/utils/lib/wxqrcode.js'
import { getSystemInfo, getSystemInfoSync } from '~/utils/systemInfo'
/**
* 微信校验通知类工具封装
*/
......@@ -174,7 +175,7 @@ const getViewInfo = (name, callBack, isComponents) => {
// 获取设备信息
const getDeviceSize = () => {
return new Promise((resolve, reject) => {
wx.getSystemInfo({
getSystemInfo({
success: function (res) {
// console.log(res)
const { screenHeight, safeArea } = res
......@@ -194,7 +195,7 @@ const isFullSucreen = isComponents => {
const routerList = wx.$router.getRouterList()
const router = routerList.find(item => item.url === `/${thisPage.route}`)
let val = false
wx.getSystemInfo({
getSystemInfo({
success(res) {
let { statusBarHeight, screenHeight, windowHeight, safeArea } = res
// console.log(statusBarHeight, screenHeight, windowHeight, safeArea)
......@@ -236,8 +237,8 @@ const isFullSucreen = isComponents => {
// })
// }
/**获取设备信息 */
const getSystemInfo = callBack => {
wx.getSystemInfo({
const getSystemInfoCallback = callBack => {
getSystemInfo({
success(res) {
callBack(res)
},
......@@ -249,7 +250,7 @@ const getSystemInfo = callBack => {
const wxApi = {
// getPhoneInfo,
previewImage,
getSystemInfo,
getSystemInfo: getSystemInfoCallback,
showLoading,
hideLoading,
setCopyData,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!