|
@@ -1,5 +1,6 @@
|
|
// pages/xunjian/xunjian.js
|
|
// pages/xunjian/xunjian.js
|
|
import http from '../../base/httputil'
|
|
import http from '../../base/httputil'
|
|
|
|
+import tools from '../../base/tools'
|
|
Page({
|
|
Page({
|
|
/**
|
|
/**
|
|
* 页面的初始数据
|
|
* 页面的初始数据
|
|
@@ -34,23 +35,76 @@ Page({
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
- takePicture: function () {
|
|
|
|
|
|
+ takePicture: function (e) {
|
|
// 拍照
|
|
// 拍照
|
|
-
|
|
|
|
|
|
+ let jibie = e.currentTarget.dataset.jibie
|
|
|
|
+ let listid = e.currentTarget.dataset.listid
|
|
|
|
+ let from = e.currentTarget.dataset.picfrom
|
|
|
|
+ let that = this
|
|
|
|
+
|
|
wx.chooseMedia({
|
|
wx.chooseMedia({
|
|
- sourceType :['album','camera'],
|
|
|
|
- success(res){
|
|
|
|
|
|
+ sourceType: ['album', 'camera'],
|
|
|
|
+ success(res) {
|
|
let tempFilePath = res.tempFiles[0].tempFilePath
|
|
let tempFilePath = res.tempFiles[0].tempFilePath
|
|
console.log(tempFilePath)
|
|
console.log(tempFilePath)
|
|
|
|
+ //
|
|
|
|
+ that.data.xunjianItems[jibie][1].forEach(function (item, index) {
|
|
|
|
+ if (item.listid == listid) {
|
|
|
|
+ let uuid = tools.uuid()
|
|
|
|
+
|
|
|
|
+ let picutre = {
|
|
|
|
+ "pic_key": uuid,
|
|
|
|
+ "pic_value": tempFilePath,
|
|
|
|
+ "pic_base64":wx.getFileSystemManager().readFileSync(tempFilePath,'base64')
|
|
|
|
+ }
|
|
|
|
+ if (from == "before") {
|
|
|
|
+ that.data.xunjianItems[jibie][1][index].picturesBefore.push(picutre)
|
|
|
|
+ }
|
|
|
|
+ if (from == "after") {
|
|
|
|
+ that.data.xunjianItems[jibie][1][index].picturesAfter.push(picutre)
|
|
|
|
+ }
|
|
|
|
+ // let str = 'xunjianItems["' + jibie + '"][1][' + index + '].checked'
|
|
|
|
+ that.setData({
|
|
|
|
+ xunjianItems: that.data.xunjianItems
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
this.setData({
|
|
this.setData({
|
|
show: false
|
|
show: false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
|
|
-
|
|
|
|
|
|
+ deletePic(e) {
|
|
|
|
+ let that = this
|
|
|
|
+ let jibie = e.currentTarget.dataset.jibie
|
|
|
|
+ let listid = e.currentTarget.dataset.listid
|
|
|
|
+ let pickey = e.currentTarget.dataset.pickey
|
|
|
|
+ let from = e.currentTarget.dataset.picfrom
|
|
|
|
+ console.log(jibie, listid, pickey, from)
|
|
|
|
+ this.data.xunjianItems[jibie][1].forEach(function (item, index) {
|
|
|
|
+ if (item.listid == listid) {
|
|
|
|
+ if (from == "before") {
|
|
|
|
+ that.data.xunjianItems[jibie][1][index].picturesBefore.forEach(function (it, inx) {
|
|
|
|
+ if (it.pic_key == pickey) {
|
|
|
|
+ that.data.xunjianItems[jibie][1][index].picturesBefore.splice(inx, 1)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else if (from == "after") {
|
|
|
|
+ that.data.xunjianItems[jibie][1][index].picturesAfter.forEach(function (it, inx) {
|
|
|
|
+ if (it.pic_key == pickey) {
|
|
|
|
+ that.data.xunjianItems[jibie][1][index].picturesAfter.splice(inx, 1)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ that.setData({
|
|
|
|
+ xunjianItems: that.data.xunjianItems
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
|
|
pictureAuthSetting() {
|
|
pictureAuthSetting() {
|
|
wx.authorize({
|
|
wx.authorize({
|
|
@@ -283,7 +337,7 @@ Page({
|
|
submitXujianSuccess(res) {
|
|
submitXujianSuccess(res) {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
- url: '../xqzggzs2/xqzggzs2',
|
|
|
|
|
|
+ url: '../xqzggzs2/xqzggzs2?logId='+res.logId,
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
wx.showToast({
|
|
wx.showToast({
|