Pārlūkot izejas kodu

删除home.html,addVersion使用通用的

cuiyalong 5 gadi atpakaļ
vecāks
revīzija
0949dd7fe1
3 mainītis faili ar 41 papildinājumiem un 199 dzēšanām
  1. 38 15
      addVersion.js
  2. 0 168
      public/home.html
  3. 3 16
      public/index.html

+ 38 - 15
addVersion.js

@@ -1,23 +1,46 @@
 /* eslint-disable */
 var fs = require('fs')
-var path = require('path');
+var path = require('path')
+
+// 例子
+// [
+//   'res://app2-jytest.jianyu360.cn/jyapp/local/vue.min.js',
+//   'res://app2-jytest.jianyu360.cn/jyapp/local/vue-router.min.js',
+//   'res://app2-jytest.jianyu360.cn/jyapp/local/vuex.min.js',
+//   'res://app2-jytest.jianyu360.cn/jyapp/local/axios.min.js',
+//   'res://app2-jytest.jianyu360.cn/jyapp/local/js.cookie.min.js',
+//   'res://app2-jytest.jianyu360.cn/jyapp/local/vant.min.js',
+//   'res://app2-jytest.jianyu360.cn/jyapp/local/echarts.min.js',
+//   'res://app2-jytest.jianyu360.cn/jyapp/local/moment.min.js',
+// ]
 
 var config = {
-  // urlBefore: 'res://app2-jytest.jianyu360.cn',
-  urlBefore: ['res://app-i1.jianyu360.com', 'res://app2-jytest.jianyu360.cn'],
+  projectPath: path.resolve(__dirname),
+  filePath: '/page_entniche/',
+  templateName: 'index.html',
   urlLocal: '/jyapp/local',
-  readFile: '/page_entniche/index.html',
-  writeFile: ['/page_entniche/index_i1.html', '/page_entniche/index_app2.html'],
+  output: [
+    {
+      origin: 'res://app-i1.jianyu360.com',
+      fileName: 'index_i1.html'
+    },
+    {
+      origin: 'res://app2-jytest.jianyu360.cn',
+      fileName: 'index_app2.html'
+    }
+  ]
 }
 
