Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
educationStu
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
向伟
educationStu
Commits
daadfd14
Commit
daadfd14
authored
Aug 16, 2021
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
2a24d8e8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
208 additions
and
70 deletions
+208
-70
index.js
src/api/index.js
+13
-1
askForLeave.vue
src/pages/course/askForLeave.vue
+32
-28
chapter.vue
src/pages/course/chapter.vue
+3
-1
timeTable.vue
src/pages/course/timeTable.vue
+16
-10
login.vue
src/pages/login/login.vue
+1
-1
index.js
src/utils/index.js
+143
-29
No files found.
src/api/index.js
View file @
daadfd14
...
...
@@ -85,7 +85,7 @@ export function getStundentSurplus(data) {
}
/**
* 学生
申请请假
* 学生
请假申请
* @param {JSON参数} data
*/
export
function
setStudentLeave
(
data
)
{
...
...
@@ -94,4 +94,16 @@ export function setStudentLeave(data) {
method
:
'post'
,
data
})
}
/**
* 学生请假列表
* @param {JSON参数} data
*/
export
function
getStudentLeaveList
(
data
)
{
return
request
({
url
:
'/AppletIndex/GetEducationReceiptPage'
,
method
:
'post'
,
data
})
}
\ No newline at end of file
src/pages/course/askForLeave.vue
View file @
daadfd14
...
...
@@ -96,8 +96,20 @@
v-if=
"checkboxListAll.length > 2"
@
click=
"showAllCheck"
>
<van-icon
name=
"arrow-down"
v-if=
"!isShowAllCheck"
/>
<van-icon
name=
"arrow-up"
v-if=
"isShowAllCheck"
/>
<van-divider
contentPosition=
"center"
style=
"width: 90%"
v-if=
"isShowAllCheck"
>
<van-icon
name=
"arrow-up"
color=
"#00ACF9"
/>
</van-divider>
<van-divider
contentPosition=
"center"
style=
"width: 90%"
v-if=
"!isShowAllCheck"
>
<van-icon
name=
"arrow-down"
color=
"#00ACF9"
/>
</van-divider>
</view>
</view>
<view
class=
"cell-2 flex flex_between_center"
>
...
...
@@ -133,17 +145,16 @@
multiple
accept=
"all"
:file-list=
"fileList"
image-fit=
"aspectFill"
preview-size=
"120rpx"
@
after-read=
"customUpload"
@
delete=
"deleteFile"
/>
</view>
</view>
<van-button
block
custom-class=
"submit-btn"
@
click=
"submitLeave"
>
提交
</van-button
>
<!--
<van-button
block
custom-class=
"submit-btn"
@
click=
"uniimage"
>
unippimg
</van-button
>
-->
</view>
</
template
>
...
...
@@ -160,7 +171,7 @@ import {
inject
,
}
from
"vue"
;
import
{
getdate
}
from
"../../utils/date"
;
import
{
upload
}
from
"../../utils/index"
;
import
{
upload
File
}
from
"../../utils/index"
;
import
{
getStundentPlanStatistical
,
setStudentLeave
}
from
"../../api/index"
;
let
{
ClassId
}
=
uni
.
getStorageSync
(
"indexData"
);
export
default
{
...
...
@@ -195,13 +206,6 @@ export default {
fileList
:
[
{
url
:
"https://img.yzcdn.cn/vant/leaf.jpg"
,
status
:
"uploading"
,
message
:
"上传中"
,
},
{
url
:
"https://img.yzcdn.cn/vant/tree.jpg"
,
status
:
"failed"
,
message
:
"上传失败"
,
},
],
totalLeaveTimes
:
0
,
...
...
@@ -228,7 +232,6 @@ export default {
//选择请假类型
onSelect
(
val
)
{
data
.
data
.
type
=
val
.
detail
.
name
;
console
.
log
(
"214"
,
val
);
data
.
showType
=
false
;
data
.
leaveMsg
.
LeaveType
=
val
.
detail
.
id
;
},
...
...
@@ -263,7 +266,6 @@ export default {
// 请假理由
reason
(
val
)
{
data
.
leaveMsg
.
Remarks
=
val
.
detail
;
console
.
log
(
"239"
,
data
.
leaveMsg
);
},
//课程多选
checkChange
(
val
)
{
...
...
@@ -303,28 +305,28 @@ export default {
},
customUpload
(
event
)
{
const
{
file
}
=
event
.
detail
;
upload
(
file
,
(
res
)
=>
{
console
.
log
(
"305s"
,
res
);
console
.
log
(
"295"
,
file
);
uploadFile
(
"stuLeave"
,
file
,
(
res
)
=>
{
console
.
log
(
"297"
,
res
);
data
.
fileList
.
push
(
res
);
});
},
deleteFile
(
event
)
{
let
index
=
event
.
detail
.
index
;
data
.
fileList
.
splice
(
index
,
1
);
},
async
submitLeave
()
{
if
(
data
.
leaveMsg
.
LeaveInfoList
.
length
===
0
)
{
Toast
(
"至少选择一节课程"
);
return
;
}
data
.
leaveMsg
.
ReceiptFileList
=
[];
data
.
fileList
.
map
((
item
)
=>
{
data
.
leaveMsg
.
ReceiptFileList
.
push
(
item
.
url
);
});
let
res
=
await
setStudentLeave
(
data
.
leaveMsg
);
console
.
log
(
"293"
,
res
);
},
uniimage
()
{
uni
.
chooseImage
({
count
:
6
,
//默认9
sizeType
:
[
"original"
,
"compressed"
],
//可以指定是原图还是压缩图,默认二者都有
sourceType
:
[
"album"
],
//从相册选择
success
:
function
(
res
)
{
console
.
log
(
JSON
.
stringify
(
res
.
tempFilePaths
));
},
});
},
};
watch
(
data
.
checkboxVal
,
(
newVal
)
=>
{
data
.
totalLeaveTimes
=
0
;
...
...
@@ -349,7 +351,6 @@ export default {
});
});
});
console
.
log
(
"296"
,
data
.
leaveMsg
);
});
onMounted
(()
=>
{
that
.
getCourseTime
();
...
...
@@ -476,4 +477,7 @@ export default {
font-weight
:
500
;
color
:
#666
;
}
/
deep
/
.van-divider
{
margin
:
0
auto
;
}
</
style
>
src/pages/course/chapter.vue
View file @
daadfd14
...
...
@@ -3,7 +3,9 @@
<view
class=
"info"
>
<view
class=
"info-top flex flex_start_center"
>
<view
class=
"left-icon"
></view>
<view
class=
"wrapper-title"
>
{{
data
.
node
.
ChapterName
}}
</view>
<view
class=
"wrapper-title one_line"
>
{{
data
.
node
.
ChapterName
}}
</view>
</view>
<view
class=
"info-main"
>
<view
class=
"flex flex flex_start_center wrapper-section"
>
...
...
src/pages/course/timeTable.vue
View file @
daadfd14
...
...
@@ -71,19 +71,22 @@
</view>
<view
class=
"isToday"
v-if=
"item.isToday === 1"
>
今天
</view>
</view>
<view
class=
"openorclose flex flex_center_center"
>
<van-icon
name=
"arrow-up"
color=
"#00ACF9"
@
click=
"changeCalendar"
<van-divider
contentPosition=
"center"
style=
"width: 90%"
v-if=
"isShowAllDay"
/>
<van-icon
name=
"arrow-down"
color=
"#00ACF9"
@
click=
"changeCalendar"
>
<van-icon
name=
"arrow-up"
color=
"#00ACF9"
@
click=
"changeCalendar"
/>
</van-divider>
<van-divider
contentPosition=
"center"
style=
"width: 90%"
v-if=
"!isShowAllDay"
/>
>
<van-icon
name=
"arrow-down"
color=
"#00ACF9"
@
click=
"changeCalendar"
/>
</van-divider>
</view>
</view>
<view
class=
"Timetable-box"
>
...
...
@@ -336,4 +339,7 @@ export default {
font-weight
:
800
;
color
:
#111111
;
}
/
deep
/
.van-divider
{
margin
:
0
auto
;
}
</
style
>
src/pages/login/login.vue
View file @
daadfd14
...
...
@@ -132,7 +132,7 @@ export default {
Toast
.
success
(
"登录成功"
);
setTimeout
(()
=>
{
that
.
jumpPage
();
},
5
00
);
},
10
00
);
}
},
getunionid
(
code
)
{
...
...
src/utils/index.js
View file @
daadfd14
...
...
@@ -17,39 +17,15 @@ export let desensitization = (str, beginLen, endLen) => {
return
tempStr
;
}
export
let
upload
=
(
file
,
successCallback
)
=>
{
let
{
UploadConfig
}
=
uni
.
getStorageSync
(
'userInfo'
)
export
let
uploadFile
=
(
path
,
file
,
successCallback
)
=>
{
for
(
let
i
=
0
;
i
<
file
.
length
;
i
++
)
{
urlTobase64
(
file
[
i
].
url
,
(
base64Str
)
=>
{
console
.
log
(
23
,
base64Str
)
uni
.
uploadFile
({
url
:
UploadConfig
.
UploadDomain
+
"/UploadBase64"
,
filePath
:
base64Str
,
name
:
'myfile'
,
success
(
res
)
{
successCallback
(
res
.
data
)
},
fail
(
err
)
{
console
.
log
(
"uploadErr"
,
err
)
}
});
})
UploadSelfFile
(
path
,
file
[
i
],
successCallback
)
}
}
// let strTobase64 = (str) => {
// var buf = new ArrayBuffer(str.length * 2);
// var bufView = new Uint16Array(buf);
// for (var i = 0, strlen = str.length; i < strlen; i++) {
// bufView[i] = str.charCodeAt(i);
// }
// var base64 = uni.arrayBufferToBase64(buf);
// base64 = 'data:image/jpeg;base64,' + base64;
// return base64;
// }
let
urlTobase64
=
(
file
,
suc
)
=>
{
//获取base64格式路径
export
let
urlTobase64
=
(
file
,
suc
)
=>
{
uni
.
getFileSystemManager
().
readFile
({
filePath
:
file
,
//选择图片返回的相对路径
encoding
:
'base64'
,
//编码格式
...
...
@@ -59,4 +35,142 @@ let urlTobase64 = (file, suc) => {
suc
(
base64
);
}
});
}
\ No newline at end of file
}
/**
* 上传文件
*/
export
function
UploadSelfFile
(
path
,
file
,
callback
,
configObj
)
{
//用户登录缓存
var
cacheInfo
=
uni
.
getStorageSync
(
"userInfo"
)
//上传配置
var
uploadConfig
=
""
;
if
(
cacheInfo
&&
cacheInfo
.
UploadConfig
)
{
uploadConfig
=
cacheInfo
.
UploadConfig
;
}
//获取文件扩展名
var
index
=
file
.
name
.
lastIndexOf
(
"."
);
var
suffix
=
file
.
name
.
substr
(
index
);
var
timestamp1
=
Date
.
parse
(
new
Date
())
+
"_"
+
(
Math
.
ceil
(
Math
.
random
()
*
1000
));
let
str
=
'/Test'
;
var
newPath
=
"/EduSystem"
+
str
+
'/Upload/'
+
path
;
uni
.
showLoading
({
title
:
'文件上传中...'
});
if
(
uploadConfig
)
{
switch
(
uploadConfig
.
StoreType
)
{
//上传文件到腾讯云
case
1
:
newPath
+=
"/"
+
timestamp1
+
""
+
suffix
;
UploadFileToTencent
(
uploadConfig
,
newPath
,
file
,
callback
);
break
;
//上传文件到阿里云
case
2
:
newPath
+=
"/"
+
timestamp1
+
""
+
suffix
;
UploadFileToALi
(
uploadConfig
,
newPath
,
file
,
callback
);
break
;
//上传文件到自己文件服务器
case
3
:
UploadFileToSystem
(
uploadConfig
,
newPath
,
file
,
callback
,
configObj
);
break
;
}
}
}
/**
* 上传文件到本地文件系统
*/
export
function
UploadFileToSystem
(
uploadConfig
,
fileFullPath
,
fileObj
,
successCall
,
configObj
)
{
let
url
=
uploadConfig
.
UploadDomain
+
"/Upload?filePath="
+
fileFullPath
;
if
(
configObj
)
{
//是否转换图片
if
(
configObj
.
isTrans
&&
configObj
.
isTrans
==
1
)
{
url
+=
"&isTrans=1"
}
if
(
configObj
.
isCreateCover
&&
configObj
.
isCreateCover
==
1
)
{
url
+=
"&isCreateCover=1"
}
}
uni
.
uploadFile
({
url
:
url
,
filePath
:
fileObj
.
url
,
name
:
'file'
,
formData
:
{
'myfile'
:
fileObj
},
success
(
res
)
{
uni
.
hideLoading
();
let
jsonObj
=
JSON
.
parse
(
res
.
data
)
let
index
=
jsonObj
.
FilePath
.
indexOf
(
"."
)
let
suffix
=
jsonObj
.
FilePath
.
slice
(
index
+
1
)
let
uploadResult
=
{
name
:
fileObj
.
name
,
url
:
uploadConfig
.
CustomDomain
+
'/'
+
jsonObj
.
FilePath
,
type
:
fileObj
.
type
,
suffix
:
suffix
,
// VideoCoverImg: uploadConfig.CustomDomain + jsonObj.VideoCoverImg,
}
successCall
(
uploadResult
);
},
fail
(
err
)
{
console
.
log
(
"uploadErr"
,
err
)
}
});
}
/**
* 上传文件到阿里云
*/
export
function
UploadFileToALi
(
uploadConfig
,
fileFullPath
,
fileObj
,
successCall
)
{
// var OSS = require('ali-oss');
// var oss = new OSS({
// region: uploadConfig.Region,
// accessKeyId: uploadConfig.SecretId,
// accessKeySecret: uploadConfig.SecretKey,
// bucket: uploadConfig.Bucket
// })
// var result = oss.multipartUpload(fileFullPath, fileObj, {
// progress: function* (p) { }
// }).then(res => {
// uni.hideLoading()
// var uploadResult = {
// Code: 1,
// FileName: fileObj.name,
// FileUrl: res.res.requestUrls[0].split('?')[0].replace('http', 'https')
// }
// if (successCall) {
// successCall(uploadResult);
// }
// })
}
/**
* 上传文件到腾讯云
*/
export
function
UploadFileToTencent
(
uploadConfig
,
fileFullPath
,
fileObj
,
successCall
)
{
// var COS = require('cos-js-sdk-v5');
// var cos = new COS({
// SecretId: uploadConfig.SecretId,
// SecretKey: uploadConfig.SecretKey,
// });
// cos.putObject({
// Bucket: uploadConfig.Bucket,
// Region: uploadConfig.Region, //存储桶所在地域,必须字段
// Key: fileFullPath, //文件名
// StorageClass: 'STANDARD',
// Body: fileObj, // 上传文件对象
// onProgress: function (progressData) { }
// }, function (err, data) {
// uni.hideLoading()
// if (data && data.statusCode == 200) {
// var uploadResult = {
// Code: 1,
// FileName: fileObj.name,
// FileUrl: "https://" + data.Location
// }
// if (successCall) {
// successCall(uploadResult);
// }
// } else {
// /*上传文件异常*/
// console.log(err || data);
// }
// });
}
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