工作台代码提交
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
// pages/workBenchNew/components/uninstallMeter/index.js
|
||||
import { uninstallMeter } from "../../../../service/meter";
|
||||
import dayjs from "../../../../utils/dayjs"
|
||||
import { alertInfo, } from "../../../../utils/index"
|
||||
import request from "../../../../utils/request"
|
||||
import { alertInfo, alertSuccess, } from "../../../../utils/index"
|
||||
|
||||
const { OK } = request;
|
||||
|
||||
Page({
|
||||
|
||||
/**
|
||||
@@ -66,6 +71,7 @@ Page({
|
||||
this.setData({
|
||||
meter: data.id,
|
||||
meterName: data.address,
|
||||
meterInfo: data,
|
||||
});
|
||||
break;
|
||||
case "card":
|
||||
@@ -106,6 +112,59 @@ Page({
|
||||
type: "",
|
||||
})
|
||||
},
|
||||
async onSubmit() {
|
||||
const { meter, } = this.data;
|
||||
if (!meter) {
|
||||
alertInfo("请选择表号")
|
||||
return;
|
||||
}
|
||||
const { code, message } = await uninstallMeter(meter)
|
||||
if (code !== OK) {
|
||||
alertInfo(message)
|
||||
return
|
||||
}
|
||||
alertSuccess("拆除成功")
|
||||
setTimeout(() => {
|
||||
wx.navigateTo({
|
||||
url: '/pages/workBenchTodoList/index',
|
||||
})
|
||||
}, 300)
|
||||
},
|
||||
uploadImage() {
|
||||
const that = this;
|
||||
wx.chooseMedia({
|
||||
count: 1,
|
||||
mediaType: ['image'],
|
||||
sourceType: ['album', 'camera'],
|
||||
success: async function(res) {
|
||||
console.log("res", res)
|
||||
const path = res.tempFiles?.[0]?.tempFilePath.toLowerCase()
|
||||
if (!/(\.jpg|\.png|\.jpeg)$/.test(path)) {
|
||||
wx.showToast({
|
||||
title: '请上传jpg、png或jpeg格式的图片',
|
||||
icon: 'none',
|
||||
});
|
||||
return;
|
||||
}
|
||||
var tempFilePaths = path;
|
||||
loadingFunc(async () => {
|
||||
const { code, message, url } = await uploadInstallMeter(tempFilePaths)
|
||||
if (code !== OK) {
|
||||
alertError(message)
|
||||
return
|
||||
}
|
||||
that.setData({
|
||||
url: url
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
clearImage() {
|
||||
this.setData({
|
||||
url: ""
|
||||
})
|
||||
},
|
||||
goback() {
|
||||
wx.navigateBack()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user