|
@@ -12,7 +12,7 @@
|
|
@close="showCalendarTb = false"></u-datetime-picker>
|
|
@close="showCalendarTb = false"></u-datetime-picker>
|
|
</view> -->
|
|
</view> -->
|
|
<u-button type="primary" icon="camera-fill" size="small" @click="chooseImage"
|
|
<u-button type="primary" icon="camera-fill" size="small" @click="chooseImage"
|
|
- style="margin: 2px 0px;">从相册选取</u-button>
|
|
|
|
|
|
+ style="margin: 2px 0px;">图片选取</u-button>
|
|
<!-- 图片预览 -->
|
|
<!-- 图片预览 -->
|
|
<view class="imgView">
|
|
<view class="imgView">
|
|
<image v-if="imageSrc" style="width:150px" :src="imageSrc" mode="widthFix"></image>
|
|
<image v-if="imageSrc" style="width:150px" :src="imageSrc" mode="widthFix"></image>
|
|
@@ -297,89 +297,33 @@ export default {
|
|
//获取图片识别数据
|
|
//获取图片识别数据
|
|
getGasIdentify() {
|
|
getGasIdentify() {
|
|
let that = this
|
|
let that = this
|
|
- // let formData = new FormData();
|
|
|
|
- // formData.append('img', that.imageSrcList[0]);
|
|
|
|
- // formData.append('user', that.username);
|
|
|
|
- // console.log(that.imageSrcList,formData,'111')
|
|
|
|
- // new Promise((resolve, reject) => {
|
|
|
|
- // api
|
|
|
|
- // .gasIdentify({img: that.imageSrcList[0],user:that.username})
|
|
|
|
- // .then((response) => {
|
|
|
|
- // if (response.data.code == 200) {
|
|
|
|
- // let data = response.data.result
|
|
|
|
- // console.log(data, '图片识别数据--------')
|
|
|
|
- // } else {
|
|
|
|
- // reject(response);
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // .catch((error) => {
|
|
|
|
- // console.log("catch===>response", response);
|
|
|
|
- // reject(error);
|
|
|
|
- // });
|
|
|
|
- // });
|
|
|
|
let apiUrl = configService.apiUrl;
|
|
let apiUrl = configService.apiUrl;
|
|
- uni.request({
|
|
|
|
|
|
+ console.log(that.imageSrcList[0])
|
|
|
|
+ uni.uploadFile({
|
|
url: `${apiUrl}/gasIdentify`,
|
|
url: `${apiUrl}/gasIdentify`,
|
|
- data: {
|
|
|
|
- img: that.imageSrcList[0].name,
|
|
|
|
- user:that.username
|
|
|
|
|
|
+ filePath: that.imageSrcList[0].path,
|
|
|
|
+ name: 'img',
|
|
|
|
+ formData: {
|
|
|
|
+ 'user': that.username,
|
|
},
|
|
},
|
|
- method: 'POST', // 参数类型
|
|
|
|
- header: {
|
|
|
|
- "Content-Type": "application/x-www-form-urlencoded"
|
|
|
|
- }, // 请求头
|
|
|
|
success: (res) => {
|
|
success: (res) => {
|
|
- console.log(res, 'hhhhhhhhhhhhh')
|
|
|
|
|
|
+ console.log(res,'识别成功!');
|
|
|
|
+ if(res){
|
|
|
|
+ that.indexList=res.data.dara
|
|
|
|
+ }
|
|
|
|
+
|
|
},
|
|
},
|
|
- complete: () => { },
|
|
|
|
- fail: (res) => { }
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // this.indexList = [
|
|
|
|
- // {
|
|
|
|
- // "日期": "2025年3月5日",
|
|
|
|
- // "班次": "早班",
|
|
|
|
- // "检查地点": "22106综采工作面设备列车",
|
|
|
|
- // "检查时间": "0:04",
|
|
|
|
- // "CH4%": "0.00",
|
|
|
|
- // "CO2%": "0.04",
|
|
|
|
- // "O2%": "20.9",
|
|
|
|
- // "CO(ppm)": "1",
|
|
|
|
- // "温度(℃)": "17",
|
|
|
|
- // "检查人": "xxx"
|
|
|
|
- // },
|
|
|
|
- // {
|
|
|
|
- // "日期": "2025年3月5日",
|
|
|
|
- // "班次": "早班",
|
|
|
|
- // "检查地点": "22106综采工作面设备列车",
|
|
|
|
- // "检查时间": "8:13",
|
|
|
|
- // "CH4%": "0.00",
|
|
|
|
- // "CO2%": "0.04",
|
|
|
|
- // "O2%": "20.9",
|
|
|
|
- // "CO(ppm)": "1",
|
|
|
|
- // "温度(℃)": "17",
|
|
|
|
- // "检查人": "xxx"
|
|
|
|
- // },
|
|
|
|
- // {
|
|
|
|
- // "日期": "2025年3月5日",
|
|
|
|
- // "班次": "早班",
|
|
|
|
- // "检查地点": "22106综采工作面设备列车",
|
|
|
|
- // "检查时间": "16:15",
|
|
|
|
- // "CH4%": "0.00",
|
|
|
|
- // "CO2%": "0.04",
|
|
|
|
- // "O2%": "20.9",
|
|
|
|
- // "CO(ppm)": "1",
|
|
|
|
- // "温度(℃)": "17",
|
|
|
|
- // "检查人": "xxx"
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // ]
|
|
|
|
|
|
+ fail:(errpr)=>{
|
|
|
|
+ console.log(error.data,'识别失败!');
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
// 选择图片的方法
|
|
// 选择图片的方法
|
|
chooseImage() {
|
|
chooseImage() {
|
|
uni.chooseImage({
|
|
uni.chooseImage({
|
|
|
|
+ count: 1, // 默认9,设置图片的最大选择数
|
|
|
|
+ sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
|
+ sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
success: (res) => {
|
|
success: (res) => {
|
|
console.log(res, 'res===')
|
|
console.log(res, 'res===')
|
|
// 获取选中的图片路径,这里我们只取第一张图进行预览
|
|
// 获取选中的图片路径,这里我们只取第一张图进行预览
|
|
@@ -401,6 +345,7 @@ export default {
|
|
delSb() {
|
|
delSb() {
|
|
this.indexList = []
|
|
this.indexList = []
|
|
this.indexParam = {}
|
|
this.indexParam = {}
|
|
|
|
+ this.imageSrc=''
|
|
},
|
|
},
|
|
//班次下拉选项切换
|
|
//班次下拉选项切换
|
|
changeBc(e) {
|
|
changeBc(e) {
|