Selaa lähdekoodia

feat(设备管理): 添加DGP光谱图片列表功能并优化设备详情

- 新增DGP光谱图片列表页面
- 优化设备详情页的设备ID显示逻辑
- 修复视频播放器兼容性问题
- 调整设备导航逻辑
- 添加未配置配方选项
- 更新视频流地址配置
allen 13 tuntia sitten
vanhempi
commit
50feb34ae9

+ 9 - 0
pages.json

@@ -5,7 +5,9 @@
 	"pages": [{
 			"path": "pages/index/index",
 			"style": {
+				"enablePullDownRefresh": false,
 				"navigationBarTitleText": "首页",
+				"navigationStyle": "custom",
 				"navigationBarBackgroundColor": "#00B075"
 			}
 		},
@@ -1077,6 +1079,13 @@
 						"navigationBarTitleText": "",
 						"enablePullDownRefresh": false
 					}
+				},
+				{
+					"path": "dgpImagelist",
+					"style": {
+						"navigationBarTitleText": "光谱图片列表",
+						"enablePullDownRefresh": false
+					}
 				}
 			]
 		},

+ 8 - 11
pages/cb/equip-detail/equip-detail-new.vue

@@ -8,7 +8,7 @@
           :src="`${$imageURL}/bigdata_app/image/fourMoodBase/${equipInfo.type}.png`"
           mode=""
         ></image>
-        {{ equipInfo.imei || equipInfo.device_id }}
+        {{ equipInfo.imei || equipInfo.device_id ||equipInfo.id  }}
         <image
           :src="$imageURL+'/bigdata_app/image/environment/fuzhi.png'"
           mode=""
@@ -19,10 +19,10 @@
           :class="[
             'float-right',
             'yficonfont',
-            equipInfo.is_online == 1 ? 'on icon-zaixian' : 'off icon-lixian',
+            equipInfo.status == 1 ? 'on icon-zaixian' : 'off icon-lixian',
           ]"
         >
-          {{ equipInfo.is_online == 1 ? '在线' : '离线' }}
+          {{ equipInfo.status == 1 ? '在线' : '离线' }}
         </view>
       </view>
       <view class="info-list">
@@ -219,7 +219,7 @@ export default {
         getUserPermission(),
         this.equipInfo.pur_id
       );
