瀏覽代碼

更改选择图片张数

zhanghongrui 2 年之前
父節點
當前提交
f42b609862
共有 1 個文件被更改,包括 14 次插入13 次删除
  1. 14 13
      pages/xunjian/xunjian.js

+ 14 - 13
pages/xunjian/xunjian.js

@@ -33,8 +33,8 @@ Page({
         listid: "1"
       },
     ],
-    isBeforeBack:false,
-    isAfterBack:false,
+    isBeforeBack: false,
+    isAfterBack: false,
   },
 
   takePicture: function (e) {
@@ -46,6 +46,7 @@ Page({
 
     wx.chooseMedia({
       sourceType: ['album', 'camera'],
+      count: 1,
       success(res) {
         let tempFilePath = res.tempFiles[0].tempFilePath
         console.log(tempFilePath)
@@ -221,8 +222,8 @@ Page({
   },
   //上传图片
   onLoad: function (options) {
-    console.log("TAG","onLoad_"+options.isBeforeBack);
-    this.data.isBeforeBack=options.isBeforeBack;
+    console.log("TAG", "onLoad_" + options.isBeforeBack);
+    this.data.isBeforeBack = options.isBeforeBack;
     this.pictureAuthSetting()
     this.data.busEnterpriseId = options.busEnterpriseId
     // this.getXunjianItems()
@@ -233,20 +234,20 @@ Page({
       uplaodFile: this.uplaodFile.bind(this),
     })
   },
-  onShow:function(){
+  onShow: function () {
     let pages = getCurrentPages();
-    let currPage = pages[pages.length-1];
-    this.data.isAfterBack=currPage.data.isAfterBack;
+    let currPage = pages[pages.length - 1];
+    this.data.isAfterBack = currPage.data.isAfterBack;
     // this.data.busEnterpriseId = options.busEnterpriseId
     // console.log("TAG","onShow_before_"+this.data.isBeforeBack);
     // console.log("TAG","onShow_after_"+this.data.isAfterBack);
-    if(this.data.isBeforeBack){
+    if (this.data.isBeforeBack) {
       this.getXunjianItems()
-      this.data.isBeforeBack=false
+      this.data.isBeforeBack = false
     }
-    if(this.data.isAfterBack){
+    if (this.data.isAfterBack) {
       this.getXunjianItems()
-      this.data.isAfterBack=false
+      this.data.isAfterBack = false
     }
   },
   //mpuploader选择图片时的过滤函数,返回true表示图片有效
@@ -319,7 +320,7 @@ Page({
   getXunjianItems() {
     // console.log("TAG","getXunjianItems")
     var obj = new Object()
-    
+
     obj.busEnterpriseId = this.data.busEnterpriseId
     http.post("/system/AppXunjianController/getXunjianItems", obj, this.getXunjianItemsSuccess)
   },
@@ -447,7 +448,7 @@ Page({
     }
     clearInterval(interval); // 清除setInterval 
     time = 0;
-  }, 
+  },
 
 })