Commit 8ae71a670d6be448e3dc9277a1c79abe042dc435
1 parent
49e4f5fe
删除多余文件;
Showing
1 changed file
with
0 additions
and
128 deletions
src/components/Common/PersonCenter/SkinChangeModal copy.js deleted
| 1 | -/* eslint-disable */ | ||
| 2 | -import React, { useEffect, useRef, useState } from "react"; | ||
| 3 | -import AntdDraggableModal from "@/components/Common/AntdDraggableModal"; | ||
| 4 | -import styles from "@/routes/indexPage.less"; | ||
| 5 | - | ||
| 6 | -const skinList = [ | ||
| 7 | - { | ||
| 8 | - name: "default", | ||
| 9 | - color1: "#383d41", | ||
| 10 | - color2: "#303538" | ||
| 11 | - }, | ||
| 12 | - { | ||
| 13 | - name: "color1", | ||
| 14 | - color1: "#6e5064", | ||
| 15 | - color2: "#b482a4" | ||
| 16 | - }, | ||
| 17 | - { | ||
| 18 | - name: "color2", | ||
| 19 | - color1: "#0010fc", | ||
| 20 | - color2: "#515bf3" | ||
| 21 | - }, | ||
| 22 | - { | ||
| 23 | - name: "color3", | ||
| 24 | - color1: "#433598", | ||
| 25 | - color2: "#7160d5" | ||
| 26 | - }, | ||
| 27 | - { | ||
| 28 | - name: "color4", | ||
| 29 | - color1: "#e1408e", | ||
| 30 | - color2: "#c56f98" | ||
| 31 | - }, | ||
| 32 | - { | ||
| 33 | - name: "color5", | ||
| 34 | - color1: "#f46b5f", | ||
| 35 | - color2: "#e69892" | ||
| 36 | - }, | ||
| 37 | - { | ||
| 38 | - name: "color6", | ||
| 39 | - color1: "#fa375c", | ||
| 40 | - color2: "#eb8498" | ||
| 41 | - }, | ||
| 42 | - { | ||
| 43 | - name: "color7", | ||
| 44 | - color1: "#6f41ed", | ||
| 45 | - color2: "#8b70d5" | ||
| 46 | - }, | ||
| 47 | - { | ||
| 48 | - name: "color8", | ||
| 49 | - color1: "#fd4138", | ||
| 50 | - color2: "#e3736e" | ||
| 51 | - } | ||
| 52 | -]; | ||
| 53 | - | ||
| 54 | -const SkinChangeModal = props => { | ||
| 55 | - const { skinChangeModalVisible, handleCancel } = props; | ||
| 56 | - const [currentSkin, setCurrentSkin] = useState( | ||
| 57 | - localStorage.getItem("xly-skin") || "default" | ||
| 58 | - ); | ||
| 59 | - const oldSkin = useRef(null); | ||
| 60 | - useEffect(() => { | ||
| 61 | - // getComputedStyle(oBody).getPropertyValue('--xly-login-header-logo') | ||
| 62 | - const oBody = document.querySelector("body"); | ||
| 63 | - oldSkin.current = oBody.getAttribute("data-skin"); | ||
| 64 | - }, []); | ||
| 65 | - | ||
| 66 | - const handleCancelSelf = () => { | ||
| 67 | - const oBody = document.querySelector("body"); | ||
| 68 | - oBody.setAttribute("data-skin", oldSkin.current); | ||
| 69 | - handleCancel(); | ||
| 70 | - }; | ||
| 71 | - | ||
| 72 | - const handleOk = () => { | ||
| 73 | - localStorage.setItem("xly-skin", currentSkin); | ||
| 74 | - handleCancel(); | ||
| 75 | - }; | ||
| 76 | - | ||
| 77 | - const handleChooseSkin = ({ name }) => { | ||
| 78 | - setCurrentSkin(name); | ||
| 79 | - const oBody = document.querySelector("body"); | ||
| 80 | - oBody.setAttribute("data-skin", name); | ||
| 81 | - }; | ||
| 82 | - | ||
| 83 | - return skinChangeModalVisible ? ( | ||
| 84 | - <AntdDraggableModal | ||
| 85 | - title={"主题肤色"} | ||
| 86 | - visible={skinChangeModalVisible} | ||
| 87 | - width={600} | ||
| 88 | - onOk={handleOk} | ||
| 89 | - onCancel={handleCancelSelf} | ||
| 90 | - > | ||
| 91 | - <div className={styles.skinChangeModal}> | ||
| 92 | - {skinList.map(item => { | ||
| 93 | - const { color1, color2, name } = item; | ||
| 94 | - return ( | ||
| 95 | - <div | ||
| 96 | - className="skinChangeOption" | ||
| 97 | - onClick={() => { | ||
| 98 | - handleChooseSkin(item); | ||
| 99 | - }} | ||
| 100 | - > | ||
| 101 | - <div className="skinChangeOptionLeft"> | ||
| 102 | - <div | ||
| 103 | - className="skinChangeOptionColor2" | ||
| 104 | - style={{ background: color2 }} | ||
| 105 | - /> | ||
| 106 | - </div> | ||
| 107 | - <div className="skinChangeOptionRight"> | ||
| 108 | - <div | ||
| 109 | - className="skinChangeOptionColor1" | ||
| 110 | - style={{ background: color1 }} | ||
| 111 | - /> | ||
| 112 | - {currentSkin === name ? ( | ||
| 113 | - <div className="skinChangeChecked">✓</div> | ||
| 114 | - ) : ( | ||
| 115 | - "" | ||
| 116 | - )} | ||
| 117 | - </div> | ||
| 118 | - </div> | ||
| 119 | - ); | ||
| 120 | - })} | ||
| 121 | - </div> | ||
| 122 | - </AntdDraggableModal> | ||
| 123 | - ) : ( | ||
| 124 | - "" | ||
| 125 | - ); | ||
| 126 | -}; | ||
| 127 | - | ||
| 128 | -export default SkinChangeModal; |