소스 검색

add custom deploy path

Konstantin Ladutenko 5 년 전
부모
커밋
36c9f89db3
4개의 변경된 파일32개의 추가작업 그리고 20개의 파일을 삭제
  1. 14 13
      vue-cli3-webapp/public/index.html
  2. 4 2
      vue-cli3-webapp/src/App.vue
  3. 11 3
      vue-cli3-webapp/src/components/GetMaterials.vue
  4. 3 2
      vue-cli3-webapp/vue.config.js

+ 14 - 13
vue-cli3-webapp/public/index.html

@@ -6,20 +6,21 @@
   <meta name="viewport" content="width=device-width,initial-scale=1.0">
 <!--  <link rel="icon" href="<%= BASE_URL %>favicon.ico">-->
   <title>Mie calculator</title>
-  <!-- Yandex.Metrika counter -->
-  <script type="text/javascript" >
-    (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
-      m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
-    (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
 
-    ym(54984811, "init", {
-      clickmap:true,
-      trackLinks:true,
-      accurateTrackBounce:true
-    });
-  </script>
-  <noscript><div><img src="https://mc.yandex.ru/watch/54984811" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
-  <!-- /Yandex.Metrika counter -->
+<!--  &lt;!&ndash; Yandex.Metrika counter &ndash;&gt;-->
+<!--  <script type="text/javascript" >-->
+<!--    (function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};-->
+<!--      m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})-->
+<!--    (window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");-->
+
+<!--    ym(54984811, "init", {-->
+<!--      clickmap:true,-->
+<!--      trackLinks:true,-->
+<!--      accurateTrackBounce:true-->
+<!--    });-->
+<!--  </script>-->
+<!--  <noscript><div><img src="https://mc.yandex.ru/watch/54984811" style="position:absolute; left:-9999px;" alt="" /></div></noscript>-->
+<!--  &lt;!&ndash; /Yandex.Metrika counter &ndash;&gt;-->
 </head>
 <body>
 

+ 4 - 2
vue-cli3-webapp/src/App.vue

@@ -128,8 +128,10 @@
   import nmiejs from './nmiejs.js';
   const module = nmiejs({
     locateFile(path) {
-      // let deploy_path = '/themes/custom/physics/mie/';
-      let deploy_path = '';
+      let deploy_path = process.env.BASE_URL;
+      // '/themes/custom/physics/mie/';
+      // console.log();
+      // // let deploy_path = '';
       console.log(deploy_path+path);
       return deploy_path+path;
     }

+ 11 - 3
vue-cli3-webapp/src/components/GetMaterials.vue

@@ -23,6 +23,7 @@
                         <th>Name</th>
                         <th>Plot</th>
                         <th>File or URL</th>
+                        <th></th>
                     </tr>
                     </thead>
                     <tr v-for="material in materials" v-bind:key="material.name">
@@ -42,7 +43,8 @@
                         <td>{{material.name}}  ({{material.spline_n.xs[0]}} -
                             {{material.spline_n.xs[material.spline_n.xs.length-1]}} nm)</td>
                         <td><b-checkbox v-model="material.isPlot"/></td>
-                        <td><a v-bind:href="material.fname">{{material.fname}}</a>
+                        <td><a v-bind:href="material.fname">{{material.display_fname}}</a></td>
+                        <td>
                             <span class="rh-input">
                                 <b-button @click="deleteMaterial(material.fname);" class="is-danger is-small is-outlined">
                                     <font-awesome-icon icon="trash"/>
@@ -147,9 +149,12 @@
             }
         },
         mounted() {
-            // let deploy_path = deploy_path+'';
-            let deploy_path = '';
+            // let deploy_path = '/themes/custom/physics/mie/';
+            // let deploy_path = '';
+            // let deploy_path = window.location.pathname;
+            let deploy_path = process.env.BASE_URL;
 
+            // console.log('materials path', deploy_path);
             let files = [deploy_path+'Ag-Johnson-1972.yml',
                 deploy_path+'Al-McPeak-2015.yml',
                 deploy_path+'Au-McPeak-2015.yml',
@@ -276,11 +281,14 @@
             },
             addMaterial(files, names){
                 let old_names=[];
+                let deploy_path = process.env.BASE_URL;
+
                 for (const mat of this.materials) old_names.push(mat.name);
                 for (let i = 0; i < files.length; i++) {
                     if (old_names.includes(names[i])) continue; //Filter out reloads during development
                     this.materials.push({
                         fname: files[i],
+                        display_fname: files[i].replace(process.env.BASE_URL,""),
                         name: names[i],
                         isUsed: true,
                         isPlot: false,

+ 3 - 2
vue-cli3-webapp/vue.config.js

@@ -1,4 +1,5 @@
 module.exports = {
-    // publicPath: '/themes/custom/physics/mie/'
-    publicPath: ''
+    publicPath: process.env.NODE_ENV === 'production'
+        ? '/themes/custom/physics/mie/' //deploy path in Drupal setup at physics.ifmo.ru
+        : '/'
 }