|
@@ -8,47 +8,55 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { addstorePhoto, addVisitsPosition } from "@/api/index";
|
|
|
|
|
-import axios from "axios";
|
|
|
|
|
|
|
+import { addstorePhoto, addVisitsPosition } from '@/api/index';
|
|
|
|
|
+import axios from 'axios';
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
- name: "uploadImg",
|
|
|
|
|
|
|
+ name: 'uploadImg',
|
|
|
props: {
|
|
props: {
|
|
|
uploadid: {
|
|
uploadid: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
storeGroupId: {
|
|
storeGroupId: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
parentCollectionId: {
|
|
parentCollectionId: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
secondCollectionId: {
|
|
secondCollectionId: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
firstCollectionId: {
|
|
firstCollectionId: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
|
|
+ },
|
|
|
|
|
+ fourthCollectionId: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: '',
|
|
|
|
|
+ },
|
|
|
|
|
+ thirdCollectionId: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
visitsId: {
|
|
visitsId: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
taskId: {
|
|
taskId: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
collectionId: {
|
|
collectionId: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
objectType: {
|
|
objectType: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
type: {
|
|
type: {
|
|
|
type: Number,
|
|
type: Number,
|
|
@@ -62,26 +70,26 @@ export default {
|
|
|
},
|
|
},
|
|
|
visitModel: {
|
|
visitModel: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "1",
|
|
|
|
|
|
|
+ default: '1',
|
|
|
},
|
|
},
|
|
|
deviceCode: {
|
|
deviceCode: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
putInCode: {
|
|
putInCode: {
|
|
|
type: String,
|
|
type: String,
|
|
|
- default: "",
|
|
|
|
|
|
|
+ default: '',
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
shows: false,
|
|
shows: false,
|
|
|
- url: "",
|
|
|
|
|
|
|
+ url: '',
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
uploadImg() {
|
|
uploadImg() {
|
|
|
- var map = new TMap.Map("allmap", {
|
|
|
|
|
|
|
+ var map = new TMap.Map('allmap', {
|
|
|
zoom: 14,
|
|
zoom: 14,
|
|
|
center: new TMap.LatLng(39.986785, 116.301012),
|
|
center: new TMap.LatLng(39.986785, 116.301012),
|
|
|
});
|
|
});
|
|
@@ -93,19 +101,19 @@ export default {
|
|
|
});
|
|
});
|
|
|
markers.setGeometries([]);
|
|
markers.setGeometries([]);
|
|
|
|
|
|
|
|
- if (this.objectType == "" || this.objectType == null) {
|
|
|
|
|
- this.$toast("请选择类型!");
|
|
|
|
|
|
|
+ if (this.objectType == '' || this.objectType == null) {
|
|
|
|
|
+ this.$toast('请选择类型!');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
let url = window.location.href;
|
|
let url = window.location.href;
|
|
|
let that = this;
|
|
let that = this;
|
|
|
let wx = this.wx;
|
|
let wx = this.wx;
|
|
|
let qiyeData;
|
|
let qiyeData;
|
|
|
- let addressesRemark = "";
|
|
|
|
|
|
|
+ let addressesRemark = '';
|
|
|
const instance = axios.create();
|
|
const instance = axios.create();
|
|
|
- instance.defaults.headers.common["userId"] = localStorage.getItem("loginName");
|
|
|
|
|
|
|
+ instance.defaults.headers.common['userId'] = localStorage.getItem('loginName');
|
|
|
instance
|
|
instance
|
|
|
- .get(process.env.VUE_APP_BASE_API + "mobile/wx/ticket", {
|
|
|
|
|
|
|
+ .get(process.env.VUE_APP_BASE_API + 'mobile/wx/ticket', {
|
|
|
params: {
|
|
params: {
|
|
|
url: url,
|
|
url: url,
|
|
|
},
|
|
},
|
|
@@ -120,17 +128,17 @@ export default {
|
|
|
timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
|
|
timestamp: qiyeData.timestamp, // 必填,生成签名的时间戳
|
|
|
nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
|
|
nonceStr: qiyeData.nonceStr, // 必填,生成签名的随机串
|
|
|
signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
|
|
signature: qiyeData.signature, // 必填,签名,见 附录-JS-SDK使用权限签名算法
|
|
|
- jsApiList: ["ready", "chooseImage", "uploadImage", "getLocation"], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
|
|
|
|
|
|
|
+ jsApiList: ['ready', 'chooseImage', 'uploadImage', 'getLocation'], // 必填,需要使用的JS接口列表,凡是要调用的接口都需要传进来
|
|
|
});
|
|
});
|
|
|
wx.ready(function () {
|
|
wx.ready(function () {
|
|
|
wx.getLocation({
|
|
wx.getLocation({
|
|
|
- type: "gcj02",
|
|
|
|
|
|
|
+ type: 'gcj02',
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
var location = new TMap.LatLng(res.latitude, res.longitude);
|
|
var location = new TMap.LatLng(res.latitude, res.longitude);
|
|
|
map.setCenter(location);
|
|
map.setCenter(location);
|
|
|
markers.updateGeometries([
|
|
markers.updateGeometries([
|
|
|
{
|
|
{
|
|
|
- id: "main", // 点标注数据数组
|
|
|
|
|
|
|
+ id: 'main', // 点标注数据数组
|
|
|
position: location,
|
|
position: location,
|
|
|
},
|
|
},
|
|
|
]);
|
|
]);
|
|
@@ -140,24 +148,24 @@ export default {
|
|
|
addressesRemark = addresses.recommend;
|
|
addressesRemark = addresses.recommend;
|
|
|
},
|
|
},
|
|
|
function (err) {
|
|
function (err) {
|
|
|
- addressesRemark = "";
|
|
|
|
|
|
|
+ addressesRemark = '';
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
|
fail: function () {
|
|
fail: function () {
|
|
|
that.$dialog.alert({
|
|
that.$dialog.alert({
|
|
|
- message: "GPS未开启",
|
|
|
|
|
|
|
+ message: 'GPS未开启',
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
wx.chooseImage({
|
|
wx.chooseImage({
|
|
|
count: 1,
|
|
count: 1,
|
|
|
- sizeType: ["compressed"], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
|
|
- sourceType: ["camera"], // 可以指定来源是相册还是相机,默认二者都有
|
|
|
|
|
- defaultCameraMode: "normal", //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
|
|
|
|
|
|
|
+ sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
|
|
|
|
+ sourceType: ['camera'], // 可以指定来源是相册还是相机,默认二者都有
|
|
|
|
|
+ defaultCameraMode: 'normal', //表示进入拍照界面的默认模式,目前有normal与batch两种选择,normal表示普通单拍模式,batch表示连拍模式,不传该参数则为normal模式。从3.0.26版本开始支持front和batch_front两种值,其中front表示默认为前置摄像头单拍模式,batch_front表示默认为前置摄像头连拍模式。(注:用户进入拍照界面仍然可自由切换两种模式)
|
|
|
isSaveToAlbum: 0,
|
|
isSaveToAlbum: 0,
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
- var localIds = "";
|
|
|
|
|
|
|
+ var localIds = '';
|
|
|
if (res.localIds != undefined) {
|
|
if (res.localIds != undefined) {
|
|
|
localIds = res.localIds[0];
|
|
localIds = res.localIds[0];
|
|
|
} else {
|
|
} else {
|
|
@@ -179,45 +187,55 @@ export default {
|
|
|
uploadImagev(meidaId, addressesRemark) {
|
|
uploadImagev(meidaId, addressesRemark) {
|
|
|
var that = this;
|
|
var that = this;
|
|
|
var parentCollectionId = null;
|
|
var parentCollectionId = null;
|
|
|
- if (that.parentCollectionId != null && that.parentCollectionId != "null") {
|
|
|
|
|
|
|
+ if (that.parentCollectionId != null && that.parentCollectionId != 'null') {
|
|
|
parentCollectionId = that.parentCollectionId;
|
|
parentCollectionId = that.parentCollectionId;
|
|
|
}
|
|
}
|
|
|
var secondCollectionId = null;
|
|
var secondCollectionId = null;
|
|
|
- if (that.secondCollectionId != null && that.secondCollectionId != "null") {
|
|
|
|
|
|
|
+ if (that.secondCollectionId != null && that.secondCollectionId != 'null') {
|
|
|
secondCollectionId = that.secondCollectionId;
|
|
secondCollectionId = that.secondCollectionId;
|
|
|
}
|
|
}
|
|
|
var firstCollectionId = null;
|
|
var firstCollectionId = null;
|
|
|
- if (that.firstCollectionId != null && that.firstCollectionId != "null") {
|
|
|
|
|
|
|
+ if (that.firstCollectionId != null && that.firstCollectionId != 'null') {
|
|
|
firstCollectionId = that.firstCollectionId;
|
|
firstCollectionId = that.firstCollectionId;
|
|
|
}
|
|
}
|
|
|
|
|
+ var fourthCollectionId = null;
|
|
|
|
|
+ if (that.fourthCollectionId != null && that.fourthCollectionId != 'null') {
|
|
|
|
|
+ fourthCollectionId = that.fourthCollectionId;
|
|
|
|
|
+ }
|
|
|
|
|
+ var thirdCollectionId = null;
|
|
|
|
|
+ if (that.thirdCollectionId != null && that.thirdCollectionId != 'null') {
|
|
|
|
|
+ thirdCollectionId = that.thirdCollectionId;
|
|
|
|
|
+ }
|
|
|
var form = {
|
|
var form = {
|
|
|
mediaId: meidaId,
|
|
mediaId: meidaId,
|
|
|
collectionItemId: that.collectionId,
|
|
collectionItemId: that.collectionId,
|
|
|
objectType: that.objectType,
|
|
objectType: that.objectType,
|
|
|
storeGroupId: that.storeGroupId,
|
|
storeGroupId: that.storeGroupId,
|
|
|
taskId: that.taskId,
|
|
taskId: that.taskId,
|
|
|
- visitsId: localStorage.getItem("visitId"),
|
|
|
|
|
|
|
+ visitsId: localStorage.getItem('visitId'),
|
|
|
visitModel: that.visitModel,
|
|
visitModel: that.visitModel,
|
|
|
- visitSource: "1",
|
|
|
|
|
|
|
+ visitSource: '1',
|
|
|
locationRemark: addressesRemark,
|
|
locationRemark: addressesRemark,
|
|
|
parentCollectionId: parentCollectionId,
|
|
parentCollectionId: parentCollectionId,
|
|
|
secondCollectionId: secondCollectionId,
|
|
secondCollectionId: secondCollectionId,
|
|
|
firstCollectionId: firstCollectionId,
|
|
firstCollectionId: firstCollectionId,
|
|
|
|
|
+ fourthCollectionId: fourthCollectionId,
|
|
|
|
|
+ thirdCollectionId: thirdCollectionId,
|
|
|
deviceCode: that.deviceCode, //设备编号
|
|
deviceCode: that.deviceCode, //设备编号
|
|
|
putInCode: that.putInCode, //投放编号
|
|
putInCode: that.putInCode, //投放编号
|
|
|
};
|
|
};
|
|
|
var loind1 = that.$toast.loading({
|
|
var loind1 = that.$toast.loading({
|
|
|
duration: 0,
|
|
duration: 0,
|
|
|
- message: "上传中...",
|
|
|
|
|
|
|
+ message: '上传中...',
|
|
|
forbidClick: true,
|
|
forbidClick: true,
|
|
|
});
|
|
});
|
|
|
addstorePhoto(form).then((res) => {
|
|
addstorePhoto(form).then((res) => {
|
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
|
loind1.clear();
|
|
loind1.clear();
|
|
|
- that.$toast("上传成功!");
|
|
|
|
|
- that.$emit("newimgarr", { fileUrl: res.data.url, id: res.data.fileId, type: 2 });
|
|
|
|
|
|
|
+ that.$toast('上传成功!');
|
|
|
|
|
+ that.$emit('newimgarr', { fileUrl: res.data.url, id: res.data.fileId, type: 2 });
|
|
|
} else {
|
|
} else {
|
|
|
- that.$toast("上传失败!");
|
|
|
|
|
|
|
+ that.$toast('上传失败!');
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|