Commit e39e3ddf by 张立顺

fix bug

1 parent 065ff0ca
//app.js //app.js
// 初始化sentry // 初始化sentry
import sentryInit from "~/utils/sentryConfig/sentryInit"; import sentryInit from '~/utils/sentryConfig/sentryInit'
const sentry = sentryInit(); const sentry = sentryInit()
wx.$sendSentry = function (e) { wx.$sendSentry = function (e) {
sentry.captureException(e); sentry.captureException(e)
}; }
// 解决showLoading 和 showToast显示异常的问题 // 解决showLoading 和 showToast显示异常的问题
import fixWxShowToast from "./utils/lib/fixWxShowToast"; import fixWxShowToast from './utils/lib/fixWxShowToast'
fixWxShowToast(); fixWxShowToast()
import router from "./router/index.js"; import router from './router/index.js'
// 判断小程序是否需要更新 // 判断小程序是否需要更新
import getUpdateManager from "./utils/lib/wxUpdateManager"; import getUpdateManager from './utils/lib/wxUpdateManager'
import util from "./utils/util.js"; import util from './utils/util.js'
import wxApi from "./utils/utils_wx"; import wxApi from './utils/utils_wx'
// 实例化对象存储 // 实例化对象存储
import { Storage } from "~/utils/cache/storage"; import { Storage } from '~/utils/cache/storage'
const $Storage = new Storage(); const $Storage = new Storage()
import { import {
setSystem_info, setSystem_info,
getNoSignInUuid, getNoSignInUuid,
removeSystemStorage, removeSystemStorage,
rmNoSignInUuid rmNoSignInUuid
} from "~/utils/cache/storageApi"; } from '~/utils/cache/storageApi'
setSystem_info(); // 存储设备信息 setSystem_info() // 存储设备信息
import { checkYqdSuper, checkScene } from "~/store/index"; import { checkYqdSuper, checkScene } from '~/store/index'
import eventbus from "./utils/eventbus"; import eventbus from './utils/eventbus'
import api from "./api/api"; import api from './api/api'
import { Version } from "glsx-common-sdk"; import { Version } from 'glsx-common-sdk'
import { areaList } from "@vant/area-data"; //预加载省市区 import { areaList } from '@vant/area-data' //预加载省市区
import globalDataFunction from './mixins/globalDataFunction' import globalDataFunction from './mixins/globalDataFunction'
...@@ -37,90 +37,90 @@ const $Track = new Track() ...@@ -37,90 +37,90 @@ const $Track = new Track()
// 将 api.reNoSignIn() 函数包装为防抖函数 // 将 api.reNoSignIn() 函数包装为防抖函数
const debouncedReNoSignIn = debounce(function (noSignInUuid, that) { const debouncedReNoSignIn = debounce(function (noSignInUuid, that) {
console.log("debouncedReNoSignIn2222"); console.log('debouncedReNoSignIn2222')
api api
.reNoSignIn({ .reNoSignIn({
noSignInUuid: noSignInUuid, noSignInUuid: noSignInUuid
}) })
.then((res) => { .then(res => {
let { code, data } = res; let { code, data } = res
if (code == "0" && data) { if (code == '0' && data) {
util.setSessionId(data?.sessionId); util.setSessionId(data?.sessionId)
// debugger // debugger
// 还要判断一下他是不是全部登录完,不是直接打到账号选择页面 // 还要判断一下他是不是全部登录完,不是直接打到账号选择页面
if (!data.needSelectAccount) { if (!data.needSelectAccount) {
wx.reLaunch({ url: "/pages/loading/loading" }); wx.reLaunch({ url: '/pages/loading/loading' })
} else { } else {
// debugger // debugger
wx.reLaunch({ url: "/pages/accountItems/accountItems" }); wx.reLaunch({ url: '/pages/accountItems/accountItems' })
} }
} else { } else {
util.removeStorage(); util.removeStorage()
removeSystemStorage(); removeSystemStorage()
that.login(false); that.login(false)
} }
}); })
}, 0); // 设置防抖时间为 0 秒 }, 0) // 设置防抖时间为 0 秒
// }, 0); // 设置防抖时间为 5 秒 // }, 0); // 设置防抖时间为 5 秒
// 定义一个防抖函数 // 定义一个防抖函数
function debounce(func, timeout) { function debounce(func, timeout) {
let timer; let timer
return (...args) => { return (...args) => {
clearTimeout(timer); clearTimeout(timer)
timer = setTimeout(() => { timer = setTimeout(() => {
func.apply(this, args); func.apply(this, args)
}, timeout); }, timeout)
}; }
} }
App({ App({
onLaunch() { onLaunch() {
/**挂载到wx对象 */ /**挂载到wx对象 */
wx.$storage = $Storage; /** 挂载全局缓存方法 */ wx.$storage = $Storage /** 挂载全局缓存方法 */
wx.$router = router; wx.$router = router
wx.$modal = this.showModal; wx.$modal = this.showModal
wx.$util = util; wx.$util = util
wx.$api = wxApi; wx.$api = wxApi
wx.$eventbus = eventbus; wx.$eventbus = eventbus
wx.$areaList = areaList; wx.$areaList = areaList
wx.$track = $Track wx.$track = $Track
let userInfo = util.getStorageSync("dj_boutique_user_info"); let userInfo = util.getStorageSync('dj_boutique_user_info')
// ,this.globalData, userInfo // ,this.globalData, userInfo
userInfo && this.gobalCheckYqdSuper(userInfo); userInfo && this.gobalCheckYqdSuper(userInfo)
wx.$versionConfig = new Version({ wx.$versionConfig = new Version({
request: { request: {
baseUrl: "https://config-center-backend.glsx.com.cn/glsxAdmin/config", baseUrl: 'https://config-center-backend.glsx.com.cn/glsxAdmin/config',
isSign: false, isSign: false
}, }
}); })
wx.$globalDataFunction = globalDataFunction wx.$globalDataFunction = globalDataFunction
}, },
async getVersionInfo(request) { async getVersionInfo(request) {
if (request) this.globalData.versionData = null; if (request) this.globalData.versionData = null
const { versionData } = this.globalData; const { versionData } = this.globalData
if (versionData) return versionData; if (versionData) return versionData
else { else {
const res = await wx.$versionConfig.get({ const res = await wx.$versionConfig.get({
moduleUrl: "dj-car-boutique-work-wechat", moduleUrl: 'dj-car-boutique-work-wechat',
// moduleUrl: 'business-assistant', // moduleUrl: 'business-assistant',
env: "update", env: 'update'
}); })
this.globalData.versionData = res; this.globalData.versionData = res
return res; return res
} }
}, },
showModal(that, options, id = "#modal") { showModal(that, options, id = '#modal') {
// id = id || "#modal"; // id = id || "#modal";
that.selectComponent(id).showModal(options); that.selectComponent(id).showModal(options)
}, },
gobalCheckYqdSuper(userInfo) { gobalCheckYqdSuper(userInfo) {
checkYqdSuper(userInfo, this.globalData); checkYqdSuper(userInfo, this.globalData)
}, },
onShow(options) { onShow(options) {
wx.onMemoryWarning(function () { wx.onMemoryWarning(function () {
console.log("onMemoryWarningReceive"); console.log('onMemoryWarningReceive')
}); })
// console.log('lifeshow') // console.log('lifeshow')
getUpdateManager(); getUpdateManager()
// options = { // options = {
// query: { // query: {
// page: 'playVideo', // page: 'playVideo',
...@@ -133,26 +133,26 @@ App({ ...@@ -133,26 +133,26 @@ App({
if (options) { if (options) {
console.log('options', options) console.log('options', options)
let res = checkScene(options); let res = checkScene(options)
// console.log(res, 'res') // console.log(res, 'res')
// 如果需要重新登录 去掉30天免登录逻辑避免自动登录直接跳回到首页去 // 如果需要重新登录 去掉30天免登录逻辑避免自动登录直接跳回到首页去
if (res) { if (res) {
rmNoSignInUuid() rmNoSignInUuid()
this.login(true, res); this.login(true, res)
} }
// res && // res &&
} }
}, },
login(relogin, context, RequestMethods) { login(relogin, context, RequestMethods) {
let that = this; let that = this
// 清空多账号信息 // 清空多账号信息
if (relogin) { if (relogin) {
// 判断有没有 30 天免登陆 有直接跳选园区 // 判断有没有 30 天免登陆 有直接跳选园区
let noSignInUuid = getNoSignInUuid(); let noSignInUuid = getNoSignInUuid()
console.log("noSignInUuid", noSignInUuid); console.log('noSignInUuid', noSignInUuid)
if (noSignInUuid) { if (noSignInUuid) {
// 调用防抖函数 // 调用防抖函数
debouncedReNoSignIn(noSignInUuid, that); debouncedReNoSignIn(noSignInUuid, that)
// util.debounce(() => { // util.debounce(() => {
// console.log(1112); // console.log(1112);
// api // api
...@@ -176,57 +176,62 @@ App({ ...@@ -176,57 +176,62 @@ App({
} else { } else {
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
// 启动页loading中的埋点接口 在触发登录超时后 ios端wx.showModal会被页面跳转截断,导致无弹窗,将loading页面这个埋点接口的登录超时不做弹窗处理 // 启动页loading中的埋点接口 在触发登录超时后 ios端wx.showModal会被页面跳转截断,导致无弹窗,将loading页面这个埋点接口的登录超时不做弹窗处理
if (thisPage?.route == 'pages/loading/loading' && RequestMethods.includes('dj.api.smartcarlife.staff.login.record.save')) return if (
thisPage?.route == 'pages/loading/loading' &&
RequestMethods.includes('dj.api.smartcarlife.staff.login.record.save')
)
return
// 标志位 解决安卓查复弹框问题 // 标志位 解决安卓查复弹框问题
if (wx.__HAS_NOTLOGIN_MODAL) return false; if (wx.__HAS_NOTLOGIN_MODAL) return false
wx.__HAS_NOTLOGIN_MODAL = true; wx.__HAS_NOTLOGIN_MODAL = true
wx.showModal({ wx.showModal({
title: "温馨提示", title: '温馨提示',
content: context || "登录过期,请重新登录。", content: context || '登录过期,请重新登录。',
showCancel: false, showCancel: false,
confirmText: "去登录", confirmText: '去登录',
confirmColor: "#2C66F7", confirmColor: '#2C66F7',
success(res) { success(res) {
if (res.confirm) { if (res.confirm) {
that.globalData.yqdInfo = {}; that.globalData.yqdInfo = {}
that.globalData.YQorderSetting = ""; that.globalData.YQorderSetting = ''
that.globalData.YQList = ""; that.globalData.YQList = ''
that.globalData.businessSchoolScene = ""; that.globalData.businessSchoolScene = ''
util.removeStorage(); util.removeStorage()
wx.$relogin = relogin; wx.$relogin = relogin
router.reLaunch("pages.wxLogin"); router.reLaunch('pages.wxLogin')
} }
}, },
complete: () => { complete: () => {
// 这个延迟的目的是为了避免短时间内重复弹出 // 这个延迟的目的是为了避免短时间内重复弹出
// 你要是没有这个需要也可以去掉,直接把标志位改成 false 就行 // 你要是没有这个需要也可以去掉,直接把标志位改成 false 就行
setTimeout(() => { setTimeout(() => {
wx.__HAS_NOTLOGIN_MODAL = false; wx.__HAS_NOTLOGIN_MODAL = false
}, 2000); }, 2000)
}, }
}); })
} }
} else { } else {
this.globalData.yqdInfo = {}; this.globalData.yqdInfo = {}
this.globalData.YQorderSetting = ""; this.globalData.YQorderSetting = ''
this.globalData.YQList = ""; this.globalData.YQList = ''
this.globalData.businessSchoolScene = ""; this.globalData.businessSchoolScene = ''
util.removeStorage(); util.removeStorage()
removeSystemStorage(); removeSystemStorage()
wx.$relogin = relogin; wx.$relogin = relogin
router.reLaunch("pages.wxLogin"); router.reLaunch('pages.wxLogin')
} }
}, },
globalData: { globalData: {
statusBarHeight: wx.getSystemInfoSync()["statusBarHeight"], // 头部导航栏的高度 statusBarHeight: wx.getSystemInfoSync()['statusBarHeight'], // 头部导航栏的高度
yqdInfo: {}, yqdInfo: {},
isYqdSuper: true, isYqdSuper: true,
isStaff: false, isStaff: false,
YQorderSetting: "", YQorderSetting: '',
count: "", count: '',
versionData: null, versionData: null,
businessSchoolScene: "", businessSchoolScene: '',
ROUTE_QUERY: {},//路由携带的参数 ROUTE_QUERY: {}, //路由携带的参数
}, isChoosingMedia: false
}); }
})
...@@ -18,7 +18,7 @@ export const appId = 'wx570d9331f9ace0bd' ...@@ -18,7 +18,7 @@ export const appId = 'wx570d9331f9ace0bd'
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 2 let index = 1
const accountInfo = wx.getAccountInfoSync() const accountInfo = wx.getAccountInfoSync()
const systemInfo = wx.getSystemInfoSync() const systemInfo = wx.getSystemInfoSync()
const envName = accountInfo.miniProgram.envVersion const envName = accountInfo.miniProgram.envVersion
......
// packageWorkspace/pages/validReferralCount/components/editItem/editItem.js // packageWorkspace/pages/validReferralCount/components/editItem/editItem.js
import api from '~/api/api.js' import api from '~/api/api.js'
const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/' const IMG_URL =
'https://img02.glsx.com.cn/weapp/resource/miniprogram/regional-assistant/'
Component({ Component({
properties: { properties: {
...@@ -9,7 +10,7 @@ Component({ ...@@ -9,7 +10,7 @@ Component({
value: {}, value: {},
observer(newVal) { observer(newVal) {
if (newVal) { if (newVal) {
this.initData(newVal); this.initData(newVal)
} }
} }
} }
...@@ -17,7 +18,7 @@ Component({ ...@@ -17,7 +18,7 @@ Component({
data: { data: {
IMG_URL, IMG_URL,
// 业务场景:1-精品升级(轻改);2-会员权益(广联权益);3-单延保; // 业务场景:1-精品升级(轻改);2-会员权益(广联权益);3-单延保;
sceneMap: { sceneMap: {
1: '轻改', 1: '轻改',
2: '广联权益', 2: '广联权益',
...@@ -31,7 +32,7 @@ Component({ ...@@ -31,7 +32,7 @@ Component({
lifetimes: { lifetimes: {
attached() { attached() {
if (this.data.item) { if (this.data.item) {
this.checkRemarkRequired(this.data.item); this.checkRemarkRequired(this.data.item)
} }
} }
}, },
...@@ -40,78 +41,87 @@ Component({ ...@@ -40,78 +41,87 @@ Component({
initData(item) { initData(item) {
// Initialize fileList from imageUrls // Initialize fileList from imageUrls
if (item.imageUrls) { if (item.imageUrls) {
const urls = item.imageUrls.split(',').filter(i => i); const urls = item.imageUrls.split(',').filter(i => i)
const fileList = urls.map(url => ({ const fileList = urls.map(url => ({
fileUrl: url, fileUrl: url
})); }))
this.setData({ fileList }); this.setData({ fileList })
} else { } else {
this.setData({ fileList: [] }); this.setData({ fileList: [] })
} }
}, },
// Check if remark is required // Check if remark is required
checkRemarkRequired(item) { checkRemarkRequired(item) {
let isRequired = false; let isRequired = false
const list = item?.effectiveReferralCountDTOS || []; const list = item?.effectiveReferralCountDTOS || []
for (const dto of list) { for (const dto of list) {
const referral = parseInt(dto.effectiveReferralCount || 0, 10); const referral = parseInt(dto.effectiveReferralCount || 0, 10)
const delivery = parseInt(dto.deliveryCount || 0, 10); const delivery = parseInt(dto.deliveryCount || 0, 10)
if (referral != delivery) { if (referral != delivery) {
isRequired = true; isRequired = true
break; break
} }
} }
this.setData({ isRemarkRequired: isRequired }); this.setData({ isRemarkRequired: isRequired })
}, },
// Handle Effective Referral Count Change // Handle Effective Referral Count Change
onCountChange(e) { onCountChange(e) {
const index = e.currentTarget.dataset.index; const index = e.currentTarget.dataset.index
let value = e.detail; let value = e.detail
// Ensure it's a string // Ensure it's a string
value = String(value); value = String(value)
// Remove any non-digit characters (integer only) // Remove any non-digit characters (integer only)
let sanitizedValue = value.replace(/\D/g, ''); let sanitizedValue = value.replace(/\D/g, '')
// Handle range check (0-100,000,000) // Handle range check (0-100,000,000)
if (sanitizedValue !== '') { if (sanitizedValue !== '') {
let num = parseInt(sanitizedValue, 10); let num = parseInt(sanitizedValue, 10)
if (num > 100000000) { if (num > 100000000) {
num = 100000000; num = 100000000
} }
sanitizedValue = String(num); sanitizedValue = String(num)
} }
const key = `item.effectiveReferralCountDTOS[${index}].effectiveReferralCount`; const key = `item.effectiveReferralCountDTOS[${index}].effectiveReferralCount`
this.setData({ this.setData(
[key]: sanitizedValue {
}, () => { [key]: sanitizedValue
// Re-check remark requirement },
this.checkRemarkRequired(this.data.item); () => {
}); // Re-check remark requirement
this.checkRemarkRequired(this.data.item)
}
)
}, },
// Handle Remark Change // Handle Remark Change
onRemarkChange(e) { onRemarkChange(e) {
this.setData({ this.setData({
'item.remark': e.detail.value 'item.remark': e.detail.value
}); })
}, },
// Upload Images // Upload Images
uploadImages() { uploadImages() {
let _this = this let _this = this
let { fileList, fileMaxLen } = _this.data let { fileList, fileMaxLen } = _this.data
getApp().globalData.isChoosingMedia = true
wx.chooseMedia({ wx.chooseMedia({
count: fileMaxLen - fileList.length, count: fileMaxLen - fileList.length,
sizeType: ['original'], sizeType: ['original'],
mediaType: ['image'], mediaType: ['image'],
complete() {
setTimeout(() => {
getApp().globalData.isChoosingMedia = false
}, 500)
},
success(res) { success(res) {
wx.showLoading({ title: '上传中' }) wx.showLoading({ title: '上传中' })
const uploadImages = async (tempFiles) => { const uploadImages = async tempFiles => {
try { try {
for (const item of tempFiles) { for (const item of tempFiles) {
const val = item.tempFilePath const val = item.tempFilePath
...@@ -153,7 +163,9 @@ Component({ ...@@ -153,7 +163,9 @@ Component({
// Preview Image // Preview Image
previewImage(e) { previewImage(e) {
let { url, index } = e.currentTarget.dataset let { url, index } = e.currentTarget.dataset
let imageUrl = url?.map(v => { return v.fileUrl}) let imageUrl = url?.map(v => {
return v.fileUrl
})
wx.previewImage({ wx.previewImage({
urls: imageUrl, urls: imageUrl,
current: imageUrl[index] current: imageUrl[index]
...@@ -171,26 +183,26 @@ Component({ ...@@ -171,26 +183,26 @@ Component({
// Sync fileList to item.imageUrls // Sync fileList to item.imageUrls
updateImageUrls(fileList) { updateImageUrls(fileList) {
const urls = fileList.map(file => file.fileUrl).join(','); const urls = fileList.map(file => file.fileUrl).join(',')
this.setData({ this.setData({
'item.imageUrls': urls 'item.imageUrls': urls
}); })
}, },
// Validate Referral Counts // Validate Referral Counts
validateReferralCounts() { validateReferralCounts() {
const { effectiveReferralCountDTOS, remark } = this.data.item; const { effectiveReferralCountDTOS, remark } = this.data.item
const { isRemarkRequired, fileList } = this.data; const { isRemarkRequired, fileList } = this.data
if (effectiveReferralCountDTOS && effectiveReferralCountDTOS.length > 0) { if (effectiveReferralCountDTOS && effectiveReferralCountDTOS.length > 0) {
for (const dto of effectiveReferralCountDTOS) { for (const dto of effectiveReferralCountDTOS) {
const val = dto.effectiveReferralCount; const val = dto.effectiveReferralCount
if (val == null || val == undefined || val == "") { if (val == null || val == undefined || val == '') {
wx.showToast({ wx.showToast({
title: `${dto.brandName}交车数有效引荐数未填`, title: `${dto.brandName}交车数有效引荐数未填`,
icon: "none", icon: 'none'
}); })
return false; return false
} }
} }
} }
...@@ -198,34 +210,34 @@ Component({ ...@@ -198,34 +210,34 @@ Component({
if (isRemarkRequired) { if (isRemarkRequired) {
if (fileList.length === 0) { if (fileList.length === 0) {
wx.showToast({ wx.showToast({
title: "有效引荐数与交车数不一致,请上传凭证", title: '有效引荐数与交车数不一致,请上传凭证',
icon: "none", icon: 'none'
}); })
return false; return false
} }
if (!remark) { if (!remark) {
wx.showToast({ wx.showToast({
title: "有效引荐数与交车数不一致,请填写备注", title: '有效引荐数与交车数不一致,请填写备注',
icon: "none", icon: 'none'
}); })
return false; return false
} }
} }
return true; return true
}, },
// Save Draft // Save Draft
onDraft() { onDraft() {
if (!this.validateReferralCounts()) return; if (!this.validateReferralCounts()) return
this.triggerEvent('draft', this.data.item); this.triggerEvent('draft', this.data.item)
}, },
// Submit // Submit
onSubmit() { onSubmit() {
if (!this.validateReferralCounts()) return; if (!this.validateReferralCounts()) return
this.triggerEvent('submit', this.data.item); this.triggerEvent('submit', this.data.item)
} }
} }
}) })
...@@ -12,8 +12,10 @@ export const checkYqdSuper = (userInfo, globalData) => { ...@@ -12,8 +12,10 @@ export const checkYqdSuper = (userInfo, globalData) => {
}) })
// 解决传入app 在初始化获取不到的bug // 解决传入app 在初始化获取不到的bug
// console.log(userInfo, 'userInfo') // console.log(userInfo, 'userInfo')
globalData.isYqdSuper = userInfo.userType != 2 && !userInfo.isSuper && merchantAccountType globalData.isYqdSuper =
globalData.isStaff = userInfo.userType == 2 && !userInfo.isSuper && merchantAccountType userInfo.userType != 2 && !userInfo.isSuper && merchantAccountType
globalData.isStaff =
userInfo.userType == 2 && !userInfo.isSuper && merchantAccountType
const loginRole = userInfo.loginRole const loginRole = userInfo.loginRole
if (loginRole) { if (loginRole) {
globalData.isYqdSuper = [2, 3].includes(loginRole) globalData.isYqdSuper = [2, 3].includes(loginRole)
...@@ -66,7 +68,8 @@ export const getYQInfo = userInfo => { ...@@ -66,7 +68,8 @@ export const getYQInfo = userInfo => {
if (data.length > 1) { if (data.length > 1) {
if (userInfo.merchantId != userInfo.subLoginUser.merchantId) { if (userInfo.merchantId != userInfo.subLoginUser.merchantId) {
data.map((e, index) => { data.map((e, index) => {
if (e.merchantId == userInfo.subLoginUser.merchantId) subIndex = index + 1 if (e.merchantId == userInfo.subLoginUser.merchantId)
subIndex = index + 1
}) })
} }
arr = [all, ...data] arr = [all, ...data]
...@@ -121,7 +124,9 @@ export const getYQorderInfo = () => { ...@@ -121,7 +124,9 @@ export const getYQorderInfo = () => {
// 过滤园区店是否需要屏蔽手机号选项 // 过滤园区店是否需要屏蔽手机号选项
let filterYqPhoneConfig = JSON.parse(data.yqPhoneConfig) let filterYqPhoneConfig = JSON.parse(data.yqPhoneConfig)
// console.log(filterYqPhoneConfig) // console.log(filterYqPhoneConfig)
data.yqPhoneConfig = filterYqPhoneConfig?.find(item => item.yqMerchantId == merchantId)?.shopMerchantPhoneList || false data.yqPhoneConfig =
filterYqPhoneConfig?.find(item => item.yqMerchantId == merchantId)
?.shopMerchantPhoneList || false
// console.log(data) // console.log(data)
app.globalData.YQorderSetting = data app.globalData.YQorderSetting = data
// this.checkSeverType(userInfo) // this.checkSeverType(userInfo)
...@@ -174,7 +179,10 @@ export const getBusinessSchoolScene = () => { ...@@ -174,7 +179,10 @@ export const getBusinessSchoolScene = () => {
const app = getApp() const app = getApp()
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 如果有 直接返回 // 如果有 直接返回
if (app.globalData.businessSchoolScene != '' && app.globalData.businessSchoolScene != null) { if (
app.globalData.businessSchoolScene != '' &&
app.globalData.businessSchoolScene != null
) {
// debugger // debugger
return resolve(app.globalData.businessSchoolScene) return resolve(app.globalData.businessSchoolScene)
} else { } else {
...@@ -207,6 +215,7 @@ export const getBusinessSchoolScene = () => { ...@@ -207,6 +215,7 @@ export const getBusinessSchoolScene = () => {
// 扫码进来的处理 // 扫码进来的处理
export const checkScene = options => { export const checkScene = options => {
if (getApp().globalData.isChoosingMedia) return
// let query = options.query // let query = options.query
let { query } = options let { query } = options
...@@ -243,30 +252,36 @@ export const checkScene = options => { ...@@ -243,30 +252,36 @@ export const checkScene = options => {
createOrder: 'tabWorkOrder/pages/createOrder/createOrder', createOrder: 'tabWorkOrder/pages/createOrder/createOrder',
followUpOrder: 'tabDate/pages/detail', followUpOrder: 'tabDate/pages/detail',
staffDaily: 'tabWorkOrder/pages/staffDaily/staffDaily', staffDaily: 'tabWorkOrder/pages/staffDaily/staffDaily',
playVideo: 'packageEquity/pages/trainingMaterials/pages/playVideo/index', playVideo:
upgradeStaffDaily: 'tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily', 'packageEquity/pages/trainingMaterials/pages/playVideo/index',
upgradeStaffDaily:
'tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily',
deliveryTarget: 'packageEquity/pages/deliveryTarget/deliveryTarget', deliveryTarget: 'packageEquity/pages/deliveryTarget/deliveryTarget',
'aiDetail': 'packageEquity/pages/aiExcercise/ai/ai', aiDetail: 'packageEquity/pages/aiExcercise/ai/ai',
'tabDateIndex': 'pages/tabDateIndex/pages/tabDateIndex', tabDateIndex: 'pages/tabDateIndex/pages/tabDateIndex',
'tabDateIndex': 'pages/tabDateIndex/pages/tabDateIndex', tabDateIndex: 'pages/tabDateIndex/pages/tabDateIndex',
'h5AuthPhone': 'pages/h5AuthPhone/h5AuthPhone', h5AuthPhone: 'pages/h5AuthPhone/h5AuthPhone',
'mentorShipManage': 'tabWorkOrder/pages/mentorshipManage/mentorshipManage', mentorShipManage:
'refundApply': 'tabWorkOrder/pages/refundApply/refundApply' 'tabWorkOrder/pages/mentorshipManage/mentorshipManage',
refundApply: 'tabWorkOrder/pages/refundApply/refundApply'
} }
options.path = pagePath[query.page] options.path = pagePath[query.page]
} }
console.log(options, query, 'options') console.log(options, query, 'options')
console.log(userInfo, 'userInfo'); console.log(userInfo, 'userInfo')
wx.$SCENE = options wx.$SCENE = options
// 跳转登录页就去掉这个跳转逻辑 // 跳转登录页就去掉这个跳转逻辑
if (options.path == "pages/wxLogin/wxLogin") { if (options.path == 'pages/wxLogin/wxLogin') {
wx.$SCENE = null wx.$SCENE = null
} }
if (query.merchantId && !query.reportDate && !query.title) { if (query.merchantId && !query.reportDate && !query.title) {
// &&options.patch == 'tabIndex/pages/index/index' // &&options.patch == 'tabIndex/pages/index/index'
// 需要已登录并且是当前门店的 不是就重新登录 // 需要已登录并且是当前门店的 不是就重新登录
if (userInfo?.subLoginUser?.merchantId && (userInfo?.subLoginUser?.merchantId != query.merchantId)) { if (
userInfo?.subLoginUser?.merchantId &&
userInfo?.subLoginUser?.merchantId != query.merchantId
) {
wx.$SCENE = null wx.$SCENE = null
// return this.login(true) // return this.login(true)
// return true // 重新登录 // return true // 重新登录
...@@ -276,7 +291,18 @@ export const checkScene = options => { ...@@ -276,7 +291,18 @@ export const checkScene = options => {
console.log(options.path, 'options.path') console.log(options.path, 'options.path')
// wx.$SCENE = options // wx.$SCENE = options
if (!userInfo && !['pages/accountItems/accountItems', 'pages/wxLogin/wxLogin', 'tabWorkOrder/pages/staffDaily/staffDaily', 'tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily', 'packageEquity/pages/trainingMaterials/pages/playVideo/index', 'packageEquity/pages/deliveryTarget/deliveryTarget', 'pages/h5AuthPhone/h5AuthPhone'].includes(options.path)) { if (
!userInfo &&
![
'pages/accountItems/accountItems',
'pages/wxLogin/wxLogin',
'tabWorkOrder/pages/staffDaily/staffDaily',
'tabWorkOrder/pages/upgradeStaffDaily/upgradeStaffDaily',
'packageEquity/pages/trainingMaterials/pages/playVideo/index',
'packageEquity/pages/deliveryTarget/deliveryTarget',
'pages/h5AuthPhone/h5AuthPhone'
].includes(options.path)
) {
// if (!userInfo) { // if (!userInfo) {
// console.log(userInfo); // console.log(userInfo);
console.log('未登录,请登录。') console.log('未登录,请登录。')
...@@ -298,7 +324,9 @@ export const setWebSocket = () => { ...@@ -298,7 +324,9 @@ export const setWebSocket = () => {
let thisPage = wx.$router.getPageInstance() let thisPage = wx.$router.getPageInstance()
console.log('socket', data) console.log('socket', data)
let _data_ = JSON.parse(data.data) let _data_ = JSON.parse(data.data)
if (thisPage.route == 'tabWorkOrder/pages/confirmOrder/confirmOrder') { if (
thisPage.route == 'tabWorkOrder/pages/confirmOrder/confirmOrder'
) {
console.log(thisPage.data.orderInfo.orderCode, _data_.content) console.log(thisPage.data.orderInfo.orderCode, _data_.content)
if (thisPage.data.orderInfo.orderCode == _data_.content) { if (thisPage.data.orderInfo.orderCode == _data_.content) {
console.log(_data_.type) console.log(_data_.type)
...@@ -318,11 +346,15 @@ export const setWebSocket = () => { ...@@ -318,11 +346,15 @@ export const setWebSocket = () => {
} }
/** 获取园区店下的4S店 */ /** 获取园区店下的4S店 */
export const get4SStoreList = (options, isSupervision, noScene) => { // isSupervision是否是区域运营/超管/飞行督导 noScene登录未选场景时 export const get4SStoreList = (options, isSupervision, noScene) => {
// isSupervision是否是区域运营/超管/飞行督导 noScene登录未选场景时
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.$util.showLoading() wx.$util.showLoading()
let all = { merchantName: '全部' } let all = { merchantName: '全部' }
let event = noScene || !isSupervision ? 'getSceneMerchantRefStoreList' : 'getCurShopList' let event =
noScene || !isSupervision
? 'getSceneMerchantRefStoreList'
: 'getCurShopList'
if (event == 'getCurShopList') { if (event == 'getCurShopList') {
options.sceneType = options.scene options.sceneType = options.scene
} }
...@@ -336,7 +368,8 @@ export const get4SStoreList = (options, isSupervision, noScene) => { // isSuperv ...@@ -336,7 +368,8 @@ export const get4SStoreList = (options, isSupervision, noScene) => { // isSuperv
// debugger // debugger
// console.log(data); // console.log(data);
// getCurShopList 接口数据结构不一致,要修改 // getCurShopList 接口数据结构不一致,要修改
let resolveData = (event == 'getCurShopList' ? data?.list : data) || [] let resolveData =
(event == 'getCurShopList' ? data?.list : data) || []
if (isSupervision) resolveData = [all, ...resolveData] if (isSupervision) resolveData = [all, ...resolveData]
// console.log(resolveData, 'resolveData'); // console.log(resolveData, 'resolveData');
resolve(resolveData) resolve(resolveData)
...@@ -473,12 +506,10 @@ export const loginLogAdd = options => { ...@@ -473,12 +506,10 @@ export const loginLogAdd = options => {
options.loginDeviceType = isPad ? 1 : 2 // 登录设备类型(1.pad,2手机) options.loginDeviceType = isPad ? 1 : 2 // 登录设备类型(1.pad,2手机)
options.loginSource = 1 // 登录来源(1.嘀加区域助手小程序,默认) options.loginSource = 1 // 登录来源(1.嘀加区域助手小程序,默认)
// "登录方式(1账号密码登录,2.手机号授权,3验证码)" // "登录方式(1账号密码登录,2.手机号授权,3验证码)"
api.loginLogAdd(options).then((result) => { api
.loginLogAdd(options)
}).catch((err) => { .then(result => {})
.catch(err => {})
});
} }
}) })
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!