Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
086a5fd1fa |
@ -13,7 +13,7 @@
|
|||||||
"h5" : {
|
"h5" : {
|
||||||
"launchtype" : "local"
|
"launchtype" : "local"
|
||||||
},
|
},
|
||||||
"provider" : "aliyun",
|
"provider" : "alipay",
|
||||||
"type" : "uniCloud"
|
"type" : "uniCloud"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
153
App.vue
@ -1,78 +1,87 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import silenceUpdate from '@/uni_modules/rt-uni-update/js_sdk/silence-update.js' //引入静默更新
|
||||||
|
import config from './config';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
methods: {
|
||||||
return {
|
networkStatusChange(res) {
|
||||||
// 上一次网络状态
|
if (res.isConnected) {
|
||||||
lastNetworkStatus: null
|
uni.redirectTo({
|
||||||
}
|
url: "/pages/index/index",
|
||||||
},
|
});
|
||||||
methods: {
|
} else {
|
||||||
// 判断是否是第一次安装APP并且打开
|
uni.redirectTo({
|
||||||
isFirstOpen() {
|
url: "/pages/networko/index",
|
||||||
let isFirstOpen = uni.getStorageSync('isFirstOpen')
|
});
|
||||||
if (!isFirstOpen) {
|
}
|
||||||
uni.setStorageSync('isFirstOpen', true)
|
},
|
||||||
return true
|
// 获取本地应用资源版本号
|
||||||
}
|
getLocalVersion() {
|
||||||
return false
|
return new Promise((resolve, reject) => {
|
||||||
},
|
plus.runtime.getProperty(plus.runtime.appid, function (widgetInfo) {
|
||||||
networkStatusChange(res) {
|
resolve(widgetInfo);
|
||||||
console.log(res)
|
});
|
||||||
if (res.isConnected) {
|
});
|
||||||
// 如果是第一次安装进入,并且网络状态为有网络,则跳转到主页
|
},
|
||||||
if (this.isFirstOpen()) {
|
// 获取服务端应用资源版本号
|
||||||
uni.redirectTo({
|
getServerVersion(widgetInfo) {
|
||||||
url: '/pages/index/index'
|
return new Promise((resolve, reject) => {
|
||||||
})
|
uni.request({
|
||||||
}
|
url: config.apiBaseUrl + "/version-info",
|
||||||
// 如果上一次网络状态为无网络,且当前网络状态为有网络,则跳转到首页
|
method:'POST',
|
||||||
if (this.lastNetworkStatus === false) {
|
data:{
|
||||||
uni.showModal({
|
edition_type:widgetInfo.appid,
|
||||||
title: "提示",
|
version_type:uni.getSystemInfoSync().platform,
|
||||||
content: "当前设备网络发生更改,是否刷新页面?",
|
edition_number:Number(widgetInfo.versionCode)
|
||||||
showCancel: true,
|
},
|
||||||
success: function (res) {
|
success: (res) => {
|
||||||
if (res.confirm || res.cancel) {
|
console.log("res4", res.data.data);
|
||||||
uni.redirectTo({
|
resolve(res.data.data);
|
||||||
url: '/pages/index/index'
|
},
|
||||||
})
|
});
|
||||||
}
|
});
|
||||||
},
|
},
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
// 检测更新
|
||||||
uni.redirectTo({
|
checkUpdate() {
|
||||||
url: '/pages/networko/index'
|
// 检测更新
|
||||||
})
|
this.getLocalVersion().then((widgetInfo) => {
|
||||||
}
|
console.log("本地信息", widgetInfo);
|
||||||
this.lastNetworkStatus = res.isConnected
|
console.log("config", config);
|
||||||
|
this.getServerVersion(widgetInfo).then((serverVersionData) => {
|
||||||
}
|
if (Number(widgetInfo.versionCode) !== serverVersionData.edition_number) {
|
||||||
},
|
uni.navigateTo({
|
||||||
onLaunch: function () {
|
url:
|
||||||
console.log('onLaunch')
|
"/uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update?obj=" +
|
||||||
|
JSON.stringify(serverVersionData),
|
||||||
},
|
});
|
||||||
onShow: function () {
|
}
|
||||||
uni.onNetworkStatusChange(this.networkStatusChange);
|
});
|
||||||
uni.getNetworkType({
|
});
|
||||||
success: (res) => {
|
},
|
||||||
if (res.networkType === 'none') {
|
},
|
||||||
uni.redirectTo({
|
onLaunch: function () {},
|
||||||
url: '/pages/networko/index'
|
onShow: function () {
|
||||||
})
|
console.log("App 1onShow");
|
||||||
|
this.checkUpdate();
|
||||||
}
|
// silenceUpdate('555')
|
||||||
}
|
// uni.navigateTo({
|
||||||
})
|
// url: "./uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update",
|
||||||
|
// });
|
||||||
},
|
uni.getNetworkType({
|
||||||
onHide: function () {
|
success: (res) => {
|
||||||
uni.offNetworkStatusChange(this.networkStatusChange)
|
if (res.networkType === "none") {
|
||||||
}
|
uni.redirectTo({
|
||||||
}
|
url: "/pages/networko/index",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
uni.onNetworkStatusChange(this.networkStatusChange);
|
||||||
|
},
|
||||||
|
onHide: function () {
|
||||||
|
uni.offNetworkStatusChange(this.networkStatusChange);
|
||||||
|
},
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"version" : "1",
|
"version" : "1",
|
||||||
"prompt" : "template",
|
"prompt" : "template",
|
||||||
"title" : "温馨提示",
|
"title" : "服务协议和隐私政策",
|
||||||
"message" : " 感谢您对oa考勤系统的信赖!在使用前请务必阅读并同意<a href=\"https://oa-a.szjixun.cn/#/pages/setting/severInfo\">《用户服务协议》</a>和<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>,我们将按照协议和政策内容为您提供服务。<br/>oa考勤系统系统的基本功能为打卡、审批等考勤管理及协同办公服务。基于您的授权及服务之必要,基本功能的必要个人信息包括移动电话号码、账号信息等。您同意<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>仅代表同意oa考勤系统在您使用基本功能时处理相关必要信息。附加功能如需处理个人信息,将单独征求您的同意。",
|
"message" : " 请你务必审慎阅读、充分理解“平台服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href=\"https://oa.szjixun.cn/#/pages/login/serveInfo\">《用户服务协议》</a>和<a href=\"https://oa.szjixun.cn/#/pages/login/privateInfo\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
|
||||||
"buttonAccept" : "同意并接受",
|
"buttonAccept" : "同意并接受",
|
||||||
"buttonRefuse" : "不同意",
|
"buttonRefuse" : "不同意",
|
||||||
"second" : {
|
"second" : {
|
||||||
"title" : " 您需要同意本隐私政策才能继续使用oa考勤系统",
|
"title" : "确认提示",
|
||||||
"message" : " 若您不同意本<a href=\"https://oa-a.szjixun.cn/#/pages/setting/privateInfo\">《隐私政策》</a>,很遗憾我们将无法为您提供服务",
|
"message" : " 进入应用前,你需先同意<a href=\"https://oa.szjixun.cn/#/pages/login/serveInfo\">《用户服务协议》</a>和<a href=\"https://oa.szjixun.cn/#/pages/login/privateInfo\">《隐私政策》</a>,否则将退出应用。",
|
||||||
"buttonAccept" : "同意并继续",
|
"buttonAccept" : "同意并继续",
|
||||||
"buttonRefuse" : "退出应用"
|
"buttonRefuse" : "退出应用"
|
||||||
},
|
},
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
const env = 'prod';
|
const env = 'test';
|
||||||
const configs = {
|
const configs = {
|
||||||
LocalTest: {
|
LocalTest: {
|
||||||
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
||||||
h5Url: 'http://192.168.88.61:2367/#/'
|
h5Url:'http://192.168.88.51:8080/#/'
|
||||||
},
|
},
|
||||||
dev: {
|
dev: {
|
||||||
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
||||||
h5Url: 'http://192.168.88.47:2367/#/'
|
h5Url:'https://192.168.88.27:8080/#/'
|
||||||
},
|
},
|
||||||
test: {
|
test: {
|
||||||
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
apiBaseUrl: 'https://warehouse.szjixun.cn/oa_backend',
|
||||||
h5Url: 'http://114.218.158.24:8042/#/'
|
h5Url:'https://192.168.88.29:8080/#/'
|
||||||
},
|
},
|
||||||
prod: {
|
prod: {
|
||||||
apiBaseUrl: 'https://oa-a.szjixun.cn/api',
|
apiBaseUrl: 'https://oa-a.szjixun.cn/api',
|
||||||
h5Url: 'https://oa-a.szjixun.cn/#/'
|
h5Url:'https://oa-a.szjixun.cn/#/'
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const config = configs[env];
|
const config = configs[env];
|
||||||
|
@ -33,12 +33,12 @@
|
|||||||
<rect key="frame" x="150.66666666666666" y="391.66666666666669" width="112.66666666666666" height="112.66666666666669"/>
|
<rect key="frame" x="150.66666666666666" y="391.66666666666669" width="112.66666666666666" height="112.66666666666669"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
</imageView>
|
</imageView>
|
||||||
<!-- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="hello uniapp" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QBH-Ne-rcx">
|
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="hello uniapp" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QBH-Ne-rcx">
|
||||||
<rect key="frame" x="168" y="835" width="78.333333333333314" height="17"/>
|
<rect key="frame" x="168" y="835" width="78.333333333333314" height="17"/>
|
||||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||||
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<nil key="highlightedColor"/>
|
<nil key="highlightedColor"/>
|
||||||
</label> -->
|
</label>
|
||||||
</subviews>
|
</subviews>
|
||||||
<viewLayoutGuide key="safeArea" id="IW3-oA-Ytg"/>
|
<viewLayoutGuide key="safeArea" id="IW3-oA-Ytg"/>
|
||||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||||
|
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 732 KiB |
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 732 KiB |
@ -1,3 +1,3 @@
|
|||||||
Android 包名 : uni.UNI70C49A3
|
Android 包名 : uni.UNI4796942
|
||||||
证书别名:oaapp
|
证书别名:oaapp
|
||||||
密钥密码:12345678
|
密钥密码:12345678
|
||||||
|
BIN
files/icon.png
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 8.0 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 19 KiB |
@ -1,5 +1 @@
|
|||||||
Android 包名 : uni.UNI70C49A3
|
|
||||||
证书别名:oaapp
|
|
||||||
密钥密码:12345678
|
|
||||||
Bundle ID:com.fonchain.attendance
|
|
||||||
IOS:私钥证书密码 dis dev 都是 12345678
|
|
||||||
|
1
main.js
@ -3,6 +3,7 @@ import App from './App'
|
|||||||
// #ifndef VUE3
|
// #ifndef VUE3
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import './uni.promisify.adaptor'
|
import './uni.promisify.adaptor'
|
||||||
|
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
App.mpType = 'app'
|
App.mpType = 'app'
|
||||||
const app = new Vue({
|
const app = new Vue({
|
||||||
|
@ -2,14 +2,11 @@
|
|||||||
"name" : "oa考勤系统",
|
"name" : "oa考勤系统",
|
||||||
"appid" : "__UNI__4796942",
|
"appid" : "__UNI__4796942",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "2.3.2",
|
"versionName" : "2.1.4",
|
||||||
"versionCode" : 232,
|
"versionCode" : 214,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"compatible" : {
|
|
||||||
"ignoreVersion" : true //true表示忽略版本检查提示框,HBuilderX1.9.0及以上版本支持
|
|
||||||
},
|
|
||||||
"usingComponents" : true,
|
"usingComponents" : true,
|
||||||
"nvueStyleCompiler" : "uni-app",
|
"nvueStyleCompiler" : "uni-app",
|
||||||
"compilerVersion" : 3,
|
"compilerVersion" : 3,
|
||||||
@ -24,10 +21,7 @@
|
|||||||
"Camera" : {},
|
"Camera" : {},
|
||||||
"Geolocation" : {},
|
"Geolocation" : {},
|
||||||
"Maps" : {},
|
"Maps" : {},
|
||||||
"LivePusher" : {},
|
"LivePusher" : {}
|
||||||
"Push" : {},
|
|
||||||
"Barcode" : {},
|
|
||||||
"Share" : {}
|
|
||||||
},
|
},
|
||||||
/* 应用发布信息 */
|
/* 应用发布信息 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
@ -38,11 +32,13 @@
|
|||||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
@ -52,8 +48,7 @@
|
|||||||
],
|
],
|
||||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
|
"abiFilters" : [ "armeabi-v7a", "arm64-v8a" ],
|
||||||
"autoSdkPermissions" : false,
|
"autoSdkPermissions" : false,
|
||||||
"targetSdkVersion" : 34,
|
"targetSdkVersion" : 34
|
||||||
"minSdkVersion" : 21
|
|
||||||
},
|
},
|
||||||
/* ios打包配置 */
|
/* ios打包配置 */
|
||||||
"ios" : {
|
"ios" : {
|
||||||
@ -70,36 +65,32 @@
|
|||||||
"geolocation" : {
|
"geolocation" : {
|
||||||
"system" : {
|
"system" : {
|
||||||
"__platform__" : [ "ios", "android" ]
|
"__platform__" : [ "ios", "android" ]
|
||||||
|
},
|
||||||
|
"baidu" : {
|
||||||
|
"__platform__" : [ "ios", "android" ],
|
||||||
|
"appkey_ios" : "5zzMAq3ofL5H5KfxRcf0zDMLTimvGIb0",
|
||||||
|
"appkey_android" : "ahdcPcBfatf61zRAgNl9SpBGUEURsnXN"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ad" : {},
|
"ad" : {},
|
||||||
"share" : {
|
"share" : {
|
||||||
"weixin" : {
|
"weixin" : {
|
||||||
"appid" : "wx3a0f78634d074b23",
|
"appid" : "",
|
||||||
"UniversalLinks" : "https://warehouse.szjixun.cn/oa_backend/static/aretree/"
|
"UniversalLinks" : ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"push" : {
|
"push" : {
|
||||||
"unipush" : {
|
"unipush" : {
|
||||||
"offline" : true,
|
|
||||||
"oppo" : {},
|
|
||||||
"vivo" : {},
|
|
||||||
"mi" : {},
|
|
||||||
"honor" : {},
|
|
||||||
"version" : "2",
|
"version" : "2",
|
||||||
"icons" : {
|
"offline" : true
|
||||||
"small" : {
|
|
||||||
"ldpi" : "unpackage/pushicon/18.png",
|
|
||||||
"mdpi" : "unpackage/pushicon/24.png",
|
|
||||||
"hdpi" : "unpackage/pushicon/36.png",
|
|
||||||
"xhdpi" : "unpackage/pushicon/48.png",
|
|
||||||
"xxhdpi" : "unpackage/pushicon/72.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"meizu" : {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"maps" : {}
|
"maps" : {
|
||||||
|
"baidu" : {
|
||||||
|
"appkey_ios" : "5zzMAq3ofL5H5KfxRcf0zDMLTimvGIb0",
|
||||||
|
"appkey_android" : "ahdcPcBfatf61zRAgNl9SpBGUEURsnXN"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"icons" : {
|
"icons" : {
|
||||||
"android" : {
|
"android" : {
|
||||||
@ -135,13 +126,13 @@
|
|||||||
},
|
},
|
||||||
"splashscreen" : {
|
"splashscreen" : {
|
||||||
"useOriginalMsgbox" : true,
|
"useOriginalMsgbox" : true,
|
||||||
"androidStyle" : "default",
|
"androidStyle" : "common",
|
||||||
"android" : {
|
"android" : {
|
||||||
"hdpi" : "static/image/drawable-hdpi/sy.9.png",
|
"hdpi" : "static/image/sy.png",
|
||||||
"xhdpi" : "static/image/drawable-xhdpi/sy.9.png",
|
"xhdpi" : "static/image/sy.png",
|
||||||
"xxhdpi" : "static/image/drawable-xxhdpi/sy.9.png"
|
"xxhdpi" : "static/image/sy.png"
|
||||||
},
|
},
|
||||||
"iosStyle" : "storyboard",
|
"iosStyle" : "common",
|
||||||
"ios" : {
|
"ios" : {
|
||||||
"storyboard" : "files/CustomStoryboard.zip"
|
"storyboard" : "files/CustomStoryboard.zip"
|
||||||
}
|
}
|
||||||
|
1
package.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
64
pages.json
@ -1,28 +1,42 @@
|
|||||||
{
|
{
|
||||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
"pages": [
|
||||||
{
|
//pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||||
"path": "pages/index/index",
|
{
|
||||||
"style": {
|
"path": "pages/index/index",
|
||||||
"navigationBarTitleText": "uni-app",
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationBarTitleText": "uni-app",
|
||||||
}
|
"navigationStyle": "custom"
|
||||||
},
|
}
|
||||||
{
|
},
|
||||||
"path" : "pages/networko/index",
|
{
|
||||||
"style" :
|
"path": "pages/networko/index",
|
||||||
{
|
"style": {
|
||||||
"navigationBarTitleText": "uni-app",
|
"navigationBarTitleText": "uni-app",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
{
|
||||||
],
|
"path": "uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update",
|
||||||
"globalStyle": {
|
"style": {
|
||||||
"navigationBarTextStyle": "black",
|
"app-plus": {
|
||||||
"navigationBarTitleText": "uni-app",
|
"animationDuration": 200,
|
||||||
"navigationBarBackgroundColor": "#F8F8F8",
|
"animationType": "fade-in",
|
||||||
"backgroundColor": "#F8F8F8"
|
"background": "transparent",
|
||||||
},
|
"backgroundColorTop": "transparent",
|
||||||
"uniIdRouter": {}
|
"popGesture": "none",
|
||||||
|
"scrollIndicator": false,
|
||||||
|
"titleNView": false
|
||||||
|
},
|
||||||
|
"disableScroll": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"globalStyle": {
|
||||||
|
"navigationBarTextStyle": "black",
|
||||||
|
"navigationBarTitleText": "uni-app",
|
||||||
|
"navigationBarBackgroundColor": "#F8F8F8",
|
||||||
|
"backgroundColor": "#F8F8F8"
|
||||||
|
},
|
||||||
|
"uniIdRouter": {}
|
||||||
}
|
}
|
||||||
|
@ -1,173 +1,90 @@
|
|||||||
<template>
|
<template>
|
||||||
<web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
|
<web-view class="webview" @message="webLoad" style="flex: 1;" :src="config.h5Url"></web-view>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onExit, onShow } from "@dcloudio/uni-app";
|
import config from "../../config";
|
||||||
import config from "../../config"
|
import {onExit } from "@dcloudio/uni-app";
|
||||||
onShow(() => {
|
|
||||||
// const { statusBarHeight } = uni.getSystemInfoSync()
|
|
||||||
// const wv1 = plus.webview.getWebviewById("custom-webview");
|
|
||||||
// let wv = null;
|
|
||||||
// if (wv1) {
|
|
||||||
// wv = wv1;
|
|
||||||
// } else {
|
|
||||||
// wv = plus.webview.create(config.h5Url, "custom-webview", {
|
|
||||||
// top: statusBarHeight,
|
|
||||||
// bottom: 0,
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// var pages = getCurrentPages();
|
|
||||||
// var page = pages[pages.length - 1];
|
|
||||||
// var currentWebview = page.$getAppWebview();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
import { Communication } from '../../utils/communication.js';
|
import { Communication } from '../../utils/communication.js';
|
||||||
const commun = new Communication()
|
const commun=new Communication()
|
||||||
const shareH5 = () => {
|
|
||||||
uni.share({
|
|
||||||
provider: 'weixin',
|
|
||||||
scene: "WXSceneSession",
|
|
||||||
type: 0,// 5代表分享为小程序
|
|
||||||
imageUrl: 'https://th.bing.com/th?id=ORMS.41c34644e7e67f95a14620e77064b5d9&pid=Wdp&w=268&h=140&qlt=90&c=1&rs=1&dpr=1&p=0', // 必填
|
|
||||||
title: '分享的标题',
|
|
||||||
href: 'https://www.baidu.com/',
|
|
||||||
success: function (res) {
|
|
||||||
console.log("success:" + JSON.stringify(res));
|
|
||||||
},
|
|
||||||
fail: function (err) {
|
|
||||||
console.log("fail:" + JSON.stringify(err));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//#ifdef APP-ANDROID
|
|
||||||
import {
|
|
||||||
registerRequestPermissionTipsListener,
|
|
||||||
unregisterRequestPermissionTipsListener,
|
|
||||||
setRequestPermissionTips
|
|
||||||
} from "@/uni_modules/uni-registerRequestPermissionTips"
|
|
||||||
|
|
||||||
const PermissionTips = {
|
// import {
|
||||||
"android.permission.READ_PHONE_STATE": "<h4 style=\"font-size:40px;\">正在读取网络状态权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意</font>",
|
// registerRequestPermissionTipsListener,
|
||||||
"android.permission.CAMERA": "<h4 style=\"font-size:40px;\">正在访问相机权限</h4><font color=#cccccc>需要扫描二维码或拍照,是否允许打开相机?</font>",
|
// unregisterRequestPermissionTipsListener,
|
||||||
"android.permission.WRITE_EXTERNAL_STORAGE": "<h4 style=\"font-size:40px;\">正在读取相册权限</h4><font color=#cccccc>我们需要获取访问您设备相册的权限,以便您能够选择并上传图片或视频到我们的应用中。</font>",
|
// setRequestPermissionTips
|
||||||
"android.permission.ACCESS_FINE_LOCATION": "<h4 style=\"font-size:40px;\">正在访问位置权限</h4><font color=#cccccc>需要获取您的位置信息,以便您能够进行考勤打卡。</font>",
|
// } from "@/uni_modules/uni-registerRequestPermissionTips"
|
||||||
"android.permission.ACCESS_COARSE_LOCATION": "<h4 style=\"font-size:40px;\">正在访问位置权限</h4><font color=#cccccc>需要获取您的位置信息,以便您能够进行考勤打卡。</font>"
|
|
||||||
}
|
|
||||||
onExit(() => {
|
|
||||||
unregisterRequestPermissionTipsListener()
|
|
||||||
})
|
|
||||||
|
|
||||||
const brand = uni.getSystemInfoSync().deviceBrand
|
// const PermissionTips = {
|
||||||
setRequestPermissionTips(PermissionTips)
|
// "android.permission.CAMERA": "<h4 style=\"font-size:40px;\">正在读取通讯录权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意</font>",
|
||||||
registerRequestPermissionTipsListener({
|
// "android.permission.READ_PHONE_STATE": "<h4 style=\"font-size:40px;\">正在读取网络状态权限</h4><font color=#cccccc>通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意通讯录权限不会获取任何信息,请注意</font>"
|
||||||
onRequest: (e) => {
|
// }
|
||||||
console.log('onRequest', e)
|
// onExit(()=>{
|
||||||
},
|
// unregisterRequestPermissionTipsListener()
|
||||||
onConfirm: (e) => {
|
// })
|
||||||
// commun.sendToH5('permission-application', { action: 'open-permission', data: e });
|
|
||||||
},
|
|
||||||
onComplete: (e) => {
|
|
||||||
commun.sendToH5('permission-application', { action: 'close-permission', data: e });
|
|
||||||
|
|
||||||
// 华为手机在权限禁止之后,再次申请权限不会出现权限申请框。此时应该引导用户去系统设置开启此权限,不应该频繁申请。
|
// const brand = uni.getSystemInfoSync().deviceBrand
|
||||||
if (brand.toLowerCase() === "huawei") {
|
// setRequestPermissionTips(PermissionTips)
|
||||||
const tips = {}
|
// registerRequestPermissionTipsListener({
|
||||||
let hasDeniedPermission = false
|
// onRequest: (e) => {
|
||||||
for (let k in PermissionTips) {
|
// console.log('onRequest',e)
|
||||||
if (e[k] !== "denied") {
|
// },
|
||||||
tips[k] = PermissionTips[k]
|
// onConfirm: (e) => {
|
||||||
} else {
|
// commun.sendToH5('permission-application',{action:'open-permission',data:e});
|
||||||
hasDeniedPermission = true
|
// },
|
||||||
}
|
// onComplete: (e) => {
|
||||||
}
|
// commun.sendToH5('permission-application',{action:'close-permission',data:e});
|
||||||
setRequestPermissionTips(tips) // 更新弹框提醒,防止华为手机不出现权限申请框时权限提醒框闪烁的情况
|
|
||||||
if (hasDeniedPermission)
|
// // 华为手机在权限禁止之后,再次申请权限不会出现权限申请框。此时应该引导用户去系统设置开启此权限,不应该频繁申请。
|
||||||
uni.showModal({
|
// if (brand.toLowerCase() === "huawei") {
|
||||||
content: "权限已经被拒绝,请前往设置中开启"
|
// const tips = {}
|
||||||
})
|
// let hasDeniedPermission = false
|
||||||
}
|
// for (let k in PermissionTips) {
|
||||||
}
|
// if (e[k] !== "denied") {
|
||||||
})
|
// tips[k] = PermissionTips[k]
|
||||||
//#endif
|
// } else {
|
||||||
const webLoad = (e) => {
|
// hasDeniedPermission = true
|
||||||
const message = e.detail.data?.[0] || '';
|
// }
|
||||||
commun.handleMessage(message);
|
// }
|
||||||
};
|
// setRequestPermissionTips(tips) // 更新弹框提醒,防止华为手机不出现权限申请框时权限提醒框闪烁的情况
|
||||||
|
// if (hasDeniedPermission)
|
||||||
|
// uni.showModal({
|
||||||
|
// content: "权限已经被拒绝,请前往设置中开启"
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
function initializeWebView() {
|
function initializeWebView() {
|
||||||
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
const currentWebview = getCurrentPages().pop().$getAppWebview()
|
||||||
commun.setWebView(currentWebview.children()[0])
|
commun.setWebView(currentWebview.children()[0])
|
||||||
}
|
}
|
||||||
//load-complete 注册函数
|
//load-complete 注册函数
|
||||||
commun.registerHandler('load-complete', () => {
|
commun.registerHandler('load-complete',()=>{
|
||||||
|
|
||||||
initializeWebView()
|
initializeWebView()
|
||||||
const { statusBarHeight } = uni.getSystemInfoSync()
|
const {statusBarHeight} = uni.getSystemInfoSync()
|
||||||
commun.webViewObj.setStyle({
|
commun.webViewObj.setStyle({
|
||||||
top: statusBarHeight,
|
top: statusBarHeight,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
commun.registerHandler('getLocation',(data)=>{
|
||||||
commun.registerHandler('getLocation', (data) => {
|
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'gcj02',
|
type:'gcj02',
|
||||||
geocode: true,
|
geocode:true,
|
||||||
isHighAccuracy: true,
|
isHighAccuracy:true,
|
||||||
...data,
|
...data,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
console.log('getLocation', res)
|
console.log('getLocation',res)
|
||||||
commun.sendToH5('getLocation', res);
|
commun.sendToH5('getLocation',res);
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
commun.registerHandler('goCard', async (data) => {
|
const webLoad = (e) => {
|
||||||
await getCard(data.phone)
|
const message = e.detail.data?.[0] || '';
|
||||||
})
|
commun.handleMessage(message);
|
||||||
|
};
|
||||||
commun.registerHandler('createPushMessage', async (data) => {
|
|
||||||
uni.createPushMessage(JSON.parse(decodeURIComponent(data)))
|
|
||||||
})
|
|
||||||
|
|
||||||
// 获取电子名片
|
|
||||||
async function getCard(phone) {
|
|
||||||
uni.request({
|
|
||||||
url: 'https://blockchain.szjixun.cn/api/e_card/info-phone',
|
|
||||||
method: 'POST',
|
|
||||||
data: {
|
|
||||||
phone: phone
|
|
||||||
},
|
|
||||||
success: (res) => {
|
|
||||||
const resData = res.data.data
|
|
||||||
uni.share({
|
|
||||||
provider: 'weixin',
|
|
||||||
scene: "WXSceneSession",
|
|
||||||
type: 5,// 5代表分享为小程序
|
|
||||||
imageUrl: 'https://e-cdn.fontree.cn/fonchain-main/prod/image/139/avatar/ababc42c-7654-47f8-b22b-29dc589c71f0.png', // 必填
|
|
||||||
title: `${resData.name}的电子名片`,
|
|
||||||
miniProgram: {
|
|
||||||
id: "gh_97094c34debd",
|
|
||||||
path: `/pages/mine/index?uid=${resData.uid}&userType=${resData.userType}`,
|
|
||||||
type: 0,
|
|
||||||
webUrl: `/pages/mine/index?uid=${resData.uid}&userType=${resData.userType}`,
|
|
||||||
},
|
|
||||||
success: function (res) {
|
|
||||||
console.log("success:" + JSON.stringify(res));
|
|
||||||
},
|
|
||||||
fail: function (err) {
|
|
||||||
console.log("fail:" + JSON.stringify(err));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
console.log('getCard', err)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
Before Width: | Height: | Size: 175 KiB |
Before Width: | Height: | Size: 227 KiB |
Before Width: | Height: | Size: 525 KiB |
Before Width: | Height: | Size: 226 KiB After Width: | Height: | Size: 732 KiB |
@ -1,14 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"IndexName": "index_device_id",
|
|
||||||
"MgoKeySchema": {
|
|
||||||
"MgoIndexKeys": [
|
|
||||||
{
|
|
||||||
"Name": "device_id",
|
|
||||||
"Direction": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"MgoIsUnique": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
@ -1,142 +0,0 @@
|
|||||||
{
|
|
||||||
"bsonType": "object",
|
|
||||||
"required": [],
|
|
||||||
"permission": {
|
|
||||||
"read": false,
|
|
||||||
"create": false,
|
|
||||||
"update": false,
|
|
||||||
"delete": false
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"_id": {
|
|
||||||
"description": "ID,系统自动生成"
|
|
||||||
},
|
|
||||||
"appid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "DCloud appid"
|
|
||||||
},
|
|
||||||
"device_id": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备唯一标识"
|
|
||||||
},
|
|
||||||
"vendor": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备厂商"
|
|
||||||
},
|
|
||||||
"push_clientid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "推送设备客户端标识"
|
|
||||||
},
|
|
||||||
"imei": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "国际移动设备识别码IMEI(International Mobile Equipment Identity)"
|
|
||||||
},
|
|
||||||
"oaid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "移动智能设备标识公共服务平台提供的匿名设备标识符(OAID)"
|
|
||||||
},
|
|
||||||
"idfa": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "iOS平台配置应用使用广告标识(IDFA)"
|
|
||||||
},
|
|
||||||
"imsi": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "国际移动用户识别码(International Mobile Subscriber Identification Number)"
|
|
||||||
},
|
|
||||||
"model": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备型号"
|
|
||||||
},
|
|
||||||
"platform": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "平台类型"
|
|
||||||
},
|
|
||||||
"uni_platform": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "uni-app 运行平台,与条件编译平台相同。"
|
|
||||||
},
|
|
||||||
"os_name": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "ios|android|windows|mac|linux "
|
|
||||||
},
|
|
||||||
"os_version": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统版本号 "
|
|
||||||
},
|
|
||||||
"os_language": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统语言 "
|
|
||||||
},
|
|
||||||
"os_theme": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统主题 light|dark"
|
|
||||||
},
|
|
||||||
"pixel_ratio": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备像素比 "
|
|
||||||
},
|
|
||||||
"network_model": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备网络型号wifi/3G/4G/"
|
|
||||||
},
|
|
||||||
"window_width": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备窗口宽度 "
|
|
||||||
},
|
|
||||||
"window_height": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备窗口高度"
|
|
||||||
},
|
|
||||||
"screen_width": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备屏幕宽度"
|
|
||||||
},
|
|
||||||
"screen_height": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备屏幕高度"
|
|
||||||
},
|
|
||||||
"rom_name": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "rom 名称"
|
|
||||||
},
|
|
||||||
"rom_version": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "rom 版本"
|
|
||||||
},
|
|
||||||
"location_latitude": {
|
|
||||||
"bsonType": "double",
|
|
||||||
"description": "纬度"
|
|
||||||
},
|
|
||||||
"location_longitude": {
|
|
||||||
"bsonType": "double",
|
|
||||||
"description": "经度"
|
|
||||||
},
|
|
||||||
"location_country": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "国家"
|
|
||||||
},
|
|
||||||
"location_province": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "省份"
|
|
||||||
},
|
|
||||||
"location_city": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "城市"
|
|
||||||
},
|
|
||||||
"create_date": {
|
|
||||||
"bsonType": "timestamp",
|
|
||||||
"description": "创建时间",
|
|
||||||
"forceDefaultValue": {
|
|
||||||
"$env": "now"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"last_update_date": {
|
|
||||||
"bsonType": "timestamp",
|
|
||||||
"description": "最后一次修改时间",
|
|
||||||
"forceDefaultValue": {
|
|
||||||
"$env": "now"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"version": "0.0.1"
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"bsonType": "object",
|
|
||||||
"required": [
|
|
||||||
"value",
|
|
||||||
"expired"
|
|
||||||
],
|
|
||||||
"permission": {
|
|
||||||
"read": false,
|
|
||||||
"create": false,
|
|
||||||
"update": false,
|
|
||||||
"delete": false
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"_id": {
|
|
||||||
"description": "ID,系统自动生成"
|
|
||||||
},
|
|
||||||
"value": {
|
|
||||||
"description": "值"
|
|
||||||
},
|
|
||||||
"expired": {
|
|
||||||
"description": "过期时间",
|
|
||||||
"bsonType": "timestamp"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"version": "0.0.1"
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"IndexName": "device_id",
|
|
||||||
"MgoKeySchema": {
|
|
||||||
"MgoIndexKeys": [
|
|
||||||
{
|
|
||||||
"Name": "device_id",
|
|
||||||
"Direction": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"MgoIsUnique": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"IndexName": "oaid",
|
|
||||||
"MgoKeySchema": {
|
|
||||||
"MgoIndexKeys": [
|
|
||||||
{
|
|
||||||
"Name": "oaid",
|
|
||||||
"Direction": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"MgoIsUnique": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"IndexName": "imei",
|
|
||||||
"MgoKeySchema": {
|
|
||||||
"MgoIndexKeys": [
|
|
||||||
{
|
|
||||||
"Name": "imei",
|
|
||||||
"Direction": "1"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"MgoIsUnique": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
@ -1,87 +0,0 @@
|
|||||||
{
|
|
||||||
"bsonType": "object",
|
|
||||||
"required": [
|
|
||||||
"user_id"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"_id": {
|
|
||||||
"description": "ID,系统自动生成"
|
|
||||||
},
|
|
||||||
"user_id": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "用户id,参考uni-id-users表"
|
|
||||||
},
|
|
||||||
"ua": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "userAgent"
|
|
||||||
},
|
|
||||||
"uuid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备唯一标识(需要加密存储)"
|
|
||||||
},
|
|
||||||
"os_name": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "ios|android|windows|mac|linux "
|
|
||||||
},
|
|
||||||
"os_version": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统版本号 "
|
|
||||||
},
|
|
||||||
"os_language": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统语言 "
|
|
||||||
},
|
|
||||||
"os_theme": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "操作系统主题 light|dark"
|
|
||||||
},
|
|
||||||
"vendor": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备厂商"
|
|
||||||
},
|
|
||||||
"push_clientid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "推送设备客户端标识"
|
|
||||||
},
|
|
||||||
"device_id": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备id"
|
|
||||||
},
|
|
||||||
"imei": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "国际移动设备识别码IMEI(International Mobile Equipment Identity)"
|
|
||||||
},
|
|
||||||
"oaid": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "移动智能设备标识公共服务平台提供的匿名设备标识符(OAID)"
|
|
||||||
},
|
|
||||||
"idfa": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "iOS平台配置应用使用广告标识(IDFA)"
|
|
||||||
},
|
|
||||||
"model": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "设备型号"
|
|
||||||
},
|
|
||||||
"platform": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "平台类型"
|
|
||||||
},
|
|
||||||
"create_date": {
|
|
||||||
"bsonType": "timestamp",
|
|
||||||
"description": "创建时间",
|
|
||||||
"forceDefaultValue": {
|
|
||||||
"$env": "now"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"last_active_date": {
|
|
||||||
"bsonType": "timestamp",
|
|
||||||
"description": "最后登录时间"
|
|
||||||
},
|
|
||||||
"last_active_ip": {
|
|
||||||
"bsonType": "string",
|
|
||||||
"description": "最后登录IP"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"version": "0.0.1"
|
|
||||||
}
|
|
97
uni_modules/rt-uni-update/changelog.md
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
## 1.5.2(2023-09-08)
|
||||||
|
优化文档
|
||||||
|
## 1.5.1(2023-05-26)
|
||||||
|
优化文档
|
||||||
|
## 1.5.0(2023-05-23)
|
||||||
|
优化文档
|
||||||
|
## 1.4.9(2023-05-23)
|
||||||
|
文档新增后台版本管理示例图
|
||||||
|
## 1.4.8(2023-05-23)
|
||||||
|
优化当前版本显示
|
||||||
|
## 1.4.7(2023-05-23)
|
||||||
|
新增当前运行版本名称和新版本名称显示
|
||||||
|
## 1.4.6(2023-05-22)
|
||||||
|
新增显示安装包大小
|
||||||
|
## 1.4.5(2023-04-27)
|
||||||
|
优化页面不透明
|
||||||
|
## 1.4.4(2023-04-25)
|
||||||
|
新增pages_init.json自动注册页面
|
||||||
|
## 1.4.3(2023-04-25)
|
||||||
|
修改app下载链接
|
||||||
|
## 1.4.2(2023-04-25)
|
||||||
|
优化
|
||||||
|
## 1.4.1(2023-04-15)
|
||||||
|
优化bug
|
||||||
|
## 1.4.0(2023-04-14)
|
||||||
|
删除无用代码
|
||||||
|
## 1.3.9(2023-04-14)
|
||||||
|
优化
|
||||||
|
## 1.3.8(2023-04-03)
|
||||||
|
优化文档
|
||||||
|
## 1.3.7(2023-03-23)
|
||||||
|
优化文档
|
||||||
|
## 1.3.6(2023-03-23)
|
||||||
|
优化文档
|
||||||
|
## 1.3.5(2023-03-08)
|
||||||
|
新增常见问题
|
||||||
|
## 1.3.4(2023-03-07)
|
||||||
|
解决应用切换到后台再次打开更新弹窗叠加多个的问题
|
||||||
|
## 1.3.3(2023-03-02)
|
||||||
|
优化提示文档
|
||||||
|
## 1.3.2(2023-02-02)
|
||||||
|
优化部分wgt包无法安装的提示
|
||||||
|
## 1.3.1(2023-01-12)
|
||||||
|
修改示例下载文件地址
|
||||||
|
## 1.3.0(2022-11-17)
|
||||||
|
兼容低版本安卓手机,用户拒绝安装后,去掉自动重启,优化体验
|
||||||
|
## 1.2.9(2022-11-14)
|
||||||
|
优化插件
|
||||||
|
## 1.2.8(2022-11-14)
|
||||||
|
优化整包更新用户体验
|
||||||
|
## 1.2.7(2022-11-14)
|
||||||
|
修复apk整包更新时,点击拒绝安装,更新进度还在的bug
|
||||||
|
## 1.2.6(2022-10-17)
|
||||||
|
优化问题汇总
|
||||||
|
## 1.2.5(2022-10-17)
|
||||||
|
常见问题优化
|
||||||
|
## 1.2.4(2022-09-21)
|
||||||
|
文档新增常见问题汇总,方便更快的解决问题
|
||||||
|
## 1.2.3(2022-09-21)
|
||||||
|
文档新增常见问题汇总,方便更快的解决问题
|
||||||
|
## 1.2.2(2022-09-21)
|
||||||
|
文档新增常见问题汇总,方便更快的解决问题
|
||||||
|
## 1.2.1(2022-09-21)
|
||||||
|
文档新增常见问题汇总,方便更快的解决问题
|
||||||
|
## 1.2.0(2022-08-03)
|
||||||
|
优化插件,wgt升级重启,整包升级不重启
|
||||||
|
## 1.1.9(2022-08-01)
|
||||||
|
新增弹出一个合并页面路由的pages.json修改界面。插件使用者点击确认按钮即可完成插件页面向项目pages.json的注册。HBuilderX 3.5.0+支持
|
||||||
|
## 1.1.8(2022-07-25)
|
||||||
|
1、静默更新后提示用户重启应用,以解决样式错乱的问题
|
||||||
|
2、跳转应用市场下载后,解决更新提示弹窗一直叠加的问题
|
||||||
|
## 1.1.7(2022-07-22)
|
||||||
|
优化示例代码
|
||||||
|
## 1.1.6(2022-07-22)
|
||||||
|
优化文档
|
||||||
|
## 1.1.5(2022-07-19)
|
||||||
|
优化文档
|
||||||
|
## 1.1.4(2022-07-19)
|
||||||
|
优化文档
|
||||||
|
## 1.1.3(2022-07-19)
|
||||||
|
优化文档
|
||||||
|
## 1.1.2(2022-07-18)
|
||||||
|
优化wgt更新文档
|
||||||
|
## 1.1.1(2022-07-17)
|
||||||
|
新增wgt包静默更新
|
||||||
|
## 1.1.0(2022-05-17)
|
||||||
|
优化readme文档
|
||||||
|
## 1.0.9(2022-05-14)
|
||||||
|
优化
|
||||||
|
## 1.0.8(2022-05-05)
|
||||||
|
修复图片不显示的bug
|
||||||
|
## 1.0.7(2022-01-19)
|
||||||
|
1.0.7 优化readme文档
|
||||||
|
## 1.0.6(2022-01-19)
|
||||||
|
正式支持uni_modules
|
||||||
|
## 1.0.5(2022-01-19)
|
||||||
|
测试支持uni_models
|
@ -0,0 +1,303 @@
|
|||||||
|
<template>
|
||||||
|
<view class="update-mask flex-center">
|
||||||
|
<view class="content botton-radius">
|
||||||
|
<view class="content-top">
|
||||||
|
<view class="content-top-text">
|
||||||
|
<text class="">发现新版本 v{{data.edition_name}}</text>
|
||||||
|
<text class="version">当前版本:{{version}}</text>
|
||||||
|
</view>
|
||||||
|
<image class="content-top" style="top: 0;" width="100%" height="100%" src="/uni_modules/rt-uni-update/static/bg_top.png"></image>
|
||||||
|
</view>
|
||||||
|
<view class="content-header"></view>
|
||||||
|
<view class="content-body">
|
||||||
|
|
||||||
|
<view class="title"><text>更新内容</text></view>
|
||||||
|
<view class="body">
|
||||||
|
<scroll-view class="box-des-scroll" scroll-y="true"><rich-text :nodes="data.describe"></rich-text></scroll-view>
|
||||||
|
</view>
|
||||||
|
<view class="footer flex-center">
|
||||||
|
<view class="progress-box flex-column" v-if="!updateBtn">
|
||||||
|
<progress class="progress" border-radius="35" :percent="percent" activeColor="#3DA7FF" show-info stroke-width="10" />
|
||||||
|
<!-- <u-line-progress :striped="true" :percent="percent" :striped-active="true"></u-line-progress> -->
|
||||||
|
<view><text class="fs24">正在下载,请稍后 ({{downloadedSize}}/{{packageFileSize}}M)</text></view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<button class="content-button" style="border: none;color: #fff;" plain @click="confirm" v-if="updateBtn">立即升级</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<image v-if="cancleBtn" class="close-img" src="/uni_modules/rt-uni-update/static/app_update_close.png" @click.stop="cancel"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
version:'1.0.0',//当前运行版本(打包时manifest里的版本名称)
|
||||||
|
percent: 0, //进度条百分比
|
||||||
|
updateBtn: true, //是否显示立即更新
|
||||||
|
cancleBtn: false, //是否显示取消按钮
|
||||||
|
downloadedSize:0,//当前已下载大小
|
||||||
|
packageFileSize:0,//安装包大小
|
||||||
|
data: {
|
||||||
|
describe: '1. 修复已知问题<br>2. 优化用户体验',
|
||||||
|
edition_url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-6bef1fe3-e3e3-4909-9f0c-6ed9bd11c93b/aae2360a-6628-4c93-b873-ce1600b9a852.apk', //安装包下载地址或者通用应用市场地址
|
||||||
|
edition_force: 1, //是否强制更新 0代表否 1代表是
|
||||||
|
package_type: 0 ,//0是整包升级 1是wgt升级
|
||||||
|
edition_name:'1.0.1' //后端返回的版本名称
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onHide() { //解决应用切换到后台再次打开更新弹窗叠加多个的问题
|
||||||
|
// console.log('切换到后台');
|
||||||
|
this.data.edition_force = 0;
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
})
|
||||||
|
},
|
||||||
|
onLoad({obj}) {
|
||||||
|
this.data = JSON.parse(obj);
|
||||||
|
if (this.data.edition_force == 0) {
|
||||||
|
this.cancleBtn = true;
|
||||||
|
}
|
||||||
|
plus.runtime.getProperty(plus.runtime.appid,(inf) => {
|
||||||
|
this.version = inf.version;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
onBackPress() {
|
||||||
|
// 强制更新不允许返回
|
||||||
|
if (this.data.edition_force == 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
cancel() {
|
||||||
|
//取消升级 返回上一页
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
},
|
||||||
|
confirm() {
|
||||||
|
if (this.data.package_type == 0) {
|
||||||
|
//apk整包升级 下载地址必须以.apk结尾
|
||||||
|
if (this.data.edition_url.includes('.apk')) {
|
||||||
|
this.updateBtn = false;
|
||||||
|
this.cancleBtn = false;
|
||||||
|
this.download();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//外部下载 一般是手机应用市场或者其他h5页面
|
||||||
|
this.data.edition_force = 0; // 解决跳转外部链接后,更新提示还在的问题
|
||||||
|
plus.runtime.openURL(this.data.edition_url);
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.updateBtn = false;
|
||||||
|
this.cancleBtn = false;
|
||||||
|
//wgt资源包升级 下载地址必须以.wgt结尾
|
||||||
|
this.download();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
download() {
|
||||||
|
let package_type = this.data.package_type;
|
||||||
|
let that = this;
|
||||||
|
const downloadTask = uni.downloadFile({
|
||||||
|
url: this.data.edition_url,
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
plus.runtime.install(
|
||||||
|
res.tempFilePath,
|
||||||
|
{
|
||||||
|
force: true //true表示强制安装,不进行版本号的校验;false则需要版本号校验,
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
// console.log('success', success);
|
||||||
|
if (package_type == 1) {
|
||||||
|
plus.runtime.restart();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function(e) {
|
||||||
|
//提示部分wgt包无法安装的问题
|
||||||
|
that.data.edition_force = 0;
|
||||||
|
uni.showToast({
|
||||||
|
title:e.message,
|
||||||
|
icon:'none',
|
||||||
|
duration:2500
|
||||||
|
})
|
||||||
|
setTimeout(()=>{
|
||||||
|
uni.navigateBack()
|
||||||
|
},2000)
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
if (package_type == 0) {
|
||||||
|
// 解决安装app点击取消,更新还在的问题
|
||||||
|
this.data.edition_force = 0;
|
||||||
|
uni.navigateBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 进度条
|
||||||
|
downloadTask.onProgressUpdate(res => {
|
||||||
|
this.percent = res.progress;
|
||||||
|
this.downloadedSize = (res.totalBytesWritten / Math.pow(1024, 2)).toFixed(2);
|
||||||
|
this.packageFileSize = (res.totalBytesExpectedToWrite / Math.pow(1024, 2)).toFixed(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
page {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-center {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.update-mask {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: rgba(0, 0, 0, 0.65);
|
||||||
|
}
|
||||||
|
|
||||||
|
.botton-radius {
|
||||||
|
border-bottom-left-radius: 30rpx;
|
||||||
|
border-bottom-right-radius: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
position: relative;
|
||||||
|
top: 0;
|
||||||
|
width: 600rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0 50rpx;
|
||||||
|
font-family: Source Han Sans CN;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: block;
|
||||||
|
/* #endif */
|
||||||
|
line-height: 200px;
|
||||||
|
text-align: center;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-top {
|
||||||
|
position: absolute;
|
||||||
|
top: -195rpx;
|
||||||
|
left: 0;
|
||||||
|
width: 600rpx;
|
||||||
|
height: 270rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-top-text {
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #f8f8fa;
|
||||||
|
position: absolute;
|
||||||
|
top: 120rpx;
|
||||||
|
left: 50rpx;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-header {
|
||||||
|
height: 70rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
font-size: 33rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #3da7ff;
|
||||||
|
line-height: 38px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
height: 150rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-des-scroll {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-des {
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #000000;
|
||||||
|
line-height: 50rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-box {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress {
|
||||||
|
width: 83%;
|
||||||
|
height: 40rpx;
|
||||||
|
border-radius: 35px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close-img {
|
||||||
|
width: 70rpx;
|
||||||
|
height: 70rpx;
|
||||||
|
z-index: 1000;
|
||||||
|
position: absolute;
|
||||||
|
bottom: -120rpx;
|
||||||
|
left: calc(50% - 70rpx / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-button {
|
||||||
|
text-align: center;
|
||||||
|
flex: 1;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #ffffff;
|
||||||
|
border-radius: 40rpx;
|
||||||
|
margin: 0 18rpx;
|
||||||
|
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
|
||||||
|
background: linear-gradient(to right, #1785ff, #3da7ff);
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-column {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.fs24{
|
||||||
|
font-size: 24rpx;
|
||||||
|
}
|
||||||
|
.version{
|
||||||
|
font-size: 24rpx;
|
||||||
|
margin-top: 10rpx;
|
||||||
|
color: #eeeeee;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
</style>
|
31
uni_modules/rt-uni-update/js_sdk/silence-update.js
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
export default function silenceUpdate(url) {
|
||||||
|
uni.downloadFile({
|
||||||
|
url,
|
||||||
|
success: res => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
plus.runtime.install(
|
||||||
|
res.tempFilePath, {
|
||||||
|
force: true //true表示强制安装,不进行版本号的校验;false则需要版本号校验,
|
||||||
|
},
|
||||||
|
function() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '更新提示',
|
||||||
|
content: '新版本已经准备好,请重启应用',
|
||||||
|
showCancel: false,
|
||||||
|
success: function(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
// console.log('用户点击确定');
|
||||||
|
plus.runtime.restart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// console.log('install success...');
|
||||||
|
},
|
||||||
|
function(e) {
|
||||||
|
console.error('install fail...');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
80
uni_modules/rt-uni-update/package.json
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
"id": "rt-uni-update",
|
||||||
|
"displayName": "app升级整包更新和热更新支持vue3 支持打开安卓、苹果市场,wgt静默更新",
|
||||||
|
"version": "1.5.2",
|
||||||
|
"description": "app升级、整包更新和热更新组件 支持vue3 支持打开安卓、苹果应用市场,支持wgt静默更新,无感知,支持覆盖原生tabar,原生导航栏",
|
||||||
|
"keywords": [
|
||||||
|
"整包更新",
|
||||||
|
"热更新",
|
||||||
|
"vue3",
|
||||||
|
"静默更新",
|
||||||
|
"app更新升级"
|
||||||
|
],
|
||||||
|
"repository": "",
|
||||||
|
"engines": {
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "",
|
||||||
|
"type": "component-vue"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "y"
|
||||||
|
},
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "y"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "u",
|
||||||
|
"Android Browser": "u",
|
||||||
|
"微信浏览器(Android)": "u",
|
||||||
|
"QQ浏览器(Android)": "u"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "u",
|
||||||
|
"IE": "u",
|
||||||
|
"Edge": "u",
|
||||||
|
"Firefox": "u",
|
||||||
|
"Safari": "u"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "u",
|
||||||
|
"阿里": "u",
|
||||||
|
"百度": "u",
|
||||||
|
"字节跳动": "u",
|
||||||
|
"QQ": "u"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
192
uni_modules/rt-uni-update/readme.md
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
## 整包更新和热更新组件 支持vue3 支持打开安卓、苹果应用市场,支持wgt静默更新
|
||||||
|
|
||||||
|
- ui图是采用uniapp官方更新组件的ui,如不满足需要,可自行替换
|
||||||
|
- 一键式检查更新,同时支持整包升级与wgt资源包更新 支持打开安卓自带的应用市场和苹果appstore
|
||||||
|
- 好看、实用、可自定义的客户端提示框
|
||||||
|
- 支持强制更新,无法退出
|
||||||
|
- 支持静默更新,下次启动后更新的内容自动生效
|
||||||
|
- 支持覆盖原生tabar,原生导航栏
|
||||||
|
|
||||||
|
## 安装指引
|
||||||
|
|
||||||
|
1. 在插件市场打开本插件页面,在右侧点击`使用 HBuilderX 导入插件`,选择要导入的项目点击确定(建议使用uni_modules版本 非uni_modules版本不在维护,有需要自行修改)
|
||||||
|
|
||||||
|
2. 在`pages.json`中添加页面路径。注意:一定不要设置为pages.json中第一项(在1.1.9版本新增弹出一个合并页面路由的pages.json修改界面。点击确认按钮即可完成插件页面向项目pages.json的注册。HBuilderX 3.5.0+支持,无需手动添加)
|
||||||
|
|
||||||
|
```
|
||||||
|
"pages": [
|
||||||
|
// ……其他页面配置
|
||||||
|
{
|
||||||
|
"path": "uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update",
|
||||||
|
"style": {
|
||||||
|
"disableScroll": true,
|
||||||
|
"app-plus": {
|
||||||
|
"backgroundColorTop": "transparent",
|
||||||
|
"background": "transparent",
|
||||||
|
"titleNView": false,
|
||||||
|
"scrollIndicator": false,
|
||||||
|
"popGesture": "none",
|
||||||
|
"animationType": "fade-in",
|
||||||
|
"animationDuration": 200
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
3. 查看显示效果 (注意:这里只是查看显示效果,具体代码需要按照下面的项目使用说明编写)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
// App.vue的onShow中查看效果 如果无法跳转 请在`pages.json`中添加页面路径,参照第二步
|
||||||
|
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update'
|
||||||
|
});
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 前言,一般来说,后台都需要有一个app的版本管理系统(可参考下图)
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
## 项目使用说明 最重要!!!
|
||||||
|
|
||||||
|
- 注意!!!后端返回数据要求 字段如下 (如果后端字段不一样,请在跳转更新页时手动赋值,示例见下面代码)
|
||||||
|
|
||||||
|
```
|
||||||
|
data:{
|
||||||
|
// 版本更新内容 支持<br>自动换行
|
||||||
|
describe: '1. 修复已知问题<br>
|
||||||
|
2. 优化用户体验',
|
||||||
|
edition_url: '', //apk、wgt包下载地址或者应用市场地址 安卓应用市场 market://details?id=xxxx 苹果store itms-apps://itunes.apple.com/cn/app/xxxxxx
|
||||||
|
edition_force: 0, //是否强制更新 0代表否 1代表是
|
||||||
|
package_type: 1, //0是整包升级(apk或者appstore或者安卓应用市场) 1是wgt升级
|
||||||
|
edition_issue:1, //是否发行 0否 1是 为了控制上架应用市场审核时不能弹出热更新框
|
||||||
|
edition_number:100, //版本号 最重要的manifest里的版本号 (检查更新主要以服务器返回的edition_number版本号是否大于当前app的版本号来实现是否更新)
|
||||||
|
edition_name:'1.0.0',// 版本名称 manifest里的版本名称
|
||||||
|
edition_silence:0, // 是否静默更新 0代表否 1代表是
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果后端返回的字段和上面不一致,请在前端手动赋值(示例)
|
||||||
|
|
||||||
|
data.edition_url = res.data.editionUrl
|
||||||
|
data.edition_force = res.data.editionForce
|
||||||
|
data.package_type = res.data.packageType
|
||||||
|
data.xxx = res.data.xxx
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## 后端注意!!!
|
||||||
|
|
||||||
|
edition_number传这个参数是为了解决部分用户app长期不使用,第一次打开服务器查到的版本是最新的是wgt包,但是之前app有过整包更新,如果直接更新最新wgt的话,会出现以前的整包添加的原生模块或者安卓权限无法使用,所以后端查询版本必须返回大于当前edition_number版本的最新的整包apk地址或者是应用市场地址,如果没有大于edition_number的整包,就返回最新的wgt包地址就行。
|
||||||
|
|
||||||
|
- 前端示例代码 或者根据实际业务修改 如果需要自动检测新版本,建议写在App.vue的onShow中
|
||||||
|
|
||||||
|
```
|
||||||
|
import silenceUpdate from '@/uni_modules/rt-uni-update/js_sdk/silence-update.js' //引入静默更新
|
||||||
|
|
||||||
|
//#ifdef APP-PLUS
|
||||||
|
|
||||||
|
// 获取本地应用资源版本号
|
||||||
|
plus.runtime.getProperty(plus.runtime.appid, (inf) => {
|
||||||
|
//获取服务器的版本号
|
||||||
|
uni.request({
|
||||||
|
url: 'http://127.0.0.1:8088/edition_manage/get_edition', //示例接口
|
||||||
|
data: {
|
||||||
|
edition_type: plus.runtime.appid,
|
||||||
|
version_type: uni.getSystemInfoSync().platform, //android或者ios
|
||||||
|
edition_number: inf.versionCode // 打包时manifest设置的版本号
|
||||||
|
},
|
||||||
|
success: (res) => {
|
||||||
|
//res.data.xxx根据后台返回的数据决定(我这里后端返回的是data),所以是res.data.data
|
||||||
|
//判断后台返回版本号是否大于当前应用版本号 && 是否发行 (上架应用市场时一定不能弹出更新提示)
|
||||||
|
if (Number(res.data.data.edition_number) > Number(inf.versionCode) && res
|
||||||
|
.data.data.edition_issue == 1) {
|
||||||
|
|
||||||
|
//如果是wgt升级,并且是静默更新 (注意!!! 如果是手动检查新版本,就不用判断静默更新,请直接跳转更新页,不然点击检查新版本后会没反应)
|
||||||
|
if (res.data.data.package_type == 1 && res.data.data.edition_silence == 1) {
|
||||||
|
|
||||||
|
//调用静默更新方法 传入下载地址
|
||||||
|
silenceUpdate(res.data.data.edition_url)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//跳转更新页面 (注意!!!如果pages.json第一页的代码里有一打开就跳转其他页面的操作,下面这行代码最好写在setTimeout里面设置延时3到5秒再执行)
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/uni_modules/rt-uni-update/components/rt-uni-update/rt-uni-update?obj=' +
|
||||||
|
JSON.stringify(res.data.data)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// 如果是手动检查新版本 需开启以下注释
|
||||||
|
/* uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '已是最新版本',
|
||||||
|
showCancel: false
|
||||||
|
}) */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
# 常见问题汇总!!!
|
||||||
|
|
||||||
|
# 热更新制作wgt包的方法:1、修改manifest.json版本名称和版本号,必须大于当前版本。2、点击菜单的发行——原生App-制作应用wgt包
|
||||||
|
|
||||||
|
# app上传地址:个人建议开通unicloud的阿里云按量付费,方便、便宜,apk或者wgt包直接上传到云存储就行。
|
||||||
|
|
||||||
|
## 1、调试请打包自定义基座测试,否则uni.getSystemInfoSync().platform获取到的可能不是android或者ios,会导致无法跳转更新页
|
||||||
|
|
||||||
|
## 2、进度条不显示,但可以正常安装,原因:99%的情况是因为下载链接为内网链接,内网链接无法监听下载进度,请更换为外网链接
|
||||||
|
|
||||||
|
## 3、进度条显示,下载apk完成后,安卓不会自动弹出安装页面,原因:可能是离线打包未添加安卓安装权限,请添加以下权限或者使用云打包
|
||||||
|
|
||||||
|
```
|
||||||
|
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
|
||||||
|
|
||||||
|
```
|
||||||
|
```
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4、在app.vue中无法跳转到更新页,原因:第一、在pages.json中忘记注册页面,第二、如果已经注册过页面,一般在app.vue或者首页中会有默认跳转,所以影响到了跳转更新页,解决办法:修改跳转逻辑或者在跳转更新页时加setTimeout,延时几秒在跳转
|
||||||
|
|
||||||
|
## 5、app内下载apk时会跳转外部下载,原因:安卓apk下载链接必须为.apk结尾,如果不是.apk结尾,就会跳转外部下载(比如应用市场链接)。
|
||||||
|
|
||||||
|
## 6、热更新时wgt包可以下载,但是无法安装,控制台提示wgt/wgtu文件格式错误。解决方法:下载地址必须为http://xxxxxx.wgt的格式,就是链接必须以.wgt结尾。2、如果地址是http://xxxxxx.wgt格式,请在浏览器打开这个下载地址,如果无法自动下载,一般可能都是后端下载权限的问题导致的
|
||||||
|
|
||||||
|
## 7、整包更新/热更新成功后,还是一直弹更新弹窗,原因是,打wgt包时未修改manifest.json的版本号,请修改版本号后上传服务器后重试。
|
||||||
|
|
||||||
|
## 8、苹果支持appstore链接和wgt更新,不支持整包ipa更新。
|
||||||
|
|
||||||
|
## 9、wgt更新,进度条100%,苹果无法安装,原因:1、wgt包名不要设置为中文,2、增加原生模块必须上传appstore,不能热更新
|
||||||
|
|
||||||
|
## 10、不能热更新的有:1、如果原项目没有nvue页面,新增nvue后也必须整包更新,2、增加推送、第三方登录、地图、视频播放、支付等模块,或者其他安卓权限。3、修改启动图或者app图标
|
||||||
|
|
||||||
|
## 11、更新弹窗后面的页面一半儿白屏,[官方的bug](https://ask.dcloud.net.cn/question/164141)
|
||||||
|
|
||||||
|
## 12、跳转更新页后无法获取参数,可能是使用了uni-simple-router等第三方路由插件,解决办法:通过eventChannel.$emit等方式传参,在插件里接收赋值
|
||||||
|
|
||||||
|
|
||||||
|
有鼓励,更有动力,如果您认为这个插件帮到了您的开发工作,麻烦给个五星好评鼓励一下,有能力的也可以小小赞赏一下,感谢支持。
|
||||||
|
|
||||||
|
<img src="https://mp-bed742be-5cd0-413d-b7a5-c1bdcda83cd2.cdn.bspapp.com/rookie-ui/34afc1f2862e7579c3cbdd33d23d0de.jpg" width="220" >
|
||||||
|
<img style="margin-left: 100px;" src="https://mp-bed742be-5cd0-413d-b7a5-c1bdcda83cd2.cdn.bspapp.com/rookie-ui/e14de964c6d89008035f651be6fa2c8.jpg" width="220" >
|
||||||
|
|
||||||
|
## 如有问题,请加qq 965969604
|
BIN
uni_modules/rt-uni-update/static/app_update_close.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
uni_modules/rt-uni-update/static/bg_top.png
Normal file
After Width: | Height: | Size: 7.6 KiB |