Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9120ea1f
authored
Jan 02, 2025
by
前端
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
合并
1 parent
c5339ea4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
138 additions
and
180 deletions
components/HomeFrame/components/RecordList.vue
manifest.json
mixin/click.js
utils/RecordManager.js
utils/TimeoutManager.js
utils/logger/LocalLog.js
components/HomeFrame/components/RecordList.vue
View file @
9120ea1
<
template
>
<
template
>
<view
class=
"record-box"
>
<view
class=
"record-box"
>
<view
<view
class=
"record-content"
v-if=
"showRecord"
>
class=
"record-content"
v-if=
"showRecord"
>
<view
class=
"data-box"
>
<view
class=
"data-box"
>
<template
v-for=
"(i, index) in dataList"
>
<template
v-for=
"(i, index) in dataList"
>
<view
<view
:class=
"['data-item', i.type]"
:key=
"index"
>
:class=
"['data-item', i.type]"
<image
:src=
"i.icon"
class=
"data-item-bg"
/>
:key=
"index"
>
<image
:src=
"i.icon"
class=
"data-item-bg"
/>
<view
class=
"title"
>
{{
dateList
[
index
].
text
}}
</view>
<view
class=
"title"
>
{{
dateList
[
index
].
text
}}
</view>
<view
class=
"content"
>
<view
class=
"content"
>
<view
class=
"total"
>
<view
class=
"total"
>
...
@@ -37,74 +28,35 @@
...
@@ -37,74 +28,35 @@
</view>
</view>
<view
class=
"data-container"
>
<view
class=
"data-container"
>
<view
:class=
"['type-box']"
>
<view
:class=
"['type-box']"
>
<view
<view
class=
"tab-item"
v-for=
"(i, index) in typeList"
:key=
"index"
@
click=
"changeType(index, 'firstIndex')"
>
class=
"tab-item"
<view
class=
"sprite-icon"
:class=
"[firstIndex == index ? `icon-${firstClass[index]} active` : '', firstLeft[index]]"
></view>
v-for=
"(i, index) in typeList"
<view
class=
"text"
:class=
"[firstIndex == index ? `active` : '']"
>
:key=
"index"
@
click=
"changeType(index, 'firstIndex')"
>
<view
class=
"sprite-icon"
:class=
"[firstIndex == index ? `icon-${firstClass[index]} active` : '', firstLeft[index]]"
></view>
<view
class=
"text"
:class=
"[firstIndex == index ? `active` : '']"
>
{{ i.tabName }}
{{ i.tabName }}
<
template
v-if=
"index == 1 && i.num && recordFailList.length > 0"
>
(
{{
recordFailList
.
length
}}
)
</
template
>
<
template
v-if=
"index == 1 && i.num && recordFailList.length > 0"
>
(
{{
recordFailList
.
length
}}
)
</
template
>
<
template
v-if=
"index == 2 && i.num && preRecordFailList.length > 0"
>
(
{{
preRecordFailList
.
length
}}
)
</
template
>
<
template
v-if=
"index == 2 && i.num && preRecordFailList.length > 0"
>
(
{{
preRecordFailList
.
length
}}
)
</
template
>
<div
<div
class=
"dot"
v-if=
"index == 2 && i.num && preRecordFailList.length > 0"
></div>
class=
"dot"
v-if=
"index == 2 && i.num && preRecordFailList.length > 0"
></div>
</view>
</view>
</view>
</view>
</view>
</view>
<view
class=
"tabs-bottom"
></view>
<view
class=
"tabs-bottom"
></view>
<view
<view
v-if=
"firstIndex == 0"
class=
"data-tabs-box"
>
v-if=
"firstIndex == 0"
class=
"data-tabs-box"
>
<view
class=
"data-tabs"
>
<view
class=
"data-tabs"
>
<
template
v-for=
"(i, index) in dateList"
>
<
template
v-for=
"(i, index) in dateList"
>
<view
<view
:class=
"['tab flex',
{ active: dateIndex == index }]" :key="index" @click="changeIndex(index)">
{{
i
.
text
}}
</view>
:class=
"['tab flex',
{ active: dateIndex == index }]"
:key="index"
@click="changeIndex(index)"
>
{{
i
.
text
}}
</view>
</
template
>
</
template
>
<view
:class=
"['active-btn', `active-btn-${dateIndex}`]"
></view>
<view
:class=
"['active-btn', `active-btn-${dateIndex}`]"
></view>
</view>
</view>
</view>
</view>
<scroll-view
<scroll-view
:class=
"['record-list', { 'type-1': firstIndex == 1 }]"
scroll-y
@
scrolltolower=
"pageonReachBottom"
@
scroll=
"scroll"
>
:class=
"['record-list', { 'type-1': firstIndex == 1 }]"
<div
class=
"record-tips"
v-if=
"firstIndex == 2 && list.length && list[0] && list[0].length"
>
以下非正常结束的接待记录,需要进行信息确认后才能提交到系统。
</div>
scroll-y
@
scrolltolower=
"pageonReachBottom"
@
scroll=
"scroll"
>
<div
class=
"record-tips"
v-if=
"firstIndex == 2 && list.length && list[0] && list[0].length"
>
以下非正常结束的接待记录,需要进行信息确认后才能提交到系统。
</div>
<view
class=
"list"
>
<view
class=
"list"
>
<
template
v-if=
"flag"
>
<
template
v-if=
"flag"
>
<template
v-if=
"list.length && list[0] && list[0].length"
>
<template
v-if=
"list.length && list[0] && list[0].length"
>
<template
v-for=
"i in list"
>
<template
v-for=
"i in list"
>
<template
v-for=
"item in i"
>
<template
v-for=
"item in i"
>
<view
<view
class=
"item"
:key=
"item.id"
@
click=
"jumpDetail(item)"
>
class=
"item"
<view
class=
"status flex disabled"
v-if=
"item.receptionStatus === '' || item.receptionStatus === undefined"
>
未知
</view>
:key=
"item.id"
<view
:class=
"['status flex',
{ deal: item.receptionStatus == 1 }]" v-else>
@
click=
"jumpDetail(item)"
>
<view
class=
"status flex disabled"
v-if=
"item.receptionStatus === '' || item.receptionStatus === undefined"
>
未知
</view>
<view
:class=
"['status flex',
{ deal: item.receptionStatus == 1 }]"
v-else
>
{{
{{
{
{
1
:
'成交'
,
1
:
'成交'
,
...
@@ -117,10 +69,7 @@
...
@@ -117,10 +69,7 @@
<
/view
>
<
/view
>
<
view
class
=
"goods-name"
>
{{
item
.
carModel
?
item
.
carModel
:
'未选择车型'
}}
<
/view
>
<
view
class
=
"goods-name"
>
{{
item
.
carModel
?
item
.
carModel
:
'未选择车型'
}}
<
/view
>
<
template
v
-
for
=
"(k, ind) in itemObject"
>
<
template
v
-
for
=
"(k, ind) in itemObject"
>
<
view
<
view
class
=
"info flex"
:
key
=
"ind"
>
class
=
"info flex"
:
key
=
"ind"
>
<
view
class
=
"label"
>
{{
k
.
label
}}
<
/view
>
<
view
class
=
"label"
>
{{
k
.
label
}}
<
/view
>
<
view
class
=
"value"
>
{{
formatValue
(
item
[
k
.
key
],
k
.
key
)
||
'-'
}}
<
/view
>
<
view
class
=
"value"
>
{{
formatValue
(
item
[
k
.
key
],
k
.
key
)
||
'-'
}}
<
/view
>
<
/view
>
<
/view
>
...
@@ -131,10 +80,7 @@
...
@@ -131,10 +80,7 @@
<
/template
>
<
/template
>
<
template
v
-
else
>
<
template
v
-
else
>
<
view
class
=
"nothing flex"
>
<
view
class
=
"nothing flex"
>
<
image
<
image
class
=
"icon"
src
=
"../../../assets/images/home/nothing.webp"
/>
class
=
"icon"
src
=
"../../../assets/images/home/nothing.webp"
/>
暂无接待记录
暂无接待记录
<
/view
>
<
/view
>
<
/template
>
<
/template
>
...
@@ -146,12 +92,7 @@
...
@@ -146,12 +92,7 @@
<
/scroll-view
>
<
/scroll-view
>
<
/view
>
<
/view
>
<
/view
>
<
/view
>
<
save
-
record
<
save
-
record
v
-
else
@
cancel
=
"handleCancel"
@
submit
=
"handleSubmit"
:
customerInfoVal
=
"customerInfo"
><
/save-record
>
v
-
else
@
cancel
=
"handleCancel"
@
submit
=
"handleSubmit"
:
customerInfoVal
=
"customerInfo"
><
/save-record
>
<
/view
>
<
/view
>
<
/template
>
<
/template
>
<
script
type
=
"text/ecmascript-6"
>
<
script
type
=
"text/ecmascript-6"
>
...
@@ -231,6 +172,7 @@ export default {
...
@@ -231,6 +172,7 @@ export default {
formatValue
(
val
,
k
)
{
formatValue
(
val
,
k
)
{
if
(
!
val
)
return
if
(
!
val
)
return
if
(
k
==
'phoneNumber'
)
{
if
(
k
==
'phoneNumber'
)
{
val
=
val
.
toString
()
return
val
.
slice
(
0
,
3
)
+
" "
+
val
.
slice
(
3
,
7
)
+
" "
+
val
.
slice
(
7
)
return
val
.
slice
(
0
,
3
)
+
" "
+
val
.
slice
(
3
,
7
)
+
" "
+
val
.
slice
(
7
)
}
}
return
val
return
val
...
@@ -240,7 +182,7 @@ export default {
...
@@ -240,7 +182,7 @@ export default {
}
,
}
,
async
handleSubmit
(
val
)
{
async
handleSubmit
(
val
)
{
this
.
showRecord
=
true
;
this
.
showRecord
=
true
;
uni
.
$record
Manager
.
addRecord
(
val
)
await
uni
.
$db
Manager
.
addRecord
(
val
)
uni
.
$logger
.
local
.
info
(
`添加记录${JSON.stringify(val)
}
`
)
uni
.
$logger
.
local
.
info
(
`添加记录${JSON.stringify(val)
}
`
)
interruptRecord
.
removePreRecord
(
val
.
id
)
interruptRecord
.
removePreRecord
(
val
.
id
)
this
.
getRecordNum
()
this
.
getRecordNum
()
...
@@ -281,8 +223,8 @@ export default {
...
@@ -281,8 +223,8 @@ export default {
scroll
(
e
)
{
scroll
(
e
)
{
this
.
sticky
=
e
.
detail
.
scrollTop
>=
148
this
.
sticky
=
e
.
detail
.
scrollTop
>=
148
}
,
}
,
getRecordNum
()
{
async
getRecordNum
()
{
let
recordFailListAll
=
uni
.
$record
Manager
.
getRecords
();
let
recordFailListAll
=
await
uni
.
$db
Manager
.
getRecords
();
if
(
typeof
recordFailListAll
==
'string'
)
{
if
(
typeof
recordFailListAll
==
'string'
)
{
recordFailListAll
=
JSON
.
parse
(
recordFailListAll
||
'[]'
)
recordFailListAll
=
JSON
.
parse
(
recordFailListAll
||
'[]'
)
}
}
...
...
manifest.json
View file @
9120ea1
{
{
"name"
:
"展业助手"
,
"name"
:
"展业助手"
,
"appid"
:
"__UNI__D3BD3DF"
,
"appid"
:
"__UNI__D3BD3DF"
,
"description"
:
""
,
"description"
:
""
,
"versionName"
:
"2.3.0"
,
"versionName"
:
"2.3.0"
,
"versionCode"
:
"100"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
"transformPx"
:
false
,
/*
5
+App特有相关
*/
/*
5
+App特有相关
*/
"app-plus"
:
{
"app-plus"
:
{
"bounce"
:
"none"
,
"bounce"
:
"none"
,
"usingComponents"
:
true
,
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
"nvueStyleCompiler"
:
"uni-app"
,
"compilerVersion"
:
3
,
"compilerVersion"
:
3
,
"screenOrientation"
:
"landscape"
,
"screenOrientation"
:
"landscape"
,
"splashscreen"
:
{
"splashscreen"
:
{
"alwaysShowBeforeRender"
:
true
,
"alwaysShowBeforeRender"
:
true
,
"waiting"
:
true
,
"waiting"
:
true
,
"autoclose"
:
true
,
"autoclose"
:
true
,
"delay"
:
0
"delay"
:
0
},
},
/*
模块配置
*/
/*
模块配置
*/
"modules"
:
{
"modules"
:
{
"Camera"
:
{},
"Camera"
:
{},
"Record"
:
{},
"Record"
:
{},
"VideoPlayer"
:
{},
"VideoPlayer"
:
{},
"AudioPlayer"
:
{},
"AudioPlayer"
:
{},
"SQLite"
:
{}
"SQLite"
:
{}
},
},
/*
应用发布信息
*/
/*
应用发布信息
*/
"distribute"
:
{
"distribute"
:
{
/*
android打包配置
*/
/*
android打包配置
*/
"android"
:
{
"android"
:
{
"permissions"
:
[
"permissions"
:
[
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera.autofocus
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera.autofocus
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.ACCESS_NETWORK_STATE
\"
/>"
,
...
@@ -45,71 +45,83 @@
...
@@ -45,71 +45,83 @@
"<uses-permission android:name=
\"
android.permission.WAKE_LOCK
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WAKE_LOCK
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
],
],
"abiFilters"
:
[
"armeabi-v7a"
,
"arm64-v8a"
,
"x86"
],
"abiFilters"
:
[
"targetSdkVersion"
:
30
"armeabi-v7a"
,
"arm64-v8a"
,
"x86"
],
"targetSdkVersion"
:
30
},
},
/*
ios打包配置
*/
/*
ios打包配置
*/
"ios"
:
{
"ios"
:
{
"dSYMs"
:
false
,
"dSYMs"
:
false
,
"UIBackgroundModes"
:
"audio"
"UIBackgroundModes"
:
"audio"
},
},
/*
SDK配置
*/
/*
SDK配置
*/
"sdkConfigs"
:
{
"sdkConfigs"
:
{
"ad"
:
{},
"ad"
:
{},
"speech"
:
{}
"speech"
:
{},
"geolocation"
:
{
"system"
:
{
"__platform__"
:
[
"ios"
,
"android"
]
}
}
},
},
"icons"
:
{
"icons"
:
{
"android"
:
{
"android"
:
{
"hdpi"
:
"static/72.png"
,
"hdpi"
:
"static/72.png"
,
"xhdpi"
:
"static/96.png"
,
"xhdpi"
:
"static/96.png"
,
"xxhdpi"
:
"static/144.png"
"xxhdpi"
:
"static/144.png"
}
}
}
}
},
},
"nativePlugins"
:
{
"nativePlugins"
:
{
"Ba-KeepAliveSuit"
:
{
"Ba-KeepAliveSuit"
:
{
"__plugin_info__"
:
{
"__plugin_info__"
:
{
"name"
:
"安卓保活套装(通用、常驻通知、电池优化、自启管理、后台运行等)"
,
"name"
:
"安卓保活套装(通用、常驻通知、电池优化、自启管理、后台运行等)"
,
"description"
:
"在Ba-KeepAlive的基础上,新增了忽略电池优化、自启管理、常驻通知。为定位、推送、websocket、定时任务、蓝牙、聊天等保驾护航(**注意:**不保证支持所有机型和场景,建议先试用再购买)"
,
"description"
:
"在Ba-KeepAlive的基础上,新增了忽略电池优化、自启管理、常驻通知。为定位、推送、websocket、定时任务、蓝牙、聊天等保驾护航(**注意:**不保证支持所有机型和场景,建议先试用再购买)"
,
"platforms"
:
"Android"
,
"platforms"
:
"Android"
,
"url"
:
"https://ext.dcloud.net.cn/plugin?id=11765"
,
"url"
:
"https://ext.dcloud.net.cn/plugin?id=11765"
,
"android_package_name"
:
"uni.gltap"
,
"android_package_name"
:
"uni.gltap"
,
"ios_bundle_id"
:
""
,
"ios_bundle_id"
:
""
,
"isCloud"
:
true
,
"isCloud"
:
true
,
"bought"
:
1
,
"bought"
:
1
,
"pid"
:
"11765"
,
"pid"
:
"11765"
,
"parameters"
:
{}
"parameters"
:
{}
}
}
}
}
}
}
},
},
/*
快应用特有相关
*/
/*
快应用特有相关
*/
"quickapp"
:
{},
"quickapp"
:
{},
/*
小程序特有相关
*/
/*
小程序特有相关
*/
"mp-weixin"
:
{
"mp-weixin"
:
{
"appid"
:
"wx79d1ff39bee3d047"
,
"appid"
:
"wx79d1ff39bee3d047"
,
"setting"
:
{
"setting"
:
{
"urlCheck"
:
false
"urlCheck"
:
false
},
},
"usingComponents"
:
true
"usingComponents"
:
true
},
},
"mp-alipay"
:
{
"mp-alipay"
:
{
"usingComponents"
:
true
"usingComponents"
:
true
},
},
"mp-baidu"
:
{
"mp-baidu"
:
{
"usingComponents"
:
true
"usingComponents"
:
true
},
},
"mp-toutiao"
:
{
"mp-toutiao"
:
{
"usingComponents"
:
true
"usingComponents"
:
true
},
},
"uniStatistics"
:
{
"uniStatistics"
:
{
"enable"
:
false
"enable"
:
false
},
},
"vueVersion"
:
"2"
,
"vueVersion"
:
"2"
,
"h5"
:
{
"h5"
:
{
"devServer"
:
{
"devServer"
:
{
"port"
:
8080
,
"port"
:
8080
,
"https"
:
false
"https"
:
false
}
}
}
}
}
}
\ No newline at end of file
\ No newline at end of file
mixin/click.js
View file @
9120ea1
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 前端 qianduan01@didihu.com.cn
* @Author: 前端 qianduan01@didihu.com.cn
* @Date: 2024-04-08 11:28:48
* @Date: 2024-04-08 11:28:48
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 202
4-12-30 20:57:30
* @LastEditTime: 202
5-01-02 09:50:34
* @FilePath: \gl_tape\mixin\click.js
* @FilePath: \gl_tape\mixin\click.js
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
...
@@ -35,7 +35,7 @@ export default {
...
@@ -35,7 +35,7 @@ export default {
},
},
async
mounted
()
{
async
mounted
()
{
uni
.
$logger
.
local
.
info
(
`进入接待首页!`
)
uni
.
$logger
.
local
.
info
(
`进入接待首页!`
)
//
this.checkPackage() //检查安装包
this
.
checkPackage
()
//检查安装包
this
.
handleCheck
()
// 检查更新
this
.
handleCheck
()
// 检查更新
this
.
handleSave
(
false
)
this
.
handleSave
(
false
)
// 获取当前页面栈数组
// 获取当前页面栈数组
...
@@ -386,7 +386,7 @@ export default {
...
@@ -386,7 +386,7 @@ export default {
uni
.
$logger
.
local
.
info
(
`添加记录
${
JSON
.
stringify
(
record
)}
`
)
uni
.
$logger
.
local
.
info
(
`添加记录
${
JSON
.
stringify
(
record
)}
`
)
const
unlock
=
await
uni
.
$recordManager
.
lock
()
const
unlock
=
await
uni
.
$recordManager
.
lock
()
console
.
log
(
'record'
,
record
)
console
.
log
(
'record'
,
record
)
uni
.
$record
Manager
.
addRecord
(
record
)
await
uni
.
$db
Manager
.
addRecord
(
record
)
interruptRecord
.
removePreRecord
(
record
.
id
)
interruptRecord
.
removePreRecord
(
record
.
id
)
unlock
()
unlock
()
},
},
...
...
utils/RecordManager.js
View file @
9120ea1
import
{
storageApi
}
from
'./cache'
import
{
storageApi
}
from
'./cache'
import
fileManager
from
'@/utils/file/FileManager.js'
import
fileManager
from
"@/utils/file/FileManager.js"
;
import
utils
from
'./utils'
import
utils
from
'./utils'
/**
/**
* 记录管理器类
* 记录管理器类
...
@@ -52,16 +52,17 @@ class RecordManager {
...
@@ -52,16 +52,17 @@ class RecordManager {
unlock
()
{
unlock
()
{
this
.
locker
=
false
this
.
locker
=
false
}
}
/**
/**
* 将一条新记录添加到当前对象的记录列表中
* 将一条新记录添加到当前对象的记录列表中
*
*
* @param {Object} record - 要添加的新记录对象
* @param {Object} record - 要添加的新记录对象
* @returns {Array} - 包含新记录的更新后的记录列表
* @returns {Array} - 包含新记录的更新后的记录列表
*/
*/
async
addRecord
(
record
,
key
)
{
async
addRecord
(
record
,
key
)
{
const
records
=
this
.
getRecords
(
key
)
||
[]
const
records
=
this
.
getRecords
(
key
)
||
[]
records
.
push
(
record
)
records
.
push
(
record
)
this
.
setRecords
(
records
,
key
)
this
.
setRecords
(
records
,
key
)
return
records
return
records
}
}
/**
/**
...
@@ -70,7 +71,7 @@ class RecordManager {
...
@@ -70,7 +71,7 @@ class RecordManager {
* @param {number} id - 要移除的记录的ID
* @param {number} id - 要移除的记录的ID
* @returns {Array} - 移除记录后的更新后的记录列表
* @returns {Array} - 移除记录后的更新后的记录列表
*/
*/
async
removeRecord
(
id
,
key
)
{
async
removeRecord
(
id
,
key
)
{
let
records
=
this
.
getRecords
(
key
)
let
records
=
this
.
getRecords
(
key
)
records
=
records
.
filter
(
i
=>
i
.
id
!==
id
)
records
=
records
.
filter
(
i
=>
i
.
id
!==
id
)
this
.
setRecords
(
records
)
this
.
setRecords
(
records
)
...
@@ -92,7 +93,7 @@ class RecordManager {
...
@@ -92,7 +93,7 @@ class RecordManager {
* @returns {Object} - 具有给定 ID 的记录对象,如果没有找到符合条件的记录,则返回 undefined
* @returns {Object} - 具有给定 ID 的记录对象,如果没有找到符合条件的记录,则返回 undefined
*
*
*/
*/
getRecordById
(
id
,
key
)
{
getRecordById
(
id
,
key
)
{
const
records
=
this
.
getRecords
(
key
)
const
records
=
this
.
getRecords
(
key
)
return
records
.
find
(
i
=>
i
.
id
===
id
)
return
records
.
find
(
i
=>
i
.
id
===
id
)
}
}
...
@@ -112,8 +113,8 @@ class RecordManager {
...
@@ -112,8 +113,8 @@ class RecordManager {
* @param {Array} records - 要设置的记录列表
* @param {Array} records - 要设置的记录列表
* @returns {void} - 此函数不返回任何值
* @returns {void} - 此函数不返回任何值
*/
*/
setRecords
(
records
,
key
)
{
setRecords
(
records
,
key
)
{
storageApi
.
setRecords
(
records
,
key
)
storageApi
.
setRecords
(
records
,
key
)
}
}
/**
/**
* 更新记录数组中的记录
* 更新记录数组中的记录
...
@@ -123,7 +124,7 @@ class RecordManager {
...
@@ -123,7 +124,7 @@ class RecordManager {
* @param {Object} record - 要更新的记录对象,必须包含一个唯一的 id 属性
* @param {Object} record - 要更新的记录对象,必须包含一个唯一的 id 属性
* @throws {Error} 如果记录数组中找不到具有给定 id 的记录,将抛出错误
* @throws {Error} 如果记录数组中找不到具有给定 id 的记录,将抛出错误
*/
*/
updateRecord
(
record
,
key
)
{
updateRecord
(
record
,
key
)
{
const
records
=
this
.
getRecords
(
key
)
const
records
=
this
.
getRecords
(
key
)
const
index
=
records
.
findIndex
(
i
=>
i
.
id
===
record
.
id
)
const
index
=
records
.
findIndex
(
i
=>
i
.
id
===
record
.
id
)
if
(
index
!==
-
1
)
{
if
(
index
!==
-
1
)
{
...
@@ -131,28 +132,28 @@ class RecordManager {
...
@@ -131,28 +132,28 @@ class RecordManager {
this
.
setRecords
(
records
)
this
.
setRecords
(
records
)
}
}
}
}
/**
/**
* 兼容模式的异步处理函数
* 兼容模式的异步处理函数
* 这个函数用于处理在兼容模式下的文件路径转换和记录属性的修正
* 这个函数用于处理在兼容模式下的文件路径转换和记录属性的修正
* 它首先获取一个锁,以确保在操作过程中数据的一致性
* 它首先获取一个锁,以确保在操作过程中数据的一致性
* 然后,它获取客户端文件保存文件夹的路径,并检查是否获取成功
* 然后,它获取客户端文件保存文件夹的路径,并检查是否获取成功
* 接着,它获取所有的记录,并对每个记录执行以下操作:
* 接着,它获取所有的记录,并对每个记录执行以下操作:
* - 检查记录的 recordUrlList 是否存在且不为空,对于每个 URL,判断其是否以 'file://' 开头
* - 检查记录的 recordUrlList 是否存在且不为空,对于每个 URL,判断其是否以 'file://' 开头
* - 如果不是,使用路径中的文件名构建一个新的客户端文件路径,并替换掉原来的 URL
* - 如果不是,使用路径中的文件名构建一个新的客户端文件路径,并替换掉原来的 URL
* - 如果记录没有 id 属性,随机生成一个 UUID 并设置为记录的 id
* - 如果记录没有 id 属性,随机生成一个 UUID 并设置为记录的 id
*
*
* 在处理过程中,如果发生任何错误,它将抛出该错误
* 在处理过程中,如果发生任何错误,它将抛出该错误
* 无论成功或失败,最终都会执行 finally 块中的代码。这里首先释放记录锁,然后调用 polling 方法,可能是为了继续下一次文件上传。
* 无论成功或失败,最终都会执行 finally 块中的代码。这里首先释放记录锁,然后调用 polling 方法,可能是为了继续下一次文件上传。
*
*
* @async
* @async
* @throws {Error} 如果获取记录失败或发生任何其他错误,将抛出错误
* @throws {Error} 如果获取记录失败或发生任何其他错误,将抛出错误
*/
*/
async
compatible
()
{
async
compatible
()
{
const
unlock
=
await
this
.
lock
()
const
unlock
=
await
this
.
lock
()
let
path
=
await
utils
.
getFileSaveFolderOnClient
()
let
path
=
await
utils
.
getFileSaveFolderOnClient
()
try
{
try
{
let
records
=
this
.
getRecords
()
let
records
=
this
.
getRecords
()
if
(
typeof
records
===
'string'
)
{
if
(
typeof
records
===
'string'
)
{
records
=
JSON
.
parse
(
records
)
records
=
JSON
.
parse
(
records
)
}
}
records
.
forEach
(
i
=>
{
records
.
forEach
(
i
=>
{
...
@@ -175,6 +176,7 @@ class RecordManager {
...
@@ -175,6 +176,7 @@ class RecordManager {
unlock
()
unlock
()
}
}
}
}
/**
/**
* 清除所有记录
* 清除所有记录
*
*
...
...
utils/TimeoutManager.js
View file @
9120ea1
...
@@ -11,6 +11,7 @@ class TimeoutManager {
...
@@ -11,6 +11,7 @@ class TimeoutManager {
const
promises
=
[
this
.
delay
(
waitTime
),
timeout
]
const
promises
=
[
this
.
delay
(
waitTime
),
timeout
]
return
Promise
.
race
(
promises
)
return
Promise
.
race
(
promises
)
}
}
cancelAllTasks
()
{
cancelAllTasks
()
{
while
(
this
.
tasks
.
length
)
{
while
(
this
.
tasks
.
length
)
{
const
abort
=
this
.
tasks
.
shift
()
const
abort
=
this
.
tasks
.
shift
()
...
@@ -18,9 +19,11 @@ class TimeoutManager {
...
@@ -18,9 +19,11 @@ class TimeoutManager {
}
}
uni
.
$logger
.
local
.
info
(
'强制取消轮询.'
)
uni
.
$logger
.
local
.
info
(
'强制取消轮询.'
)
}
}
get
isProcessing
()
{
get
isProcessing
()
{
return
this
.
tasks
.
length
>
0
return
this
.
tasks
.
length
>
0
}
}
delay
(
interval
=
60
*
10
)
{
delay
(
interval
=
60
*
10
)
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
this
.
tasks
.
push
(
resolve
)
this
.
tasks
.
push
(
resolve
)
...
...
utils/logger/LocalLog.js
View file @
9120ea1
...
@@ -5,7 +5,6 @@ class LocalLog {
...
@@ -5,7 +5,6 @@ class LocalLog {
logger
=
null
logger
=
null
constructor
()
{
constructor
()
{
this
.
logger
=
new
LogCat
()
this
.
logger
=
new
LogCat
()
// this.logger = { }
}
}
debug
(
msg
)
{
debug
(
msg
)
{
this
.
logger
.
writeLog
(
LogLevel
.
DEBUG
,
msg
)
this
.
logger
.
writeLog
(
LogLevel
.
DEBUG
,
msg
)
...
...
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