Browse Source

[update] build conf

x 5 years ago
parent
commit
c5d43f6b60
7 changed files with 130 additions and 89 deletions
  1. 0 2
      .env
  2. 3 0
      .env.development
  3. 3 0
      .env.production
  4. 62 35
      build.py
  5. 7 0
      change.md
  6. 49 47
      tools/build.sh
  7. 6 5
      tools/version.json

+ 0 - 2
.env

@@ -1,3 +1 @@
-VUE_APP_API_URL=https://twongd.shotshock.shop/api
-VUE_APP_WS_URL=wss:twongd.shotshock.shop
 VUE_APP_NAME=美天旺

+ 3 - 0
.env.development

@@ -0,0 +1,3 @@
+VUE_APP_API_URL = http://localhost:8080/api
+VUE_APP_UPDATE_URL = https://qndownload.shotshock.shop/version
+VUE_APP_SHARE_URL = https://twong.shotshock.shop/mobilex/share

+ 3 - 0
.env.production

@@ -0,0 +1,3 @@
+VUE_APP_API_URL = http://81.70.81.74:30007/api
+VUE_APP_UPDATE_URL = https://qndownload.shotshock.shop/version
+VUE_APP_SHARE_URL = https://twong.shotshock.shop/mobilex/share

+ 62 - 35
build.py

@@ -11,19 +11,22 @@ apkPath = "./cordova/platforms/android/app/build/outputs/apk/release/app-release
 appID = "1537411658"
 # appStore 地址
 appStore = "itms-apps://itunes.apple.com/us/app/apple-store/" + appID
+# App 下载页面
+download_url = "https://twongd.shotshock.shop/mobilex/download"
 
 
 # 保存版本信息
 def save_version(new_ver):
     ver = {
+        'iosID': appID,
         "version": new_ver,
-        "iosVersion": new_ver,
-        'iosID': (appID,),
+        "deVersion": new_ver,
         "iosStore": appStore,
+        "update": download_url,
         "download": remote_url + "/twong-" + new_ver + ".apk",
     }
     ver_file = open("tools/version.json", "w")
-    json.dump(ver, ver_file)
+    json.dump(ver, ver_file, indent=4)
     ver_file.close()
 
 
@@ -47,53 +50,77 @@ def remote_version():
     return cur_version["version"]
 
 
+def error():
+    print("参数错误")
+    help()
+    exit(1)
+
+
+def help():
+    print("用法:\n\
+    all\t\t\t-- 生成一个新的版本号 用新的版本号打包 然后全部上传到服务器\n\
+    all [code]\t\t-- 把[code]作为版本号存入本地并应用到Cordova工程 打包 然后全部上传到服务器\n\
+    android\t\t-- 打包APK\n\
+    android [code]\t-- 把[code]作为版本号存入本地并应用到Cordova工程 打包APK\n\
+    help\t\t-- 显示帮助文档\n\
+    info\t\t-- 显示当前远程版本号和本地版本号\n\
+    ios\t\t\t-- Build IOS Cordova 工程\n\
+    ios [code]\t\t-- 把[code]作为版本号存入本地并应用到Cordova工程 打包IOS\n\
+    upload\t\t-- 以当前版本号打包 只上传APP到服务器\n\
+    upload [code]\t-- 把[code]作为版本号打包APK 只上传APK到服务器\n\
+    version\t\t-- 只把当前目录的版本文件上传到服务器(tools/version.json)\n\
+    version [code]\t-- 把[code]作为版本号存入本地并应用到Cordova工程 只上传版本文件到服务器\n")
+
+
+def test():
+    save_version("1.2.1")
+    print("test over")
+
+
 if __name__ == "__main__":
     args = sys.argv
-
-    if len(args) > 0:
-        if args[1] == "version":
-            cur_ver = remote_version()
-            ver_new = new_version(cur_ver)
+    if len(args) > 1:
+        arg_1 = args[1]
+        if arg_1 == "version":
+            cur_ver = get_apk_version()
             if len(args) > 2:
-                ver_new = args[2]
-                save_version(ver_new)
-                apk_version(ver_new)
+                cur_ver = args[2]
+                apk_version(cur_ver)
+            save_version(cur_ver)
             update_version()
-        elif args[1] == "upload":
+        elif arg_1 == "upload":
             if len(args) > 2:
                 code = args[2]
                 apk_version(code)
-            build_package("android")
+            build_package("android pub")
             update_package()
-        elif args[1] == "help":
-            print("用法:\n\
-        没有参数直接执行打包脚本(tools/build.sh)\n\
-        all\t\t-- 生成一个新的版本号 用新的版本号打包 然后全部上传到服务器\n\
-        all [code]\t-- 把[code]作为版本号存入本地并应用到Cordova工程 打包 然后全部上传到服务器\n\
-        help\t\t-- 显示帮助文档\n\
-        ios\t\t-- Build IOS Cordova 工程\n\
-        upload\t\t-- 以当前版本号打包 只上传APP到服务器\n\
-        upload [code]\t-- 把[code]作为版本号打包APK 只上传APK到服务器\n\
-        var\t\t-- 显示当前远程版本号和本地版本号\n\
-        version\t\t-- 只把当前目录的版本文件上传到服务器(tools/version.json)\n\
-        version [code]\t-- 把[code]作为版本号存入本地并应用到Cordova工程 只上传版本文件到服务器\n\
-                ")
-        elif args[1] == "all":
-            cur_ver = remote_version()
+        elif arg_1 == "help":
+            help()
+        elif arg_1 == "all":
+            cur_ver = get_version()["version"]
             ver_new = new_version(cur_ver)
             if len(args) > 2:
                 ver_new = args[2]
