|
@@ -658,7 +658,7 @@ export default {
|
|
|
const startEl = (sourceEl && sourceEl.nodeType === 1)
|
|
const startEl = (sourceEl && sourceEl.nodeType === 1)
|
|
|
? sourceEl
|
|
? sourceEl
|
|
|
: this.getGrabSourceEl();
|
|
: this.getGrabSourceEl();
|
|
|
- const animPromise = this.createGrabAnimation(startEl);
|
|
|
|
|
|
|
+ const animPromise = this.createGrabAnimation(startEl, item);
|
|
|
// 3. 从 region 分区列表中移除该条数据
|
|
// 3. 从 region 分区列表中移除该条数据
|
|
|
this.removeKnowledgeFromPartition(knowledgeId);
|
|
this.removeKnowledgeFromPartition(knowledgeId);
|
|
|
await animPromise;
|
|
await animPromise;
|
|
@@ -679,24 +679,56 @@ export default {
|
|
|
const chartRef = this.$refs.circularDiffusion;
|
|
const chartRef = this.$refs.circularDiffusion;
|
|
|
return (chartRef && chartRef.$refs && chartRef.$refs.grabSourceEl) || null;
|
|
return (chartRef && chartRef.$refs && chartRef.$refs.grabSourceEl) || null;
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按知识点类型取分区条目的背景色 / 边框色
|
|
|
|
|
+ * 1薄弱 #F2B5B5 / 2能力提升 #F7DEA5 / 3扎实巩固 #AEE2C5 / 其他冲刺 #B9CBFC
|
|
|
|
|
+ */
|
|
|
|
|
+ getZoneGrabTheme(item) {
|
|
|
|
|
+ const t = Number(item && (item.knowledgeType ?? item.type));
|
|
|
|
|
+ if (t === 2) return { backgroundColor: '#FFFFFF', borderColor: '#F7DEA5' };
|
|
|
|
|
+ if (t === 3) return { backgroundColor: '#FFFFFF', borderColor: '#AEE2C5' };
|
|
|
|
|
+ if (t === 4) return { backgroundColor: '#FFFFFF', borderColor: '#B9CBFC' };
|
|
|
|
|
+ return { backgroundColor: '#FFFFFF', borderColor: '#F2B5B5' };
|
|
|
|
|
+ },
|
|
|
/**
|
|
/**
|
|
|
* 抓取飞入动画:从加入练习模块飞向顶部「知识点练习作答」
|
|
* 抓取飞入动画:从加入练习模块飞向顶部「知识点练习作答」
|
|
|
* 起点/终点均用 getBoundingClientRect(相对视口),自动适配页面滚动
|
|
* 起点/终点均用 getBoundingClientRect(相对视口),自动适配页面滚动
|
|
|
|
|
+ * 克隆体带上当前分区条目的背景色和边框色
|
|
|
*/
|
|
*/
|
|
|
- createGrabAnimation(startEl) {
|
|
|
|
|
|
|
+ createGrabAnimation(startEl, item) {
|
|
|
try {
|
|
try {
|
|
|
const endEl = document.querySelector('.js-practice-answer-step');
|
|
const endEl = document.querySelector('.js-practice-answer-step');
|
|
|
if (!startEl || !endEl) return Promise.resolve();
|
|
if (!startEl || !endEl) return Promise.resolve();
|
|
|
|
|
|
|
|
- const startRect = startEl.getBoundingClientRect();
|
|
|
|
|
|
|
+ const visualEl = (startEl.closest && startEl.closest('.knowledge_row')) || startEl;
|
|
|
|
|
+ const startRect = visualEl.getBoundingClientRect();
|
|
|
const endRect = endEl.getBoundingClientRect();
|
|
const endRect = endEl.getBoundingClientRect();
|
|
|
if (!startRect.width || !startRect.height) return Promise.resolve();
|
|
if (!startRect.width || !startRect.height) return Promise.resolve();
|
|
|
|
|
|
|
|
const HOLD_MS = 60;
|
|
const HOLD_MS = 60;
|
|
|
const FLY_MS = 600;
|
|
const FLY_MS = 600;
|
|
|
const FADE_MS = 100;
|
|
const FADE_MS = 100;
|
|
|
|
|
+ const theme = this.getZoneGrabTheme(item);
|
|
|
|
|
+ let backgroundColor = theme.backgroundColor;
|
|
|
|
|
+ let borderColor = theme.borderColor;
|
|
|
|
|
+ let borderRadius = '4px';
|
|
|
|
|
+ const isRow = visualEl.classList && visualEl.classList.contains('knowledge_row');
|
|
|
|
|
+ if (isRow) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const cs = window.getComputedStyle(visualEl);
|
|
|
|
|
+ if (cs.backgroundColor && cs.backgroundColor !== 'rgba(0, 0, 0, 0)' && cs.backgroundColor !== 'transparent') {
|
|
|
|
|
+ backgroundColor = cs.backgroundColor;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (cs.borderColor && cs.borderColor !== 'rgba(0, 0, 0, 0)') {
|
|
|
|
|
+ borderColor = cs.borderColor;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (cs.borderRadius) {
|
|
|
|
|
+ borderRadius = cs.borderRadius;
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (e) {}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- const clone = startEl.cloneNode(true);
|
|
|
|
|
|
|
+ const clone = visualEl.cloneNode(true);
|
|
|
clone.style.position = 'fixed';
|
|
clone.style.position = 'fixed';
|
|
|
clone.style.left = `${startRect.left}px`;
|
|
clone.style.left = `${startRect.left}px`;
|
|
|
clone.style.top = `${startRect.top}px`;
|
|
clone.style.top = `${startRect.top}px`;
|
|
@@ -706,7 +738,9 @@ export default {
|
|
|
clone.style.zIndex = '2000';
|
|
clone.style.zIndex = '2000';
|
|
|
clone.style.transition = `transform ${FLY_MS}ms cubic-bezier(.22,.61,.36,1)`;
|
|
clone.style.transition = `transform ${FLY_MS}ms cubic-bezier(.22,.61,.36,1)`;
|
|
|
clone.style.boxSizing = 'border-box';
|
|
clone.style.boxSizing = 'border-box';
|
|
|
- clone.style.backgroundColor = '#ffffff';
|
|
|
|
|
|
|
+ clone.style.backgroundColor = backgroundColor;
|
|
|
|
|
+ clone.style.border = `1px solid ${borderColor}`;
|
|
|
|
|
+ clone.style.borderRadius = borderRadius;
|
|
|
clone.style.boxShadow = '0 4px 12px rgba(0, 0, 0, 0.3)';
|
|
clone.style.boxShadow = '0 4px 12px rgba(0, 0, 0, 0.3)';
|
|
|
clone.style.overflow = 'hidden';
|
|
clone.style.overflow = 'hidden';
|
|
|
clone.style.pointerEvents = 'none';
|
|
clone.style.pointerEvents = 'none';
|