From 0fb5844b6a64be8d65ef56334557f2895eb49f9e Mon Sep 17 00:00:00 2001
From: abu <3109389044@qq.com>
Date: Mon, 12 May 2025 14:51:35 +0800
Subject: [PATCH] 4.0.0
---
App.vue | 67 +-
TUIKit/assets/icon/jubao.svg | 1 +
.../message-list/message-tool/index.vue | 629 +++---
androidPrivacy.json | 56 +-
apple-app-site-association | 11 +
config/config.js | 8 +-
js_sdk/yu-app-permission/package.json | 20 +
js_sdk/yu-app-permission/yu-app-permission.js | 308 +++
manifest.json | 30 +-
pages.json | 1 +
pages/publish/preview.nvue | 80 +-
pages/publish/publish.nvue | 5 +-
pages/tabbar/vlog/index.nvue | 19 +-
plugins/APPUpdate/index.js | 1708 ++++++++---------
utils/huawei_describe.js | 29 +
utils/tools.js | 3 +-
16 files changed, 1707 insertions(+), 1268 deletions(-)
create mode 100644 TUIKit/assets/icon/jubao.svg
create mode 100644 apple-app-site-association
create mode 100644 js_sdk/yu-app-permission/package.json
create mode 100644 js_sdk/yu-app-permission/yu-app-permission.js
create mode 100644 utils/huawei_describe.js
diff --git a/App.vue b/App.vue
index b50e878b..766afca7 100644
--- a/App.vue
+++ b/App.vue
@@ -14,6 +14,10 @@ import storage from '@/utils/storage.js'; //缓存
//初始化im
import { TUIChatKit } from '@/TUIKit';
import { loginIm } from '@/utils/handleim.js';
+//解决华为上架权限描述
+import { PermissionTips } from '@/utils/huawei_describe.js';
+import { requestPermissions, closeModal, showModal } from '@/js_sdk/yu-app-permission/yu-app-permission.js';
+
export default {
// 全局属性
globalData: {
@@ -21,7 +25,9 @@ export default {
},
data() {
return {
- config
+ config,
+ popupView: null,
+ flag: false
};
},
@@ -56,15 +62,20 @@ export default {
onLaunch: function () {
// #ifdef APP-PLUS
this.checkArguments(); // 检测启动参数
+ // 权限监听申请
+ this.onRequestPermissionListener();
APPUpdate();
this.hanleTabCenter();
// 重点是以下: 一定要监听后台恢复 !一定要
plus.globalEvent.addEventListener('newintent', (e) => {
this.checkArguments(); // 检测启动参数
});
- // init im
- TUIChatKit.init();
- console.log('IM初始化完成');
+
+ if (storage.getHasLogin()) {
+ // init im
+ TUIChatKit.init();
+ console.log('IM初始化完成');
+ }
// 如果有缓存登录信息
console.log('是否登录', storage.getHasLogin());
if (storage.getHasLogin()) {
@@ -83,6 +94,54 @@ export default {
// #endif
},
methods: {
+ onRequestPermissionListener() {
+ // #ifdef APP
+ // 权限监听申请
+ // 为应用市场审核时要求:APP在调用终端权限时,应同步告知用户申请该权限的目的。此时即可使用本API,在app.vue里全局监听。
+ var brand = uni.getSystemInfoSync().deviceBrand;
+ if (brand.toLowerCase() != 'huawei' && brand.toLowerCase() != 'xiaomi') return;
+ this.permissionListener = uni.createRequestPermissionListener();
+ this.permissionListener.onRequest(async (e) => {
+ if (this.flag) {
+ return;
+ }
+ this.flag = true;
+ console.log('权限-1', e);
+ var item = e[0];
+ const { isSuc, msg } = await requestPermissions({
+ title: PermissionTips[item].title, // 申请权限时弹出框标题
+ content: PermissionTips[item].content, // 申请权限时弹出框内容
+ permissionID: item // 权限ID
+ });
+ console.log(msg);
+ if (!isSuc) {
+ if (msg != 'close') {
+ this.popupView = showModal({
+ title: PermissionTips[item].title, // 申请权限时弹出框标题
+ content: PermissionTips[item].content, // 申请权限时弹出框内容
+ permissionID: item // 权限ID
+ });
+ } else {
+ console.log('用户永久拒绝');
+ }
+ }
+ });
+ this.permissionListener.onComplete((e) => {
+ console.log('权限-2', e);
+ if (this.popupView) {
+ this.popupView.close();
+ }
+ setTimeout(() => {
+ this.flag = false;
+ }, 5000);
+ });
+ // 权限检测成功则返回 { isSuc : true} ,未授权则弹出权限询问弹窗以及权限说明窗口
+
+ // if (!isSuc) {
+ // return false
+ // }
+ // #endif
+ },
hanleTabCenter() {
// 点击中间的➕
uni.onTabBarMidButtonTap(() => {
diff --git a/TUIKit/assets/icon/jubao.svg b/TUIKit/assets/icon/jubao.svg
new file mode 100644
index 00000000..fdb8d29a
--- /dev/null
+++ b/TUIKit/assets/icon/jubao.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/TUIKit/components/TUIChat/message-list/message-tool/index.vue b/TUIKit/components/TUIChat/message-list/message-tool/index.vue
index 2c85c42b..e4410b91 100644
--- a/TUIKit/components/TUIChat/message-list/message-tool/index.vue
+++ b/TUIKit/components/TUIChat/message-list/message-tool/index.vue
@@ -1,48 +1,44 @@
-
-
-
-
-
-
- {{ item.text }}
-
-
-
-
+
+
+
+
+
+
+ {{ item.text }}
+
+
+
+
diff --git a/androidPrivacy.json b/androidPrivacy.json
index 264d6324..f583a868 100755
--- a/androidPrivacy.json
+++ b/androidPrivacy.json
@@ -1,28 +1,28 @@
-{
- "version": "4",
- "prompt": "template",
- "title": "用户协议和隐私政策",
- "message": " 请你务必审慎阅读、充分理解“用户协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。
你可阅读《用户协议》和《隐私政策》了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
- "buttonAccept": "同意并接受",
- "buttonRefuse": "暂不同意",
- "hrefLoader": "system|default",
- "second": {
- "title": "确认提示",
- "message": " 进入应用前,你需先同意《用户协议》和《隐私政策》,否则将退出应用。",
- "buttonAccept": "同意并继续",
- "buttonRefuse": "退出应用"
- },
- "styles": {
- "backgroundColor": "#ffffff",
- "borderRadius": "5px",
- "title": {
- "color": "#FF2C3C"
- },
- "buttonAccept": {
- "color": "#FF2C3C"
- },
- "buttonRefuse": {
- "color": "#545454"
- }
- }
-}
\ No newline at end of file
+{
+ "version" : "4",
+ "prompt" : "template",
+ "title" : "用户协议和隐私政策",
+ "message" : " 请你务必审慎阅读、充分理解“用户协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。
你可阅读《用户协议》和《隐私政策》了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
+ "buttonAccept" : "同意并接受",
+ "buttonRefuse" : "暂不同意",
+ "hrefLoader" : "system|default",
+ "second" : {
+ "title" : "确认提示",
+ "message" : " 进入应用前,你需先同意《用户协议》和《隐私政策》,否则将退出应用。",
+ "buttonAccept" : "同意并继续",
+ "buttonRefuse" : "退出应用"
+ },
+ "styles" : {
+ "backgroundColor" : "#ffffff",
+ "borderRadius" : "5px",
+ "title" : {
+ "color" : "#FF2C3C"
+ },
+ "buttonAccept" : {
+ "color" : "#FF2C3C"
+ },
+ "buttonRefuse" : {
+ "color" : "#545454"
+ }
+ }
+}
diff --git a/apple-app-site-association b/apple-app-site-association
new file mode 100644
index 00000000..e12e63c1
--- /dev/null
+++ b/apple-app-site-association
@@ -0,0 +1,11 @@
+{
+ "applinks": {
+ "apps": [],
+ "details": [
+ {
+ "appID": "9C9VWBX77X.cn.net.wzj.mall",
+ "paths": [ "/ulink/*"]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/config/config.js b/config/config.js
index c8a10ce4..dd91b5e7 100644
--- a/config/config.js
+++ b/config/config.js
@@ -9,9 +9,9 @@ export default {
appSecret: "6dfbe0c72380dce5d49d65b3c91059b1", //可在 manifest.json 查看
aMapKey: "AOHBZ-VCEL3-XX73N-O623U-FMTP6-ASBTD", //在腾讯的中申请web端key
scanAuthNavigation: ['https://m-b2b2c.pickmall.cn/'], //扫码认证跳转域名配置 会根据此处配置的路由进行跳转
- iosAppId: "id1564638363", //AppStore的应用地址id 具体在分享->拷贝链接中查看
- logo: "https://lilishop-oss.oss-cn-beijing.aliyuncs.com/4c864e133c2944efad1f7282ac8a3b9e.png", //logo地址
- customerServiceMobile: "13161366885", //客服电话
- customerServiceEmail: "lili@lili.com", //客服邮箱
+ iosAppId: "id6479185362", //AppStore的应用地址id 具体在分享->拷贝链接中查看
+ logo: "https://wuzhongjie.com.cn/download/logo.png", //logo地址
+ customerServiceMobile: "13040076090", //客服电话
+ customerServiceEmail: "13040076090@163.com", //客服邮箱
img: 'https://wzjbucket.oss-rg-china-mainland.aliyuncs.com', //图片地址,聊天分享的图片地址
};
\ No newline at end of file
diff --git a/js_sdk/yu-app-permission/package.json b/js_sdk/yu-app-permission/package.json
new file mode 100644
index 00000000..f1296b31
--- /dev/null
+++ b/js_sdk/yu-app-permission/package.json
@@ -0,0 +1,20 @@
+{
+ "id": "yu-app-permission",
+ "name": "解决APP未向用户告知权限申请目的,导致华为等上架被拒问题",
+ "displayName": "解决APP未向用户告知权限申请目的,导致华为等上架被拒问题",
+ "version": "0.0.1",
+ "description": "纯JS单个文件,解决安卓APP上架时未向用户告知权限申请目的等被拒问题",
+ "keywords": [
+ "华为",
+ "上架",
+ "权限",
+ "上架被拒",
+ "app"
+ ],
+ "dcloudext": {
+ "category": [
+ "JS SDK",
+ "通用 SDK"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/js_sdk/yu-app-permission/yu-app-permission.js b/js_sdk/yu-app-permission/yu-app-permission.js
new file mode 100644
index 00000000..7d217da8
--- /dev/null
+++ b/js_sdk/yu-app-permission/yu-app-permission.js
@@ -0,0 +1,308 @@
+let popupView = null // 窗口实例
+export function showModal(info) {
+ const title = info && info.title ? info.title : '标题'
+ const content = info && info.content ? info.content : '请输入内容'
+ let screenWidth = plus.screen.resolutionWidth
+ let screenHeight = plus.screen.resolutionHeight
+ const popupViewWidth = screenWidth * 0.7
+ const viewContentPadding = 20
+ const viewContentWidth = parseInt(popupViewWidth - (viewContentPadding * 2))
+ const descriptionList = drawtext(content, viewContentWidth)
+ let popupViewHeight = 80 + 20 + 20 + 20
+ let popupViewContentList = [{
+ tag: 'font',
+ id: 'title',
+ text: title,
+ textStyles: {
+ size: '18px',
+ color: "#333",
+ weight: "bold",
+ whiteSpace: "normal"
+ },
+ position: {
+ top: '60px',
+ left: viewContentPadding + "px",
+ width: viewContentWidth + "px",
+ height: "30px",
+ }
+ }]
+ const textHeight = 18
+ let contentTop = 110
+ descriptionList.forEach((item, index) => {
+ if (index > 0) {
+ popupViewHeight += textHeight;
+ contentTop += textHeight;
+ }
+ popupViewContentList.push({
+ tag: 'font',
+ id: 'content' + index + 1,
+ text: item.content,
+ textStyles: {
+ size: '14px',
+ color: "#666",
+ lineSpacing: "50%",
+ align: "center"
+ },
+ position: {
+ top: contentTop + "px",
+ left: viewContentPadding + "px",
+ width: viewContentWidth + "px",
+ height: textHeight + "px",
+ }
+ });
+ if (item.type == "break") {
+ contentTop += 10;
+ popupViewHeight += 10;
+ }
+ })
+ popupView = new plus.nativeObj.View("popupView", { //创建底部图标菜单
+ tag: "rect",
+ top: "50px",
+ left: '15%',
+ height: popupViewHeight + "px",
+ width: "70%"
+ })
+ popupView.drawRect({
+ color: "#FFFFFF",
+ radius: "8px",
+ borderWidth: "2px",
+ borderColor: "#ddd"
+ }, {
+ top: "40px",
+ height: popupViewHeight - 40 + "px",
+ })
+ popupView.draw(popupViewContentList)
+ popupView.show()
+ return popupView
+}
+
+
+export function closeModal() {
+ // 在不再需要 popupView 时关闭它
+ popupView && popupView.close();
+ popupView = null;
+}
+
+// 文字换行
+function drawtext(text, maxWidth) {
+ let textArr = text.split("");
+ let len = textArr.length;
+ // 上个节点
+ let previousNode = 0;
+ // 记录节点宽度
+ let nodeWidth = 0;
+ // 文本换行数组
+ let rowText = [];
+ // 如果是字母,侧保存长度
+ let letterWidth = 0;
+ // 汉字宽度
+ let chineseWidth = 14;
+ // otherFont宽度
+ let otherWidth = 7;
+ for (let i = 0; i < len; i++) {
+ if (/[\u4e00-\u9fa5]|[\uFE30-\uFFA0]/g.test(textArr[i])) {
+ if (letterWidth > 0) {
+ if (nodeWidth + chineseWidth + letterWidth * otherWidth > maxWidth) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, i)
+ });
+ previousNode = i
+ nodeWidth = chineseWidth
+ letterWidth = 0
+ } else {
+ nodeWidth += chineseWidth + letterWidth * otherWidth
+ letterWidth = 0
+ }
+ } else {
+ if (nodeWidth + chineseWidth > maxWidth) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, i)
+ })
+ previousNode = i
+ nodeWidth = chineseWidth
+ } else {
+ nodeWidth += chineseWidth
+ }
+ }
+ } else {
+ if (/\n/g.test(textArr[i])) {
+ rowText.push({
+ type: "break",
+ content: text.substring(previousNode, i)
+ })
+ previousNode = i + 1
+ nodeWidth = 0
+ letterWidth = 0
+ } else if (textArr[i] == "\\" && textArr[i + 1] == "n") {
+ rowText.push({
+ type: "break",
+ content: text.substring(previousNode, i)
+ })
+ previousNode = i + 2
+ nodeWidth = 0
+ letterWidth = 0
+ } else if (/[a-zA-Z0-9]/g.test(textArr[i])) {
+ letterWidth += 1;
+ if (nodeWidth + letterWidth * otherWidth > maxWidth) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, i + 1 - letterWidth)
+ })
+ previousNode = i + 1 - letterWidth
+ nodeWidth = letterWidth * otherWidth
+ letterWidth = 0
+ }
+ } else {
+ if (nodeWidth + otherWidth > maxWidth) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, i)
+ });
+ previousNode = i
+ nodeWidth = otherWidth
+ } else {
+ nodeWidth += otherWidth
+ }
+ }
+ }
+ }
+ if (previousNode < len) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, len)
+ })
+ }
+ return rowText
+}
+
+
+
+//权限检测
+export function requestPermissions(info) {
+ const permissionID = info.permissionID
+ return new Promise((rev, jec) => {
+ if (!permissionID) {
+ rev({
+ isSuc: false,
+ msg: "缺少permissionID"
+ })
+ return false
+ }
+ //判断安卓与ios设备
+ if (plus.os.name == 'Android') {
+ let _permissionID = permissionID;
+ console.log(permissionID)
+ plus.android.checkPermission(_permissionID,
+ granted => {
+ if (granted.checkResult == 0) {
+ rev({
+ isSuc: true,
+ msg: ''
+ })
+ }
+ if (granted.checkResult == -1) {
+ //还未授权当前查询的权限,打开权限申请目的自定义弹框
+ closeModal() // 先关闭再弹窗
+ // showModal(info)
+ rev({
+ isSuc: false,
+ msg: ''
+ })
+ plus.android.requestPermissions([_permissionID],
+ (e) => {
+ //关闭权限申请目的自定义弹框
+ // if (e.granted.length > 0) {
+ // closeModal()
+ // //当前查询权限已授权,此时可以通知页面执行接下来的操作
+ // rev({
+ // isSuc: true
+ // })
+ // }
+ // if (e.deniedPresent.length > 0) {
+ // closeModal()
+ // //当前查询权限已授权,此时可以通知页面执行接下来的操作
+ // rev({
+ // isSuc: false,
+ // msg: "用户已拒绝"
+ // })
+ // }
+ if (e.deniedAlways.length > 0) {
+ rev({
+ isSuc: false,
+ msg: "close"
+ })
+ //当前查询权限已被永久禁用,此时需要引导用户跳转手机系统设置去开启
+ // uni.showModal({
+ // title: '温馨提示',
+ // content: '还没有该权限,立即去设置开启?',
+ // cancelText: "取消",
+ // confirmText: "去设置",
+ // showCancel: true,
+ // confirmColor: '#000',
+ // cancelColor: '#666',
+ // success: (res) => {
+ // if (res.confirm) {
+ // goSetting();
+ // }
+ // if (res.cancel) {
+ // rev({
+ // isSuc: false,
+ // msg: "取消前往权限设置页面"
+ // })
+ // }
+ // },
+ // fail(e) {
+ // rev({
+ // isSuc: false,
+ // msg: e.message || "弹窗失败"
+ // })
+ // },
+ // complete() {
+ // closeModal()
+ // }
+ // })
+ }
+ })
+ }
+ },
+ error => {
+ rev({
+ isSuc: false,
+ mes: error.message || '检查权限失败'
+ })
+ }
+ );
+
+ } else {
+ //IOS不需要添加自定义弹框来描述权限目的,因为在配置文件的隐私信息访问的许可描述里可添加
+ rev({
+ isSuc: true
+ })
+ }
+ })
+}
+//跳转手机系统设置
+export function goSetting() {
+ if (plus.os.name == "iOS") {
+ var UIApplication = plus.ios.import("UIApplication");
+ var application2 = UIApplication.sharedApplication();
+ var NSURL2 = plus.ios.import("NSURL");
+ var setting2 = NSURL2.URLWithString("app-settings:");
+ application2.openURL(setting2);
+ plus.ios.deleteObject(setting2);
+ plus.ios.deleteObject(NSURL2);
+ plus.ios.deleteObject(application2);
+ } else {
+ var Intent = plus.android.importClass("android.content.Intent");
+ var Settings = plus.android.importClass("android.provider.Settings");
+ var Uri = plus.android.importClass("android.net.Uri");
+ var mainActivity = plus.android.runtimeMainActivity();
+ var intent = new Intent();
+ intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
+ var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
+ intent.setData(uri);
+ mainActivity.startActivity(intent);
+ }
+}
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 15a9d2b5..4f483f5b 100644
--- a/manifest.json
+++ b/manifest.json
@@ -3,7 +3,7 @@
"appid" : "__UNI__6DB512D",
"description" : "admin",
"versionName" : "4.0.0",
- "versionCode" : 4000049,
+ "versionCode" : 402,
"transformPx" : false,
"app-plus" : {
"android" : {
@@ -29,11 +29,11 @@
"Share" : {},
"Geolocation" : {},
"Maps" : {},
- "OAuth" : {},
"Camera" : {},
"Barcode" : {},
"VideoPlayer" : {},
- "Push" : {}
+ "Push" : {},
+ "OAuth" : {}
},
"error" : {
/* 404错误页面*/
@@ -71,20 +71,25 @@
"",
""
],
- "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
+ "abiFilters" : [ "arm64-v8a" ],
"schemes" : "wuzhongjie",
- "minSdkVersion" : 21
+ "minSdkVersion" : 30,
+ "targetSdkVersion" : 34
},
"ios" : {
"idfa" : false,
"privacyDescription" : {
"NSPhotoLibraryUsageDescription" : "需要用与评论上传,头像上传功能",
"NSPhotoLibraryAddUsageDescription" : "保存商品图片到本地",
- "NSFaceIDUsageDescription" : "使用面部识别进行登录",
"NSCameraUsageDescription" : "需要用与扫描二维码和商品评论图片拍摄",
- "NSLocationAlwaysAndWhenInUseUsageDescription" : "位置信息将用于高德地图的效果展示",
+ "NSLocationAlwaysAndWhenInUseUsageDescription" : "可根据位置向您介绍附近的视频信息,提升浏览体验,或帮助你在发布的信息中展示位置,不授权不影响app正常使用",
"NSMicrophoneUsageDescription" : "用户上传视频时需使用音频信息"
},
+ "capabilities" : {
+ "entitlements" : {
+ "com.apple.developer.associated-domains" : [ "applinks:wuzhongjie.com.cn" ]
+ }
+ },
"urltypes" : "wuzhongjie",
"dSYMs" : false
},
@@ -94,7 +99,7 @@
"weixin" : {
"__platform__" : [ "ios", "android" ],
"appid" : "wxebcdaea31881caab",
- "UniversalLinks" : "https://m-b2b2c.pickmall.cn/app/"
+ "UniversalLinks" : "https://wuzhongjie.com.cn/ulink/"
},
"alipay" : {
"__platform__" : [ "ios", "android" ]
@@ -104,18 +109,13 @@
"share" : {
"weixin" : {
"appid" : "wxebcdaea31881caab",
- "UniversalLinks" : "https://m-b2b2c.pickmall.cn/app/"
+ "UniversalLinks" : "https://wuzhongjie.com.cn/ulink/"
}
},
"oauth" : {
"weixin" : {
"appid" : "wxebcdaea31881caab",
- "appsecret" : "71826d76bad096ec5407897c6ed1391f",
- "UniversalLinks" : "https://m-b2b2c.pickmall.cn/app/"
- },
- "apple" : {},
- "qq" : {
- "appid" : "101918503"
+ "UniversalLinks" : "https://wuzhongjie.com.cn/ulink/"
}
},
"geolocation" : {
diff --git a/pages.json b/pages.json
index f853c56e..493d0c19 100644
--- a/pages.json
+++ b/pages.json
@@ -102,6 +102,7 @@
"style": {
"navigationBarTitleText": "预览视频",
"navigationBarBackgroundColor": "#181b27",
+ "navigationBarTextStyle": "#FFFFFF",
"enablePullDownRefresh": false
}
},
diff --git a/pages/publish/preview.nvue b/pages/publish/preview.nvue
index 0f133aa5..582ed07c 100755
--- a/pages/publish/preview.nvue
+++ b/pages/publish/preview.nvue
@@ -1,54 +1,58 @@
-
-
-
+
+
+
diff --git a/pages/publish/publish.nvue b/pages/publish/publish.nvue
index b0583b78..201aecf2 100755
--- a/pages/publish/publish.nvue
+++ b/pages/publish/publish.nvue
@@ -104,6 +104,7 @@ export default {
title: '',
width: 0,
height: 0,
+ localFile: '',
percentCompleted: 0 // 进度
};
},
@@ -113,6 +114,8 @@ export default {
let vlogInfo = storage.getVlogUserInfo();
// 上个页面传过来的文件事件对象, 其中包含了相册中选择的视频内容
let fileObjectEvent = JSON.parse(params.fileObjectEvent);
+ console.log(fileObjectEvent);
+ this.localFile = fileObjectEvent.tempFilePath;
let times = new Date().getTime();
var userId = vlogInfo.id;
let nickname = vlogInfo.nickname;
@@ -229,7 +232,7 @@ export default {
preview() {
uni.navigateTo({
- url: '/pages/publish/preview?videoUrl=' + this.videoUrl + '&width=' + this.width + '&height=' + this.height,
+ url: '/pages/publish/preview?videoUrl=' + this.videoUrl + '&width=' + this.width + '&height=' + this.height + '&localFile=' + this.localFile,
animationType: 'slide-in-bottom',
animationDuration: 500
});
diff --git a/pages/tabbar/vlog/index.nvue b/pages/tabbar/vlog/index.nvue
index f7debb8d..497c1eac 100644
--- a/pages/tabbar/vlog/index.nvue
+++ b/pages/tabbar/vlog/index.nvue
@@ -237,7 +237,6 @@ export default {
},
onShow() {
var prop = this.pageList[this.curIndex];
- this.getLocation();
if (storage.getRefreshVlogIndex() == '1') {
// 登录后需要刷新数据
for (var i = 0; i < this.pageList.length; i++) {
@@ -279,7 +278,7 @@ export default {
});
// #endif
},
- getLocation() {
+ getLocation(localdom) {
uni.getLocation({
type: 'wg84',
success: (res) => {
@@ -304,6 +303,7 @@ export default {
var address_name = ad_info.district || ad_info.city;
this.tabList.forEach((i, index) => {
if (index == 0) {
+ localdom.get();
i.name = address_name;
// this.selectorQuery();
var timer = setTimeout(() => {
@@ -328,7 +328,7 @@ export default {
storage.setCityCode('');
uni.showToast({
icon: 'none',
- title: '获取位置信息失败'
+ title: '获取位置信息失败,请前往设置'
});
}
});
@@ -429,10 +429,15 @@ export default {
var beforeProp = this.pageList[this._lastTabIndex];
var indexProp = this.pageList[index];
if (this.$refs[indexProp].dataList.length == 0) {
- // 初始化数据
- try {
- this.$refs[indexProp].get();
- } catch {}
+ if (index == 0) {
+ var localdom = this.$refs[indexProp];
+ this.getLocation(localdom);
+ } else {
+ // 初始化数据
+ try {
+ this.$refs[indexProp].get();
+ } catch {}
+ }
}
try {
this.$refs[beforeProp].hideVd();
diff --git a/plugins/APPUpdate/index.js b/plugins/APPUpdate/index.js
index 8520ea0d..7ebcd220 100644
--- a/plugins/APPUpdate/index.js
+++ b/plugins/APPUpdate/index.js
@@ -2,900 +2,882 @@
/**** 此文件说明请看注释 *****/
// 可以用自己项目的请求方法
// 请求配置说明:https://ext.dcloud.net.cn/plugin?id=822
-import { getAppVersion } from "@/api/message.js";
+import {
+ getAppVersion
+} from "@/api/message.js";
const platform = uni.getSystemInfoSync().platform;
// 主颜色
const $mainColor = "#1ABC9C";
// 弹窗图标url
const $iconUrl =
- "https://lilishop-oss.oss-cn-beijing.aliyuncs.com/app/upgrade.png";
+ "https://wuzhongjie.com.cn/download/logo.png";
// 获取当前应用的版本号
-export const getCurrentNo = function (callback) {
- // 获取本地应用资源版本号
- plus.runtime.getProperty(plus.runtime.appid, function (inf) {
- callback &&
- callback({
- versionCode: inf.version.replace(/\./g, ""),
- version: inf.version,
- });
- });
+export const getCurrentNo = function(callback) {
+ // 获取本地应用资源版本号
+ plus.runtime.getProperty(plus.runtime.appid, function(inf) {
+ callback &&
+ callback({
+ versionCode: inf.version.replace(/\./g, ""),
+ version: inf.version,
+ });
+ });
};
// 发起ajax请求获取服务端版本号
-export const getServerNo = function (callback) {
- let type;
+export const getServerNo = function(callback) {
+ let type;
- platform == "android" ? (type = "ANDROID") : (type = "IOS");
+ platform == "android" ? (type = "ANDROID") : (type = "IOS");
- getAppVersion(type).then((res) => {
- if (res.data.success && res.data.result.downloadUrl) {
- let response = res.data.result;
- let result = {};
- result.versionCode = response.version;
- result.versionName = response.versionName;
- result.versionInfo = response.content || "暂无";
- result.forceUpdate = response.forceUpdate;
- result.downloadUrl = response.downloadUrl;
- callback && callback(result);
- }
- });
+ getAppVersion(type).then((res) => {
+ if (res.data.success && res.data.result.downloadUrl) {
+ let response = res.data.result;
+ let result = {};
+ result.versionCode = response.version;
+ result.versionName = response.versionName;
+ result.versionInfo = response.content || "暂无";
+ result.forceUpdate = response.forceUpdate;
+ result.downloadUrl = response.downloadUrl;
+ callback && callback(result);
+ }
+ });
};
// 从服务器下载应用资源包(wgt文件)
-export const getDownload = function (data) {
- let popupData = {
- progress: true,
- buttonNum: 2,
- };
- if (data.forceUpdate) {
- popupData.buttonNum = 0;
- popupData.forceUpdate = data.forceUpdate;
- }
- let dtask;
- let lastProgressValue = 0;
- downloadPopup(
- popupData,
- function (res) {
- dtask = plus.downloader.createDownload(
- data.downloadUrl,
- {
- filename: "_doc/update/",
- },
- function (download, status) {
- if (status == 200) {
- res.change({
- progressValue: 100,
- progressTip: "正在安装文件...",
- progress: true,
- buttonNum: 0,
- });
- plus.runtime.install(
- download.filename,
- {},
- function () {
- res.change({
- contentText: "应用资源更新完成!",
- buttonNum: 1,
- progress: false,
- });
- },
- function (e) {
- res.cancel();
- plus.nativeUI.alert(
- "安装文件失败[" + e.code + "]:" + e.message
- );
- }
- );
- } else {
- res.change({
- contentText: "文件下载失败...",
- buttonNum: 1,
- progress: false,
- });
- }
- }
- );
- dtask.start();
- dtask.addEventListener("statechanged", function (task, status) {
- switch (task.state) {
- case 1: // 开始
- res.change({
- progressValue: 0,
- progressTip: "准备下载...",
- progress: true,
- });
- break;
- case 2: // 已连接到服务器
- res.change({
- progressValue: 0,
- progressTip: "开始下载...",
- progress: true,
- });
- break;
- case 3:
- const progress = parseInt(
- (task.downloadedSize / task.totalSize) * 100
- );
- if (progress - lastProgressValue >= 2) {
- lastProgressValue = progress;
- res.change({
- progressValue: progress,
- progressTip: "已下载" + progress + "%",
- progress: true,
- });
- }
- break;
- }
- });
- },
- function () {
- // 取消下载
- dtask && dtask.abort();
- uni.showToast({
- title: "已取消下载",
- icon: "none",
- });
- },
- function () {
- // 重启APP
- plus.runtime.restart();
- }
- );
+export const getDownload = function(data) {
+ let popupData = {
+ progress: true,
+ buttonNum: 2,
+ };
+ if (data.forceUpdate) {
+ popupData.buttonNum = 0;
+ popupData.forceUpdate = data.forceUpdate;
+ }
+ let dtask;
+ let lastProgressValue = 0;
+ downloadPopup(
+ popupData,
+ function(res) {
+ dtask = plus.downloader.createDownload(
+ data.downloadUrl, {
+ filename: "_doc/update/",
+ },
+ function(download, status) {
+ if (status == 200) {
+ res.change({
+ progressValue: 100,
+ progressTip: "正在安装文件...",
+ progress: true,
+ buttonNum: 0,
+ });
+ plus.runtime.install(
+ download.filename, {},
+ function() {
+ res.change({
+ contentText: "应用资源更新完成!",
+ buttonNum: 1,
+ progress: false,
+ });
+ },
+ function(e) {
+ res.cancel();
+ plus.nativeUI.alert(
+ "安装文件失败[" + e.code + "]:" + e.message
+ );
+ }
+ );
+ } else {
+ res.change({
+ contentText: "文件下载失败...",
+ buttonNum: 1,
+ progress: false,
+ });
+ }
+ }
+ );
+ dtask.start();
+ dtask.addEventListener("statechanged", function(task, status) {
+ switch (task.state) {
+ case 1: // 开始
+ res.change({
+ progressValue: 0,
+ progressTip: "准备下载...",
+ progress: true,
+ });
+ break;
+ case 2: // 已连接到服务器
+ res.change({
+ progressValue: 0,
+ progressTip: "开始下载...",
+ progress: true,
+ });
+ break;
+ case 3:
+ const progress = parseInt(
+ (task.downloadedSize / task.totalSize) * 100
+ );
+ if (progress - lastProgressValue >= 2) {
+ lastProgressValue = progress;
+ res.change({
+ progressValue: progress,
+ progressTip: "已下载" + progress + "%",
+ progress: true,
+ });
+ }
+ break;
+ }
+ });
+ },
+ function() {
+ // 取消下载
+ dtask && dtask.abort();
+ uni.showToast({
+ title: "已取消下载",
+ icon: "none",
+ });
+ },
+ function() {
+ // 重启APP
+ plus.runtime.restart();
+ }
+ );
};
// 文字换行
function drawtext(text, maxWidth) {
- let textArr = text.split("");
- let len = textArr.length;
+ let textArr = text.split("");
+ let len = textArr.length;
- // 上个节点
- let previousNode = 0;
- // 记录节点宽度
- let nodeWidth = 0;
- // 文本换行数组
- let rowText = [];
+ // 上个节点
+ let previousNode = 0;
+ // 记录节点宽度
+ let nodeWidth = 0;
+ // 文本换行数组
+ let rowText = [];
- // 如果是字母,侧保存长度
- let letterWidth = 0;
- // 汉字宽度
- let chineseWidth = 14;
- // otherFont宽度
- let otherWidth = 7;
- for (let i = 0; i < len; i++) {
- if (/[\u4e00-\u9fa5]|[\uFE30-\uFFA0]/g.test(textArr[i])) {
- if (letterWidth > 0) {
- if (nodeWidth + chineseWidth + letterWidth * otherWidth > maxWidth) {
- rowText.push({
- type: "text",
- content: text.substring(previousNode, i),
- });
- previousNode = i;
- nodeWidth = chineseWidth;
- letterWidth = 0;
- } else {
- nodeWidth += chineseWidth + letterWidth * otherWidth;
- letterWidth = 0;
- }
- } else {
- if (nodeWidth + chineseWidth > maxWidth) {
- rowText.push({
- type: "text",
- content: text.substring(previousNode, i),
- });
- previousNode = i;
- nodeWidth = chineseWidth;
- } else {
- nodeWidth += chineseWidth;
- }
- }
- } else {
- if (/\n/g.test(textArr[i])) {
- rowText.push({
- type: "break",
- content: text.substring(previousNode, i),
- });
- previousNode = i + 1;
- nodeWidth = 0;
- letterWidth = 0;
- } else if (textArr[i] == "\\" && textArr[i + 1] == "n") {
- rowText.push({
- type: "break",
- content: text.substring(previousNode, i),
- });
- previousNode = i + 2;
- nodeWidth = 0;
- letterWidth = 0;
- } else if (/[a-zA-Z0-9]/g.test(textArr[i])) {
- letterWidth += 1;
- if (nodeWidth + letterWidth * otherWidth > maxWidth) {
- rowText.push({
- type: "text",
- content: text.substring(previousNode, i + 1 - letterWidth),
- });
- previousNode = i + 1 - letterWidth;
- nodeWidth = letterWidth * otherWidth;
- letterWidth = 0;
- }
- } else {
- if (nodeWidth + otherWidth > maxWidth) {
- rowText.push({
- type: "text",
- content: text.substring(previousNode, i),
- });
- previousNode = i;
- nodeWidth = otherWidth;
- } else {
- nodeWidth += otherWidth;
- }
- }
- }
- }
- if (previousNode < len) {
- rowText.push({
- type: "text",
- content: text.substring(previousNode, len),
- });
- }
+ // 如果是字母,侧保存长度
+ let letterWidth = 0;
+ // 汉字宽度
+ let chineseWidth = 14;
+ // otherFont宽度
+ let otherWidth = 7;
+ for (let i = 0; i < len; i++) {
+ if (/[\u4e00-\u9fa5]|[\uFE30-\uFFA0]/g.test(textArr[i])) {
+ if (letterWidth > 0) {
+ if (nodeWidth + chineseWidth + letterWidth * otherWidth > maxWidth) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, i),
+ });
+ previousNode = i;
+ nodeWidth = chineseWidth;
+ letterWidth = 0;
+ } else {
+ nodeWidth += chineseWidth + letterWidth * otherWidth;
+ letterWidth = 0;
+ }
+ } else {
+ if (nodeWidth + chineseWidth > maxWidth) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, i),
+ });
+ previousNode = i;
+ nodeWidth = chineseWidth;
+ } else {
+ nodeWidth += chineseWidth;
+ }
+ }
+ } else {
+ if (/\n/g.test(textArr[i])) {
+ rowText.push({
+ type: "break",
+ content: text.substring(previousNode, i),
+ });
+ previousNode = i + 1;
+ nodeWidth = 0;
+ letterWidth = 0;
+ } else if (textArr[i] == "\\" && textArr[i + 1] == "n") {
+ rowText.push({
+ type: "break",
+ content: text.substring(previousNode, i),
+ });
+ previousNode = i + 2;
+ nodeWidth = 0;
+ letterWidth = 0;
+ } else if (/[a-zA-Z0-9]/g.test(textArr[i])) {
+ letterWidth += 1;
+ if (nodeWidth + letterWidth * otherWidth > maxWidth) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, i + 1 - letterWidth),
+ });
+ previousNode = i + 1 - letterWidth;
+ nodeWidth = letterWidth * otherWidth;
+ letterWidth = 0;
+ }
+ } else {
+ if (nodeWidth + otherWidth > maxWidth) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, i),
+ });
+ previousNode = i;
+ nodeWidth = otherWidth;
+ } else {
+ nodeWidth += otherWidth;
+ }
+ }
+ }
+ }
+ if (previousNode < len) {
+ rowText.push({
+ type: "text",
+ content: text.substring(previousNode, len),
+ });
+ }
- return rowText;
+ return rowText;
}
// 是否更新弹窗
function updatePopup(data, callback) {
- // 弹窗遮罩层
- let maskLayer = new plus.nativeObj.View("maskLayer", {
- //先创建遮罩层
- top: "0px",
- left: "0px",
- height: "100%",
- width: "100%",
- backgroundColor: "rgba(0,0,0,0.5)",
- });
- let downloadUrl = data.downloadUrl;
- // 以下为计算菜单的nview绘制布局,为固定算法,使用者无关关心
- const screenWidth = plus.screen.resolutionWidth;
- const screenHeight = plus.screen.resolutionHeight;
- //弹窗容器宽度
- const popupViewWidth = screenWidth * 0.8;
- // 弹窗容器的Padding
- const viewContentPadding = 20;
- // 弹窗容器的宽度
- const viewContentWidth = parseInt(popupViewWidth - viewContentPadding * 5);
- // 描述的列表
- const descriptionList = drawtext(data.versionInfo, viewContentWidth);
+ // 弹窗遮罩层
+ let maskLayer = new plus.nativeObj.View("maskLayer", {
+ //先创建遮罩层
+ top: "0px",
+ left: "0px",
+ height: "100%",
+ width: "100%",
+ backgroundColor: "rgba(0,0,0,0.5)",
+ });
+ let downloadUrl = data.downloadUrl;
+ // 以下为计算菜单的nview绘制布局,为固定算法,使用者无关关心
+ const screenWidth = plus.screen.resolutionWidth;
+ const screenHeight = plus.screen.resolutionHeight;
+ //弹窗容器宽度
+ const popupViewWidth = screenWidth * 0.8;
+ // 弹窗容器的Padding
+ const viewContentPadding = 20;
+ // 弹窗容器的宽度
+ const viewContentWidth = parseInt(popupViewWidth - viewContentPadding * 5);
+ // 描述的列表
+ const descriptionList = drawtext(data.versionInfo, viewContentWidth);
- // 弹窗容器高度
- let popupViewHeight = 400;
- let popupViewContentList = [
- {
- src: $iconUrl,
- id: "logo",
- tag: "img",
- },
- {
- tag: "font",
- id: "title",
- text: "V" + data.versionCode,
- textStyles: {
- size: "26px",
- color: "#fff",
- weight: "700",
- },
- position: {
- top: "60px",
- left: "64px",
- height: "20px",
- },
- },
- {
- tag: "font",
- id: "welcome",
- text: "欢迎体验",
- textStyles: {
- size: "16px",
- color: "#fff",
- weight: "400",
- },
- position: {
- top: "85px",
- left: "64px",
- height: "20px",
- },
- },
- ];
- const textHeight = 18;
- let contentTop = popupViewHeight / 2 + 16;
+ // 弹窗容器高度
+ let popupViewHeight = 400;
+ let popupViewContentList = [{
+ src: $iconUrl,
+ id: "logo",
+ tag: "img",
+ },
+ {
+ tag: "font",
+ id: "title",
+ text: "V" + data.versionCode,
+ textStyles: {
+ size: "26px",
+ color: "#fff",
+ weight: "700",
+ },
+ position: {
+ top: "60px",
+ left: "64px",
+ height: "20px",
+ },
+ },
+ {
+ tag: "font",
+ id: "welcome",
+ text: "欢迎体验",
+ textStyles: {
+ size: "16px",
+ color: "#fff",
+ weight: "400",
+ },
+ position: {
+ top: "85px",
+ left: "64px",
+ height: "20px",
+ },
+ },
+ ];
+ const textHeight = 18;
+ let contentTop = popupViewHeight / 2 + 16;
- popupViewContentList.push({
- tag: "font",
- id: "content-title",
- text: "新版本特性:",
- textStyles: {
- size: "20px",
- lineSpacing: "50%",
- align: "left",
- },
- position: {
- top: popupViewHeight / 2 - 24 + "px",
- left: viewContentPadding + "px",
- width: viewContentWidth + "px",
- height: textHeight + "px",
- },
- });
- descriptionList.forEach((item, index) => {
- if (index > 0) {
- popupViewHeight += textHeight;
- contentTop += textHeight;
- }
- popupViewContentList.push({
- tag: "font",
- id: "content" + index + 1,
- text: item.content,
+ popupViewContentList.push({
+ tag: "font",
+ id: "content-title",
+ text: "新版本特性:",
+ textStyles: {
+ size: "20px",
+ lineSpacing: "50%",
+ align: "left",
+ },
+ position: {
+ top: popupViewHeight / 2 - 24 + "px",
+ left: viewContentPadding + "px",
+ width: viewContentWidth + "px",
+ height: textHeight + "px",
+ },
+ });
+ descriptionList.forEach((item, index) => {
+ if (index > 0) {
+ popupViewHeight += textHeight;
+ contentTop += textHeight;
+ }
+ popupViewContentList.push({
+ tag: "font",
+ id: "content" + index + 1,
+ text: item.content,
- textStyles: {
- size: "14px",
- color: "#666",
- lineSpacing: "50%",
- align: "left",
- },
+ textStyles: {
+ size: "14px",
+ color: "#666",
+ lineSpacing: "50%",
+ align: "left",
+ },
- position: {
- top: contentTop + "px",
- left: viewContentPadding + "px",
- width: viewContentWidth + "px",
- height: textHeight + "px",
- },
- });
- if (item.type == "break") {
- contentTop += 10;
- popupViewHeight += 10;
- }
- });
- // 弹窗内容
- let popupView = new plus.nativeObj.View("popupView", {
- //创建底部图标菜单
- tag: "rect",
- top: (screenHeight - popupViewHeight) / 2 + "px",
- left: "10%",
- height: popupViewHeight + "px",
- width: "80%",
- });
- // 绘制白色背景
- popupView.drawRect(
- {
- color: "#FFFFFF",
- radius: "8px",
- },
- {
- top: "40px",
- height: popupViewHeight - 40 + "px",
- }
- );
- // 绘制底边按钮
- popupView.drawRect(
- {
- radius: "3px",
- borderColor: "#f1f1f1",
- borderWidth: "1px",
- },
- {
- bottom: viewContentPadding + "px",
- left: viewContentPadding + "px",
- width: (viewContentWidth - viewContentPadding) / 2 + "px",
- height: "30px",
- }
- );
- // 绘制底边按钮
- popupView.drawRect(
- {
- radius: "3px",
- color: $mainColor,
- borderColor: $mainColor,
- },
- {
- bottom: viewContentPadding + "px",
- left:
- (viewContentWidth - viewContentPadding) / 2 +
- viewContentPadding * 2 +
- "px",
- width: (viewContentWidth - viewContentPadding) / 2 + "px",
- height: "30px",
- }
- );
- popupViewContentList.push({
- tag: "rect",
- id: "confimBtn",
- rectStyles: {
- color: $mainColor,
- radius: "3px",
- },
- position: {
- bottom: viewContentPadding + "px",
- left: (viewContentWidth - viewContentPadding) / 3 + "px",
- width: viewContentWidth - viewContentPadding + "px",
- height: "40px",
- },
- });
- popupViewContentList.push({
- tag: "font",
- id: "confirmText",
- text: "立即更新",
- textStyles: {
- size: "18px",
- color: "#fff",
- lineSpacing: "0%",
- whiteSpace: "normal",
- },
- position: {
- bottom: viewContentPadding + "px",
- left: (viewContentWidth - viewContentPadding) / 3 + "px",
- width: viewContentWidth - viewContentPadding + "px",
- height: "40px",
- },
- });
- popupView.draw(popupViewContentList);
- popupView.addEventListener("click", function (e) {
- let maxTop = popupViewHeight - viewContentPadding;
- let maxLeft = popupViewWidth - viewContentPadding;
- let buttonWidth = (viewContentWidth - viewContentPadding) / 2;
- if (e.clientY > maxTop - 30 && e.clientY < maxTop) {
- // 暂不升级
- if (
- e.clientX > viewContentPadding &&
- e.clientX < maxLeft - buttonWidth - viewContentPadding
- ) {
- // 立即升级
- if (platform == "android") {
- maskLayer.hide();
- popupView.hide();
- callback && callback();
- } else {
- if (!data.forceUpdate) {
- maskLayer.hide();
- popupView.hide();
- }
- plus.runtime.openURL(downloadUrl);
- }
- } else if (e.clientX > maxLeft - buttonWidth && e.clientX < maxLeft) {
- // 立即升级
- if (platform == "android") {
- maskLayer.hide();
- popupView.hide();
- callback && callback();
- } else {
- if (!data.forceUpdate) {
- maskLayer.hide();
- popupView.hide();
- }
- plus.runtime.openURL(downloadUrl);
- }
- }
- }
- });
- // 点击遮罩层
- maskLayer.addEventListener("click", function () {
- //处理遮罩层点击
- if (!data.forceUpdate) {
- maskLayer.hide();
- popupView.hide();
- }
- });
- // 显示弹窗
- maskLayer.show();
- popupView.show();
+ position: {
+ top: contentTop + "px",
+ left: viewContentPadding + "px",
+ width: viewContentWidth + "px",
+ height: textHeight + "px",
+ },
+ });
+ if (item.type == "break") {
+ contentTop += 10;
+ popupViewHeight += 10;
+ }
+ });
+ // 弹窗内容
+ let popupView = new plus.nativeObj.View("popupView", {
+ //创建底部图标菜单
+ tag: "rect",
+ top: (screenHeight - popupViewHeight) / 2 + "px",
+ left: "10%",
+ height: popupViewHeight + "px",
+ width: "80%",
+ });
+ // 绘制白色背景
+ popupView.drawRect({
+ color: "#FFFFFF",
+ radius: "8px",
+ }, {
+ top: "40px",
+ height: popupViewHeight - 40 + "px",
+ });
+ // 绘制底边按钮
+ popupView.drawRect({
+ radius: "3px",
+ borderColor: "#f1f1f1",
+ borderWidth: "1px",
+ }, {
+ bottom: viewContentPadding + "px",
+ left: viewContentPadding + "px",
+ width: (viewContentWidth - viewContentPadding) / 2 + "px",
+ height: "30px",
+ });
+ // 绘制底边按钮
+ popupView.drawRect({
+ radius: "3px",
+ color: $mainColor,
+ borderColor: $mainColor,
+ }, {
+ bottom: viewContentPadding + "px",
+ left: (viewContentWidth - viewContentPadding) / 2 +
+ viewContentPadding * 2 +
+ "px",
+ width: (viewContentWidth - viewContentPadding) / 2 + "px",
+ height: "30px",
+ });
+ popupViewContentList.push({
+ tag: "rect",
+ id: "confimBtn",
+ rectStyles: {
+ color: $mainColor,
+ radius: "3px",
+ },
+ position: {
+ bottom: viewContentPadding + "px",
+ left: (viewContentWidth - viewContentPadding) / 3 + "px",
+ width: viewContentWidth - viewContentPadding + "px",
+ height: "40px",
+ },
+ });
+ popupViewContentList.push({
+ tag: "font",
+ id: "confirmText",
+ text: "立即更新",
+ textStyles: {
+ size: "18px",
+ color: "#fff",
+ lineSpacing: "0%",
+ whiteSpace: "normal",
+ },
+ position: {
+ bottom: viewContentPadding + "px",
+ left: (viewContentWidth - viewContentPadding) / 3 + "px",
+ width: viewContentWidth - viewContentPadding + "px",
+ height: "40px",
+ },
+ });
+ popupView.draw(popupViewContentList);
+ popupView.addEventListener("click", function(e) {
+ let maxTop = popupViewHeight - viewContentPadding;
+ let maxLeft = popupViewWidth - viewContentPadding;
+ let buttonWidth = (viewContentWidth - viewContentPadding) / 2;
+ if (e.clientY > maxTop - 30 && e.clientY < maxTop) {
+ // 暂不升级
+ if (
+ e.clientX > viewContentPadding &&
+ e.clientX < maxLeft - buttonWidth - viewContentPadding
+ ) {
+ // 立即升级
+ if (platform == "android") {
+ maskLayer.hide();
+ popupView.hide();
+ callback && callback();
+ } else {
+ if (!data.forceUpdate) {
+ maskLayer.hide();
+ popupView.hide();
+ }
+ plus.runtime.openURL(downloadUrl);
+ }
+ } else if (e.clientX > maxLeft - buttonWidth && e.clientX < maxLeft) {
+ // 立即升级
+ if (platform == "android") {
+ maskLayer.hide();
+ popupView.hide();
+ callback && callback();
+ } else {
+ if (!data.forceUpdate) {
+ maskLayer.hide();
+ popupView.hide();
+ }
+ plus.runtime.openURL(downloadUrl);
+ }
+ }
+ }
+ });
+ // 点击遮罩层
+ maskLayer.addEventListener("click", function() {
+ //处理遮罩层点击
+ if (!data.forceUpdate) {
+ maskLayer.hide();
+ popupView.hide();
+ }
+ });
+ // 显示弹窗
+ maskLayer.show();
+ popupView.show();
}
// 文件下载的弹窗绘图
function downloadPopupDrawing(data) {
- // 以下为计算菜单的nview绘制布局,为固定算法,使用者无关关心
- const screenWidth = plus.screen.resolutionWidth;
- const screenHeight = plus.screen.resolutionHeight;
- //弹窗容器宽度
- const popupViewWidth = screenWidth * 0.7;
- // 弹窗容器的Padding
- const viewContentPadding = 20;
- // 弹窗容器的宽度
- const viewContentWidth = popupViewWidth - viewContentPadding * 2;
- // 弹窗容器高度
- let popupViewHeight = viewContentPadding * 3 + 60;
- let progressTip = data.progressTip || "准备下载...";
- let contentText = data.contentText || "正在为您更新,请耐心等待";
- let elementList = [
- {
- tag: "rect", //背景色
- color: "#FFFFFF",
- rectStyles: {
- radius: "8px",
- },
- },
- {
- tag: "font",
- id: "title",
- text: "升级APP",
- textStyles: {
- size: "16px",
- color: "#333",
- weight: "bold",
- verticalAlign: "middle",
- whiteSpace: "normal",
- },
- position: {
- top: viewContentPadding + "px",
- height: "30px",
- },
- },
- {
- tag: "font",
- id: "content",
- text: contentText,
- textStyles: {
- size: "14px",
- color: "#333",
- verticalAlign: "middle",
- whiteSpace: "normal",
- },
- position: {
- top: viewContentPadding * 2 + 30 + "px",
- height: "20px",
- },
- },
- ];
- // 是否有进度条
- if (data.progress) {
- popupViewHeight += viewContentPadding + 40;
- elementList = elementList.concat([
- {
- tag: "font",
- id: "progressValue",
- text: progressTip,
- textStyles: {
- size: "14px",
- color: $mainColor,
- whiteSpace: "normal",
- },
- position: {
- top: viewContentPadding * 4 + 20 + "px",
- height: "30px",
- },
- },
- {
- tag: "rect", //绘制进度条背景
- id: "progressBg",
- rectStyles: {
- radius: "4px",
- borderColor: "#f1f1f1",
- borderWidth: "1px",
- },
- position: {
- top: viewContentPadding * 4 + 60 + "px",
- left: viewContentPadding + "px",
- width: viewContentWidth + "px",
- height: "8px",
- },
- },
- ]);
- }
- if (data.buttonNum == 2) {
- popupViewHeight += viewContentPadding + 30;
- // elementList = elementList.concat([{
- // tag: 'rect', //绘制底边按钮
- // rectStyles: {
- // radius: "3px",
- // borderColor: "#f1f1f1",
- // borderWidth: "1px",
- // },
- // position: {
- // bottom: viewContentPadding + 'px',
- // left: viewContentPadding + "px",
- // width: (viewContentWidth - viewContentPadding) / 2 + "px",
- // height: "30px"
- // }
- // },
- // {
- // tag: 'rect', //绘制底边按钮
- // rectStyles: {
- // radius: "3px",
- // color: $mainColor
- // },
- // position: {
- // bottom: viewContentPadding + 'px',
- // left: ((viewContentWidth - viewContentPadding) / 2 + viewContentPadding * 2) + "px",
- // width: (viewContentWidth - viewContentPadding) / 2 + "px",
- // height: "30px"
- // }
- // },
- // {
- // tag: 'font',
- // id: 'cancelText',
- // text: "取消下载",
- // textStyles: {
- // size: '14px',
- // color: "#666",
- // lineSpacing: "0%",
- // whiteSpace: "normal"
- // },
- // position: {
- // bottom: viewContentPadding + 'px',
- // left: viewContentPadding + "px",
- // width: (viewContentWidth - viewContentPadding) / 2 + "px",
- // height: "30px",
- // }
- // },
- // {
- // tag: 'font',
- // id: 'confirmText',
- // text: "后台下载",
- // textStyles: {
- // size: '14px',
- // color: "#FFF",
- // lineSpacing: "0%",
- // whiteSpace: "normal"
- // },
- // position: {
- // bottom: viewContentPadding + 'px',
- // left: ((viewContentWidth - viewContentPadding) / 2 + viewContentPadding * 2) + "px",
- // width: (viewContentWidth - viewContentPadding) / 2 + "px",
- // height: "30px",
- // }
- // }
- // ]);
- }
- if (data.buttonNum == 1) {
- popupViewHeight += viewContentPadding + 40;
- elementList = elementList.concat([
- {
- tag: "rect", //绘制底边按钮
- rectStyles: {
- radius: "6px",
- color: $mainColor,
- },
- position: {
- bottom: viewContentPadding + "px",
- left: viewContentPadding + "px",
- width: viewContentWidth + "px",
- height: "40px",
- },
- },
- {
- tag: "font",
- id: "confirmText",
- text: "关闭",
- textStyles: {
- size: "14px",
- color: "#FFF",
- lineSpacing: "0%",
- },
- position: {
- bottom: viewContentPadding + "px",
- left: viewContentPadding + "px",
- width: viewContentWidth + "px",
- height: "40px",
- },
- },
- ]);
- }
- return {
- popupViewHeight: popupViewHeight,
- popupViewWidth: popupViewWidth,
- screenHeight: screenHeight,
- viewContentWidth: viewContentWidth,
- viewContentPadding: viewContentPadding,
- elementList: elementList,
- };
+ // 以下为计算菜单的nview绘制布局,为固定算法,使用者无关关心
+ const screenWidth = plus.screen.resolutionWidth;
+ const screenHeight = plus.screen.resolutionHeight;
+ //弹窗容器宽度
+ const popupViewWidth = screenWidth * 0.7;
+ // 弹窗容器的Padding
+ const viewContentPadding = 20;
+ // 弹窗容器的宽度
+ const viewContentWidth = popupViewWidth - viewContentPadding * 2;
+ // 弹窗容器高度
+ let popupViewHeight = viewContentPadding * 3 + 60;
+ let progressTip = data.progressTip || "准备下载...";
+ let contentText = data.contentText || "正在为您更新,请耐心等待";
+ let elementList = [{
+ tag: "rect", //背景色
+ color: "#FFFFFF",
+ rectStyles: {
+ radius: "8px",
+ },
+ },
+ {
+ tag: "font",
+ id: "title",
+ text: "升级APP",
+ textStyles: {
+ size: "16px",
+ color: "#333",
+ weight: "bold",
+ verticalAlign: "middle",
+ whiteSpace: "normal",
+ },
+ position: {
+ top: viewContentPadding + "px",
+ height: "30px",
+ },
+ },
+ {
+ tag: "font",
+ id: "content",
+ text: contentText,
+ textStyles: {
+ size: "14px",
+ color: "#333",
+ verticalAlign: "middle",
+ whiteSpace: "normal",
+ },
+ position: {
+ top: viewContentPadding * 2 + 30 + "px",
+ height: "20px",
+ },
+ },
+ ];
+ // 是否有进度条
+ if (data.progress) {
+ popupViewHeight += viewContentPadding + 40;
+ elementList = elementList.concat([{
+ tag: "font",
+ id: "progressValue",
+ text: progressTip,
+ textStyles: {
+ size: "14px",
+ color: $mainColor,
+ whiteSpace: "normal",
+ },
+ position: {
+ top: viewContentPadding * 4 + 20 + "px",
+ height: "30px",
+ },
+ },
+ {
+ tag: "rect", //绘制进度条背景
+ id: "progressBg",
+ rectStyles: {
+ radius: "4px",
+ borderColor: "#f1f1f1",
+ borderWidth: "1px",
+ },
+ position: {
+ top: viewContentPadding * 4 + 60 + "px",
+ left: viewContentPadding + "px",
+ width: viewContentWidth + "px",
+ height: "8px",
+ },
+ },
+ ]);
+ }
+ if (data.buttonNum == 2) {
+ popupViewHeight += viewContentPadding + 30;
+ // elementList = elementList.concat([{
+ // tag: 'rect', //绘制底边按钮
+ // rectStyles: {
+ // radius: "3px",
+ // borderColor: "#f1f1f1",
+ // borderWidth: "1px",
+ // },
+ // position: {
+ // bottom: viewContentPadding + 'px',
+ // left: viewContentPadding + "px",
+ // width: (viewContentWidth - viewContentPadding) / 2 + "px",
+ // height: "30px"
+ // }
+ // },
+ // {
+ // tag: 'rect', //绘制底边按钮
+ // rectStyles: {
+ // radius: "3px",
+ // color: $mainColor
+ // },
+ // position: {
+ // bottom: viewContentPadding + 'px',
+ // left: ((viewContentWidth - viewContentPadding) / 2 + viewContentPadding * 2) + "px",
+ // width: (viewContentWidth - viewContentPadding) / 2 + "px",
+ // height: "30px"
+ // }
+ // },
+ // {
+ // tag: 'font',
+ // id: 'cancelText',
+ // text: "取消下载",
+ // textStyles: {
+ // size: '14px',
+ // color: "#666",
+ // lineSpacing: "0%",
+ // whiteSpace: "normal"
+ // },
+ // position: {
+ // bottom: viewContentPadding + 'px',
+ // left: viewContentPadding + "px",
+ // width: (viewContentWidth - viewContentPadding) / 2 + "px",
+ // height: "30px",
+ // }
+ // },
+ // {
+ // tag: 'font',
+ // id: 'confirmText',
+ // text: "后台下载",
+ // textStyles: {
+ // size: '14px',
+ // color: "#FFF",
+ // lineSpacing: "0%",
+ // whiteSpace: "normal"
+ // },
+ // position: {
+ // bottom: viewContentPadding + 'px',
+ // left: ((viewContentWidth - viewContentPadding) / 2 + viewContentPadding * 2) + "px",
+ // width: (viewContentWidth - viewContentPadding) / 2 + "px",
+ // height: "30px",
+ // }
+ // }
+ // ]);
+ }
+ if (data.buttonNum == 1) {
+ popupViewHeight += viewContentPadding + 40;
+ elementList = elementList.concat([{
+ tag: "rect", //绘制底边按钮
+ rectStyles: {
+ radius: "6px",
+ color: $mainColor,
+ },
+ position: {
+ bottom: viewContentPadding + "px",
+ left: viewContentPadding + "px",
+ width: viewContentWidth + "px",
+ height: "40px",
+ },
+ },
+ {
+ tag: "font",
+ id: "confirmText",
+ text: "关闭",
+ textStyles: {
+ size: "14px",
+ color: "#FFF",
+ lineSpacing: "0%",
+ },
+ position: {
+ bottom: viewContentPadding + "px",
+ left: viewContentPadding + "px",
+ width: viewContentWidth + "px",
+ height: "40px",
+ },
+ },
+ ]);
+ }
+ return {
+ popupViewHeight: popupViewHeight,
+ popupViewWidth: popupViewWidth,
+ screenHeight: screenHeight,
+ viewContentWidth: viewContentWidth,
+ viewContentPadding: viewContentPadding,
+ elementList: elementList,
+ };
}
// 文件下载的弹窗
function downloadPopup(data, callback, cancelCallback, rebootCallback) {
- // 弹窗遮罩层
- let maskLayer = new plus.nativeObj.View("maskLayer", {
- //先创建遮罩层
- top: "0px",
- left: "0px",
- height: "100%",
- width: "100%",
- backgroundColor: "rgba(0,0,0,0.5)",
- });
- let popupViewData = downloadPopupDrawing(data);
- // 弹窗内容
- let popupView = new plus.nativeObj.View("popupView", {
- //创建底部图标菜单
- tag: "rect",
- top:
- (popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 + "px",
- left: "15%",
- height: popupViewData.popupViewHeight + "px",
- width: "70%",
- });
- let progressValue = 0;
- let progressTip = 0;
- let contentText = 0;
- let buttonNum = 2;
- let forceUpdate = data.forceUpdate;
- if (data.buttonNum >= 0) {
- buttonNum = data.buttonNum;
- }
- popupView.draw(popupViewData.elementList);
- popupView.addEventListener("click", function (e) {
- let maxTop =
- popupViewData.popupViewHeight - popupViewData.viewContentPadding;
- let maxLeft =
- popupViewData.popupViewWidth - popupViewData.viewContentPadding;
- if (e.clientY > maxTop - 40 && e.clientY < maxTop) {
- if (buttonNum == 1) {
- // 单按钮
- if (
- e.clientX > popupViewData.viewContentPadding &&
- e.clientX < maxLeft
- ) {
- maskLayer.hide();
- popupView.hide();
- }
- } else if (buttonNum == 2) {
- // 双按钮
- let buttonWidth =
- (popupViewData.viewContentWidth - popupViewData.viewContentPadding) /
- 2;
- if (
- e.clientX > popupViewData.viewContentPadding &&
- e.clientX < maxLeft - buttonWidth - popupViewData.viewContentPadding
- ) {
- maskLayer.hide();
- popupView.hide();
- //cancelCallback && cancelCallback();
- } else if (e.clientX > maxLeft - buttonWidth && e.clientX < maxLeft) {
- maskLayer.hide();
- popupView.hide();
- }
- }
- }
- });
- // 显示弹窗
- maskLayer.show();
- popupView.show();
- // 改变进度条
- callback({
- change: function (res) {
- let progressElement = [];
- if (res.progressValue) {
- progressValue = res.progressValue;
- // 绘制进度条
- progressElement.push({
- tag: "rect", //绘制进度条背景
- id: "progressValueBg",
- rectStyles: {
- radius: "4px",
- color: $mainColor,
- },
- position: {
- top: popupViewData.viewContentPadding * 4 + 60 + "px",
- left: popupViewData.viewContentPadding + "px",
- width:
- popupViewData.viewContentWidth * (res.progressValue / 100) + "px",
- height: "8px",
- },
- });
- }
- if (res.progressTip) {
- progressTip = res.progressTip;
- progressElement.push({
- tag: "font",
- id: "progressValue",
- text: res.progressTip,
- textStyles: {
- size: "14px",
- color: $mainColor,
- whiteSpace: "normal",
- },
- position: {
- top: popupViewData.viewContentPadding * 4 + 20 + "px",
- height: "30px",
- },
- });
- }
- if (res.contentText) {
- contentText = res.contentText;
- progressElement.push({
- tag: "font",
- id: "content",
- text: res.contentText,
- textStyles: {
- size: "16px",
- color: "#333",
- whiteSpace: "normal",
- },
- position: {
- top: popupViewData.viewContentPadding * 2 + 30 + "px",
- height: "30px",
- },
- });
- }
- if (res.buttonNum >= 0 && buttonNum != res.buttonNum) {
- buttonNum = res.buttonNum;
- popupView.reset();
- popupViewData = downloadPopupDrawing(
- Object.assign(
- {
- progressValue: progressValue,
- progressTip: progressTip,
- contentText: contentText,
- },
- res
- )
- );
- let newElement = [];
- popupViewData.elementList.map((item, index) => {
- let have = false;
- progressElement.forEach((childItem, childIndex) => {
- if (item.id == childItem.id) {
- have = true;
- }
- });
- if (!have) {
- newElement.push(item);
- }
- });
- progressElement = newElement.concat(progressElement);
- popupView.setStyle({
- tag: "rect",
- top:
- (popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 +
- "px",
- left: "15%",
- height: popupViewData.popupViewHeight + "px",
- width: "70%",
- });
- popupView.draw(progressElement);
- } else {
- popupView.draw(progressElement);
- }
- },
- cancel: function () {
- maskLayer.hide();
- popupView.hide();
- },
- });
-}
-// APPUpdate
-export default function (isPrompt = false) {
- getCurrentNo((version) => {
- getServerNo((res) => {
- if (res.versionCode.replace(/\./g, "") <= version.versionCode) {
- return false;
- }
-
- if (res.forceUpdate) {
- if (/\.wgt$/i.test(res.downloadUrl)) {
- getDownload(res);
- } else if (/\.html$/i.test(res.downloadUrl)) {
- plus.runtime.openURL(res.downloadUrl);
- } else {
- if (platform == "android") {
- getDownload(res);
- } else {
- updatePopup(res, function () {
- plus.runtime.openURL(res.downloadUrl);
- });
- // uni.showLoading({
- // title: "升级中......",
- // mask: true
- // });
- // plus.runtime.openURL(res.downloadUrl);
- // plus.runtime.restart();
- }
- }
- } else {
- updatePopup(res, function () {
- if (/\.wgt$/i.test(res.downloadUrl)) {
- getDownload(res);
- } else if (/\.html$/i.test(res.downloadUrl)) {
- plus.runtime.openURL(res.downloadUrl);
- } else {
- getDownload(res);
- // if (platform == "android") {
- // getDownload(res);
- // } else {
- // plus.runtime.openURL(res.downloadUrl);
- // }
- }
- });
- }
- });
- });
+ // 弹窗遮罩层
+ let maskLayer = new plus.nativeObj.View("maskLayer", {
+ //先创建遮罩层
+ top: "0px",
+ left: "0px",
+ height: "100%",
+ width: "100%",
+ backgroundColor: "rgba(0,0,0,0.5)",
+ });
+ let popupViewData = downloadPopupDrawing(data);
+ // 弹窗内容
+ let popupView = new plus.nativeObj.View("popupView", {
+ //创建底部图标菜单
+ tag: "rect",
+ top: (popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 + "px",
+ left: "15%",
+ height: popupViewData.popupViewHeight + "px",
+ width: "70%",
+ });
+ let progressValue = 0;
+ let progressTip = 0;
+ let contentText = 0;
+ let buttonNum = 2;
+ let forceUpdate = data.forceUpdate;
+ if (data.buttonNum >= 0) {
+ buttonNum = data.buttonNum;
+ }
+ popupView.draw(popupViewData.elementList);
+ popupView.addEventListener("click", function(e) {
+ let maxTop =
+ popupViewData.popupViewHeight - popupViewData.viewContentPadding;
+ let maxLeft =
+ popupViewData.popupViewWidth - popupViewData.viewContentPadding;
+ if (e.clientY > maxTop - 40 && e.clientY < maxTop) {
+ if (buttonNum == 1) {
+ // 单按钮
+ if (
+ e.clientX > popupViewData.viewContentPadding &&
+ e.clientX < maxLeft
+ ) {
+ maskLayer.hide();
+ popupView.hide();
+ }
+ } else if (buttonNum == 2) {
+ // 双按钮
+ let buttonWidth =
+ (popupViewData.viewContentWidth - popupViewData.viewContentPadding) /
+ 2;
+ if (
+ e.clientX > popupViewData.viewContentPadding &&
+ e.clientX < maxLeft - buttonWidth - popupViewData.viewContentPadding
+ ) {
+ maskLayer.hide();
+ popupView.hide();
+ //cancelCallback && cancelCallback();
+ } else if (e.clientX > maxLeft - buttonWidth && e.clientX < maxLeft) {
+ maskLayer.hide();
+ popupView.hide();
+ }
+ }
+ }
+ });
+ // 显示弹窗
+ maskLayer.show();
+ popupView.show();
+ // 改变进度条
+ callback({
+ change: function(res) {
+ let progressElement = [];
+ if (res.progressValue) {
+ progressValue = res.progressValue;
+ // 绘制进度条
+ progressElement.push({
+ tag: "rect", //绘制进度条背景
+ id: "progressValueBg",
+ rectStyles: {
+ radius: "4px",
+ color: $mainColor,
+ },
+ position: {
+ top: popupViewData.viewContentPadding * 4 + 60 + "px",
+ left: popupViewData.viewContentPadding + "px",
+ width: popupViewData.viewContentWidth * (res.progressValue / 100) + "px",
+ height: "8px",
+ },
+ });
+ }
+ if (res.progressTip) {
+ progressTip = res.progressTip;
+ progressElement.push({
+ tag: "font",
+ id: "progressValue",
+ text: res.progressTip,
+ textStyles: {
+ size: "14px",
+ color: $mainColor,
+ whiteSpace: "normal",
+ },
+ position: {
+ top: popupViewData.viewContentPadding * 4 + 20 + "px",
+ height: "30px",
+ },
+ });
+ }
+ if (res.contentText) {
+ contentText = res.contentText;
+ progressElement.push({
+ tag: "font",
+ id: "content",
+ text: res.contentText,
+ textStyles: {
+ size: "16px",
+ color: "#333",
+ whiteSpace: "normal",
+ },
+ position: {
+ top: popupViewData.viewContentPadding * 2 + 30 + "px",
+ height: "30px",
+ },
+ });
+ }
+ if (res.buttonNum >= 0 && buttonNum != res.buttonNum) {
+ buttonNum = res.buttonNum;
+ popupView.reset();
+ popupViewData = downloadPopupDrawing(
+ Object.assign({
+ progressValue: progressValue,
+ progressTip: progressTip,
+ contentText: contentText,
+ },
+ res
+ )
+ );
+ let newElement = [];
+ popupViewData.elementList.map((item, index) => {
+ let have = false;
+ progressElement.forEach((childItem, childIndex) => {
+ if (item.id == childItem.id) {
+ have = true;
+ }
+ });
+ if (!have) {
+ newElement.push(item);
+ }
+ });
+ progressElement = newElement.concat(progressElement);
+ popupView.setStyle({
+ tag: "rect",
+ top: (popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 +
+ "px",
+ left: "15%",
+ height: popupViewData.popupViewHeight + "px",
+ width: "70%",
+ });
+ popupView.draw(progressElement);
+ } else {
+ popupView.draw(progressElement);
+ }
+ },
+ cancel: function() {
+ maskLayer.hide();
+ popupView.hide();
+ },
+ });
}
-// #endif
+// APPUpdate
+export default function(isPrompt = false) {
+ getCurrentNo((version) => {
+ getServerNo((res) => {
+ if (res.versionCode.replace(/\./g, "") <= version.versionCode) {
+ return false;
+ }
+
+ if (res.forceUpdate) {
+ if (/\.wgt$/i.test(res.downloadUrl)) {
+ getDownload(res);
+ } else if (/\.html$/i.test(res.downloadUrl)) {
+ plus.runtime.openURL(res.downloadUrl);
+ } else {
+ if (platform == "android") {
+ getDownload(res);
+ } else {
+ updatePopup(res, function() {
+ plus.runtime.openURL(res.downloadUrl);
+ });
+ // uni.showLoading({
+ // title: "升级中......",
+ // mask: true
+ // });
+ // plus.runtime.openURL(res.downloadUrl);
+ // plus.runtime.restart();
+ }
+ }
+ } else {
+ updatePopup(res, function() {
+ if (/\.wgt$/i.test(res.downloadUrl)) {
+ getDownload(res);
+ } else if (/\.html$/i.test(res.downloadUrl)) {
+ plus.runtime.openURL(res.downloadUrl);
+ } else {
+ getDownload(res);
+ // if (platform == "android") {
+ // getDownload(res);
+ // } else {
+ // plus.runtime.openURL(res.downloadUrl);
+ // }
+ }
+ });
+ }
+ });
+ });
+}
+// #endif
\ No newline at end of file
diff --git a/utils/huawei_describe.js b/utils/huawei_describe.js
new file mode 100644
index 00000000..89bf8e5a
--- /dev/null
+++ b/utils/huawei_describe.js
@@ -0,0 +1,29 @@
+export const PermissionTips = {
+ "android.permission.WRITE_EXTERNAL_STORAGE": {
+ title: '正在获取相册权限',
+ content: '为了您使用相机拍摄,并在评论、传头像等功能使用所拍摄的照片,我们需要访问您终端设备的摄像头权限和相册权限,如果您拒绝或关闭本项权限,我们将无法提供上述服务。'
+
+ },
+ "android.permission.READ_EXTERNAL_STORAGE": {
+ title: '正在获取相册权限',
+ content: '为了您使用相机拍摄,并在评论、传头像等功能使用所拍摄的照片,我们需要访问您终端设备的摄像头权限和相册权限,如果您拒绝或关闭本项权限,我们将无法提供上述服务。'
+
+ },
+ "android.permission.CAMERA": {
+ title: '正在获取摄像头权限',
+ content: '您可以拍照设置头像、拍照上传图片'
+
+ },
+ "android.permission.ACCESS_COARSE_LOCATION": {
+ title: '正在获取定位信息',
+ content: '可根据位置向您介绍附近的视频信息,提升浏览体验,或帮助你在发布的信息中展示位置,不授权不影响app正常使用'
+ },
+ "android.permission.ACCESS_FINE_LOCATION": {
+ title: '正在获取定位信息',
+ content: '可根据位置向您介绍附近的视频信息,提升浏览体验,或帮助你在发布的信息中展示位置,不授权不影响app正常使用'
+ },
+ "android.permission.RECORD_AUDIO": {
+ title: '正在获取麦克风权限',
+ content: '为了您使用发送语音消息功能,我们需要访问您终端设备的麦克风权限,不授权不影响app正常使用'
+ }
+}
\ No newline at end of file
diff --git a/utils/tools.js b/utils/tools.js
index e7180474..c98c3141 100644
--- a/utils/tools.js
+++ b/utils/tools.js
@@ -288,7 +288,8 @@ const clickFeedBack = (fn) => {
}
if (uni.getSystemInfoSync().platform == 'android') {
// vibrateShort
- uni.vibrateLong({
+ // uni.vibrateLong({
+ uni.vibrateShort({
success: () => {
console.log('点击震动');
}