Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
account-book
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘文虎
account-book
Commits
0cccaf4f
Commit
0cccaf4f
authored
Aug 26, 2022
by
刘文虎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传/下载
parent
4437fd5d
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1763 additions
and
526 deletions
+1763
-526
androidPrivacy.json
androidPrivacy.json
+1
-1
index.js
api/bill/index.js
+1
-1
index.js
api/maintain/index.js
+1
-1
billing-daily.vue
components/billing-daily/billing-daily.vue
+6
-7
LsjFile.js
components/lsj-upload/LsjFile.js
+392
-0
lsj-upload.vue
components/lsj-upload/lsj-upload.vue
+312
-0
index.vue
components/pop-input-view/index.vue
+6
-1
manifest.json
manifest.json
+12
-12
pages.json
pages.json
+305
-355
login.vue
pages/login/login.vue
+8
-7
cd-key.vue
pages/mine/cd-key/cd-key.vue
+3
-2
file-list.vue
pages/mine/import-export/components/file-list.vue
+142
-0
export.vue
pages/mine/import-export/export/export.vue
+49
-24
download-template.vue
...ine/import-export/import/components/download-template.vue
+53
-23
upload-bill.vue
pages/mine/import-export/import/components/upload-bill.vue
+162
-14
input.vue
pages/mine/input/input.vue
+2
-2
pay.vue
pages/mine/pay/pay.vue
+3
-1
drap-view.vue
pages/mine/payments-setting/components/drap-view.vue
+78
-45
payments-setting.vue
pages/mine/payments-setting/payments-setting.vue
+5
-0
timed.vue
pages/mine/timed/timed.vue
+1
-1
login.js
store/modules/login.js
+1
-4
auth.js
utils/auth.js
+14
-10
download.js
utils/download.js
+206
-15
No files found.
androidPrivacy.json
View file @
0cccaf4f
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
"prompt"
:
"template"
,
"prompt"
:
"template"
,
"version"
:
"1"
,
"version"
:
"1"
,
"title"
:
"服务协议和隐私政策"
,
"title"
:
"服务协议和隐私政策"
,
"message"
:
" 请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href='http
://www.weixiuhui.cn/protocol.html'>《服务协议》</a>和<a href='http://www.weixiuhui.cn
/policy.html'>《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。"
,
"message"
:
" 请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href='http
s://api-book.kaying.cc/protocol.html'>《服务协议》</a>和<a href='https://api-book.kaying.cc
/policy.html'>《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。"
,
"buttonAccept"
:
"同意并接受"
,
"buttonAccept"
:
"同意并接受"
,
"buttonRefuse"
:
"不同意并退出"
,
"buttonRefuse"
:
"不同意并退出"
,
"hrefLoader"
:
"default"
,
"hrefLoader"
:
"default"
,
...
...
api/bill/index.js
View file @
0cccaf4f
...
@@ -31,7 +31,7 @@ export function getStatistics(data) {
...
@@ -31,7 +31,7 @@ export function getStatistics(data) {
export
function
exportBill
(
data
)
{
export
function
exportBill
(
data
)
{
return
request
({
return
request
({
url
:
`/rest/bookRecord/export`
,
url
:
`/rest/bookRecord/export`
,
method
:
'
POS
T'
,
method
:
'
GE
T'
,
responseType
:
'ArrayBuffer'
,
responseType
:
'ArrayBuffer'
,
data
,
data
,
noLoading
:
true
noLoading
:
true
...
...
api/maintain/index.js
View file @
0cccaf4f
...
@@ -44,7 +44,7 @@ export async function repair(data) {
...
@@ -44,7 +44,7 @@ export async function repair(data) {
export
async
function
repairExport
(
data
)
{
export
async
function
repairExport
(
data
)
{
return
request
({
return
request
({
url
:
`/rest/repair/export`
,
url
:
`/rest/repair/export`
,
method
:
'
POS
T'
,
method
:
'
GE
T'
,
data
,
data
,
responseType
:
'ArrayBuffer'
,
responseType
:
'ArrayBuffer'
,
noLoading
:
true
noLoading
:
true
...
...
components/billing-daily/billing-daily.vue
View file @
0cccaf4f
...
@@ -45,7 +45,9 @@
...
@@ -45,7 +45,9 @@
</view>
</view>
</view>
</view>
<!-- 计算器 -->
<!-- 计算器 -->
<view
class=
"billing-calculator"
:style=
"
{'padding-bottom':Height+'px'}">
<ab-calculator
ref=
"ab-calculator"
@
change=
"calculatorChange"
@
sure=
"calculatorSure"
></ab-calculator></view>
<view
class=
"billing-calculator"
:style=
"
{ 'padding-bottom': Height + 'px' }">
<ab-calculator
ref=
"ab-calculator"
@
change=
"calculatorChange"
@
sure=
"calculatorSure"
></ab-calculator>
</view>
<!-- 日历 -->
<!-- 日历 -->
<calendar-popup
:date=
"form.happenTime"
ref=
"calendar-popup"
@
confirm=
"calendarChange"
></calendar-popup>
<calendar-popup
:date=
"form.happenTime"
ref=
"calendar-popup"
@
confirm=
"calendarChange"
></calendar-popup>
<bottom-choose
ref=
"bottom-choose"
@
choose=
"bottomChoose"
></bottom-choose>
<bottom-choose
ref=
"bottom-choose"
@
choose=
"bottomChoose"
></bottom-choose>
...
@@ -136,7 +138,7 @@ export default {
...
@@ -136,7 +138,7 @@ export default {
notification
:
'update-payments-setting'
,
notification
:
'update-payments-setting'
,
sourceType
:
[
'camera'
,
'album'
],
sourceType
:
[
'camera'
,
'album'
],
keyBoardHeight
:
0
,
keyBoardHeight
:
0
,
Height
:
0
,
Height
:
0
};
};
},
},
computed
:
{
computed
:
{
...
@@ -175,7 +177,7 @@ export default {
...
@@ -175,7 +177,7 @@ export default {
try
{
try
{
let
{
data
}
=
await
getBillTypes
({
type
:
this
.
form
.
type
});
let
{
data
}
=
await
getBillTypes
({
type
:
this
.
form
.
type
});
let
list
=
[];
let
list
=
[];
let
resData
=
this
.
deepClone
(
data
)
;
let
resData
=
[...
data
]
;
if
(
!
this
.
form
.
classificationId
)
{
if
(
!
this
.
form
.
classificationId
)
{
this
.
form
.
classificationId
=
(
data
[
0
]
&&
data
[
0
].
id
)
||
''
;
this
.
form
.
classificationId
=
(
data
[
0
]
&&
data
[
0
].
id
)
||
''
;
}
}
...
@@ -264,9 +266,6 @@ export default {
...
@@ -264,9 +266,6 @@ export default {
},
},
chooseLocation
()
{
chooseLocation
()
{
uni
.
chooseLocation
({
uni
.
chooseLocation
({
// #ifdef APP-PLUS
keyword
:
'1'
,
// #endif
success
:
res
=>
{
success
:
res
=>
{
console
.
log
(
'位置名称:'
+
res
.
name
);
console
.
log
(
'位置名称:'
+
res
.
name
);
console
.
log
(
'详细地址:'
+
res
.
address
);
console
.
log
(
'详细地址:'
+
res
.
address
);
...
@@ -379,7 +378,7 @@ export default {
...
@@ -379,7 +378,7 @@ export default {
if
(
item
.
id
===
'setting'
)
{
if
(
item
.
id
===
'setting'
)
{
uni
.
navigateTo
({
uni
.
navigateTo
({
url
:
'/pages/mine/payments-setting/payments-setting'
,
url
:
'/pages/mine/payments-setting/payments-setting'
,
animationType
:
'pop-in'
animationType
:
'pop-in'
});
});
uni
.
$on
(
this
.
notification
,
res
=>
{
uni
.
$on
(
this
.
notification
,
res
=>
{
this
.
getBillTypeOptions
();
this
.
getBillTypeOptions
();
...
...
components/lsj-upload/LsjFile.js
0 → 100644
View file @
0cccaf4f
This diff is collapsed.
Click to expand it.
components/lsj-upload/lsj-upload.vue
0 → 100644
View file @
0cccaf4f
<
template
>
<view
class=
"lsj-file"
:style=
"[getStyles]"
>
<view
ref=
"lsj"
class=
"hFile"
:style=
"[getStyles]"
@
click=
"onClick"
>
<slot><view
class=
"defview"
:style=
"[getStyles]"
>
附件上传
</view></slot>
</view>
</view>
</
template
>
<
script
>
// 查看文档:https://ext.dcloud.net.cn/plugin?id=5459
import
{
LsjFile
}
from
'./LsjFile.js'
export
default
{
name
:
'Lsj-upload'
,
props
:
{
// 打印日志
debug
:
{
type
:
Boolean
,
default
:
false
},
// 自动上传
instantly
:
{
type
:
Boolean
,
default
:
false
},
// 上传接口参数设置
option
:
{
type
:
Object
,
default
:
()
=>
{}},
// 文件大小上限
size
:
{
type
:
Number
,
default
:
10
},
// 文件选择个数上限,超出后不触发点击
count
:
{
type
:
Number
,
default
:
9
},
// 允许上传的文件格式(多个以逗号隔开)
formats
:
{
type
:
String
,
default
:
''
},
// input file选择限制
accept
:
{
type
:
String
,
default
:
''
},
// 微信选择文件类型
//all=从所有文件选择,
//video=只能选择视频文件,
//image=只能选择图片文件,
//file=可以选择除了图片和视频之外的其它的文件
wxFileType
:
{
type
:
String
,
default
:
'all'
},
// webviewID需唯一,不同窗口也不要同Id
childId
:
{
type
:
String
,
default
:
'lsjUpload'
},
// 文件选择触发面宽度
width
:
{
type
:
String
,
default
:
'100%'
},
// 文件选择触发面高度
height
:
{
type
:
String
,
default
:
'80rpx'
},
// top,left,bottom,right仅position=absolute时才需要传入
top
:
{
type
:
[
String
,
Number
],
default
:
''
},
left
:
{
type
:
[
String
,
Number
],
default
:
''
},
bottom
:
{
type
:
[
String
,
Number
],
default
:
''
},
right
:
{
type
:
[
String
,
Number
],
default
:
''
},
// nvue不支持跟随窗口滚动
position
:
{
type
:
String
,
// #ifdef APP-NVUE
default
:
'absolute'
,
// #endif
// #ifndef APP-NVUE
default
:
'static'
,
// #endif
},
},
data
()
{
return
{
}
},
watch
:
{
option
(
v
)
{
// #ifdef APP-PLUS
this
.
lsjFile
&&
this
.
show
();
// #endif
}
},
updated
()
{
// #ifdef APP-PLUS
if
(
this
.
isShow
)
{
this
.
lsjFile
&&
this
.
show
();
}
// #endif
},
computed
:
{
getStyles
()
{
let
styles
=
{
width
:
this
.
width
,
height
:
this
.
height
}
if
(
this
.
position
==
'absolute'
)
{
styles
[
'top'
]
=
this
.
top
styles
[
'bottom'
]
=
this
.
bottom
styles
[
'left'
]
=
this
.
left
styles
[
'right'
]
=
this
.
right
styles
[
'position'
]
=
'fixed'
}
return
styles
}
},
mounted
()
{
this
.
_size
=
0
;
this
.
lsjFile
=
new
LsjFile
({
debug
:
this
.
debug
,
id
:
this
.
childId
,
width
:
this
.
width
,
height
:
this
.
height
,
option
:
this
.
option
,
instantly
:
this
.
instantly
,
// 限制条件
prohibited
:
{
// 大小
size
:
this
.
size
,
// 允许上传的格式
formats
:
this
.
formats
,
// 限制选择的格式
accept
:
this
.
accept
,
count
:
this
.
count
},
onchange
:
this
.
onchange
,
onprogress
:
this
.
onprogress
,
});
this
.
create
();
},
beforeDestroy
()
{
// #ifdef APP-PLUS
this
.
lsjFile
.
dom
.
close
();
// #endif
},
methods
:
{
setFiles
(
array
)
{
if
(
array
instanceof
Map
)
{
for
(
let
[
key
,
item
]
of
array
)
{
item
[
'progress'
]
=
100
;
item
[
'type'
]
=
'success'
;
this
.
lsjFile
.
files
.
set
(
key
,
item
);
}
}
else
if
(
Array
.
isArray
(
array
))
{
array
.
forEach
(
item
=>
{
if
(
item
.
name
)
{
item
[
'progress'
]
=
100
;
item
[
'type'
]
=
'success'
;
this
.
lsjFile
.
files
.
set
(
item
.
name
,
item
);
}
});
}
this
.
onchange
(
this
.
lsjFile
.
files
);
},
setData
()
{
this
.
lsjFile
&&
this
.
lsjFile
.
setData
(...
arguments
);
},
getDomStyles
(
callback
)
{
// #ifndef APP-NVUE
let
view
=
uni
.
createSelectorQuery
()
.
in
(
this
)
.
select
(
'.lsj-file'
)
view
.
fields
(
{
size
:
true
,
rect
:
true
},
({
height
,
width
,
top
,
left
,
right
,
bottom
})
=>
{
uni
.
createSelectorQuery
()
.
selectViewport
()
.
scrollOffset
(({
scrollTop
})
=>
{
return
callback
({
top
:
parseInt
(
top
)
+
parseInt
(
scrollTop
)
+
'px'
,
left
:
parseInt
(
left
)
+
'px'
,
width
:
parseInt
(
width
)
+
'px'
,
height
:
parseInt
(
height
)
+
'px'
})
})
.
exec
()
}
).
exec
()
// #endif
// #ifdef APP-NVUE
const
dom
=
weex
.
requireModule
(
'dom'
)
dom
.
getComponentRect
(
this
.
$refs
.
lsj
,
({
size
:
{
height
,
width
,
top
,
left
,
right
,
bottom
}
})
=>
{
return
callback
({
top
:
parseInt
(
top
)
+
'px'
,
left
:
parseInt
(
left
)
+
'px'
,
width
:
parseInt
(
width
)
+
'px'
,
height
:
parseInt
(
height
)
+
'px'
,
right
:
parseInt
(
right
)
+
'px'
,
bottom
:
parseInt
(
bottom
)
+
'px'
})
})
// #endif
},
show
()
{
this
.
isShow
=
true
;
// #ifdef APP-PLUS
this
.
lsjFile
&&
this
.
getDomStyles
(
styles
=>
{
this
.
lsjFile
.
dom
.
setStyle
(
styles
)
});
// #endif
// #ifdef H5
this
.
lsjFile
.
dom
.
style
.
display
=
'inline'
// #endif
},
hide
()
{
this
.
isShow
=
false
;
// #ifdef APP-PLUS
this
.
lsjFile
&&
this
.
lsjFile
.
dom
.
setStyle
({
top
:
'-500px'
,
left
:
'0px'
,
width
:
'1px'
,
height
:
'1px'
,
});
// #endif
// #ifdef H5
this
.
lsjFile
.
dom
.
style
.
display
=
'none'
// #endif
},
/**
* 手动提交上传
* @param {string}name 文件名称,不传则上传所有type等于waiting和fail的文件
*/
upload
(
name
)
{
this
.
lsjFile
&&
this
.
lsjFile
.
upload
(
name
);
},
/**
* @returns {Map} 已选择的文件Map集
*/
onchange
(
files
)
{
this
.
$emit
(
'change'
,
files
);
this
.
_size
=
files
.
size
;
return
files
.
size
>=
this
.
count
?
this
.
hide
()
:
this
.
show
();
},
/**
* @returns {object} 当前上传中的对象
*/
onprogress
(
item
,
end
=
false
)
{
this
.
$emit
(
'progress'
,
item
);
if
(
end
)
{
setTimeout
(()
=>
{
this
.
$emit
(
'uploadEnd'
,
item
);
},
0
);
}
},
/**
* 移除组件内缓存的某条数据
* @param {string}name 文件名称,不指定默认清除所有文件
*/
clear
(
name
)
{
this
.
lsjFile
.
clear
(
name
);
},
// 创建选择器
create
()
{
// 若iOS端服务端处理不了跨域就将hybrid目录内的html放到服务端去,并将此处path改成服务器上的地址
// let path = '/uni_modules/lsj-upload/hybrid/html/uploadFile.html';
// let path = '/components/lsj-upload/hybrid/html/uploadFile.html';
let
path
=
'https://api-book-test.banshouhui.com/hybrid/uploadFile.html'
;
let
dom
=
this
.
lsjFile
.
create
(
path
);
// #ifdef H5
this
.
$refs
.
lsj
.
$el
.
appendChild
(
dom
);
// #endif
// #ifndef APP-PLUS
this
.
show
();
// #endif
// #ifdef APP-PLUS
dom
.
setStyle
({
position
:
this
.
position
});
dom
.
loadURL
(
path
);
setTimeout
(()
=>
{
// #ifdef APP-NVUE
plus
.
webview
.
currentWebview
().
append
(
dom
);
// #endif
// #ifndef APP-NVUE
this
.
$root
.
$scope
.
$getAppWebview
().
append
(
dom
);
// #endif
this
.
show
();
},
300
)
// #endif
},
// 点击选择附件
onClick
()
{
if
(
this
.
_size
>=
this
.
count
)
{
this
.
toast
(
`只允许上传
${
this
.
count
}
个文件`
);
return
;
}
// #ifdef MP-WEIXIN
if
(
!
this
.
isShow
)
{
return
;}
let
count
=
this
.
count
-
this
.
_size
;
this
.
lsjFile
.
chooseMessageFile
(
this
.
wxFileType
,
count
);
// #endif
},
toast
(
msg
)
{
uni
.
showToast
({
title
:
msg
,
icon
:
'none'
});
}
}
}
</
script
>
<
style
scoped
>
.lsj-file
{
display
:
inline-block
;
}
.defview
{
background-color
:
#007aff
;
color
:
#fff
;
border-radius
:
10
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
font-size
:
28
rpx
;
}
.hFile
{
position
:
relative
;
overflow
:
hidden
;
}
</
style
>
components/pop-input-view/index.vue
View file @
0cccaf4f
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
class=
"cancel"
class=
"cancel"
hover-class=
"u-hover-class"
hover-class=
"u-hover-class"
@
click=
"$u.throttle(handleClickCancel, 500)"
@
click=
"$u.throttle(handleClickCancel, 500)"
v-if=
"showCancel"
>
{{
cancelText
}}
</view
>
{{
cancelText
}}
</view
>
>
<view
<view
...
@@ -75,6 +76,10 @@ export default {
...
@@ -75,6 +76,10 @@ export default {
type
:
String
,
type
:
String
,
default
:
'#333333'
,
default
:
'#333333'
,
},
},
showCancel
:{
type
:
Boolean
,
default
:
true
,
},
cancelText
:
{
cancelText
:
{
type
:
String
,
type
:
String
,
default
:
'取消'
,
default
:
'取消'
,
...
@@ -268,7 +273,7 @@ export default {
...
@@ -268,7 +273,7 @@ export default {
margin-top
:
68rpx
;
margin-top
:
68rpx
;
display
:
flex
;
display
:
flex
;
font-size
:
32rpx
;
font-size
:
32rpx
;
justify-content
:
center
;
.cancel
{
.cancel
{
height
:
96rpx
;
height
:
96rpx
;
flex
:
1
;
flex
:
1
;
...
...
manifest.json
View file @
0cccaf4f
{
{
"name"
:
"
account-book
"
,
"name"
:
"
扳手记账
"
,
"appid"
:
"__UNI__C731E8B"
,
"appid"
:
"__UNI__C731E8B"
,
"description"
:
""
,
"description"
:
""
,
"versionName"
:
"1.0.1"
,
"versionName"
:
"1.0.1"
,
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
"request"
:
"none"
,
"request"
:
"none"
,
"prompt"
:
"为获取当地天气信息,需要获取 位置信息 使用权限,请允许。"
"prompt"
:
"为获取当地天气信息,需要获取 位置信息 使用权限,请允许。"
},
},
"schemes"
:
"com.shenjiying.
kuaicha
"
"schemes"
:
"com.shenjiying.
jizhang
"
},
},
/*
ios打包配置
*/
/*
ios打包配置
*/
"ios"
:
{
"ios"
:
{
...
@@ -79,34 +79,34 @@
...
@@ -79,34 +79,34 @@
"ad"
:
{},
"ad"
:
{},
"oauth"
:
{
"oauth"
:
{
"weixin"
:
{
"weixin"
:
{
"appid"
:
"wx
e12043817d088b68
"
,
"appid"
:
"wx
f0a780908851623f
"
,
"UniversalLinks"
:
""
"UniversalLinks"
:
""
}
}
},
},
"payment"
:
{
"payment"
:
{
"weixin"
:
{
"weixin"
:
{
"__platform__"
:
[
"ios"
,
"android"
],
"__platform__"
:
[
"ios"
,
"android"
],
"appid"
:
"wx
e12043817d088b68
"
,
"appid"
:
"wx
f0a780908851623f
"
,
"UniversalLinks"
:
""
"UniversalLinks"
:
""
}
}
},
},
"share"
:
{
"share"
:
{
"weixin"
:
{
"weixin"
:
{
"appid"
:
"wx
e12043817d088b68
"
,
"appid"
:
"wx
f0a780908851623f
"
,
"UniversalLinks"
:
""
"UniversalLinks"
:
""
}
}
},
},
"maps"
:
{
"maps"
:
{
"
baidu
"
:
{
"
amap
"
:
{
"appkey_ios"
:
"
dFMUnxGBq8mB8CSotGMELp4EGUq9qlwo
"
,
"appkey_ios"
:
"
a808d665af78906c3e2f0b1b28ea17ed
"
,
"appkey_android"
:
"
32HwrFwjGUFno8GddnqSZtP72sDFucG1
"
"appkey_android"
:
"
6f92327cbdcd93ca769a62676ba69e78
"
}
}
},
},
"geolocation"
:
{
"geolocation"
:
{
"
baidu
"
:
{
"
amap
"
:
{
"__platform__"
:
[
"android"
],
"__platform__"
:
[
"
ios"
,
"
android"
],
"appkey_ios"
:
"
dFMUnxGBq8mB8CSotGMELp4EGUq9qlwo
"
,
"appkey_ios"
:
"
a808d665af78906c3e2f0b1b28ea17ed
"
,
"appkey_android"
:
"
32HwrFwjGUFno8GddnqSZtP72sDFucG1
"
"appkey_android"
:
"
6f92327cbdcd93ca769a62676ba69e78
"
}
}
}
}
},
},
...
...
pages.json
View file @
0cccaf4f
This diff is collapsed.
Click to expand it.
pages/login/login.vue
View file @
0cccaf4f
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
<
script
>
<
script
>
import
{
baseUrl
}
from
'@/utils/config.js'
;
import
{
baseUrl
}
from
'@/utils/config.js'
;
import
{
wxLogin
}
from
'@/utils/auth.js'
;
import
{
mapGetters
}
from
'vuex'
;
import
{
mapGetters
}
from
'vuex'
;
export
default
{
export
default
{
components
:
{},
components
:
{},
...
@@ -114,7 +115,8 @@ export default {
...
@@ -114,7 +115,8 @@ export default {
});
});
try
{
try
{
await
this
.
$store
.
dispatch
(
'App_get_provider'
);
await
this
.
$store
.
dispatch
(
'App_get_provider'
);
let
res
=
await
this
.
$store
.
dispatch
(
'Auto_login'
,
{});
let
code
=
await
wxLogin
()
let
res
=
await
this
.
$store
.
dispatch
(
'Auto_login'
,
{
code
});
this
.
showToast
(
'登录成功'
,
true
);
this
.
showToast
(
'登录成功'
,
true
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
if
(
this
.
returnUrl
)
{
if
(
this
.
returnUrl
)
{
...
@@ -131,9 +133,10 @@ export default {
...
@@ -131,9 +133,10 @@ export default {
}
}
},
1000
);
},
1000
);
}
catch
(
e
)
{
}
catch
(
e
)
{
let
{
code
}
=
e
;
console
.
log
(
"appWxLogin:error"
,
e
)
let
{
code
,
data
}
=
e
;
if
(
code
===
40011
)
{
if
(
code
===
40011
)
{
this
.
toPhoneLogin
(
e
);
this
.
toPhoneLogin
(
data
);
}
}
//TODO handle the exception
//TODO handle the exception
}
}
...
@@ -144,11 +147,9 @@ export default {
...
@@ -144,11 +147,9 @@ export default {
return
;
return
;
}
}
console
.
log
(
'toPhoneLogin'
,
res
);
console
.
log
(
'toPhoneLogin'
,
res
);
if
(
res
.
data
){
let
{
openId
,
unionId
,
loginChannel
,
authType
}
=
res
.
data
;
}
let
params
=
{};
let
params
=
{};
if
(
res
.
data
&&
unionId
)
{
if
(
res
&&
res
.
unionId
)
{
let
{
openId
,
unionId
,
loginChannel
,
authType
}
=
res
;
params
=
{
params
=
{
openId
,
openId
,
unionId
,
unionId
,
...
...
pages/mine/cd-key/cd-key.vue
View file @
0cccaf4f
...
@@ -525,7 +525,8 @@ export default {
...
@@ -525,7 +525,8 @@ export default {
border
:
2rpx
solid
$default-color
;
border
:
2rpx
solid
$default-color
;
text-align
:
center
;
text-align
:
center
;
border-radius
:
8rpx
;
border-radius
:
8rpx
;
padding
:
4rpx
0
;
// padding: 4rpx 0;
line-height
:
40rpx
;
}
}
.list-view
{
.list-view
{
...
@@ -556,7 +557,7 @@ export default {
...
@@ -556,7 +557,7 @@ export default {
border
:
2rpx
solid
$default-color
;
border
:
2rpx
solid
$default-color
;
text-align
:
center
;
text-align
:
center
;
border-radius
:
8rpx
;
border-radius
:
8rpx
;
padding
:
6rpx
0
;
line-height
:
48rpx
;
background-color
:
$default-color
;
background-color
:
$default-color
;
}
}
</
style
>
</
style
>
pages/mine/import-export/components/file-list.vue
0 → 100644
View file @
0cccaf4f
<
template
>
<view
class=
"file-list"
>
<view
class=
"file"
v-for=
"(item, index) in list"
:key=
"item.createTime"
@
click=
"previewFile(item)"
>
<view
class=
"file-info"
>
<view
class=
"file-name"
>
{{
fileName
}}
</view>
<view
class=
"file-time"
>
{{
item
.
time
}}
</view>
</view>
<view
class=
"file-delete"
@
click
.
stop=
"beforeDelete(item)"
><u-icon
name=
"trash"
></u-icon></view>
</view>
<PopInput
title=
"删除提醒"
type=
"text"
sureText=
"确定"
content=
"确认删除文件吗?"
:visible
.
sync=
"showConfirm"
@
click=
"handleConfirm"
@
cancel=
"handleCancel"
/>
</view>
</
template
>
<
script
>
import
PopInput
from
'@/components/pop-input-view'
;
import
{
mapGetters
}
from
'vuex'
;
export
default
{
props
:
[
'fileName'
],
components
:
{
PopInput
},
data
()
{
return
{
list
:
[],
showConfirm
:
false
,
deleteFile
:
null
};
},
computed
:
{
...
mapGetters
([
'isIOS'
])
},
mounted
()
{
this
.
getList
();
},
methods
:
{
getList
()
{
uni
.
getSavedFileList
({
success
:
res
=>
{
console
.
log
(
'getSavedFileList'
,
res
.
fileList
);
res
.
fileList
.
map
(
item
=>
{
item
.
time
=
this
.
parseTime
(
item
.
createTime
);
});
this
.
list
=
res
.
fileList
;
},
fail
(
err
)
{
console
.
log
(
err
);
}
});
},
previewFile
(
item
)
{
uni
.
openDocument
({
//打开文件
filePath
:
item
.
filePath
,
//文件名
showMenu
:
true
,
//右上角是否显示(...)
success
(
res
)
{
console
.
log
(
res
);
},
fail
(
err
)
{
console
.
log
(
'openDocument:fail'
,
err
);
if
(
this
.
isIOS
)
{
this
.
showToast
(
'打开文件失败'
);
}
else
{
uni
.
showModal
({
title
:
'打开文件失败'
,
content
:
'请先安装Office应用'
,
confirmColor
:
'#0bc183'
,
confirmText
:
'确定'
,
showCancel
:
false
,
success
:
res
=>
{}
});
}
}
});
},
beforeDelete
(
item
){
this
.
deleteFile
=
item
this
.
showConfirm
=
true
},
handleConfirm
(){
this
.
removeFile
(
this
.
deleteFile
)
},
handleCancel
(){
this
.
deleteFile
=
null
},
removeFile
(
item
)
{
uni
.
removeSavedFile
({
filePath
:
item
.
filePath
,
success
(
res
)
{
console
.
log
(
res
);
},
fail
()
{
this
.
showToast
(
'删除失败'
);
},
complete
:
()
=>
{
this
.
getList
();
}
});
},
}
};
</
script
>
<
style
lang=
"scss"
scoped
>
.file-list
{
margin-top
:
32rpx
;
.file
{
margin-bottom
:
24rpx
;
background-color
:
#fff
;
border-radius
:
16rpx
;
display
:
flex
;
align-items
:
center
;
height
:
88rpx
;
width
:
100%
;
font-size
:
24rpx
;
padding
:
0
24rpx
;
&
-info
{
flex
:
1
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
}
&
-name
{
}
&
-time
{
margin-top
:
10rpx
;
color
:
#8d8d8d
;
}
&
-delete
{
margin-left
:
40rpx
;
width
:
88rpx
;
height
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
font-size
:
36rpx
;
color
:
#fc524d
;
}
}
}
</
style
>
pages/mine/import-export/export/export.vue
View file @
0cccaf4f
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
</view>
</view>
</view>
</view>
</view>
</view>
<view
:class=
"['date-view',
{ show: currentIndex == 1 }]">
<view
:class=
"['date-view',
{ show: currentIndex == 1 }]">
<view
class=
"label-view"
>
选择时间
</view>
<view
class=
"label-view"
>
选择时间
</view>
<view
class=
"value-view"
>
<view
class=
"value-view"
>
...
@@ -37,17 +37,21 @@
...
@@ -37,17 +37,21 @@
</view>
</view>
</view>
</view>
</view>
</view>
<file-list
ref=
"file-list"
fileName=
"账单"
></file-list>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
DateRangePicker
from
'@/components/date-range-picker/uni-datetime-picker.vue'
;
import
DateRangePicker
from
'@/components/date-range-picker/uni-datetime-picker.vue'
;
import
FileList
from
"../components/file-list.vue"
import
{
exportBill
}
from
'@/api/bill/index.js'
;
import
{
exportBill
}
from
'@/api/bill/index.js'
;
import
{
repairExport
}
from
'@/api/maintain/index.js'
;
import
{
repairExport
}
from
'@/api/maintain/index.js'
;
import
{
downLoad
}
from
'@/utils/download.js'
;
import
{
downLoad
,
downLoadFile
,
saveFile
}
from
'@/utils/download.js'
;
import
{
mapGetters
}
from
'vuex'
;
export
default
{
export
default
{
components
:
{
components
:
{
DateRangePicker
DateRangePicker
,
FileList
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -60,6 +64,7 @@ export default {
...
@@ -60,6 +64,7 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapGetters
([
'platform'
]),
tabs
()
{
tabs
()
{
return
[
'全部'
,
'自定义'
];
return
[
'全部'
,
'自定义'
];
},
},
...
@@ -86,6 +91,7 @@ export default {
...
@@ -86,6 +91,7 @@ export default {
},
},
onReady
()
{
onReady
()
{
this
.
initDate
();
this
.
initDate
();
},
},
methods
:
{
methods
:
{
initDate
()
{
initDate
()
{
...
@@ -96,8 +102,8 @@ export default {
...
@@ -96,8 +102,8 @@ export default {
},
},
beforeDownload
(
range
)
{
beforeDownload
(
range
)
{
console
.
log
(
range
);
console
.
log
(
range
);
let
startTime
=
""
;
let
startTime
=
''
;
let
endTime
=
""
;
let
endTime
=
''
;
if
(
range
)
{
if
(
range
)
{
startTime
=
range
[
0
]
+
' 00:00:00'
;
startTime
=
range
[
0
]
+
' 00:00:00'
;
endTime
=
range
[
1
]
+
' 23:59:59'
;
endTime
=
range
[
1
]
+
' 23:59:59'
;
...
@@ -111,7 +117,7 @@ export default {
...
@@ -111,7 +117,7 @@ export default {
mask
:
true
,
mask
:
true
,
title
:
'下载中'
title
:
'下载中'
});
});
try
{
try
{
let
{
startTime
,
endTime
}
=
date
;
let
{
startTime
,
endTime
}
=
date
;
let
params
=
{
let
params
=
{
...
@@ -119,15 +125,30 @@ export default {
...
@@ -119,15 +125,30 @@ export default {
end
:
endTime
end
:
endTime
};
};
console
.
log
(
params
);
console
.
log
(
params
);
if
(
this
.
type
===
'maintain'
)
{
let
res
=
null
;
// 维修账单
const
globalUrl
=
process
.
uniEnv
||
{};
let
res
=
await
repairExport
(
params
);
let
apiUrl
=
globalUrl
.
apiUrl
;
this
.
saveFile
(
res
);
let
url
=
''
;
}
else
{
if
(
this
.
platform
===
'4'
)
{
// 日常账单
if
(
this
.
type
===
'maintain'
)
{
let
res
=
await
exportBill
(
params
);
// 维修账单
this
.
saveFile
(
res
);
url
=
apiUrl
+
'/rest/repair/export'
;
}
else
{
// 日常账单
url
=
apiUrl
+
'/rest/bookRecord/export'
;
}
res
=
await
downLoadFile
(
url
);
console
.
log
(
res
);
}
else
{
if
(
this
.
type
===
'maintain'
)
{
// 维修账单
res
=
await
repairExport
(
params
);
}
else
{
// 日常账单
res
=
await
exportBill
(
params
);
}
}
}
this
.
saveFile
(
res
);
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
showToast
(
'下载错误'
);
this
.
showToast
(
'下载错误'
);
this
.
stopLoading
();
this
.
stopLoading
();
...
@@ -139,7 +160,13 @@ export default {
...
@@ -139,7 +160,13 @@ export default {
async
saveFile
(
file
)
{
async
saveFile
(
file
)
{
console
.
log
(
'saveFile'
);
console
.
log
(
'saveFile'
);
try
{
try
{
let
res
=
await
downLoad
(
file
);
let
res
=
null
;
if
(
this
.
platform
===
'4'
)
{
await
saveFile
(
file
.
tempFilePath
)
this
.
refreshList
()
}
else
{
await
downLoad
(
file
);
}
this
.
stopLoading
();
this
.
stopLoading
();
}
catch
(
e
)
{
}
catch
(
e
)
{
uni
.
hideLoading
();
uni
.
hideLoading
();
...
@@ -148,10 +175,9 @@ export default {
...
@@ -148,10 +175,9 @@ export default {
//TODO handle the exception
//TODO handle the exception
}
}
},
},
refreshList
(){
this
.
$refs
[
'file-list'
].
getList
()
},
handleChange
(
index
)
{
handleChange
(
index
)
{
this
.
currentIndex
=
index
;
this
.
currentIndex
=
index
;
},
},
...
@@ -165,7 +191,7 @@ export default {
...
@@ -165,7 +191,7 @@ export default {
// this.changeVisibleValue(false)
// this.changeVisibleValue(false)
this
.
loading
=
true
;
this
.
loading
=
true
;
// this.$emit('confirm', this.currentIndex == 0 ? null : this.daterange);
// this.$emit('confirm', this.currentIndex == 0 ? null : this.daterange);
this
.
beforeDownload
(
this
.
currentIndex
==
0
?
null
:
this
.
daterange
)
this
.
beforeDownload
(
this
.
currentIndex
==
0
?
null
:
this
.
daterange
)
;
},
},
handleClose
()
{
handleClose
()
{
this
.
changeVisibleValue
(
false
);
this
.
changeVisibleValue
(
false
);
...
@@ -199,7 +225,7 @@ export default {
...
@@ -199,7 +225,7 @@ export default {
font-size
:
28rpx
;
font-size
:
28rpx
;
border-radius
:
16rpx
;
border-radius
:
16rpx
;
margin-bottom
:
104rpx
;
margin-bottom
:
104rpx
;
.content-view-time
{
.content-view-time
{
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
align-items
:
center
;
align-items
:
center
;
...
@@ -221,7 +247,7 @@ export default {
...
@@ -221,7 +247,7 @@ export default {
background-color
:
#f6f7fa
;
background-color
:
#f6f7fa
;
border-radius
:
16rpx
;
border-radius
:
16rpx
;
margin-right
:
24rpx
;
margin-right
:
24rpx
;
&
:last-child
{
&
:last-child
{
margin-right
:
0
;
margin-right
:
0
;
}
}
&
.select
{
&
.select
{
...
@@ -238,7 +264,7 @@ export default {
...
@@ -238,7 +264,7 @@ export default {
overflow
:
hidden
;
overflow
:
hidden
;
height
:
0
;
height
:
0
;
&
.show
{
&
.show
{
border-top
:
1px
solid
#
F6F7FA
;
border-top
:
1px
solid
#
f6f7fa
;
// height: 54rpx;
// height: 54rpx;
height
:
110rpx
;
height
:
110rpx
;
padding
:
28rpx
0
;
padding
:
28rpx
0
;
...
@@ -261,7 +287,6 @@ export default {
...
@@ -261,7 +287,6 @@ export default {
color
:
$default-color
;
color
:
$default-color
;
}
}
}
}
}
}
}
}
}
}
...
...
pages/mine/import-export/import/components/download-template.vue
View file @
0cccaf4f
<
template
>
<
template
>
<view
class=
"download"
>
<view
class=
"download"
>
<view
class=
"download-icon"
@
click=
"downloadFile"
><image
:src=
"downloadImg"
/></view>
<view
class=
"download-icon"
@
click=
"downloadFile"
><image
:src=
"downloadImg"
/></view>
<view
class=
"download-content"
>
<view
class=
"download-content"
v-if=
"platform==='4'"
>
<view
class=
"download-content-item"
>
1. 点击图标,下载模板文件;
</view>
<view
class=
"download-content-item"
v-if=
"isIOS"
>
2. 文件右上角,选择存储到"文件";
</view>
<view
class=
"download-content-item"
v-else
>
2. 打开文件进行编辑;
</view>
<view
class=
"undeline"
@
click=
"copy"
>
点击这里,复制到浏览器打开
</view>
</view>
<view
class=
"download-content"
v-else
>
<view
class=
"download-content-item"
>
1. 点击图标,打开模板文件;
</view>
<view
class=
"download-content-item"
>
1. 点击图标,打开模板文件;
</view>
<view
class=
"download-content-item"
>
2. 文件
左
上角"...",选择转发自己或朋友;
</view>
<view
class=
"download-content-item"
>
2. 文件
右
上角"...",选择转发自己或朋友;
</view>
<view
class=
""
>
3. 登录电脑版微信,再次转发可获得模板。
</view>
<view
class=
""
>
3. 登录电脑版微信,再次转发可获得模板。
</view>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
mineBaseUrl
}
from
'@/utils/config.js'
;
import
{
mineBaseUrl
}
from
'@/utils/config.js'
;
import
{
downLoadFile
}
from
'@/utils/download.js'
;
import
{
downLoadFile
,
saveFile
,
appDowloadFile
}
from
'@/utils/download.js'
;
import
{
mapGetters
}
from
'vuex'
;
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
downloadImg
:
mineBaseUrl
+
'XISX1@3x.png'
,
downloadImg
:
mineBaseUrl
+
'XISX1@3x.png'
,
filePath
:
"https://api-book-test.banshouhui.com/%E8%B4%A6%E5%8D%95%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx"
filePath
:
'https://api-book-test.banshouhui.com/%E8%B4%A6%E5%8D%95%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx'
};
};
},
},
methods
:{
computed
:
{
async
downloadFile
(){
...
mapGetters
([
'platform'
,
'isIOS'
])
try
{
},
let
res
=
await
downLoadFile
(
this
.
filePath
)
methods
:
{
let
{
tempFilePath
}
=
res
async
downloadFile
()
{
this
.
openFile
(
tempFilePath
)
try
{
console
.
log
(
res
)
let
res
=
null
;
}
catch
(
e
){
if
(
this
.
platform
===
'4'
)
{
appDowloadFile
({
url
:
this
.
filePath
,
filename
:
'zhangdan'
});
}
else
{
res
=
await
downLoadFile
(
this
.
filePath
);
let
{
tempFilePath
}
=
res
;
this
.
openFile
(
tempFilePath
);
}
}
catch
(
e
)
{
console
.
log
(
e
);
//TODO handle the exception
//TODO handle the exception
}
}
},
},
openFile
(
filePath
){
openFile
(
filePath
)
{
uni
.
showModal
({
uni
.
showModal
({
title
:
"下载成功"
,
title
:
'下载成功'
,
content
:
"是否打开?"
,
content
:
'是否打开?'
,
confirmColor
:
"#0bc183"
,
confirmColor
:
'#0bc183'
,
confirmText
:
"打开"
,
confirmText
:
'打开'
,
success
(
res
)
{
success
(
res
)
{
if
(
res
.
confirm
)
{
if
(
res
.
confirm
)
{
uni
.
openDocument
({
//打开文件
uni
.
openDocument
({
//打开文件
filePath
,
//文件名
filePath
,
//文件名
showMenu
:
true
,
//右上角是否显示(...)
showMenu
:
true
,
//右上角是否显示(...)
success
(
res
)
{
success
(
res
)
{
console
.
log
(
res
);
console
.
log
(
res
);
}
,
}
});
});
}
else
if
(
res
.
cancel
)
{
}
else
if
(
res
.
cancel
)
{}
}
},
}
});
},
copy
(){
uni
.
setClipboardData
({
data
:
this
.
filePath
,
success
:
()
=>
{
this
.
showToast
(
"已复制到剪贴板"
)
}
});
});
}
}
}
}
...
@@ -72,6 +99,9 @@ export default {
...
@@ -72,6 +99,9 @@ export default {
&
-item
{
&
-item
{
margin-bottom
:
24rpx
;
margin-bottom
:
24rpx
;
}
}
.undeline
{
text-decoration
:
underline
;
}
}
}
}
}
</
style
>
</
style
>
pages/mine/import-export/import/components/upload-bill.vue
View file @
0cccaf4f
<
template
>
<
template
>
<view
class=
"download"
@
click=
"selectFile"
>
<view
class=
"download"
>
<view
class=
"download-icon"
><image
:src=
"downloadImg"
/></view>
<view
class=
"download-icon"
>
<view
class=
"download-icon-wx"
v-if=
"platform === '4'||true"
>
<lsj-upload
ref=
"lsjUpload"
childId=
"upload1"
:width=
"width"
:height=
"height"
:option=
"option"
:size=
"size"
:formats=
"formats"
:debug=
"debug"
:instantly=
"instantly"
@
change=
"onChange"
@
progress=
"onprogress"
@
uploadEnd=
"onuploadEnd"
>
<view
class=
"download-icon-wx"
><image
:src=
"downloadImg"
/></view>
</lsj-upload>
</view>
<view
class=
"download-icon-wx"
@
click=
"selectFile"
v-else
><image
:src=
"downloadImg"
/></view>
</view>
<view
class=
"download-content"
>
<view
class=
"download-content"
>
<view
class=
"download-content-item"
>
1. 通过电脑版微信,回传账单模板;
</view>
<view
class=
"download-content-item"
>
1. 通过电脑版微信,回传账单模板;
</view>
<view
class=
"download-content-item"
>
2. 点击左侧图标,找到回传对象微信或群;
</view>
<view
class=
"download-content-item"
>
2. 点击左侧图标,找到回传对象微信或群;
</view>
<view
class=
""
>
3. 找到文件,选择保存,完成上传操作。
</view>
<view
class=
""
>
3. 找到文件,选择保存,完成上传操作。
</view>
</view>
</view>
<PopInput
title=
"提醒"
type=
"text"
sureText=
"确定"
:showCancel=
"true"
:content=
"uploadConent"
:visible
.
sync=
"showConfirm"
@
click=
"handleConfirm"
/>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
PopInput
from
'@/components/pop-input-view'
;
import
LsjUpload
from
'@/components/lsj-upload/lsj-upload.vue'
;
import
{
mineBaseUrl
}
from
'@/utils/config.js'
;
import
{
mineBaseUrl
}
from
'@/utils/config.js'
;
import
{
getToken
}
from
'@/utils/common.js'
;
import
{
getToken
}
from
'@/utils/common.js'
;
import
{
mapGetters
}
from
'vuex'
;
const
globalUrl
=
process
.
uniEnv
||
{};
let
apiUrl
=
globalUrl
.
apiUrl
;
export
default
{
export
default
{
components
:
{
LsjUpload
,
PopInput
},
data
()
{
data
()
{
return
{
return
{
downloadImg
:
mineBaseUrl
+
'kaishishangchuan@3x.png'
,
downloadImg
:
mineBaseUrl
+
'kaishishangchuan@3x.png'
,
currentCount
:
1
,
currentCount
:
1
,
filePath
:
null
filePath
:
null
,
uploadConent
:
""
,
successConent
:
"上传成功"
,
failConent
:
"上传失败,请检查表格格式"
,
showConfirm
:
false
,
// 上传接口参数
option
:
{
// 上传服务器地址,此地址需要替换为你的接口地址
url
:
apiUrl
+
'/rest/bookRecord/import'
,
// 上传附件的key
name
:
'file'
,
// 根据你接口需求自定义请求头
header
:
{
'token'
:
'Bearer '
+
getToken
()
},
// 根据你接口需求自定义body参数
formData
:
{
// 'orderId': 1000
}
},
// 选择文件后是否立即自动上传,true=选择后立即上传
instantly
:
true
,
// 必传宽高且宽高应与slot宽高保持一致
width
:
'136rpx'
,
height
:
'136rpx'
,
// 限制允许上传的格式,空串=不限制,默认为空
formats
:
'xls,xlsx'
,
// 文件上传大小限制
size
:
20
,
// 文件回显列表
files
:
new
Map
(),
// 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道
wxFiles
:
[],
// 是否打印日志
debug
:
true
,
list
:[],
};
};
},
},
computed
:
{
...
mapGetters
([
'platform'
])
},
methods
:
{
methods
:
{
selectFile
()
{
selectFile
()
{
wx
.
chooseMessageFile
({
wx
.
chooseMessageFile
({
...
@@ -43,9 +111,9 @@ export default {
...
@@ -43,9 +111,9 @@ export default {
let
apiUrl
=
globalUrl
.
apiUrl
;
let
apiUrl
=
globalUrl
.
apiUrl
;
let
token
=
getToken
();
let
token
=
getToken
();
uni
.
showLoading
({
uni
.
showLoading
({
mask
:
true
,
mask
:
true
,
title
:
"正在上传..."
title
:
'正在上传...'
})
})
;
uni
.
uploadFile
({
uni
.
uploadFile
({
url
:
apiUrl
+
'/rest/bookRecord/import'
,
url
:
apiUrl
+
'/rest/bookRecord/import'
,
filePath
:
this
.
filePath
,
filePath
:
this
.
filePath
,
...
@@ -57,17 +125,89 @@ export default {
...
@@ -57,17 +125,89 @@ export default {
complete
:
res
=>
{
complete
:
res
=>
{
console
.
log
(
res
);
console
.
log
(
res
);
// let { data, statusCode } = res;
// let { data, statusCode } = res;
let
data
=
JSON
.
parse
(
res
.
data
)
let
data
=
JSON
.
parse
(
res
.
data
);
let
{
code
,
msg
}
=
data
let
{
code
,
msg
}
=
data
;
uni
.
hideLoading
()
uni
.
hideLoading
();
if
(
code
===
0
){
if
(
code
===
0
)
{
this
.
showToast
(
"上传成功"
,
true
)
// this.showToast('上传成功', true);
}
else
{
this
.
uploadConent
=
this
.
successConent
this
.
showToast
(
msg
,
true
)
this
.
showConfirm
=
true
}
else
{
// this.showToast(msg, true);
this
.
uploadConent
=
this
.
failConent
this
.
showConfirm
=
true
}
}
}
}
});
});
}
},
// 某文件上传结束回调(成功失败都回调)
onuploadEnd
(
item
)
{
console
.
log
(
`
${
item
.
name
}
已上传结束,上传状态=
${
item
.
type
}
`
);
if
(
item
.
type
===
'success'
)
{
this
.
uploadConent
=
this
.
successConent
this
.
showConfirm
=
true
}
else
{
this
.
uploadConent
=
this
.
failConent
this
.
showConfirm
=
true
}
// // 更新当前状态变化的文件
// this.files.set(item.name,item);
// // 演示上传完成后取服务端数据
// if (item['responseText']) {
// console.log('演示服务器返回的字符串JSON转对象');
// this.files.get(item.name).responseText = JSON.parse(item.responseText);
// }
// // 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道
// // #ifdef MP-WEIXIN
// this.wxFiles = [...this.files.values()];
// // #endif
// // 强制更新视图
// this.$forceUpdate();
// // ---可删除--演示判断是否所有文件均已上传成功
// let isAll = [...this.files.values()].find(item=>item.type!=='success');
// if (!isAll) {
// console.log('已全部上传完毕');
// }
// else {
// console.log(isAll.name+'待上传');
// }
},
handleConfirm
(){
this
.
showConfirm
=
false
},
// 上传进度回调
onprogress
(
item
)
{
// 更新当前状态变化的文件
this
.
files
.
set
(
item
.
name
,
item
);
console
.
log
(
'打印对象'
,
JSON
.
stringify
(
this
.
files
.
get
(
item
.
name
)));
// 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道
// #ifdef MP-WEIXIN
this
.
wxFiles
=
[...
this
.
files
.
values
()];
// #endif
// 强制更新视图
this
.
$forceUpdate
();
},
// 文件选择回调
onChange
(
files
)
{
// 更新选择的文件
this
.
files
=
files
;
// 强制更新视图
this
.
$forceUpdate
();
// 微信小程序Map对象for循环不显示,所以转成普通数组,不要问为什么,我也不知道
// #ifdef MP-WEIXIN
this
.
wxFiles
=
[...
this
.
files
.
values
()];
// #endif
},
}
}
};
};
</
script
>
</
script
>
...
@@ -81,6 +221,14 @@ export default {
...
@@ -81,6 +221,14 @@ export default {
width
:
136rpx
;
width
:
136rpx
;
height
:
136rpx
;
height
:
136rpx
;
margin-right
:
40rpx
;
margin-right
:
40rpx
;
&
-wx
{
width
:
100%
;
height
:
100%
;
}
.download-icon-wx
{
width
:
100%
;
height
:
100%
;
}
}
}
&
-content
{
&
-content
{
...
...
pages/mine/input/input.vue
View file @
0cccaf4f
...
@@ -70,7 +70,7 @@ export default {
...
@@ -70,7 +70,7 @@ export default {
return
{
return
{
title
:
'店铺名称'
,
title
:
'店铺名称'
,
type
:
'textarea'
,
type
:
'textarea'
,
placeholder
:
'请输入
组名
(15个字以内)'
,
placeholder
:
'请输入
店铺名称
(15个字以内)'
,
maxlength
:
15
,
maxlength
:
15
,
height
:
240
height
:
240
};
};
...
@@ -78,7 +78,7 @@ export default {
...
@@ -78,7 +78,7 @@ export default {
return
{
return
{
title
:
'店铺地址'
,
title
:
'店铺地址'
,
type
:
'textarea'
,
type
:
'textarea'
,
placeholder
:
'请输入
营地名
(30个字以内)'
,
placeholder
:
'请输入
店铺地址
(30个字以内)'
,
maxlength
:
30
,
maxlength
:
30
,
height
:
240
height
:
240
};
};
...
...
pages/mine/pay/pay.vue
View file @
0cccaf4f
...
@@ -242,6 +242,8 @@ export default {
...
@@ -242,6 +242,8 @@ export default {
title
:
'支付中'
title
:
'支付中'
});
});
console
.
log
(
"charge=========="
,
charge
)
console
.
log
(
"charge=========="
,
charge
)
console
.
log
(
"charge.orderInfo=========="
,
charge
.
orderInfo
)
uni
.
requestPayment
({
uni
.
requestPayment
({
// #ifdef MP-WEIXIN
// #ifdef MP-WEIXIN
timeStamp
:
''
+
charge
.
timeStamp
,
timeStamp
:
''
+
charge
.
timeStamp
,
...
@@ -295,7 +297,7 @@ export default {
...
@@ -295,7 +297,7 @@ export default {
},
},
fail
:
res
=>
{
fail
:
res
=>
{
console
.
log
(
'fail:'
+
JSON
.
stringify
(
res
));
console
.
log
(
'fail:'
+
JSON
.
stringify
(
res
));
console
.
log
(
this
.
uid
,
'支付失败:'
,
res
);
console
.
log
(
'支付失败:'
,
res
);
uni
.
showToast
({
uni
.
showToast
({
title
:
res
.
errMsg
.
indexOf
(
'cancel'
)
!=
-
1
?
'支付取消'
:
'支付失败'
,
title
:
res
.
errMsg
.
indexOf
(
'cancel'
)
!=
-
1
?
'支付取消'
:
'支付失败'
,
icon
:
'none'
icon
:
'none'
...
...
pages/mine/payments-setting/components/drap-view.vue
View file @
0cccaf4f
...
@@ -4,34 +4,48 @@
...
@@ -4,34 +4,48 @@
<view
class=
"zhuti"
>
<view
class=
"zhuti"
>
<scroll-view
:scroll-y=
"pageInfo.scrollY"
class=
"product-section"
>
<scroll-view
:scroll-y=
"pageInfo.scrollY"
class=
"product-section"
>
<view
class=
"list"
>
<view
class=
"list"
>
<uni-swipe-action>
<uni-swipe-action
ref=
"swipeAction"
>
<view
class=
"swipe-action-outside"
v-for=
"(item, index) in optionLists"
:key=
"item.guid"
>
<view
class=
"swipe-action-outside"
v-for=
"(item, index) in optionLists"
:key=
"item.id"
>
<uni-swipe-action-item
:right-options=
"options"
bg-color=
"#f6f7fa"
:index=
"item.guid"
@
click=
"onClick($event,item,index)"
@
change=
"swipeChange($event, index)"
>
<uni-swipe-action-item
<view
:right-options=
"options"
class=
"row list-row"
bg-color=
"#f6f7fa"
:data-index=
"index"
:index=
"item.id"
@
longpress=
"longpress($event, item, index)"
:auto-close=
"true"
@
touchmove=
"dragMove"
@
click
.
stop=
"onClick($event, item, index)"
@
touchend=
"dragEnd($event, item)"
@
change=
"swipeChange($event, index)"
:class=
"
{ 'ready-place': pageInfo.readyPlaceIndex === index }"
>
:id="`item-view-${item.guid}`"
<view
:style="'height: ' + pageInfo.rowHeight + 'px;'"
class=
"row list-row"
@click.stop="closeAll"
:data-index=
"index"
>
@
longpress
.
stop=
"longpress($event, item, index)"
<view
class=
"item-view"
@
click
.
stop=
"clickCell(item, index)"
>
@
touchmove=
"dragMove"
<view
class=
"left-view"
>
@
touchend=
"dragEnd($event, item)"
<view
class=
"image-view"
><image
:src=
"billStaticBaseUrl + item.icon"
v-if=
"item.icon"
></image></view>
:class=
"
{ 'ready-place': pageInfo.readyPlaceIndex === index }"
<view
class=
"name-view"
>
{{
item
.
label
}}
</view>
:id="`item-view-${item.id}`"
:style="'height: ' + pageInfo.rowHeight + 'px;'"
@click.stop="closeAll"
>
<view
class=
"item-view"
@
click
.
stop=
"clickCell(item, index)"
>
<view
class=
"left-view"
>
<view
class=
"image-view"
><image
:src=
"billStaticBaseUrl + item.icon"
v-if=
"item.icon"
></image></view>
<view
class=
"name-view"
>
{{
item
.
label
}}
</view>
</view>
</view>
</view>
</view>
</
view
>
</
uni-swipe-action-item
>
</view>
</view>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
</uni-swipe-action>
</view>
</view>
</scroll-view>
</scroll-view>
<movable-area
class=
"movable-area"
:class=
"
{ 'movable-area-active': pageInfo.beginMove }">
<movable-area
class=
"movable-area"
:class=
"
{ 'movable-area-active': pageInfo.beginMove }">
<movable-view
class=
"row list-row movable-row"
:out-of-bounds=
"true"
damping=
"999"
:style=
"movableViewStyle"
direction=
"vertical"
:y=
"movableViewInfo.y"
>
<movable-view
class=
"row list-row movable-row"
:class=
"
{ 'movable-row-active': pageInfo.beginMove }"
:out-of-bounds="true"
damping="999"
direction="vertical"
:y="movableViewInfo.y"
>
<view
class=
"item-view"
>
<view
class=
"item-view"
>
<view
class=
"left-view"
>
<view
class=
"left-view"
>
<view
class=
"image-view"
><image
:src=
"billStaticBaseUrl + movableViewInfo.data.icon"
class=
"image-view"
v-if=
"movableViewInfo.data.icon"
></image></view>
<view
class=
"image-view"
><image
:src=
"billStaticBaseUrl + movableViewInfo.data.icon"
class=
"image-view"
v-if=
"movableViewInfo.data.icon"
></image></view>
...
@@ -50,6 +64,7 @@ import UniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue';
...
@@ -50,6 +64,7 @@ import UniSwipeAction from '@/components/uni-swipe-action/uni-swipe-action.vue';
import
UniSwipeActionItem
from
'@/components/uni-swipe-action-item/uni-swipe-action-item.vue'
;
import
UniSwipeActionItem
from
'@/components/uni-swipe-action-item/uni-swipe-action-item.vue'
;
import
PopInput
from
'@/components/pop-input-view'
;
import
PopInput
from
'@/components/pop-input-view'
;
import
{
billStaticBaseUrl
}
from
'@/utils/config.js'
;
import
{
billStaticBaseUrl
}
from
'@/utils/config.js'
;
import
{
mapGetters
}
from
'vuex'
;
export
default
{
export
default
{
name
:
'dragEdit'
,
name
:
'dragEdit'
,
props
:
[
'list'
],
props
:
[
'list'
],
...
@@ -103,12 +118,14 @@ export default {
...
@@ -103,12 +118,14 @@ export default {
list
:
{
list
:
{
handler
(
val
)
{
handler
(
val
)
{
this
.
optionLists
=
[...
val
];
this
.
optionLists
=
[...
val
];
},
},
immediate
:
true
,
immediate
:
true
,
deep
:
true
deep
:
true
}
}
},
},
computed
:
{
computed
:
{
...
mapGetters
([
'platform'
]),
movableViewStyle
()
{
movableViewStyle
()
{
let
style
=
`height:
${
this
.
pageInfo
.
rowHeight
}
px`
;
let
style
=
`height:
${
this
.
pageInfo
.
rowHeight
}
px`
;
return
style
;
return
style
;
...
@@ -119,9 +136,18 @@ export default {
...
@@ -119,9 +136,18 @@ export default {
this
.
optionLists
=
[...
this
.
list
];
this
.
optionLists
=
[...
this
.
list
];
},
},
methods
:
{
methods
:
{
beginMoveChange
(){
resize
(){
this
.
beginMove
=!
this
.
beginMove
if
(
this
.
platform
===
'4'
)
{
this
.
pageInfo
.
beginMove
=!
this
.
pageInfo
.
beginMove
this
.
$nextTick
(()
=>
{
if
(
this
.
$refs
.
swipeAction
){
// this.$refs["swipeAction"].resize()
}
});
}
},
beginMoveChange
()
{
this
.
beginMove
=
!
this
.
beginMove
;
this
.
pageInfo
.
beginMove
=
!
this
.
pageInfo
.
beginMove
;
},
},
clickCell
(
item
)
{
clickCell
(
item
)
{
let
flag
=
true
;
let
flag
=
true
;
...
@@ -169,19 +195,19 @@ export default {
...
@@ -169,19 +195,19 @@ export default {
});
});
},
},
handleConfirm
()
{
handleConfirm
()
{
this
.
optionLists
.
map
(
item
=>
{
//
this.optionLists.map(item => {
if
(
item
.
id
===
this
.
readyDeleteItem
.
id
)
{
//
if (item.id === this.readyDeleteItem.id) {
item
.
show
=
false
;
//
item.show = false;
}
//
}
});
//
});
this
.
$emit
(
'onDelete'
,
this
.
readyDeleteItem
);
this
.
$emit
(
'onDelete'
,
this
.
readyDeleteItem
);
},
},
handleCancel
()
{
handleCancel
()
{
this
.
optionLists
.
map
(
item
=>
{
//
this.optionLists.map(item => {
if
(
item
.
id
===
this
.
readyDeleteItem
.
id
)
{
//
if (item.id === this.readyDeleteItem.id) {
item
.
show
=
false
;
//
item.show = false;
}
//
}
});
//
});
},
},
beforeDelete
(
item
)
{
beforeDelete
(
item
)
{
...
@@ -197,9 +223,9 @@ export default {
...
@@ -197,9 +223,9 @@ export default {
},
},
closeAll
()
{
closeAll
()
{
if
(
this
.
optionLists
.
length
)
{
if
(
this
.
optionLists
.
length
)
{
this
.
optionLists
.
map
(
item
=>
{
//
this.optionLists.map(item => {
item
.
show
=
false
;
//
item.show = false;
});
//
});
}
}
},
},
async
longpress
(
event
,
item
)
{
async
longpress
(
event
,
item
)
{
...
@@ -225,10 +251,9 @@ export default {
...
@@ -225,10 +251,9 @@ export default {
console
.
log
(
'dragStart'
);
console
.
log
(
'dragStart'
);
// 开始本次拖拽
// 开始本次拖拽
this
.
pageInfo
.
beginMove
=
true
;
this
.
pageInfo
.
beginMove
=
true
;
console
.
log
(
'beginMove'
,
this
.
beginMove
);
// this.$set(this.pageInfo,'beginMove',true)
// this.$set(this.pageInfo,'beginMove',true)
// 本次移动的view真实下标
// 本次移动的view真实下标
var
currentMoveIndex
=
(
this
.
optionLists
||
[]).
findIndex
(
x
=>
x
.
guid
===
item
.
gu
id
);
var
currentMoveIndex
=
(
this
.
optionLists
||
[]).
findIndex
(
x
=>
x
.
id
===
item
.
id
);
console
.
log
(
'currentMoveIndex'
,
currentMoveIndex
);
console
.
log
(
'currentMoveIndex'
,
currentMoveIndex
);
// var startIndex = event.currentTarget.dataset.index;
// var startIndex = event.currentTarget.dataset.index;
var
startIndex
=
currentMoveIndex
;
var
startIndex
=
currentMoveIndex
;
...
@@ -251,8 +276,6 @@ export default {
...
@@ -251,8 +276,6 @@ export default {
this
.
movableViewInfo
=
movableViewInfo
;
this
.
movableViewInfo
=
movableViewInfo
;
this
.
pageInfo
=
pageInfo
;
this
.
pageInfo
=
pageInfo
;
console
.
log
(
'movableViewInfo'
,
this
.
movableViewInfo
);
console
.
log
(
'pageInfo'
,
this
.
pageInfo
.
beginMove
);
},
},
// 拖拽移动(按住不松)
// 拖拽移动(按住不松)
dragMove
(
event
)
{
dragMove
(
event
)
{
...
@@ -367,7 +390,7 @@ export default {
...
@@ -367,7 +390,7 @@ export default {
overflow
:
scroll
;
overflow
:
scroll
;
}
}
.row
{
.row
{
height
:
47
px
;
height
:
66
px
;
width
:
100%
;
width
:
100%
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
...
@@ -392,19 +415,28 @@ export default {
...
@@ -392,19 +415,28 @@ export default {
z-index
:
10
;
z-index
:
10
;
width
:
100%
;
width
:
100%
;
visibility
:
hidden
;
visibility
:
hidden
;
height
:
100%
;
height
:
0
;
}
}
.movable-area-active
{
.movable-area-active
{
visibility
:
unset
;
visibility
:
unset
;
display
:
inline-block
;
display
:
inline-block
;
height
:
100%
;
// display: block;
// display: block;
}
}
.movable-row
{
.movable-row
{
box-shadow
:
#d9d9d9
0
0
20px
;
// visibility: hidden;
height
:
0
;
.item-view
{
.item-view
{
}
}
}
}
.movable-row-active
{
box-shadow
:
#d9d9d9
0
0
20px
;
// visibility: unset;
height
:
66px
;
}
.ready-place
{
.ready-place
{
background
:
rgba
(
238
,
240
,
254
,
0
.6
);
background
:
rgba
(
238
,
240
,
254
,
0
.6
);
}
}
...
@@ -422,6 +454,7 @@ export default {
...
@@ -422,6 +454,7 @@ export default {
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
.image-view
{
.image-view
{
width
:
72rpx
;
width
:
72rpx
;
height
:
72rpx
;
height
:
72rpx
;
...
...
pages/mine/payments-setting/payments-setting.vue
View file @
0cccaf4f
...
@@ -87,6 +87,9 @@ export default {
...
@@ -87,6 +87,9 @@ export default {
uni
.
$off
(
this
.
notification
);
uni
.
$off
(
this
.
notification
);
},
},
methods
:
{
methods
:
{
resize
(){
// this.$refs["drap-view"].resize()
},
updateEmit
(){
updateEmit
(){
uni
.
$emit
(
this
.
notification
,
{
uni
.
$emit
(
this
.
notification
,
{
content
:
""
content
:
""
...
@@ -150,7 +153,9 @@ export default {
...
@@ -150,7 +153,9 @@ export default {
item
.
icon
=
item
.
recordSelectedIcon
;
item
.
icon
=
item
.
recordSelectedIcon
;
item
.
show
=
false
item
.
show
=
false
});
});
console
.
log
(
data
)
this
.
list
=
data
||
[];
this
.
list
=
data
||
[];
this
.
resize
()
}
catch
(
e
)
{
}
catch
(
e
)
{
//TODO handle the exception
//TODO handle the exception
}
}
...
...
pages/mine/timed/timed.vue
View file @
0cccaf4f
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
active-color=
"#02A074"
active-color=
"#02A074"
inactive-color=
"#CCCCCC"
inactive-color=
"#CCCCCC"
:loading=
"item.loading"
:loading=
"item.loading"
@
change
.
stop
=
"handleSwitchChange($event, index)"
@
change=
"handleSwitchChange($event, index)"
></u-switch>
></u-switch>
</view>
</view>
</view>
</view>
...
...
store/modules/login.js
View file @
0cccaf4f
...
@@ -161,15 +161,12 @@ const actions = {
...
@@ -161,15 +161,12 @@ const actions = {
case
'3'
:
// 抖音
case
'3'
:
// 抖音
authType
=
""
authType
=
""
break
;
break
;
case
'4'
:
//
抖音
case
'4'
:
//
app-plus
authType
=
"WX"
authType
=
"WX"
break
;
break
;
}
}
try
{
try
{
let
code
=
""
let
code
=
""
if
(
!
params
.
account
){
code
=
await
wxLogin
()
}
let
info
=
{
let
info
=
{
...
loginInfo
,
...
loginInfo
,
authType
:
authType
,
authType
:
authType
,
...
...
utils/auth.js
View file @
0cccaf4f
let
localtionshowModal
=
null
let
localtionshowModal
=
null
import
{
platform
,
channel
}
from
'./platform'
import
{
platform
,
channel
}
from
'./platform'
export
function
showModal
({
export
function
showModal
({
content
=
"检测到您没打开获取位置信息功能权限,是否去设置打开?"
,
content
=
"检测到您没打开获取位置信息功能权限,是否去设置打开?"
,
...
@@ -47,7 +50,7 @@ export function openSetting({
...
@@ -47,7 +50,7 @@ export function openSetting({
if
(
callback
&&
callback
instanceof
Function
)
{
if
(
callback
&&
callback
instanceof
Function
)
{
callback
()
callback
()
}
}
}
else
{
}
else
{
if
(
fail
&&
fail
instanceof
Function
)
{
if
(
fail
&&
fail
instanceof
Function
)
{
fail
()
fail
()
}
}
...
@@ -110,7 +113,7 @@ export const getWritePhotosAlbum = function() {
...
@@ -110,7 +113,7 @@ export const getWritePhotosAlbum = function() {
})
})
}
}
export
const
wxLogin
=
function
(
provider
)
{
export
function
wxLogin
(
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
login
({
uni
.
login
({
// #ifdef APP-PLUS
// #ifdef APP-PLUS
...
@@ -136,19 +139,20 @@ export const wxLogin = function(provider) {
...
@@ -136,19 +139,20 @@ export const wxLogin = function(provider) {
errCode
,
errCode
,
code
code
}
=
err
;
}
=
err
;
let
title
=
'登录失败'
;
let
title
=
'登录失败'
;
if
(
errCode
===
-
8
)
{
if
(
errCode
===
-
8
)
{
title
=
'请先安装微信客户端'
;
title
=
'请先安装微信客户端'
;
}
}
if
(
platform
===
'4'
)
{
if
(
platform
===
'4'
)
{
uni
.
showModal
({
uni
.
showModal
({
content
:
title
,
content
:
title
,
showCancel
:
false
showCancel
:
false
});
});
}
}
reject
(
err
);
reject
(
err
);
}
},
});
});
})
})
}
}
...
@@ -196,7 +200,7 @@ export const getUserinfo = function(callback) {
...
@@ -196,7 +200,7 @@ export const getUserinfo = function(callback) {
})
})
}
}
export
const
authorizeUserinfo
=
function
(
scope
=
"scope.userInfo"
)
{
export
const
authorizeUserinfo
=
function
(
scope
=
"scope.userInfo"
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
authorize
({
uni
.
authorize
({
scope
:
scope
,
scope
:
scope
,
...
@@ -218,7 +222,7 @@ export const authorizeUserinfo = function(scope="scope.userInfo") {
...
@@ -218,7 +222,7 @@ export const authorizeUserinfo = function(scope="scope.userInfo") {
}
}
export
const
authorize
=
function
(
scope
=
"scope.userInfo"
)
{
export
const
authorize
=
function
(
scope
=
"scope.userInfo"
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
authorize
({
uni
.
authorize
({
scope
:
scope
,
scope
:
scope
,
...
@@ -238,7 +242,7 @@ export const authorize = function(scope="scope.userInfo") {
...
@@ -238,7 +242,7 @@ export const authorize = function(scope="scope.userInfo") {
export
function
openGps
()
{
export
function
openGps
()
{
let
system
=
uni
.
getSystemInfoSync
();
// 获取系统信息
let
system
=
uni
.
getSystemInfoSync
();
// 获取系统信息
if
(
system
.
platform
===
'android'
)
{
// 判断平台
if
(
system
.
platform
===
'android'
)
{
// 判断平台
console
.
log
(
"安卓平台获取GPS定位权限"
)
console
.
log
(
"安卓平台获取GPS定位权限"
)
var
context
=
plus
.
android
.
importClass
(
"android.content.Context"
);
var
context
=
plus
.
android
.
importClass
(
"android.content.Context"
);
var
locationManager
=
plus
.
android
.
importClass
(
"android.location.LocationManager"
);
var
locationManager
=
plus
.
android
.
importClass
(
"android.location.LocationManager"
);
var
main
=
plus
.
android
.
runtimeMainActivity
();
var
main
=
plus
.
android
.
runtimeMainActivity
();
...
@@ -280,4 +284,4 @@ export function openGps() {
...
@@ -280,4 +284,4 @@ export function openGps() {
}
}
});
});
}
}
}
}
\ No newline at end of file
utils/download.js
View file @
0cccaf4f
export
function
downLoadFile
(
url
){
import
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
getToken
,
showToast
,
parseTime
}
from
"@/utils/common.js"
let
systemInfo
=
uni
.
getSystemInfoSync
()
let
isIOS
=
systemInfo
.
platform
===
'ios'
export
function
downLoadFile
(
url
)
{
let
header
=
{
token
:
'Bearer '
+
getToken
()
}
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
uni
.
downloadFile
({
uni
.
downloadFile
({
url
:
url
,
url
:
url
,
header
,
// #ifdef APP-PLUS
// filePath:`_doc/uniapp_temp_1661245330777/download/zhangdan-${new Date().getTime()}.xlsx`,
// #endif
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
resolve
(
res
)
resolve
(
res
)
console
.
log
(
'downLoadFile_ok'
,
res
)
console
.
log
(
'downLoadFile_ok'
,
res
)
},
},
fail
:
err
=>
{
fail
:
err
=>
{
console
.
log
(
'downLoadFile_fail'
,
err
)
console
.
log
(
'downLoadFile_fail'
,
err
)
reject
(
err
)
reject
(
err
)
}
}
})
})
})
})
}
}
export
function
openFile
(
url
)
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
uni
.
openDocument
({
//打开文件
filePath
:
url
,
//文件名
showMenu
:
true
,
//右上角是否显示(...)
success
(
res
)
{
console
.
log
(
res
);
resolve
()
},
fail
(
err
)
{
console
.
log
(
"openDocument:fail"
,
err
);
if
(
isIOS
)
{
showToast
(
"打开文件失败"
)
}
else
{
uni
.
showModal
({
title
:
"打开文件失败"
,
content
:
"请先安装Office应用"
,
confirmColor
:
"#0bc183"
,
confirmText
:
"确定"
,
showCancel
:
false
,
success
:
(
res
)
=>
{}
})
}
reject
()
}
});
})
}
// file:{filename:文件名称,fileulr:文件地址}
export
function
appDowloadFile
({
url
,
filename
=
"账单导入模板"
,
data
=
""
,
// POST 请求时携带的参数
method
=
"GET"
})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
console
.
log
(
url
,
filename
,
data
,
method
)
let
type
=
url
.
substring
(
url
.
lastIndexOf
(
"."
))
let
date
=
new
Date
()
let
filenameConcat
=
`
${
filename
}
-
${
parseTime
(
date
)}
`
//file://storage/emulated/0 固定写法,
//Download:文件保存的文件夹名称,试了其他名称但是在手机文件管理中没能找到文件,使用download后可以
//type:文件后缀
let
basePath
=
"_downloads/"
let
fullPath
=
basePath
+
filenameConcat
+
type
let
task
=
plus
.
downloader
.
createDownload
(
url
,
{
filename
:
fullPath
,
method
,
data
,
},
function
(
d
,
status
)
{
uni
.
hideLoading
()
if
(
status
===
200
)
{
//d.filename是文件在保存在本地的相对路径,使用下面的API可转为平台绝对路径
let
fileSaveUrl
=
plus
.
io
.
convertLocalFileSystemURL
(
d
.
filename
)
console
.
log
(
"plus.downloader"
,
d
,
"status=="
,
status
)
let
content
=
"下载成功,是否打开?"
if
(
!
isIOS
)
{
content
=
"文件已保存至文件管理器 Android/data/com.shenjiying.jizhang/downloads/ 目录,是否打开?"
}
else
{
fileSaveUrl
=
"file:"
+
fileSaveUrl
}
console
.
log
(
"fileSaveUrl"
,
fileSaveUrl
)
uni
.
showModal
({
title
:
"下载成功"
,
content
:
content
,
confirmColor
:
"#0bc183"
,
confirmText
:
"打开"
,
success
(
res
)
{
if
(
res
.
confirm
)
{
//选择软件打开文件
plus
.
runtime
.
openFile
(
fileSaveUrl
,
{},
err
=>
{
console
.
log
(
err
)
if
(
isIOS
)
{
showToast
(
"打开文件失败"
,
true
)
}
else
{
uni
.
showModal
({
title
:
"打开文件失败"
,
content
:
"请先安装Office应用"
,
confirmColor
:
"#0bc183"
,
confirmText
:
"确定"
,
showCancel
:
false
,
success
:
(
res
)
=>
{
}
})
}
})
}
else
if
(
res
.
cancel
)
{}
},
});
resolve
(
d
,
status
)
}
else
{
showToast
(
"下载失败"
,
true
)
plus
.
downloader
.
clear
()
reject
(
d
,
status
)
}
})
uni
.
showLoading
({
title
:
'文件下载中...'
})
// task.setRequestHeader("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
task
.
setRequestHeader
(
"token"
,
'Bearer '
+
getToken
())
task
.
start
();
})
}
export
function
saveFile
(
url
)
{
uni
.
showLoading
({
title
:
"加载中"
});
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
uni
.
saveFile
({
tempFilePath
:
url
,
success
:
(
res
)
=>
{
console
.
log
(
'saveFile_ok'
,
res
)
uni
.
hideLoading
();
let
filePath
=
res
.
savedFilePath
;
resolve
(
res
)
uni
.
showModal
({
title
:
"下载成功"
,
content
:
"文件已保存至手机,是否打开?"
,
confirmColor
:
"#0bc183"
,
confirmText
:
"打开"
,
success
(
res
)
{
if
(
res
.
confirm
)
{
uni
.
openDocument
({
//打开文件
filePath
,
//文件名
showMenu
:
true
,
//右上角是否显示(...)
success
(
res
)
{
console
.
log
(
res
);
},
fail
(
err
)
{
console
.
log
(
"openDocument:fail"
,
err
);
if
(
isIOS
)
{
showToast
(
"打开文件失败"
)
}
else
{
uni
.
showModal
({
title
:
"打开文件失败"
,
content
:
"请先安装Office应用"
,
confirmColor
:
"#0bc183"
,
confirmText
:
"确定"
,
showCancel
:
false
,
success
:
(
res
)
=>
{
}
})
}
}
});
}
else
if
(
res
.
cancel
)
{}
},
});
},
fail
:
err
=>
{
console
.
log
(
'saveFile_fail'
,
err
)
uni
.
hideLoading
();
uni
.
showModal
({
title
:
'提示'
,
content
:
"文件保存失败"
,
showCancel
:
false
,
//是否显示取消按钮
success
:
function
(
result
)
{}
})
reject
(
err
)
}
})
})
}
export
function
downLoad
(
file
)
{
export
function
downLoad
(
file
)
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
uni
.
showLoading
({
uni
.
showLoading
({
title
:
"加载中"
title
:
"加载中"
});
});
// let filePath = `${wx.env.USER_DATA_PATH}/${new Date().getTime()}.xlsx`; //导出的文件名
// let filePath = `${wx.env.USER_DATA_PATH}/${new Date().getTime()}.xlsx`; //导出的文件名
let
filePath
=
`
${
wx
.
env
.
USER_DATA_PATH
}
/zhangdan-
${
new
Date
().
getTime
()}
.xlsx`
;
//导出的文件名
let
filePath
=
console
.
log
(
filePath
)
`
${
wx
.
env
.
USER_DATA_PATH
}
/zhangdan-
${
new
Date
().
getTime
()}
.xlsx`
;
//导出的文件名
try
{
console
.
log
(
"filePath"
,
filePath
)
try
{
let
fm
=
uni
.
getFileSystemManager
();
//获取文件管理器
let
fm
=
uni
.
getFileSystemManager
();
//获取文件管理器
fm
.
writeFile
({
//写入文件
fm
.
writeFile
({
//写入文件
filePath
,
//文件名
filePath
,
//文件名
data
:
file
,
//数据
data
:
file
,
//数据
encoding
:
"binary"
,
encoding
:
"binary"
,
success
:
res
=>
{
success
:
res
=>
{
console
.
log
(
"writeFile"
,
res
)
console
.
log
(
"writeFile"
,
res
)
uni
.
hideLoading
();
uni
.
hideLoading
();
resolve
(
res
)
resolve
(
res
)
// downLoadFile(filePath)
// downLoadFile(filePath)
...
@@ -66,7 +257,7 @@ export function downLoad(file) {
...
@@ -66,7 +257,7 @@ export function downLoad(file) {
console
.
log
(
res
);
console
.
log
(
res
);
},
},
});
});
}
else
if
(
res
.
cancel
)
{}
}
else
if
(
res
.
cancel
)
{}
},
},
});
});
...
@@ -82,7 +273,7 @@ export function downLoad(file) {
...
@@ -82,7 +273,7 @@ export function downLoad(file) {
})
})
},
},
})
})
}
catch
(
e
)
{
}
catch
(
e
)
{
uni
.
hideLoading
();
uni
.
hideLoading
();
this
.
showToast
(
'写入文件失败'
)
this
.
showToast
(
'写入文件失败'
)
console
.
log
(
e
)
console
.
log
(
e
)
...
@@ -90,6 +281,6 @@ export function downLoad(file) {
...
@@ -90,6 +281,6 @@ export function downLoad(file) {
//TODO handle the exception
//TODO handle the exception
}
}
})
})
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment