mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-10-25 00:50:28 +08:00
去掉收集慢接口,由服务端中间件收集
This commit is contained in:
@@ -21,9 +21,7 @@
|
||||
Pid: 'e19e3be20de94f49b68fafb4c30668bc',
|
||||
Uid: ''
|
||||
},
|
||||
new XErr.Web({
|
||||
onloadTimeOut: 5000
|
||||
})
|
||||
new XErr.Web({})
|
||||
)
|
||||
xErr.SetUid(2) //设置用户ID
|
||||
</script>
|
||||
|
||||
@@ -18,9 +18,7 @@ import VForm3 from 'vform3-builds' //引入VForm3库
|
||||
// Pid: 'e19e3be20de94f49b68fafb4c30668bc',
|
||||
// Uid: ''
|
||||
// },
|
||||
// new Web({
|
||||
// onloadTimeOut: 300
|
||||
// })
|
||||
// new Web()
|
||||
// )
|
||||
// xErr.SetUid(1) //设置用户ID
|
||||
|
||||
|
||||
@@ -48,7 +48,10 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="使用SDK" v-if="mode == 'edit'&&formData.ProjectType=='web'">
|
||||
<el-form-item
|
||||
label="使用SDK"
|
||||
v-if="mode == 'edit' && formData.ProjectType == 'web'"
|
||||
>
|
||||
<highlight-code :code="code" lang="javascript"></highlight-code>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -100,9 +103,7 @@ new Base(
|
||||
Pid: '${formData.ProjectKey}',
|
||||
Uid: ''
|
||||
},
|
||||
new Web({
|
||||
onloadTimeOut: 8000
|
||||
})
|
||||
new Web()
|
||||
)`
|
||||
})
|
||||
const formRules = {
|
||||
|
||||
@@ -12,24 +12,24 @@ import (
|
||||
type FlowHistoryHandler struct {
|
||||
}
|
||||
|
||||
// @Summary 流程历史列表
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param applyId query int false "申请id"
|
||||
// @Param templateId query int false "模板id"
|
||||
// @Param applyUserId query int false "申请人id"
|
||||
// @Param applyUserNickname query string false "申请人昵称"
|
||||
// @Param approverId query int false "审批人id"
|
||||
// @Param approverNickname query string false "审批用户昵称"
|
||||
// @Param nodeId query string false "节点"
|
||||
// @Param formValue query string false "表单值"
|
||||
// @Param passStatus query int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark query string false "通过备注"
|
||||
// @Success 200 {object} response.Response{data=response.PageResp{lists=[]FlowHistoryResp}} "成功"
|
||||
// @Router /api/admin/flow/flow_history/list [get]
|
||||
// @Summary 流程历史列表
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param PageNo query int true "页码"
|
||||
// @Param PageSize query int true "每页数量"
|
||||
// @Param applyId query int false "申请id"
|
||||
// @Param templateId query int false "模板id"
|
||||
// @Param applyUserId query int false "申请人id"
|
||||
// @Param applyUserNickname query string false "申请人昵称"
|
||||
// @Param approverId query int false "审批人id"
|
||||
// @Param approverNickname query string false "审批用户昵称"
|
||||
// @Param nodeId query string false "节点"
|
||||
// @Param formValue query string false "表单值"
|
||||
// @Param passStatus query int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark query string false "通过备注"
|
||||
// @Success 200 {object} response.Response{data=response.PageResp{lists=[]FlowHistoryResp}} "成功"
|
||||
// @Router /api/admin/flow/flow_history/list [get]
|
||||
func (hd FlowHistoryHandler) List(c *gin.Context) {
|
||||
var page request.PageReq
|
||||
var listReq = FlowHistoryListReq{
|
||||
@@ -45,11 +45,11 @@ func (hd FlowHistoryHandler) List(c *gin.Context) {
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程历史列表-所有
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Success 200 {object} response.Response{data=FlowHistoryResp} "成功"
|
||||
// @Router /api/admin/flow/flow_history/listAll [get]
|
||||
// @Summary 流程历史列表-所有
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Success 200 {object} response.Response{data=FlowHistoryResp} "成功"
|
||||
// @Router /api/admin/flow/flow_history/listAll [get]
|
||||
func (hd FlowHistoryHandler) ListAll(c *gin.Context) {
|
||||
var listReq FlowHistoryListReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
|
||||
@@ -59,13 +59,13 @@ func (hd FlowHistoryHandler) ListAll(c *gin.Context) {
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程历史详情
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id query int false "历史id"
|
||||
// @Success 200 {object} response.Response{data=FlowHistoryResp} "成功"
|
||||
// @Router /api/admin/flow/flow_history/detail [get]
|
||||
// @Summary 流程历史详情
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id query int false "历史id"
|
||||
// @Success 200 {object} response.Response{data=FlowHistoryResp} "成功"
|
||||
// @Router /api/admin/flow/flow_history/detail [get]
|
||||
func (hd FlowHistoryHandler) Detail(c *gin.Context) {
|
||||
var detailReq FlowHistoryDetailReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
|
||||
@@ -75,22 +75,22 @@ func (hd FlowHistoryHandler) Detail(c *gin.Context) {
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
|
||||
// @Summary 流程历史新增
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.Response "成功"
|
||||
// @Router /api/admin/flow/flow_history/add [post]
|
||||
// @Summary 流程历史新增
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.Response "成功"
|
||||
// @Router /api/admin/flow/flow_history/add [post]
|
||||
func (hd FlowHistoryHandler) Add(c *gin.Context) {
|
||||
var addReq FlowHistoryAddReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &addReq)) {
|
||||
@@ -99,23 +99,23 @@ func (hd FlowHistoryHandler) Add(c *gin.Context) {
|
||||
response.CheckAndResp(c, Service.Add(addReq))
|
||||
}
|
||||
|
||||
// @Summary 流程历史编辑
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.Response "成功"
|
||||
// @Router /api/admin/flow/flow_history/edit [post]
|
||||
// @Summary 流程历史编辑
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Param applyId body int false "申请id"
|
||||
// @Param templateId body int false "模板id"
|
||||
// @Param applyUserId body int false "申请人id"
|
||||
// @Param applyUserNickname body string false "申请人昵称"
|
||||
// @Param approverId body int false "审批人id"
|
||||
// @Param approverNickname body string false "审批用户昵称"
|
||||
// @Param nodeId body string false "节点"
|
||||
// @Param formValue body string false "表单值"
|
||||
// @Param passStatus body int false "通过状态:0待处理,1通过,2拒绝"
|
||||
// @Param passRemark body string false "通过备注"
|
||||
// @Success 200 {object} response.Response "成功"
|
||||
// @Router /api/admin/flow/flow_history/edit [post]
|
||||
func (hd FlowHistoryHandler) Edit(c *gin.Context) {
|
||||
var editReq FlowHistoryEditReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &editReq)) {
|
||||
@@ -124,13 +124,13 @@ func (hd FlowHistoryHandler) Edit(c *gin.Context) {
|
||||
response.CheckAndResp(c, Service.Edit(editReq))
|
||||
}
|
||||
|
||||
// @Summary 流程历史删除
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Success 200 {object} response.Response "成功"
|
||||
// @Router /api/admin/flow/flow_history/del [post]
|
||||
// @Summary 流程历史删除
|
||||
// @Tags flow_history-流程历史
|
||||
// @Produce json
|
||||
// @Param Token header string true "token"
|
||||
// @Param id body int false "历史id"
|
||||
// @Success 200 {object} response.Response "成功"
|
||||
// @Router /api/admin/flow/flow_history/del [post]
|
||||
func (hd FlowHistoryHandler) Del(c *gin.Context) {
|
||||
var delReq FlowHistoryDelReq
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &delReq)) {
|
||||
@@ -140,6 +140,7 @@ func (hd FlowHistoryHandler) Del(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 提交申请,通过审批
|
||||
//
|
||||
// @Tags flow_history-流程历史
|
||||
//
|
||||
// @Router /api/admin/flow/flow_apply/pass [post]
|
||||
@@ -154,6 +155,7 @@ func (hd FlowHistoryHandler) Pass(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 拒绝审批
|
||||
//
|
||||
// @Tags flow_history-流程历史
|
||||
//
|
||||
// @Router /api/admin/flow/flow_apply/back [post]
|
||||
@@ -173,8 +175,6 @@ func (hd FlowHistoryHandler) NextNode(c *gin.Context) {
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &nextNode)) {
|
||||
return
|
||||
}
|
||||
|
||||
// response.CheckAndResp(c, Service.GetNextNode(nextNode))
|
||||
res, _, _, err := Service.GetNextNode(nextNode.ApplyId)
|
||||
response.CheckAndRespWithData(c, res, err)
|
||||
}
|
||||
@@ -186,8 +186,6 @@ func (hd FlowHistoryHandler) GetApprover(c *gin.Context) {
|
||||
if response.IsFailWithResp(c, util.VerifyUtil.VerifyBody(c, &nextNode)) {
|
||||
return
|
||||
}
|
||||
|
||||
// response.CheckAndResp(c, Service.GetNextNode(node))
|
||||
res, err := Service.GetApprover(nextNode.ApplyId)
|
||||
if err != nil {
|
||||
response.FailWithMsg(c, response.Failed, err.Error())
|
||||
|
||||
@@ -140,7 +140,6 @@ func (hd *MonitorClientHandler) Detail(c *gin.Context) {
|
||||
func (hd *MonitorClientHandler) Add(c *gin.Context) {
|
||||
data, err := url.QueryUnescape(c.Query("data"))
|
||||
if err != nil {
|
||||
// response.CheckAndRespWithData(c, 0, err)
|
||||
c.Data(200, "image/gif", img_util.EmptyGif())
|
||||
return
|
||||
}
|
||||
@@ -159,7 +158,6 @@ func (hd *MonitorClientHandler) Add(c *gin.Context) {
|
||||
// 前后数据一样,不用创建新的数据
|
||||
fmt.Println("前后数据一样,不用创建新的数据")
|
||||
c.Data(200, "image/gif", img_util.EmptyGif())
|
||||
// response.CheckAndRespWithData(c, 0, nil)
|
||||
return
|
||||
} else {
|
||||
// 新建的话,需要清除lastClient对应的缓存
|
||||
|
||||
@@ -108,7 +108,6 @@ func (hd *MonitorErrorHandler) Detail(c *gin.Context) {
|
||||
func (hd *MonitorErrorHandler) Add(c *gin.Context) {
|
||||
data, err := url.QueryUnescape(c.Query("data"))
|
||||
if err != nil {
|
||||
// response.CheckAndRespWithData(c, 0, err)
|
||||
c.Data(200, "image/gif", img_util.EmptyGif())
|
||||
return
|
||||
}
|
||||
@@ -122,7 +121,6 @@ func (hd *MonitorErrorHandler) Add(c *gin.Context) {
|
||||
for i := 0; i < len(addReq); i++ {
|
||||
MonitorErrorService.Add(addReq[i])
|
||||
}
|
||||
// response.CheckAndRespWithData(c, g, nil)
|
||||
c.Data(200, "image/gif", img_util.EmptyGif())
|
||||
}
|
||||
|
||||
|
||||
@@ -1,117 +1,119 @@
|
||||
{
|
||||
"name": "x-admin",
|
||||
"appid": "__UNI__FB29F21",
|
||||
"description": "",
|
||||
"versionName": "2025.04.142245",
|
||||
"versionCode": 130,
|
||||
"transformPx": false,
|
||||
"app-plus": {
|
||||
"compatible": {
|
||||
"ignoreVersion": true
|
||||
},
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
"delay": 0
|
||||
},
|
||||
"modules": {},
|
||||
"distribute": {
|
||||
"android": {
|
||||
"permissions": [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
],
|
||||
"minSdkVersion": 26,
|
||||
"schemes": "x_admin",
|
||||
"targetSdkVersion": 30
|
||||
},
|
||||
"ios": {
|
||||
"urltypes": "x_admin",
|
||||
"dSYMs": false
|
||||
},
|
||||
"sdkConfigs": {
|
||||
"ad": {}
|
||||
},
|
||||
"icons": {
|
||||
"android": {
|
||||
"hdpi": "unpackage/res/icons/72x72.png",
|
||||
"xhdpi": "unpackage/res/icons/96x96.png",
|
||||
"xxhdpi": "unpackage/res/icons/144x144.png",
|
||||
"xxxhdpi": "unpackage/res/icons/192x192.png"
|
||||
},
|
||||
"ios": {
|
||||
"appstore": "unpackage/res/icons/1024x1024.png",
|
||||
"ipad": {
|
||||
"app": "unpackage/res/icons/76x76.png",
|
||||
"app@2x": "unpackage/res/icons/152x152.png",
|
||||
"notification": "unpackage/res/icons/20x20.png",
|
||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
||||
"proapp@2x": "unpackage/res/icons/167x167.png",
|
||||
"settings": "unpackage/res/icons/29x29.png",
|
||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
||||
"spotlight": "unpackage/res/icons/40x40.png",
|
||||
"spotlight@2x": "unpackage/res/icons/80x80.png"
|
||||
},
|
||||
"iphone": {
|
||||
"app@2x": "unpackage/res/icons/120x120.png",
|
||||
"app@3x": "unpackage/res/icons/180x180.png",
|
||||
"notification@2x": "unpackage/res/icons/40x40.png",
|
||||
"notification@3x": "unpackage/res/icons/60x60.png",
|
||||
"settings@2x": "unpackage/res/icons/58x58.png",
|
||||
"settings@3x": "unpackage/res/icons/87x87.png",
|
||||
"spotlight@2x": "unpackage/res/icons/80x80.png",
|
||||
"spotlight@3x": "unpackage/res/icons/120x120.png"
|
||||
}
|
||||
}
|
||||
},
|
||||
"splashscreen": {
|
||||
"useOriginalMsgbox": true
|
||||
}
|
||||
},
|
||||
"nvueLaunchMode": "",
|
||||
"nativePlugins": {}
|
||||
},
|
||||
"quickapp": {},
|
||||
"mp-weixin": {
|
||||
"appid": "",
|
||||
"setting": {
|
||||
"urlCheck": false
|
||||
},
|
||||
"usingComponents": true,
|
||||
"unipush": {
|
||||
"enable": false
|
||||
}
|
||||
},
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
},
|
||||
"vueVersion": "3",
|
||||
"locale": "zh-Hans",
|
||||
"fallbackLocale": "zh-Hans"
|
||||
}
|
||||
"name" : "x-admin",
|
||||
"appid" : "__UNI__FB29F21",
|
||||
"description" : "",
|
||||
"versionName" : "2025.04.201658",
|
||||
"versionCode" : 133,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"compatible" : {
|
||||
"ignoreVersion" : true
|
||||
},
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
"modules" : {
|
||||
"VideoPlayer" : {}
|
||||
},
|
||||
"distribute" : {
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
],
|
||||
"minSdkVersion" : 26,
|
||||
"schemes" : "x_admin",
|
||||
"targetSdkVersion" : 30
|
||||
},
|
||||
"ios" : {
|
||||
"urltypes" : "x_admin",
|
||||
"dSYMs" : false
|
||||
},
|
||||
"sdkConfigs" : {
|
||||
"ad" : {}
|
||||
},
|
||||
"icons" : {
|
||||
"android" : {
|
||||
"hdpi" : "unpackage/res/icons/72x72.png",
|
||||
"xhdpi" : "unpackage/res/icons/96x96.png",
|
||||
"xxhdpi" : "unpackage/res/icons/144x144.png",
|
||||
"xxxhdpi" : "unpackage/res/icons/192x192.png"
|
||||
},
|
||||
"ios" : {
|
||||
"appstore" : "unpackage/res/icons/1024x1024.png",
|
||||
"ipad" : {
|
||||
"app" : "unpackage/res/icons/76x76.png",
|
||||
"app@2x" : "unpackage/res/icons/152x152.png",
|
||||
"notification" : "unpackage/res/icons/20x20.png",
|
||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||
"proapp@2x" : "unpackage/res/icons/167x167.png",
|
||||
"settings" : "unpackage/res/icons/29x29.png",
|
||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||
"spotlight" : "unpackage/res/icons/40x40.png",
|
||||
"spotlight@2x" : "unpackage/res/icons/80x80.png"
|
||||
},
|
||||
"iphone" : {
|
||||
"app@2x" : "unpackage/res/icons/120x120.png",
|
||||
"app@3x" : "unpackage/res/icons/180x180.png",
|
||||
"notification@2x" : "unpackage/res/icons/40x40.png",
|
||||
"notification@3x" : "unpackage/res/icons/60x60.png",
|
||||
"settings@2x" : "unpackage/res/icons/58x58.png",
|
||||
"settings@3x" : "unpackage/res/icons/87x87.png",
|
||||
"spotlight@2x" : "unpackage/res/icons/80x80.png",
|
||||
"spotlight@3x" : "unpackage/res/icons/120x120.png"
|
||||
}
|
||||
}
|
||||
},
|
||||
"splashscreen" : {
|
||||
"useOriginalMsgbox" : true
|
||||
}
|
||||
},
|
||||
"nvueLaunchMode" : "",
|
||||
"nativePlugins" : {}
|
||||
},
|
||||
"quickapp" : {},
|
||||
"mp-weixin" : {
|
||||
"appid" : "",
|
||||
"setting" : {
|
||||
"urlCheck" : false
|
||||
},
|
||||
"usingComponents" : true,
|
||||
"unipush" : {
|
||||
"enable" : false
|
||||
}
|
||||
},
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
},
|
||||
"vueVersion" : "3",
|
||||
"locale" : "zh-Hans",
|
||||
"fallbackLocale" : "zh-Hans"
|
||||
}
|
||||
|
||||
@@ -12,12 +12,6 @@ export type LogWithError = {
|
||||
Stack?: string;
|
||||
};
|
||||
|
||||
export type ISlow = {
|
||||
Type: "onloadTime"
|
||||
|
||||
Path:string;
|
||||
Time: number;
|
||||
};
|
||||
|
||||
|
||||
// 扩展必须实现的接口
|
||||
@@ -30,4 +24,4 @@ export interface IErrorEvent {
|
||||
listen(callback: ListenCallbackFn): void;
|
||||
unListen(): void;
|
||||
}
|
||||
export type ListenCallbackFn = (params: LogWithError|ISlow) => void;
|
||||
export type ListenCallbackFn = (params: LogWithError) => void;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { v1 as uuid_v1 } from "uuid";
|
||||
import type { LogWithError, IErrorEvent,ISlow, LogWithEnv } from "../types";
|
||||
|
||||
import type { LogWithError, IErrorEvent, LogWithEnv } from "../types";
|
||||
|
||||
type Uid = string | number;
|
||||
|
||||
type Props = {
|
||||
@@ -44,17 +44,11 @@ class Base {
|
||||
this.SetUid();
|
||||
this.getLocalMessage();
|
||||
|
||||
|
||||
// 监听错误
|
||||
platform.listen((params: LogWithError|ISlow) => {
|
||||
platform.listen((params: LogWithError) => {
|
||||
console.log("listenCallback", params);
|
||||
if(params.Type=='onloadTime'){
|
||||
let slow=params as ISlow;
|
||||
this.uploadSlow(slow);
|
||||
}else{
|
||||
this.Push(params);
|
||||
}
|
||||
|
||||
|
||||
this.Push(params);
|
||||
});
|
||||
|
||||
this.timer = setInterval(() => {
|
||||
@@ -65,9 +59,8 @@ class Base {
|
||||
// 设置用户id
|
||||
public SetUid(uid?: Uid) {
|
||||
if (uid) {
|
||||
this.Uid =String(uid) ;
|
||||
this.Uid = String(uid);
|
||||
this.platform?.setCache("x_err_uid", this.Uid);
|
||||
|
||||
} else {
|
||||
const u_id = this.platform?.getCache("x_err_uid");
|
||||
if (u_id) {
|
||||
@@ -103,7 +96,7 @@ class Base {
|
||||
}
|
||||
}
|
||||
// 记录错误,超出5条时立即上报,否则缓存到本地(等待定时器上报)
|
||||
public Push=(data: LogWithError) =>{
|
||||
public Push = (data: LogWithError) => {
|
||||
this.MessageList.push({
|
||||
...data,
|
||||
ProjectKey: this.Pid,
|
||||
@@ -115,8 +108,8 @@ class Base {
|
||||
} else {
|
||||
this.platform?.setCache("x_err_message_list", this.MessageList);
|
||||
}
|
||||
}
|
||||
public uploadInfo=(envInfo: LogWithEnv) =>{
|
||||
};
|
||||
public uploadInfo = (envInfo: LogWithEnv) => {
|
||||
if (!this.Dns) return; //未设置Dns服务器不上传
|
||||
|
||||
try {
|
||||
@@ -132,24 +125,7 @@ class Base {
|
||||
// 上传失败
|
||||
});
|
||||
} catch (error) {}
|
||||
}
|
||||
public uploadSlow=(envInfo: ISlow) =>{
|
||||
if (!this.Dns) return; //未设置Dns服务器不上传
|
||||
|
||||
try {
|
||||
this.platform
|
||||
?.upload(this.Dns + `/admin/monitor_slow/add`, {
|
||||
ProjectKey: this.Pid,
|
||||
ClientId: this.client_id,
|
||||
UserId: this.Uid,
|
||||
Path: envInfo.Path,
|
||||
Time: envInfo.Time,
|
||||
})
|
||||
.catch((err: any) => {
|
||||
// 上传失败
|
||||
});
|
||||
} catch (error) {}
|
||||
}
|
||||
};
|
||||
|
||||
// 上传文件
|
||||
public upload() {
|
||||
|
||||
@@ -2,18 +2,15 @@ import type {
|
||||
LogWithError,
|
||||
LogWithEnv,
|
||||
ListenCallbackFn,
|
||||
IErrorEvent,ISlow
|
||||
IErrorEvent
|
||||
} from "../types";
|
||||
|
||||
interface LoggerProps {
|
||||
// timeout:number
|
||||
onloadTimeOut?: number;
|
||||
}
|
||||
class Web implements IErrorEvent {
|
||||
props: LoggerProps;
|
||||
constructor(props?: LoggerProps) {
|
||||
this.props = {
|
||||
onloadTimeOut: 5000,
|
||||
...props,
|
||||
};
|
||||
}
|
||||
@@ -67,7 +64,7 @@ class Web implements IErrorEvent {
|
||||
}
|
||||
return env;
|
||||
}
|
||||
private callback(err: LogWithError|ISlow): void {}
|
||||
private callback(err: LogWithError): void {}
|
||||
private listenError = (err: any) => {
|
||||
console.error([err]);
|
||||
let target = err.target;
|
||||
@@ -130,31 +127,7 @@ class Web implements IErrorEvent {
|
||||
}
|
||||
return newStack.join("\n");
|
||||
}
|
||||
private onLoad = () => {
|
||||
// 获取性能数据
|
||||
const entries = performance.getEntriesByType("navigation");
|
||||
if (entries.length > 0) {
|
||||
const performanceData = entries[0] as PerformanceNavigationTiming;
|
||||
|
||||
console.log("performanceData", performanceData);
|
||||
|
||||
// 计算页面onload时间
|
||||
let onloadTime =
|
||||
performanceData.loadEventStart - performanceData.startTime;
|
||||
if (
|
||||
this.props.onloadTimeOut &&
|
||||
onloadTime > this.props.onloadTimeOut
|
||||
) {
|
||||
// 页面加载时间5s以上
|
||||
this.callback({
|
||||
Type: "onloadTime",
|
||||
Path: window.location.href,
|
||||
Time:Math.floor(onloadTime)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
public listen(callback: ListenCallbackFn): void {
|
||||
this.callback = callback;
|
||||
window.addEventListener("unhandledrejection", this.unhandledrejection);
|
||||
@@ -162,8 +135,6 @@ class Web implements IErrorEvent {
|
||||
// window.addEventListener("click", this.listenClick);
|
||||
// window.addEventListener("hashchange", this.listenHashRouterChange);
|
||||
// window.addEventListener("popstate", this.listenHistoryRouterChange);
|
||||
|
||||
window.addEventListener("load", this.onLoad);
|
||||
}
|
||||
|
||||
public unListen(): void {
|
||||
|
||||
Reference in New Issue
Block a user