浏览代码

first commit

fogwind 2 年之前
当前提交
83cb2e189b
共有 8 个文件被更改,包括 298 次插入0 次删除
  1. 4 0
      .gitignore
  2. 55 0
      config.xml
  3. 47 0
      google-services.json
  4. 二进制
      icon/icon150x150.png
  5. 二进制
      image/loading.gif
  6. 二进制
      launch/launch1080x1920.png
  7. 188 0
      pages/main/main.stml
  8. 4 0
      res/manifest.xml

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+.apicloud
+.bin
+.yonstudio
+.svn

+ 55 - 0
config.xml

@@ -0,0 +1,55 @@
+<widget id="A6126216679500" version="0.0.2">
+
+	<name>WestKiss Hair</name>
+
+	<description>This APP is developed for the corresponding APP end of website (www.westkiss.com).</description>
+
+	<author email="service@westkiss.com" href="https://www.westkiss.com">westkiss</author>
+
+	<preference name="avm" value="true"/>
+
+	<preference name="android_abi" value="arm64-v8a"/>
+
+	<preference name="userAgent" value="APICloud"/>
+
+	<preference name="checkSslTrusted" value="false"/>
+
+	<preference name="appCertificateVerify" value="false"/>
+
+	<preference name="pageBounce" value="false"/>
+
+	<preference name="appBackground" value="rgba(0,0,0,0.0)"/>
+
+	<preference name="windowBackground" value="rgba(0,0,0,0.0)"/>
+
+	<preference name="frameBackgroundColor" value="rgba(0,0,0,0.0)"/>
+
+	<preference name="hScrollBarEnabled" value="false"/>
+
+	<preference name="vScrollBarEnabled" value="false"/>
+
+	<preference name="autoLaunch" value="true"/>
+
+	<preference name="fullScreen" value="false"/>
+
+	<preference name="autoUpdate" value="true"/>
+
+	<preference name="smartUpdate" value="false"/>
+
+	<preference name="debug" value="false"/>
+
+	<preference name="statusBarAppearance" value="false"/>
+
+	<content src="pages/main/main"/>
+
+	<access origin="*"/>
+
+	<permission name="readPhoneState"/>
+
+	<permission name="fileSystem"/>
+
+	<permission name="internet"/>
+
+	<meta-data name="com.google.android.gms.version" value="11020000"/>
+
+</widget>

+ 47 - 0
google-services.json

@@ -0,0 +1,47 @@
+{
+  "project_info": {
+    "project_number": "293909089298",
+    "project_id": "westkiss-app",
+    "storage_bucket": "westkiss-app.appspot.com"
+  },
+  "client": [
+    {
+      "client_info": {
+        "mobilesdk_app_id": "1:293909089298:android:a90ecc9e768117f7989ccb",
+        "android_client_info": {
+          "package_name": "com.westkiss.www"
+        }
+      },
+      "oauth_client": [
+        {
+          "client_id": "293909089298-fa0aa258fitca7imr0uh4odm3qtgrnvd.apps.googleusercontent.com",
+          "client_type": 1,
+          "android_info": {
+            "package_name": "com.westkiss.www",
+            "certificate_hash": "ecb9beaa20488c48890c1240e91761631fa039a3"
+          }
+        },
+        {
+          "client_id": "293909089298-qfkr8lkprfc260v8v275mkd56q39jka4.apps.googleusercontent.com",
+          "client_type": 3
+        }
+      ],
+      "api_key": [
+        {
+          "current_key": "AIzaSyC9qQ6qjljfwRob896dtChm-iqF2viCvbQ"
+        }
+      ],
+      "services": {
+        "appinvite_service": {
+          "other_platform_oauth_client": [
+            {
+              "client_id": "293909089298-qfkr8lkprfc260v8v275mkd56q39jka4.apps.googleusercontent.com",
+              "client_type": 3
+            }
+          ]
+        }
+      }
+    }
+  ],
+  "configuration_version": "1"
+}

二进制
icon/icon150x150.png


二进制
image/loading.gif


二进制
launch/launch1080x1920.png


+ 188 - 0
pages/main/main.stml

