deviceControl.vue 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183
  1. <template>
  2. <view class="device-detail">
  3. <view class="device-detail__header">
  4. <u-icon
  5. size="36"
  6. class="arrow-left"
  7. name="arrow-left"
  8. @click="handleBack"
  9. ></u-icon>
  10. {{ title }}
  11. </view>
  12. <view class="device-detail__body">
  13. <view class="tabs">
  14. <view class="tab-container">
  15. <view class="tab-item" v-if="myuser_type" :class="activeTab === 'pestAnalysis'?'active':''" @click="handleTabClick('pestAnalysis')">
  16. 管理员
  17. </view>
  18. <view class="tab-item" :class="activeTab === 'viewImage'?'active':''" @click="handleTabClick('viewImage')">
  19. 设置
  20. </view>
  21. </view>
  22. </view>
  23. <view class="device-detail-content" v-if="activeTab === 'pestAnalysis'">
  24. <view class="device-detail-child-settings" style="width:100%">
  25. <view class="device-detail-viewImage">
  26. <text class="device-detail-label">设备名称:</text>
  27. <view class="device-detail-value" >
  28. <u-input v-model="deviceName" type="text" maxlength="15" placeholder="设备名称" input-align="right" :custom-style="{'font-size':'24rpx'}"/>
  29. </view>
  30. </view>
  31. <view class="device-detail-viewImage">
  32. <text class="device-detail-label">设备ID:</text>
  33. <view class="device-detail-value" >
  34. <u-input v-model="deviceID" disabled type="text" placeholder="设备ID" input-align="right" :custom-style="{'font-size':'24rpx'}"/>
  35. </view>
  36. </view>
  37. <view class="device-detail-viewImage">
  38. <text class="device-detail-label">相机1:</text>
  39. <view class="device-detail-value" @click="openCameraIdPicker('camera1ID')">
  40. <text class="week-text">{{ camera1ID || '请选择相机' }}</text>
  41. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  42. </view>
  43. </view>
  44. <view class="device-detail-viewImage">
  45. <text class="device-detail-label">相机2:</text>
  46. <view class="device-detail-value" @click="openCameraIdPicker('camera2ID')">
  47. <text class="week-text">{{ camera2ID || '请选择相机' }}</text>
  48. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  49. </view>
  50. </view>
  51. <view class="device-detail-viewImage">
  52. <text class="device-detail-label">相机3:</text>
  53. <view class="device-detail-value" @click="openCameraIdPicker('camera3ID')">
  54. <text class="week-text">{{ camera3ID || '请选择相机' }}</text>
  55. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="device-detail-content" style="padding-bottom: 50rpx" v-if="activeTab === 'viewImage'">
  61. <view v-for="(item, index) in deviceList" :key="index" style="width:100%">
  62. <view class="device-detail-name" @click="toggleChildItem(index)">
  63. <text>{{ item.deviceId || item.label }}</text>
  64. <u-icon name="arrow-down" size="24" :class="actionChildItem == index ? 'rotate':''"></u-icon>
  65. </view>
  66. <view v-show="actionChildItem == index" class="device-detail-child-settings-container">
  67. <view class="tabs">
  68. <view class="tab-container">
  69. <view class="tab-item" :class="item.activeTab === 'settings'?'active':''" @click="handleTabChildClick(item, 'settings')">
  70. 拍摄设置
  71. </view>
  72. <view class="tab-item" :class="item.activeTab === 'schedule'?'active':''" @click="handleTabChildClick(item, 'schedule')">
  73. 定时设置
  74. </view>
  75. <view class="tab-item" :class="item.activeTab === 'warning'?'active':''" @click="handleTabChildClick(item, 'warning')">
  76. 触发报警设置
  77. </view>
  78. <view class="tab-item" :class="item.activeTab === 'other'?'active':''" @click="handleTabChildClick(item, 'other')">
  79. 其他设置
  80. </view>
  81. </view>
  82. </view>
  83. <view class="device-detail-child-settings" v-if="item.activeTab === 'settings'">
  84. <view class="device-detail-viewImage">
  85. <text class="device-detail-label">拍照模式:</text>
  86. <view class="device-detail-value" @click="setDeviceItemContorl(item, 'takephoto')">
  87. <text class="week-text">{{ formatPhotoModel(item.photoSettings.photoModel) }}</text>
  88. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  89. </view>
  90. </view>
  91. <view class="device-detail-viewImage">
  92. <text class="device-detail-label">图片大小:</text>
  93. <view class="device-detail-value" @click="setDeviceItemContorl(item, 'imageSize')">
  94. <text class="week-text">{{ formatImageSize(item.photoSettings.imageSize) }}</text>
  95. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  96. </view>
  97. </view>
  98. <view class="device-detail-viewImage">
  99. <text class="device-detail-label">视频大小:</text>
  100. <view class="device-detail-value" @click="setDeviceItemContorl(item, 'videoSize')">
  101. <text class="week-text">{{ formatImageSize(item.photoSettings.videoSize) }}</text>
  102. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  103. </view>
  104. </view>
  105. <view class="device-detail-viewImage">
  106. <text class="device-detail-label">连拍:</text>
  107. <view class="device-detail-value">
  108. <u-input v-model="item.photoSettings.burstPhoto" type="number" :maxlength="4" placeholder="连拍(1-9)" input-align="right" :custom-style="{'font-size':'24rpx'}" @blur="handlePositiveIntBlur(item.photoSettings, 'burstPhoto', 9)"/>
  109. <text class="unit-text">次</text>
  110. </view>
  111. </view>
  112. <view class="device-detail-viewImage">
  113. <text class="device-detail-label">视频长度:</text>
  114. <view class="device-detail-value">
  115. <u-input v-model="item.photoSettings.videoLength" type="number" :maxlength="4" placeholder="视频长度(1-300)" input-align="right" :custom-style="{'font-size':'24rpx'}" @blur="handlePositiveIntBlur(item.photoSettings, 'videoLength', 300)"/>
  116. <text class="unit-text">秒</text>
  117. </view>
  118. </view>
  119. <view class="device-detail-viewImage">
  120. <text class="device-detail-label">拍摄限制:</text>
  121. <view class="device-detail-value">
  122. <u-input v-model="item.photoSettings.photoInterval" type="number" :maxlength="4" placeholder="拍摄限制(0-255)" input-align="right" :custom-style="{'font-size':'24rpx'}" @blur="handlePositiveIntBlur(item.photoSettings, 'photoInterval', 255, 0)" />
  123. <text class="unit-text">次</text>
  124. </view>
  125. </view>
  126. </view>
  127. <view class="device-detail-child-settings" v-if="item.activeTab === 'schedule'">
  128. <view class="device-detail-viewImage">
  129. <text class="device-detail-label">定时拍照:</text>
  130. <text class="device-detail-value">
  131. <u-switch v-model="item.timeSettings.timePhoto" size="36" />
  132. </text>
  133. </view>
  134. <view class="device-detail-viewImage">
  135. <text class="device-detail-label">循环拍摄间隔:</text>
  136. <view class="device-detail-value" @click="openIntervalPicker(item)">
  137. <text class="week-text">{{ item.timeSettings.photoTime || '00:01' }}</text>
  138. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  139. </view>
  140. </view>
  141. <view class="device-detail-viewImage">
  142. <text class="device-detail-label">时间段1:</text>
  143. <view class="device-detail-value">
  144. <text class="time-text" @click="openTimePicker(item, 'time1', 0)">{{ (item.timeSettings.time1 && item.timeSettings.time1[0]) || '开始' }}</text>
  145. <text class="time-sep">-</text>
  146. <text class="time-text" @click="openTimePicker(item, 'time1', 1)">{{ (item.timeSettings.time1 && item.timeSettings.time1[1]) || '结束' }}</text>
  147. </view>
  148. </view>
  149. <view class="device-detail-viewImage">
  150. <text class="device-detail-label">时间段2:</text>
  151. <view class="device-detail-value">
  152. <text class="time-text" @click="openTimePicker(item, 'time2', 0)">{{ (item.timeSettings.time2 && item.timeSettings.time2[0]) || '开始' }}</text>
  153. <text class="time-sep">-</text>
  154. <text class="time-text" @click="openTimePicker(item, 'time2', 1)">{{ (item.timeSettings.time2 && item.timeSettings.time2[1]) || '结束' }}</text>
  155. </view>
  156. </view>
  157. <view class="device-detail-viewImage">
  158. <text class="device-detail-label">时间段3:</text>
  159. <view class="device-detail-value">
  160. <text class="time-text" @click="openTimePicker(item, 'time3', 0)">{{ (item.timeSettings.time3 && item.timeSettings.time3[0]) || '开始' }}</text>
  161. <text class="time-sep">-</text>
  162. <text class="time-text" @click="openTimePicker(item, 'time3', 1)">{{ (item.timeSettings.time3 && item.timeSettings.time3[1]) || '结束' }}</text>
  163. </view>
  164. </view>
  165. <view class="device-detail-viewImage">
  166. <text class="device-detail-label">周重复:</text>
  167. <view class="device-detail-value" @click="openWeekPicker(item)">
  168. <view class="week-text">{{ (item.timeSettings.weekLoop || []).join('、') || '请选择' }}</view>
  169. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  170. </view>
  171. </view>
  172. </view>
  173. <view class="device-detail-child-settings" v-if="item.activeTab === 'warning'">
  174. <view class="device-detail-viewImage">
  175. <text class="device-detail-label">PIR开关:</text>
  176. <text class="device-detail-value">
  177. <u-switch v-model="item.warning.pirOpenOrClose" size="36" />
  178. </text>
  179. </view>
  180. <view class="device-detail-viewImage">
  181. <text class="device-detail-label">PIR灵敏度:</text>
  182. <view class="device-detail-value" @click="setDeviceItemContorl(item, 'pirSensitivity')">
  183. <text class="week-text">{{ formatPirSensitivity(item.warning.pirSensitivity) }}</text>
  184. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  185. </view>
  186. </view>
  187. <view class="device-detail-viewImage">
  188. <text class="device-detail-label">触发时间间隔:</text>
  189. <view class="device-detail-value" @click="setDeviceItemContorl(item, 'pirInterval')">
  190. <text class="week-text">{{ item.warning.triggerTimeInterval || '00:00' }}</text>
  191. <u-icon name="arrow-right" color="#999999" size="24"></u-icon>
  192. </view>
  193. </view>
  194. </view>
  195. <view class="device-detail-child-settings" v-if="item.activeTab === 'other'">
  196. <view class="device-detail-viewImage">
  197. <text class="device-detail-label">信息戳记:</text>
  198. <text class="device-detail-value">
  199. <u-switch v-model="item.other.informationStamp" size="36" />
  200. </text>
  201. </view>
  202. <view class="device-detail-viewImage">
  203. <text class="device-detail-label">自动覆盖:</text>
  204. <text class="device-detail-value">
  205. <u-switch v-model="item.other.autoOverWrite" size="36" />
  206. </text>
  207. </view>
  208. <view class="device-detail-viewImage">
  209. <text class="device-detail-label">相机名称:</text>
  210. <view class="device-detail-value">
  211. <u-input v-model="item.other.photoName" :maxlength="15" placeholder="相机名称(最多15字)" input-align="right" :custom-style="{'font-size':'24rpx'}" />
  212. </view>
  213. </view>
  214. </view>
  215. </view>
  216. </view>
  217. </view>
  218. </view>
  219. <view class="device-detail-btn-footer">
  220. <view class="device-detail-btn" @click="saveSettings">保存</view>
  221. </view>
  222. <u-select v-model="showContorl" :list="list" @confirm="confirmDeviceItemContorl"></u-select>
  223. <u-select v-model="showImageTypeContorl" :list="currentSizeList" @confirm="confirmDeviceItemContorl"></u-select>
  224. <u-select v-model="showVideoTypeContorl" :list="currentSizeList" @confirm="confirmDeviceItemContorl"></u-select>
  225. <u-select v-model="showPirTypeContorl" :list="pirList" @confirm="confirmDeviceItemContorl"></u-select>
  226. <u-select v-model="showPirIntervalContorl" :list="pirIntervalList" @confirm="confirmDeviceItemContorl"></u-select>
  227. <u-picker
  228. v-model="showDateTime"
  229. mode="time"
  230. :params="timeParams"
  231. :default-time="currentDefaultTime"
  232. @confirm="confirmTimePicker"
  233. ></u-picker>
  234. <u-popup v-model="showWeekPicker" mode="bottom" border-radius="16">
  235. <view class="week-picker">
  236. <view class="week-picker__title">周重复</view>
  237. <view class="week-picker__list">
  238. <view
  239. v-for="day in weekList"
  240. :key="day"
  241. class="week-picker__item"
  242. :class="{ active: selectedWeeks.indexOf(day) > -1 }"
  243. @click="toggleWeek(day)"
  244. >{{ day }}</view>
  245. </view>
  246. <view class="week-picker__btn" @click="confirmWeekPicker">确定</view>
  247. </view>
  248. </u-popup>
  249. <u-select v-model="showCameraSelect" :list="cameraSelectList" @confirm="confirmCameraSelect"></u-select>
  250. </view>
  251. </template>
  252. <script>
  253. export default {
  254. data(){
  255. return {
  256. value: 10,
  257. camera1ID: '123',
  258. camera2ID: '456',
  259. camera3ID: '789',
  260. timeParams: {
  261. year: false,
  262. month: false,
  263. day: false,
  264. hour: true,
  265. minute: true,
  266. second: false
  267. },
  268. // 拍照模式可选项(value 与协议 CAM_Mode 对应)
  269. list: [
  270. {
  271. label: '拍照',
  272. value: '0'
  273. },
  274. {
  275. label: '录像',
  276. value: '1'
  277. },
  278. {
  279. label: '拍照+录像',
  280. value: '2'
  281. }
  282. ],
  283. // 图片/视频大小可选项:点击时由当前相机的 options 动态生成
  284. currentSizeList: [],
  285. actionChildItem: 0,
  286. equipContrlForm: {},
  287. time: '',
  288. activeTab: 'pestAnalysis',
  289. title: '设置控制',
  290. myuser_type: false,
  291. deviceType: '',
  292. location: '',
  293. deviceList: [],
  294. d_id: '',
  295. // 双摄主设备 id(相机配置接口入参)
  296. device_id: '',
  297. show: false,
  298. checked: false,
  299. showContorl: false,
  300. showPirTypeContorl: false,
  301. showPirIntervalContorl: false,
  302. // 触发时间间隔可选项:小时 00~60、分钟 00~50 步长 10(与 PC 端一致)
  303. pirIntervalList: (() => {
  304. const list = []
  305. for (let hour = 0; hour <= 60; hour++) {
  306. for (let minute = 0; minute <= 50; minute += 10) {
  307. const hh = ('0' + hour).slice(-2)
  308. const mm = ('0' + minute).slice(-2)
  309. list.push({ label: hh + ':' + mm, value: hh + ':' + mm })
  310. }
  311. }
  312. return list
  313. })(),
  314. pirList: [
  315. {
  316. label: '自动',
  317. value: '0'
  318. },
  319. {
  320. label: '低',
  321. value: '1'
  322. },
  323. {
  324. label: '中',
  325. value: '2'
  326. },
  327. {
  328. label: '高',
  329. value: '3'
  330. }
  331. ],
  332. showDateTime: false,
  333. currentTimeItem: null,
  334. currentTimeField: '',
  335. currentTimeIndex: 0,
  336. currentIntervalItem: null,
  337. currentDefaultTime: '08:00',
  338. showImageTypeContorl: false,
  339. showVideoTypeContorl: false,
  340. showWeekPicker: false,
  341. weekList: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
  342. selectedWeeks: [],
  343. currentWeekItem: null,
  344. currentItem: null,
  345. currentFieldType: '',
  346. deviceName: '',
  347. deviceID: '',
  348. camera1ID: '',
  349. camera2ID: '',
  350. camera3ID: '',
  351. showCameraSelect: false,
  352. currentCameraField: '',
  353. // 相机选择弹层的可选项(打开时按互斥规则过滤)
  354. cameraSelectList: [],
  355. // 主设备下的相机列表(接口获取,作为相机选择弹层可选项)
  356. cameraList: []
  357. }
  358. },
  359. onLoad(options){
  360. this.d_id = options.d_id
  361. this.device_id = options.deviceId || ''
  362. // 管理员 tab 回显
  363. this.deviceID = this.device_id
  364. this.deviceName = options.name ? decodeURIComponent(options.name) : ''
  365. this.getCameraConfig()
  366. this.getCameraDeviceList()
  367. // this.getControlDeviceConfigInfo()
  368. uni.getStorage({
  369. key:"myuser_type",
  370. success:(res)=>{
  371. if(Number(res.data) == 1){
  372. this.myuser_type = true
  373. this.activeTab = 'pestAnalysis'
  374. }else{
  375. this.activeTab = 'viewImage'
  376. }
  377. }
  378. })
  379. },
  380. methods: {
  381. setDeviceItemContorl(item, type){
  382. this.currentItem = item
  383. this.currentFieldType = type
  384. switch(type){
  385. case 'takephoto':
  386. this.showContorl = true
  387. break;
  388. case 'imageSize':
  389. // 可选项来自当前相机配置返回的 options
  390. this.currentSizeList = (item.photoSettings.imageSizeOptions || []).map(label => ({ label: label, value: label }))
  391. this.showImageTypeContorl = true
  392. break;
  393. case 'videoSize':
  394. this.currentSizeList = (item.photoSettings.videoSizeOptions || []).map(label => ({ label: label, value: label }))
  395. this.showVideoTypeContorl = true
  396. break;
  397. case 'pirSensitivity':
  398. this.showPirTypeContorl = true
  399. break;
  400. case 'pirInterval':
  401. this.showPirIntervalContorl = true
  402. break;
  403. }
  404. },
  405. confirmDeviceItemContorl(e){
  406. const fieldMap = {
  407. takephoto: ['photoSettings', 'photoModel'],
  408. imageSize: ['photoSettings', 'imageSize'],
  409. videoSize: ['photoSettings', 'videoSize'],
  410. pirSensitivity: ['warning', 'pirSensitivity'],
  411. pirInterval: ['warning', 'triggerTimeInterval']
  412. }
  413. const target = fieldMap[this.currentFieldType]
  414. if (this.currentItem && target) {
  415. // 统一写入 value(协议编码或选项串),显示由 formatXxx 转文案
  416. this.$set(this.currentItem[target[0]], target[1], e[0].value)
  417. }
  418. },
  419. // 拍照模式编码转文案(与PC端一致:0=拍照,1=录像,2=拍照+录像)
  420. formatPhotoModel(value){
  421. const map = { '0': '拍照', '1': '录像', '2': '拍照+录像' }
  422. return map[value] || value || '--'
  423. },
  424. // 图片/视频大小:直接显示选项串(如 4M/2560*1440)
  425. formatImageSize(value){
  426. return value === '' || value === null || value === undefined ? '--' : value
  427. },
  428. // PIR灵敏度编码转文案(0=自动,1=低,2=中,3=高)
  429. formatPirSensitivity(value){
  430. const map = { '0': '自动', '1': '低', '2': '中', '3': '高' }
  431. return map[value] || value || '--'
  432. },
  433. handleTabChildClick(item, tab){
  434. item.activeTab = tab;
  435. },
  436. // 展开/收起相机设置面板(同时只展开一个,再点一次收起;-1表示全部收起)
  437. toggleChildItem(index){
  438. this.actionChildItem = this.actionChildItem == index ? -1 : index
  439. },
  440. // 失焦时校验:只保留数字并按上下限截断(min 缺省为 1,传 0 表示允许 0,如拍摄限制的不限)
  441. // 小程序上@input回传参数拿不到输入值,且边输入边改值会引发输入框错乱,所以统一在失焦时校正
  442. handlePositiveIntBlur(item, field, max, min){
  443. max = max || 1000
  444. min = min === undefined ? 1 : min
  445. let value = (item[field] === null || item[field] === undefined ? '' : item[field] + '').replace(/\D/g, '')
  446. if (value === '') {
  447. value = String(min)
  448. } else {
  449. value = String(Math.min(Math.max(Number(value), min), max))
  450. }
  451. this.$set(item, field, value)
  452. },
  453. openCameraIdPicker(field) {
  454. this.currentCameraField = field
  455. // 互斥:过滤掉已被其他相机项选中的选项
  456. const fields = ['camera1ID', 'camera2ID', 'camera3ID']
  457. this.cameraSelectList = this.cameraList.filter(c =>
  458. fields.every(f => f === field || this[f] !== c.value)
  459. )
  460. this.showCameraSelect = true
  461. },
  462. confirmCameraSelect(e) {
  463. const value = e[0].value
  464. const fields = ['camera1ID', 'camera2ID', 'camera3ID']
  465. for (let i = 0; i < fields.length; i++) {
  466. if (fields[i] !== this.currentCameraField && this[fields[i]] === value) {
  467. uni.showToast({ title: '该相机已被其他项选择', icon: 'none' })
  468. return
  469. }
  470. }
  471. this[this.currentCameraField] = value
  472. },
  473. // 循环拍摄间隔:时:分选择器(协议 Timer_Interval,00:00~23:59)
  474. openIntervalPicker(item) {
  475. this.currentIntervalItem = item
  476. this.currentDefaultTime = item.timeSettings.photoTime || '00:01'
  477. this.showDateTime = true
  478. },
  479. openTimePicker(item, field, index) {
  480. this.currentIntervalItem = null
  481. this.currentTimeItem = item
  482. this.currentTimeField = field
  483. this.currentTimeIndex = index
  484. const range = item.timeSettings[field] || []
  485. this.currentDefaultTime = range[index] || '08:00'
  486. this.showDateTime = true
  487. },
  488. confirmTimePicker(e) {
  489. const pad = (n) => ('0' + Number(n)).slice(-2)
  490. const value = pad(e.hour) + ':' + pad(e.minute)
  491. // 循环拍摄间隔:直接写入 HH:MM
  492. if (this.currentIntervalItem) {
  493. this.currentIntervalItem.timeSettings.photoTime = value
  494. this.currentIntervalItem = null
  495. return
  496. }
  497. const item = this.currentTimeItem
  498. const field = this.currentTimeField
  499. const index = this.currentTimeIndex
  500. if (!item || !field) return
  501. // 用修改后的临时数据做校验,通过才写入(time1~time3为[开始,结束]数组)
  502. const slots = ['time1', 'time2', 'time3'].map((key, i) => {
  503. const source = item.timeSettings[key] || []
  504. const range = [source[0] || '', source[1] || '']
  505. if (key === field) range[index] = value
  506. return { name: '时间段' + (i + 1), start: range[0], end: range[1] }
  507. })
  508. // 开始==结束视为未配置(如默认回显的 00:00-00:00),不参与校验
  509. const configured = slots.filter(s => s.start && s.end && s.start !== s.end)
  510. for (let i = 0; i < configured.length; i++) {
  511. if (configured[i].start >= configured[i].end) {
  512. uni.showToast({ title: configured[i].name + '的开始时间需小于结束时间', icon: 'none' })
  513. return
  514. }
  515. }
  516. for (let i = 0; i < configured.length - 1; i++) {
  517. const a = configured[i]
  518. const b = configured[i + 1]
  519. if (a.start === b.start && a.end === b.end) {
  520. uni.showToast({ title: a.name + '与' + b.name + '不能重复', icon: 'none' })
  521. return
  522. }
  523. if (a.end > b.start) {
  524. uni.showToast({ title: a.name + '需早于' + b.name, icon: 'none' })
  525. return
  526. }
  527. }
  528. if (!item.timeSettings[field] || item.timeSettings[field].length !== 2) {
  529. this.$set(item.timeSettings, field, ['', ''])
  530. }
  531. this.$set(item.timeSettings[field], index, value)
  532. },
  533. openWeekPicker(item) {
  534. this.currentWeekItem = item
  535. this.selectedWeeks = item.timeSettings.weekLoop ? item.timeSettings.weekLoop.slice() : []
  536. this.showWeekPicker = true
  537. },
  538. toggleWeek(day) {
  539. const index = this.selectedWeeks.indexOf(day)
  540. if (index > -1) {
  541. if (this.selectedWeeks.length === 1) {
  542. uni.showToast({
  543. title: '至少保留一个',
  544. icon: 'none'
  545. })
  546. return
  547. }
  548. this.selectedWeeks.splice(index, 1)
  549. } else {
  550. this.selectedWeeks.push(day)
  551. }
  552. },
  553. confirmWeekPicker() {
  554. if (this.selectedWeeks.length === 0) {
  555. uni.showToast({
  556. title: '请至少选择一个',
  557. icon: 'none'
  558. })
  559. return
  560. }
  561. if (this.currentWeekItem) {
  562. const ordered = this.weekList.filter(day => this.selectedWeeks.indexOf(day) > -1)
  563. this.$set(this.currentWeekItem.timeSettings, 'weekLoop', ordered)
  564. }
  565. this.showWeekPicker = false
  566. },
  567. getProgressWidth(value, min, max) {
  568. if (max === min) return 0
  569. return ((value - min) / (max - min)) * 100
  570. },
  571. onSliderTouchStart(e, field, min, max) {
  572. this.sliderField = field
  573. this.sliderMin = min
  574. this.sliderMax = max
  575. const query = uni.createSelectorQuery().in(this)
  576. query.select('.custom-progress').boundingClientRect(rect => {
  577. this.sliderRect = rect
  578. }).exec()
  579. this.updateSliderValue(e.touches[0].clientX, field, min, max)
  580. },
  581. onSliderTouchMove(e, min, max) {
  582. if (!this.sliderField || !this.sliderRect) return
  583. this.updateSliderValue(e.touches[0].clientX, this.sliderField, min, max)
  584. },
  585. onSliderTouchEnd() {
  586. this.sliderField = ''
  587. },
  588. onSliderTap(e, field, min, max) {
  589. const query = uni.createSelectorQuery().in(this)
  590. query.select('.custom-progress').boundingClientRect(rect => {
  591. this.sliderRect = rect
  592. this.updateSliderValue(e.detail.x + rect.left, field, min, max)
  593. }).exec()
  594. },
  595. updateSliderValue(clientX, field, min, max) {
  596. if (!this.sliderRect) return
  597. let ratio = (clientX - this.sliderRect.left) / this.sliderRect.width
  598. ratio = Math.max(0, Math.min(1, ratio))
  599. const value = Math.round(min + ratio * (max - min))
  600. this.$set(this.equipContrlForm, field, value)
  601. },
  602. handleBack() {
  603. uni.navigateBack({
  604. delta: 1
  605. });
  606. },
  607. handleTabClick(tab) {
  608. this.activeTab = tab;
  609. },
  610. showMqttConfig(){
  611. this.show = true;
  612. },
  613. closeMqttConfig(){
  614. this.show = false;
  615. },
  616. async setDeviceContorl(type){
  617. const data = {
  618. device_type_id: 3,
  619. d_id: this.d_id,
  620. cmd: type,
  621. }
  622. if(type === 'imei'){
  623. data.imei = this.equipContrlForm.imei
  624. }else{
  625. delete data.imei
  626. }
  627. this.$myRequest({
  628. url: '/api/api_gateway?method=forecast.send_control.admin_device_control',
  629. method: 'POST',
  630. data
  631. }).then(res => {
  632. this.closeMqttConfig()
  633. if (res) {
  634. uni.showToast({
  635. title: '设备控制修改成功!',
  636. icon: 'success',
  637. });
  638. } else {
  639. uni.showToast({
  640. title: '设备控制修改失败',
  641. icon: 'error',
  642. });
  643. }
  644. });
  645. },
  646. saveSettings(){
  647. // 管理员 tab:保存设备名称与相机绑定;设置 tab:下发相机配置
  648. if (this.activeTab === 'pestAnalysis') {
  649. this.saveAdminInfo()
  650. return
  651. }
  652. this.saveCameraConfig()
  653. },
  654. // 设置 tab:整包下发相机配置(未改动字段原样透传)
  655. async saveCameraConfig(){
  656. const device_config_data = this.deviceList.map(item => {
  657. // 以回显时的原始配置为底,写回用户改动
  658. const cfg = JSON.parse(JSON.stringify(item.rawConfig || {}));
  659. const p = item.photoSettings;
  660. const t = item.timeSettings;
  661. const w = item.warning;
  662. const o = item.other;
  663. cfg.CAM_Mode = Number(p.photoModel);
  664. if (p.imageSize && p.imageSizeOptions.length) {
  665. cfg.CAM_ImageSize = { options: p.imageSizeOptions, Selected: Math.max(0, p.imageSizeOptions.indexOf(p.imageSize)) };
  666. }
  667. if (p.videoSize && p.videoSizeOptions.length) {
  668. cfg.CAM_VideoSize = { options: p.videoSizeOptions, Selected: Math.max(0, p.videoSizeOptions.indexOf(p.videoSize)) };
  669. }
  670. cfg.CAM_Shooting = String(p.burstPhoto);
  671. cfg.CAM_VideoLength = Number(p.videoLength);
  672. cfg.CAM_MaxShooting = Number(p.photoInterval);
  673. cfg.PIR_Enable = w.pirOpenOrClose ? 1 : 0;
  674. cfg.PIR_Sensitivity = Number(w.pirSensitivity);
  675. cfg.PIR_Interval = w.triggerTimeInterval;
  676. cfg.Timer_Enable = t.timePhoto ? 1 : 0;
  677. cfg.Timer_Interval = t.photoTime;
  678. cfg.Timer_1Start = t.time1[0] || '00:00';
  679. cfg.Timer_1End = t.time1[1] || '00:00';
  680. cfg.Timer_2Start = t.time2[0] || '00:00';
  681. cfg.Timer_2End = t.time2[1] || '00:00';
  682. cfg.Timer_3Start = t.time3[0] || '00:00';
  683. cfg.Timer_3End = t.time3[1] || '00:00';
  684. cfg.Timer_Repeats = this.weeksToRepeats(t.weekLoop);
  685. cfg.Other_Stamp = o.informationStamp ? 1 : 0;
  686. cfg.Other_Cycle = o.autoOverWrite ? 1 : 0;
  687. cfg.Other_DevName = o.photoName;
  688. return { device_id: item.deviceId, device_config: cfg };
  689. });
  690. const res = await this.$myRequest({
  691. url: '/api/api_gateway?method=forecast.shuhai.shuhai_two_camera_update_config',
  692. method: 'POST',
  693. data: {
  694. device_id: this.device_id,
  695. device_config_data: JSON.stringify(device_config_data)
  696. }
  697. });
  698. if (res) {
  699. uni.showToast({
  700. title: '保存成功',
  701. icon: 'success',
  702. });
  703. } else {
  704. uni.showToast({
  705. title: '保存失败',
  706. icon: 'none',
  707. });
  708. }
  709. },
  710. // ['周日','周一'...] → 按周日~周六位序的 7 位串
  711. weeksToRepeats(weeks) {
  712. const weekOrder = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
  713. return weekOrder.map(name => ((weeks || []).indexOf(name) > -1 ? '1' : '0')).join('');
  714. },
  715. // 管理员 tab:保存设备名称与相机1/2/3绑定
  716. async saveAdminInfo(){
  717. const res = await this.$myRequest({
  718. url: '/api/api_gateway?method=forecast.shuhai.shuhai_two_device_info_update',
  719. method: 'POST',
  720. data: {
  721. device_id: this.device_id,
  722. device_name: this.deviceName,
  723. ding_one_device_id: this.camera1ID,
  724. ding_two_device_id: this.camera2ID,
  725. ding_three_device_id: this.camera3ID
  726. }
  727. });
  728. if (res) {
  729. uni.showToast({
  730. title: '保存成功',
  731. icon: 'success',
  732. });
  733. } else {
  734. uni.showToast({
  735. title: '保存失败',
  736. icon: 'none',
  737. });
  738. }
  739. },
  740. async getControlDeviceConfigInfo(){
  741. const res = await this.$myRequest({
  742. url: '/api/api_gateway?method=forecast.send_control.device_control_info',
  743. method: 'POST',
  744. data: {
  745. d_id: this.d_id,
  746. cmd:'paramconf'
  747. },
  748. });
  749. this.equipContrlForm = res
  750. },
  751. // 拉取相机配置并回显:按 camera_config 动态生成相机列表(返回几台显示几台)
  752. async getCameraConfig(){
  753. const res = await this.$myRequest({
  754. url: '/api/api_gateway?method=forecast.shuhai.shuhai_two_camera_config',
  755. method: 'POST',
  756. data: {
  757. device_id: this.device_id
  758. },
  759. });
  760. const configList = (res && res.camera_config) || [];
  761. if (!configList.length) return;
  762. // 相机编号回显(管理员 tab 的相机选择)
  763. this.camera1ID = (configList[0] && configList[0].device_id) || ''
  764. this.camera2ID = (configList[1] && configList[1].device_id) || ''
  765. this.camera3ID = (configList[2] && configList[2].device_id) || ''
  766. this.deviceList = configList.map((camera, index) => {
  767. const cfg = (camera && camera.device_config) || {};
  768. return {
  769. label: '相机' + (index + 1),
  770. content: '',
  771. show: false,
  772. activeTab: 'settings',
  773. deviceId: (camera && camera.device_id) || '',
  774. // 保存时以原始配置为底回传,未改动字段透传
  775. rawConfig: cfg,
  776. // 拍摄设置
  777. photoSettings: {
  778. photoModel: cfg.CAM_Mode !== undefined ? String(cfg.CAM_Mode) : '',
  779. imageSize: this.sizeOf(cfg.CAM_ImageSize),
  780. videoSize: this.sizeOf(cfg.CAM_VideoSize),
  781. burstPhoto: cfg.CAM_Shooting !== undefined ? cfg.CAM_Shooting : '',
  782. videoLength: cfg.CAM_VideoLength !== undefined ? cfg.CAM_VideoLength : '',
  783. photoInterval: cfg.CAM_MaxShooting !== undefined ? cfg.CAM_MaxShooting : '',
  784. // 大小可选项,供下拉选择用
  785. imageSizeOptions: (cfg.CAM_ImageSize && cfg.CAM_ImageSize.options) || [],
  786. videoSizeOptions: (cfg.CAM_VideoSize && cfg.CAM_VideoSize.options) || []
  787. },
  788. // 定时设置
  789. timeSettings: {
  790. // 开关绑布尔值:u-switch 外观只认 value 的布尔真假,字符串 "0" 会被当成开
  791. timePhoto: cfg.Timer_Enable !== undefined ? Number(cfg.Timer_Enable) === 1 : false,
  792. photoTime: cfg.Timer_Interval !== undefined ? cfg.Timer_Interval : '',
  793. time1: [cfg.Timer_1Start || '', cfg.Timer_1End || ''],
  794. time2: [cfg.Timer_2Start || '', cfg.Timer_2End || ''],
  795. time3: [cfg.Timer_3Start || '', cfg.Timer_3End || ''],
  796. weekLoop: this.repeatsToWeeks(cfg.Timer_Repeats)
  797. },
  798. // 触发报警设置
  799. warning: {
  800. pirOpenOrClose: cfg.PIR_Enable !== undefined ? Number(cfg.PIR_Enable) === 1 : false,
  801. pirSensitivity: cfg.PIR_Sensitivity !== undefined ? String(cfg.PIR_Sensitivity) : '',
  802. triggerTimeInterval: cfg.PIR_Interval !== undefined ? cfg.PIR_Interval : ''
  803. },
  804. // 其他设置
  805. other: {
  806. informationStamp: cfg.Other_Stamp !== undefined ? Number(cfg.Other_Stamp) === 1 : false,
  807. autoOverWrite: cfg.Other_Cycle !== undefined ? Number(cfg.Other_Cycle) === 1 : false,
  808. photoName: cfg.Other_DevName !== undefined ? cfg.Other_DevName : ''
  809. }
  810. };
  811. });
  812. },
  813. // {options, Selected} → 选中的选项文案
  814. sizeOf(obj) {
  815. return ((obj && obj.options) || [])[(obj && obj.Selected)] || ''
  816. },
  817. // 拉取主设备下的相机列表,作为相机1/2/3选择弹层的可选项
  818. async getCameraDeviceList(){
  819. const res = await this.$myRequest({
  820. url: '/api/api_gateway?method=forecast.shuhai.get_shuhai_two_camera_device_list',
  821. method: 'POST',
  822. data: {
  823. device_id: this.device_id
  824. },
  825. });
  826. const devices = (res && res.device) || [];
  827. this.cameraList = devices
  828. .map(d => d.camera_id)
  829. .filter(Boolean)
  830. .map(id => ({ label: id, value: id }));
  831. },
  832. // '1111111'(位序:周日~周六)→ 按周一~周日顺序的文案数组
  833. repeatsToWeeks(repeats) {
  834. const weekOrder = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
  835. if (typeof repeats !== 'string' || repeats.length !== 7) return []
  836. const selected = []
  837. weekOrder.forEach((name, i) => {
  838. if (repeats.charAt(i) === '1') selected.push(name)
  839. })
  840. // 按页面上周一~周日的展示顺序重排
  841. return this.weekList.filter(day => selected.indexOf(day) > -1)
  842. },
  843. }
  844. }
  845. </script>
  846. <style scoped lang="scss">
  847. .device-detail {
  848. display: flex;
  849. width: 100%;
  850. height: calc(100vh - 112rpx);
  851. padding-top: 112rpx;
  852. flex-direction: column;
  853. align-items: center;
  854. background: linear-gradient(180deg, #ffffff00 0%, #F5F6FA 23.64%, #F5F6FA 100%), linear-gradient(102deg, #BFEADD 6.77%, #B8F1E7 40.15%, #B9EEF5 84.02%);
  855. .device-detail__header {
  856. width: 100%;
  857. font-size: 28rpx;
  858. color: #999;
  859. color: #042118;
  860. font-family: 'Source Han Sans CN VF';
  861. font-weight: 700;
  862. position: relative;
  863. text-align: center;
  864. .arrow-left {
  865. position: absolute;
  866. left: 32rpx;
  867. margin-right: 12rpx;
  868. }
  869. }
  870. .device-detail__body {
  871. width: calc(100% - 64rpx);
  872. margin: 0 auto;
  873. border-radius: 16rpx;
  874. overflow-x: hidden;
  875. overflow-y: auto;
  876. // 隐藏滚动条
  877. -ms-overflow-style: none;
  878. scrollbar-width: none;
  879. }
  880. .tabs {
  881. margin: 24rpx 0;
  882. border-radius: 16rpx;
  883. padding: 16rpx 0;
  884. padding-top: 0;
  885. .tab-container{
  886. display: flex;
  887. width: 100%;
  888. height: 88rpx;
  889. line-height: 88rpx;
  890. text-align: center;
  891. font-size: 28rpx;
  892. font-weight: 700;
  893. color: #042118;
  894. font-family: 'Source Han Sans CN VF';
  895. }
  896. .tab-item {
  897. margin-right: 40rpx;
  898. color:#999999;
  899. }
  900. .active{
  901. position: relative;
  902. color: #303133;
  903. text-align: center;
  904. font-family: "Source Han Sans CN VF";
  905. font-size: 28rpx;
  906. font-weight: 700;
  907. &::after {
  908. content: '';
  909. position: absolute;
  910. bottom: 10rpx;
  911. left: 50%;
  912. transform: translateX(-50%);
  913. width: 100%;
  914. height: 36rpx;
  915. border-bottom: 6rpx solid #303133;
  916. }
  917. }
  918. }
  919. .device-detail-content{
  920. display: flex;
  921. padding: 24rpx 32rpx;
  922. flex-direction: column;
  923. align-items: flex-start;
  924. gap: 20rpx;
  925. border-radius: 16rpx;
  926. background: #FFF;
  927. .device-detail-name{
  928. flex:1;
  929. width: 100%;
  930. display: flex;
  931. justify-content: space-between;
  932. .rotate{
  933. transform: rotate(180deg);
  934. transition: all 0.3s ease-in-out;
  935. }
  936. }
  937. .device-detail-child-settings-container{
  938. transition: all 0.3s ease-in-out;
  939. padding: 0 24rpx;
  940. }
  941. .tabs {
  942. margin: 2rpx 0;
  943. border-radius: 16rpx;
  944. padding: 6rpx 0;
  945. padding-top: 0;
  946. .tab-container{
  947. display: flex;
  948. width: 100%;
  949. height: 68rpx;
  950. line-height: 68rpx;
  951. text-align: center;
  952. font-size: 24rpx;
  953. color: #042118;
  954. font-family: 'Source Han Sans CN VF';
  955. }
  956. .tab-item {
  957. margin-right: 20rpx;
  958. color:#999999;
  959. }
  960. .active{
  961. position: relative;
  962. color: #303133;
  963. text-align: center;
  964. font-family: "Source Han Sans CN VF";
  965. font-size: 24rpx;
  966. &::after {
  967. content: '';
  968. position: absolute;
  969. bottom: 10rpx;
  970. left: 50%;
  971. transform: translateX(-50%);
  972. width: 100%;
  973. height: 36rpx;
  974. border-bottom: 6rpx solid #303133;
  975. }
  976. }
  977. }
  978. .device-detail-item{
  979. .device-detail-btn-container{
  980. display: flex;
  981. gap: 24rpx;
  982. margin-top: 12rpx;
  983. }
  984. .device-detail-btn{
  985. display: flex;
  986. padding: 10rpx 16rpx;
  987. justify-content: center;
  988. align-items: center;
  989. gap: 16rpx;
  990. border-radius: 16rpx;
  991. background: #0BBC58;
  992. color: #ffffff;
  993. font-family: "Source Han Sans CN VF";
  994. font-size: 26rpx;
  995. font-weight: 400;
  996. }
  997. .force-btn{
  998. background: #FB4E52;
  999. }
  1000. }
  1001. .device-detail-viewImage{
  1002. width: 100%;
  1003. display: flex;
  1004. justify-content: space-between;
  1005. align-items: center;
  1006. height: 70rpx;
  1007. .device-detail-label{
  1008. color: #303133;
  1009. font-family: "Source Han Sans CN VF";
  1010. font-size: 26rpx;
  1011. flex-shrink: 0;
  1012. }
  1013. .device-detail-value{
  1014. color: #303133;
  1015. font-family: "Source Han Sans CN VF";
  1016. font-size: 26rpx;
  1017. display: flex;
  1018. align-items: center;
  1019. justify-content: space-between;
  1020. .week-text{
  1021. flex: 1;
  1022. min-width: 0;
  1023. overflow: hidden;
  1024. text-overflow: ellipsis;
  1025. white-space: nowrap;
  1026. text-align: right;
  1027. margin-right: 8rpx;
  1028. }
  1029. .time-text{
  1030. min-width: 96rpx;
  1031. height: 48rpx;
  1032. line-height: 48rpx;
  1033. padding: 0 16rpx;
  1034. text-align: center;
  1035. border-radius: 10rpx;
  1036. background: #F6F8FC;
  1037. color: #303133;
  1038. font-size: 24rpx;
  1039. font-family: "Source Han Sans CN VF";
  1040. }
  1041. .time-sep{
  1042. margin: 0 8rpx;
  1043. color: #999999;
  1044. }
  1045. .unit-text{
  1046. margin-left: 8rpx;
  1047. flex-shrink: 0;
  1048. color: #303133;
  1049. font-size: 24rpx;
  1050. font-family: "Source Han Sans CN VF";
  1051. }
  1052. }
  1053. }
  1054. }
  1055. .slider-container{
  1056. position: relative;
  1057. margin-bottom: 20rpx;
  1058. .slider-min-value{
  1059. position: absolute;
  1060. left: 0;
  1061. top: -50rpx;
  1062. }
  1063. .slider{
  1064. width: 600rpx;
  1065. }
  1066. .slider-max-value{
  1067. position: absolute;
  1068. right: 0;
  1069. top: -50rpx;
  1070. }
  1071. }
  1072. .custom-progress{
  1073. width: 600rpx;
  1074. padding: 0;
  1075. .progress-track{
  1076. position: relative;
  1077. height: 12rpx;
  1078. background-color: #ebedf0;
  1079. border-radius: 6rpx;
  1080. }
  1081. .progress-fill{
  1082. position: absolute;
  1083. left: 0;
  1084. top: 0;
  1085. height: 100%;
  1086. background-color: #0BBC58;
  1087. border-radius: 6rpx;
  1088. transition: width 0.2s;
  1089. }
  1090. .progress-thumb{
  1091. position: absolute;
  1092. top: 50%;
  1093. width: 28rpx;
  1094. height: 28rpx;
  1095. margin-left: -14rpx;
  1096. margin-top: -14rpx;
  1097. border-radius: 50%;
  1098. background-color: #fff;
  1099. box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  1100. transition: left 0.2s;
  1101. }
  1102. }
  1103. .device-detail-btn-footer{
  1104. position: fixed;
  1105. bottom: 0;
  1106. left: 0;
  1107. width: 100%;
  1108. height: 112rpx;
  1109. line-height: 112rpx;
  1110. text-align: center;
  1111. font-size: 28rpx;
  1112. font-weight: 700;
  1113. color: #042118;
  1114. font-family: 'Source Han Sans CN VF';
  1115. background: #ffffff;
  1116. display: flex;
  1117. justify-content: center;
  1118. align-items: center;
  1119. .device-detail-btn{
  1120. display: flex;
  1121. height: 80rpx;
  1122. width: 90%;
  1123. margin: 0 auto;
  1124. padding: 0rpx 20rpx;
  1125. justify-content: center;
  1126. align-items: center;
  1127. gap: 8rpx;
  1128. border-radius: 16rpx;
  1129. background:#0BBC58;
  1130. color: #ffffff;
  1131. text-align: center;
  1132. font-family: "Source Han Sans CN VF";
  1133. font-size: 14px;
  1134. font-style: normal;
  1135. font-weight: 500;
  1136. }
  1137. }
  1138. .week-picker{
  1139. padding: 32rpx 32rpx 40rpx;
  1140. .week-picker__title{
  1141. text-align: center;
  1142. font-size: 30rpx;
  1143. font-weight: 700;
  1144. color: #042118;
  1145. font-family: 'Source Han Sans CN VF';
  1146. margin-bottom: 32rpx;
  1147. }
  1148. .week-picker__list{
  1149. display: flex;
  1150. flex-wrap: wrap;
  1151. gap: 24rpx;
  1152. margin-bottom: 40rpx;
  1153. }
  1154. .week-picker__item{
  1155. width: calc((100% - 72rpx) / 4);
  1156. height: 64rpx;
  1157. line-height: 64rpx;
  1158. text-align: center;
  1159. border-radius: 12rpx;
  1160. background: #F6F8FC;
  1161. color: #666666;
  1162. font-size: 26rpx;
  1163. font-family: 'Source Han Sans CN VF';
  1164. &.active{
  1165. background: #0BBC58;
  1166. color: #ffffff;
  1167. }
  1168. }
  1169. .week-picker__btn{
  1170. height: 80rpx;
  1171. line-height: 80rpx;
  1172. text-align: center;
  1173. border-radius: 16rpx;
  1174. background: #0BBC58;
  1175. color: #ffffff;
  1176. font-size: 28rpx;
  1177. font-family: 'Source Han Sans CN VF';
  1178. font-weight: 500;
  1179. }
  1180. }
  1181. }
  1182. </style>