Browse Source

Merge branch 'develop3.0-tmd' into develop3.0

CrazyIter_Bin 4 years ago
parent
commit
d30b6153cd

+ 2 - 2
TEAMModelOS/ClientApp/src/utils/blobTool.js

@@ -358,12 +358,12 @@ export default class BlobTool {
             let sasString = ''
             if (blobTool) {
                 blobs = await blobTool.listBlob({
-                    prefix: sourceFolder
+                    prefix: sourceFolder + '/'
                 }, false)
                 sasString = blobTool.sasString
             } else {
                 blobs = await this.listBlob({
-                    prefix: sourceFolder
+                    prefix: sourceFolder + '/'
                 }, false)
                 sasString = this.sasString
             }

+ 17 - 1
TEAMModelOS/Controllers/Core/ImportController.cs

@@ -249,9 +249,25 @@ namespace TEAMModelOS.Controllers
 
             var doc = _DOXC2HTMLTranslator.Translate(file.OpenReadStream());
             // Dictionary<string, object> model = await ImportExerciseService.UploadWord(_azureStorage, file);
-            return Ok(doc);
+            return Ok(new { htmlString = doc });
         }
 
+        /// <summary>
+        /// htmlString AnalyzeHtml
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("parse-word")]
+        public IActionResult ParseWord([FromForm] IFormFile file)
+        {
+            if (!FileType.GetExtention(file.FileName).ToLower().Equals("docx"))
+            {
+                return BadRequest(new Dictionary<string, object> { { "msg", "type is not docx!" }, { "code", ResponseCode.FAILED } });
+            }
+            var doc = _DOXC2HTMLTranslator.Translate(file.OpenReadStream());
+            var exercises = _HTML2ITEMV3Translator.Translate(doc);
+            return Ok(exercises);
+        }
         /// <summary>
         /// htmlString AnalyzeHtml
         /// </summary>

+ 1 - 1
TEAMModelOS/TEAMModelOS.csproj

@@ -7,7 +7,7 @@
     <PackageReference Include="Caching.CSRedis" Version="3.6.50" />
     <PackageReference Include="CSRedisCore" Version="3.6.5" />
     <PackageReference Include="DotNetZip" Version="1.15.0" />
-    <PackageReference Include="HTEXLib" Version="2.2.9" />
+    <PackageReference Include="HTEXLib" Version="2.3.1" />
     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.6" />
       <PackageReference Include="VueCliMiddleware" Version="3.1.2" />  </ItemGroup>
   <PropertyGroup>