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 a2043580
authored
Nov 02, 2022
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化sentry 导入 和新增config.js
1 parent
a1680e87
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
45 additions
and
28 deletions
api/applyApi/applyApi.js
api/mineApi/mine.js
api/outputApi/output.js
app.js
config.js
utils/Draw.js
utils/format.js
utils/request/environment.js
utils/sentryConfig/sentryInit.js
api/applyApi/applyApi.js
View file @
a204358
import
api
from
'~/utils/request/request'
const
{
appId
}
=
wx
.
getAccountInfoSync
().
miniProgram
//
const { appId } = wx.getAccountInfoSync().miniProgram
const
CODE
=
{
platformEntrance
:
'BUSINESS_ASSISTANT'
,
productCode
:
'PC00c3'
...
...
api/mineApi/mine.js
View file @
a204358
import
api
from
'~/utils/request/request'
const
{
appId
}
=
wx
.
getAccountInfoSync
().
miniProgram
//
const { appId } = wx.getAccountInfoSync().miniProgram
const
CODE
=
{
platformEntrance
:
'BUSINESS_ASSISTANT'
,
productCode
:
'PC00c3'
...
...
api/outputApi/output.js
View file @
a204358
import
api
from
'~/utils/request/request'
const
{
appId
}
=
wx
.
getAccountInfoSync
().
miniProgram
//
const { appId } = wx.getAccountInfoSync().miniProgram
const
CODE
=
{
platformEntrance
:
'BUSINESS_ASSISTANT'
,
productCode
:
'PC00c3'
...
...
app.js
View file @
a204358
// app.js
import
*
as
Sentry
from
'./utils/lib/sentry-miniapp'
// accountInfo.miniProgram.envVersion == 'release' &&
const
accountInfo
=
wx
.
getAccountInfoSync
()
//测试和生产才开发sentry
const
env
=
[
'trial'
,
'release'
]
env
.
includes
(
accountInfo
.
miniProgram
.
envVersion
)
&&
Sentry
.
init
({
// dsn: 'http://ebcf31c417cc4ce185782f046e4a87a2@sentry.glsx.com.cn/5'
dsn
:
'https://59c3cfc3ffb84ed68fc0dda26fb09e12@sentry.glsx.com.cn/30'
})
// 初始化sentry
import
sentryInit
from
'~/utils/sentryConfig/sentryInit'
sentryInit
()
import
util
from
'./utils/util'
import
wxApi
from
'./utils/utils_wx'
...
...
@@ -17,7 +11,6 @@ import router from './router/index'
// 有问题 前后顺序不能随意调整
// console.log(test)
import
{
setSystem_info
}
from
'~/utils/cache/storageApi'
// console.log(setSystem_info)
...
...
config.js
0 → 100644
View file @
a204358
/**
* 用来配置小程序项目的变量
* 统一管理
*/
// 配置预发布的小程序aapId
export
const
preReleaseAppId
=
'wx24ebae5768e74138'
// sentry Dsn 地址
export
const
dsnUrl
=
'https://59c3cfc3ffb84ed68fc0dda26fb09e12@sentry.glsx.com.cn/30'
utils/Draw.js
View file @
a204358
...
...
@@ -75,6 +75,7 @@ class Draw {
if
(
fontSize
)
this
[
_ctx_
].
font
=
`
${
fontSize
}
px
${
font
}
`
return
this
[
_ctx_
].
measureText
(
text
).
width
}
// 画块形状
drawFill
({
x
,
y
,
width
,
height
,
color
})
{
height
=
this
.
toRpx
(
height
)
width
=
this
.
toRpx
(
width
)
...
...
utils/format.js
View file @
a204358
...
...
@@ -56,19 +56,19 @@ export function commentTime(dateTimeStamp) {
let
monthTime
=
dayTime
*
30
let
yearTime
=
dayTime
*
365
if
(
parseInt
(
timeDifference
/
yearTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
yearTime
)
+
'年前'
}
else
if
(
parseInt
(
timeDifference
/
monthTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
monthTime
)
+
'月前'
}
else
if
(
parseInt
(
timeDifference
/
weektTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
weektTime
)
+
'周前'
}
else
if
(
parseInt
(
timeDifference
/
dayTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
dayTime
)
+
'天前'
}
else
if
(
parseInt
(
timeDifference
/
hourTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
hourTime
)
+
'小时前'
}
else
if
(
parseInt
(
timeDifference
/
minTime
)
>=
1
)
{
result
=
parseInt
(
timeDifference
/
minTime
)
+
'分钟前'
if
(
parseInt
(
timeDifference
/
minTime
)
<=
5
)
{
if
(
math
.
floor
(
timeDifference
/
yearTime
)
>=
1
)
{
result
=
math
.
floor
(
timeDifference
/
yearTime
)
+
'年前'
}
else
if
(
math
.
floor
(
timeDifference
/
monthTime
)
>=
1
)
{
result
=
math
.
floor
(
timeDifference
/
monthTime
)
+
'月前'
}
else
if
(
math
.
floor
(
timeDifference
/
weektTime
)
>=
1
)
{
result
=
math
.
floor
(
timeDifference
/
weektTime
)
+
'周前'
}
else
if
(
math
.
floor
(
timeDifference
/
dayTime
)
>=
1
)
{
result
=
math
.
floor
(
timeDifference
/
dayTime
)
+
'天前'
}
else
if
(
math
.
floor
(
timeDifference
/
hourTime
)
>=
1
)
{
result
=
math
.
floor
(
timeDifference
/
hourTime
)
+
'小时前'
}
else
if
(
math
.
floor
(
timeDifference
/
minTime
)
>=
1
)
{
result
=
math
.
floor
(
timeDifference
/
minTime
)
+
'分钟前'
if
(
math
.
floor
(
timeDifference
/
minTime
)
<=
5
)
{
//五分钟内就是刚刚
result
=
'刚刚'
}
...
...
utils/request/environment.js
View file @
a204358
import
{
preReleaseAppId
}
from
'~/config'
const
target
=
[
'ip'
,
'dev'
,
'uat'
,
'prod'
,
'preRelease'
]
/**
...
...
@@ -28,7 +29,7 @@ let index = 3
// console.log();
if
(
systemInfo
.
platform
!=
'devtools'
)
{
// 判断预发布的appid 是强制锁定为4(预发布的地址)
if
(
accountInfo
.
miniProgram
.
appId
==
'wx24ebae5768e74138'
)
{
if
(
accountInfo
.
miniProgram
.
appId
==
preReleaseAppId
)
{
index
=
4
}
else
{
switch
(
accountInfo
.
miniProgram
.
envVersion
)
{
...
...
@@ -46,7 +47,6 @@ if (systemInfo.platform != 'devtools') {
break
}
}
}
const
secretKey
=
{
...
...
utils/sentryConfig/sentryInit.js
0 → 100644
View file @
a204358
import
{
dsnUrl
}
from
'~/config'
import
*
as
Sentry
from
'~/utils/lib/sentry-miniapp'
export
default
function
sentryInit
()
{
// accountInfo.miniProgram.envVersion == 'release' &&
const
accountInfo
=
wx
.
getAccountInfoSync
()
//测试和生产才开发sentry
const
env
=
[
'trial'
,
'release'
]
env
.
includes
(
accountInfo
.
miniProgram
.
envVersion
)
&&
Sentry
.
init
({
// dsn: 'http://ebcf31c417cc4ce185782f046e4a87a2@sentry.glsx.com.cn/5'
dsn
:
dsnUrl
})
}
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