index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. <template>
  2. <div class="light" v-if="showLight && lampList && lampList.length">
  3. <!--如果有子设备-->
  4. <div class="light-top">
  5. <div class="light-desc">
  6. <p class="light-title">
  7. {{ isShowChildLight ? "光照" : lampList[0].localName }}
  8. </p>
  9. <p :class="isShowChildLight ? 'light-status' : 'light-status'">
  10. {{ lampSw ? "照明已开启" : "照明已关闭" }}
  11. </p>
  12. </div>
  13. <div class="light-right">
  14. <div class="switch-box" v-if="isShowChildLight">
  15. <span class="switch-item" @click="eqChange('allLamp', true, 0)"
  16. >全开</span
  17. >
  18. <span class="switch-item" @click="eqChange('allLamp', false, 0)"
  19. >全关</span
  20. >
  21. </div>
  22. <img :src="lightImg" alt="" v-if="!isShowChildLight" />
  23. </div>
  24. </div>
  25. <div class="light-main-control" v-if="!isShowChildLight">
  26. <div
  27. class="main-color"
  28. v-if="lampList[0].bright || lampList[0].colorTemperature"
  29. >
  30. <img
  31. :src="lightColorImg"
  32. @click="showLightColorCtrol(lampList[0])"
  33. alt=""
  34. />
  35. </div>
  36. <div v-else></div>
  37. <Switch
  38. v-if="!showFlag"
  39. :size="23"
  40. :disabled="!userIsControl"
  41. v-model="lampSw"
  42. @click="eqChange('allLamp', '', 0)"
  43. inactive-color="rgba(196, 196, 196, 0.4)"
  44. class="switch-btn"
  45. />
  46. </div>
  47. <!--灯控制按钮-->
  48. <div class="light-box" v-if="isShowChildLight">
  49. <template v-for="(item, index) in lampList" :key="item.id">
  50. <div
  51. class="light-control"
  52. @click="showLightColorCtrol(item)"
  53. v-if="showFlag ? index < lampList.length : index < 2"
  54. >
  55. <div class="control-top">
  56. <img :src="item.switch ? item.imgOpen : item.imgClose" alt="" />
  57. <Switch
  58. active-color="$elActiveColor"
  59. :disabled="!userIsControl"
  60. v-model="item.switch"
  61. :loading="item.loading"
  62. size="14px"
  63. @click.stop="eqChange('main', item, index)"
  64. inactive-color="rgba(196, 196, 196, 0.2)"
  65. class="child-switch"
  66. />
  67. </div>
  68. <div class="control-bottom">
  69. <div class="control-title">
  70. {{ item.localName }}
  71. </div>
  72. <img
  73. v-if="item.bright || item.colorTemperature"
  74. :style="{ opacity: item.switch ? '1' : '0.3' }"
  75. :src="lightColorImg"
  76. alt=""
  77. />
  78. </div>
  79. </div>
  80. </template>
  81. </div>
  82. <div
  83. class="show-all"
  84. v-if="lampList && lampList.length > 2"
  85. @click.stop="showAll"
  86. >
  87. <van-icon :name="lightIcon" class="light-icon" />
  88. <span>展开更多</span>
  89. </div>
  90. </div>
  91. </template>
  92. <script lang="ts">
  93. import {
  94. defineComponent,
  95. computed,
  96. onMounted,
  97. reactive,
  98. toRefs,
  99. getCurrentInstance,
  100. watch,
  101. onBeforeMount,
  102. onUnmounted,
  103. onBeforeUnmount,
  104. } from "vue";
  105. import { Switch, Toast } from "vant";
  106. import { getLampHttp, getStatusHttp, setallLampHttp } from "@/apis/envmonitor";
  107. import { getRelNowTime, parseImgUrl } from "@/utils";
  108. import { type } from "os";
  109. import { onDeactivated } from "vue";
  110. import { AnyMxRecord } from "dns";
  111. export default defineComponent({
  112. props: {
  113. projectId: {
  114. type: String,
  115. default: () => "",
  116. },
  117. controlMode: {
  118. type: Number,
  119. default: () => 0,
  120. },
  121. spaceId: {
  122. type: String,
  123. default: () => "",
  124. },
  125. userIsControl: {
  126. type: Boolean,
  127. default: () => false,
  128. },
  129. forceOverTimeFlag: {
  130. type: Boolean,
  131. default: () => false,
  132. },
  133. showLight: {
  134. type: Boolean,
  135. default: () => false,
  136. },
  137. seviceEquipmentList: {
  138. // 是否走服务定制的设备
  139. type: Array,
  140. default: () => [],
  141. },
  142. },
  143. components: { Switch },
  144. setup(props, contx) {
  145. const lampList: any = [];
  146. let lightsStatusTimer: any = null;
  147. const timeOut: any = null;
  148. const initData: any = [];
  149. let lightParams: any = [];
  150. let statusInterval: any = null;
  151. const proxyData = reactive({
  152. seviceEquipmentList: props.seviceEquipmentList,
  153. showLight: props.showLight,
  154. spaceId: props.spaceId,
  155. controlMode: props.controlMode,
  156. userIsControl: props.userIsControl,
  157. forceOverTimeFlag: props.forceOverTimeFlag,
  158. setStatus: 0,
  159. lightParams: lightParams,
  160. allowSvg: "down_Arrow.svg",
  161. timeOut: timeOut,
  162. lightIcon: "arrow-down",
  163. showFlag: false,
  164. loadingLight: false,
  165. loading: false,
  166. initData: initData,
  167. lampList: lampList,
  168. lightsStatusTimer: lightsStatusTimer,
  169. startCheckLightsTime: 0,
  170. lightColorImg: parseImgUrl("page-officehome", "lightColorControl.svg"),
  171. lightImg: parseImgUrl("page-officehome", "lamp_close.png"),
  172. lampSw: false, // 主灯开关
  173. // 点击展示所有的登录
  174. showAll() {
  175. proxyData.showFlag = !proxyData.showFlag;
  176. console.log("proxyData.showFlag==", proxyData.showFlag);
  177. if (proxyData.showFlag) {
  178. proxyData.lightIcon = "arrow-up";
  179. } else {
  180. proxyData.lightIcon = "arrow-down";
  181. }
  182. },
  183. // 点击展示调色和调温弹窗
  184. showLightColorCtrol(item: any, e: any = null) {
  185. console.log(item);
  186. if (item.switch) {
  187. contx.emit("showLightColorCtrol", item);
  188. }
  189. },
  190. // 检查设备是否执行空间服务时间
  191. checkDeviceIsExeSpaceTime(deviceAll: any = []) {
  192. // debugger
  193. if (proxyData.controlMode !== 1) {
  194. return true;
  195. }
  196. let seviceEquipmentList: any = proxyData.seviceEquipmentList;
  197. let flag: any = false;
  198. for (let i = 0; i < seviceEquipmentList.length; i++) {
  199. for (let j = 0; j < deviceAll.length; j++) {
  200. if (
  201. seviceEquipmentList[i].id == deviceAll[j].id &&
  202. seviceEquipmentList[i].isExeSpaceTime
  203. ) {
  204. flag = true;
  205. break;
  206. }
  207. }
  208. if (flag) {
  209. break;
  210. }
  211. }
  212. return flag;
  213. },
  214. // 获取灯的状态
  215. getLampList() {
  216. getLampHttp({ spaceId: proxyData.spaceId })
  217. .then((res) => {
  218. const resData: any = res;
  219. if (!proxyData.setStatus) {
  220. // console.log("灯的状态修改--");
  221. if (resData && resData.result == "success") {
  222. let content = resData?.content ?? [];
  223. let lampOpen = false; // 如果有一个开 则总灯开
  224. for (let i = 0; i < content.length; i++) {
  225. content[i].type = "lamp";
  226. if (content[i].lightType == 1) {
  227. content[i].imgOpen = parseImgUrl(
  228. "page-officehome",
  229. "lamp_open.png"
  230. );
  231. content[i].imgClose = parseImgUrl(
  232. "page-officehome",
  233. "lamp_close.png"
  234. );
  235. } else {
  236. content[i].imgOpen = parseImgUrl(
  237. "page-officehome",
  238. "atmLamp_small_open.png"
  239. );
  240. content[i].imgClose = parseImgUrl(
  241. "page-officehome",
  242. "atmLamp_small_close.png"
  243. );
  244. }
  245. content[i].switch = content[i].runStatus ? true : false;
  246. if (content[i].runStatus) {
  247. lampOpen = true;
  248. }
  249. content[i].loading = false;
  250. }
  251. proxyData.initData = JSON.parse(JSON.stringify(content)); // 灯的数据
  252. proxyData.lampSw = lampOpen; // 主灯开关
  253. proxyData.lampList = content;
  254. proxyData.lightImg = proxyData.lampSw
  255. ? parseImgUrl("page-officehome", "lamp_open.png")
  256. : parseImgUrl("page-officehome", "lamp_close.png");
  257. if (content[0]) {
  258. if (content[0].lightType !== 1) {
  259. proxyData.lightImg = proxyData.lampSw
  260. ? parseImgUrl("page-officehome", "atmLamp_small_open.png")
  261. : parseImgUrl(
  262. "page-officehome",
  263. "atmLamp_small_close.png"
  264. );
  265. }
  266. }
  267. }
  268. }
  269. // console.log("执行了----====");
  270. proxyData.startLightsStatusTimer();
  271. })
  272. .catch(() => {
  273. proxyData.startLightsStatusTimer();
  274. });
  275. },
  276. // 调整灯
  277. eqChange(type: any, item: any, index: any) {
  278. if (proxyData.userIsControl) {
  279. // debugger
  280. if (type === "allLamp") {
  281. let isExeSpaceTime: Boolean = proxyData.checkDeviceIsExeSpaceTime(
  282. proxyData.lampList
  283. );
  284. if (item !== "") {
  285. proxyData.lampSw = item; // 点击全开和全关的时候item动态传值true或者false
  286. }
  287. if (
  288. proxyData.forceOverTimeFlag &&
  289. proxyData.lampSw &&
  290. isExeSpaceTime
  291. ) {
  292. // 强制加班开灯
  293. contx.emit("triggerWork", 3);
  294. return;
  295. }
  296. // 总开关按钮所有灯
  297. // 当前要执行的灯的操作
  298. proxyData.loading = true;
  299. proxyData.loadingLight = true;
  300. proxyData.lightImg = proxyData.lampSw
  301. ? parseImgUrl("page-officehome", "lamp_open.png")
  302. : parseImgUrl("page-officehome", "lamp_close.png");
  303. const statusFlag = proxyData.lampSw;
  304. // 瞬间修改状态
  305. proxyData.setStatus = 15; // 点击后状态重新计算
  306. proxyData.updateAllLampStatus(statusFlag);
  307. proxyData.setLamp(type, "", statusFlag, 0); // 调接口
  308. } else {
  309. let isExeSpaceTime: Boolean = proxyData.checkDeviceIsExeSpaceTime([
  310. item,
  311. ]);
  312. if (proxyData.forceOverTimeFlag && item.switch && isExeSpaceTime) {
  313. // 强制加班开灯
  314. contx.emit("triggerWork", 3, item);
  315. return;
  316. }
  317. //当前要执行的灯的操作
  318. // 按钮loading
  319. item.loading = true;
  320. const statusFlag: any = item.switch;
  321. let id = item.id;
  322. proxyData.setStatus = 15;
  323. proxyData.updateLampStatus(item, statusFlag);
  324. proxyData.setLamp(type, id, statusFlag, index, item); // 调接口
  325. }
  326. } else {
  327. Toast("您没有当前空间的控制权限!");
  328. }
  329. },
  330. // 定时查看灯的状态是否需要更新
  331. statusInterval: statusInterval,
  332. setStatusNum() {
  333. clearInterval(proxyData.statusInterval);
  334. proxyData.statusInterval = setInterval(() => {
  335. proxyData.setStatus--;
  336. if (proxyData.setStatus == 1) {
  337. proxyData.setStatus = 0;
  338. clearInterval(proxyData.statusInterval);
  339. }
  340. }, 1000);
  341. },
  342. // 控制灯的接口
  343. setLamp(
  344. type: string,
  345. id: any,
  346. statusFlag: any,
  347. index: any,
  348. item: any = null
  349. ) {
  350. let params: any = [];
  351. if (type === "allLamp") {
  352. for (let i = 0; i < proxyData.initData.length; i++) {
  353. proxyData.initData[i].switch = statusFlag;
  354. }
  355. params = proxyData.initData;
  356. } else {
  357. params = [
  358. {
  359. id: id,
  360. switch: statusFlag,
  361. },
  362. ];
  363. }
  364. proxyData.lightParams = params;
  365. // 调服务端的接口像后台发送灯的操作的指令
  366. setallLampHttp(params)
  367. .then((res) => {
  368. const resData: any = res;
  369. // set成功后15s更新灯的状态
  370. proxyData.setStatusNum();
  371. if (item) {
  372. item.loading = false;
  373. }
  374. if (resData.result === "success") {
  375. // const checkData: any = proxyData.judgeChangeResponeseSuccess(resData)
  376. // proxyData.getTimeLampStatus(checkData, type, id, statusFlag, index)
  377. } else {
  378. proxyData.initLampLoading();
  379. }
  380. })
  381. .catch((error: any) => {
  382. // set成功后15s更新灯的状态
  383. proxyData.setStatusNum();
  384. if (item) {
  385. item.loading = false;
  386. }
  387. // console.log(error)
  388. Toast("连接异常,请检查网络!");
  389. });
  390. },
  391. // 报错后关闭灯的loading
  392. initLampLoading() {
  393. proxyData.loadingLight = false;
  394. proxyData.lampList.map((item: any) => {
  395. item.loading = false;
  396. });
  397. },
  398. //手动修改灯的状态
  399. updateAllLampStatus(statusFlag: any) {
  400. proxyData.lampSw = statusFlag;
  401. for (let i = 0; i < proxyData.lampList.length; i++) {
  402. proxyData.lampList[i].switch = statusFlag;
  403. // if (proxyData.lampList[i].type == 'lamp') {
  404. // }
  405. }
  406. },
  407. // 单个灯的状态修改
  408. updateLampStatus(item: any, statusFlag: any) {
  409. item.switch = statusFlag;
  410. },
  411. // 轮询查看状态
  412. getTimeLampStatus(
  413. checkData: any,
  414. type: any,
  415. id: any,
  416. statusFlag: any,
  417. index: any
  418. ) {
  419. if (checkData["success"] && checkData["success"].length) {
  420. if (type === "allLamp") {
  421. // 点击主灯按钮
  422. proxyData.updateAllLampLoading(checkData["success"]); // 所有灯
  423. } else {
  424. // 当个的时候修改loading的状态
  425. proxyData.updateLampLoading(index);
  426. }
  427. proxyData.getLampList();
  428. }
  429. if (checkData["processing"] && checkData["processing"].length) {
  430. let checkParams: any = proxyData.lightParams;
  431. let processArr: any = checkData["processing"];
  432. let params: any = [];
  433. processArr.map((item: any) => {
  434. let obj: any = {
  435. id: item.id,
  436. orderSeqNum: item.orderSeqNum,
  437. };
  438. for (let i = 0; i < checkParams.length; i++) {
  439. if (item.id === checkParams[i].id) {
  440. obj.switch = checkParams[i].switch;
  441. break;
  442. }
  443. }
  444. params.push(obj);
  445. });
  446. proxyData.checkChangeLightStatusSuccess(
  447. params,
  448. type,
  449. id,
  450. statusFlag,
  451. index
  452. );
  453. }
  454. if (checkData["error"] && checkData["error"].length) {
  455. if (type === "allLamp") {
  456. // 点击主灯按钮
  457. proxyData.updateAllLampLoading(checkData["error"]); // 所有灯
  458. } else {
  459. // 当个的时候修改loading的状态
  460. proxyData.updateLampLoading(index);
  461. }
  462. }
  463. },
  464. // 查看指令是否成功完成
  465. judgeChangeResponeseSuccess(resData: any) {
  466. let data: any = resData?.content ?? [];
  467. let processingArr: any = [];
  468. let successArr: any = [];
  469. let errorArr: any = [];
  470. for (let i = 0; i < data.length; i++) {
  471. let item: any = data[i];
  472. if ((item.result = "success")) {
  473. if (item.state === 200 && item.exeResult === "success") {
  474. successArr.push(item);
  475. } else if (
  476. (item.state === 200 && item.exeResult === "processing:rcvd") ||
  477. (item.state === 202 && !item.exeResult)
  478. ) {
  479. processingArr.push(item);
  480. } else {
  481. errorArr.push(item);
  482. }
  483. } else {
  484. errorArr.push(item);
  485. }
  486. }
  487. let obj: any = {
  488. success: successArr,
  489. processing: processingArr,
  490. error: errorArr,
  491. };
  492. return obj;
  493. },
  494. // 操作成功后更新所有灯的真实状态
  495. updateAllLampLoading(arr: any) {
  496. for (let i = 0; i < proxyData.lampList.length; i++) {
  497. if (proxyData.lampList[i].type == "lamp") {
  498. arr.map((item: any) => {
  499. if (proxyData.lampList[i].id === item.id) {
  500. proxyData.lampList[i].loading = false;
  501. }
  502. });
  503. }
  504. }
  505. let loadingLen = proxyData.lampList.filter((item: any) => {
  506. return item.loading;
  507. });
  508. if (loadingLen.length === 0) {
  509. proxyData.loadingLight = false;
  510. }
  511. },
  512. // 动态切换主灯的状态
  513. updateLampLoading(index: any) {
  514. proxyData.lampList[index].loading = false;
  515. },
  516. // 灯的指令完成后更新状态
  517. checkChangeLightStatusSuccess(
  518. checkParams: any,
  519. type: any,
  520. id: any,
  521. value: any,
  522. index: any
  523. ) {
  524. // 轮询查询灯的状态
  525. getStatusHttp(checkParams).then((res) => {
  526. const resData: any = res;
  527. const checkData: any = proxyData.judgeChangeResponeseSuccess(resData);
  528. proxyData.getTimeLampStatus(checkData, type, id, value, index);
  529. });
  530. },
  531. // 灯灯接口清除定时器
  532. clearLightStatusTimer() {
  533. clearTimeout(proxyData.lightsStatusTimer);
  534. proxyData.lightsStatusTimer = null;
  535. },
  536. // 定时刷新接口
  537. startLightsStatusTimer(timerLen: any = 15000) {
  538. let nowTime: any = getRelNowTime();
  539. if (timerLen == 15000 && nowTime < "070000" && nowTime > "200000") {
  540. timerLen = 300000;
  541. }
  542. proxyData.clearLightStatusTimer();
  543. proxyData.lightsStatusTimer = setTimeout(() => {
  544. proxyData.clearLightStatusTimer();
  545. proxyData.getLampList();
  546. }, timerLen);
  547. },
  548. });
  549. const isShowChildLight: any = computed(() => {
  550. return proxyData.lampList.length && proxyData.lampList.length > 1;
  551. });
  552. // onDeactivated(()=>{
  553. // destroyWatch()
  554. // })
  555. watch(
  556. [() => props, () => props.spaceId],
  557. (newProps: any, oldProps: any) => {
  558. // debugger
  559. if (newProps[0]) {
  560. proxyData.showLight = newProps[0].showLight;
  561. proxyData.userIsControl = newProps[0].userIsControl;
  562. proxyData.controlMode = newProps[0].controlMode;
  563. proxyData.forceOverTimeFlag = newProps[0].forceOverTimeFlag;
  564. proxyData.seviceEquipmentList = newProps[0].seviceEquipmentList;
  565. }
  566. if (newProps[1] && oldProps[1] && newProps[1] != oldProps[1]) {
  567. // 空间id改变的重新获取值调用接口
  568. proxyData.clearLightStatusTimer();
  569. proxyData.showFlag = false;
  570. proxyData.lampList = [];
  571. proxyData.spaceId = newProps[1];
  572. proxyData.getLampList();
  573. }
  574. },
  575. {
  576. deep: true,
  577. immediate: true,
  578. }
  579. );
  580. onBeforeUnmount(() => {
  581. console.log("灯的组件销毁了--");
  582. proxyData.clearLightStatusTimer();
  583. });
  584. onMounted(() => {
  585. // proxyData.clearLightStatusTimer();
  586. proxyData.getLampList();
  587. });
  588. return {
  589. isShowChildLight,
  590. ...toRefs(proxyData),
  591. };
  592. },
  593. });
  594. </script>
  595. <style lang="scss" scoped>
  596. .light {
  597. width: 100%;
  598. background: #ffffff;
  599. box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.07), 0px 4px 10px rgba(0, 0, 0, 0.05);
  600. border-radius: 25px;
  601. margin: 15px 0px;
  602. }
  603. .light-main {
  604. padding-left: 20px;
  605. padding-bottom: 10px;
  606. padding-top: 10px;
  607. }
  608. .light-top {
  609. padding-left: 20px;
  610. // padding-bottom: 10px;
  611. padding-top: 10px;
  612. display: flex;
  613. justify-content: space-between;
  614. }
  615. .light-main-control {
  616. padding-bottom: 15px;
  617. padding-left: 20px;
  618. padding-right: 15px;
  619. // line-height: 36px;
  620. display: flex;
  621. justify-content: space-between;
  622. text-align: right;
  623. div {
  624. width: 36px;
  625. }
  626. .main-color {
  627. width: 36px;
  628. height: 36px;
  629. // line-height: 36px;
  630. text-align: center;
  631. border-radius: 50%;
  632. background: #f7f9fa;
  633. img {
  634. width: 20px;
  635. height: 20px;
  636. margin-top: 8px;
  637. }
  638. }
  639. .switch-btn {
  640. margin-top: 6px;
  641. margin-right: 12px;
  642. }
  643. }
  644. .light-desc {
  645. padding-top: 10px;
  646. // padding-left: 5px;
  647. font-family: PingFang SC;
  648. font-size: 16px;
  649. line-height: 19px;
  650. color: #4d5262;
  651. }
  652. .light-right {
  653. position: relative;
  654. text-align: center;
  655. .switch-box {
  656. padding-top: 20px;
  657. padding-right: 15px;
  658. span {
  659. display: inline-block;
  660. font-family: "PingFang SC";
  661. font-style: normal;
  662. font-weight: 400;
  663. font-size: 14px;
  664. color: #2e3742;
  665. margin-left: 20px;
  666. // width: 60px;
  667. height: 32px;
  668. line-height: 32px;
  669. padding: 0 15px;
  670. background: #f1f4f6;
  671. border-radius: 21px;
  672. }
  673. .switch-item {
  674. &:hover {
  675. background: #e8ecf0;
  676. }
  677. &:active {
  678. background: #e8ecf0;
  679. }
  680. }
  681. }
  682. img {
  683. //width: 98px;
  684. height: 100px;
  685. }
  686. .switch-btn {
  687. position: absolute;
  688. right: -20px;
  689. bottom: 20px;
  690. }
  691. }
  692. .light-title {
  693. font-family: PingFang SC;
  694. padding-left: 5px;
  695. font-size: 16px;
  696. line-height: 19px;
  697. color: #4d5262;
  698. flex: none;
  699. order: 0;
  700. flex-grow: 0;
  701. margin: 5px 0px;
  702. }
  703. .light-status {
  704. font-family: PingFang SC;
  705. padding-left: 5px;
  706. font-size: 12px;
  707. line-height: 16px;
  708. color: #c4c4c4;
  709. flex: none;
  710. order: 1;
  711. flex-grow: 0;
  712. margin: 15px 0px;
  713. }
  714. .show-all {
  715. font-family: "PingFang SC";
  716. font-style: normal;
  717. font-weight: 400;
  718. font-size: 12px;
  719. line-height: 17px;
  720. padding-bottom: 15px;
  721. padding-top: 5px;
  722. color: #cccccc;
  723. text-align: center;
  724. .light-icon {
  725. font-size: 12px;
  726. padding-right: 10px;
  727. }
  728. }
  729. .light-box {
  730. padding: 0 12px;
  731. font-size: 0;
  732. }
  733. .light-control {
  734. display: inline-block;
  735. width: 49%;
  736. vertical-align: middle;
  737. background: #f7f9fa;
  738. border-radius: 16px;
  739. margin-bottom: 12px;
  740. // margin-left: 2%;
  741. &:nth-child(2n - 1) {
  742. margin-right: 2%;
  743. }
  744. .control-top {
  745. display: flex;
  746. padding-right: 16px;
  747. padding-bottom: 12px;
  748. justify-content: space-between;
  749. img {
  750. width: 80px;
  751. height: 70px;
  752. vertical-align: middle;
  753. }
  754. .child-switch {
  755. margin-top: 16px;
  756. display: inline-block;
  757. vertical-align: middle;
  758. }
  759. }
  760. .control-bottom {
  761. display: flex;
  762. justify-content: space-between;
  763. padding-right: 16px;
  764. padding-left: 18px;
  765. padding-bottom: 15px;
  766. .control-title {
  767. font-weight: 500;
  768. font-family: PingFang SC;
  769. font-size: 16px;
  770. line-height: 20px;
  771. color: #4d5262;
  772. }
  773. img {
  774. width: 20px;
  775. height: 20px;
  776. cursor: pointer;
  777. }
  778. }
  779. }
  780. </style>
  781. <style class="style" lang="scss">
  782. .light {
  783. .van-loading__spinner {
  784. color: $elActiveColor !important;
  785. }
  786. .van-switch__loading {
  787. top: 0;
  788. left: 0;
  789. width: 100%;
  790. height: 100%;
  791. line-height: 1;
  792. }
  793. .van-switch--disabled {
  794. opacity: 0.5;
  795. }
  796. }
  797. </style>