index.vue 22 KB

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