Forecast.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  1. <template>
  2. <view class="content">
  3. <!-- <third-comp :key="menuKey"></third-comp> -->
  4. <view v-if="toggleSwitch==false">
  5. <view>
  6. <cu-custom bgColor="bg-blacks" :isBack="false">
  7. <block slot="right"><image src="../../static/picture/fourLine.png" style="width: 30px;height: 30px;margin-left: 2%;" @tap="openDrawer"></image></block>
  8. <block slot="right">
  9. <view class="icon cuIcon-notice text-white" v-if="badge != 0" style="margin-left: -70%;">
  10. <view class="cu-tag looknumber" style="margin-top: -2%;">
  11. <block v-if="badge != 1">{{ badge > 99 ? '99+' : badge }}</block>
  12. </view>
  13. </view>
  14. </block>
  15. <block slot="right"></block>
  16. <block slot="content">{{ address }}</block>
  17. <block slot="right"><view class="plus" @tap="showModal" data-target="viewModal">+</view></block>
  18. <!-- <block slot="right"><view class="plus" @tap="showModal" data-target="viewModal">+</view></block> -->
  19. </cu-custom>
  20. </view>
  21. <!-- 抽屉组件 -->
  22. <!-- 地图组件 -->
  23. <div>
  24. <drawer ref="drawer" @tap="closeDrawer" ></drawer>
  25. </div>
  26. <div class="plusDrawer" @tap="hideModal">
  27. <plusDrawer ref="plusDrawer"></plusDrawer>
  28. </div>
  29. <view v-if="kg==true">
  30. <!-- <div class="plusDrawer" @tap="hideModal"><plusDrawer ref="plusDrawer"></plusDrawer></div> -->
  31. <view class="page-body">
  32. <view class="page-section page-section-gap">
  33. <map style="width: 100%; height: 300px;"
  34. :controls="controls"
  35. :circles="circles"
  36. :polyline="polyline"
  37. :scale="scale"
  38. :latitude="latitude"
  39. :longitude="longitude"
  40. :markers="covers"
  41. >
  42. <cover-view style="color: #000000;" > 经度:{{ mapEnd_1 }}</cover-view>
  43. <cover-view style="color: #000000;"> 纬度:{{ mapEnd_2 }}</cover-view>
  44. </map>
  45. </view>
  46. </view>
  47. </view>
  48. <!--经纬度组件-->
  49. <!-- <view class="InformationCard">
  50. <view class="informationCardAll">
  51. <view class="informationCardTextOne">
  52. <view class="informationCardText">
  53. <view class="textSilver">经度:</view>
  54. <view class="textWhite">{{ mapEnd_1 }}</view>
  55. </view>
  56. </view>
  57. <view class="informationCardTextOne">
  58. <view class="informationCardText">
  59. <view class="textSilver">纬度:</view>
  60. <view class="textWhite">{{ mapEnd_2 }}</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view> -->
  65. <scroll-view @tap="hideModal" scroll-y class="DrawerPage" :class="modalName == 'viewModal' ? 'show' : ''">
  66. <!-- 个人信息组件 -->
  67. <view class="Personal_information_W">
  68. <view class="name">姓名:李占国</view>
  69. <view class="history" @click="mapDate;mapdelete();"> <span class="navigation"></span> </view>
  70. <view class="skills">技能:电力类,机械类</view>
  71. </view>
  72. <!-- 历史曲线组件 -->
  73. <view class="curve" >
  74. <view class="curve_l">健康情况</view>
  75. <view class="curve_r" @tap="common.navTo('/components/bracelet/braceletHistoryCurve?braceletCurve=' + braceletCurve)">历史曲线</view>
  76. <div class="greater"></div>
  77. </view>
  78. <!-- 健康详情组件 -->
  79. <view class="healthy" >
  80. <view class="healthy_H">
  81. <view class="details_z">心跳频率:{{xtpl_computed}}<!-- ({{ bracelet[deviceName][targetName_xtpl][targetName_xtpl_size].value }}) --></view>
  82. <view class="details_m">步数:{{bs_computed}}</view>
  83. <view class="details_y">收缩血压:{{ssxy_computed}}</view>
  84. </view>
  85. <view class="healthy_N">
  86. <view class="details_z">舒张血压:{{szxy_computed}}<!-- ({{ bracelet[deviceName][targetName_szxy][targetName_szxy_size].value }}) --></view>
  87. <view class="details_m">疲劳度:{{pld_computed}}<!-- ({{ bracelet[deviceName][targetName_pld][targetName_pld_size].value }}) --></view>
  88. <view class="details_y">血氧浓度:{{xynd_computed}}<!-- ({{ bracelet[deviceName][targetName_xynd][targetName_xynd_size].value }}) --></view>
  89. </view>
  90. </view>
  91. </scroll-view>
  92. </view>
  93. <view v-if="toggleSwitch==true">
  94. <WeatherProphethomepage ref="r1"></WeatherProphethomepage>
  95. </view>
  96. <!-- <view class="DrawerClose" :class="modalName == 'viewModal' ? 'show' : ''" @tap="hideModal"><text class="cuIcon-pullright"></text></view> -->
  97. </view>
  98. </template>
  99. <script>
  100. import res from '../../common/data.json';
  101. import drawer from '../../components/drawer/threeLineDrawer.vue';
  102. import plusDrawer from '../../components/drawer/plusDrawer.vue';
  103. import WeatherProphethomepage from '../../components/weatherProphethomepage/WeatherProphethomepage.vue';
  104. var _self;
  105. export default {
  106. components: {
  107. drawer: drawer,
  108. plusDrawer: plusDrawer,
  109. WeatherProphethomepage:WeatherProphethomepage
  110. },
  111. data: function() {
  112. return {
  113. kg:true,
  114. leftNavigationtitle:'预测功能分组',
  115. leftbarkg:false,
  116. bs_computed:'',
  117. xtpl_computed:'',
  118. ssxy_computed:'',
  119. szxy_computed:'',
  120. pld_computed:'',
  121. xynd_computed:'',
  122. WeatherProphethomepagebool:true,
  123. toggleSwitch:false,
  124. menuKey:1,
  125. pointKey: 'MHSFCJSFW.NX_GD_MHSF_XX_XX_XXX_XXX_CI0087',
  126. socketTask_bracelet: '',
  127. socketTask_close_bracelet: '',
  128. deviceName: 'Y1-A0BC',
  129. deviceNamePld: 'Y1-A0BC_PLD',
  130. deviceNameBs: 'Y1-A0BC_BS',
  131. deviceNameSsxy: 'Y1-A0BC_SSXY',
  132. deviceNameXtpl: 'Y1-A0BC_XTPL',
  133. deviceNameXynd: 'Y1-A0BC_XYND',
  134. deviceNameSzxy: 'Y1-A0BC_SZXY',
  135. deviceNameLng: 'Y1-A0BC_LNG',
  136. deviceNameLat: 'Y1-A0BC_LAT',
  137. bracelet: {
  138. deviceName: '',
  139. deviceNamePld: '',
  140. deviceNameBs: '',
  141. deviceNameSsxy: '',
  142. deviceNameXtpl: '',
  143. deviceNameXynd: '',
  144. deviceNameSzxy: '',
  145. },
  146. braceletCurve: {},
  147. mapBegin_1:'',
  148. mapEnd_1:'',
  149. mapBegin_2:'',
  150. mapEnd_2:'',
  151. points:[
  152. {
  153. latitude:'',
  154. longitude:''
  155. },
  156. {
  157. latitude:'',
  158. longitude:''
  159. }
  160. ],
  161. list:{},
  162. braceletCurve_SSXY: [],
  163. braceletCurve_PLD: [],
  164. braceletCurve_SZXY: [],
  165. braceletCurve_XTPL: [],
  166. braceletCurve_BS: [],
  167. braceletCurve_XYND: [],
  168. braceletCurve_LNG: [],
  169. braceletCurve_LAT: [],
  170. /* targetdetail_visable: { targetdetail_target: true, targetdetail_curve: true, targetdetail_histogram: true},
  171. targetdetail: { targetdetail_target: '', targetdetail_curve: '', targetdetail_histogram: ''}, */
  172. targetName: '日发电量',
  173. targetUnit: '万kwh',
  174. bool:true,
  175. pld: '',
  176. ssxy: '',
  177. lng: '',
  178. szxy: '',
  179. lat: '',
  180. xtpl: '',
  181. bs: '',
  182. xynd: '',
  183. device_nam: '',
  184. title: 'map',
  185. latitude: 39.907,//定位中心
  186. longitude: 116.39742,//
  187. covers: [
  188. {
  189. latitude:39.909 , //纬度坐标点
  190. longitude:116.39742 , //经度
  191. iconPath: '../../static/picture/forcast/DingWei.png', //显示的图标
  192. title: '阿打算', //标注点名
  193. label: {
  194. //为标记点旁边增加标签
  195. content: '', //文本1
  196. color: '#F76350', //文本颜色
  197. anchorX: 0, //label的坐标,原点是 marker 对应的经纬度
  198. anchorY: -80, //label的坐标,原点是 marker 对应的经纬度
  199. // x:39.909,//这个组件微信在1.2.0以后就废弃了
  200. // y:116.39742,
  201. bgColor: '#fff', //背景色
  202. padding: 5, //文本边缘留白
  203. borderWidth: 1, //边框宽度
  204. borderColor: '#D84C29', //边框颜色
  205. textAlign: 'right' //文本对齐方式。
  206. },
  207. callout: {
  208. //自定义标记点上方的气泡窗口 点击有效
  209. content: '地点1',
  210. color: '#F76350',
  211. fontSize: 12,
  212. borderRadius: 5
  213. }
  214. // anchor:{//经纬度在标注图标的锚点,默认底边中点
  215. // x:5,
  216. // y:1,
  217. // }
  218. } , {
  219. latitude:39.90 ,//最后点
  220. longitude: 116.399,//
  221. iconPath: '../../static/picture/forcast/DingWei.png',
  222. title:'阿迪达斯',
  223. x:'',//
  224. y: '',//116.399
  225. label:{
  226. content:'',
  227. color:'#F76350',
  228. bgColor:'#fff',
  229. padding:5,
  230. borderRadius:4,
  231. },
  232. callout:{
  233. content:'地点2',
  234. color:'#F76350',
  235. fontSize:12
  236. }
  237. }
  238. ],
  239. scale: 15, //地图层级
  240. controls: [
  241. {
  242. //在地图上显示控件,控件不随着地图移动
  243. id: 1, //控件id
  244. /* iconPath: '../../static/picture/forcast/DingWei.png', *///显示的图标
  245. position: {
  246. //控件在地图的位置
  247. left: 15,
  248. top: 15,
  249. width: 40,
  250. height: 40
  251. }
  252. }
  253. ],
  254. circles: [
  255. {
  256. //在地图上显示圆
  257. latitude: 39.9,
  258. longitude: 116.39,
  259. fillColor: '#FFC41F', //填充颜色
  260. color: '#12A1DD', //描边的颜色
  261. radius: 0, //半径
  262. strokeWidth: 2 //描边的宽度
  263. }
  264. ],
  265. polyline: [
  266. { /* .polyline[0].points */
  267. points:[{}],
  268. //指定一系列坐标点,从数组第一项连线至最后一项
  269. /* points: [{ latitude:this.mapBegin_1, longitude:this.mapBegin_2 }, { latitude: this.mapEnd_1, longitude:this.mapEnd_2 }], */
  270. /* points: [{ latitude: 0, longitude: 0 }, { latitude: 0, longitude: 0 }], */
  271. color: '#0000AA', //线的颜色
  272. width: 2, //线的宽度
  273. dottedLine: true, //是否虚线
  274. arrowLine: true //带箭头的线 开发者工具暂不支持该属性
  275. }
  276. ],
  277. badge: 22,
  278. inconList: ['form', 'favor', 'question', 'edit'],
  279. modalName: null,
  280. address: '',
  281. drawerList: [],
  282. plusDrawerList: [],
  283. permissionsInformation:[]
  284. };
  285. },
  286. mounted() {
  287. //document.querySelector('body').setAttribute('style', 'background-color:#000000');
  288. },created: function() {
  289. // this.pushWindPowerStationNameToSessionStorage("麻黄山");
  290. this.viewUserid();
  291. this.monitoringAuthority();
  292. this.address = this.dataprocessing.getWindPowerStationName();
  293. this.FDC=this.dataprocessing.getWindPowerStationId();
  294. this.windPowerStationId =this.dataprocessing.getWindPowerStationId();
  295. this.$nextTick(function() {
  296. //this.getWeatherDataToday();
  297. //this.getWeatherData7();
  298. });
  299. this.cWidth = uni.upx2px(2000);
  300. this.cHeight = uni.upx2px(350);
  301. this.cWidth40 = uni.upx2px(5000);
  302. this.cHeight40 = uni.upx2px(350);
  303. this.windStation =this.dataprocessing.getWindPowerStationNameByNames(this.address);
  304. this.windStationName = this.windStation[0].replace('风电场', '');
  305. },
  306. onLoad(pointKey) {
  307. let _this = this;
  308. this.pointKey = pointKey.pointKey;
  309. this.targetName = pointKey.callTargetName;
  310. this.targetUnit = pointKey.callTargetUnit;
  311. this.braceletData();
  312. /* console.log(_this.bracelet[_this.deviceName]);
  313. console.log(_this.bracelet[_this.deviceName][_this.targetName_pld][0]); */
  314. /* uni.getLocation({//获取当前的位置坐标
  315. type: 'wgs84',
  316. success: function (res) {
  317. console.log('当前位置的经度:' + res.longitude);
  318. console.log('当前位置的纬度:' + res.latitude);
  319. }
  320. }); */
  321. },
  322. onReady() {},
  323. computed: {
  324. targetName_xtpl: function() {
  325. return this.deviceName + '_XTPL';
  326. },
  327. targetName_xtpl_size: function() {
  328. return this.bracelet[this.deviceName][this.targetName_xtpl].length - 1;
  329. },
  330. targetName_pld: function() {
  331. return this.deviceName + '_PLD';
  332. },
  333. targetName_pld_size: function() {
  334. return this.bracelet[this.deviceName][this.targetName_pld].length - 1;
  335. },
  336. targetName_bs: function() {
  337. return this.deviceName + '_BS';
  338. },
  339. targetName_bs_size: function() {
  340. return this.bracelet[this.deviceName][this.targetName_bs].length - 1;
  341. },
  342. targetName_ssxy: function() {
  343. return this.deviceName + '_SSXY';
  344. },
  345. targetName_ssxy_size: function() {
  346. return this.bracelet[this.deviceName][this.targetName_ssxy].length - 1;
  347. },
  348. targetName_szxy: function() {
  349. return this.deviceName + '_SZXY';
  350. },
  351. targetName_szxy_size: function() {
  352. return this.bracelet[this.deviceName][this.targetName_szxy].length - 1;
  353. },
  354. targetName_xynd: function() {
  355. return this.deviceName + '_XYND';
  356. },
  357. targetName_xynd_size: function() {
  358. return this.bracelet[this.deviceName][this.targetName_xynd].length - 1;
  359. },
  360. backStageIp: function() {
  361. return this.$store.state.wholeSituationBackStageIp;
  362. },
  363. backStagePort: function() {
  364. return this.$store.state.wholeSituationBackStagePort;
  365. },
  366. windpowerstationNameToId: function() {
  367. return this.$store.state.windpowerstationNameToId;
  368. }
  369. },
  370. methods: {
  371. viewUserid: function() {
  372. this.plusDrawerList=uni.getStorageSync('plusList');
  373. },
  374. monitoringAuthority: function() {
  375. this.drawerList=uni.getStorageSync('leftlist3');
  376. },
  377. mapdelete(){
  378. //#ifdef H5
  379. if(this.bool){
  380. this.$delete(this.polyline[0],'points');
  381. this.braceletCurve_LNG = this.bracelet[this.deviceName][this.deviceNameLng];
  382. this.braceletCurve_LAT = this.bracelet[this.deviceName][this.deviceNameLat];
  383. this.points[0].longitude=this.bracelet[this.deviceName][this.deviceNameLng][0].value;
  384. this.points[0].latitude=this.bracelet[this.deviceName][this.deviceNameLat][0].value;
  385. this.points[1].longitude=this.bracelet[this.deviceName][this.deviceNameLng][this.braceletCurve_LNG.length-1].value;
  386. this.points[1].latitude=this.bracelet[this.deviceName][this.deviceNameLat][this.braceletCurve_LAT.length-1].value;
  387. for(let val of this.polyline){
  388. this.$set(val,'points',this.points);
  389. this.bool = false;
  390. console.log("true");
  391. }
  392. /* 定义地图经纬度中心 */
  393. var lat= parseFloat(this.mapBegin_2)+parseFloat(this.mapEnd_2);
  394. var lng= parseFloat(this.mapBegin_1)+parseFloat(this.mapEnd_1);
  395. this.latitude = lat/2;
  396. this.longitude = lng/2;
  397. }else{
  398. /* this.braceletCurve_LNG = this.bracelet[this.deviceName][this.deviceNameLng];
  399. this.braceletCurve_LAT = this.bracelet[this.deviceName][this.deviceNameLat];
  400. this.points[0].longitude=this.bracelet[this.deviceName][this.deviceNameLng][0].value;
  401. this.points[0].latitude=this.bracelet[this.deviceName][this.deviceNameLat][0].value;
  402. this.points[1].longitude=this.bracelet[this.deviceName][this.deviceNameLng][this.braceletCurve_LNG.length-1].value;
  403. this.points[1].latitude=this.bracelet[this.deviceName][this.deviceNameLat][this.braceletCurve_LAT.length-1].value;
  404. */
  405. /* this.$replace(this.polyline[0],'points'); */
  406. /* this.latitude = this.mapBegin_2+this.mapEnd_2/2;
  407. this.longitude = this.mapBegin_1+this.mapEnd_1/2; */
  408. console.log("false");
  409. /* 还原定位中心位置 */
  410. this.latitude = this.mapBegin_2;
  411. this.longitude = this.mapBegin_1;
  412. this.bool = true;
  413. }
  414. this.$forceUpdate();
  415. //#endif
  416. //#ifdef APP-PLUS
  417. if(this.bool){
  418. this.$delete(this.polyline[0],'points');
  419. this.braceletCurve_LNG = this.bracelet[this.deviceName][this.deviceNameLng];
  420. this.braceletCurve_LAT = this.bracelet[this.deviceName][this.deviceNameLat];
  421. this.points[0].longitude=this.bracelet[this.deviceName][this.deviceNameLng][0].value;
  422. this.points[0].latitude=this.bracelet[this.deviceName][this.deviceNameLat][0].value;
  423. this.points[1].longitude=this.bracelet[this.deviceName][this.deviceNameLng][this.braceletCurve_LNG.length-1].value;
  424. this.points[1].latitude=this.bracelet[this.deviceName][this.deviceNameLat][this.braceletCurve_LAT.length-1].value;
  425. for(let val of this.polyline){
  426. this.$set(val,'points',this.points);
  427. this.bool = false;
  428. console.log("true");
  429. }
  430. /* 定义地图经纬度中心 */
  431. var lat= parseFloat(this.mapBegin_2)+parseFloat(this.mapEnd_2);
  432. var lng= parseFloat(this.mapBegin_1)+parseFloat(this.mapEnd_1);
  433. this.latitude = lat/2;
  434. this.longitude = lng/2;
  435. }else{
  436. /* this.braceletCurve_LNG = this.bracelet[this.deviceName][this.deviceNameLng];
  437. this.braceletCurve_LAT = this.bracelet[this.deviceName][this.deviceNameLat];
  438. this.points[0].longitude=this.bracelet[this.deviceName][this.deviceNameLng][0].value;
  439. this.points[0].latitude=this.bracelet[this.deviceName][this.deviceNameLat][0].value;
  440. this.points[1].longitude=this.bracelet[this.deviceName][this.deviceNameLng][this.braceletCurve_LNG.length-1].value;
  441. this.points[1].latitude=this.bracelet[this.deviceName][this.deviceNameLat][this.braceletCurve_LAT.length-1].value;
  442. */
  443. this.$delete(this.polyline[0],'points');
  444. /* this.latitude = this.mapBegin_2+this.mapEnd_2/2;
  445. this.longitude = this.mapBegin_1+this.mapEnd_1/2; */
  446. console.log("false");
  447. /* 还原定位中心位置 */
  448. this.latitude = this.mapBegin_2;
  449. this.longitude = this.mapBegin_1;
  450. this.bool = true;
  451. }
  452. this.$forceUpdate();
  453. //#endif
  454. },
  455. mapDate(){
  456. },
  457. openDrawer: function() {
  458. this.kg=false;
  459. this.$refs.drawer.openDrawer(250, this.drawerList, this.inconList,this.leftNavigationtitle);
  460. },
  461. closeDrawer: function() {
  462. this.drawerIsShow = false;
  463. },
  464. pushWindPowerStationNameToSessionStorage(windpowerstationName) {
  465. uni.setStorageSync('windpowerstationName', windpowerstationName);
  466. //sessionStorage.setItem('windpowerstationName', windpowerstationName);
  467. //alert("v"+ sessionStorage.getItem("windpowerstationName"));
  468. //this.common.goback('/pages/index/Index');
  469. },
  470. getWindPowerStationNameToSessionStorage() {
  471. uni.getStorageSync('windpowerstationName');
  472. return uni.getStorageSync('windpowerstationName');
  473. },
  474. leftbar(){
  475. this.kg=true;
  476. },
  477. onHide() {
  478. this.$refs.drawer.closeDrawer();
  479. this.hideModal();
  480. },
  481. onShow: function() {
  482. this.leftbar();
  483. this.windPowerStationId = uni.getStorageSync('windPowerStationId');
  484. this.address = this.getWindPowerStationNameToSessionStorage();
  485. this.viewUserid();
  486. this.monitoringAuthority();
  487. },
  488. showModal(e) {
  489. this.kg=false;
  490. this.modalName = e.currentTarget.dataset.target;
  491. this.$refs.plusDrawer.showModal(this.plusDrawerList, this.modalName);
  492. },
  493. hideModal() {
  494. this.leftbar();
  495. this.modalName = null;
  496. //this.$refs.plusDrawer.hideModal(this.modalName);
  497. },
  498. braceletData() {
  499. let _this = this;
  500. let ip;
  501. uni.request({
  502. url: 'http://' + _this.backStageIp + ':' + _this.backStagePort + '/bracelet/bracelet?beginDate=2020-04-20 09:26:27&&endDate=2020-04-25 09:26:29',
  503. success: res => {
  504. ip = res.data;
  505. }
  506. });
  507. // 创建一个this.socketTask对象【发送、接收、关闭socket都由这个对象操作】
  508. this.socketTask_bracelet = uni.connectSocket({
  509. /* 【非常重要】必须确保你的服务器是成功的,如果是手机测试千万别使用ws://127.0.0.1:9099【特别容易犯的错误】 */
  510. url: 'ws://' + _this.backStageIp + ':' + _this.backStagePort + '/websocket/pageNumber_9/functionNumber_1',
  511. success(data) {
  512. console.log('websocket连接成功');
  513. }
  514. });
  515. // 消息的发送和接收必须在正常连接打开中,才能发送或接收【否则会失败】
  516. this.socketTask_bracelet.onOpen(res => {
  517. console.log('WebSocket连接正常打开中...!');
  518. _this.is_open_socket = true;
  519. // 注:只有连接正常打开中 ,才能正常收到消息
  520. _this.socketTask_bracelet.onMessage(res => {
  521. //console.log("收到服务器内容:" + res.data);
  522. _this.bracelet = JSON.parse(res.data)[ip];
  523. _this.braceletCurve = JSON.stringify(_this.bracelet[_this.deviceName]);
  524. /* 获取起始经纬度 */
  525. _this.braceletCurve_LNG = _this.bracelet[_this.deviceName][_this.deviceNameLng];
  526. _this.braceletCurve_LAT = _this.bracelet[_this.deviceName][_this.deviceNameLat];
  527. _this.mapBegin_1 = (_this.bracelet[_this.deviceName][_this.deviceNameLng][0].value);
  528. _this.mapBegin_2 = (_this.bracelet[_this.deviceName][_this.deviceNameLat][0].value);
  529. _this.mapEnd_1 = (_this.bracelet[_this.deviceName][_this.deviceNameLng][_this.braceletCurve_LNG.length-1].value);
  530. _this.mapEnd_2 = (_this.bracelet[_this.deviceName][_this.deviceNameLat][_this.braceletCurve_LAT.length-1].value);
  531. _this.latitude = _this.mapBegin_2;
  532. _this.longitude = _this.mapBegin_1;
  533. _this.covers[0].latitude = _this.mapBegin_2;
  534. _this.covers[0].longitude = _this.mapBegin_1;
  535. _this.covers[1].latitude = _this.mapEnd_2;
  536. _this.covers[1].longitude = _this.mapEnd_1;
  537. _this.bs_computed = _this.bracelet[_this.deviceName][_this.targetName_bs][_this.targetName_bs_size].value;
  538. _this.xtpl_computed = _this.bracelet[_this.deviceName][_this.targetName_xtpl][_this.targetName_xtpl_size].value;
  539. _this.ssxy_computed = _this.bracelet[_this.deviceName][_this.targetName_ssxy][_this.targetName_ssxy_size].value;
  540. _this.szxy_computed = _this.bracelet[_this.deviceName][_this.targetName_szxy][_this.targetName_szxy_size].value;
  541. _this.pld_computed = _this.bracelet[_this.deviceName][_this.targetName_pld][_this.targetName_pld_size].value;
  542. _this.xynd_computed = _this.bracelet[_this.deviceName][_this.targetName_xynd][_this.targetName_xynd_size].value;
  543. /* this.braceletCurve_LNG = this.bracelet[this.deviceName][this.deviceNameLng];
  544. this.braceletCurve_LAT = this.bracelet[this.deviceName][this.deviceNameLat];
  545. this.points[0].longitude=this.bracelet[this.deviceName][this.deviceNameLng][0].value;
  546. this.points[0].latitude=this.bracelet[this.deviceName][this.deviceNameLat][0].value;
  547. this.points[1].longitude=this.bracelet[this.deviceName][this.deviceNameLng][this.braceletCurve_LNG.length-1].value;
  548. this.points[1].latitude=this.bracelet[this.deviceName][this.deviceNameLat][this.braceletCurve_LAT.length-1].value; */
  549. /* _this.mapDate(); */
  550. /* _this.polyline[0].points[0].latitude=_this.mapBegin_2;
  551. _this.polyline[0].points[0].longitude=_this.mapBegin_1;
  552. _this.polyline[0].points[1].latitude=_this.mapEnd_2;
  553. _this.polyline[0].points[1].longitude=_this.mapEnd_1; */
  554. /* _this.braceletCurve_SSXY = _this.bracelet[_this.deviceName][_this.deviceNameSsxy];
  555. _this.braceletCurve_SZXY = _this.bracelet[_this.deviceName][_this.deviceNameSzxy];
  556. _this.braceletCurve_XYND = _this.bracelet[_this.deviceName][_this.deviceNameXynd];
  557. _this.braceletCurve_XTPL = _this.bracelet[_this.deviceName][_this.deviceNameXtpl];
  558. _this.braceletCurve_BS = _this.bracelet[_this.deviceName][_this.deviceNameBs];
  559. console.log(_this.braceletCurve_BS[0].value); */
  560. });
  561. });
  562. // 这里仅是事件监听【如果socket关闭了会执行】
  563. this.socketTask_bracelet.onClose(() => {
  564. uni.request({
  565. url: 'http://' + _this.backStageIp + ':' + _this.backStagePort + '/bracelet/close_bracelet?pointKey=' + _this.pointKey,
  566. success: res => {}
  567. });
  568. });
  569. }
  570. }
  571. };
  572. </script>
  573. <style>
  574. body {
  575. font-family: '方正兰亭细黑_GBK';
  576. font-size: 15px;
  577. color: silver;
  578. background: #000;
  579. }
  580. @font-face {
  581. font-family: '方正兰亭细黑_GBK';
  582. src: url(../../static/fzltxh.TTF);
  583. }
  584. .content{
  585. //background-color: #000000;
  586. }
  587. page {
  588. background-color: #1f1f1f;
  589. font-family: '方正兰亭细黑_GBK';
  590. overflow-x: hidden;
  591. }
  592. .top {
  593. width: 100%;
  594. height: 130upx;
  595. padding-top: 5upx;
  596. background-color: #1f1f1f;
  597. position: fixed;
  598. top: 0px;
  599. left: 0px;
  600. z-index: 100;
  601. }
  602. .threeLine {
  603. width: 50px;
  604. height: 45px;
  605. float: left;
  606. }
  607. .text {
  608. width: calc(100% - 100px);
  609. height: 45px;
  610. float: left;
  611. user-select: text;
  612. -webkit-user-select: text;
  613. -moz-user-select: text;
  614. -ms-user-select: text;
  615. color: silver;
  616. line-height: 45px;
  617. margin-top: 11px;
  618. font-size: 18px;
  619. }
  620. .notice {
  621. width: 50px;
  622. height: 45px;
  623. float: left;
  624. }
  625. .plus {
  626. width: 30px;
  627. height: 45px;
  628. float: right;
  629. color: white;
  630. font-size: 35px;
  631. line-height: 45px;
  632. text-align: right;
  633. margin-right: 2.5%;
  634. }
  635. .textWindpowerstation {
  636. width: 180px;
  637. height: 45px;
  638. float: left;
  639. text-align: center;
  640. margin-left: 18px;
  641. }
  642. .InformationCard {
  643. position: absolute;
  644. top: 50px;
  645. left: 0px;
  646. margin-top: 0px;
  647. width: 50%;
  648. height: 8%;
  649. background: rgba(0, 0, 0, 0);
  650. float: left;
  651. }
  652. .informationCardAll {
  653. width: 95%;
  654. margin-left: 2.5%;
  655. margin-top: 10px;
  656. height: 60px;
  657. float: left;
  658. }
  659. .informationCardTextOne {
  660. width: 100%;
  661. height: 35px;
  662. float: left;
  663. margin-top: -10px;
  664. }
  665. .informationCardText {
  666. /* margin-left: 2%; */
  667. width: 65px;
  668. height: 35px;
  669. line-height: 35px;
  670. user-select: text;
  671. -webkit-user-select: text;
  672. -moz-user-select: text;
  673. -ms-user-select: text;
  674. color: silver;
  675. font-size: 10px;
  676. transform: scale(0.975);
  677. float: left;
  678. font-weight: 1000;
  679. }
  680. .textSilver {
  681. user-select: text;
  682. -webkit-user-select: text;
  683. -moz-user-select: text;
  684. -ms-user-select: text;
  685. color: black;
  686. float: left;
  687. }
  688. .textWhite {
  689. color: black;
  690. float: right;
  691. width: 24px;
  692. font-size: 10px;
  693. margin-right: 13%;
  694. transform: scale(0.975);
  695. /* text-align: right; */
  696. }
  697. .Personal_information_W {
  698. position: relative;
  699. /* margin-top: 3%; */
  700. width: 90%;
  701. height: 80px;/*
  702. background-color: #242424; */
  703. border-bottom: #BDBDBD solid 0.5px;
  704. transform: translateX(-50%);
  705. left: 50%;
  706. color: #B8B7B7;
  707. }
  708. .name{
  709. position: absolute;
  710. height: 30px;
  711. width: 130px;
  712. left: 3%;
  713. /* background: -webkit-linear-gradient(top, rgba(159, 131, 111, 0.1) 0%, rgba(193, 94, 21, 0.2) 100%); */
  714. text-align: left;
  715. line-height: 30px;
  716. margin-top: 1%;
  717. font-weight: 1000;
  718. }
  719. .history {
  720. position: absolute;
  721. margin-top: 6%;
  722. right: 3%;
  723. height: 30px;
  724. height: 20px;
  725. text-align: center;
  726. line-height: 30px;
  727. }
  728. .skills {
  729. position: absolute;
  730. top: 56%;
  731. left: 3%;
  732. height: 25px;
  733. width: 180px;/*
  734. background: -webkit-linear-gradient(top, rgba(159, 131, 111, 0.1) 0%, rgba(193, 94, 21, 0.2) 100%); */
  735. text-align: left;
  736. line-height: 30px;
  737. }
  738. .curve{
  739. position: relative;
  740. width: 90%;
  741. transform: translateX(-50%);
  742. left: 50%;
  743. height: 30px;
  744. margin-top: 3%;
  745. color: #B8B7B7;
  746. font-weight: 1000;
  747. }
  748. .curve_l{
  749. position: absolute;
  750. left: 3%;
  751. }
  752. .curve_r{
  753. position: absolute;
  754. right: 3%;
  755. }
  756. .healthy {
  757. margin-left: 3%;
  758. height: 180px;
  759. width: 95%;
  760. margin-bottom: 100px;
  761. text-align: center;
  762. color: #B8B7B7;
  763. font-size: 12px;
  764. line-height:65px ;
  765. font-weight: 1000;
  766. }
  767. .healthy_H,
  768. .healthy_N,
  769. .healthy_W {
  770. background-color:#242424;
  771. position: relative;
  772. width: 100%;
  773. height: 42%;
  774. text-align: center;
  775. /* padding-bottom: 1%; */
  776. }
  777. .details_z {
  778. position: absolute;
  779. background: -webkit-linear-gradient(top, rgba(159, 131, 111, 0.1) 0%, rgba(193, 94, 21, 0.2) 100%);
  780. width: 30%;
  781. left:3%;
  782. height: 60px;
  783. top: 3%;
  784. margin-top: 2%;
  785. }
  786. .details_m {
  787. position: absolute;
  788. background: -webkit-linear-gradient(top, rgba(159, 131, 111, 0.1) 0%, rgba(193, 94, 21, 0.2) 100%);
  789. width: 30%;
  790. left: 35.5%;
  791. height: 60px;
  792. top: 3%;
  793. margin-top: 2%;
  794. }
  795. .details_y {
  796. position: absolute;
  797. background: -webkit-linear-gradient(top, rgba(159, 131, 111, 0.1) 0%, rgba(193, 94, 21, 0.2) 100%);
  798. width: 30%;
  799. left: 68%;
  800. height: 60px;
  801. top: 3%;
  802. margin-top: 2%;
  803. /* margin-bottom: 0.6%;
  804. margin-top: 0.6%;
  805. float: right;
  806. margin-left: 0.2%;
  807. margin-right: 1.2%;
  808. width: 31%;
  809. height: 100%;
  810. background: -webkit-linear-gradient(top, rgba(159, 131, 111, 0.1) 0%, rgba(193, 94, 21, 0.2) 100%);
  811. color: silver;
  812. text-align: center;
  813. padding-top: 10px;
  814. background-color: #ffffff;
  815. font-size: 12px;
  816. padding-bottom: 4px;
  817. line-height: 13px;
  818. border-radius: 5px;
  819. padding-top: 8px; */
  820. }
  821. .navigation::after {
  822. content: url(../../static/picture/forcast/position.png);
  823. }
  824. /* .greater {
  825. position: relative;
  826. width: 249px;
  827. height: 35px;
  828. border: 1px solid #000;
  829. } */
  830. .greater{
  831. float: right;
  832. content: "";
  833. margin-top: 0.8%;
  834. margin-right: 0.8%;
  835. /* position: absolute; */
  836. /* top: 8px;
  837. right: 15px; */
  838. width: 8px;
  839. height: 8px;
  840. border-right: 2px solid #fff;
  841. border-bottom: 2px solid #fff;
  842. transform: rotate(-45deg);
  843. }
  844. .windStationNameAndChoice {
  845. clear: both;
  846. width: 100%;
  847. height: 30px;
  848. margin-top: 1%;
  849. color: silver;
  850. /* border: 1px solid red; */
  851. }
  852. .windStationName {
  853. width: 50%;
  854. height: 100%;
  855. float: left;
  856. line-height: 30px;
  857. font-size: 14px;
  858. margin-left: 9.5%;
  859. }
  860. .windStationChoice {
  861. width: 20%;
  862. height: 100%;
  863. float: right;
  864. text-align: right;
  865. line-height: 30px;
  866. font-size: 14px;
  867. margin-right: 5%;
  868. }
  869. .s-popup-wrapper {
  870. width: 500rpx;
  871. background-color: #f0f0f0;
  872. }
  873. .s-popup-title {
  874. width: 100%;
  875. height: 50px;
  876. background-color: #211E21;
  877. }
  878. .s-popup-word {
  879. width: calc(100% - 65px);
  880. height: 50px;
  881. font-size: 14px;
  882. color: white;
  883. line-height: 50px;
  884. float: left;
  885. margin-left: 25px;
  886. }
  887. .s-popup-cha {
  888. width: 40px;
  889. height: 50px;
  890. text-align: center;
  891. line-height: 50px;
  892. float: right;
  893. font-size: 24px;
  894. }
  895. .windStationItemContainer {
  896. width: 100%;
  897. }
  898. .windStationItemContainerBlack {
  899. width: 100%;
  900. background-color: grey;
  901. color: white;
  902. }
  903. .windStationItem {
  904. width: 80%;
  905. height: 50px;
  906. border-bottom: 1px solid #c8c8c8;
  907. text-align: left;
  908. line-height: 50px;
  909. margin-left: 10%;
  910. color: #333333;
  911. }
  912. .DrawerPage {
  913. position: fixed;
  914. width: 100vw;
  915. height: 100vh;
  916. left: 0vw;
  917. background-color: #1f1f1f;
  918. transition: all 0.4s;
  919. }
  920. .DrawerPage.show {
  921. transform: scale(0.9, 0.9);
  922. left: 85vw;
  923. box-shadow: 0 0 60upx rgba(0, 0, 0, 0.2);
  924. transform-origin: 0;
  925. }
  926. .DrawerPage .cu-bar.tabbar .action button.cuIcon {
  927. width: 64upx;
  928. height: 64upx;
  929. line-height: 64upx;
  930. margin: 0;
  931. display: inline-block;
  932. }
  933. .DrawerPage .cu-bar.tabbar .action .cu-avatar {
  934. margin: 0;
  935. }
  936. .DrawerPage .nav {
  937. flex: 1;
  938. }
  939. .DrawerPage .nav .cu-item.cur {
  940. border-bottom: 0;
  941. position: relative;
  942. }
  943. .DrawerPage .nav .cu-item.cur::after {
  944. content: '';
  945. width: 10upx;
  946. height: 10upx;
  947. background-color: currentColor;
  948. position: absolute;
  949. bottom: 10upx;
  950. border-radius: 10upx;
  951. left: 0;
  952. right: 0;
  953. margin: auto;
  954. }
  955. .DrawerPage .cu-bar.tabbar .action {
  956. flex: initial;
  957. }
  958. </style>