Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
H
huamu
Project
Project
Details
Activity
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
郭铭瑶
huamu
Commits
de7e2f04
Commit
de7e2f04
authored
Sep 16, 2021
by
郭铭瑶
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传功能完成
parent
7ef6e681
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
221 additions
and
50 deletions
+221
-50
App.vue
src/App.vue
+4
-0
api.ts
src/ajax/api.ts
+5
-2
useAliOss.ts
src/hooks/useAliOss.ts
+2
-2
useExportFile.ts
src/hooks/useExportFile.ts
+20
-2
building-drawer.vue
src/view/components/building-drawer.vue
+0
-1
member-info.vue
src/view/components/member-info.vue
+0
-1
new-activity-drawer.vue
src/view/components/new-activity-drawer.vue
+190
-42
No files found.
src/App.vue
View file @
de7e2f04
...
...
@@ -69,6 +69,10 @@ const themeOverrides: GlobalThemeOverrides = {
Card
:
{
borderRadius
:
'.06rem'
,
},
Upload
:
{
itemTextColorSuccess
:
'#3D7FE9'
,
itemTextColorError
:
'#E59B00'
,
},
Tag
:
{
borderRadius
:
'.04rem'
,
colorPrimary
:
'#FCF4F5'
,
...
...
src/ajax/api.ts
View file @
de7e2f04
...
...
@@ -10,12 +10,13 @@ const getCookie = (name: string): string | null => {
switch
(
process
.
env
.
NODE_ENV
)
{
case
'production'
:
BASE_URL
=
'https://
survey.maicedata.com/api/data/'
BASE_URL
=
'https://
www.maicedata.com/collector/data/'
// 生产环境
TOKEN
=
LZString
.
decompressFromEncodedURIComponent
(
getCookie
(
'__DM_TOKEN__'
)
||
window
.
localStorage
.
getItem
(
'dm_token_'
),
)
break
default
:
// vite.config 代理 https://survey.maicedata.com/api/data/
BASE_URL
=
'/api'
TOKEN
=
'91e315a9-b2a8-4950-97fa-9dbf84a230d6'
}
...
...
@@ -35,5 +36,7 @@ export default {
ATTACHMENT
:
'988fc63e-fa55-4729-851d-24c4355213f2'
,
TAG
:
'54344e11-c0d3-40d5-8f99-771066249328'
,
GET_AUTH
:
'988fc63e-fa55-4729-851d-24c4355213f2/storage/grant'
,
GET_USER_ID
:
'/auth/user/bytoken'
,
GET_USER_ID
:
'https://www.maicedata.com/auth/user/bytoken'
,
USER
:
'3625616b-7f2c-449a-8306-101aac7b8b97'
,
ORG
:
'b47ddc9a-0aa7-45a8-b1b6-6064f888d537'
,
}
src/hooks/useAliOss.ts
View file @
de7e2f04
...
...
@@ -6,7 +6,7 @@ import { api } from '@/ajax'
export
default
async
function
useAliOss
(
file
:
any
)
{
const
auth
=
(
await
useFetchAuth
())?.
token
const
client
=
new
OSS
({
region
:
auth
.
region
,
region
:
'oss-'
+
auth
.
region
,
accessKeyId
:
auth
.
access_key_id
,
accessKeySecret
:
auth
.
access_key_secret
,
bucket
:
auth
.
bucket
,
...
...
@@ -19,7 +19,7 @@ export default async function useAliOss(file: any) {
fr
.
readAsArrayBuffer
(
file
)
fr
.
onload
=
async
(
e
)
=>
{
const
buffer
=
new
OSS
.
Buffer
(
e
.
target
&&
e
.
target
.
result
)
const
key
=
`collector/
${
api
.
A
CTIVITY
}
/huamu_
${
md5
(
buffer
)}
_
${
filename
}
`
const
key
=
`collector/
${
api
.
A
TTACHMENT
}
/huamu_
${
md5
(
buffer
)}
_
${
filename
}
`
const
res
=
await
client
.
put
(
key
,
buffer
)
resolve
(
res
.
url
)
}
...
...
src/hooks/useExportFile.ts
View file @
de7e2f04
...
...
@@ -6,6 +6,7 @@ import {
HeadingLevel
,
TextRun
,
ImageRun
,
ExternalHyperlink
,
}
from
'docx'
function
createHeading
(
text
:
string
):
Paragraph
{
...
...
@@ -26,9 +27,9 @@ function createText(text: string): Paragraph {
})
}
async
function
createImage
(
key
:
string
,
urls
:
string
[])
{
async
function
createImage
(
key
:
string
,
items
:
any
[])
{
const
blobs
=
await
Promise
.
all
(
urls
.
map
(
async
(
url
)
=>
await
fetch
(
url
).
then
((
r
:
any
)
=>
r
.
blob
())),
items
.
map
(
async
(
item
)
=>
await
fetch
(
item
.
url
).
then
((
r
:
any
)
=>
r
.
blob
())),
)
return
new
Paragraph
({
children
:
[
...
...
@@ -46,6 +47,22 @@ async function createImage(key: string, urls: string[]) {
],
})
}
function
createLink
(
key
:
string
,
items
:
any
[])
{
return
new
Paragraph
({
children
:
[
new
TextRun
({
text
:
`
${
key
}
:`
}),
...
items
.
map
(
(
item
:
any
)
=>
new
ExternalHyperlink
({
link
:
item
.
url
,
child
:
new
TextRun
({
text
:
decodeURIComponent
(
item
.
url
.
split
(
'_'
).
pop
()
||
'未命名'
),
}),
}),
),
],
})
}
async
function
createDocument
(
data
:
any
[],
labelKey
:
string
)
{
function
arrayToString
(
e
:
unknown
)
{
...
...
@@ -65,6 +82,7 @@ async function createDocument(data: any[], labelKey: string) {
if
(
key
.
startsWith
(
'_'
))
return
createText
(
''
)
if
(
key
.
includes
(
'照片'
))
return
await
createImage
(
key
,
item
[
key
])
if
(
key
.
includes
(
'文件'
))
return
createLink
(
key
,
item
[
key
])
return
createText
(
`
${
key
}
:
${
arrayToString
(
item
[
key
])}
`
)
}),
)),
...
...
src/view/components/building-drawer.vue
View file @
de7e2f04
...
...
@@ -202,7 +202,6 @@ const getRooms = async (query: string) => {
)
}
const
getFloors
=
async
(
data
:
any
)
=>
{
console
.
log
(
'123'
,
data
)
return
Promise
.
all
(
(
await
useFetchRoom
({
...
...
src/view/components/member-info.vue
View file @
de7e2f04
...
...
@@ -59,7 +59,6 @@ const props = defineProps({
const
trans
=
(
val
:
string
)
=>
{
return
(
val
&&
val
.
replace
(
/
(\w{3})\w
*
(\w{4})
/
,
'$1******$2'
))
||
'无'
}
console
.
log
(
dayjs
().
diff
(
'1999-09-12'
,
'year'
))
const
tags
=
computed
(()
=>
{
const
result
:
{
type
?:
string
;
name
?:
string
}[]
=
[]
const
marker
:
string
[]
=
props
.
data
[
'标签'
]
||
[]
...
...
src/view/components/new-activity-drawer.vue
View file @
de7e2f04
This diff is collapsed.
Click to expand it.
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