-                apk_version(ver_new)
-                save_version(ver_new)
+            apk_version(ver_new)
+            save_version(ver_new)
+            build_package("android pub")
             update_package()
             update_version()
-        elif args[1] == "ios":
-            build_package("ios")
-        elif args[1] == "ver":
+        elif arg_1 == "ios":
+            if len(args) > 2:
+                apk_version(args[2])
+            build_package("ios pub")
+        elif arg_1 == "info":
             get_apk_version()
             get_version()
+        elif arg_1 == "android":
+            if len(args) > 2:
+                apk_version(args[2])
+            build_package("android pub")
+        elif arg_1 == "test":
+            test()
         else:
-            print("参数错误 请使用 help 检查可用的参数列表")
+            error()
     else:
-        build_package("android")
+        error()
 

+ 7 - 0
change.md

@@ -0,0 +1,7 @@
+
+
+#### 1.2.8
+- 修复安卓返回按钮不能关闭弹窗界面
+#### 1.2.7
+- 适配 iPhone 刘海屏
+- 修复 IOS 网络访问异常(修改为 IP 访问 HTTP)

+ 49 - 47
tools/build.sh

@@ -1,70 +1,72 @@
 #!/bin/bash
 
-buildResource() {
-if [ ! -d "cordova" ]; then
-  echo "current path is wrong! Please use tools/build.sh xxx to run!"
-  exit 1
+if [ -n "$2" ]; then
+  type="$2"
+else
+  type="development"
 fi
 
-# build resources
-echo "------- begin build vue project -------"
-npm run build
-echo "------- vue project build over  -------"
+buildResource() {
+  if [ ! -d "cordova" ]; then
+    echo "current path is wrong! Please use tools/build.sh xxx to run!"
+    exit 1
+  fi
+
+  # build resources
+  echo "------- begin build vue project MODE[$type] -------"
+  npm run build-"$type"
+  echo "------- vue project build over[$type]  -------"
 }
 
 enterCordova() {
-# enter cordova project
-cd cordova
-# del tem file
-rm -rf www/cordova.js
+  # enter cordova project
+  cd cordova
+  # del tem file
+  rm -rf www/cordova.js
 }
 
 buildAndroid() {
-echo "------- begin build android project -------"
-# build android package
-cordova build android --release -- --keystore="../config/release.keystore" --alias=tianwang --storePassword=wanbits --password=wanbits
-echo "------- android project build over  -------"
+  echo "------- begin build android project[$type] -------"
+  # build android package
+  cordova build android --release -- --keystore="../config/release.keystore" --alias=tianwang --storePassword=wanbits --password=wanbits
+  echo "------- android project build over[$type]  -------"
 }
 
 buildIOS() {
-echo "------- begin build ios project -------"
-# build ios package
-cordova build ios
-echo "------- ios project build over  -------"
+  echo "------- begin build ios project[$type] -------"
+  # build ios package
+  cordova build ios
+  echo "------- ios project build over[$type]  -------"
+}
+
+help() {
+  echo "use:
+    no params build android with dev
+    android [type]      -- build android [type: dev pub, default:dev]
+    help                -- show help info
+    ios [type]          -- build ios [type: dev pub, default:dev]"
+  exit
 }
 
 # build app
 if [ -n "$1" ]; then
-    if [ "$1" == "android" ]
-    then
-      buildResource
-      enterCordova
-      buildAndroid
-    elif [ "$1" == "ios" ]
-    then
-      buildResource
-      enterCordova
-      buildIOS
-    elif [ "$1" == "help" ]; then
-      echo "use:
-      no params build all
-      android     -- build android
-      help        -- show help info
-      ios         -- build ios"
-      exit
-    else
-      echo "use:
-      no params build all
-      android     -- build android
-      help        -- show help info
-      ios         -- build ios"
-      exit
-    fi
+  if [ "$1" == "android" ]; then
+    buildResource
+    enterCordova
+    buildAndroid
+  elif [ "$1" == "ios" ]; then
+    buildResource
+    enterCordova
+    buildIOS
+  elif [ "$1" == "help" ]; then
+    help
+  else
+    help
+  fi
 else
   buildResource
   enterCordova
   buildAndroid
-  buildIOS
 fi
 
-echo "-------      all    done        -------"
+echo "-------      all  [$type]  done        -------"

+ 6 - 5
tools/version.json

@@ -1,7 +1,8 @@
 {
-  "version": "1.2.1",
-  "iosVersion": "1.2.1",
-  "iosID": "1537411658",
-  "download": "http://qndownload.shotshock.shop/twong-1.2.1.apk",
-  "iosStore": "itms-apps://itunes.apple.com/us/app/apple-store/1537411658"
+    "iosID": "1537411658", 
+    "deVersion": "1.2.8", 
+    "update": "https://twongd.shotshock.shop/mobilex/download", 
+    "version": "1.2.8", 
+    "download": "http://qndownload.shotshock.shop/twong-1.2.8.apk", 
+    "iosStore": "itms-apps://itunes.apple.com/us/app/apple-store/1537411658"
 }