|
@@ -18,6 +18,12 @@ import Huajuan from "./components/huajuan";
|
|
|
import { OBJLoader } from "three/examples/jsm/loaders/OBJLoader.js";
|
|
|
import { MTLLoader } from "three/examples/jsm/loaders/MTLLoader.js";
|
|
|
|
|
|
+import { Hotspot } from "./utils/index";
|
|
|
+
|
|
|
+
|
|
|
+import Toast from "./components/Toast";
|
|
|
+
|
|
|
+
|
|
|
import {
|
|
|
loading_bg,
|
|
|
img_culture,
|
|
@@ -25,7 +31,9 @@ import {
|
|
|
label_title,
|
|
|
logo,
|
|
|
ico_up,
|
|
|
- ico_down,
|
|
|
+ lxuliezhen,
|
|
|
+ xuliezhen1,
|
|
|
+ xuliezhen2,
|
|
|
img_manshouxing,
|
|
|
img_shouxinger,
|
|
|
img_shouxingniu,
|
|
@@ -34,12 +42,29 @@ import {
|
|
|
img_texture,
|
|
|
ico_change_active,
|
|
|
ico_change_normal,
|
|
|
+ ico_history_active,
|
|
|
+ ico_history_normal,
|
|
|
+ ico_painting_active,
|
|
|
+ ico_painting_normal,
|
|
|
+ ico_visual_active,
|
|
|
+ ico_visual_normal,
|
|
|
line_boat,
|
|
|
line_friends,
|
|
|
line_mount,
|
|
|
- imgtext
|
|
|
+ imgtext,
|
|
|
+ ico_back,
|
|
|
+ huaxueqingliao,
|
|
|
+ zhumingqing,
|
|
|
+ zheliao,
|
|
|
+ sumaliqing,
|
|
|
+ shiziqing,
|
|
|
+ huiqing,
|
|
|
+ pingdengqing,
|
|
|
+ ico_cancel
|
|
|
+
|
|
|
+
|
|
|
} from "./assets/images/loadImg.js";
|
|
|
-import Toast from "./components/Toast/index";
|
|
|
+import Scale from "./components/LongImageSequence/scale";
|
|
|
|
|
|
|
|
|
function App() {
|
|
@@ -62,7 +87,11 @@ function App() {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
let container = null, containerW = 0, containerH = 0,
|
|
|
+
|
|
|
+ hotspots = useRef<any[]>([]),
|
|
|
+
|
|
|
emissiveTexture = useRef<THREE.Texture>(),
|
|
|
scene: THREE.Scene,
|
|
|
startMouse = useRef<THREE.Vector2>(new THREE.Vector2(0, 0)),
|
|
@@ -71,6 +100,12 @@ function App() {
|
|
|
showInfoRef = useRef<Boolean>(false),
|
|
|
isOpenPingGai = useRef<Boolean>(false),
|
|
|
|
|
|
+ canHandleHotspot = useRef<Boolean>(false),
|
|
|
+
|
|
|
+ canAction = useRef<Boolean>(false),
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
camera = useRef<THREE.Camera | THREE.PerspectiveCamera>(),
|
|
|
rafId: number,
|
|
|
textrueLoader = useRef<THREE.TextureLoader>(new THREE.TextureLoader()),
|
|
@@ -102,43 +137,246 @@ function App() {
|
|
|
}
|
|
|
]
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ const colors = [
|
|
|
+
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ key: '苏麻离青',
|
|
|
+ age: '元代后期-明永宣时期',
|
|
|
+ img: sumaliqing,
|
|
|
+ textrue: '发色浓重青翠,有“铁锈斑痕”,“锡光”'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ key: '平等青',
|
|
|
+ img: pingdengqing,
|
|
|
+ age: '明成弘时期',
|
|
|
+ textrue: '发色灰蓝淡雅、青亮、稳定'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ img: huiqing,
|
|
|
+ key: '回青',
|
|
|
+ age: '明嘉万时期',
|
|
|
+ textrue: '发色清幽泛紫,单独使用浑散不收,多于石子青混合使用'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 4,
|
|
|
+ img: zheliao,
|
|
|
+ key: '浙料',
|
|
|
+ age: '明万历中期-清代',
|
|
|
+ textrue: '发色青翠艳丽明亮,无铁锈斑痕'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 5,
|
|
|
+ img: shiziqing,
|
|
|
+ key: '石子青',
|
|
|
+ age: '明清二代民窑使用',
|
|
|
+ textrue: '发色蓝中带黑,灰暗,一般与回青混合使用'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 6,
|
|
|
+ img: zhumingqing,
|
|
|
+ key: '珠明青',
|
|
|
+ age: '清康熙时期',
|
|
|
+ textrue: '发色正蓝,明丽纯正,如蓝宝石般明亮'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 7,
|
|
|
+ img: huaxueqingliao,
|
|
|
+ key: '化学青料',
|
|
|
+ age: '现代发明的人工青料',
|
|
|
+ textrue: '发色紫蓝,纯粹,浓艳但轻浮而缺乏附着力,容易飘'
|
|
|
+ },
|
|
|
+ ]
|
|
|
+
|
|
|
+
|
|
|
+ const ageArr = [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ key: '唐宋',
|
|
|
+ textarea: ['青花瓷创烧于唐,此时制瓷工艺还不够成熟,处于滥觞期,主要用于外销。唐青花的产地可以判定为河南巩窑。',
|
|
|
+ '而宋代人崇尚朴素的审美文化所以青花瓷在宋朝并没有得到较大的发展。',
|
|
|
+ '唐宋时期的青花瓷还处于一个拙朴的状态。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ key: '元',
|
|
|
+ textarea: ['元代,青花瓷的发展迎来了一个小高峰。',
|
|
|
+ '景德镇出产的青花瓷标志着青花制瓷工艺已经达到了一个非常成熟的水准,业界人士将之简称为“元青花”。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ key: '明洪武',
|
|
|
+ textarea: ['景德镇御窑厂正式成立,此时的青花风格仍保留一部分元代遗风。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 4,
|
|
|
+ key: '明永宣',
|
|
|
+ textarea: ['苏麻离青料技艺的革新,以及永乐皇帝的重视,让永乐青花达到第个小高峰。宣德和永乐时期的青花风格很相似。制造工艺水平极高,可以说,永宣时期的青花是冠绝明代的。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 5,
|
|
|
+ key: '明成弘',
|
|
|
+ textarea: ['青花瓷的发展在正统、景泰、天顺三朝停滞后又迎来了一个小高潮,青花用料改为平等青,青花发色有了较强的进步。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 6,
|
|
|
+ key: '明嘉万',
|
|
|
+ textarea: ['明代中晚期,国家开始走向衰落,经济衰退,青花的质量逐渐下降,大不如前。制瓷工艺和青花风格上没什么创新和特色,没什么较大的发展。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 7,
|
|
|
+ key: '清康熙',
|
|
|
+ textarea: ['到了康熙一朝,由于国家逐渐安定繁荣,青花又快速发展起来,以“五彩青花”为代表使青花瓷发展到了巅峰。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 8,
|
|
|
+ key: '清雍正',
|
|
|
+ textarea: ['雍正皇帝对瓷器十分重视,派遣年希尧、唐英管理御窑厂,让雍正一朝保持超高的工艺水准。并且雍正时期青花多为仿永宣青花作品,虽少有创新,但其工艺水准之高,绝对不输前朝。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 9,
|
|
|
+ key: '清乾隆',
|
|
|
+ textarea: ['青花发展至乾隆一朝后,其制瓷工艺已经高度成熟,瓷器生产的数量和质量都达到了顶峰,也有相当数量的仿古瓷器。总体而言,工艺已经登峰造极。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 10,
|
|
|
+ key: '晚清',
|
|
|
+ textarea: ['督陶官制度被终结,景德镇官窑不再受到中央的重视。',
|
|
|
+ '战乱、政局动荡,使青花彻底地走 向了没落,无论是制瓷工艺还是创新,都处于极低的水准。']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 11,
|
|
|
+ key: '中华民国',
|
|
|
+ textarea: ['民国时期的青花瓷器,又称之为“洋蓝瓷器”,其颜色多发暗蓝,纹饰图案以绘画和诗词相结合为主,但是绘功不高,不太精细。',
|
|
|
+ '民国时期的青花瓷器青料质量有高有低。高质量的青花色泽纯正艳丽,低质量的青花色泽多泛灰,而且有杂质,缺少一种鲜活的美感。']
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
+
|
|
|
const cpArr = [
|
|
|
{
|
|
|
id: 1,
|
|
|
name: '馒首形',
|
|
|
img: img_manshouxing,
|
|
|
+ posInModel: new THREE.Vector3(
|
|
|
+ 0.009043116204992076,
|
|
|
+ 0.22948584032184838,
|
|
|
+ 0.015596999822647409
|
|
|
+ ),
|
|
|
+ titleInPoint: new THREE.Vector3(
|
|
|
+ 0.1, 0.24948584032184838, 0.05
|
|
|
+ ),
|
|
|
+ title: textrueLoader.current!.load(`model/manshouxing.png`),
|
|
|
wenli: textrueLoader.current!.load(`model/1-manshouxing.jpg`)
|
|
|
},
|
|
|
{
|
|
|
id: 2,
|
|
|
name: '兽形耳',
|
|
|
img: img_shouxinger,
|
|
|
+ posInModel: new THREE.Vector3(
|
|
|
+ 0.08457595303316055,
|
|
|
+ 0.056032072652909666,
|
|
|
+ 0.1059102513639425),
|
|
|
+ titleInPoint: new THREE.Vector3(
|
|
|
+ 0.12457595303316055,
|
|
|
+ 0.156032072652909666,
|
|
|
+ 0.2059102513639425
|
|
|
+ ),
|
|
|
+ title: textrueLoader.current!.load(`model/shouxinger.png`),
|
|
|
wenli: textrueLoader.current!.load(`model/2-shouxinger.jpg`)
|
|
|
},
|
|
|
{
|
|
|
id: 3,
|
|
|
name: '子母口',
|
|
|
img: img_zimukou,
|
|
|
+ posInModel: new THREE.Vector3(
|
|
|
+ -0.09101613983409917,
|
|
|
+ 0.16361387703933025,
|
|
|
+ 0.0272763910188533
|
|
|
+ ),
|
|
|
+ titleInPoint: new THREE.Vector3(
|
|
|
+ -0.16101613983409917,
|
|
|
+ 0.26361387703933025,
|
|
|
+ 0.0272763910188533
|
|
|
+ ),
|
|
|
+ title: textrueLoader.current!.load(`model/zimukou.png`),
|
|
|
wenli: textrueLoader.current!.load(`model/3-zimukou.jpg`)
|
|
|
},
|
|
|
{
|
|
|
id: 4,
|
|
|
name: '兽形钮',
|
|
|
img: img_shouxingniu,
|
|
|
+ posInModel: new THREE.Vector3(0, 0.25, 0),
|
|
|
+ titleInPoint: new THREE.Vector3(0, 0.35, 0),
|
|
|
+ title: textrueLoader.current!.load(`model/shouxingniu.png`),
|
|
|
wenli: textrueLoader.current!.load(`model/4-shouxingniu.jpg`)
|
|
|
}
|
|
|
]
|
|
|
|
|
|
+ const buttonArr = [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ name: '赏析',
|
|
|
+ img: ico_visual_normal,
|
|
|
+ active: ico_visual_active
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ name: '画卷',
|
|
|
+ img: ico_painting_normal,
|
|
|
+ active: ico_painting_active
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ name: '历史',
|
|
|
+ img: ico_history_normal,
|
|
|
+ active: ico_history_active
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 4,
|
|
|
+ name: '复位',
|
|
|
+ img: ico_change_normal,
|
|
|
+ active: ico_change_active
|
|
|
+ }
|
|
|
+ ]
|
|
|
+
|
|
|
+ const jianshangArr = [
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ color: '#D6D6D6'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ color: '#FFF7DB'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ color: '#C2B7BF'
|
|
|
+ },
|
|
|
+ ]
|
|
|
|
|
|
|
|
|
let [btnactive, setBtnactive] = useState({} as { name: string, id: number, wenli: string })
|
|
|
+
|
|
|
+ let [coloractive, setColoractive] = useState(colors[0] as { key: string, id: number, img: string, textrue: string, age: string })
|
|
|
+
|
|
|
+ let [jianshangColor, setJianshangColor] = useState(jianshangArr[0] as { color: string, id: number })
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
let [changeLeft, setchangeLeft] = useState(0)
|
|
|
let [loaded, setloaded] = useState(0)
|
|
|
|
|
|
let [showInfo, setShowInfo] = useState(false)
|
|
|
+ let [showHistory, setShowHistory] = useState(false)
|
|
|
+ let [showJianShang, setShowJianShang] = useState(false)
|
|
|
+ let [showJuanZhou, setShowJuanZhou] = useState(false)
|
|
|
|
|
|
- let [currentMsg, setcurrentMsg] = useState('')
|
|
|
- let [isReset, setIsReset] = useState(false)
|
|
|
+ let [currentScale, setCurrentScale] = useState({} as any)
|
|
|
|
|
|
|
|
|
let fixinfo = useMemo(() => {
|
|
@@ -178,10 +416,9 @@ function App() {
|
|
|
|
|
|
const resetCamera = () => {
|
|
|
controls.current!.enableZoom = false
|
|
|
- setIsReset(false)
|
|
|
|
|
|
if (isOpenPingGai.current) {
|
|
|
- movePinggai(-MOVEPINGGAI)
|
|
|
+ movePinggaiFn(-MOVEPINGGAI)
|
|
|
}
|
|
|
|
|
|
let tween = new Tween({
|
|
@@ -212,7 +449,6 @@ function App() {
|
|
|
controls.current!.enableZoom = true
|
|
|
let t1 = setTimeout(() => {
|
|
|
clearTimeout(t1)
|
|
|
- setIsReset(true)
|
|
|
}, 500);
|
|
|
}).start()
|
|
|
}
|
|
@@ -246,7 +482,7 @@ function App() {
|
|
|
obj.current.traverse((child) => {
|
|
|
if (child instanceof THREE.Mesh) {
|
|
|
if (child.name === PING_GAI) {
|
|
|
- outlineObj(child)
|
|
|
+ // outlineObj(child)
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -281,35 +517,30 @@ function App() {
|
|
|
obj.current = object
|
|
|
object.traverse((child) => {
|
|
|
if (child instanceof THREE.Mesh) {
|
|
|
- if (child.isMesh) {
|
|
|
- if (child instanceof THREE.Mesh) {
|
|
|
- console.log('result:', child.name);
|
|
|
- if (child.name === PING_GAI) {
|
|
|
- outlineObj(child)
|
|
|
- }
|
|
|
- }
|
|
|
- emissiveTexture.current = textrueLoader.current.load("model/shanchuanren.jpg");
|
|
|
- let step = 1
|
|
|
-
|
|
|
- setInterval(() => {
|
|
|
- if (showWenli.current && showWenli.current === child.name) {
|
|
|
- if (child.material.emissiveIntensity > 1.2) {
|
|
|
- step = -1
|
|
|
- }
|
|
|
- if (child.material.emissiveIntensity < 0) {
|
|
|
- step = 1
|
|
|
- }
|
|
|
- child.material.emissiveIntensity += 0.03 * step;
|
|
|
+ // if (child.name === PING_GAI) {
|
|
|
+ // outlineObj(child)
|
|
|
+ // }
|
|
|
+ emissiveTexture.current = textrueLoader.current.load("model/shanchuanren.jpg");
|
|
|
+ let step = 1
|
|
|
+
|
|
|
+ setInterval(() => {
|
|
|
+ if (showWenli.current && showWenli.current === child.name) {
|
|
|
+ if (child.material.emissiveIntensity > 1.2) {
|
|
|
+ step = -1
|
|
|
}
|
|
|
- else {
|
|
|
- child.material.emissiveMap = emissiveTexture.current;
|
|
|
- child.material.emissiveIntensity = 0;
|
|
|
+ if (child.material.emissiveIntensity < 0) {
|
|
|
+ step = 1
|
|
|
}
|
|
|
- }, 50);
|
|
|
+ child.material.emissiveIntensity += 0.03 * step;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ child.material.emissiveMap = emissiveTexture.current;
|
|
|
+ child.material.emissiveIntensity = 0;
|
|
|
+ }
|
|
|
+ }, 50);
|
|
|
|
|
|
- child.material.emissive = new THREE.Color(0xffffff);
|
|
|
- child.material.dispose();
|
|
|
- }
|
|
|
+ child.material.emissive = new THREE.Color(0xffffff);
|
|
|
+ child.material.dispose();
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -335,6 +566,7 @@ function App() {
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
const addHelper = () => {
|
|
|
const box = new THREE.BoxHelper(obj.current!, 0xffff00);
|
|
|
scene.add(box);
|
|
@@ -368,8 +600,8 @@ function App() {
|
|
|
// [-0.341,0.2594,0.342],
|
|
|
// [-0.486,-0.2250,-0.347],
|
|
|
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
// [0.641,0.1994,-0.442],
|
|
|
// [-0.486,-0.2250,0.347],
|
|
|
// [-0.2,-0.3,0.4],
|
|
@@ -408,7 +640,15 @@ function App() {
|
|
|
controls.current!.enableZoom = true
|
|
|
controls.current!.autoRotate = true;
|
|
|
controls.current!.autoRotateSpeed = 1;
|
|
|
- setIsReset(true)
|
|
|
+ Hotspot.camera = camera.current
|
|
|
+ Hotspot.scene = scene
|
|
|
+ cpArr.forEach(item => {
|
|
|
+ let hotspot = new Hotspot();
|
|
|
+ hotspot.initLabel(item)
|
|
|
+ hotspots.current.push(hotspot)
|
|
|
+ })
|
|
|
+
|
|
|
+ canAction.current = true
|
|
|
}, 1e3);
|
|
|
}
|
|
|
)).start()
|
|
@@ -420,7 +660,11 @@ function App() {
|
|
|
rafId = requestAnimationFrame(animate);
|
|
|
controls.current?.update();
|
|
|
renderer.render(scene!, camera.current!);
|
|
|
-
|
|
|
+ hotspots.current.forEach(item => {
|
|
|
+ item.reticleAnim && item.reticleAnim.lookAt(camera.current!.position)
|
|
|
+ item.nameMesh && item.nameMesh.lookAt(camera.current!.position)
|
|
|
+ item.textureAnimator && item.textureAnimator.update(1.5e1)
|
|
|
+ })
|
|
|
update();
|
|
|
if (composer) {
|
|
|
composer.render()
|
|
@@ -457,12 +701,27 @@ function App() {
|
|
|
composer.addPass(effectFXAA)
|
|
|
}
|
|
|
|
|
|
- const movePinggai = (position: number, speed: number = 5e2) => {
|
|
|
+ const toggleHotspots = (tag: Boolean) => {
|
|
|
+ if (canHandleHotspot.current) {
|
|
|
+ hotspots.current.forEach(item => {
|
|
|
+ tag ? item.show() : item.hide()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const movePinggaiFn = (position: number, speed: number = 5e2) => {
|
|
|
+ if (!canAction.current) return
|
|
|
let pinggai_obj = obj.current!.getObjectByName(PING_GAI)
|
|
|
|
|
|
+ if (!isOpenPingGai.current) {
|
|
|
+ toggleHotspots(false)
|
|
|
+ }
|
|
|
let complete = () => {
|
|
|
- isOpenPingGai.current = !isOpenPingGai.current
|
|
|
OpeningPingGai = false
|
|
|
+ if (isOpenPingGai.current) {
|
|
|
+ toggleHotspots(true)
|
|
|
+ }
|
|
|
+ isOpenPingGai.current = !isOpenPingGai.current
|
|
|
}
|
|
|
new Tween(pinggai_obj!.position).to({
|
|
|
x: pinggai_obj!.position.x,
|
|
@@ -474,19 +733,28 @@ function App() {
|
|
|
|
|
|
const pingGaiUpOrDown = () => {
|
|
|
if (OpeningPingGai) return
|
|
|
- console.log('result:', isOpenPingGai.current);
|
|
|
- isOpenPingGai.current ? movePinggai(-MOVEPINGGAI) : movePinggai(MOVEPINGGAI)
|
|
|
+ isOpenPingGai.current ? movePinggaiFn(-MOVEPINGGAI) : movePinggaiFn(MOVEPINGGAI)
|
|
|
}
|
|
|
|
|
|
const onMouseClickOrTouchEnd = (event: TouchEvent | MouseEvent) => {
|
|
|
// 获取 raycaster 和所有模型相交的数组,其中的元素按照距离排序,越近的越靠前
|
|
|
var intersects = getIntersects(event);
|
|
|
if (intersects) {
|
|
|
- // 获取选中最近的 Mesh 对象
|
|
|
- if (intersects!.length !== 0 && intersects![0].object instanceof THREE.Mesh) {
|
|
|
- let selectObject = intersects![0].object;
|
|
|
- if (selectObject.name === PING_GAI) {
|
|
|
- pingGaiUpOrDown();
|
|
|
+ if (intersects!.length !== 0) {
|
|
|
+ //过滤Line模型
|
|
|
+ let iiis = intersects.filter(item => !(item.object instanceof THREE.Line))
|
|
|
+ if (iiis.length > 0) {
|
|
|
+ let selectObject = iiis![0].object;
|
|
|
+ // 获取选中最近的 Mesh 对象
|
|
|
+ if (selectObject instanceof THREE.Mesh) {
|
|
|
+ if (canHandleHotspot.current) {
|
|
|
+ let current = cpArr.find(item => item.name === selectObject.name)
|
|
|
+ current && handleBtn(current)
|
|
|
+ }
|
|
|
+ if (selectObject.name === PING_GAI) {
|
|
|
+ pingGaiUpOrDown();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -590,19 +858,55 @@ function App() {
|
|
|
}
|
|
|
|
|
|
|
|
|
- const toggleInfo = (event: any) => {
|
|
|
+ const closeAll = (event: any) => {
|
|
|
event.preventDefault()
|
|
|
- setShowInfo(!showInfo)
|
|
|
+ handleBtnReset(event)
|
|
|
+ setShowHistory(false)
|
|
|
+ setShowInfo(false)
|
|
|
+ setShowJianShang(false)
|
|
|
+ setShowJuanZhou(false)
|
|
|
}
|
|
|
- const handleBtn = (event: any, item: any) => {
|
|
|
- console.log('result:', item);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ const handleBtn = (item: any) => {
|
|
|
+ setBtnactive((prev) => {
|
|
|
+ if (prev.id === item.id) {
|
|
|
+ return {}
|
|
|
+ } else {
|
|
|
+ return item
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleRightBtn = (event: any, item: any) => {
|
|
|
event.preventDefault()
|
|
|
- if (item.id !== btnactive.id) {
|
|
|
- setBtnactive(item)
|
|
|
+ switch (item.id) {
|
|
|
+ case 1:
|
|
|
+ setShowJianShang(true)
|
|
|
+ handleBtnReset(event)
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 2:
|
|
|
+ setShowJuanZhou(true)
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 3:
|
|
|
+ setShowHistory(true)
|
|
|
+ break;
|
|
|
+
|
|
|
+ case 4:
|
|
|
+ handleBtnReset(event)
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
const handleBtnReset = (event: any) => {
|
|
|
event.preventDefault()
|
|
|
resetCamera()
|
|
@@ -623,9 +927,9 @@ function App() {
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
if (btnactive.wenli) {
|
|
|
-
|
|
|
let pingshen = obj.current?.getObjectByName(PING_SHEN)
|
|
|
let pinggai = obj.current?.getObjectByName(PING_GAI)
|
|
|
|
|
@@ -633,27 +937,42 @@ function App() {
|
|
|
wlmesh.material.emissiveMap = btnactive.wenli;
|
|
|
showWenli.current = wlmesh.name
|
|
|
wlmesh.material.dispose();
|
|
|
+ } else {
|
|
|
+ showWenli.current = ''
|
|
|
}
|
|
|
}, [btnactive])
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
- showInfoRef.current = !currentMsg
|
|
|
- if (currentMsg) {
|
|
|
+ if (currentScale.id === 2) {
|
|
|
const timer = setTimeout(() => {
|
|
|
clearTimeout(timer);
|
|
|
- setcurrentMsg('');
|
|
|
+ setCurrentScale({});
|
|
|
}, 3000);
|
|
|
return () => {
|
|
|
clearTimeout(timer);
|
|
|
};
|
|
|
}
|
|
|
- }, [currentMsg]);
|
|
|
+ }, [currentScale]);
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
+ canHandleHotspot.current = true
|
|
|
+ toggleHotspots(!showJianShang)
|
|
|
+ showWenli.current = ''
|
|
|
+ canHandleHotspot.current = !showJianShang
|
|
|
+ }, [showJianShang]);
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
return (
|
|
|
- <div className="App" style={{ background: `#3c454c url(${loading_bg}) no-repeat 50%/cover` }}>
|
|
|
+ <div className="App" style={{ background: showJianShang ? `${jianshangColor.color}` : `#3c454c url(${loading_bg}) no-repeat 50%/cover` }}>
|
|
|
+
|
|
|
+ {/* 为了触发jianshangColor.color的变化 */}
|
|
|
+ <i style={{ opacity: 0, pointerEvents: 'none' }} >{jianshangColor.color}</i>
|
|
|
+
|
|
|
{loaded !== 100 && <div className='loadbox' style={{ background: `#3c454c url(${loading_bg}) no-repeat 50%/cover` }}>
|
|
|
<div className="loadShow">
|
|
|
<div className="title">
|
|
@@ -671,7 +990,7 @@ function App() {
|
|
|
|
|
|
<img src={logo} alt='img' className='logo' />
|
|
|
|
|
|
- <div className="mask" style={{ bottom: showInfo ? 0 : '-73%' }}>
|
|
|
+ <div className="mask" style={{ bottom: showInfo ? 0 : '-101%' }}>
|
|
|
<div className="info">
|
|
|
<h3>带盖青花瓷坛</h3>
|
|
|
<ul>
|
|
@@ -690,23 +1009,92 @@ function App() {
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
- <Huajuan
|
|
|
- handleClick={(item: any) => { setcurrentMsg(item.msg) }}
|
|
|
- onChange={(temp: any) => { setchangeLeft(temp) }}
|
|
|
- imgs={{
|
|
|
- img_juanzhou, img_texture, line_boat,
|
|
|
- line_friends,
|
|
|
- line_mount
|
|
|
- }}
|
|
|
- left={changeLeft}
|
|
|
- />
|
|
|
-
|
|
|
- <div onTouchEnd={toggleInfo} className="shoula">
|
|
|
- <img src={showInfo ? ico_down : ico_up} alt='img' className='logo' />
|
|
|
+ <div className="info">
|
|
|
+ <h3>青花的七种青料</h3>
|
|
|
+ <div className='yanlian'>
|
|
|
+ <ul>
|
|
|
+ {
|
|
|
+ colors.map(item => {
|
|
|
+ return (
|
|
|
+ <li className={`${coloractive.id === item.id ? 'active' : ''}`} onTouchEnd={() => { setColoractive(item) }} key={item.key}>
|
|
|
+ <span>{item.key}</span>
|
|
|
+ </li>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </ul>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <img src={coloractive.img} alt='img' />
|
|
|
+ <p className='ttp'>主要使用时期:</p>
|
|
|
+ <p>{coloractive.age}</p>
|
|
|
+ <p className='ttp'>发色特征:</p>
|
|
|
+ <p>{coloractive.textrue}</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
+
|
|
|
</div>
|
|
|
|
|
|
- <div className='btnlist'>
|
|
|
+ {/* 历史 */}
|
|
|
+ <div className="mask history" style={{ bottom: showHistory ? 0 : '-101%' }}>
|
|
|
+ <ul>
|
|
|
+ {
|
|
|
+ ageArr.map(item => {
|
|
|
+ return (
|
|
|
+ <li key={item.id}>
|
|
|
+ <h3>{item.key}</h3>
|
|
|
+ <div>
|
|
|
+ {
|
|
|
+ item.textarea.map(sub => {
|
|
|
+ return <p key={sub}>{sub}</p>
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ )
|
|
|
+ })
|
|
|
+ }
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ {!showJianShang && (
|
|
|
+ <>
|
|
|
+ <div className='more_btn' onTouchEnd={() => setShowInfo(true)}>
|
|
|
+ <img src={ico_up} alt='img' />
|
|
|
+ <span>更多</span>
|
|
|
+ </div>
|
|
|
+ <ul className='btnlist'>
|
|
|
+ {buttonArr.map(item => {
|
|
|
+ return (
|
|
|
+ <li key={item.id} onTouchEnd={(event) => { handleRightBtn(event, item) }}>
|
|
|
+ <div className='img'>
|
|
|
+ <img src={item.img} alt="buttonArr" />
|
|
|
+ </div>
|
|
|
+ <span>{item.name}</span>
|
|
|
+ </li>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </ul>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+
|
|
|
+
|
|
|
+ {showJianShang && <div className='jianshanglist'>
|
|
|
+ <ul>
|
|
|
+ {jianshangArr.map(item => {
|
|
|
+ return (
|
|
|
+ <li style={{ background: `${item.color}` }} key={item.id} onTouchEnd={() => { setJianshangColor(item) }}>
|
|
|
+ </li>
|
|
|
+ )
|
|
|
+ })}
|
|
|
+ </ul>
|
|
|
+ </div>}
|
|
|
+
|
|
|
+ {/* <div className='btnlist'>
|
|
|
<ul>
|
|
|
{cpArr.map(item => {
|
|
|
return (
|
|
@@ -720,16 +1108,35 @@ function App() {
|
|
|
)
|
|
|
})}
|
|
|
</ul>
|
|
|
- </div>
|
|
|
+ </div> */}
|
|
|
|
|
|
- <div className="reset">
|
|
|
- <img onTouchEnd={(event) => { handleBtnReset(event) }} src={isReset ? ico_change_active : ico_change_normal} alt='reset' className='reset' />
|
|
|
- </div>
|
|
|
+ {showJuanZhou && <div className='juanzhou'>
|
|
|
+ <Huajuan
|
|
|
+ handleClick={(item: any) => { setCurrentScale(item) }}
|
|
|
+ onChange={(temp: any) => { setchangeLeft(temp) }}
|
|
|
+ imgs={{
|
|
|
+ img_juanzhou, img_texture, line_boat,
|
|
|
+ line_friends,
|
|
|
+ line_mount,
|
|
|
+ lxuliezhen
|
|
|
+ }}
|
|
|
+ left={changeLeft}
|
|
|
+ />
|
|
|
+
|
|
|
+ <img className='j-close' onTouchEnd={closeAll} src={ico_cancel} alt="" />
|
|
|
+ </div>}
|
|
|
|
|
|
{
|
|
|
- currentMsg && <Toast bg={imgtext} message={currentMsg}></Toast>
|
|
|
+ currentScale.id &&
|
|
|
+ (currentScale.id === 2 ? <Toast bg={imgtext} message={currentScale.txt}></Toast> :
|
|
|
+ <Scale handleClose={() => { setCurrentScale({}) }} close_img={ico_cancel} txt={currentScale.txt} image={currentScale.img === 'xuliezhen1' ? xuliezhen1 : xuliezhen2}></Scale>)
|
|
|
}
|
|
|
|
|
|
+ {(showInfo || showJianShang || showHistory) && <div onTouchEnd={closeAll} className="shoula">
|
|
|
+ <img src={ico_back} alt='img' />
|
|
|
+ </div>}
|
|
|
+
|
|
|
+
|
|
|
<div id="webgl" ref={webglRef}></div>
|
|
|
</div>
|
|
|
);
|