diff --git a/package.json b/package.json
index fc5c88de8e29cb992307d6ac7f39a365bab36b2a..ca5d4d4c0fee7416197c47c1989dfe7496e99656 100644
--- a/package.json
+++ b/package.json
@@ -1,11 +1,88 @@
{
- "id": "hello-uniapp-x",
- "displayName": "hello-uniapp-x",
- "description": "演示 uni-app x 框架的组件、接口、模板",
- "keywords": [
- "uni-app-x",
- "uni-app2.0",
- "示例工程"
- ],
- "version": "1.0.6"
-}
+ "id": "hello-uniapp-x",
+ "name": "hello-uniapp-x",
+ "displayName": "hello-uniapp-x",
+ "version": "1.0.8",
+ "description": "演示 uni-app x 框架的组件、接口、模板",
+ "repository": "https://gitcode.net/dcloud/hello-uni-app-x",
+ "keywords": [
+ "uni-app-x",
+ "uni-app2.0",
+ "示例工程"
+],
+ "author": "",
+ "license": "MIT",
+ "dependencies": {},
+ "engines": {
+ "HBuilderX": "^3.98"
+ },
+ "dcloudext": {
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "不采集任何数据",
+ "permissions": "- android.permission.INTERNET \n- android.permission.READ_EXTERNAL_STORAGE \n- android.permission.WRITE_EXTERNAL_STORAGE \n- android.permission.ACCESS_FINE_LOCATION \n- android.permission.ACCESS_COARSE_LOCATION \n- android.permission.ACCESS_NETWORK_STATE \n- android.permission.READ_MEDIA_IMAGES \n- android.permission.READ_MEDIA_VIDEO \n- android.permission.READ_MEDIA_VISUAL_USER_SELECTED \n- android.permission.CAMERA \n- android.permission.READ_PHONE_STATE \n- android.permission.REQUEST_INSTALL_PACKAGES"
+ },
+ "npmurl": "",
+ "type": "uniapp-template-project"
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "App": {
+ "app-vue": "n",
+ "app-nvue": "n",
+ "app-uvue": "y"
+ },
+ "H5-mobile": {
+ "Safari": "n",
+ "Android Browser": "n",
+ "微信浏览器(Android)": "n",
+ "QQ浏览器(Android)": "n"
+ },
+ "H5-pc": {
+ "Chrome": "n",
+ "IE": "n",
+ "Edge": "n",
+ "Firefox": "n",
+ "Safari": "n"
+ },
+ "小程序": {
+ "微信": "n",
+ "阿里": "n",
+ "百度": "n",
+ "字节跳动": "n",
+ "QQ": "n",
+ "京东": "n",
+ "钉钉": "n",
+ "快手": "n",
+ "飞书": "n"
+ },
+ "快应用": {
+ "华为": "n",
+ "联盟": "n"
+ },
+ "Vue": {
+ "vue2": "n",
+ "vue3": "y"
+ }
+ }
+ }
+ }
+}
diff --git a/pages/tabBar/template.uvue b/pages/tabBar/template.uvue
index d5e80dfae2079bc27d35308346d46303afa385f8..dc094f53034476d03af56bd6a023a56a050e0f99 100644
--- a/pages/tabBar/template.uvue
+++ b/pages/tabBar/template.uvue
@@ -154,14 +154,13 @@ export default {
open: false,
pages: [] as Page[],
},
- // {
- // id: 'half-screen',
- // url: 'half-screen',
- // name: '半屏弹窗',
- // open: false,
- // enable: false,
- // pages: [] as Page[],
- // },
+ {
+ id: 'half-screen',
+ url: 'half-screen',
+ name: '半屏弹窗',
+ open: false,
+ pages: [] as Page[],
+ },
{
id: 'drop-card',
url: 'drop-card',
diff --git a/pages/template/half-screen/half-screen.uvue b/pages/template/half-screen/half-screen.uvue
index 840b8e66dd7788598f6c2a54ed1a8b80c1e2f2ea..89a2aeeb457807fee4723bd418b488eef5352710 100644
--- a/pages/template/half-screen/half-screen.uvue
+++ b/pages/template/half-screen/half-screen.uvue
@@ -1,181 +1,193 @@
-
-
- TouchEvent还有细节需要优化,需支持拦截事件分发逻辑解决拖拽半屏窗口引起内容滚动的问题
-
-
- 半屏弹窗标题
-
-
- half screen content-{{item}}
-
-
-
-
-
-
-
-
-
diff --git a/uni_modules/uni-upgrade-center-app/changelog.md b/uni_modules/uni-upgrade-center-app/changelog.md
index ab09aa828d9ff009a68e3dc233e38e720371340f..e2b235c3957da51eb8a79c188e2af6947356498a 100644
--- a/uni_modules/uni-upgrade-center-app/changelog.md
+++ b/uni_modules/uni-upgrade-center-app/changelog.md
@@ -1,3 +1,9 @@
+## 0.7.4(2023-11-29)
+- 修复 uni-app-x 项目中由上版引发的无法升级的Bug
+## 0.7.3(2023-11-27)
+- 修复 在 uni-app x 中无更新时报错的Bug
+## 0.7.2(2023-11-20)
+- 新增 插件根目录 utils 文件夹中新增 check-update-nvue.js 文件(vue2 的 nvue 页面请引用该文件)
## 0.7.1(2023-11-17)
- 修复 运行至浏览器 ts 语法报错
## 0.7.0(2023-11-10)
diff --git a/uni_modules/uni-upgrade-center-app/package.json b/uni_modules/uni-upgrade-center-app/package.json
index a1b9e46986fa27e1c70a779586f777a259143860..8869b744c2901aad2bddd4e46ca9d5a62fe6bee2 100644
--- a/uni_modules/uni-upgrade-center-app/package.json
+++ b/uni_modules/uni-upgrade-center-app/package.json
@@ -1,7 +1,7 @@
{
"id": "uni-upgrade-center-app",
"displayName": "升级中心 uni-upgrade-center - App",
- "version": "0.7.1",
+ "version": "0.7.4",
"description": "uni升级中心 - 客户端检查更新",
"keywords": [
"uniCloud",
diff --git a/uni_modules/uni-upgrade-center-app/utils/call-check-version.ts b/uni_modules/uni-upgrade-center-app/utils/call-check-version.ts
index c14ce3d0065a8a2aa5f3b0558e8101d002cc6d55..3b4adbda97379384eb06aeb93007c46ba0bc0893 100644
--- a/uni_modules/uni-upgrade-center-app/utils/call-check-version.ts
+++ b/uni_modules/uni-upgrade-center-app/utils/call-check-version.ts
@@ -78,14 +78,22 @@ export default function () : Promise {
data: data
}).then(res => {
const code = res.result['code']
- if (['Int', 'Long', 'number'].includes(typeof code) && (code as number) < 0) {
- reject({
- code: res.result['code'],
- message: res.result['message']
- })
- } else {
- const result = JSON.parse(JSON.stringify(res.result)) as UniUpgradeCenterResult
- resolve(result)
+ const codeIsNumber = ['Int', 'Long', 'number'].includes(typeof code)
+ if (codeIsNumber) {
+ if ((code as number) == 0) {
+ reject({
+ code: res.result['code'],
+ message: res.result['message']
+ })
+ } else if (code < 0) {
+ reject({
+ code: res.result['code'],
+ message: res.result['message']
+ })
+ } else {
+ const result = JSON.parse(JSON.stringify(res.result)) as UniUpgradeCenterResult
+ resolve(result)
+ }
}
}).catch((err : any | null) => {
const error = err as UniCloudError
diff --git a/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js b/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js
new file mode 100644
index 0000000000000000000000000000000000000000..6c0d4bca0f9562bb764133ba175f2677b8b1189d
--- /dev/null
+++ b/uni_modules/uni-upgrade-center-app/utils/check-update-nvue.js
@@ -0,0 +1,184 @@
+function callCheckVersion() {
+ // #ifdef APP-PLUS
+ return new Promise((resolve, reject) => {
+ plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
+ let data = {
+ action: 'checkVersion',
+ appid: plus.runtime.appid,
+ appVersion: plus.runtime.version,
+ wgtVersion: widgetInfo.version
+ }
+ uniCloud.callFunction({
+ name: 'uni-upgrade-center',
+ data,
+ success: (e) => {
+ resolve(e)
+ },
+ fail: (error) => {
+ reject(error)
+ }
+ })
+ })
+ })
+ // #endif
+ // #ifndef APP-PLUS
+ return new Promise((resolve, reject) => {})
+ // #endif
+}
+
+// 推荐再App.vue中使用
+const PACKAGE_INFO_KEY = '__package_info__'
+
+export default function() {
+ // #ifdef APP-PLUS
+ return new Promise((resolve, reject) => {
+ callCheckVersion().then(async (e) => {
+ if (!e.result) return;
+ const {
+ code,
+ message,
+ is_silently, // 是否静默更新
+ url, // 安装包下载地址
+ platform, // 安装包平台
+ type // 安装包类型
+ } = e.result;
+
+ // 此处逻辑仅为实例,可自行编写
+ if (code > 0) {
+ // 腾讯云和阿里云下载链接不同,需要处理一下,阿里云会原样返回
+ const {
+ fileList
+ } = await uniCloud.getTempFileURL({
+ fileList: [url]
+ });
+ if (fileList[0].tempFileURL)
+ e.result.url = fileList[0].tempFileURL;
+
+ resolve(e)
+
+ // 静默更新,只有wgt有
+ if (is_silently) {
+ uni.downloadFile({
+ url: e.result.url,
+ success: res => {
+ if (res.statusCode == 200) {
+ // 下载好直接安装,下次启动生效
+ plus.runtime.install(res.tempFilePath, {
+ force: false
+ });
+ }
+ }
+ });
+ return;
+ }
+
+ /**
+ * 提示升级一
+ * 使用 uni.showModal
+ */
+ // return updateUseModal(e.result)
+
+ /**
+ * 提示升级二
+ * 官方适配的升级弹窗,可自行替换资源适配UI风格
+ */
+ uni.setStorageSync(PACKAGE_INFO_KEY, e.result)
+ uni.navigateTo({
+ url: `/uni_modules/uni-upgrade-center-app/pages/upgrade-popup?local_storage_key=${PACKAGE_INFO_KEY}`,
+ fail: (err) => {
+ console.error('更新弹框跳转失败', err)
+ uni.removeStorageSync(PACKAGE_INFO_KEY)
+ }
+ })
+
+ return
+ } else if (code < 0) {
+ // TODO 云函数报错处理
+ console.error(message)
+ return reject(e)
+ }
+ return resolve(e)
+ }).catch(err => {
+ // TODO 云函数报错处理
+ console.error(err.message)
+ reject(err)
+ })
+ });
+ // #endif
+}
+
+/**
+ * 使用 uni.showModal 升级
+ */
+function updateUseModal(packageInfo) {
+ const {
+ title, // 标题
+ contents, // 升级内容
+ is_mandatory, // 是否强制更新
+ url, // 安装包下载地址
+ platform, // 安装包平台
+ type // 安装包类型
+ } = packageInfo;
+
+ let isWGT = type === 'wgt'
+ let isiOS = !isWGT ? platform.includes('iOS') : false;
+ let confirmText = isiOS ? '立即跳转更新' : '立即下载更新'
+
+ return uni.showModal({
+ title,
+ content: contents,
+ showCancel: !is_mandatory,
+ confirmText,
+ success: res => {
+ if (res.cancel) return;
+
+ // 安装包下载
+ if (isiOS) {
+ plus.runtime.openURL(url);
+ return;
+ }
+
+ uni.showToast({
+ title: '后台下载中……',
+ duration: 1000
+ });
+
+ // wgt 和 安卓下载更新
+ downloadTask = uni.downloadFile({
+ url,
+ success: res => {
+ if (res.statusCode !== 200) {
+ console.error('下载安装包失败', err);
+ return;
+ }
+ // 下载好直接安装,下次启动生效
+ plus.runtime.install(res.tempFilePath, {
+ force: false
+ }, () => {
+ if (is_mandatory) {
+ //更新完重启app
+ plus.runtime.restart();
+ return;
+ }
+ uni.showModal({
+ title: '安装成功是否重启?',
+ success: res => {
+ if (res.confirm) {
+ //更新完重启app
+ plus.runtime.restart();
+ }
+ }
+ });
+ }, err => {
+ uni.showModal({
+ title: '更新失败',
+ content: err
+ .message,
+ showCancel: false
+ });
+ });
+ }
+ });
+ }
+ });
+}