-var filePath=path.resolve(__dirname);
-
-fs.readFile(filePath + config.readFile,'utf8',function(err,files){
-  config.writeFile.forEach(function(v,i) {
-    var result = files.replace(/\/page_entniche\//g, config.urlBefore[i] + '/page_entniche/');
-    result = result.replace(/script(.*?)src=(.*?)\d\/(.*?).min.js/g, `script$1src=${config.urlBefore[i]}${config.urlLocal}/$3.min.js`);
-    fs.writeFile(filePath + config.writeFile[i], result, 'utf8', function (err) {
-      if (err) return console.log(err);
-    });
+fs.readFile(`${config.projectPath}${config.filePath}${config.templateName}`, 'utf8', function(err, files) {
+  config.output.forEach(function (item, index) {
+    let replaced = files.replace(new RegExp(`${config.filePath}`, 'g'), `${item.origin}${config.filePath}`)
+    // 在文件中部分 标签 前加换行,避免被正则贪婪匹配全部匹配到
+    replaced = replaced.replace(/(<[a-z])/g, `\n$1`)
+    replaced = replaced.replace(/script(.*?)src=\/(.*)\/(.*).min.js/g, `script$1src=${item.origin}${config.urlLocal}/$3.min.js`)
+    // 将前面添加的换行去掉
+    replaced = replaced.replace(/\n/g, '')
+    fs.writeFileSync(`${config.projectPath}${config.filePath}${item.fileName}`, replaced, 'utf8', function (err) {
+      if (err) return console.log(err)
+    })
   })
-})
+})

+ 0 - 168
public/home.html

@@ -1,168 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
-    <meta charset="UTF-8">
-    <meta name="viewport"
-        content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
-    <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <base target="_blank" />
-    <title>入口页面</title>
-    <script src="../js/rem.js"></script>
-    <link rel="stylesheet" href="../css/weui.min.css">
-    <link rel="stylesheet" href="../css/base.css">
-    <style>
-        a {
-            color: #2CB7CA;
-        }
-
-        h2,
-        h3,
-        h4 {
-            font-weight: normal;
-        }
-
-        h2 {
-            font-size: .36rem;
-        }
-
-        h3 {
-            font-size: .34rem;
-        }
-
-        h4 {
-            font-size: .32rem;
-        }
-
-        p {
-            color: #666;
-            font-size: .3rem;
-            text-indent: 8px;
-            text-align: justify;
-        }
-    </style>
-</head>
-
-<body>
-
-    <div style="padding: 0.3rem;">
-        <h1 style="text-align: center;">企业商机管理</h1>
-        <h2 class="title"><a href="./page/treasure_box.html" class=""> 百宝箱</a></h2>
-        <section style="padding: 0.3rem 0 0;">
-            <h2 class="title"><a class="">1. 企业商机管理入口页</a></h2>
-            <section style="padding: 0.1rem 0.3rem;">
-                <p>入口页为app订阅栏目,需要在之前后端开发的vip订阅 版本基础上修改,暂无修改</p>
-                <section style="padding: 0.2rem 0.3rem 0.1rem;">
-                    <h4> <a href="./page/sub_mode/sub_mode.html">1.1 切换订阅模式</a></h4>
-                    <p></p>
-                </section>
-                <section style="padding: 0.2rem 0.3rem 0.1rem;">
-                    <h4> <a href="./page/sub_mode/switch_mode.html">1.2 切换企业</a></h4>
-                    <p></p>
-                </section>
-            </section>
-        </section>
-        <!-- 购买页 -->
-        <section style="padding: 0.3rem 0 0;">
-            <h2 class="title"><a class="" href="./page/introduce_page.html">2. 商机管理介绍页</a></h2>
-            <section style="padding: 0.1rem 0.3rem;">
-                <section style="padding: 0.2rem 0.3rem 0.1rem;">
-                    <h4><a class="" href="./page/buy_production/buy_production.html">2.1 购买页</a></h4>
-                    <p></p>
-                </section>
-                <section style="padding: 0.2rem 0.3rem 0.1rem;">
-                    <h4> <a href="./page/buy_production/buy_checkout.html">2.2 选择支付方式</a></h4>
-                    <p></p>
-                </section>
-                <section style="padding: 0.2rem 0.3rem 0.1rem;">
-                    <h4> <a href="./page/buy_production/pay_success.html">2.3 支付成功</a></h4>
-                    <p></p>
-                </section>
-            </section> 
-        </section>
-        <!-- 订阅设置 -->
-        <section style="padding: 0.3rem 0 0;">
-            <h2 class="title"><a class="" href="./page/subsetting/sub_entrance.html">3. 订阅设置</a></h2>
-            <section style="padding: 0.2rem 0.3rem 0.1rem;">
-                <h4> <a href="./page/subsetting/choose_area.html">3.1 区域选择</a></h4>
-                <p></p>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4><a href="./page/subsetting/choose_industry.html">3.2 采购单位 行业选择</a></h4>
-                <p></p>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4><a href="./page/subsetting/additionWord.html">3.3 设置附加词</a></h4>
-                <p></p>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4><a href="./page/subsetting/exclusiveWord.html">3.4 设置排除词</a></h4>
-                <p></p>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/subsetting/keyWord.html">3.5 设置关键词</a></h4>
-                <p></p>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/subsetting/messageType.html">3.6 选择信息类型</a></h4>
-            </section>
-        </section>
-        <!-- 分发设置 -->
-        <section style="padding: 0.3rem 0 0;">
-            <h2 class="title"><a class="" href="./page/sub_management/dispense_settings.html">4. 分发设置</a></h2>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/sub_management/dispense_settings_detail.html">4.1 分发设置</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/sub_management/dispense_keywords.html">4.2 添加关键词</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/sub_management/dispense_staff.html">4.3 分发员工</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/sub_management/dispense_staff.html">4.3 分发员工</a></h4>
-            </section>
-        </section>
-        <!-- 企业架构 -->
-        <section style="padding: 0.3rem 0 0;">
-            <h2 class="title"><a class="" href="./page/business_management/enterprise_architecture.html">5. 企业架构</a></h2>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/business_management/people_management.html">5.1 人员管理</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/business_management/personnel_info.html">5.2 人员信息</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/business_management/add_branch.html">5.3 添加部门</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/business_management/add_personnel.html">5.4 添加人员</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/business_management/choose_branch.html">5.5 选择部门</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/business_management/choose_admin.html">5.6 选择管理员</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/business_management/set_admin.html">5.7 设置管理员</a></h4>
-            </section>
-            <section style="padding: 0.1rem 0.3rem;">
-                <h4 class="title"><a class="" href="./page/business_management/choose_child_branch.html">5.8 选择子部门</a></h4>
-            </section>
-        </section>
-        <!-- 订阅管理 -->
-        <section style="padding: 0.3rem 0 0;">
-            <h2 class="title"><a class="" href="./page/sub_management/sub_management.html">6. 订阅管理</a></h2>
-            <p>角色分为公司管理员、部门管理员、员工,对应展示不同内容。(默认展示一个,其他的通过具体数据进行显示隐藏) </p>
-        </section>
-
-        <br>
-        <section>
-            <h2  style="font-size: 0.3rem;">备注:页面分工</h2>
-            <h3 style="font-size: 0.3rem;color: red;">购买页、分发设置、入口页(崔亚龙);<br> 订阅设置(汤世哲);<br>介绍页、百宝箱、 企业架构(杨峰)</h3>
-        </section>
-    </div>
-</body>
-
-</html>

+ 3 - 16
public/index.html

@@ -2,17 +2,15 @@
 <html lang="zh-CN">
   <head>
     <meta charset="utf-8">
-    <meta name="keywords" content="企明星,剑鱼标讯">
-    <meta name="description" content="企明星,剑鱼标讯">
-    <meta name="author" content="企明星,剑鱼标讯">
+    <meta name="keywords" content="剑鱼标讯,企业商机管理,企明星">
+    <meta name="description" content="剑鱼标讯,企业商机管理,企明星">
+    <meta name="author" content="剑鱼标讯,企明星">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover">
     <meta name="browsermode" content="application">
     <meta name="x5-orientation" content="portrait">
     <meta name="screen-orientation" content="portrait">
     <meta name="x5-page-mode" content="app">
-    <meta name="apple-mobile-web-app-capable" content="yes" />
-    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
     <meta name="apple-mobile-web-app-capable" content="yes">
     <meta name="apple-mobile-web-app-status-bar-style" content="black">
     <meta name="format-detection" content="telephone=no">
@@ -27,17 +25,6 @@
       <script src="//cdn.jsdelivr.net/npm/vant@2.5.7/lib/vant.min.js"></script>
       <script src="//cdn.bootcdn.net/ajax/libs/echarts/4.7.0/echarts.min.js"></script>
       <script src="//cdn.bootcdn.net/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
-      <script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
-
-<!--      <script src="res://app2-jytest.jianyu360.cn/jyapp/local/vue.min.js"></script>-->
-<!--      <script src="res://app2-jytest.jianyu360.cn/jyapp/local/vue-router.min.js"></script>-->
-<!--      <script src="res://app2-jytest.jianyu360.cn/jyapp/local/vuex.min.js"></script>-->
-<!--      <script src="res://app2-jytest.jianyu360.cn/jyapp/local/axios.min.js"></script>-->
-<!--      <script src="res://app2-jytest.jianyu360.cn/jyapp/local/js.cookie.min.js"></script>-->
-<!--      <script src="res://app2-jytest.jianyu360.cn/jyapp/local/vant.min.js"></script>-->
-<!--      <script src="res://app2-jytest.jianyu360.cn/jyapp/local/echarts.min.js"></script>-->
-<!--      <script src="res://app2-jytest.jianyu360.cn/jyapp/local/moment.min.js"></script>-->
-<!--      <script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>-->
     <% } %>
   </head>
   <body>