-      permission.forEach((item) => {
+      permission?.forEach((item) => {
         if (item.purview_name == '查看图片') {
           this.cbd.unshift({
             icon: '/image/cb/1.png',
@@ -288,9 +288,6 @@ export default {
 			    txt: '设备版本',
 			    value: this.newState.dver_num,
 			  },
-
-			  
-			  
 			]
 		}else if(this.equipInfo.type==34){
 			return [
@@ -468,7 +465,7 @@ export default {
       Number(this.equipInfo.equip_type) ||
       Number(this.equipInfo.device_type_id);
     this.equipInfo.type = this.type;
-    this.device_status = this.equipInfo.is_online;
+    this.device_status = this.equipInfo.status;
 
     this.getState();
 
@@ -488,7 +485,7 @@ export default {
         url: '/api/api_gateway?method=new_gateway.device_info.devices_list',
         data: {
           device_type_id: this.equipInfo.type,
-          id: this.equipInfo.imei || this.equipInfo.device_id,
+          id: this.equipInfo.imei || this.equipInfo.device_id || this.equipInfo.id,
           page: 1,
           size: 999,
         },
@@ -513,7 +510,7 @@ export default {
 
     partClick(path) {
       console.log(path);
-      var device_id = this.equipInfo.device_id || this.equipInfo.imei;
+      var device_id = this.equipInfo.device_id || this.equipInfo.imei || this.equipInfo.id;
       uni.navigateTo({
         url:
           path +
@@ -642,7 +639,7 @@ export default {
     copy(item) {
       console.log(item);
       uni.setClipboardData({
-        data: item.imei || item.device_id,
+        data: item.imei || item.device_id || item.id,
         success: function () {
           console.log('success');
         },

+ 6 - 6
pages/cb/equip-detail/equip-detail.vue

@@ -2,12 +2,12 @@
 	<view>
 		<view :class="['info',equipInfo.is_online==1?'on':'off']">
 			<view class="" @click="copy(equipInfo)">
-				设备ID:{{equipInfo.imei||equipInfo.device_id}}
+				设备ID:{{equipInfo.imei||equipInfo.device_id||equipInfo.id}}
 				<image :src="$imageURL+'/bigdata_app/image/environment/fuzhi.png'" mode="" class="tishi">
 				</image>
 			</view>
 			<view class="">
-				设备名称:{{equipInfo.device_name?equipInfo.device_name:"无"}}
+				设备名称:{{equipInfo.name?equipInfo.name:"无"}}
 			</view>
 			<view class="">
 				设备类型:<span v-if="equipInfo.type">{{equipInfo.type|equipType}}</span><span
@@ -525,7 +525,7 @@
 					data: {
 						device_type_id: this.equipInfo.type || this.equipInfo.equip_type || this.equipInfo
 							.device_type_id,
-						device_id: this.equipInfo.imei || this.equipInfo.device_id,
+						device_id: this.equipInfo.imei || this.equipInfo.device_id || this.equipInfo.id,
 						page: 1,
 						page_size: 1,
 						start_time: Math.floor((+new Date() - 24 * 60 * 60 * 1000) / 1000),
@@ -559,7 +559,7 @@
 			},
 			partClick(path) {
 				console.log(path)
-				var device_id = this.equipInfo.device_id || this.equipInfo.imei
+				var device_id = this.equipInfo.device_id || this.equipInfo.imei || this.equipInfo.id
 				uni.navigateTo({
 					url: path + '?d_id=' + this.equipInfo.d_id + "&device_id=" + device_id + "&device_type=" + this
 						.type + "&disable=" + this.equipInfo.disable
@@ -567,7 +567,7 @@
 			},
 			partClicks() {
 				var path = ""
-				var device_id = this.equipInfo.device_id || this.equipInfo.imei
+				var device_id = this.equipInfo.device_id || this.equipInfo.imei || this.equipInfo.id
 				if (this.type == 3) {
 					path = "/pages/cb/cbd/equip-set/historyfile"
 				} else if (this.type == 7) {
@@ -678,7 +678,7 @@
 			copy(item) {
 				console.log(item)
 				uni.setClipboardData({
-					data: item.imei || item.device_id,
+					data: item.imei || item.device_id || item.id,
 					success: function() {
 						console.log('success');
 					}

+ 11 - 0
pages/cb/shuifeizsFirst/autoSetting.vue

@@ -255,6 +255,17 @@ export default {
       list.forEach((item,index)=>{
         item.label = '配方' + (index + 1);
       })
+      // 8 表示未配置
+      list.push({
+        'Part008:Formula': 8,
+        Formula: 8,
+        ec: '',
+        ph: '',
+        wfratio: '',
+        label: "未配置",
+        channels: [],
+      });
+      console.log(list,'listlist')
       this.selector = list;
     },
     selectFertType(type){

+ 7 - 7
pages/cb/smallPest/smallPest.vue

@@ -2,12 +2,12 @@
 	<view>
 		<view :class="['info',equipInfo.is_online==1?'on':'off']">
 			<view class="" @click="copy(equipInfo)">
-				设备ID:{{equipInfo.imei||equipInfo.device_id}}
+				设备ID:{{equipInfo.imei||equipInfo.device_id ||equipInfo.id}}
 				<image :src="$imageURL+'/bigdata_app/image/environment/fuzhi.png'" mode="" class="tishi">
 				</image>
 			</view>
 			<view class="">
-				设备名称:{{equipInfo.device_name==""?"无":equipInfo.device_name}}
+				设备名称:{{equipInfo.name==""?"无":equipInfo.name}}
 			</view>
 			<!-- <view class="">
 				设备类型:吸虫塔
@@ -195,7 +195,7 @@
 			copy(item) {
 				console.log(item)
 				uni.setClipboardData({
-					data: item.imei || item.device_id,
+					data: item.imei || item.device_id || item.id,
 					success: function() {
 						console.log('success');
 					}
@@ -203,19 +203,19 @@
 			},
 			toset() {
 				uni.navigateTo({
-					url: "./xctset?device_id=" + this.equipInfo.imei + "&d_id=" + this.equipInfo.d_id + "&dtype=" +
+					url: "./xctset?device_id=" +( this.equipInfo.imei || this.equipInfo.device_id || this.equipInfo.id) + "&d_id=" + this.equipInfo.d_id + "&dtype=" +
 						this.equipInfo.dtype +
-						"&device_name=" + this.equipInfo.device_name
+						"&device_name=" + this.equipInfo.name
 				})
 			},
 			tophoto() {
 				uni.navigateTo({
-					url: "./photolist?device_id=" + this.equipInfo.imei + "&d_id=" + this.equipInfo.d_id
+					url: "./photolist?device_id=" +( this.equipInfo.imei || this.equipInfo.device_id || this.equipInfo.id) + "&d_id=" + this.equipInfo.d_id
 				})
 			},
 			toanal() {
 				uni.navigateTo({
-					url: "./analyse?d_id=" + this.equipInfo.d_id + "&device_id=" + this.equipInfo.imei +
+					url: "./analyse?d_id=" + this.equipInfo.d_id + "&device_id=" +( this.equipInfo.imei || this.equipInfo.device_id || this.equipInfo.id) +
 						"&device_type=12&disable=" + this.equipInfo.disable
 				})
 			},

+ 7 - 7
pages/cb/xctdetail/xctdetail.vue

@@ -2,12 +2,12 @@
 	<view>
 		<view :class="['info',equipInfo.is_online==1?'on':'off']">
 			<view class="" @click="copy(equipInfo)">
-				设备ID:{{equipInfo.imei||equipInfo.device_id}}
+				设备ID:{{equipInfo.imei||equipInfo.device_id||equipInfo.id}}
 				<image :src="$imageURL+'/bigdata_app/image/environment/fuzhi.png'" mode="" class="tishi">
 				</image>
 			</view>
 			<view class="">
-				设备名称:{{equipInfo.device_name==""?"无":equipInfo.device_name}}
+				设备名称:{{equipInfo.name==""?"无":equipInfo.name}}
 			</view>
 			<view class="">
 				设备类型:吸虫塔
@@ -190,7 +190,7 @@
 			copy(item) {
 				console.log(item)
 				uni.setClipboardData({
-					data: item.imei || item.device_id,
+					data: item.imei || item.device_id || item.id,
 					success: function() {
 						console.log('success');
 					}
@@ -198,19 +198,19 @@
 			},
 			toset() {
 				uni.navigateTo({
-					url: "./xctset?device_id=" + this.equipInfo.imei + "&d_id=" + this.equipInfo.d_id + "&dtype=" +
+					url: "./xctset?device_id=" +( this.equipInfo.imei || this.equipInfo.device_id || this.equipInfo.id) + "&d_id=" + this.equipInfo.d_id + "&dtype=" +
 						this.equipInfo.dtype +
-						"&device_name=" + this.equipInfo.device_name
+						"&device_name=" + this.equipInfo.name
 				})
 			},
 			tophoto() {
 				uni.navigateTo({
-					url: "./photolist?device_id=" + this.equipInfo.imei + "&d_id=" + this.equipInfo.d_id
+					url: "./photolist?device_id=" +( this.equipInfo.imei || this.equipInfo.device_id || this.equipInfo.id) + "&d_id=" + this.equipInfo.d_id
 				})
 			},
 			toanal() {
 				uni.navigateTo({
-					url: "./analyse?d_id=" + this.equipInfo.d_id + "&device_id=" + this.equipInfo.imei +
+					url: "./analyse?d_id=" + this.equipInfo.d_id + "&device_id=" +( this.equipInfo.imei || this.equipInfo.device_id || this.equipInfo.id) +
 						"&device_type=12&disable=" + this.equipInfo.disable
 				})
 			},

+ 4 - 3
pages/cb/xy2.0/particulars.vue

@@ -2,10 +2,10 @@
 	<view>
 		<view class="">
 			<view :class="['info',equipInfo.is_online==1?'on':'off']">
-				<p @click="copy(newState.device_id)">设备ID:{{newState.device_id}}<image :src="$imageURL+'/bigdata_app/image/environment/fuzhi.png'" mode="" class="tishi"></image></p>
+				<p @click="copy(newState.device_id || newState.imei || newState.id)">设备ID:{{newState.device_id || newState.imei || newState.id}}<image :src="$imageURL+'/bigdata_app/image/environment/fuzhi.png'" mode="" class="tishi"></image></p>
 				<p>设备名称:{{newState.device_name==""?"无":newState.device_name}}</p>
 				<p>最新上报时间:{{newState.uptime | timeFormat}}</p>
-				<p>最新地址:{{newState.addr}}</p>
+				<p>最新地址:{{newState.address || newState.addr}}</p>
 				<p class="fillin" @click="addxy">测报害虫:<input type="text" v-model="newState.decoy" disabled v-if="newState.decoy"/><u-icon name="edit-pen" color="#f0ad4e" size="28"></u-icon></p>
 				<p @click="glass_show=true">诱芯更换时间:<span style="margin:0 20rpx;">{{yxchangetime}}</span><u-icon name="edit-pen" color="#f0ad4e" size="28"></u-icon></p>
 				<p @click="glass_showtwo=true">诱芯到期时间:<span style="margin:0 20rpx;">{{yxendtime}}</span><u-icon name="edit-pen" color="#f0ad4e" size="28"></u-icon></p>
@@ -148,6 +148,7 @@
 						d_id: d_id,
 					}
 				})
+				console.log(res,'resresres')
 				this.newState = res[0]
 				if(res[0].xy_expire_time==0){
 					this.yxendtime = "暂无"
@@ -283,7 +284,7 @@
 			var times = new Date()
 			this.date = times.getFullYear()+1 + "-" + Number(times.getMonth()+1) + "-" + times.getDate()
 			console.log(this.date)
-			this.Chistory(this.equipInfo.device_id)
+			this.Chistory(this.equipInfo.device_id || this.equipInfo.imei || this.equipInfo.id)
 			// uni.getStorage({ 待开发
 			// 	key:"jurisdiction",
 			// 	success:(res)=>{

+ 1 - 1
pages/cbd/components/pestArchive.vue

@@ -1,5 +1,5 @@
 <template>
-  <view class="pest-archive">
+  <view class="pest-archive" v-if="pest_info.name">
     <view class="pest-archive__header">
       <view class="pest-archive__title">虫害档案</view>
     </view>

+ 1 - 1
pages/cbd/components/pestDiscern.vue

@@ -1,5 +1,5 @@
 <template>
-  <view class="pest-discern">
+  <view class="pest-discern" v-if="pests.length">
     <view class="pest-discern__header">
       <view class="pest-discern__title">
         虫害识别

+ 3 - 1
pages/cbd/components/pestEchart.vue

@@ -14,7 +14,7 @@
       </view>
     </view>
 
-    <view class="pest-echart__content">
+    <view class="pest-echart__content" v-if="dayData.length">
       <!-- 三个关键时期 -->
       <view class="period-section">
         <view class="period-item">
@@ -110,6 +110,7 @@ export default {
       tabs: [],
       currentPest:'',
       activeTab: 0,
+      dayData:[],
       // 三个关键时期数据
       periodData: {
         firstDate: '-',
@@ -176,6 +177,7 @@ export default {
 
       // 确保 pest 数据是数字类型
       const dayData = this.day || [];
+      this.dayData = dayData;
       const pestData = (this.pest || []).map(item => Number(item) || 0);
 
       chartInstance = echarts.init(chartDom);

+ 7 - 7
pages/equipList/index.vue

@@ -635,13 +635,6 @@ export default {
             url: '../cb/xylps/detail?detail=' + JSON.stringify(item),
           });
           break;
-        default:
-          item.addtime = item.uptime;
-          item.type = this.type_id;
-          uni.navigateTo({
-            url: '../cb/xy2.0/particulars?info=' + JSON.stringify(item),
-          });
-          break;
         case 40:
           item.addtime = item.uptime;
           uni.navigateTo({
@@ -670,6 +663,13 @@ export default {
             url: `../cb/zhamenFirst/zhamenzs?devBid=${item.d_id}&devName=${item.device_name}&devStatus=${item.is_online}`,
           });
           break;
+        default:
+          item.addtime = item.uptime;
+          item.type = this.type_id;
+          uni.navigateTo({
+            url: '../cb/xy2.0/particulars?info=' + JSON.stringify(item),
+          });
+          break;
       }
     },
     search() {

+ 40 - 14
pages/equipList2/index.vue

@@ -285,6 +285,16 @@
 								this.accessToken,
 						});
 						break;
+        	case 44:
+          uni.navigateTo({
+            url:
+              '/pages/webviewdgp/webviewdgp?device_id=' +
+              item.id +
+              '&accessToken=' +
+              uni.getStorageSync('session_key') +
+              '&type=dgp',
+          });
+          break;
 					case 3:
 						item.addtime = item.uptime;
 						item.type = item.type_id;
@@ -386,13 +396,13 @@
               url: "/pages/fmSys/details?info=" + JSON.stringify(item)
             })
           break;
-          case 44:
-            uni.navigateTo({
-              url: "/pages/webviewdgp/webview?device_id=" + item.id + "&accessToken=" + this.accessToken || uni
-                .getStorageSync('session_key') +
-                '&type=dgp'
-            })
-          break;
+          // case 44:
+          //   uni.navigateTo({
+          //     url: "/pages/webviewdgp/webview?device_id=" + item.id + "&accessToken=" + this.accessToken || uni
+          //       .getStorageSync('session_key') +
+          //       '&type=dgp'
+          //   })
+          // break;
 					case 11:
 						var obj = {};
 						obj.d_id = item.d_id;
@@ -489,23 +499,39 @@
 							url: '../cb/xylps/detail?detail=' + JSON.stringify(item),
 						});
 						break;
-					default:
+					case 40:
 						item.addtime = item.uptime;
-						item.type = this.type_id;
 						uni.navigateTo({
-							url: '../cb/xy2.0/particulars?info=' + JSON.stringify(item),
+							url: `../cb/shuifeizs/shuifeizs?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}`,
 						});
 						break;
-					case 40:
+					case 42:
 						item.addtime = item.uptime;
 						uni.navigateTo({
-							url: `../cb/shuifeizs/shuifeizs?devBid=${item.devBid}&devName=${item.name}&devStatus=${item.status}`,
+							url: `../cb/wenshizs/wenshizs?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}`,
 						});
 						break;
-					case 42:
+					case 45:
+						item.addtime = item.uptime;
+						uni.navigateTo({
+							url: `../cb/shuifeizsFirst/shuifeizs?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}`,
+						});
+						break;
+					case 46:
+						uni.navigateTo({
+							url: `../deviceDetails/weatherStation/index?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}&address=${item.address}&uptime=${item.uptime}&d_id=${item.d_id}&deviceType=46`,
+						});
+						break;
+					case 47:
+						uni.navigateTo({
+							url: `../cb/zhamenFirst/zhamenzs?devBid=${item.d_id}&devName=${item.name}&devStatus=${item.status}`,
+						});
+						break;
+					default:
 						item.addtime = item.uptime;
+						item.type = this.type_id;
 						uni.navigateTo({
-							url: `../cb/wenshizs/wenshizs?devBid=${item.devBid}&devName=${item.name}&devStatus=${item.status}`,
+							url: '../cb/xy2.0/particulars?info=' + JSON.stringify(item),
 						});
 						break;
 				}

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1150 - 0
pages/index/index2.vue


+ 457 - 0
pages/monitor/dgpImagelist.vue

@@ -0,0 +1,457 @@
+<template>
+  <view>
+    <view class="" style="position: relative; top: 5px">
+      <!-- <view style="position: fixed;z-index: 100;">
+				<uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="查看图片"></uni-nav-bar>
+			</view> -->
+      <p class="tishi" v-if="tishi">暂无数据</p>
+	<view style="position: fixed; z-index: 100;">
+		
+	
+	  <view class="tab-box">
+	  	<u-tabs :list="equipArr"  :current="active" active-color="#14A478" @change="tabClick"></u-tabs>
+	  </view>
+	  <view class="selecttimes" @click="tiemshow = !tiemshow">
+	    <view class="timesbox">
+	      <image
+	        :src="
+	          $imageURL+ '/bigdata_app' +
+	          '/image/prevention/1acfe2751c01d3786cdc49b83d7e505.png'
+	        "
+	        mode=""
+	      ></image>
+	      <p>{{ timetab(timestate) }}</p>
+	      <p class="or">~</p>
+	      <p>{{ timetab(timeend) }}</p>
+	      <u-icon name="rili" custom-prefix="custom-icon" class="icon"></u-icon>
+	    </view>
+	    <u-calendar
+	      v-model="tiemshow"
+	      mode="range"
+	      @change="tiemchange"
+	    ></u-calendar>
+	  </view>
+	  </view>
+      <view class="imglist">
+        <view
+          class="imglist_box"
+          v-for="(item, index) in imglists"
+          :key="index"
+        >
+          <view class="imglist_left">
+            <image
+              :src="
+                $imageURL+ '/bigdata_app' +
+                '/image/cb/jiazai.ui.gif'
+              "
+              mode=""
+            >
+            </image>
+            <image :src="item.photo" mode="" @click="examine(item.photo)"></image>
+          </view>
+          <view class="imglist_right">
+            <view class="icon_box" @click="delimg(item.photo_id)">
+              <i class="yficonfont icon-shanchu"></i>
+            </view>
+			<p>设备名称:{{ item.device_name  }}</p>
+			<p>所属场景:{{ item.index_name  }}</p>
+			<p>类型:{{ item.index_type  }}</p>
+			<p>指数:{{ item.index_value  }}</p>
+            <p >{{ item.addtime | timeFormat() }}</p>
+          </view>
+        </view>
+      </view>
+    </view>
+    <view class="top" v-if="isTop" @click="top">
+      <image
+        :src="
+          $imageURL+ '/bigdata_app' +
+          '/image/6209a98f0cb3b5086f2ca36152c9269.png'
+        "
+        mode=""
+      ></image>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  data() {
+    return {
+      page: 1,
+      imglists: [],
+      tishi: true,
+      d_id: '',
+      timeend: '', //当前时间 也是搜索的结束时间
+      timestate: '',
+      timeshow: false,
+      params: {
+        year: true,
+        month: true,
+        day: true,
+        hour: true,
+        minute: true,
+        second: false,
+      },
+      flag: 1,
+      self: true,
+      isTop: false,
+      resultdata: {},
+      titletext: ['24小时', '近一个月', '近半年', '近一年'],
+      titleidnex: 0,
+      tiemshow: false, //时间选择器
+      disable: '',
+      device_type: '',
+      myuid: '',
+	  active:0,
+	  equipArr:[
+		          { name: '全部', value: '全部' },
+		        { name: 'NDVI(归一化差值植被指数)', value: 'NDVI' },
+		             { name: 'GNDVI(绿度归一化差值植被指数)', value: 'GNDVI' },
+		             { name: 'OSAVI(优化土壤调节植被指数)', value: 'OSAVI' },
+		             { name: 'LCI(叶叶绿素指数)', value: 'LCI' },
+		             { name: 'NDRE(红边归一化差值植被指数)', value: 'NDRE' }
+	  ],
+	  device_type:''
+    };
+  },
+  methods: {
+	  examine(url) {
+	  				var imgarr =[]
+	  				imgarr.push(url)
+	  				console.log(imgarr)
+	  				uni.previewImage({
+	  					urls: imgarr
+	  				});
+	  			},
+    	tabClick(index) {
+			this.page = 1
+    				this.imglists = []
+    				this.active = index;
+    				this.device_type = this.equipArr[index].value
+
+    				    if (this.timestate != '') {
+    				      this.timestate = parseInt(this.timestate);
+    				    }
+    				    if (this.timeend != '') {
+    				      this.timeend = parseInt(this.timeend);
+    				    }
+    				    this.imglistdata(this.timestate, this.timeend);
+    			},
+    async imglistdata(time_begin, time_end) {
+      //获取图片列表
+      const res = await this.$myRequest({
+        url: '/api/api_gateway?method=camera.camera_manage.multi_camera_photo',
+        data: {
+          device_id: this.device_id,
+          page: this.page,
+          page_size: 8,
+          start: time_begin, //开始时间
+          end: time_end, //结束时间
+		  index_type: this.device_type === '全部' ? '' : this.device_type
+        },
+      });
+      this.imglists = this.imglists.concat(res.data);
+      console.log(this.imglists);
+      if (this.imglists.length == 0) {
+        this.tishi = true;
+      } else {
+        this.tishi = false;
+      }
+    },
+    //forecast.forecast_system.equip_photo_del
+    async del(id) {
+      //删除图片
+      const res = await this.$myRequest({
+        url: '/api/api_gateway?method=camera.camera_manage.multi_camera_photo_delete',
+        data: {
+          // device_id: this.device_id,
+          photo_id: id,
+        },
+      });
+      if (res) {
+        uni.showToast({
+          title: '删除成功!',
+          duration: 2000,
+        });
+        this.page = 1;
+        this.imglists = [];
+        if (this.timestate != '') {
+          this.timestate = parseInt(this.timestate);
+        }
+        if (this.timeend != '') {
+          this.timeend = parseInt(this.timeend);
+        }
+        this.imglistdata(this.timestate, this.timeend);
+      } else {
+        uni.showToast({
+          title: '删除失败!',
+          duration: 2000,
+          icon: 'none',
+        });
+      }
+    },
+    //forecast.forecast_system.equip_photo_species  pest_list
+    //forecast.forecast_system.equip_photo_species统计
+
+    //forecast.send_control.admin_device_control 拍照
+    clickLeft() {
+      uni.navigateBack({
+        delta: 1,
+      });
+    },
+    delimg(id) {
+      //删除图片
+      uni.showModal({
+        title: '提示',
+        content: '是否删除此图片?',
+        success: (res) => {
+          if (res.confirm) {
+            this.del(id);
+            console.log('用户点击确定');
+          } else if (res.cancel) {
+            console.log('用户点击取消');
+          }
+        },
+      });
+    },
+    top() {
+      uni.pageScrollTo({
+        scrollTop: 0,
+        duration: 500,
+      });
+    },
+    tiemchange(e) {
+      this.imglists = [];
+      this.page = 1;
+      console.log(e);
+      this.timestate = +new Date(e.startDate) / 1000 - 8 * 60 * 60;
+      this.timeend = +new Date(e.endDate) / 1000 + 16 * 60 * 60;
+      this.imglistdata(parseInt(this.timestate), parseInt(this.timeend));
+    },
+    timetab(e) {
+      if (!e) return '请选择';
+      e = new Date(e * 1000);
+      var year = e.getFullYear();
+      var month =
+        e.getMonth() + 1 < 10 ? '0' + (e.getMonth() + 1) : e.getMonth() + 1;
+      var day = e.getDate() < 10 ? '0' + e.getDate() : e.getDate();
+      var time = year + '/' + month + '/' + day;
+      return time;
+    },
+  },
+  onLoad(option) {
+    uni.getStorage({
+      key: 'myuid',
+      success: (res) => {
+        this.myuid = res.data;
+        console.log(this.myuid);
+      },
+    });
+    // this.timeend = +new Date() / 1000
+    // this.timestate = this.timeend - 60 * 60 * 24
+    console.log(option);
+    this.device_id = option.id;
+    console.log(this.timestate);
+    this.imglistdata('', '');
+  },
+  onShow() {},
+  onReachBottom() {
+    this.page++;
+    console.log(this.timestate);
+    if (this.timestate != '') {
+      this.timestate = parseInt(this.timestate);
+    }
+    if (this.timeend != '') {
+      this.timeend = parseInt(this.timeend);
+    }
+    this.imglistdata(this.timestate, this.timeend);
+  },
+  onPageScroll(e) {
+    //nvue暂不支持滚动监听,可用bindingx代替
+    if (e.scrollTop > 200) {
+      //距离大于200时显示
+      this.isTop = true;
+    } else {
+      //距离小于200时隐藏
+      this.isTop = false;
+    }
+  },
+};
+</script>
+
+<style lang="scss">
+.tishi {
+  position: absolute;
+  top: 45%;
+  width: 95%;
+  left: 2.5%;
+  text-align: center;
+  font-size: 40rpx;
+}
+
+.selecttimes {
+  width: 100%;
+  // position: fixed;
+  // top: 0;
+  // left: 0;
+  z-index: 100;
+  background-color: #fff;
+  padding: 10rpx 20rpx;
+ box-sizing: border-box;
+  .timesbox {
+    display: flex;
+    width:100%;
+    margin: 0 auto;
+    justify-content: space-around;
+    box-shadow: 0 0 10rpx #bcb9ca;
+    padding: 10rpx 20rpx;
+    box-sizing: border-box;
+
+    image {
+      width: 30rpx;
+      height: 30rpx;
+      margin-top: 6rpx;
+    }
+
+    .icon {
+      color: #949494;
+      text-align: right;
+      margin-left: 30rpx;
+    }
+  }
+
+  ::v-deep .u-calendar__action {
+    display: flex;
+    justify-content: space-around;
+
+    .u-calendar__action__text {
+      line-height: 25px;
+    }
+  }
+}
+
+.timeshow {
+  width: 96%;
+  height: 50rpx;
+  background-color: #ffffff;
+  position: fixed;
+  top: 10px;
+  left: 2.5%;
+  display: flex;
+  z-index: 100;
+  padding-top: 10px;
+
+  .shuju_one_title {
+    width: 70%;
+    margin: 0 auto;
+    display: flex;
+
+    .tltle_text {
+      width: 25%;
+      border: 2rpx solid #b2b2b2;
+      color: #b2b2b2;
+      text-align: center;
+      font-size: 24rpx;
+      height: 50rpx;
+      line-height: 50rpx;
+    }
+
+    .title_text_color {
+      width: 25%;
+      border: 2rpx solid #28ae4f;
+      color: #28ae4f;
+      text-align: center;
+      font-size: 24rpx;
+      height: 50rpx;
+      line-height: 50rpx;
+    }
+  }
+
+  .timeshow_tate,
+  .timeshow_end {
+    height: 50rpx;
+    width: 45%;
+    line-height: 50rpx;
+    text-align: center;
+    margin-right: 10rpx;
+    background-color: #56c877;
+    color: #ffffff;
+  }
+}
+
+.imglist {
+  position: absolute;
+  top: 95px;
+	width: 100%;
+	padding: 0 20rpx;
+	
+	box-sizing: border-box;
+  .imglist_box {
+    display: flex;
+    box-shadow: 0 0 10rpx #bcb9ca;
+    padding: 20rpx;
+    margin-bottom: 20rpx;
+    height: 140px;
+  }
+
+  .imglist_left {
+    width: 50%;
+    position: relative;
+
+    image {
+      position: absolute;
+      top: 0;
+      left: 0;
+      width: 100%;
+      height: 100%;
+    }
+  }
+
+  .imglist_right {
+    margin-left: 40rpx;
+    padding-top: 26rpx;
+	position: relative;
+	p{
+		line-height: 24px;
+	}
+    .icon_box {
+		position: absolute;
+		top: -12rpx;
+		right: -42rpx;
+      // margin-bottom: 12rpx;
+		font-size: 24rpx;
+
+      .yficonfont {
+        margin-right: 20rpx;
+        color: #ff5951;
+        font-size: 32rpx;
+      }
+    }
+
+    p:last-child {
+      margin-bottom: 0;
+    }
+  }
+}
+
+.top {
+  position: fixed;
+  right: 30px;
+  bottom: 100px;
+  z-index: 100;
+
+  image {
+    width: 100rpx;
+    height: 100rpx;
+  }
+}
+	.tab-box {
+		font-size: 30rpx;
+		line-height: 80rpx;
+		background-color: #ffffff;
+		width: 100vw;
+		z-index: 2;
+		margin-top: -10rpx;		
+	}
+</style>

+ 6 - 6
pages/prevention/equipmentdetails.vue

@@ -10,12 +10,12 @@
 					<image
 						:src="eqinfo.item.is_online==1?$imageURL+'/bigdata_app/image/cb/onBg.png':$imageURL+'/bigdata_app/image/cb/offBg.png'"
 						mode="" class="bgi"></image>
-					<p style="font-size: 32rpx;" @click="copy(eqinfo.item.imei || eqinfo.item.device_id)">设备
-						ID:{{eqinfo.item.imei || eqinfo.item.device_id}}
+					<p style="font-size: 32rpx;" @click="copy(eqinfo.item.imei || eqinfo.item.device_id || eqinfo.item.id)">设备
+						ID:{{eqinfo.item.imei || eqinfo.item.device_id || eqinfo.item.id}}
 						<image :src="$imageURL+'/bigdata_app/image/environment/fuzhi.png'" mode=""
 							class="tishi"></image>
 					</p>
-					<p>设备名称:{{eqinfo.item.device_name?eqinfo.item.device_name:"无"}}</p>
+					<p>设备名称:{{eqinfo.item.name?eqinfo.item.name:"无"}}</p>
 					<p>设备型号:{{eqinfo.item.dtype}}</p>
 					<p>最近上报时间:{{eqinfo.item.addtime|timeFormat()}}</p>
 					<p>设备地址:{{city||eqinfo.item.address}}</p>
@@ -152,7 +152,7 @@
 						url: '/api/api_gateway?method=forecast.worm_lamp.device_history_data',
 						data: {
 							device_type_id: 2,
-							device_id: this.eqinfo.item.imei,
+							device_id: this.eqinfo.item.imei || this.eqinfo.item.device_id || this.eqinfo.item.id,
 							start_time: parseInt(oldtime),
 							end_time: parseInt(newtime)
 						}
@@ -204,7 +204,7 @@
 			},
 			repairs() {
 				console.log(this.eqinfo.item)
-				var device_id = this.eqinfo.item.equip_id || this.eqinfo.item.device_id
+				var device_id = this.eqinfo.item.equip_id || this.eqinfo.item.device_id || this.eqinfo.item.id
 				uni.navigateTo({
 					url: "../afterSale/addafter?device_id=" + device_id + "&device_type=" + 2
 				})
@@ -216,7 +216,7 @@
 			},
 			charts() { //历史数据
 				uni.navigateTo({
-					url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + this.eqinfo.item.imei
+					url: "./ucharts?d_id=" + this.eqinfo.item.d_id + "&imei=" + (this.eqinfo.item.imei || this.eqinfo.item.device_id || this.eqinfo.item.id)
 				})
 			},
 			copy(item) {

+ 1 - 1
pages/webviewdgp/webviewdgp.vue

@@ -18,7 +18,7 @@
 			this.device_id = options.device_id
 			this.accessToken = options.accessToken || uni.getStorageSync('session_key');
 			// this.url = "http://8.136.98.49/#/recognition"
-			this.url = "/static/h52dgp.html?device_id=" + this.device_id + "&accessToken=" + this.accessToken
+			this.url = "https://wx.hnyfwlw.com/wexin/h52dgp.html?device_id=" + this.device_id + "&accessToken=" + this.accessToken + "&videoType=dgp"
 			// uni.setStorage({
 			// 	key: 'obj',
 			// 	data: JSON.stringify({

+ 445 - 93
static/h52dgp.html

@@ -148,10 +148,6 @@
 				margin-right: 2px;
 				margin-bottom: 3px;
 			}
-
-			.imgBtnDgp {
-				display: none;
-			}
 		</style>
 	</head>
 	<body>
@@ -206,28 +202,229 @@
 	<script src="https://unpkg.com/video.js@7.10.2/dist/video.min.js"></script>
 	<script type="module">
 		import Player from './videoPlayer/videoPlay-js.js'
+		const domin = 'https://wx.hnyfwlw.com'
+		// 检测HLS支持
+		function checkHLSSupport() {
+			const video = document.createElement('video');
+			return video.canPlayType('application/vnd.apple.mpegurl') !== '' || 
+				   video.canPlayType('application/x-mpegURL') !== '';
+		}
+		
+		// 加载HLS.js库(如果需要)
+		function loadHLSJS() {
+			return new Promise((resolve, reject) => {
+				if (window.Hls) {
+					resolve();
+					return;
+				}
+				
+				const script = document.createElement('script');
+				script.src = 'https://cdn.jsdelivr.net/npm/hls.js@latest';
+				script.onload = () => {
+					console.log('HLS.js加载完成,版本:', window.Hls.version);
+					resolve();
+				};
+				script.onerror = () => {
+					console.error('HLS.js加载失败');
+					reject(new Error('HLS.js加载失败'));
+				};
+				document.head.appendChild(script);
+			});
+		}
+		
+		// 尝试使用HLS.js播放
+		function tryHLSJSPlayer(videoSrc) {
+			if (!window.Hls) {
+				console.error('HLS.js未加载');
+				return false;
+			}
+			
+			if (!Hls.isSupported()) {
+				console.error('浏览器不支持HLS.js');
+				return false;
+			}
+			
+			const video = document.getElementById('myPlayer');
+			if (!video) {
+				console.error('视频元素不存在');
+				return false;
+			}
+			
+			const hls = new Hls({
+				debug: true,
+				enableWorker: true,
+				lowLatencyMode: true
+			});
+			
+			hls.loadSource(videoSrc);
+			hls.attachMedia(video);
+			
+			hls.on(Hls.Events.MANIFEST_PARSED, function() {
+				console.log('HLS.js: 清单解析完成');
+				video.play().catch(e => {
+					console.error('HLS.js播放失败:', e);
+					showError('HLS.js播放失败: ' + e.message);
+				});
+			});
+			
+			hls.on(Hls.Events.ERROR, function(event, data) {
+				console.error('HLS.js错误:', event, data);
+				if (data.fatal) {
+					switch(data.type) {
+						case Hls.ErrorTypes.NETWORK_ERROR:
+							showError('网络错误,无法加载视频流');
+							break;
+						case Hls.ErrorTypes.MEDIA_ERROR:
+							showError('媒体错误,视频格式可能不支持');
+							break;
+						default:
+							showError('HLS播放器致命错误');
+							break;
+					}
+				}
+			});
+			
+			return true;
+		}
+		
 		let player = null
 		let stopTimer = 0
-		//上下左右和拍照
-		var str = window.location.search.substr(1)
-		var arr = str.split('&')
-		console.log(str, arr);
-		var device_id = arr[0].split('=')[1]
-		// console.log(device_id);
-		var accessToken = arr[1].slice(12)
-		var videoType = arr[2]?.split('=')[1]
+		
+		// 更安全的URL参数解析
+		function getUrlParam(name) {
+			const urlParams = new URLSearchParams(window.location.search)
+			return urlParams.get(name) || ''
+		}
+		
+		var device_id = getUrlParam('device_id')
+		var accessToken = getUrlParam('accessToken') 
+		var videoType = getUrlParam('videoType')
 		var token = accessToken
-		console.log(videoType, videoType == 'dgp')
+		
+		console.log('解析结果:', { device_id, accessToken, videoType })
+		console.log('视频类型检查:', videoType, videoType === 'dgp')
+		// 通用错误处理函数
+		function showError(message, duration = 3000) {
+			$('#dialog').html(message).stop().show(500).delay(duration).hide(500);
+			$('.videoBtnPlay').show();
+		}
+		
+		// 安全的JSON解析
+		function safeParseJSON(str) {
+			try {
+				return JSON.parse(str);
+			} catch(e) {
+				console.warn('JSON解析失败,尝试eval:', e);
+				try {
+					return eval('(' + str + ')');
+				} catch(e2) {
+					console.error('数据解析完全失败:', e2);
+					return null;
+				}
+			}
+		}
+		
+		// 验证API响应
+		function validateAPIResponse(res, apiName = 'API') {
+			console.log(`${apiName}响应:`, res);
+			
+			if (!res) {
+				console.error(`${apiName}响应为空`);
+				return { valid: false, error: '服务器无响应' };
+			}
+			
+			if (res.message && res.message !== '') {
+				console.error(`${apiName}返回错误:`, res.message);
+				return { valid: false, error: res.message };
+			}
+			
+			if (!res.data) {
+				console.error(`${apiName}返回数据为空`);
+				return { valid: false, error: '返回数据为空' };
+			}
+			
+			return { valid: true, data: res.data };
+		}
+		
+		// 获取可用的视频源
+		function getAvailableVideoSource(data, preferredType = 'hls') {
+			const sources = {
+				hls: data.hls,
+				hlsHd: data.hlsHd,
+				rtmp: data.rtmp,
+				rtsp: data.rtsp
+			};
+			
+			console.log('可用视频源:', sources);
+			
+			// 优先使用指定类型
+			if (sources[preferredType] && sources[preferredType] !== 'undefined' && sources[preferredType] !== '') {
+				return { source: sources[preferredType], type: preferredType };
+			}
+			
+			// 按优先级查找可用源
+			const priority = ['hls', 'hlsHd', 'rtmp', 'rtsp'];
+			for (const type of priority) {
+				if (sources[type] && sources[type] !== 'undefined' && sources[type] !== '') {
+					return { source: sources[type], type: type };
+				}
+			}
+			
+			return { source: null, type: null };
+		}
+		
+		// 检查设备状态
+		function checkDeviceStatus() {
+			console.log('检查设备状态...');
+			$('#dialog').html('检查设备状态...').stop().show();
+			
+			return $.ajax({
+				type: "POST",
+				url: `${domin}/api/api_gateway?method=device.device_manage.get_device_info`,
+				data: {
+					device_id: device_id,
+					token: token
+				},
+				timeout: 5000
+			}).then((res) => {
+				console.log('设备状态响应:', res);
+				if (res && res.message === '' && res.data) {
+					const deviceInfo = typeof res.data === 'string' ? safeParseJSON(res.data) : res.data;
+					console.log('设备信息:', deviceInfo);
+					return deviceInfo;
+				} else {
+					throw new Error(res.message || '获取设备信息失败');
+				}
+			}).catch((error) => {
+				console.error('设备状态检查失败:', error);
+				showError('设备状态检查失败: ' + (error.message || '网络错误'));
+				throw error;
+			});
+		}
+		
 		window._configCamera = configCamera;
 		window._stopConfigCamera = stopConfigCamera;
 		window._postPic = postPic;
-		if (videoType == 'dgp') {
-			$('.imgBtnDgp').show()
-		} else {
-			$('.imgBtnDgp').hide()
-		}
-		$('.photo').click(() => {
-
+		
+		// 确保DOM加载完成后再执行jQuery操作
+		$(document).ready(function() {
+			// 初始化HLS支持
+			if (!checkHLSSupport()) {
+				console.log('浏览器不支持原生HLS,加载HLS.js');
+				loadHLSJS().catch(e => {
+					console.error('HLS.js加载失败:', e);
+				});
+			}
+			
+			if (videoType == 'dgp') {
+				$('.imgBtnDgp').show()
+			} else {
+				$('.imgBtnDgp').hide()
+			}
+			
+			$('.photo').click(() => {
+				// 拍照功能
+			})
 		})
 
 		function configCamera(ctrl, movenum) {
@@ -239,9 +436,9 @@
 				} else {
 
 					$('#dialog').html('拍照指令正在下发,请等待...').stop().show(50)
-					let url = "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.camera_takephoto"
+					let url =`${domin}/api/api_gateway?method=camera.camera_manage.camera_takephoto`
 					if (videoType == 'dgp') {
-						url = "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.multi_camera_takephoto"
+						url = `${domin}/api/api_gateway?method=camera.camera_manage.multi_camera_takephoto`
 					}
 					$.ajax({
 						type: "POST",
@@ -261,13 +458,13 @@
 				}
 
 			} else {
-				let url = "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.ctrl_camera"
+				let url = `${domin}/api/api_gateway?method=camera.camera_manage.ctrl_camera`
 				let postData = {
 					device_id: device_id,
 					token
 				}
 				if (videoType == 'dgp') {
-					url = "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.multi_ctrl_camera"
+					url = `${domin}/api/api_gateway?method=camera.camera_manage.multi_ctrl_camera`
 					postData.ctrl = movenum
 				} else {
 					postData.ctrl = ctrl
@@ -291,7 +488,7 @@
 				stopTimer = setTimeout(()=>{
 					$.ajax({
 						type: "POST",
-						url: "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.mulit_stop_move",
+						url: `${domin}/api/api_gateway?method=camera.camera_manage.mulit_stop_move`,
 						data: {
 							device_id: device_id,
 							token
@@ -302,7 +499,7 @@
 			} else {
 				$.ajax({
 					type: "POST",
-					url: "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.ctrl_camera",
+					url: `${domin}/api/api_gateway?method=camera.camera_manage.ctrl_camera`,
 					data: {
 						device_id: device_id,
 						ctrl: "stop",
@@ -319,7 +516,7 @@
 			form.append('token', token)
 			$.ajax({
 				type: "POST",
-				url: "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.save_camera_photo",
+				url: `${domin}/api/api_gateway?method=camera.camera_manage.save_camera_photo`,
 				contentType: false,
 				processData: false,
 				data: form
@@ -375,57 +572,197 @@
 
 		$('.videoBtnPlay').click(function() {
 			$('.videoBtnPlay').hide()
-			if (videoType == 'dgp') {
-				$.ajax({
-					type: "POST",
-					url: "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.multi_addr_camera",
-					data: {
-						device_id: device_id,
-						token
+			console.log(videoType,'videoTypevideoType')
+			
+			// 显示加载提示
+			$('#dialog').html('正在获取视频流...').stop().show();
+			
+			// 先检查设备状态(可选,如果API支持的话)
+			// checkDeviceStatus().then(() => {
+				if (videoType == 'dgp') {
+					$.ajax({
+						type: "POST",
+						url: `${domin}/api/api_gateway?method=camera.camera_manage.multi_addr_camera`,
+						data: {
+							device_id: device_id,
+							token
+						},
+						timeout: 15000 // 15秒超时
+					}).then((res) => {
+					$('#dialog').hide(); // 隐藏加载提示
+					
+					const validation = validateAPIResponse(res, 'DGP视频流API');
+					if (!validation.valid) {
+						showError(validation.error);
+						return;
 					}
-				}).then((res) => {
-					// console.log(JSON.stringify(res))
-					if (res.message == '') {
-						var data = null
-						if (typeof res.data == 'string') {
-							data = eval('(' + res.data + ')');
+					
+					let data = validation.data;
+					if (typeof data == 'string') {
+						data = safeParseJSON(data);
+						if (!data) {
+							showError('DGP数据解析失败');
+							return;
+						}
+					}
+					
+					console.log('DGP解析后的数据:', data);
+					
+					// 获取可用的视频源(DGP优先使用rtmp)
+					const videoSource = getAvailableVideoSource(data, 'rtmp');
+					
+					if (!videoSource.source) {
+						console.error('DGP没有找到可用的视频源');
+						showError('设备可能离线或未配置视频流,请检查设备状态');
+						return;
+					}
+					
+					console.log(`使用${videoSource.type}视频源:`, videoSource.source);
+						
+					console.log(`使用${videoSource.type}视频源:`, videoSource.source);
+					
+					const hlsHdSrc = videoSource.source;
+					
+					// 根据视频源类型选择合适的播放器
+					if (videoSource.type === 'rtmp') {
+						// RTMP流使用Flash播放器或转换为HLS
+						console.log('检测到RTMP流,尝试使用备用播放方案');
+						
+						// 尝试查找HLS备用源
+						const hlsBackup = getAvailableVideoSource(data, 'hls');
+						if (hlsBackup.source) {
+							console.log('使用HLS备用源:', hlsBackup.source);
+							createVideoJSPlayer(hlsBackup.source, 'application/x-mpegURL');
 						} else {
-							data = res.data;
+							// 如果没有HLS源,显示RTMP不支持的提示
+							showError('当前设备使用RTMP流,浏览器不支持直接播放。请联系管理员配置HLS流。');
 						}
-						console.log(data, 'data');
-
-						let hlsHdSrc = data.rtmp;
-						var playHtml =
-							`<video id="myPlayer"   poster='' controls playsInline  webkit-playsinline src=${hlsHdSrc}  style="width:100%; height:100%;"></video>`;
-						$("#box").html(playHtml)
-						var myVideo = videojs(`myPlayer`, {
-							controls: true,
-							autoplay: 'play',
-							url: hlsHdSrc,
-							sources: [{
-								type: 'application/x-mpegURL',
-								src: hlsHdSrc,
-							}],
-						}, function onPlayerReady() {
-							myVideo.play()
-							console.log('准备好了')
-						});
-						myVideo.on('play', function() {
-							console.log('开始播放')
-						})
-
-
 					} else {
-						alert(res.message)
+						// HLS/其他格式使用Video.js
+						const mimeType = videoSource.type === 'hls' || videoSource.type === 'hlsHd' 
+							? 'application/x-mpegURL' 
+							: 'video/mp4';
+						createVideoJSPlayer(hlsHdSrc, mimeType);
 					}
-
-				})
+				}).catch((error) => {
+					console.error('DGP视频请求失败:', error);
+					showError('DGP网络请求失败: ' + (error.message || '请检查网络连接'));
+				});
+		
+		// 创建Video.js播放器的通用函数
+		function createVideoJSPlayer(videoSrc, mimeType) {
+			console.log('创建播放器,源:', videoSrc, '类型:', mimeType);
+			
+			var playHtml =
+				`<video id="myPlayer" poster='' controls playsInline webkit-playsinline style="width:100%; height:100%;"></video>`;
+			$("#box").html(playHtml)
+			
+			// 如果是HLS格式且HLS.js可用,优先使用HLS.js
+			if (mimeType === 'application/x-mpegURL' && window.Hls && Hls.isSupported()) {
+				console.log('使用HLS.js播放器');
+				if (tryHLSJSPlayer(videoSrc)) {
+					return; // HLS.js成功初始化
+				}
+			}
+			
+			// 使用Video.js作为fallback
+			console.log('使用Video.js播放器');
+			var myVideo = videojs(`myPlayer`, {
+				controls: true,
+				autoplay: false,
+				preload: 'metadata',
+				sources: [{
+					type: mimeType,
+					src: videoSrc,
+				}],
+				html5: {
+					hls: {
+						enableLowInitialPlaylist: true,
+						smoothQualityChange: true,
+						overrideNative: false // 让HLS.js处理
+					}
+				}
+			}, function onPlayerReady() {
+				console.log('Video.js播放器准备完成');
+				// 延迟播放,确保源加载完成
+				setTimeout(() => {
+					myVideo.play().catch(e => {
+						console.error('Video.js播放失败:', e);
+						showError('视频播放失败: ' + e.message);
+					});
+				}, 1000);
+			});
+			
+			// 添加错误处理
+			myVideo.on('error', function(e) {
+				console.error('Video.js错误:', e, myVideo.error());
+				const error = myVideo.error();
+				let errorMsg = '视频播放出错';
+				
+				if (error) {
+					switch(error.code) {
+						case 1:
+							errorMsg = '视频加载被中止';
+							break;
+						case 2:
+							errorMsg = '网络错误导致视频下载失败,请检查网络连接';
+							break;
+						case 3:
+							errorMsg = '视频解码失败,可能是格式不支持';
+							break;
+						case 4:
+							errorMsg = '视频格式不支持。源: ' + videoSrc + ' 类型: ' + mimeType;
+							// 如果Video.js失败,尝试原生播放器
+							console.log('Video.js失败,尝试原生播放器');
+							tryNativePlayer(videoSrc);
+							return;
+						default:
+							errorMsg = '未知播放错误 (错误码: ' + error.code + ')';
+					}
+				}
+				
+				showError(errorMsg);
+			});
+			
+			myVideo.on('play', function() {
+				console.log('Video.js开始播放')
+			});
+			
+			myVideo.on('loadstart', function() {
+				console.log('Video.js开始加载视频');
+			});
+			
+			myVideo.on('canplay', function() {
+				console.log('Video.js视频可以播放');
+			});
+			
+			myVideo.on('loadedmetadata', function() {
+				console.log('Video.js视频元数据加载完成');
+			});
+		}
+		
+		// 尝试原生播放器
+		function tryNativePlayer(videoSrc) {
+			console.log('尝试原生播放器');
+			var playHtml = `<video id="nativePlayer" controls playsInline webkit-playsinline style="width:100%; height:100%;" src="${videoSrc}"></video>`;
+			$("#box").html(playHtml);
+			
+			const video = document.getElementById('nativePlayer');
+			video.addEventListener('error', function(e) {
+				console.error('原生播放器也失败了:', e);
+				showError('所有播放器都无法播放此视频源,请联系管理员检查视频流配置');
+			});
+			
+			video.addEventListener('canplay', function() {
+				console.log('原生播放器可以播放');
+			});
+		}
 
 			} else {
 				$.ajax({
 					type: "POST",
-					url: "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.addr_camera",
-					// url: "http://192.168.0.117:8003/api/api_gateway?method=camera.camera_manage.addr_camera",
+					// url: "http://47.110.79.22:9000/api/api_gateway?method=camera.camera_manage.multi_addr_camera",
+					url: `${domin}/api/api_gateway?method=camera.camera_manage.multi_addr_camera`,
 					data: {
 						device_id: device_id,
 						token
@@ -433,39 +770,55 @@
 						// token: localStorage.getItem('session_key')
 					}
 				}).then((res) => {
-					// console.log(JSON.stringify(res))
-					if (res.message == '') {
+					console.log('API响应:', res);
+					if (res && res.message == '') {
 						var data = null
 						if (typeof res.data == 'string') {
-							data = eval('(' + res.data + ')');
+							data = safeParseJSON(res.data);
 						} else {
 							data = res.data;
 						}
-						console.log(data, 'data');
+						
+						if (!data) {
+							showError('数据解析失败');
+							return;
+						}
+						
+						console.log('解析后的数据:', data);
+						console.log('数据字段检查:', {
+							type_id: data.type_id,
+							hls: data.hls,
+							hlsHd: data.hlsHd,
+							rtsp: data.rtsp,
+							rtmp: data.rtmp
+						});
+						
 						if (data.type_id == 2) {
 							// 大华云联
+							if (!data.rtsp || data.rtsp === 'undefined' || data.rtsp === '') {
+								console.error('RTSP视频源无效:', data.rtsp);
+								showError('RTSP视频源获取失败,请检查设备配置');
+								return;
+							}
 							initYunlianPlayer(data.rtsp)
 
 						} else {
-							let hlsHdSrc = data.type_id == 0 ? data.hls : data.hlsHd;
-							var playHtml =
-								`<video id="myPlayer"   poster='' controls playsInline  webkit-playsinline src=${hlsHdSrc}  style="width:100%; height:100%;"></video>`;
-							$("#box").html(playHtml)
-							var myVideo = videojs(`myPlayer`, {
-								controls: true,
-								autoplay: 'play',
-								url: hlsHdSrc,
-								sources: [{
-									type: 'application/x-mpegURL',
-									src: hlsHdSrc,
-								}],
-							}, function onPlayerReady() {
-								myVideo.play()
-								console.log('准备好了')
-							});
-							myVideo.on('play', function() {
-								console.log('开始播放')
-							})
+							// 获取可用的视频源
+							const videoSource = getAvailableVideoSource(data, data.type_id == 0 ? 'hls' : 'hlsHd');
+							
+							if (!videoSource.source) {
+								console.error('没有找到可用的视频源');
+								showError('设备可能离线或未配置视频流,请检查设备状态');
+								return;
+							}
+							
+							console.log(`使用${videoSource.type}视频源:`, videoSource.source);
+							
+							// 使用通用播放器创建函数
+							const mimeType = videoSource.type === 'hls' || videoSource.type === 'hlsHd' 
+								? 'application/x-mpegURL' 
+								: 'video/mp4';
+							createVideoJSPlayer(videoSource.source, mimeType);
 						}
 
 					} else {
@@ -494,7 +847,6 @@
 				// 	player.close('yunlianPlayer')
 				// 	player = null
 				// }
-
 				uni.navigateTo({
 					url: '/pages/monitor/dgpImagelist?id=' + device_id
 				})