@@ -0,0 +1,188 @@
+<template>
+	<safe-area class="page">
+		<view class="body">
+			<img id='loading' class="img" src="../../image/loading.gif" />
+		</view>
+	</safe-area>
+</template>
+<script>
+export default {
+	name: 'main',
+	apiready() {
+		var that = this;
+
+        api.openFrame({
+			name: 'main',
+			url: 'https://m.westkiss.com',
+			rect: {
+				x: 0,
+				y: 0,
+				w: 'auto',
+				h: 'auto'
+			},
+			useWKWebView: true,
+			historyGestureEnabled: true,
+			bounces: false,
+			progress:{
+                type:'page'
+            }
+		});
+		api.setStatusBarStyle({
+			style: 'light'
+		});
+
+		api.setFrameClient({
+		    frameName:'main'
+		},function(ret){
+		    that.onBrowserStateChange(ret);
+		});
+		this.removeLogic();
+        api.addEventListener({
+            name: 'keyback'
+        }, function(ret, err){
+            api.historyBack({
+                frameName:'main'
+            },function(ret,err){
+                if(!ret.status){
+                    api.closeWidget();
+                }
+            });
+        });
+		this.removeLogic();
+
+		this.googlePushInit();
+	},
+	data() {
+		return {
+			msg: "Hello APICloud",
+			launchRemoved: false,
+			loadingRemoved: false,
+		};
+	},
+	methods: {
+
+		onBrowserStateChange(ret){
+			if(0 == ret.state){//开始加载
+				if(!this.launchRemoved){
+					this.launchRemoved = true;
+					this.removeLaunch();
+				}
+			}
+			if(2 == ret.state){
+				if(!this.loadingRemoved){
+					this.loadingRemoved = true;
+					document.getElementById('loading').style.display = 'none';
+				}
+			}
+		},
+		
+		removeLogic(){
+			var that = this;
+			setTimeout(function(){
+				if(!that.launchRemoved){
+					that.launchRemoved = true;
+					that.removeLaunch();
+				}
+			}, 3000);
+		},
+
+		removeLaunch(){
+			// 移除启动图
+			api.removeLaunchView({
+				animation:{
+					type:"fade",
+					subType:"from_right",
+					duration:300
+				}
+			});
+		},
+		// google推送
+		googlePushInit() {
+			var googlePush = api.require('googlePush'); 
+			// 初始化 
+			googlePush.initFcm(function(ret, err) {
+				console.log('---initFcm satrt---');
+				console.log(JSON.stringify(ret));
+				console.log(JSON.stringify(err));
+				console.log('---initFcm end---');
+				// 获取token
+				googlePush.registerToken(function(ret, err){
+					console.log('---registerToken satrt---');
+					console.log(JSON.stringify(ret));
+					console.log(JSON.stringify(err));
+					console.log('---registerToken end---');
+				});
+				// 收到消息时会触发
+				googlePush.addOnMessageLisener(function(ret){
+					console.log('---addOnMessageLisener satrt---');
+					console.log(JSON.stringify(ret));
+					console.log('---addOnMessageLisener end---');
+				});
+			});
+			// 监听通知栏消息被点击
+			api.addEventListener({
+				name:'appintent'
+			},function(ret,err){
+				console.log('---appintent satrt---');
+				/*
+                {
+					"iosUrl":"",
+					"sourceAppId":"com.westkiss.m",
+					"appParam":{
+						"android.intent.extra.REFERRER":"com.westkiss.m",
+						"google.delivered_priority":"high",
+						"google.sent_time":1672015802071,
+						"google.ttl":604800,
+						"google.original_priority":"high",
+						"title ":"02 test",
+						"url":"https://m.westkiss.com/return_policy",
+						"from":"506304076475",
+						"google.message_id":"0:1672015802081797%3781dfb93781dfb9",
+						"content":"this is test 002",
+						"collapse_key":"com.westkiss.m"
+					}
+				}
+				*/
+				console.log(JSON.stringify(ret));
+				console.log(JSON.stringify(err));
+				console.log('---appintent end---');
+				var appParam = ret.appParam;
+				if(api.systemType == 'ios'){
+					var iosUrl = ret.iosUrl;
+				} else {
+					var sourceAppId = ret.sourceAppId;
+					console.log(JSON.stringify(appParam));
+					if(appParam.url) {
+						api.openWin({
+							name: 'WestKiss Sale',
+							url: appParam.url,
+							pageParam: {
+								name: 'test'
+							}
+						});
+					}
+				}
+			});
+		}
+	}
+};
+</script>
+<style>
+.page {
+	width: 100%;
+	height: 100%;
+	background: #fff;
+	display:flex;
+	justify-content:center;
+	align-items: center;
+}
+.body{
+	position: relative;
+}
+.img{
+    display:block;
+	width: 40px;
+	height: 40px;
+}
+
+</style>

+ 4 - 0
res/manifest.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest>
+    <application name="targetSdkVersion" value="31"/>
+</manifest>