|
@@ -7,7 +7,7 @@
|
|
|
/>
|
|
|
|
|
|
<h1>
|
|
|
- {{ timeList[activeTimeIdx].name }}
|
|
|
+ {{ timeNameList[activeTimeIdx] }}
|
|
|
</h1>
|
|
|
<menu>
|
|
|
<img
|
|
@@ -24,7 +24,7 @@
|
|
|
>
|
|
|
<ul>
|
|
|
<li
|
|
|
- v-for="(time, idx) in timeList"
|
|
|
+ v-for="(time, idx) in timeNameList"
|
|
|
:key="idx"
|
|
|
:class="{active: activeTimeIdx === idx}"
|
|
|
@click="onClickTimeItem(idx)"
|
|
@@ -32,7 +32,7 @@
|
|
|
<div
|
|
|
class="point"
|
|
|
/>
|
|
|
- {{ time.name }}
|
|
|
+ {{ time }}
|
|
|
</li>
|
|
|
</ul>
|
|
|
</menu>
|
|
@@ -46,6 +46,13 @@
|
|
|
draggable="false"
|
|
|
>
|
|
|
<div class="txt-wrapper">
|
|
|
+ <img
|
|
|
+ v-show="articleBannerUrl"
|
|
|
+ class="banner"
|
|
|
+ :src="articleBannerUrl"
|
|
|
+ alt=""
|
|
|
+ draggable="false"
|
|
|
+ >
|
|
|
<div
|
|
|
class="txt"
|
|
|
v-html="articleDesc"
|
|
@@ -56,7 +63,7 @@
|
|
|
@click="onClickLeftArrow"
|
|
|
/>
|
|
|
<button
|
|
|
- v-show="activeTimeIdx !== timeList.length - 1"
|
|
|
+ v-show="activeTimeIdx !== timeNameList.length - 1"
|
|
|
class="right"
|
|
|
@click="onClickRightArrow"
|
|
|
/>
|
|
@@ -78,6 +85,7 @@ import {
|
|
|
onMounted,
|
|
|
onBeforeUnmount,
|
|
|
computed,
|
|
|
+ watch,
|
|
|
} from 'vue'
|
|
|
|
|
|
export default {
|
|
@@ -85,120 +93,30 @@ export default {
|
|
|
setup () {
|
|
|
const myIframe = ref(null)
|
|
|
|
|
|
- const timeList = reactive([
|
|
|
- {
|
|
|
- name: '开埠通商',
|
|
|
- desc: '开埠通商的描述开埠通商的描述开埠通商的描述开埠通商的描述开埠通商的描述开埠通商的描述开埠通商的描述',
|
|
|
- corps: [
|
|
|
- {
|
|
|
- name: '李鸿章',
|
|
|
- brand: '创办江南制造局、上海机器织布局。',
|
|
|
- desc: '',
|
|
|
- story: '江南制造总局:中国民族工业从此起步;上海机器织布局:开创中国近代纺织业之先河。',
|
|
|
- importance: 30,
|
|
|
- id: '1'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '徐寿',
|
|
|
- brand: '上海江南制造总局',
|
|
|
- desc: '清代著名科学家,上海江南制造总局襄办。',
|
|
|
- story: '',
|
|
|
- importance: 40,
|
|
|
- id: '2'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '刘永康',
|
|
|
- brand: '正泰橡皮物品制造厂',
|
|
|
- desc: '创办正泰橡皮物品制造厂,首创“回力”商标。',
|
|
|
- story: '',
|
|
|
- importance: 50,
|
|
|
- id: '3'
|
|
|
- },
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '曲折发展',
|
|
|
- desc: '曲折发展的描述曲折发展的描述曲折发展的描述曲折发展的描述曲折发展的描述曲折发展的描述曲折发展的描述曲折发展的描述',
|
|
|
- corps: [
|
|
|
- {
|
|
|
- name: '黄佐卿',
|
|
|
- brand: '裕晋纱厂',
|
|
|
- desc: '1895年投资的裕晋纱厂在上海杨树浦路落成并开工投产',
|
|
|
- story: '',
|
|
|
- importance: 30,
|
|
|
- id: '1'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '孙多森、孙多鑫',
|
|
|
- brand: '阜丰面粉厂',
|
|
|
- desc: '1900年集资创办上海第一家民族机器面粉厂“阜丰面粉厂”',
|
|
|
- story: '孙氏通、孚、丰集团:官办企业转化为民族资本企业的典型。',
|
|
|
- importance: 30,
|
|
|
- id: '2'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '严裕棠',
|
|
|
- brand: '大隆机器厂',
|
|
|
- desc: '1902年开办的大隆机器厂',
|
|
|
- story: '',
|
|
|
- importance: 30,
|
|
|
- id: '3'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '张士德、刘致祥',
|
|
|
- brand: '中国精益眼镜公司',
|
|
|
- desc: '1911年集资开设中国精益眼镜公司',
|
|
|
- story: '',
|
|
|
- importance: 30,
|
|
|
- id: '4'
|
|
|
- },
|
|
|
- {
|
|
|
- name: '荣宗敬、荣德生',
|
|
|
- brand: '第一家面粉厂、申新纺织公司',
|
|
|
- desc: '第一家面粉厂,1915年,荣氏兄弟又创建申新纺织公司,人称“棉纱大王”。1919年至1921年,又发起和参与了上海华商面粉交易所、纱布交易所,成为上海民族工业的重要台柱之一。',
|
|
|
- story: '荣氏企业:上海民族工业的重要台柱之一。',
|
|
|
- importance: 30,
|
|
|
- id: '5'
|
|
|
- },
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '步履维艰',
|
|
|
- desc: '',
|
|
|
- corps: [
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '筚路蓝缕',
|
|
|
- desc: '',
|
|
|
- corps: [
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '改革开放',
|
|
|
- desc: '',
|
|
|
- corps: [
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '战略负重',
|
|
|
- desc: '',
|
|
|
- corps: [
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '创新驱动',
|
|
|
- desc: '',
|
|
|
- corps: [
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- name: '追梦未来',
|
|
|
- desc: '',
|
|
|
- corps: [
|
|
|
- ]
|
|
|
- },
|
|
|
- ])
|
|
|
+ const timeNameList = [
|
|
|
+ '开埠通商',
|
|
|
+ '曲折发展',
|
|
|
+ '步履维艰',
|
|
|
+ '筚路蓝缕',
|
|
|
+ '改革开放',
|
|
|
+ '战略负重',
|
|
|
+ '创新驱动',
|
|
|
+ '追梦未来',
|
|
|
+ ]
|
|
|
+ const timeDescList = [
|
|
|
+ '开埠通商的描述开埠通商的描述开埠通商的描述开埠通商的描述开埠通商的描述',
|
|
|
+ '曲折发展的描述曲折发展的描述曲折发展的描述曲折发展的描述曲折发展的描述',
|
|
|
+ '步履维艰的描述步履维艰的描述步履维艰的描述步履维艰的描述步履维艰的描述',
|
|
|
+ '筚路蓝缕的描述筚路蓝缕的描述筚路蓝缕的描述筚路蓝缕的描述筚路蓝缕的描述',
|
|
|
+ '改革开放的描述改革开放的描述改革开放的描述改革开放的描述改革开放的描述',
|
|
|
+ '战略负重的描述战略负重的描述战略负重的描述战略负重的描述战略负重的描述',
|
|
|
+ '创新驱动的描述创新驱动的描述创新驱动的描述创新驱动的描述创新驱动的描述',
|
|
|
+ '追梦未来的描述追梦未来的描述追梦未来的描述追梦未来的描述追梦未来的描述',
|
|
|
+ ]
|
|
|
+ const corpList = reactive({
|
|
|
+ value: [],
|
|
|
+ })
|
|
|
+
|
|
|
const activeTimeIdx = ref(0)
|
|
|
function onClickLeftArrow() {
|
|
|
if (activeTimeIdx.value > 0) {
|
|
@@ -206,39 +124,59 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
function onClickRightArrow() {
|
|
|
- if (activeTimeIdx.value < timeList.length - 1) {
|
|
|
+ if (activeTimeIdx.value < timeNameList.length - 1) {
|
|
|
activeTimeIdx.value++
|
|
|
}
|
|
|
}
|
|
|
+ watch(activeTimeIdx, async (newV) => {
|
|
|
+ if (document.getElementById('iframe-echart')?.contentWindow?.changeTime) {
|
|
|
+ document.getElementById('iframe-echart').contentWindow.changeTime(newV)
|
|
|
+ }
|
|
|
+ corpList.value = await api.getHistoryList({ stage: timeNameList[newV] })
|
|
|
+ }, { immediate: true })
|
|
|
+
|
|
|
const activeCorpId = ref('')
|
|
|
const articleTitle = computed(() => {
|
|
|
if (activeCorpId.value === '') {
|
|
|
return ''
|
|
|
- } else if (activeCorpId.value === '0') {
|
|
|
- return timeList[activeTimeIdx.value].name
|
|
|
+ } else if (activeCorpId.value === 'time-node') {
|
|
|
+ return timeNameList[activeTimeIdx.value]
|
|
|
} else {
|
|
|
- const targetCorp = timeList[activeTimeIdx.value].corps.find((item) => {
|
|
|
- return item.id === activeCorpId.value
|
|
|
+ const targetCorp = corpList.value.find((item) => {
|
|
|
+ return item.id.toString() === activeCorpId.value.toString()
|
|
|
})
|
|
|
- return targetCorp?.brand
|
|
|
+ return targetCorp?.companyName || ''
|
|
|
}
|
|
|
})
|
|
|
const articleDesc = computed(() => {
|
|
|
if (activeCorpId.value === '') {
|
|
|
return ''
|
|
|
- } else if (activeCorpId.value === '0') {
|
|
|
- return timeList[activeTimeIdx.value].desc
|
|
|
+ } else if (activeCorpId.value === 'time-node') {
|
|
|
+ return timeDescList[activeTimeIdx.value]
|
|
|
} else {
|
|
|
- const targetCorp = timeList[activeTimeIdx.value].corps.find((item) => {
|
|
|
- return item.id === activeCorpId.value
|
|
|
+ const targetCorp = corpList.value.find((item) => {
|
|
|
+ return item.id.toString() === activeCorpId.value.toString()
|
|
|
})
|
|
|
- return targetCorp?.desc || targetCorp?.story
|
|
|
+ return targetCorp?.description || targetCorp?.story || ''
|
|
|
}
|
|
|
})
|
|
|
+ const articleBannerUrl = ref('')
|
|
|
+ watch(activeCorpId, async (newV) => {
|
|
|
+ if (newV === '') {
|
|
|
+ articleBannerUrl.value = ''
|
|
|
+ } else if (newV === 'time-node') {
|
|
|
+ articleBannerUrl.value = ''
|
|
|
+ } else {
|
|
|
+ const corpDetail = await api.getHistoryDetail(newV)
|
|
|
+ articleBannerUrl.value = corpDetail?.file[0]?.filePath ? process.env.VUE_APP_API_ORIGIN + corpDetail?.file[0]?.filePath : ''
|
|
|
+ }
|
|
|
+ })
|
|
|
+ watch(activeTimeIdx, () => {
|
|
|
+ articleBannerUrl.value = ''
|
|
|
+ })
|
|
|
function onClickTimeItem(idx) {
|
|
|
activeTimeIdx.value = idx
|
|
|
activeCorpId.value = ''
|
|
|
- document.getElementById('iframe-echart').contentWindow.changeTime(idx)
|
|
|
}
|
|
|
|
|
|
function onIframeMessage(e) {
|
|
@@ -255,13 +193,14 @@ export default {
|
|
|
})
|
|
|
|
|
|
return {
|
|
|
- timeList,
|
|
|
+ timeNameList,
|
|
|
activeTimeIdx,
|
|
|
onClickLeftArrow,
|
|
|
onClickRightArrow,
|
|
|
activeCorpId,
|
|
|
articleTitle,
|
|
|
articleDesc,
|
|
|
+ articleBannerUrl,
|
|
|
onClickTimeItem,
|
|
|
}
|
|
|
}
|
|
@@ -443,10 +382,19 @@ export default {
|
|
|
position: relative;
|
|
|
padding-left: 40px;
|
|
|
padding-right: 35px;
|
|
|
+ min-height: 40px;
|
|
|
+ &::-webkit-scrollbar { background: transparent; width: 4px; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
|
|
|
+ &::-webkit-scrollbar-thumb {
|
|
|
+ background: rgba(220, 231, 240, 0.2);
|
|
|
+ border-radius: 2px;
|
|
|
+ }
|
|
|
+ > img.banner {
|
|
|
+ width: 100%;
|
|
|
+ max-height: 300px;
|
|
|
+ object-fit: contain;
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
>.txt {
|
|
|
- min-height: 40px;
|
|
|
- max-height: 500px;
|
|
|
- overflow: auto;
|
|
|
font-size: 20px;
|
|
|
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
|
|
|
font-weight: 400;
|
|
@@ -454,11 +402,7 @@ export default {
|
|
|
line-height: 23px;
|
|
|
padding-right: 10px;
|
|
|
margin-right: -10px;
|
|
|
- &::-webkit-scrollbar { background: transparent; width: 4px; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
|
|
|
- &::-webkit-scrollbar-thumb {
|
|
|
- background: rgba(220, 231, 240, 0.2);
|
|
|
- border-radius: 2px;
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
>button {
|
|
|
width: 36px;
|