4.0.0
This commit is contained in:
parent
4faa8cdb10
commit
0fb5844b6a
61
App.vue
61
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(); // 检测启动参数
|
||||
});
|
||||
|
||||
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(() => {
|
||||
|
1
TUIKit/assets/icon/jubao.svg
Normal file
1
TUIKit/assets/icon/jubao.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1747019858517" class="icon" viewBox="0 0 1088 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4001" xmlns:xlink="http://www.w3.org/1999/xlink" width="212.5" height="200"><path d="M566.224 10.032a48 48 0 0 1 20.32 20.32l480.768 920.32a48 48 0 0 1-42.544 70.24H63.232a48 48 0 0 1-42.56-70.24l480.784-920.32a48 48 0 0 1 64.768-20.32zM544 52.576L63.232 972.896h961.536L544 52.576z m16 712.32a48 48 0 1 1 0 96 48 48 0 0 1 0-96z m0-416a44.272 44.272 0 0 1 44.128 47.84l-24.72 305.456a16 16 0 0 1-15.936 14.72h-7.36a16 16 0 0 1-15.952-14.736l-24.352-305.424A44.32 44.32 0 0 1 560 348.912z" p-id="4002"></path></svg>
|
After Width: | Height: | Size: 764 B |
@ -32,17 +32,13 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import TUIChatEngine, {
|
||||
TUIStore,
|
||||
StoreName,
|
||||
TUITranslateService,
|
||||
IMessageModel,
|
||||
} from '@tencentcloud/chat-uikit-engine';
|
||||
import TUIChatEngine, { TUIStore, StoreName, TUITranslateService, IMessageModel } from '@tencentcloud/chat-uikit-engine';
|
||||
import { TUIGlobal } from '@tencentcloud/universal-api';
|
||||
import { ref, watchEffect, computed, onMounted, onUnmounted } from '../../../../adapter-vue';
|
||||
import Icon from '../../../common/Icon.vue';
|
||||
import { Toast, TOAST_TYPE } from '../../../common/Toast/index';
|
||||
import delIcon from '../../../../assets/icon/msg-del.svg';
|
||||
import juBao from '../../../../assets/icon/jubao.svg';
|
||||
import copyIcon from '../../../../assets/icon/msg-copy.svg';
|
||||
import quoteIcon from '../../../../assets/icon/msg-quote.svg';
|
||||
import revokeIcon from '../../../../assets/icon/msg-revoke.svg';
|
||||
@ -73,7 +69,7 @@ interface IEmits {
|
||||
const emits = defineEmits<IEmits>();
|
||||
const props = withDefaults(defineProps<IProps>(), {
|
||||
isMultipleSelectMode: false,
|
||||
messageItem: () => ({}) as IMessageModel,
|
||||
messageItem: () => ({} as IMessageModel)
|
||||
});
|
||||
const featureConfig = TUIChatConfig.getFeatureConfig();
|
||||
|
||||
@ -86,11 +82,9 @@ const actionItems = ref([
|
||||
iconUrl: copyIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.DownloadFile || !message.value) return false;
|
||||
return isPC && (message.value?.type === TYPES.MSG_FILE
|
||||
|| message.value.type === TYPES.MSG_VIDEO
|
||||
|| message.value.type === TYPES.MSG_IMAGE);
|
||||
return isPC && (message.value?.type === TYPES.MSG_FILE || message.value.type === TYPES.MSG_VIDEO || message.value.type === TYPES.MSG_IMAGE);
|
||||
},
|
||||
clickEvent: openMessage,
|
||||
clickEvent: openMessage
|
||||
},
|
||||
{
|
||||
key: 'copy',
|
||||
@ -100,7 +94,7 @@ const actionItems = ref([
|
||||
if (!featureConfig.CopyMessage || !message.value) return false;
|
||||
return message.value.type === TYPES.MSG_TEXT;
|
||||
},
|
||||
clickEvent: copyMessage,
|
||||
clickEvent: copyMessage
|
||||
},
|
||||
{
|
||||
key: 'revoke',
|
||||
@ -110,7 +104,7 @@ const actionItems = ref([
|
||||
if (!featureConfig.RevokeMessage || !message.value) return false;
|
||||
return message.value.flow === 'out' && message.value.status === 'success';
|
||||
},
|
||||
clickEvent: revokeMessage,
|
||||
clickEvent: revokeMessage
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
@ -120,7 +114,7 @@ const actionItems = ref([
|
||||
if (!featureConfig.DeleteMessage || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: deleteMessage,
|
||||
clickEvent: deleteMessage
|
||||
},
|
||||
{
|
||||
key: 'forward',
|
||||
@ -130,7 +124,7 @@ const actionItems = ref([
|
||||
if (!featureConfig.ForwardMessage || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: forwardSingleMessage,
|
||||
clickEvent: forwardSingleMessage
|
||||
},
|
||||
{
|
||||
key: 'quote',
|
||||
@ -141,29 +135,40 @@ const actionItems = ref([
|
||||
const _message = TUIStore.getMessageModel(message.value.ID);
|
||||
return message.value.status === 'success' && !_message.getSignalingInfo();
|
||||
},
|
||||
clickEvent: quoteMessage,
|
||||
},
|
||||
{
|
||||
key: 'translate',
|
||||
text: TUITranslateService.t('TUIChat.翻译'),
|
||||
visible: false,
|
||||
iconUrl: translateIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.TranslateMessage || !message.value) return false;
|
||||
return message.value.status === 'success' && message.value.type === TYPES.MSG_TEXT;
|
||||
},
|
||||
clickEvent: translateMessage,
|
||||
clickEvent: quoteMessage
|
||||
},
|
||||
// {
|
||||
// key: 'translate',
|
||||
// text: TUITranslateService.t('TUIChat.翻译'),
|
||||
// visible: false,
|
||||
// iconUrl: translateIcon,
|
||||
// renderCondition() {
|
||||
// if (!featureConfig.TranslateMessage || !message.value) return false;
|
||||
// return message.value.status === 'success' && message.value.type === TYPES.MSG_TEXT;
|
||||
// },
|
||||
// clickEvent: translateMessage,
|
||||
// },
|
||||
// {
|
||||
// key: 'convert',
|
||||
// text: TUITranslateService.t('TUIChat.转文字'),
|
||||
// visible: false,
|
||||
// iconUrl: convertText,
|
||||
// renderCondition() {
|
||||
// if (!featureConfig.VoiceToText || !message.value) return false;
|
||||
// return message.value.status === 'success' && message.value.type === TYPES.MSG_AUDIO;
|
||||
// },
|
||||
// clickEvent: convertVoiceToText,
|
||||
// },
|
||||
{
|
||||
key: 'convert',
|
||||
text: TUITranslateService.t('TUIChat.转文字'),
|
||||
text: '举报',
|
||||
visible: false,
|
||||
iconUrl: convertText,
|
||||
iconUrl: juBao,
|
||||
renderCondition() {
|
||||
if (!featureConfig.VoiceToText || !message.value) return false;
|
||||
return message.value.status === 'success' && message.value.type === TYPES.MSG_AUDIO;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: convertVoiceToText,
|
||||
clickEvent: toReport
|
||||
},
|
||||
{
|
||||
key: 'multi-select',
|
||||
@ -173,8 +178,8 @@ const actionItems = ref([
|
||||
if (!featureConfig.MultiSelection || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: multipleSelectMessage,
|
||||
},
|
||||
clickEvent: multipleSelectMessage
|
||||
}
|
||||
]);
|
||||
|
||||
const message = ref<IMessageModel>();
|
||||
@ -183,14 +188,14 @@ const messageToolDom = ref<HTMLElement>();
|
||||
onMounted(() => {
|
||||
TUIStore.watch(StoreName.CHAT, {
|
||||
translateTextInfo: onMessageTranslationInfoUpdated,
|
||||
voiceToTextInfo: onMessageConvertInfoUpdated,
|
||||
voiceToTextInfo: onMessageConvertInfoUpdated
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
TUIStore.unwatch(StoreName.CHAT, {
|
||||
translateTextInfo: onMessageTranslationInfoUpdated,
|
||||
voiceToTextInfo: onMessageConvertInfoUpdated,
|
||||
voiceToTextInfo: onMessageConvertInfoUpdated
|
||||
});
|
||||
});
|
||||
|
||||
@ -242,7 +247,7 @@ function revokeMessage() {
|
||||
const message = TUITranslateService.t('TUIChat.已过撤回时限');
|
||||
Toast({
|
||||
message,
|
||||
type: TOAST_TYPE.ERROR,
|
||||
type: TOAST_TYPE.ERROR
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -254,10 +259,20 @@ function deleteMessage() {
|
||||
messageModel.deleteMessage();
|
||||
}
|
||||
|
||||
function toReport() {
|
||||
if (!message.value) return;
|
||||
Toast({
|
||||
message: TUITranslateService.t('我们已收到您的举报'),
|
||||
type: TOAST_TYPE.WARNING
|
||||
});
|
||||
const messageModel = TUIStore.getMessageModel(message.value.ID);
|
||||
messageModel.deleteMessage();
|
||||
}
|
||||
|
||||
async function copyMessage() {
|
||||
if (isUniFrameWork) {
|
||||
TUIGlobal?.setClipboardData({
|
||||
data: transformTextWithKeysToEmojiNames(message.value?.payload?.text),
|
||||
data: transformTextWithKeysToEmojiNames(message.value?.payload?.text)
|
||||
});
|
||||
} else {
|
||||
// uni-app conditional compilation will not run the following code
|
||||
@ -295,17 +310,17 @@ function translateMessage() {
|
||||
if (!enable) {
|
||||
Toast({
|
||||
message: TUITranslateService.t('TUIChat.请开通翻译功能'),
|
||||
type: TOAST_TYPE.WARNING,
|
||||
type: TOAST_TYPE.WARNING
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!message.value) return;
|
||||
const index = actionItems.value.findIndex(item => item.key === 'translate');
|
||||
const index = actionItems.value.findIndex((item) => item.key === 'translate');
|
||||
TUIStore.update(StoreName.CHAT, 'translateTextInfo', {
|
||||
conversationID: message.value.conversationID,
|
||||
messageID: message.value.ID,
|
||||
visible: !actionItems.value[index].visible,
|
||||
visible: !actionItems.value[index].visible
|
||||
});
|
||||
}
|
||||
|
||||
@ -313,17 +328,17 @@ function convertVoiceToText() {
|
||||
const enable = TUIStore.getData(StoreName.APP, 'enabledVoiceToText');
|
||||
if (!enable) {
|
||||
Toast({
|
||||
message: TUITranslateService.t('TUIChat.请开通语音转文字功能'),
|
||||
message: TUITranslateService.t('TUIChat.请开通语音转文字功能')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!message.value) return;
|
||||
const index = actionItems.value.findIndex(item => item.key === 'convert');
|
||||
const index = actionItems.value.findIndex((item) => item.key === 'convert');
|
||||
TUIStore.update(StoreName.CHAT, 'voiceToTextInfo', {
|
||||
conversationID: message.value.conversationID,
|
||||
messageID: message.value.ID,
|
||||
visible: !actionItems.value[index].visible,
|
||||
visible: !actionItems.value[index].visible
|
||||
});
|
||||
}
|
||||
|
||||
@ -334,7 +349,7 @@ function multipleSelectMessage() {
|
||||
function onMessageTranslationInfoUpdated(info: Map<string, ITranslateInfo[]>) {
|
||||
if (info === undefined) return;
|
||||
const translationInfoList = info.get(props.messageItem.conversationID) || [];
|
||||
const idx = actionItems.value.findIndex(item => item.key === 'translate');
|
||||
const idx = actionItems.value.findIndex((item) => item.key === 'translate');
|
||||
for (let i = 0; i < translationInfoList.length; ++i) {
|
||||
const { messageID, visible } = translationInfoList[i];
|
||||
if (messageID === props.messageItem.ID) {
|
||||
@ -349,7 +364,7 @@ function onMessageTranslationInfoUpdated(info: Map<string, ITranslateInfo[]>) {
|
||||
function onMessageConvertInfoUpdated(info: Map<string, IConvertInfo[]>) {
|
||||
if (info === undefined) return;
|
||||
const convertInfoList = info.get(props.messageItem.conversationID) || [];
|
||||
const idx = actionItems.value.findIndex(item => item.key === 'convert');
|
||||
const idx = actionItems.value.findIndex((item) => item.key === 'convert');
|
||||
for (let i = 0; i < convertInfoList.length; ++i) {
|
||||
const { messageID, visible } = convertInfoList[i];
|
||||
if (messageID === props.messageItem.ID) {
|
||||
@ -362,12 +377,12 @@ function onMessageConvertInfoUpdated(info: Map<string, IConvertInfo[]>) {
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
messageToolDom,
|
||||
messageToolDom
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "../../../../assets/styles/common";
|
||||
@import '../../../../assets/styles/common';
|
||||
|
||||
.dialog-item-web {
|
||||
background: #fff;
|
||||
|
@ -1,28 +1,28 @@
|
||||
{
|
||||
"version": "4",
|
||||
"prompt": "template",
|
||||
"title": "用户协议和隐私政策",
|
||||
"message": " 请你务必审慎阅读、充分理解“用户协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href=\"https://www.wzj.net.cn/download/yonhuxieyi.html\">《用户协议》</a>和<a href=\"http://www.wzj.net.cn/download/yinsizhengce.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
|
||||
"buttonAccept": "同意并接受",
|
||||
"buttonRefuse": "暂不同意",
|
||||
"hrefLoader": "system|default",
|
||||
"second": {
|
||||
"title": "确认提示",
|
||||
"message": " 进入应用前,你需先同意<a href=\"https://wuzhongjie.com.cn/download/yonhuxieyi.html\" >《用户协议》</a>和<a href=\"http://wuzhongjie.com.cn/download/yinsizhengce.html\">《隐私政策》</a>,否则将退出应用。",
|
||||
"buttonAccept": "同意并继续",
|
||||
"buttonRefuse": "退出应用"
|
||||
"version" : "4",
|
||||
"prompt" : "template",
|
||||
"title" : "用户协议和隐私政策",
|
||||
"message" : " 请你务必审慎阅读、充分理解“用户协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的设备标识、操作日志等信息用于分析、优化应用性能。<br/> 你可阅读<a href=\"https://wuzhongjie.com.cn/download/yonhuxieyi.html\">《用户协议》</a>和<a href=\"https://wuzhongjie.com.cn/download/yinsizhengce.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",
|
||||
"buttonAccept" : "同意并接受",
|
||||
"buttonRefuse" : "暂不同意",
|
||||
"hrefLoader" : "system|default",
|
||||
"second" : {
|
||||
"title" : "确认提示",
|
||||
"message" : " 进入应用前,你需先同意<a href=\"https://wuzhongjie.com.cn/download/yonhuxieyi.html\" >《用户协议》</a>和<a href=\"http://wuzhongjie.com.cn/download/yinsizhengce.html\">《隐私政策》</a>,否则将退出应用。",
|
||||
"buttonAccept" : "同意并继续",
|
||||
"buttonRefuse" : "退出应用"
|
||||
},
|
||||
"styles": {
|
||||
"backgroundColor": "#ffffff",
|
||||
"borderRadius": "5px",
|
||||
"title": {
|
||||
"color": "#FF2C3C"
|
||||
"styles" : {
|
||||
"backgroundColor" : "#ffffff",
|
||||
"borderRadius" : "5px",
|
||||
"title" : {
|
||||
"color" : "#FF2C3C"
|
||||
},
|
||||
"buttonAccept": {
|
||||
"color": "#FF2C3C"
|
||||
"buttonAccept" : {
|
||||
"color" : "#FF2C3C"
|
||||
},
|
||||
"buttonRefuse": {
|
||||
"color": "#545454"
|
||||
"buttonRefuse" : {
|
||||
"color" : "#545454"
|
||||
}
|
||||
}
|
||||
}
|
11
apple-app-site-association
Normal file
11
apple-app-site-association
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"applinks": {
|
||||
"apps": [],
|
||||
"details": [
|
||||
{
|
||||
"appID": "9C9VWBX77X.cn.net.wzj.mall",
|
||||
"paths": [ "/ulink/*"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
@ -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', //图片地址,聊天分享的图片地址
|
||||
};
|
20
js_sdk/yu-app-permission/package.json
Normal file
20
js_sdk/yu-app-permission/package.json
Normal file
@ -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"
|
||||
]
|
||||
}
|
||||
}
|
308
js_sdk/yu-app-permission/yu-app-permission.js
Normal file
308
js_sdk/yu-app-permission/yu-app-permission.js
Normal file
@ -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);
|
||||
}
|
||||
}
|
@ -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 @@
|
||||
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
],
|
||||
"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" : {
|
||||
|
@ -102,6 +102,7 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "预览视频",
|
||||
"navigationBarBackgroundColor": "#181b27",
|
||||
"navigationBarTextStyle": "#FFFFFF",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
},
|
||||
|
@ -6,7 +6,8 @@
|
||||
:src="videoUrl"
|
||||
autoplay="true"
|
||||
controls="true"
|
||||
:object-fit="objectFit"></video>
|
||||
:object-fit="objectFit"
|
||||
></video>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -15,14 +16,17 @@ let system = uni.getSystemInfoSync();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
videoUrl: "",
|
||||
objectFit: "fill",
|
||||
screenSafeHeight: system.safeArea.bottom,
|
||||
videoUrl: '',
|
||||
objectFit: 'fill',
|
||||
screenSafeHeight: system.safeArea.bottom
|
||||
};
|
||||
},
|
||||
onLoad(params) {
|
||||
let me = this;
|
||||
let videoUrl = params.videoUrl;
|
||||
var path = params.videoUrl;
|
||||
var fileName = path.split('/').pop();
|
||||
// let videoUrl = 'https://wuzhongjie.com.cn/vlogData/' + fileName;
|
||||
let videoUrl = params.localFile;
|
||||
this.videoUrl = videoUrl;
|
||||
let width = parseInt(params.width);
|
||||
let height = parseInt(params.height);
|
||||
@ -30,12 +34,12 @@ export default {
|
||||
this.height = height;
|
||||
|
||||
if (width >= height) {
|
||||
me.objectFit = "contain";
|
||||
me.objectFit = 'contain';
|
||||
} else {
|
||||
me.objectFit = "fill";
|
||||
me.objectFit = 'fill';
|
||||
}
|
||||
},
|
||||
methods: {},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -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
|
||||
});
|
||||
|
@ -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,11 +429,16 @@ export default {
|
||||
var beforeProp = this.pageList[this._lastTabIndex];
|
||||
var indexProp = this.pageList[index];
|
||||
if (this.$refs[indexProp].dataList.length == 0) {
|
||||
if (index == 0) {
|
||||
var localdom = this.$refs[indexProp];
|
||||
this.getLocation(localdom);
|
||||
} else {
|
||||
// 初始化数据
|
||||
try {
|
||||
this.$refs[indexProp].get();
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.$refs[beforeProp].hideVd();
|
||||
} catch {}
|
||||
|
@ -2,19 +2,21 @@
|
||||
/**** 此文件说明请看注释 *****/
|
||||
// 可以用自己项目的请求方法
|
||||
// 请求配置说明: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) {
|
||||
export const getCurrentNo = function(callback) {
|
||||
// 获取本地应用资源版本号
|
||||
plus.runtime.getProperty(plus.runtime.appid, function (inf) {
|
||||
plus.runtime.getProperty(plus.runtime.appid, function(inf) {
|
||||
callback &&
|
||||
callback({
|
||||
versionCode: inf.version.replace(/\./g, ""),
|
||||
@ -23,7 +25,7 @@ export const getCurrentNo = function (callback) {
|
||||
});
|
||||
};
|
||||
// 发起ajax请求获取服务端版本号
|
||||
export const getServerNo = function (callback) {
|
||||
export const getServerNo = function(callback) {
|
||||
let type;
|
||||
|
||||
platform == "android" ? (type = "ANDROID") : (type = "IOS");
|
||||
@ -42,7 +44,7 @@ export const getServerNo = function (callback) {
|
||||
});
|
||||
};
|
||||
// 从服务器下载应用资源包(wgt文件)
|
||||
export const getDownload = function (data) {
|
||||
export const getDownload = function(data) {
|
||||
let popupData = {
|
||||
progress: true,
|
||||
buttonNum: 2,
|
||||
@ -55,13 +57,12 @@ export const getDownload = function (data) {
|
||||
let lastProgressValue = 0;
|
||||
downloadPopup(
|
||||
popupData,
|
||||
function (res) {
|
||||
function(res) {
|
||||
dtask = plus.downloader.createDownload(
|
||||
data.downloadUrl,
|
||||
{
|
||||
data.downloadUrl, {
|
||||
filename: "_doc/update/",
|
||||
},
|
||||
function (download, status) {
|
||||
function(download, status) {
|
||||
if (status == 200) {
|
||||
res.change({
|
||||
progressValue: 100,
|
||||
@ -70,16 +71,15 @@ export const getDownload = function (data) {
|
||||
buttonNum: 0,
|
||||
});
|
||||
plus.runtime.install(
|
||||
download.filename,
|
||||
{},
|
||||
function () {
|
||||
download.filename, {},
|
||||
function() {
|
||||
res.change({
|
||||
contentText: "应用资源更新完成!",
|
||||
buttonNum: 1,
|
||||
progress: false,
|
||||
});
|
||||
},
|
||||
function (e) {
|
||||
function(e) {
|
||||
res.cancel();
|
||||
plus.nativeUI.alert(
|
||||
"安装文件失败[" + e.code + "]:" + e.message
|
||||
@ -96,7 +96,7 @@ export const getDownload = function (data) {
|
||||
}
|
||||
);
|
||||
dtask.start();
|
||||
dtask.addEventListener("statechanged", function (task, status) {
|
||||
dtask.addEventListener("statechanged", function(task, status) {
|
||||
switch (task.state) {
|
||||
case 1: // 开始
|
||||
res.change({
|
||||
@ -128,7 +128,7 @@ export const getDownload = function (data) {
|
||||
}
|
||||
});
|
||||
},
|
||||
function () {
|
||||
function() {
|
||||
// 取消下载
|
||||
dtask && dtask.abort();
|
||||
uni.showToast({
|
||||
@ -136,7 +136,7 @@ export const getDownload = function (data) {
|
||||
icon: "none",
|
||||
});
|
||||
},
|
||||
function () {
|
||||
function() {
|
||||
// 重启APP
|
||||
plus.runtime.restart();
|
||||
}
|
||||
@ -264,8 +264,7 @@ function updatePopup(data, callback) {
|
||||
|
||||
// 弹窗容器高度
|
||||
let popupViewHeight = 400;
|
||||
let popupViewContentList = [
|
||||
{
|
||||
let popupViewContentList = [{
|
||||
src: $iconUrl,
|
||||
id: "logo",
|
||||
tag: "img",
|
||||
@ -359,47 +358,37 @@ function updatePopup(data, callback) {
|
||||
width: "80%",
|
||||
});
|
||||
// 绘制白色背景
|
||||
popupView.drawRect(
|
||||
{
|
||||
popupView.drawRect({
|
||||
color: "#FFFFFF",
|
||||
radius: "8px",
|
||||
},
|
||||
{
|
||||
}, {
|
||||
top: "40px",
|
||||
height: popupViewHeight - 40 + "px",
|
||||
}
|
||||
);
|
||||
});
|
||||
// 绘制底边按钮
|
||||
popupView.drawRect(
|
||||
{
|
||||
popupView.drawRect({
|
||||
radius: "3px",
|
||||
borderColor: "#f1f1f1",
|
||||
borderWidth: "1px",
|
||||
},
|
||||
{
|
||||
}, {
|
||||
bottom: viewContentPadding + "px",
|
||||
left: viewContentPadding + "px",
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + "px",
|
||||
height: "30px",
|
||||
}
|
||||
);
|
||||
});
|
||||
// 绘制底边按钮
|
||||
popupView.drawRect(
|
||||
{
|
||||
popupView.drawRect({
|
||||
radius: "3px",
|
||||
color: $mainColor,
|
||||
borderColor: $mainColor,
|
||||
},
|
||||
{
|
||||
}, {
|
||||
bottom: viewContentPadding + "px",
|
||||
left:
|
||||
(viewContentWidth - viewContentPadding) / 2 +
|
||||
left: (viewContentWidth - viewContentPadding) / 2 +
|
||||
viewContentPadding * 2 +
|
||||
"px",
|
||||
width: (viewContentWidth - viewContentPadding) / 2 + "px",
|
||||
height: "30px",
|
||||
}
|
||||
);
|
||||
});
|
||||
popupViewContentList.push({
|
||||
tag: "rect",
|
||||
id: "confimBtn",
|
||||
@ -432,7 +421,7 @@ function updatePopup(data, callback) {
|
||||
},
|
||||
});
|
||||
popupView.draw(popupViewContentList);
|
||||
popupView.addEventListener("click", function (e) {
|
||||
popupView.addEventListener("click", function(e) {
|
||||
let maxTop = popupViewHeight - viewContentPadding;
|
||||
let maxLeft = popupViewWidth - viewContentPadding;
|
||||
let buttonWidth = (viewContentWidth - viewContentPadding) / 2;
|
||||
@ -471,7 +460,7 @@ function updatePopup(data, callback) {
|
||||
}
|
||||
});
|
||||
// 点击遮罩层
|
||||
maskLayer.addEventListener("click", function () {
|
||||
maskLayer.addEventListener("click", function() {
|
||||
//处理遮罩层点击
|
||||
if (!data.forceUpdate) {
|
||||
maskLayer.hide();
|
||||
@ -497,8 +486,7 @@ function downloadPopupDrawing(data) {
|
||||
let popupViewHeight = viewContentPadding * 3 + 60;
|
||||
let progressTip = data.progressTip || "准备下载...";
|
||||
let contentText = data.contentText || "正在为您更新,请耐心等待";
|
||||
let elementList = [
|
||||
{
|
||||
let elementList = [{
|
||||
tag: "rect", //背景色
|
||||
color: "#FFFFFF",
|
||||
rectStyles: {
|
||||
@ -540,8 +528,7 @@ function downloadPopupDrawing(data) {
|
||||
// 是否有进度条
|
||||
if (data.progress) {
|
||||
popupViewHeight += viewContentPadding + 40;
|
||||
elementList = elementList.concat([
|
||||
{
|
||||
elementList = elementList.concat([{
|
||||
tag: "font",
|
||||
id: "progressValue",
|
||||
text: progressTip,
|
||||
@ -639,8 +626,7 @@ function downloadPopupDrawing(data) {
|
||||
}
|
||||
if (data.buttonNum == 1) {
|
||||
popupViewHeight += viewContentPadding + 40;
|
||||
elementList = elementList.concat([
|
||||
{
|
||||
elementList = elementList.concat([{
|
||||
tag: "rect", //绘制底边按钮
|
||||
rectStyles: {
|
||||
radius: "6px",
|
||||
@ -696,8 +682,7 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
|
||||
let popupView = new plus.nativeObj.View("popupView", {
|
||||
//创建底部图标菜单
|
||||
tag: "rect",
|
||||
top:
|
||||
(popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 + "px",
|
||||
top: (popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 + "px",
|
||||
left: "15%",
|
||||
height: popupViewData.popupViewHeight + "px",
|
||||
width: "70%",
|
||||
@ -711,7 +696,7 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
|
||||
buttonNum = data.buttonNum;
|
||||
}
|
||||
popupView.draw(popupViewData.elementList);
|
||||
popupView.addEventListener("click", function (e) {
|
||||
popupView.addEventListener("click", function(e) {
|
||||
let maxTop =
|
||||
popupViewData.popupViewHeight - popupViewData.viewContentPadding;
|
||||
let maxLeft =
|
||||
@ -750,7 +735,7 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
|
||||
popupView.show();
|
||||
// 改变进度条
|
||||
callback({
|
||||
change: function (res) {
|
||||
change: function(res) {
|
||||
let progressElement = [];
|
||||
if (res.progressValue) {
|
||||
progressValue = res.progressValue;
|
||||
@ -765,8 +750,7 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
|
||||
position: {
|
||||
top: popupViewData.viewContentPadding * 4 + 60 + "px",
|
||||
left: popupViewData.viewContentPadding + "px",
|
||||
width:
|
||||
popupViewData.viewContentWidth * (res.progressValue / 100) + "px",
|
||||
width: popupViewData.viewContentWidth * (res.progressValue / 100) + "px",
|
||||
height: "8px",
|
||||
},
|
||||
});
|
||||
@ -809,8 +793,7 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
|
||||
buttonNum = res.buttonNum;
|
||||
popupView.reset();
|
||||
popupViewData = downloadPopupDrawing(
|
||||
Object.assign(
|
||||
{
|
||||
Object.assign({
|
||||
progressValue: progressValue,
|
||||
progressTip: progressTip,
|
||||
contentText: contentText,
|
||||
@ -833,8 +816,7 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
|
||||
progressElement = newElement.concat(progressElement);
|
||||
popupView.setStyle({
|
||||
tag: "rect",
|
||||
top:
|
||||
(popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 +
|
||||
top: (popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 +
|
||||
"px",
|
||||
left: "15%",
|
||||
height: popupViewData.popupViewHeight + "px",
|
||||
@ -845,14 +827,14 @@ function downloadPopup(data, callback, cancelCallback, rebootCallback) {
|
||||
popupView.draw(progressElement);
|
||||
}
|
||||
},
|
||||
cancel: function () {
|
||||
cancel: function() {
|
||||
maskLayer.hide();
|
||||
popupView.hide();
|
||||
},
|
||||
});
|
||||
}
|
||||
// APPUpdate
|
||||
export default function (isPrompt = false) {
|
||||
export default function(isPrompt = false) {
|
||||
getCurrentNo((version) => {
|
||||
getServerNo((res) => {
|
||||
if (res.versionCode.replace(/\./g, "") <= version.versionCode) {
|
||||
@ -868,7 +850,7 @@ export default function (isPrompt = false) {
|
||||
if (platform == "android") {
|
||||
getDownload(res);
|
||||
} else {
|
||||
updatePopup(res, function () {
|
||||
updatePopup(res, function() {
|
||||
plus.runtime.openURL(res.downloadUrl);
|
||||
});
|
||||
// uni.showLoading({
|
||||
@ -880,7 +862,7 @@ export default function (isPrompt = false) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
updatePopup(res, function () {
|
||||
updatePopup(res, function() {
|
||||
if (/\.wgt$/i.test(res.downloadUrl)) {
|
||||
getDownload(res);
|
||||
} else if (/\.html$/i.test(res.downloadUrl)) {
|
||||
|
29
utils/huawei_describe.js
Normal file
29
utils/huawei_describe.js
Normal file
@ -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正常使用'
|
||||
}
|
||||
}
|
@ -288,7 +288,8 @@ const clickFeedBack = (fn) => {
|
||||
}
|
||||
if (uni.getSystemInfoSync().platform == 'android') {
|
||||
// vibrateShort
|
||||
uni.vibrateLong({
|
||||
// uni.vibrateLong({
|
||||
uni.vibrateShort({
|
||||
success: () => {
|
||||
console.log('点击震动');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user