李程龙 3 years ago
parent
commit
8eeef7a98f
17 changed files with 2375 additions and 73 deletions
  1. 20 6
      App.vue
  2. 15 1
      README.md
  3. 26 1
      api/aftersale.js
  4. 3 1
      config/cache.js
  5. 3 0
      main.js
  6. 1875 0
      package-lock.json
  7. 6 1
      package.json
  8. 10 1
      pages.json
  9. 62 11
      pages/aftersale/index.vue
  10. 175 0
      pages/aftersale/list.vue
  11. 58 12
      pages/camera/details.vue
  12. 5 1
      pages/index/index.vue
  13. 92 9
      pages/warn/index.vue
  14. 13 2
      styles/common.scss
  15. 0 1
      utils/cache.js
  16. 4 1
      utils/request/index.js
  17. 8 25
      utils/request/request.js

+ 20 - 6
App.vue

@@ -1,13 +1,27 @@
 <script>
+	import cache from '@/utils/cache'
+	import {
+		LOGIN_TOKEN,
+		CLIENT_ID
+	} from '@/config/cache'
 	export default {
-		onLaunch: function() {
-			console.log('App Launch')
+		// 全局获取token 与 客户端id
+		onLaunch(option) {
+			// 如果有token 就储存token与 clientId到缓存中
+			// c测试数据
+			cache.set(LOGIN_TOKEN,'1LghTlDdt7dBVyRIyadh2lmA3y9JmD9Cbtc3e57GUic=');
+			cache.set(CLIENT_ID,'');
+			// if(option.query.token){
+			// 	cache.set(LOGIN_TOKEN,option.query.token);
+			// 	cache.set(CLIENT_ID,option.query.clientId);
+			// }
+			
 		},
-		onShow: function() {
-			console.log('App Show')
+		onShow() {
+		
 		},
-		onHide: function() {
-			console.log('App Hide')
+		onHide() {
+			
 		}
 	}
 </script>

+ 15 - 1
README.md

@@ -16,6 +16,8 @@
 	--|
     |-- pages  //主包
         |-- aftersale    				    // 故障上报
+			|-- index.vue					// 上报故障提交
+			|-- list.vue					// 设备列表
         |-- camera     					// 可视监控模块
 			|-- index.vue					// 可视监控列表
 			|-- details.vue					// 可视监控详情
@@ -67,4 +69,16 @@
 ###  初始化项目
 ``` javascript
    npm install 
-```
+```
+### 项目全局token与clientId通过url传入(每个url都可以携带)
+ url格式 ${url}?token=xxxx&clientId=customer,
+ 在全局文件 App.vue onLaunch()中接收参数 并储存到缓存中,每次请求接口时会携带上
+ ``` javascript
+    onLaunch(option) {
+    	// 如果有token 就储存token与 clientId到缓存中
+    	if(option.query.token){
+    		cache.set(LOGIN_TOKEN,option.query.token);
+    		cache.set(LOGIN_TOKEN,option.query.clientId);
+    	}
+    },
+ ```

+ 26 - 1
api/aftersale.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request/index.js'
+import config from '@/config/config.js'
 /**
  * 预警上报模块
  */
@@ -7,7 +8,31 @@ import request from '@/utils/request/index.js'
 
 
 // 上传图片、视频接口
-export const uploadFile = (data) => request.post('api/v2/util/upload/img', data);
+export const uploadFile = (file) => {
+	return new Promise((resolve, reject) => {
+		uni.uploadFile({
+			url: config.baseUrl + 'api/util/upload/img/', //仅为示例,非真实的接口地
+			name: 'file',
+			filePath: file,
+			success: (res) => {
+				let result = JSON.parse(res.data ?? '{}')
+				if (result.message) {
+					uni.showToast({
+						title: result.message,
+						duration: 1500,
+						mask: true,
+						icon: 'none'
+					});
+					return resolve(null);
+				}
+				resolve(config.baseUrl + result.img_url);
+			},
+			fail: (e) => {
+				resolve(null);
+			}
+		});
+	})
+}
 
 // 预警保存
 export const saveAftersaleInfo = async (data) => {

+ 3 - 1
config/cache.js

@@ -1,5 +1,7 @@
 // 缓存名称
 module.exports = {
-	//token
+	//token 全局名称
 	LOGIN_TOKEN: 'LOGIN_STATUS_TOKEN',
+	//clientId 全局客户端id
+	CLIENT_ID: 'CLIENT_ID',
 }

+ 3 - 0
main.js

@@ -6,6 +6,9 @@ import Vue from 'vue'
 Vue.config.productionTip = false
 App.mpType = 'app'
 
+import Videojs from 'video.js'
+import 'video.js/dist/video-js.min.css' 
+Vue.prototype.$video = Videojs 
 
 // 注册全局过滤器
 import * as filters from '@/filters' //全局过滤器

File diff suppressed because it is too large
+ 1875 - 0
package-lock.json


+ 6 - 1
package.json

@@ -1,6 +1,11 @@
 {
   "dependencies": {
+    "dplayer": "^1.27.0",
     "ezuikit-js": "^0.6.3",
-    "moment": "^2.29.4"
+    "hls.js": "^1.2.3",
+    "i": "^0.3.7",
+    "moment": "^2.29.4",
+    "npm": "^8.19.2",
+    "video.js": "^7.20.3"
   }
 }

+ 10 - 1
pages.json

@@ -19,7 +19,7 @@
 				"enablePullDownRefresh": false
 			}
 
-		}, {
+		},{
 			"path": "pages/weather/history",
 			"style": {
 				"navigationBarTitleText": "历史数据",
@@ -142,6 +142,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/aftersale/list",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "设备列表",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 62 - 11
pages/aftersale/index.vue

@@ -20,17 +20,25 @@
 				图片上传
 				<text class="font-10">最多5张图片</text>
 			</view>
-			<!-- 上传图片 -->
+			<!-- 上传文件 -->
 			<view class="ui-upload" id="descripImg">
 
 				<view class="ui-upload_file" v-for="(item,index) in imgList" :key="index">
+					<uni-icons class="close" type="clear" @click="removeFile('image',0)" size="30" color="#333">
+					</uni-icons>
 					<image :src="item" @click="previewImage(index)" class="ui-upload_img" mode="aspectFill">
 					</image>
 				</view>
+				<view class="ui-upload_file" v-if="aftersale.errorvideo">
+					<uni-icons class="close" type="clear" @click="removeFile('video',0)" size="30" color="#333">
+					</uni-icons>
+					<video :src="aftersale.errorvideo" :show-center-play-btn="false" :controls="false"
+						preload="metadata" poster="" :muted="true"></video>
+				</view>
 				<view class="ui-upload_input" @click="uploadFile('image')">
 					<image src="@/static/img/image.png" class="ui-upload_img" mode="aspectFill"></image>
 				</view>
-				<view class="ui-upload_input" @click="uploadFile('video')">
+				<view class="ui-upload_input" @click="uploadFile('video')" v-if="!this.aftersale.errorvideo">
 					<image src="@/static/img/video.png" class="ui-upload_img" mode="aspectFill"></image>
 				</view>
 			</view>
@@ -67,27 +75,41 @@
 				saveLoading: false,
 			}
 		},
+		onLoad(options) {
+			this.aftersale.device_id=options.deviceId
+		},
 		methods: {
 			/**
 			 * 上传图片
 			 * @param {String} type image:图片,video 视频
 			 */
 			async uploadFile(type) {
-				let res = await this.uploadImageSync();
-				if (res) {
-					uploadFile({
-						file: res
-					});
+				if (type == 'image' && this.imgList.length == 5) {
+					return this.$api.msg('图片最多上传5张');
 				}
+				let file = type == 'image' ? await this.chooseImage() : await this.chooseVideo();
+				this.$api.loading('上传中...');
+				let res = await uploadFile(file);
+				this.$api.hide();
+				if(!res){
+					return;
+				}
+				this.$api.msg('上传成功','success');
+				// baseUrl 图片根据 img_url
+				if (type == 'image') {
+					return this.imgList.push(res)
+				}
+				this.aftersale.errorvideo = res;
 			},
-			uploadImageSync() {
+			// 选择图片
+			chooseImage() {
 				return new Promise((resolve, reject) => {
 					uni.chooseImage({
 						count: 1, // 默认9
 						sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
 						sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
 						success(res) {
-							resolve(res.tempFiles[0]);
+							resolve(res.tempFilePaths[0]);
 						},
 						fail(e) {
 							resolve(null);
@@ -95,12 +117,16 @@
 					})
 				})
 			},
-			uploadVideoSync() {
+			// 选择视频
+			chooseVideo() {
 				return new Promise((resolve, reject) => {
 					uni.chooseVideo({
 						sourceType: ['camera', 'album'],
 						success(res) {
-							self.src = res.tempFilePath;
+							resolve(res.tempFilePath);
+						},
+						fail(e) {
+							resolve(null);
 						}
 					});
 				})
@@ -109,12 +135,37 @@
 			async submitAftersaleInfo(e) {
 				this.$api.loading("上报中...");
 				this.saveLoading = true;
+				this.aftersale.errorimg = this.imgList.join(',');
 				let res = await saveAftersaleInfo(this.aftersale);
 				this.saveLoading = false;
 				this.$api.hide();
 				if (res) {
 					this.$api.msg('上报成功', 'success');
 				}
+			},
+			// 预览图片
+			previewImage(index) {
+				uni.previewImage({
+					current: index,
+					urls: this.imgList
+				});
+			},
+			/**
+			 * 删除文件
+			 * @param {String} type image:图片,video 视频
+			 * @param {Number} index 文件坐标
+			 */
+			async removeFile(type, index) {
+				const confirm = await this.$api.showModal(`是否确定删除当前${type=='image'?'图片':'视频'}`);
+				if (!confirm) {
+					return;
+				}
+				if (type == 'image') {
+					this.imgList.splice(index, 1)
+				} else {
+					this.aftersale.errorvideo = '';
+				}
+
 			}
 		}
 	}

+ 175 - 0
pages/aftersale/list.vue

@@ -0,0 +1,175 @@
+<template>
+	<!-- 故障上报设备列表 -->
+	<view>
+		<!-- 搜索框 -->
+		<ui-search placeholder="请输入设备ID" @confirm="searchDevice"></ui-search>
+		<!-- 搜索框end -->
+		<ui-tabs :list="deviceTabs" :active="deviceTab" @clickTab="clickDeviceTabs"></ui-tabs>
+		<!-- 设备列表 -->
+		<block v-for="(item,index) in deviceList" :key="index">
+	        <!-- 气象站 墒情站 -->
+			<view class="ui-card forecast-item" @click="openDeviceDetails(item.equip_id)" v-if="deviceTab==1 || deviceTab==3">
+				<view class="flex-1 info">
+					<view class="font-16 title" :class="item.is_online==1?'on':'off'">设备名称:{{item.device_name}}</view>
+					<view class="text">设备ID:{{item.equip_id}}</view>
+					<view class="text text-ellipsis">地址:{{item.address}}</view>
+					<view class="text">最新上报时间:{{item.uptime | timeFrom}}</view>
+				</view>
+				<view class="aftersale-tips">故障上报</view>
+			</view>
+			<!-- 测报灯 -->
+			<view class="ui-card forecast-item" @click="openDeviceDetails(item.imei)" v-if="deviceTab==4">
+				<view class="flex-1 info">
+					<view class="font-16 title" :class="item.is_online==1?'on':'off'">设备名称:{{item.device_name?item.device_name:'测报灯'}}</view>
+					<view class="text">设备ID:{{item.imei}}</view>
+					<view class="text">最新上报时间:{{ item.uptime | timeFrom}}</view>
+				</view>
+				<view class="aftersale-tips">故障上报</view>
+			</view>
+			<!-- 监控 -->
+			<view class="ui-card forecast-item" @click="openDeviceDetails(item.device_id)" v-if="deviceTab==2">
+				<view class="flex-1 info">
+					<view class="font-16 title" :class="item.status==1?'on':'off'">设备名称:{{item.device_name}}</view>
+					<view class="text">设备ID:{{item.device_id}}</view>
+					<view class="text">SIM卡号:{{ item.sim}}</view>
+				</view>
+				<view class="aftersale-tips">故障上报</view>
+			</view>
+		</block>
+		<!-- 气象列表end -->
+		<ui-empty v-if="deviceList.length==0"></ui-empty>
+	</view>
+</template>
+
+<script>
+	import {
+		getWeatherDeviceList
+	} from '@/api/weather.js' // 气象列表
+	import {
+		getCameraList
+	} from '@/api/camera.js' // 监控列表
+	import {
+		getWormLampList
+	} from '@/api/worm.js' // 孢子仪 测报灯列表
+	export default {
+		data() {
+			return {
+				// 列表搜索条件
+				params: {
+					device_id: '', //筛选项 设备号、设备名称
+					page: 1,
+					page_size: 10,
+					// device_type: 5, // 5气象站 8墒情站
+					// device_type_id:3 3虫情测报灯 7孢子仪
+				},
+				deviceList: [], // 设备列表
+				total: 0, // 设备总数
+				deviceTab: 1, //当前设备类型
+				deviceTabs: [{
+						text: '气象站',
+						value: 1
+					}, {
+						text: '监控',
+						value: 2
+					},
+					{
+						text: '墒情站',
+						value: 3
+					}, {
+						text: '测报灯',
+						value: 4
+					}
+				]
+			};
+		},
+		onLoad() {
+			this.getDeviceList();
+		},
+		// 触底请求
+		onReachBottom(e) {
+			if (this.deviceList.length >= this.total) {
+				return;
+			}
+			this.params.page += 1;
+			this.getDeviceList();
+		},
+		methods: {
+			// 刷新设备列表
+			refreshDeviceList() {
+				this.params.page = 1;
+				this.deviceList = [];
+				this.getDeviceList();
+			},
+			// 切换设备类型
+			clickDeviceTabs(val) {
+				this.deviceTab = val;
+				this.refreshDeviceList();
+			},
+			/**
+			 * 打开设备故障上报
+			 * @param {Object} deviceId 设备号
+			 */
+			openDeviceDetails(deviceId) {
+				uni.navigateTo({
+					url: `index?deviceId=${deviceId}`
+				})
+			},
+			// 获取设备列表
+			async getDeviceList() {
+				let params = {};
+				if (this.deviceTab == 1 || this.deviceTab == 3) {
+					params.device_type = this.deviceTab == 1 ? 5 : 8;
+				}
+				if (this.deviceTab == 4) {
+					params.device_type_id = 3;
+				}
+				const {
+					data,
+					counts
+				} = await this.requestDeviceList({
+					...this.params,
+					...params
+				});
+				this.deviceList = [...this.deviceList, ...data];
+				this.total = counts ?? 0;
+			},
+			// 请求设备列表
+			async requestDeviceList(params) {
+				const handleList = {
+					1: getWeatherDeviceList, // 气象
+					2: getCameraList, // 监控
+					3: getWeatherDeviceList, // 墒情
+					4: getWormLampList,
+				}
+
+				let res = await handleList[this.deviceTab](params);
+				// 气象 墒情
+				if (this.deviceTab == 1 || this.deviceTab == 3) {
+					return {
+						data: res.ids,
+						counts: res.nums,
+					}
+				}
+				return {
+					data: res.data,
+					counts: res.counts,
+				}
+			},
+			/**
+			 * 搜索设备
+			 * @param {String} val 搜索内容
+			 */
+			searchDevice(val) {
+				this.params.device_id = val;
+				this.refreshDeviceList();
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.aftersale-tips {
+		color: #E93F27;
+		font-size: 20rpx;
+	}
+</style>

+ 58 - 12
pages/camera/details.vue

@@ -3,8 +3,9 @@
 	<view class="page-panel">
 		<!-- 监控区域 -->
 		<view class="monitor-area">
+			<view class="video-js" ref="video" style="width: 100%;height:510rpx;"></view>
 			<!-- <image src="@/static/demo/demo1.png" mode="widthFix"></image> -->
-			<video id="hlsId" autoplay controls  style="width: 100%;height:800rpx"></video>
+			<!-- <video id="hlsId" autoplay controls  style="width: 100%;height:800rpx"></video> -->
 		</view>
 		<!-- 监控工具 -->
 		<view class="monitor-tools">
@@ -26,7 +27,8 @@
 </template>
 
 <script>
-	import EZUIKit from "ezuikit-js";
+	import Hls from 'hls.js'
+	import Dplayer from 'dplayer'
 	import {
 		getCameraAddress,
 		controlCamera
@@ -45,18 +47,61 @@
 				}
 			};
 		},
-		onLoad(options) {
+		 onLoad(options) {
 			this.deviceId = options.id;
 			this.controlParams.device_id = options.id;
 			
 		},
-		onReady() {
-			this.getCameraAddress();
-			
-		},
-		mounted() {
-			console.log('d');
-			new EZUIKit.HLS("hlsId","http://cmgw-vpc.lechange.com:8888/LCO/8C02697PAJ9FA37/0/1/20220908T101239/d14740c6649a2c1eb8f8fbc2f4fd7a8e.m3u8");
+		async onReady() {
+			await this.getCameraAddress();
+			let video = document.createElement('video');
+			video.id = 'video';
+			video.style = 'width: 100%; height:510rpx;';
+			video.controls = true;
+			video.preload = "auto"
+			video.setAttribute('playsinline', true) //IOS微信浏览器支持小窗内播放
+			video.setAttribute('webkit-playsinline', true) //这个bai属性是ios 10中设置可以让视频在小du窗内播放,也就是不是全zhi屏播放的video标签的一个属性
+			video.setAttribute('x5-video-player-type', 'h5') //安卓 声明启用同层H5播放器 可以在video上面加东西
+			let source = document.createElement('source');
+			source.src =this.cameraAddress;
+				// 'http://yun-live.oss-cn-shanghai.aliyuncs.com/record/yunlive/record/yunlive/meeting_1070/2020-11-25-09-27-59_2020-11-25-09-35-52.m3u8';
+			// source.type = 'application/x-mpegURL';
+			video.appendChild(source);
+			this.$refs.video.$el.appendChild(video);
+			let that = this;
+			let player = this.$video('video', {
+				poster: '', // 视频封面图地址
+				title: '4564564',
+				playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
+				autoDisable: true,
+				preload: 'none', //auto - 当页面加载后载入整个视频 meta - 当页面加载后只载入元数据 none - 当页面加载后不载入视频
+				language: 'zh-CN',
+				fluid: true, // 自适应宽高
+				muted: false, //  是否静音
+				aspectRatio: '16:9', // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
+				controls: true, //是否拥有控制条 【默认true】,如果设为false ,那么只能通过api进行控制了。也就是说界面上不会出现任何控制按钮
+				autoplay: true, //如果true,浏览器准备好时开始回放。 autoplay: "muted", // //自动播放属性,muted:静音播放
+				loop: true, // 导致视频一结束就重新开始。 视频播放结束后,是否循环播放
+				screenshot: true,
+				controlBar: {
+					volumePanel: { //声音样式
+						inline: false // 不使用水平方式
+					},
+					timeDivider: true, // 时间分割线
+					durationDisplay: true, // 总时间
+					progressControl: true, // 进度条
+					remainingTimeDisplay: true, //当前以播放时间
+					fullscreenToggle: true, //全屏按钮
+					pictureInPictureToggle: true, //画中画
+				}
+			}, function() {
+				this.on('error', function(err) { //请求数据时遇到错误
+					console.log("请求数据时遇到错误", err)
+				});
+				this.on('stalled', function(stalled) { //网速失速
+					console.log("网速失速", stalled)
+				});
+			});
 		},
 		methods: {
 			// 获取监控播放地址
@@ -64,8 +109,9 @@
 				let res = await getCameraAddress({
 					device_id: this.deviceId
 				});
-				// console.log(res.hls);
-				// console.log(JSON.parse(res));
+				let address = eval("(" + res + ")")
+				console.log(address.hls);
+				this.cameraAddress=address.hls;
 			},
 			// 控制摄像机
 			async controlDirection(movenum) {

+ 5 - 1
pages/index/index.vue

@@ -36,8 +36,12 @@
 						text:'病虫害识别'
 					},
 					{
-						url:'/pages/aftersale/index',
+						url:'/pages/aftersale/list',
 						text:'故障上报'
+					},
+					{
+						url:'/pages/warn/index',
+						text:'预警列表'
 					}
 					
 				]

+ 92 - 9
pages/warn/index.vue

@@ -1,24 +1,107 @@
 <template>
-	<!-- 预警信息 -->
+	<!-- 预警信息全部 -->
 	<view>
-		<view class="ui-card warn-item">
-			<view class="title">140951害虫数量总和预警</view>
-			<view class="subtitle">设备ID:87845748629</view>
-			<view class="paragraph">介绍文字介绍文字介绍文字介绍文字介绍文字介绍文字介绍文字介绍文字介绍文字介绍文字介绍文字介绍文字介绍文字介绍文字</view>
-			<text class="time">2022-08-26 12:01:46</text>
-		</view>
+		<!-- 搜索框end -->
+		<ui-tabs :list="warnTabs" :active="warnTab" @clickTab="clickWarnTabs"></ui-tabs>
+		<block v-for="(item,index) in warningList" :key="index">
+			<!-- 虫害预警 -->
+			<view class="ui-card warn-item" v-if="warnTab==1">
+				<view class="title">{{item.ekey}}</view>
+				<view class="subtitle">设备ID:{{item.device_id}}</view>
+				<view class="paragraph">
+					<text v-for="(val,key,i) in item.warning_content" :key="i">
+						{{key+':'+val}},
+					</text>
+				</view>
+				<text class="time">{{item.upltime | timeFrom}}</text>
+			</view>
+			<!-- 气象,墒情 预警 -->
+			<view class="ui-card warn-item" v-if="warnTab==2 ||warnTab==3">
+				<view class="ui-card warn-item">
+					<view class="title">{{item.ekey}}</view>
+					<view class="subtitle">设备ID:{{item.device_id}}</view>
+					<view class="paragraph">{{item.warning_content}}</view>
+					<text class="time">{{item.upltime | timeFrom}}</text>
+				</view>
+			</view>
+		</block>
+		<ui-empty v-if="warningList.length==0" text="暂无预警信息"></ui-empty>
 	</view>
 </template>
 
 <script>
+	import {
+		getPestWarningList,
+		getWeatherWarningList
+	} from '@/api/warning.js'
 	export default {
 		data() {
 			return {
-
+				warnTab: 1, //当前设备类型
+				warnTabs: [{
+					text: '虫害预警',
+					value: 1
+				}, {
+					text: '气象预警',
+					value: 2
+				}, {
+					text: '墒情预警',
+					value: 3
+				}],
+				// 预警列表
+				warningList: [],
+				params: {
+					page: 1, //页数 默认为1
+					page_size: 10, //数据条数据 默认为10
+				},
+				total: 0,
 			}
 		},
+		onLoad(options) {
+			this.getWarningList();
+		},
+		// 触底请求
+		onReachBottom(e) {
+			if (this.warningList.length >= this.total) {
+				return;
+			}
+			this.params.page += 1;
+			this.getWarningList();
+		},
 		methods: {
-
+			// 刷新预警列表
+			refreshWarningList() {
+				this.params.page = 1;
+				this.warningList = [];
+				this.getWarningList();
+			},
+			// 切换预警类型
+			clickWarnTabs(val) {
+				this.warnTab = val;
+				this.refreshWarningList();
+			},
+			// 获取预警列表
+			async getWarningList() {
+				let  params={};
+				if(this.warnTab==2 || this.warnTab==3){
+					params.device_type = this.warnTab ==2 ? 5 : 8;
+				}
+				const handleList = {
+					1: getPestWarningList, // 丛海
+					2: getWeatherWarningList, // 气象
+					3: getWeatherWarningList, // 墒情
+				}
+				
+				const {
+					data,
+					nusm
+				} = await handleList[this.warnTab]({
+					...params,
+					...this.params
+				});
+				this.warningList = [...this.warningList, ...data];
+				this.total = nusm ?? 0;
+			},
 		}
 	}
 </script>

+ 13 - 2
styles/common.scss

@@ -365,12 +365,23 @@ image {
 	margin:0 16rpx 16rpx;
 	background-color: #f3f4f5;
 	border-radius: 8rpx;
-	image{
+	
+}
+.ui-upload_input image{
 		width: 60rpx;
 		height: 60rpx;
 	}
+.ui-upload_file .close{
+	position: absolute;
+	top: -30rpx;
+	right: -20rpx;
+	z-index: 2;
+	display: block;
+}
+.ui-upload_file  video{
+	width: 128rpx;
+	height: 128rpx;
 }
-
 
 // 下拉按钮
 .picker {

+ 0 - 1
utils/cache.js

@@ -15,7 +15,6 @@ const Cache = {
 		}
 	},
 	get(key) {
-		return '1LghTlDdt7dBVyRIyadh2lmA3y9JmD9Cbtc3e57GUic='
 		try {
 			let data = uni.getStorageSync(key)
 			const {

+ 4 - 1
utils/request/index.js

@@ -3,7 +3,8 @@ import config from '@/config/config.js'
 // import store from '@/store'
 import cache from '@/utils/cache'
 import {
-	LOGIN_TOKEN
+	LOGIN_TOKEN,
+	CLIENT_ID
 } from '@/config/cache'
 
 // 创建request实例
@@ -21,9 +22,11 @@ service.interceptors.request.use(async (config, ...args) => {
 
 	// 判断token是否存在
 	let token = cache.get(LOGIN_TOKEN) || '';
+	let clientId= cache.get(CLIENT_ID) || '';
 	// token为空已过期 刷新token
 	if (token) {
 		config.body.token = token;
+		config.body.clientId = clientId;
 	}
 	return config
 })

+ 8 - 25
utils/request/request.js

@@ -65,8 +65,7 @@ export default function({
 			}, ...args)
 		},
 		onerror: () => {}, // 请求错误钩子函数集合
-		file(method, url, data, header, reqIntercept=true, resIntercept=true) {
-			console.log(data);
+		file(method, url, data, header, reqIntercept, resIntercept) {
 			let timer, // timer 检测超时定时器
 				requestTask, // requestTask 网络请求 task 对象
 				aborted = false, // aborted 请求是否已被取消
@@ -92,38 +91,22 @@ export default function({
 						await this.onerror(method, url, data, '网络请求失败:主动取消')
 						return reject('网络请求失败:主动取消')
 					}
-					console.log(body);
+					console.log(data);
 					requestTask = uni[method]({
 						// url: url[0] === '/' ? baseURL + url : url,
-						url:  baseURL + url,
+						url: baseURL + url,
 						name: data.name,
 						header,
 						filePath: data.filePath,
 						formData: body,
 						success: async res => {
-							clearTimeout(timer)
-							this.interceptors.response.intercept(resolve, {
-									success: true,
-									...res,
-								}, method, url, data, reject,
-								resIntercept) // 执行响应拦截器
+							console.log(res);
 						},
 						fail: async res => {
-							clearTimeout(timer);
-							 !overtime && await this.onerror(
-								method, url, data, aborted ? '网络请求失败:主动取消' :
-								'网络请求失败:(URL无效|无网络|DNS解析失败)')
-							aborted ? reject('网络请求失败:主动取消') : reject(
-								'网络请求失败:(URL无效|无网络|DNS解析失败)')
+							console.log(res);
 						}
 					})
-					requestTask.onProgressUpdate(progressUpdateHandle) // 监听下载进度变化
-					timer = setTimeout(async () => { // 请求超时执行方法
-						overtime = true // 将状态标记为超时,不会被 fail 中的 onerror 重复执行
-						requestTask.abort() // 执行取消请求方法
-						await this.onerror(method, url, data, '网络请求失败:超时取消')
-						reject('网络请求时间超时') // reject 原因
-					}, timeout) // 设定检测超时定时器
+
 				})
 			}), {
 				get: (target, prop) => {
@@ -139,8 +122,8 @@ export default function({
 				}
 			}) // 如果调用 cancel 方法,返回 _watcher.cancel 方法
 		},
-		request(method, url, data, header, reqIntercept=true, resIntercept=true) {
-			
+		request(method, url, data, header, reqIntercept = true, resIntercept = true) {
+
 			let timer, // timer 检测超时定时器
 				requestTask, // requestTask 网络请求 task 对象
 				aborted = false, // aborted 请求是否已被取消