Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
wechatapp.shangjiadao.com
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
wangxuelai
wechatapp.shangjiadao.com
Commits
80a0d76d
Commit
80a0d76d
authored
Apr 10, 2020
by
lvtz
Browse files
Options
Browse Files
Download
Plain Diff
fix
parents
81d894ad
fe3d06c0
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
101 additions
and
80 deletions
+101
-80
api.js
constants/api.js
+3
-2
common.js
service/common.js
+4
-7
index.js
src/pages/activityindex/index.js
+0
-1
index.js
src/pages/clockeditor/index.js
+60
-47
index.js
src/pages/mall/index.js
+0
-1
userinfoupdate.js
src/pages/setting/userinfoupdate.js
+33
-20
userinfoupdate.wxml
src/pages/setting/userinfoupdate.wxml
+1
-1
index.js
src/pages/teacherpclogin/index.js
+0
-1
No files found.
constants/api.js
View file @
80a0d76d
import
constants
from
'./constants.js'
;
const
api
=
constants
.
host
+
'/v3/'
;
// 打卡通用接口
const
apiv4
=
constants
.
host
+
'/v4/'
;
// 打卡通用接口
const
apiv2
=
constants
.
host2
+
'/shop/api/'
;
// 打卡登录注册忘记密码接口
const
apis
=
{
...
...
@@ -41,9 +42,9 @@ const apis = {
// login: `${api}member/login`,
// verifyCode: 'http://biz.wp53.cn/v2/api/service/user/verify_code',
// register: `${api}common/qx_login/register`,
cOssAccess
:
`
${
api
}
student/oss/access`
,
cOssAccess
:
`
${
api
v4
}
student/oss/access`
,
circleUserShow
:
`
${
api
}
consumer/clock/circle/userShow`
,
cMediaOssAccess
:
`
${
api
}
student/media_access`
,
cMediaOssAccess
:
`
${
api
v4
}
student/media_access`
,
generateBusinessQrcode
:
`
${
api
}
common/qr_code_unlimit`
,
generateCustomerQrcode
:
`
${
api
}
common/qr_code_unlimit`
,
updateUserinfo
:
`
${
api
}
consumer/clock/userinfo/edit`
,
...
...
service/common.js
View file @
80a0d76d
...
...
@@ -6,21 +6,18 @@ import {
}
from
'../utilities/index.js'
;
import
apis
from
'../constants/api.js'
;
// 原本c端公用的方法
function
cOssAccess
()
{
function
cOssAccess
(
data
)
{
return
wxRequest
({
url
:
apis
.
customer
.
common
.
cOssAccess
,
data
:
{
},
data
:
data
||
{},
method
:
'GET'
,
errorresolve
:
1
,
})
}
function
cMediaOssAccess
(
{
type
}
)
{
function
cMediaOssAccess
(
data
)
{
return
wxRequest
({
url
:
apis
.
customer
.
common
.
cMediaOssAccess
,
data
:
{
type
},
data
,
method
:
'GET'
,
errorresolve
:
1
,
})
...
...
src/pages/activityindex/index.js
View file @
80a0d76d
// src/pages/activityindex/index.js
import
{
wxChooseImage
,
wxUploadFile
}
from
'../../../utilities/wxApi.js'
;
import
{
...
...
src/pages/clockeditor/index.js
View file @
80a0d76d
...
...
@@ -384,14 +384,8 @@ Page({
this
.
setData
({
imageUploaded
:
false
})
cOssAccess
().
then
((
acc
)
=>
{
access
=
acc
.
data
;
if
(
!
tempFiles
.
currentTarget
){
return
{
tempFiles
,};
}
return
wxChooseImage
({
count
:
this
.
data
.
maxImgCount
-
imgCount
})
wxChooseImage
({
count
:
this
.
data
.
maxImgCount
-
imgCount
}).
then
((
res
)
=>
{
const
{
tempFiles
}
=
res
;
let
imageBox
=
this
.
data
.
imageBox
;
...
...
@@ -419,16 +413,17 @@ Page({
this
.
setData
({
imageBox
:
res
.
imageBox
,
})
this
.
singleUploadFile
(
access
)
this
.
singleUploadFile
()
}).
catch
((
e
)
=>
{
wx
.
hideLoading
()
})
},
singleUploadFile
(
access
)
{
singleUploadFile
()
{
wx
.
showLoading
({
title
:
'图片上传中...'
,
mask
:
true
})
let
access
=
{};
let
imageBox
=
this
.
data
.
imageBox
;
if
(
this
.
data
.
currentIndex
==
(
imageBox
.
length
))
{
wx
.
hideLoading
();
...
...
@@ -440,34 +435,45 @@ Page({
}
return
;
}
let
filename
=
`
${
access
.
dir
}${
getRandomFilename
(
imageBox
[
this
.
data
.
currentIndex
].
src
)}
`
;
imageBox
[
this
.
data
.
currentIndex
].
status
=
'resolving'
;
this
.
setData
({
imageBox
})
wxUploadFile
({
url
:
access
.
host
,
formData
:
{
key
:
filename
,
policy
:
access
.
policy
,
OSSAccessKeyId
:
access
.
accessid
,
signature
:
access
.
signature
,
callback
:
access
.
callback
,
success_action_status
:
'200'
},
filePath
:
imageBox
[
this
.
data
.
currentIndex
].
src
,
name
:
'file'
,
const
path
=
imageBox
[
this
.
data
.
currentIndex
].
src
;
const
fileType
=
path
.
substr
(
path
.
lastIndexOf
(
'.'
)
+
1
);
cOssAccess
({
school_id
:
this
.
data
.
sid
,
ext
:
fileType
}).
then
((
acc
)
=>
{
access
=
acc
.
data
;
// if(!tempFiles.currentTarget){
// return {tempFiles,};
// }
// imageBox[this.data.currentIndex].src = access.path;
return
wxUploadFile
({
url
:
access
.
host
,
formData
:
{
key
:
access
.
path
,
policy
:
access
.
policy
,
OSSAccessKeyId
:
access
.
accessid
,
signature
:
access
.
signature
,
callback
:
access
.
callback
,
success_action_status
:
'200'
},
filePath
:
imageBox
[
this
.
data
.
currentIndex
].
src
,
name
:
'file'
,
})
}).
then
((
res
)
=>
{
let
data
=
JSON
.
parse
(
res
.
data
);
if
(
data
.
status
==
'ok'
)
{
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fullfilled'
;
imageBox
[
this
.
data
.
currentIndex
].
src
=
filename
;
imageBox
[
this
.
data
.
currentIndex
].
src
=
access
.
path
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
this
.
setData
({
imageBox
,
currentIndex
})
this
.
singleUploadFile
(
access
);
this
.
singleUploadFile
();
}
else
{
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fail'
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
...
...
@@ -475,16 +481,16 @@ Page({
imageBox
,
currentIndex
})
this
.
singleUploadFile
(
access
);
this
.
singleUploadFile
();
}
}).
catch
(()
=>
{
}).
catch
((
e
)
=>
{
imageBox
[
this
.
data
.
currentIndex
].
status
=
'fail'
;
let
currentIndex
=
this
.
data
.
currentIndex
+
1
;
this
.
setData
({
imageBox
,
currentIndex
})
this
.
singleUploadFile
(
access
);
this
.
singleUploadFile
();
})
},
delimg
(
e
)
{
...
...
@@ -783,18 +789,16 @@ Page({
const
that
=
this
;
let
access
=
{};
let
filename
=
''
;
cMediaOssAccess
({
type
:
1
}).
then
((
res
)
=>
{
access
=
res
.
data
;
if
(
tempFile
){
return
tempFile
}
return
wxChooseVideo
({
})
let
videoInsertIndex
=
0
;
let
imageBox
=
this
.
data
.
imageBox
;
let
size
=
0
;
let
duration
=
0
;
let
tempFilePath
=
''
;
wxChooseVideo
({
}).
then
((
res
)
=>
{
let
tempFilePath
=
''
;
const
{
duration
,
size
}
=
res
;
// access = res.data;
size
=
res
.
size
;
duration
=
res
.
duration
;
if
(
tempFile
){
tempFilePath
=
res
.
path
;
}
else
{
...
...
@@ -818,11 +822,19 @@ Page({
})
return
}
let
imageBox
=
this
.
data
.
imageBox
let
videoInsertIndex
=
imageBox
.
filter
(
ele
=>
ele
.
type
==
'video'
).
length
;
filename
=
`
${
access
.
dir
}${
getRandomFilename
(
tempFilePath
)}
`
;
videoInsertIndex
=
imageBox
.
filter
(
ele
=>
ele
.
type
==
'video'
).
length
;
// filename = `${access.dir}${getRandomFilename(tempFilePath)}`;
const
path
=
tempFilePath
;
const
fileType
=
path
.
substr
(
path
.
lastIndexOf
(
'.'
)
+
1
).
toLowerCase
();
return
cMediaOssAccess
({
school_id
:
this
.
data
.
sid
,
ext
:
fileType
,
type
:
1
})
}).
then
((
res
)
=>
{
access
=
res
.
data
;
imageBox
.
splice
(
videoInsertIndex
,
0
,
{
src
:
filename
,
src
:
access
.
path
,
status
:
'resolving'
,
type
:
'video'
,
size
:
size
,
...
...
@@ -831,10 +843,10 @@ Page({
that
.
setData
({
imageBox
})
that
.
data
.
uploadVideoTask
[
`
${
filename
}
`
]
=
wx
.
uploadFile
({
that
.
data
.
uploadVideoTask
[
`
${
access
.
path
}
`
]
=
wx
.
uploadFile
({
url
:
access
.
host
,
formData
:
{
key
:
filename
,
key
:
access
.
path
,
policy
:
access
.
policy
,
OSSAccessKeyId
:
access
.
accessid
,
signature
:
access
.
signature
,
...
...
@@ -846,9 +858,9 @@ Page({
success
(
res
)
{
const
{
data
}
=
res
;
if
(
data
==
'{"status":"ok"}'
)
{
console
.
log
(
videoInsertIndex
,
'videoInsertIndex'
);
let
imageBox
=
that
.
data
.
imageBox
;
imageBox
[
videoInsertIndex
].
src
=
filename
;
console
.
log
(
access
.
path
,
'filenamefilenamefilename'
);
imageBox
[
videoInsertIndex
].
src
=
access
.
path
;
imageBox
[
videoInsertIndex
].
status
=
'fullfilled'
;
imageBox
[
videoInsertIndex
].
videoprogress
=
100
;
that
.
setData
({
...
...
@@ -1255,6 +1267,7 @@ audioStorage[value].isWaiting = true;
const
videoList
=
tempFiles
.
filter
(
ele
=>
{
return
ele
.
type
==
'video'
})
console
.
log
(
imgList
,
'tempFilestempFiles'
);
this
.
addImg
(
imgList
);
videoList
.
forEach
((
ele
)
=>
{
this
.
addVideoMethod
(
ele
)
...
...
src/pages/mall/index.js
View file @
80a0d76d
// src/pages/activityindex/index.js
import
{
wxChooseImage
,
wxUploadFile
}
from
'../../../utilities/wxApi.js'
;
import
{
...
...
src/pages/setting/userinfoupdate.js
View file @
80a0d76d
...
...
@@ -129,26 +129,36 @@ Page({
});
},
// .then((acc) => {
// access = acc.data;
// return access;
// })
proMainImgUpload
(
e
)
{
let
access
=
{};
let
tempFiles
=
null
;
let
filename
=
''
;
const
{
type
}
=
e
.
currentTarget
.
dataset
;
cOssAccess
({
school_id
:
this
.
data
.
sid
}).
then
((
acc
)
=>
{
access
=
acc
.
data
;
return
wxChooseImage
({})
}).
then
((
res
)
=>
{
const
{
tempFiles
}
=
res
;
filename
=
`
${
access
.
dir
}${
getRandomFilename
(
tempFiles
[
0
].
path
)}
`
;
wxChooseImage
({}).
then
((
res
)
=>
{
tempFiles
=
res
.
tempFiles
;
const
path
=
tempFiles
[
0
].
path
;
const
fileType
=
path
.
substr
(
path
.
lastIndexOf
(
'.'
)
+
1
);
return
cOssAccess
({
school_id
:
this
.
data
.
sid
,
ext
:
fileType
})
}).
then
((
data
)
=>
{
const
acc
=
data
.
data
;
// filename = `${access.dir}${getRandomFilename(tempFiles[0].path)}`;
filename
=
acc
.
path
;
console
.
log
(
filename
,
'filename '
);
return
wxUploadFile
({
url
:
acc
ess
.
host
,
url
:
acc
.
host
,
formData
:
{
key
:
filename
,
policy
:
acc
ess
.
policy
,
OSSAccessKeyId
:
acc
ess
.
accessid
,
signature
:
acc
ess
.
signature
,
callback
:
acc
ess
.
callback
,
policy
:
acc
.
policy
,
OSSAccessKeyId
:
acc
.
accessid
,
signature
:
acc
.
signature
,
callback
:
acc
.
callback
,
success_action_status
:
'200'
},
filePath
:
tempFiles
[
0
].
path
,
...
...
@@ -156,6 +166,7 @@ Page({
})
}).
then
((
res
)
=>
{
const
{
data
}
=
res
;
console
.
log
(
data
,
'data'
)
if
(
data
==
'{"status":"ok"}'
)
{
this
.
setData
({
cropperSrc
:
imagify
(
filename
,
'image/resize,w_1280/format,jpg'
),
...
...
@@ -196,6 +207,8 @@ Page({
},
clickcut
(
e
)
{
let
filepath
=
e
.
detail
.
url
;
const
fileType
=
filepath
.
substr
(
filepath
.
lastIndexOf
(
'.'
)
+
1
);
let
fileName
=
''
;
this
.
setData
({
showCropper
:
false
,
cropperSrc
:
''
,
...
...
@@ -203,18 +216,18 @@ Page({
})
let
filename
=
''
;
cOssAccess
({
school_id
:
this
.
data
.
sid
}).
then
((
acc
)
=>
{
return
acc
.
data
;
}).
then
((
access
)
=>
{
filename
=
`
${
access
.
dir
}${
getRandomFilename
(
filepath
)}
`
;
school_id
:
this
.
data
.
sid
,
ext
:
fileType
}).
then
((
res
)
=>
{
const
access
=
res
.
data
;
wx
.
showLoading
({
title
:
'图片上传中'
})
fileName
=
access
.
path
;
return
wxUploadFile
({
url
:
access
.
host
,
formData
:
{
key
:
filename
,
key
:
access
.
path
,
policy
:
access
.
policy
,
OSSAccessKeyId
:
access
.
accessid
,
signature
:
access
.
signature
,
...
...
@@ -235,7 +248,7 @@ Page({
})
this
.
mycropper
=
null
;
this
.
setData
({
'userInfo.avatar'
:
file
n
ame
,
'userInfo.avatar'
:
file
N
ame
,
})
}
else
{
wx
.
hideLoading
();
...
...
src/pages/setting/userinfoupdate.wxml
View file @
80a0d76d
...
...
@@ -4,7 +4,7 @@
<view class="listitem">
<text class="listtitle">头像</text>
<view class="listcontent" bindtap="proMainImgUpload">
<image class="avatar" src="{{filter.imagify(userInfo.avatar, 'image/resize,w_320/format,jpg/quality,q_50')}}" wx:if="{{userInfo.avatar}}"></image>
<image class="avatar"
mode="aspectFill"
src="{{filter.imagify(userInfo.avatar, 'image/resize,w_320/format,jpg/quality,q_50')}}" wx:if="{{userInfo.avatar}}"></image>
<image class="avatar" src="{{imageRoot}}2c/ucenter2/empty_avatar.png?{{imageVersion}}" wx:else></image>
<image class="arrowsmall" src="{{imageRoot}}2b/organizationalmgt/right.png?{{imageVersion}}"></image>
</view>
...
...
src/pages/teacherpclogin/index.js
View file @
80a0d76d
// src/pages/activityindex/index.js
import
{
wxChooseImage
,
wxUploadFile
}
from
'../../../utilities/wxApi.js'
;
import
{
...
...
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