首页 文章 firstpage_index2

firstpage_index2

2024-07-07 11:52  浏览数:291  来源:许某    

//页面跳转
const onPressLearnMore =
({page,params,pageTag='',title,num}) => {
if (page == 'WaybillList') {
userTrackEvnet('ky_search_click',
{event_type:'click',item_id:'i_100',position:'0',
label:'跳转运单列表',area_id:'P102_A01'})
}else if (page == 'LearningVideo') {
userTrackEvnet('ky_learning_resources_click',
{event_type:'click',position:'0',label:'学习视频点击',
area_id:'P102_A04'})
}else if (page == 'InstructionsPage') {
userTrackEvnet('ky_ad_banner_click',
{media_id:1,media_url:extensionImg,
position:page,area_id:'P102_A06'})
}else{
userTrackEvnet('ky_operation_board_click',
{event_type:'click',position:pageTag,
label:title,biz_value:num,area_id:'P102_A03'})
}
let newpageParams = {'InstructionsPage':'P158',
'WaybillList':'P105','OrderManagement':'P107',
'WaitPiece':'P154','dispatchTask':'P113',
'questionPiece':'P155','LearningVideo':'P156'}
if (globalThis.homeUrl) {
//目前跳转有问题,预留
openPage({pageId:newpageParams[page],pageTag},
globalThis.homeUrl, page, {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
currentIndex:params
}
},(data)=>{
if (data && data.againFlag) {
openPageEnvent({
param: '',
pageId:'P102',
pageUrl: '',
pageTag:'P102',
moduleName:'Firstpage',
rn_version: RNUpgradeApp
})
getAllApiData(true)
ZNotify.post("accountOpening",
{isOpening:true})
}
});
} else {
ZStore.get("linkUrl", ({ url }) => {
//目前跳转有问题,预留
openPage({pageId:newpageParams[page],
pageTag},url, page, {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
currentIndex:params
}
},(data)=>{
if (data && data.againFlag) {
openPageEnvent({
param: '',
pageId:'P102',
pageUrl: '',
pageTag:'P102',
moduleName:'Firstpage',
rn_version: RNUpgradeApp
})
getAllApiData(true)
ZNotify.post("accountOpening",
{isOpening:true})
}
});
});
}
};
// 常用应用跳转
const onPressLearnMore02 =
async (pageId,page,id,name,position) => {
if (page) {
let pageParams = {pageId:pageId,
pageTag:position}
if (globalThis.homeUrl) {
let paramsCat = {event_type:'click',
position,label:name,media_id:id,
media_url:globalThis.homeUrl+'&moduleName=
'+page,area_id:'P102_A05'}
userTrackEvnet('ky_operation_tools_click',
paramsCat)
if (page == "MorePage") {
openPage(pageParams,globalThis.homeUrl,
'MorePage', {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
list:JSON.stringify(applicationList)
},
},(data)=>{
if (data && data.againFlag) {
getKeys() //从内存拉取图标顺序
ZNotify.post("accountOpening",
{isOpening:true})
}
});
}else if(page == 'ProjectManagent'){
const ress = await
printAuthority('menuTree/loadMenu')
if(ress.result.data.length > 0) {
var objArr = []
var pid = ''
ress.result.data.map(async item => {
if(item.text == '掌上快运项目客户'){
pid = item.id
}
if(item.pid == pid && item.pid != '' &&
item.text != '掌上快运项目客户' ) {
objArr.push(item)
}
})
openPage(pageParams,globalThis.homeUrl,
'ProjectManagent', {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
printArr : JSON.stringify(objArr)
},
});
}else{
CToast('暂无权限')
}
}else{
// 目前跳转有问题,预留
openPage(pageParams,
globalThis.homeUrl, page, {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
type: page == "LabelsPrinting" ? 0 : 1,
},
},(data)=>{
if (data && data.againFlag) {
getAllApiData(true)
props.Fun()
ZNotify.post("accountOpening",
{isOpening:true})
}
});
}
} else {
ZStore.get("linkUrl", async ({ url }) => {
let paramsCat = {event_type:'click',
position,label:name,media_id:id,
media_url:url+'&moduleName='+page,
area_id:'P102_A05'}
userTrackEvnet('ky_operation_tools_click',
paramsCat)
if (page == "MorePage") {
openPage(pageParams,url, 'MorePage', {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
list:JSON.stringify(applicationList)
},
},(data)=>{
if (data && data.againFlag) {
getKeys() //从内存拉取图标顺序
ZNotify.post("accountOpening",
{isOpening:true})
}
});
}else if(page == 'ProjectManagent'){
const ress = await
printAuthority('menuTree/loadMenu')
if(ress.result.data.length > 0) {
var objArr = []
var pid = ''
ress.result.data.map(async item => {
if(item.text == '掌上快运项目客户'){
pid = item.id
}
if(item.pid == pid
&& item.pid != '' &&
item.text != '掌上快运项目客户' ) {
objArr.push(item)
}
})
openPage(pageParams,url,
'ProjectManagent', {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
printArr : JSON.stringify(objArr)
},
});
}else{
CToast('暂无权限')
}
}else{
// 目前跳转有问题,预留
openPage(pageParams,url, page, {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
type: page == "LabelsPrinting" ? 0 : 1,
},
},(data)=>{
if (data && data.againFlag) {
getAllApiData(true)
props.Fun()
ZNotify.post("accountOpening",
{isOpening:true})
}
});
}
});
}
}
};
//扫描
const scanOrderNo = () => {
userTrackEvnet('ky_scan_click',
{event_type:'click',rn_version:RNUpgradeApp,
area_id:'P102_A02'})
startScan({ isList: "0" }, async(result) => {
var string = dealwithScanResult(result.string)
let ress = checkOrderNoRegular(string)
if (ress) {
let res = await
operateEwbInfoApi({ewbNo: String(string)})
if (res.success) {
waybillModel = res.result
if (res.result.self === 1 &&
!res.result.ewbNo) {
CToast('暂无运单信息');
return
}
if (res.result.self === 2 &&
!res.result.latestRoute) {
CToast('暂无最新物流轨迹');
return
}
// 保存到查询记录
ZStore.get("WayBillData", (data) => {
data = typeof data ==
'object' ? data : JSON.parse(data)
if (data) {
if (data.length > 0) {
var pData = data
var acct = userAcct
data.map((item, index) => {
var itemUserAcct =
item.userAcct == undefined ?
JSON.parse(item).userAcct : item.userAcct
if (itemUserAcct == acct) {
setisContainAcct(true)
currentAcctIndex = index
}
});
setTimeout(() => {
if (isContainAcct) {
var itemObj =
typeof data[currentAcctIndex]
== 'object' ? data[currentAcctIndex] :
JSON.parse(data[currentAcctIndex])
var objArr = typeof
itemObj.orderlistData == 'object' ?
itemObj.orderlistData :
JSON.parse(itemObj.orderlistData);
if (objArr.length < 10) {
// 判断是否有重复数据
objArr.map((item1, index) => {
var item = typeof
item1 == 'object' ?
item1 : JSON.parse(item1);
var latestRoute =
item.latestRoute ?
item.latestRoute : null
var itemEwbNo =
(latestRoute && latestRoute.ewbNo) ?
latestRoute.ewbNo : item.ewbNo
var modelEwbNo = string
if (itemEwbNo ==
modelEwbNo) {
objArr.splice(index, 1);
}
});
objArr.push
(JSON.stringify(res.result))
} else {
// 判断是否有重复数据
objArr.map((item1, index) => {
var item = typeof
item1 == 'object' ?
item1 : JSON.parse(item1);
var latestRoute =
item.latestRoute ? item.latestRoute : null
var itemEwbNo =
(latestRoute && latestRoute.ewbNo) ?
latestRoute.ewbNo : item.ewbNo
var modelEwbNo = string
if (itemEwbNo ==
modelEwbNo) {
objArr.splice(index, 1)
}
});
if (objArr.length >= 10) {
objArr.splice(0, 1)
}
objArr.push
(JSON.stringify(res.result))
}
pData.splice
(currentAcctIndex, 1,
JSON.stringify({ 'userAcct': userAcct,
'orderlistData': JSON.stringify(objArr) }))
ZStore.set('WayBillData',
JSON.stringify(pData));
} else {
//不包含当前网点
var orderListArr =
[JSON.stringify(res.result)]
var arr = []
pData.map((item) => {
arr.push(item)
})
arr.push({ 'userAcct':userAcct,
'orderlistData': JSON.stringify(orderListArr) })
ZStore.set('WayBillData',
JSON.stringify(arr));
}
}, 1000)
}
} else {
// 没有查询记录
var orderlistObj = res.result
var orderListArr =
[JSON.stringify(orderlistObj)]
var accountArr =
[{ 'userAcct': userAcct,
'orderlistData': JSON.stringify(orderListArr) }]
var acct = userAcct
accountArr.map((item, index) => {
var itemUserAcct = item.userAcct
== undefined ? JSON.parse(item).userAcct
: item.userAcct
if (itemUserAcct == acct) {
setisContainAcct(true)
currentAcctIndex = index
}
});
ZStore.set('WayBillData',
JSON.stringify(accountArr));
}
});
// 做完本页所有处理之后根据权限判断是否有查看权限 有权限跳转详情
var latestRoute =
waybillModel.latestRoute ?
waybillModel.latestRoute : null
var itemEwbNo =
(latestRoute && latestRoute.ewbNo) ?
latestRoute.ewbNo : waybillModel.ewbNo
let pageParams={pageId:'P102',pageTag:2}
if (waybillModel.self == 1 &&
(itemEwbNo.length != 0)) {
if (globalThis.homeUrl) {
setTimeout(() => {
openPage(pageParams,
globalThis.homeUrl,
"WaybillDetailsPage", {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
waybillNumber: string
},
});
}, 600)
} else {
ZStore.get("linkUrl", ({ url }) => {
//目前跳转有问题,预留
setTimeout(() => {
openPage(pageParams,url,
"WaybillDetailsPage", {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
waybillNumber: string
},
});
}, 600)
});
}
}else{
if (globalThis.homeUrl) {
setTimeout(() => {
openPage(pageParams,
globalThis.homeUrl, "WaybillList", {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
waybillNumber: string
},
});
}, 600)
} else {
ZStore.get("linkUrl", ({ url }) => {
//目前跳转有问题,预留
setTimeout(() => {
openPage(pageParams,url,
"WaybillList", {
hideNav: true,
urlArgs: {
immersiveStatusBar: true,
waybillNumber: string
},
});
}, 600)
});
}
}
} else {
CToast(res.message.replace(/\r|\n/ig, ""))
}
}else{
specialToast({ 'text': '运单号不符合规则' }, () => { })
}
});
}



声明:以上文章均为用户自行添加,仅供打字交流使用,不代表本站观点,本站不承担任何法律责任,特此声明!如果有侵犯到您的权利,请及时联系我们删除。

字符:    改为:
去打字就可以设置个性皮肤啦!(O ^ ~ ^ O)