Эх сурвалжийг харах

移除相册获取图片;支持动态接口环境

zhoupeng 2 жил өмнө
parent
commit
f1a239116c

+ 1 - 1
app.json

@@ -5,7 +5,7 @@
   "window": {
     "backgroundTextStyle": "light",
     "navigationBarBackgroundColor": "#fff",
-    "navigationBarTitleText": "考试作答小程序",
+    "navigationBarTitleText": "考试作答小程序v1.1.4",
     "navigationBarTextStyle": "black"
   },
   "sitemapLocation": "sitemap.json"

+ 2 - 0
debug.log

@@ -0,0 +1,2 @@
+[0118/162807.415:ERROR:directory_reader_win.cc(43)] FindFirstFile: 系统找不到指定的路径。 (0x3)
+[0118/162807.418:ERROR:filesystem_win.cc(129)] GetFileAttributes C:\Users\ideson\AppData\Local\Google\Chrome\User Data\Crashpad\attachments\8a74dadd-df33-4e26-99c0-6c049ede7cba: 系统找不到指定的路径。 (0x3)

+ 1 - 1
pages/index/component/PicturePanel/index.js

@@ -80,7 +80,7 @@ Component({
 
       var that = this
       wx.showActionSheet({
-        itemList: ['拍照', '从手机相册选择'],
+        itemList: ['拍照'],
         success: chooseResult => {
           console.log('showActionSheet',this.data.pictures.length)
           if (this.data.pictures.length >= MAX_PICTURE) {

+ 22 - 7
pages/index/index.js

@@ -84,8 +84,14 @@ Page({
       onlyFromCamera: true,
       scanType: ['qrCode'],
       success(res) {
-        console.log(res)
-        var type = that.getQueryVariable(decodeURIComponent(res.result), 'transferFileType')
+        console.log("res")
+        var parameter = decodeURIComponent(res.result.replace(WX_REG, ""))
+        console.log('parameter::' + parameter)
+        var type = that.getQueryVariable(parameter, 'transferFileType')
+        var host = that.getQueryVariable(parameter, 'apiServer')
+        console.log("host::" + host);
+        API.initBaseUrl(host);
+        parameter = parameter.replace("&apiServer=" + host, "")
         if (type == 'PIC' || type == 'AUDIO') {
           wx.setNavigationBarTitle({
             title: type == 'PIC' ? '图片上传' : '音频上传'
@@ -94,7 +100,8 @@ Page({
             questionType: type
           })
           // 获取试题信息
-          that.secret = res.result.replace(WX_REG, '')
+          that.secret = parameter
+          console.log(that.secret)
           that.checkQrcode(that.secret, true)
         } else {
           wx.showToast({
@@ -227,11 +234,19 @@ Page({
     console.log(options)
     if (options && options.q) {
       const query = decodeURIComponent(options.q)
-      console.log(query)
-      if (query.indexOf(WX_REG) == 0) {
-        this.secret = query.replace(WX_REG, '')
-      }
+      /*if (query.indexOf("http") == 0) {
+        var result = query.replace("//", '/').replace("//", '/').split('/')
+        var baseUrl = result[0] + "//" + result[1];
+
+        API.initBaseUrl(baseUrl);
+        this.secret = query.replace(baseUrl, '').replace('/', '')
+      }*/
       var type = this.getQueryVariable(decodeURIComponent(query), 'transferFileType')
+      var host = this.getQueryVariable(decodeURIComponent(query), 'apiServer')
+      console.log("host::" + host);
+      API.initBaseUrl(host);
+      this.secret = query.replace(host, '').replace('/', '')
+
       console.log(type)
       if (type == 'PIC' || type == 'AUDIO') {
         wx.setNavigationBarTitle({

+ 59 - 53
project.config.json

@@ -1,55 +1,61 @@
 {
-	"description": "项目配置文件",
-	"packOptions": {
-		"ignore": []
-	},
-	"setting": {
-		"urlCheck": false,
-		"es6": true,
-		"postcss": true,
-		"minified": true,
-		"newFeature": true,
-		"nodeModules": true,
-		"autoAudits": false,
-		"checkInvalidKey": true,
-		"checkSiteMap": true,
-		"uploadWithSourceMap": true,
-		"babelSetting": {
-			"ignore": [],
-			"disablePlugins": [],
-			"outputPath": ""
-		}
-	},
-	"compileType": "miniprogram",
-	"libVersion": "2.8.3",
-	"appid": "wx4263754944d4d184",
-	"projectname": "tools",
-	"debugOptions": {
-		"hidedInDevtools": []
-	},
-	"isGameTourist": false,
-	"simulatorType": "wechat",
-	"simulatorPluginLibVersion": {},
-	"condition": {
-		"search": {
-			"current": -1,
-			"list": []
-		},
-		"conversation": {
-			"current": -1,
-			"list": []
-		},
-		"plugin": {
-			"current": -1,
-			"list": []
-		},
-		"game": {
-			"currentL": -1,
-			"list": []
-		},
-		"miniprogram": {
-			"current": -1,
-			"list": []
-		}
-	}
+    "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+    "packOptions": {
+        "ignore": [],
+        "include": []
+    },
+    "setting": {
+        "urlCheck": false,
+        "es6": true,
+        "postcss": true,
+        "minified": true,
+        "newFeature": true,
+        "nodeModules": true,
+        "autoAudits": false,
+        "checkInvalidKey": true,
+        "checkSiteMap": true,
+        "uploadWithSourceMap": true,
+        "babelSetting": {
+            "ignore": [],
+            "disablePlugins": [],
+            "outputPath": ""
+        },
+        "minifyWXML": true,
+        "packNpmManually": false,
+        "packNpmRelationList": [],
+        "minifyWXSS": true,
+        "disableUseStrict": false,
+        "useStaticServer": true,
+        "showES6CompileOption": false,
+        "useCompilerPlugins": false,
+        "coverView": true,
+        "lazyloadPlaceholderEnable": false,
+        "preloadBackgroundData": false,
+        "uglifyFileName": false,
+        "enhance": true,
+        "useMultiFrameRuntime": true,
+        "showShadowRootInWxmlPanel": true
+    },
+    "compileType": "miniprogram",
+    "libVersion": "2.23.4",
+    "appid": "wx4263754944d4d184",
+    "projectname": "tools",
+    "simulatorType": "wechat",
+    "simulatorPluginLibVersion": {},
+    "condition": {
+        "miniprogram": {
+            "list": [
+                {
+                    "name": "pages/index/index",
+                    "pathName": "pages/index/index",
+                    "query": "q=https%3A%2F%2F192.168.10.39%2FexamStudentId%253D2%2526examRecordDataId%253D8066862%2526order%253D20%2526transferFileType%253DAUDIO%2526key%253DU_S_0_2%2526token%253DCC0644A619EB5562733292581F30662169B6FA1A5FAC04AB6D2B9C163CDA0484",
+                    "scene": null
+                }
+            ]
+        }
+    },
+    "editorSetting": {
+        "tabIndent": "insertSpaces",
+        "tabSize": 4
+    }
 }

+ 28 - 0
project.private.config.json

@@ -0,0 +1,28 @@
+{
+    "libVersion": "2.4.4",
+    "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+    "setting": {
+        "urlCheck": false,
+        "compileHotReLoad": true
+    },
+    "condition": {
+        "miniprogram": {
+            "list": [
+                {
+                    "name": "pages/index/index",
+                    "pathName": "pages/index/index",
+                    "query": "q=https%3A%2F%2F192.168.10.39%2FexamStudentId%253D2%2526examRecordDataId%253D8066862%2526order%253D20%2526transferFileType%253DAUDIO%2526key%253DU_S_0_2%2526token%253DCC0644A619EB5562733292581F30662169B6FA1A5FAC04AB6D2B9C163CDA0484",
+                    "scene": null
+                },
+                {
+                    "name": "h",
+                    "pathName": "pages/index/index",
+                    "query": "q=examStudentId%3D36794%26examRecordDataId%3D105691%26order%3D28%26transferFileType%3DPIC%26key%3DU_S_15_36078%26token%3D69729CB5E4ADAACD6F8C3F59729B477987375F478399447E43918189CAAB12A0%26apiServer%3Dhttps%3A%2F%2Fwhdx.test41.qmth.com.cn%3A443",
+                    "launchMode": "default",
+                    "scene": null
+                }
+            ]
+        }
+    },
+    "projectname": "examcloud-weixin-upload-audio"
+}

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 7 - 1
utils/api.js


+ 10 - 1
utils/api.ts

@@ -122,7 +122,8 @@ export class Api implements API {
     //ecs-test.qmth.com.cn
     //http://ecs-dev.qmth.com.cn
     //'https://org0.ea100.com.cn'
-  configOption: ApiConfigOption = { ver: 1, versionName: 'v1.0.0', baseUrl: 'https://ecs-test.ea100.com.cn' }
+    //https://ecs-test.ea100.com.cn  https://ecs-test.ea100.com.cn
+  configOption: ApiConfigOption = { ver: 1, versionName: 'v1.0.0', baseUrl: 'http://192.168.10.41:8003' }
     private key: string = ''
     private token: string = ''
     private tokenValidCallback: TokenValidCallback = () => {}
@@ -131,6 +132,14 @@ export class Api implements API {
         return this.configOption.versionName
     }
 
+    init(config: ApiConfigOption) {
+        this.configOption = config
+    }
+
+    initBaseUrl(baseUrl: string) {
+        this.configOption.baseUrl = baseUrl
+    }
+
     /**
      * 授权成功后配置
      * @param {number} uid

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно