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 5f616d0f
authored
Mar 04, 2024
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat 免登录查看页面功能开发
1 parent
e43d8250
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
160 additions
and
107 deletions
login/lib/index.js
login/loading/loading.js
packagesList/packageOutput/pages/businessAnalysis/businessAnalysis.js
project.config.json
login/lib/index.js
View file @
5f616d0
import
{
setSessionId
,
setUserInfo
}
from
'~/utils/cache/storageApi'
import
USERAPI
from
'~/api/usersApi/index'
const
setRouteData
=
targetPath
=>
{
targetPath
=
decodeURIComponent
(
targetPath
)
console
.
log
(
targetPath
,
'targetPath'
);
let
[
url
,
query
]
=
targetPath
.
split
(
'?'
),
obj
=
{}
console
.
log
(
query
,
'query'
);
if
(
query
)
{
var
list
=
query
.
split
(
'&'
)
||
[]
console
.
log
(
list
,
list
);
list
.
forEach
(
item
=>
{
const
[
key
,
val
]
=
item
.
split
(
'='
)
obj
[
key
]
=
val
})
}
console
.
log
(
obj
,
url
);
return
{
url
,
obj
...
...
@@ -21,6 +26,7 @@ const selectAccountLogin = ({ id, sessionId }) => {
id
,
sessionId
}).
then
(({
code
,
data
,
message
})
=>
{
console
.
log
(
code
,
'selectAccountLogin'
);
if
(
code
==
'0'
)
{
console
.
log
(
data
)
setLoginInfo
(
data
.
loginUserInfoList
[
0
],
data
.
sessionId
)
...
...
@@ -56,9 +62,11 @@ const setLoginInfo = (userInfo, sessionId) => {
}
})
}
// debugger
// 自动创建服务中心
initServiceCenter
()
setUserInfo
(
userInfo
)
// debugger
setSessionId
(
sessionId
)
loginSuccess
()
}
...
...
@@ -68,8 +76,10 @@ const initServiceCenter = () => {
/**成功跳转 */
const
loginSuccess
=
()
=>
{
const
{
options
:
{
targetPath
}
options
:
{
targetPath
},
options
,
}
=
wx
.
$router
.
getPageInstance
()
console
.
log
(
options
,
'loginSuccess'
);
if
(
targetPath
)
{
const
{
url
,
obj
}
=
setRouteData
(
targetPath
)
wx
.
$router
.
reLaunch
(
url
,
obj
)
...
...
login/loading/loading.js
View file @
5f616d0
...
...
@@ -15,12 +15,12 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad
(
options
)
{},
onLoad
(
options
)
{
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
()
{},
onReady
()
{
},
/**
* 生命周期函数--监听页面显示
...
...
@@ -67,22 +67,22 @@ Page({
/**
* 生命周期函数--监听页面隐藏
*/
onHide
()
{},
onHide
()
{
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload
()
{},
onUnload
()
{
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh
()
{},
onPullDownRefresh
()
{
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom
()
{},
onReachBottom
()
{
},
arrToObj
(
list
)
{
if
(
!
Array
.
isArray
(
list
))
{
return
{}
...
...
@@ -178,6 +178,12 @@ Page({
}
USERAPI
.
accountLogin
(
params
)
.
then
(({
code
,
data
,
message
})
=>
{
this
.
options
=
{
...
this
.
options
,
...
obj
}
console
.
log
(
this
.
options
,
'this.options'
);
// debugger
if
(
code
==
'0'
)
{
const
{
sessionId
,
loginUserInfoList
}
=
data
var
routeParams
=
{}
...
...
@@ -199,6 +205,9 @@ Page({
// this.options.targetPath = '/pages/tab/output/output' + "?" + list.join("&")
this
.
options
.
targetPath
=
'/pages/tab/outputValue/outputValue'
+
'?'
+
list
.
join
(
'&'
)
}
// if (obj.url == '/packagesList/packageOutput/pages/summary') {
// }
setLoginInfo
(
loginUserInfoList
[
0
],
sessionId
)
}
else
{
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
...
...
packagesList/packageOutput/pages/businessAnalysis/businessAnalysis.js
View file @
5f616d0
...
...
@@ -50,19 +50,26 @@ Page({
}
},
initTime
()
{
initTime
(
beginDateStr
)
{
// 获取当前日期
// const currentDate = beginDateStr ? new Date(beginDateStr) : new Date()
const
currentDate
=
new
Date
()
let
today
=
currentDate
.
format
(
'yyyy-MM-dd'
)
let
NewYearDay
=
currentDate
.
format
(
'yyyy'
)
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'
)
// 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
({
dateObj
:
{
beginDateStr
:
firstDayOfMonth
,
endDateStr
:
today
,
endDateStr
:
endDateStr
||
today
,
today
:
today
,
pointUnit
:
2
,
// 1日,2月,默认日
type
:
'month'
,
...
...
@@ -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
)
{
var
new_year
=
year
//取当前的年份
var
new_month
=
month
++
//取下一个月的第一天,方便计算(最后一天不固定)
...
...
@@ -337,8 +365,13 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad
(
options
)
{
},
onRoute
(
options
)
{
console
.
log
(
options
,
'options'
);
wx
.
$api
.
showLoading
(
'加载中...'
)
this
.
initTime
()
console
.
log
(
options
,
'businessAnalysis'
);
this
.
initTime
(
options
?.
beginDateStr
||
''
)
this
.
freshPage
()
this
.
getPurchaseList
()
new
setTimeout
(()
=>
{
...
...
project.config.json
View file @
5f616d0
{
"appid"
:
"wx2c28337db96364d2"
,
"projectname"
:
"business-assistant"
,
"compileType"
:
"miniprogram"
,
"packOptions"
:
{
"ignore"
:
[],
"include"
:
[]
},
"condition"
:
{
"miniprogram"
:
{
"list"
:
[
{
"name"
:
"看产值"
,
"pathName"
:
"pages/tab/output/output"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"携带目标页面"
,
"pathName"
:
"login/loading/loading"
,
"query"
:
"url=%2Fpages%2Ftab%2Fmine%2Fmine%3Fid%3D123"
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"选择账号"
,
"pathName"
:
"login/accountItems/accountItems"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"个人中心"
,
"pathName"
:
"pages/tab/mine/mine"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
""
,
"pathName"
:
"login/index/index"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"客户管理"
,
"pathName"
:
"pages/mineDetail/customerManagement/customerManagement"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"消息盒子"
,
"pathName"
:
"pages/mineDetail/messageBox/messageBox"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
}
]
}
},
"setting"
:
{
"urlCheck"
:
true
,
"coverView"
:
true
,
"postcss"
:
true
,
"lazyloadPlaceholderEnable"
:
true
,
"minified"
:
true
,
"useIsolateContext"
:
false
,
"enhance"
:
true
,
"showShadowRootInWxmlPanel"
:
true
,
"packNpmManually"
:
true
,
"packNpmRelationList"
:
[
{
"packageJsonPath"
:
"./package.json"
,
"miniprogramNpmDistDir"
:
"./"
}
],
"useStaticServer"
:
true
,
"ignoreUploadUnusedFiles"
:
true
,
"babelSetting"
:
{
"ignore"
:
[],
"disablePlugins"
:
[],
"outputPath"
:
""
},
"useCompilerPlugins"
:
[
"sass"
],
"condition"
:
false
},
"editorSetting"
:
{
"tabIndent"
:
"insertSpaces"
,
"tabSize"
:
2
}
{
"appid"
:
"wx2c28337db96364d2"
,
"projectname"
:
"business-assistant"
,
"compileType"
:
"miniprogram"
,
"packOptions"
:
{
"ignore"
:
[],
"include"
:
[]
},
"condition"
:
{
"miniprogram"
:
{
"list"
:
[
{
"name"
:
"看产值"
,
"pathName"
:
"pages/tab/output/output"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"携带目标页面"
,
"pathName"
:
"login/loading/loading"
,
"query"
:
"url=%2Fpages%2Ftab%2Fmine%2Fmine%3Fid%3D123"
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"选择账号"
,
"pathName"
:
"login/accountItems/accountItems"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"个人中心"
,
"pathName"
:
"pages/tab/mine/mine"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
""
,
"pathName"
:
"login/index/index"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"客户管理"
,
"pathName"
:
"pages/mineDetail/customerManagement/customerManagement"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
},
{
"name"
:
"消息盒子"
,
"pathName"
:
"pages/mineDetail/messageBox/messageBox"
,
"query"
:
""
,
"launchMode"
:
"default"
,
"scene"
:
null
}
]
}
},
"setting"
:
{
"urlCheck"
:
true
,
"coverView"
:
true
,
"postcss"
:
true
,
"lazyloadPlaceholderEnable"
:
true
,
"minified"
:
true
,
"useIsolateContext"
:
false
,
"enhance"
:
true
,
"showShadowRootInWxmlPanel"
:
true
,
"packNpmManually"
:
true
,
"packNpmRelationList"
:
[
{
"packageJsonPath"
:
"./package.json"
,
"miniprogramNpmDistDir"
:
"./"
}
],
"useStaticServer"
:
true
,
"ignoreUploadUnusedFiles"
:
true
,
"babelSetting"
:
{
"ignore"
:
[],
"disablePlugins"
:
[],
"outputPath"
:
""
},
"useCompilerPlugins"
:
[
"sass"
],
"condition"
:
false
},
"editorSetting"
:
{
"tabIndent"
:
"insertSpaces"
,
"tabSize"
:
2
},
"libVersion"
:
"2.27.2"
}
\ 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