Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
L
learn-online
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
learn-online
Commits
9acb83d4
提交
9acb83d4
authored
4月 14, 2021
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改我的学分和课程考核页面
上级
1ed818eb
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
269 行增加
和
1 行删除
+269
-1
CourseApi.js
learnOnline/apiService/CourseApi.js
+5
-1
ScoreApi.js
learnOnline/apiService/ScoreApi.js
+1
-0
ec-canvas.js
learnOnline/components/ec-canvas/ec-canvas.js
+250
-0
ec-canvas.json
learnOnline/components/ec-canvas/ec-canvas.json
+5
-0
ec-canvas.wxml
learnOnline/components/ec-canvas/ec-canvas.wxml
+4
-0
ec-canvas.wxss
learnOnline/components/ec-canvas/ec-canvas.wxss
+4
-0
echarts.js
learnOnline/components/ec-canvas/echarts.js
+0
-0
wx-canvas.js
learnOnline/components/ec-canvas/wx-canvas.js
+0
-0
courseAssess.wxml
.../learnSystem/courseContent/courseAssess/courseAssess.wxml
+0
-0
courseAssess.wxss
.../learnSystem/courseContent/courseAssess/courseAssess.wxss
+0
-0
courseContent.js
learnOnline/pages/learnSystem/courseContent/courseContent.js
+0
-0
courseContent.json
...Online/pages/learnSystem/courseContent/courseContent.json
+0
-0
courseContent.wxml
...Online/pages/learnSystem/courseContent/courseContent.wxml
+0
-0
myScore.js
learnOnline/pages/learnSystem/myScore/myScore.js
+0
-0
myScore.wxml
learnOnline/pages/learnSystem/myScore/myScore.wxml
+0
-0
myScore.wxss
learnOnline/pages/learnSystem/myScore/myScore.wxss
+0
-0
project.private.config.json
learnOnline/project.private.config.json
+0
-0
没有找到文件。
learnOnline/apiService/CourseApi.js
浏览文件 @
9acb83d4
...
...
@@ -57,6 +57,7 @@ const getCourseDetail = (id, sid, callback) => {
/* 课程类型 curriculum_elective_type 类型 改为 course_type 吴锚要求 */
let
_type
=
cur
.
course_type
,
str1
=
_type
==
1
?
'必修课'
:
(
_type
==
2
?
'选修课'
:
(
_type
==
3
?
'重修课'
:
''
))
let
json
=
{
course_check_type
:
cur
.
course_check_type
,
headerInfo
:
{
isStart
:
!!
cur
.
selected
,
// 是否为开始学习按钮 或者 选课按钮
id
:
cur
.
course_id
,
...
...
@@ -172,6 +173,7 @@ const getCourseAssess = (cid, sid, callback) => {
arr
:
tempArr
})
}
const
courseCheck
=
cur
.
course_check
.
filter
(
item
=>
item
.
percent
)
let
json
=
{
score
:
cur
.
course_score
,
duration
:
util
.
durationToTimeString
(
cur
.
course_duration
||
0
),
...
...
@@ -182,7 +184,9 @@ const getCourseAssess = (cid, sid, callback) => {
created_time
:
cur
.
essay_evaluation
.
created_time
||
''
,
status
:
cur
.
essay_evaluation
.
status
||
'暂无'
,
score
:
cur
.
essay_evaluation
.
score
||
'暂无'
}
},
course_check
:
courseCheck
,
course_check_pass_score
:
cur
.
course_check_pass_score
}
callback
(
json
)
}
...
...
learnOnline/apiService/ScoreApi.js
浏览文件 @
9acb83d4
...
...
@@ -10,6 +10,7 @@ const getMyScore = (callback) => {
callback
:
function
(
res
)
{
let
_data
=
res
.
data
let
json
=
{
raw
:
_data
,
total
:
_data
.
total_credits
,
myTotal
:
_data
.
my_total_credits
,
myTotalStr
:
_data
.
total_credits
&&
((
_data
.
my_total_credits
*
1.0
/
_data
.
total_credits
*
100
).
toFixed
(
1
)
+
'%'
)
||
'0%'
,
...
...
learnOnline/components/ec-canvas/ec-canvas.js
0 → 100644
浏览文件 @
9acb83d4
import
WxCanvas
from
'./wx-canvas'
;
import
*
as
echarts
from
'./echarts'
;
let
ctx
;
function
compareVersion
(
v1
,
v2
)
{
v1
=
v1
.
split
(
'.'
)
v2
=
v2
.
split
(
'.'
)
const
len
=
Math
.
max
(
v1
.
length
,
v2
.
length
)
while
(
v1
.
length
<
len
)
{
v1
.
push
(
'0'
)
}
while
(
v2
.
length
<
len
)
{
v2
.
push
(
'0'
)
}
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
const
num1
=
parseInt
(
v1
[
i
])
const
num2
=
parseInt
(
v2
[
i
])
if
(
num1
>
num2
)
{
return
1
}
else
if
(
num1
<
num2
)
{
return
-
1
}
}
return
0
}
Component
({
properties
:
{
canvasId
:
{
type
:
String
,
value
:
'ec-canvas'
},
ec
:
{
type
:
Object
},
forceUseOldCanvas
:
{
type
:
Boolean
,
value
:
false
}
},
data
:
{
isUseNewCanvas
:
false
},
ready
:
function
()
{
// Disable prograssive because drawImage doesn't support DOM as parameter
// See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html
echarts
.
registerPreprocessor
(
option
=>
{
if
(
option
&&
option
.
series
)
{
if
(
option
.
series
.
length
>
0
)
{
option
.
series
.
forEach
(
series
=>
{
series
.
progressive
=
0
;
});
}
else
if
(
typeof
option
.
series
===
'object'
)
{
option
.
series
.
progressive
=
0
;
}
}
});
if
(
!
this
.
data
.
ec
)
{
console
.
warn
(
'组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" '
+
'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>'
);
return
;
}
if
(
!
this
.
data
.
ec
.
lazyLoad
)
{
this
.
init
();
}
},
methods
:
{
init
:
function
(
callback
)
{
const
version
=
wx
.
getSystemInfoSync
().
SDKVersion
const
canUseNewCanvas
=
compareVersion
(
version
,
'2.9.0'
)
>=
0
;
const
forceUseOldCanvas
=
this
.
data
.
forceUseOldCanvas
;
const
isUseNewCanvas
=
canUseNewCanvas
&&
!
forceUseOldCanvas
;
this
.
setData
({
isUseNewCanvas
});
if
(
forceUseOldCanvas
&&
canUseNewCanvas
)
{
console
.
warn
(
'开发者强制使用旧canvas,建议关闭'
);
}
if
(
isUseNewCanvas
)
{
// console.log('微信基础库版本大于2.9.0,开始使用<canvas type="2d"/>');
// 2.9.0 可以使用 <canvas type="2d"></canvas>
this
.
initByNewWay
(
callback
);
}
else
{
const
isValid
=
compareVersion
(
version
,
'1.9.91'
)
>=
0
if
(
!
isValid
)
{
console
.
error
(
'微信基础库版本过低,需大于等于 1.9.91。'
+
'参见:https://github.com/ecomfe/echarts-for-weixin'
+
'#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82'
);
return
;
}
else
{
console
.
warn
(
'建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能'
);
this
.
initByOldWay
(
callback
);
}
}
},
initByOldWay
(
callback
)
{
// 1.9.91 <= version < 2.9.0:原来的方式初始化
ctx
=
wx
.
createCanvasContext
(
this
.
data
.
canvasId
,
this
);
const
canvas
=
new
WxCanvas
(
ctx
,
this
.
data
.
canvasId
,
false
);
echarts
.
setCanvasCreator
(()
=>
{
return
canvas
;
});
// const canvasDpr = wx.getSystemInfoSync().pixelRatio // 微信旧的canvas不能传入dpr
const
canvasDpr
=
1
var
query
=
wx
.
createSelectorQuery
().
in
(
this
);
query
.
select
(
'.ec-canvas'
).
boundingClientRect
(
res
=>
{
if
(
typeof
callback
===
'function'
)
{
this
.
chart
=
callback
(
canvas
,
res
.
width
,
res
.
height
,
canvasDpr
);
}
else
if
(
this
.
data
.
ec
&&
typeof
this
.
data
.
ec
.
onInit
===
'function'
)
{
this
.
chart
=
this
.
data
.
ec
.
onInit
(
canvas
,
res
.
width
,
res
.
height
,
canvasDpr
);
}
else
{
this
.
triggerEvent
(
'init'
,
{
canvas
:
canvas
,
width
:
res
.
width
,
height
:
res
.
height
,
canvasDpr
:
canvasDpr
// 增加了dpr,可方便外面echarts.init
});
}
}).
exec
();
},
initByNewWay
(
callback
)
{
// version >= 2.9.0:使用新的方式初始化
const
query
=
wx
.
createSelectorQuery
().
in
(
this
)
query
.
select
(
'.ec-canvas'
)
.
fields
({
node
:
true
,
size
:
true
})
.
exec
(
res
=>
{
const
canvasNode
=
res
[
0
].
node
this
.
canvasNode
=
canvasNode
const
canvasDpr
=
wx
.
getSystemInfoSync
().
pixelRatio
const
canvasWidth
=
res
[
0
].
width
const
canvasHeight
=
res
[
0
].
height
const
ctx
=
canvasNode
.
getContext
(
'2d'
)
const
canvas
=
new
WxCanvas
(
ctx
,
this
.
data
.
canvasId
,
true
,
canvasNode
)
echarts
.
setCanvasCreator
(()
=>
{
return
canvas
})
if
(
typeof
callback
===
'function'
)
{
this
.
chart
=
callback
(
canvas
,
canvasWidth
,
canvasHeight
,
canvasDpr
)
}
else
if
(
this
.
data
.
ec
&&
typeof
this
.
data
.
ec
.
onInit
===
'function'
)
{
this
.
chart
=
this
.
data
.
ec
.
onInit
(
canvas
,
canvasWidth
,
canvasHeight
,
canvasDpr
)
}
else
{
this
.
triggerEvent
(
'init'
,
{
canvas
:
canvas
,
width
:
canvasWidth
,
height
:
canvasHeight
,
dpr
:
canvasDpr
})
}
})
},
canvasToTempFilePath
(
opt
)
{
if
(
this
.
data
.
isUseNewCanvas
)
{
// 新版
const
query
=
wx
.
createSelectorQuery
().
in
(
this
)
query
.
select
(
'.ec-canvas'
)
.
fields
({
node
:
true
,
size
:
true
})
.
exec
(
res
=>
{
const
canvasNode
=
res
[
0
].
node
opt
.
canvas
=
canvasNode
wx
.
canvasToTempFilePath
(
opt
)
})
}
else
{
// 旧的
if
(
!
opt
.
canvasId
)
{
opt
.
canvasId
=
this
.
data
.
canvasId
;
}
ctx
.
draw
(
true
,
()
=>
{
wx
.
canvasToTempFilePath
(
opt
,
this
);
});
}
},
touchStart
(
e
)
{
if
(
this
.
chart
&&
e
.
touches
.
length
>
0
)
{
var
touch
=
e
.
touches
[
0
];
var
handler
=
this
.
chart
.
getZr
().
handler
;
handler
.
dispatch
(
'mousedown'
,
{
zrX
:
touch
.
x
,
zrY
:
touch
.
y
});
handler
.
dispatch
(
'mousemove'
,
{
zrX
:
touch
.
x
,
zrY
:
touch
.
y
});
handler
.
processGesture
(
wrapTouch
(
e
),
'start'
);
}
},
touchMove
(
e
)
{
if
(
this
.
chart
&&
e
.
touches
.
length
>
0
)
{
var
touch
=
e
.
touches
[
0
];
var
handler
=
this
.
chart
.
getZr
().
handler
;
handler
.
dispatch
(
'mousemove'
,
{
zrX
:
touch
.
x
,
zrY
:
touch
.
y
});
handler
.
processGesture
(
wrapTouch
(
e
),
'change'
);
}
},
touchEnd
(
e
)
{
if
(
this
.
chart
)
{
const
touch
=
e
.
changedTouches
?
e
.
changedTouches
[
0
]
:
{};
var
handler
=
this
.
chart
.
getZr
().
handler
;
handler
.
dispatch
(
'mouseup'
,
{
zrX
:
touch
.
x
,
zrY
:
touch
.
y
});
handler
.
dispatch
(
'click'
,
{
zrX
:
touch
.
x
,
zrY
:
touch
.
y
});
handler
.
processGesture
(
wrapTouch
(
e
),
'end'
);
}
}
}
});
function
wrapTouch
(
event
)
{
for
(
let
i
=
0
;
i
<
event
.
touches
.
length
;
++
i
)
{
const
touch
=
event
.
touches
[
i
];
touch
.
offsetX
=
touch
.
x
;
touch
.
offsetY
=
touch
.
y
;
}
return
event
;
}
learnOnline/components/ec-canvas/ec-canvas.json
0 → 100644
浏览文件 @
9acb83d4
{
"component"
:
true
,
"usingComponents"
:
{}
}
\ No newline at end of file
learnOnline/components/ec-canvas/ec-canvas.wxml
0 → 100644
浏览文件 @
9acb83d4
<!-- 新的:接口对其了H5 -->
<canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
<!-- 旧的 -->
<canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas>
learnOnline/components/ec-canvas/ec-canvas.wxss
0 → 100644
浏览文件 @
9acb83d4
.ec-canvas {
width: 100%;
height: 100%;
}
learnOnline/components/ec-canvas/echarts.js
0 → 100644
浏览文件 @
9acb83d4
This source diff could not be displayed because it is too large. You can
view the blob
instead.
learnOnline/components/ec-canvas/wx-canvas.js
0 → 100644
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
learnOnline/pages/learnSystem/courseContent/courseAssess/courseAssess.wxml
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
learnOnline/pages/learnSystem/courseContent/courseAssess/courseAssess.wxss
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
learnOnline/pages/learnSystem/courseContent/courseContent.js
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
learnOnline/pages/learnSystem/courseContent/courseContent.json
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
learnOnline/pages/learnSystem/courseContent/courseContent.wxml
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
learnOnline/pages/learnSystem/myScore/myScore.js
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
learnOnline/pages/learnSystem/myScore/myScore.wxml
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
learnOnline/pages/learnSystem/myScore/myScore.wxss
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
learnOnline/project.private.config.json
0 → 100644
浏览文件 @
9acb83d4
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论