Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 854bdd39
authored
Mar 05, 2024
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'develop' into 'master'
上线合并 SAAS+V4.35.0-0304版本代码 See merge request
!54
2 parents
0cbf081a
8dd98318
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
13 deletions
READ.md
login/lib/index.js
login/loading/loading.js
packagesList/packageOutput/pages/businessAnalysis/businessAnalysis.js
project.config.json
READ.md
View file @
854bdd3
...
@@ -34,4 +34,6 @@ behaviors: [computedBehavior],
...
@@ -34,4 +34,6 @@ behaviors: [computedBehavior],
}
}
},
},
```
```
<!-- 免登录代码示例 -->
在onRoute 里面获取参数
[
{ "appId":'wx2c28337db96364d2', "path": '/login/loading/loading?targetPath=/packagesList/packageOutput/pages/businessAnalysis/businessAnalysis?beginDateStr%3D2024-01-01&userName=djfws&password=djfws123' , "pageName":'经营分析' }
]
login/lib/index.js
View file @
854bdd3
import
{
setSessionId
,
setUserInfo
}
from
'~/utils/cache/storageApi'
import
{
setSessionId
,
setUserInfo
}
from
'~/utils/cache/storageApi'
import
USERAPI
from
'~/api/usersApi/index'
import
USERAPI
from
'~/api/usersApi/index'
const
setRouteData
=
targetPath
=>
{
const
setRouteData
=
targetPath
=>
{
targetPath
=
decodeURIComponent
(
targetPath
)
console
.
log
(
targetPath
,
'targetPath'
);
let
[
url
,
query
]
=
targetPath
.
split
(
'?'
),
let
[
url
,
query
]
=
targetPath
.
split
(
'?'
),
obj
=
{}
obj
=
{}
console
.
log
(
query
,
'query'
);
if
(
query
)
{
if
(
query
)
{
var
list
=
query
.
split
(
'&'
)
||
[]
var
list
=
query
.
split
(
'&'
)
||
[]
console
.
log
(
list
,
list
);
list
.
forEach
(
item
=>
{
list
.
forEach
(
item
=>
{
const
[
key
,
val
]
=
item
.
split
(
'='
)
const
[
key
,
val
]
=
item
.
split
(
'='
)
obj
[
key
]
=
val
obj
[
key
]
=
val
})
})
}
}
console
.
log
(
obj
,
url
);
return
{
return
{
url
,
url
,
obj
obj
...
@@ -21,6 +26,7 @@ const selectAccountLogin = ({ id, sessionId }) => {
...
@@ -21,6 +26,7 @@ const selectAccountLogin = ({ id, sessionId }) => {
id
,
id
,
sessionId
sessionId
}).
then
(({
code
,
data
,
message
})
=>
{
}).
then
(({
code
,
data
,
message
})
=>
{
console
.
log
(
code
,
'selectAccountLogin'
);
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
console
.
log
(
data
)
console
.
log
(
data
)
setLoginInfo
(
data
.
loginUserInfoList
[
0
],
data
.
sessionId
)
setLoginInfo
(
data
.
loginUserInfoList
[
0
],
data
.
sessionId
)
...
@@ -56,9 +62,11 @@ const setLoginInfo = (userInfo, sessionId) => {
...
@@ -56,9 +62,11 @@ const setLoginInfo = (userInfo, sessionId) => {
}
}
})
})
}
}
// debugger
// 自动创建服务中心
// 自动创建服务中心
initServiceCenter
()
initServiceCenter
()
setUserInfo
(
userInfo
)
setUserInfo
(
userInfo
)
// debugger
setSessionId
(
sessionId
)
setSessionId
(
sessionId
)
loginSuccess
()
loginSuccess
()
}
}
...
@@ -68,8 +76,10 @@ const initServiceCenter = () => {
...
@@ -68,8 +76,10 @@ const initServiceCenter = () => {
/**成功跳转 */
/**成功跳转 */
const
loginSuccess
=
()
=>
{
const
loginSuccess
=
()
=>
{
const
{
const
{
options
:
{
targetPath
}
options
:
{
targetPath
},
options
,
}
=
wx
.
$router
.
getPageInstance
()
}
=
wx
.
$router
.
getPageInstance
()
console
.
log
(
options
,
'loginSuccess'
);
if
(
targetPath
)
{
if
(
targetPath
)
{
const
{
url
,
obj
}
=
setRouteData
(
targetPath
)
const
{
url
,
obj
}
=
setRouteData
(
targetPath
)
wx
.
$router
.
reLaunch
(
url
,
obj
)
wx
.
$router
.
reLaunch
(
url
,
obj
)
...
...
login/loading/loading.js
View file @
854bdd3
...
@@ -15,12 +15,12 @@ Page({
...
@@ -15,12 +15,12 @@ Page({
/**
/**
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
(
options
)
{},
onLoad
(
options
)
{
},
/**
/**
* 生命周期函数--监听页面初次渲染完成
* 生命周期函数--监听页面初次渲染完成
*/
*/
onReady
()
{},
onReady
()
{
},
/**
/**
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
...
@@ -67,22 +67,22 @@ Page({
...
@@ -67,22 +67,22 @@ Page({
/**
/**
* 生命周期函数--监听页面隐藏
* 生命周期函数--监听页面隐藏
*/
*/
onHide
()
{},
onHide
()
{
},
/**
/**
* 生命周期函数--监听页面卸载
* 生命周期函数--监听页面卸载
*/
*/
onUnload
()
{},
onUnload
()
{
},
/**
/**
* 页面相关事件处理函数--监听用户下拉动作
* 页面相关事件处理函数--监听用户下拉动作
*/
*/
onPullDownRefresh
()
{},
onPullDownRefresh
()
{
},
/**
/**
* 页面上拉触底事件的处理函数
* 页面上拉触底事件的处理函数
*/
*/
onReachBottom
()
{},
onReachBottom
()
{
},
arrToObj
(
list
)
{
arrToObj
(
list
)
{
if
(
!
Array
.
isArray
(
list
))
{
if
(
!
Array
.
isArray
(
list
))
{
return
{}
return
{}
...
@@ -178,6 +178,12 @@ Page({
...
@@ -178,6 +178,12 @@ Page({
}
}
USERAPI
.
accountLogin
(
params
)
USERAPI
.
accountLogin
(
params
)
.
then
(({
code
,
data
,
message
})
=>
{
.
then
(({
code
,
data
,
message
})
=>
{
this
.
options
=
{
...
this
.
options
,
...
obj
}
console
.
log
(
this
.
options
,
'this.options'
);
// debugger
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
const
{
sessionId
,
loginUserInfoList
}
=
data
const
{
sessionId
,
loginUserInfoList
}
=
data
var
routeParams
=
{}
var
routeParams
=
{}
...
@@ -199,6 +205,11 @@ Page({
...
@@ -199,6 +205,11 @@ Page({
// this.options.targetPath = '/pages/tab/output/output' + "?" + list.join("&")
// this.options.targetPath = '/pages/tab/output/output' + "?" + list.join("&")
this
.
options
.
targetPath
=
'/pages/tab/outputValue/outputValue'
+
'?'
+
list
.
join
(
'&'
)
this
.
options
.
targetPath
=
'/pages/tab/outputValue/outputValue'
+
'?'
+
list
.
join
(
'&'
)
}
}
// 展会用逻辑
if
(
obj
.
targetPath
==
'/packagesList/packageOutput/pages/businessAnalysis/businessAnalysis'
)
{
this
.
options
.
targetPath
=
'/packagesList/packageOutput/pages/businessAnalysis/businessAnalysis'
+
'?'
+
'beginDateStr=2024-01-01'
}
setLoginInfo
(
loginUserInfoList
[
0
],
sessionId
)
setLoginInfo
(
loginUserInfoList
[
0
],
sessionId
)
}
else
{
}
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
...
...
packagesList/packageOutput/pages/businessAnalysis/businessAnalysis.js
View file @
854bdd3
...
@@ -50,19 +50,26 @@ Page({
...
@@ -50,19 +50,26 @@ Page({
}
}
},
},
initTime
()
{
initTime
(
beginDateStr
)
{
// 获取当前日期
// 获取当前日期
// const currentDate = beginDateStr ? new Date(beginDateStr) : new Date()
const
currentDate
=
new
Date
()
const
currentDate
=
new
Date
()
let
today
=
currentDate
.
format
(
'yyyy-MM-dd'
)
let
today
=
currentDate
.
format
(
'yyyy-MM-dd'
)
let
NewYearDay
=
currentDate
.
format
(
'yyyy'
)
let
NewYearDay
=
currentDate
.
format
(
'yyyy'
)
let
month
=
currentDate
.
getMonth
()
+
1
<
10
?
(
'0'
+
(
currentDate
.
getMonth
()
+
1
))
:
currentDate
.
getMonth
()
+
1
let
month
=
currentDate
.
getMonth
()
+
1
<
10
?
(
'0'
+
(
currentDate
.
getMonth
()
+
1
))
:
currentDate
.
getMonth
()
+
1
let
firstDayOfMonth
=
new
Date
(
currentDate
.
getFullYear
(),
currentDate
.
getMonth
(),
1
).
format
(
'yyyy-MM-dd'
)
let
firstDayOfMonth
=
new
Date
(
currentDate
.
getFullYear
(),
currentDate
.
getMonth
(),
1
).
format
(
'yyyy-MM-dd'
)
// console.log(NewYearDay)
// console.log(NewYearDay)
let
endDateStr
if
(
beginDateStr
)
{
let
date
=
new
Date
(
beginDateStr
)
firstDayOfMonth
=
new
Date
(
date
.
getFullYear
(),
date
.
getMonth
(),
1
).
format
(
'yyyy-MM-dd'
)
endDateStr
=
this
.
getLastDayOfMonth
(
beginDateStr
)
console
.
log
(
endDateStr
,
'endDateStr'
);
}
this
.
setData
({
this
.
setData
({
dateObj
:
{
dateObj
:
{
beginDateStr
:
firstDayOfMonth
,
beginDateStr
:
firstDayOfMonth
,
endDateStr
:
today
,
endDateStr
:
endDateStr
||
today
,
today
:
today
,
today
:
today
,
pointUnit
:
2
,
// 1日,2月,默认日
pointUnit
:
2
,
// 1日,2月,默认日
type
:
'month'
,
type
:
'month'
,
...
@@ -72,7 +79,28 @@ Page({
...
@@ -72,7 +79,28 @@ Page({
}
}
})
})
},
},
getLastDayOfMonth
(
beginDateStr
)
{
console
.
log
(
beginDateStr
,
'beginDateStr'
);
// 将日期字符串转换为Date对象
var
beginDate
=
new
Date
(
beginDateStr
);
console
.
log
(
beginDate
,
'beginDate'
);
// 获取给定日期的月份和年份
var
month
=
beginDate
.
getMonth
();
var
year
=
beginDate
.
getFullYear
();
// 构建下一个月的第一天
var
nextMonth
=
new
Date
(
year
,
month
+
1
,
1
);
// 使用下一个月的第一天的前一天作为当前月的最后一天
var
lastDay
=
new
Date
(
nextMonth
.
getTime
()
-
1
);
// // 提取最后一天的日期部分并返回
// var lastDayOfMonth = lastDay.getDate();
// 提取最后一天的年份、月份和日期,并格式化为字符串
var
lastDayOfMonth
=
lastDay
.
toISOString
().
split
(
'T'
)[
0
];
return
lastDayOfMonth
;
// return lastDayOfMonth;
},
getLastDay
(
year
,
month
)
{
getLastDay
(
year
,
month
)
{
var
new_year
=
year
//取当前的年份
var
new_year
=
year
//取当前的年份
var
new_month
=
month
++
//取下一个月的第一天,方便计算(最后一天不固定)
var
new_month
=
month
++
//取下一个月的第一天,方便计算(最后一天不固定)
...
@@ -337,8 +365,13 @@ Page({
...
@@ -337,8 +365,13 @@ Page({
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
(
options
)
{
onLoad
(
options
)
{
},
onRoute
(
options
)
{
console
.
log
(
options
,
'options'
);
wx
.
$api
.
showLoading
(
'加载中...'
)
wx
.
$api
.
showLoading
(
'加载中...'
)
this
.
initTime
()
console
.
log
(
options
,
'businessAnalysis'
);
this
.
initTime
(
options
?.
beginDateStr
||
''
)
this
.
freshPage
()
this
.
freshPage
()
this
.
getPurchaseList
()
this
.
getPurchaseList
()
new
setTimeout
(()
=>
{
new
setTimeout
(()
=>
{
...
...
project.config.json
View file @
854bdd3
...
@@ -92,5 +92,6 @@
...
@@ -92,5 +92,6 @@
"editorSetting"
:
{
"editorSetting"
:
{
"tabIndent"
:
"insertSpaces"
,
"tabIndent"
:
"insertSpaces"
,
"tabSize"
:
2
"tabSize"
:
2
}
},
"libVersion"
:
"2.27.2"
}
}
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment