4.0.0
This commit is contained in:
parent
4faa8cdb10
commit
0fb5844b6a
67
App.vue
67
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(() => {
|
||||
|
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 |
@ -1,48 +1,44 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="!isAllActionItemInvalid && !messageItem.hasRiskContent"
|
||||
ref="messageToolDom"
|
||||
:class="['dialog-item', !isPC ? 'dialog-item-h5' : 'dialog-item-web']"
|
||||
>
|
||||
<slot
|
||||
v-if="featureConfig.EmojiReaction"
|
||||
name="TUIEmojiPlugin"
|
||||
/>
|
||||
<div
|
||||
class="dialog-item-list"
|
||||
:class="!isPC ? 'dialog-item-list-h5' : 'dialog-item-list-web'"
|
||||
>
|
||||
<template v-for="(item, index) in actionItems">
|
||||
<div
|
||||
v-if="item.renderCondition()"
|
||||
:key="item.key"
|
||||
class="list-item"
|
||||
@click="getFunction(index)"
|
||||
@mousedown="beforeCopy(item.key)"
|
||||
>
|
||||
<Icon
|
||||
:file="item.iconUrl"
|
||||
:size="'15px'"
|
||||
/>
|
||||
<span class="list-item-text">{{ item.text }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
v-if="!isAllActionItemInvalid && !messageItem.hasRiskContent"
|
||||
ref="messageToolDom"
|
||||
:class="['dialog-item', !isPC ? 'dialog-item-h5' : 'dialog-item-web']"
|
||||
>
|
||||
<slot
|
||||
v-if="featureConfig.EmojiReaction"
|
||||
name="TUIEmojiPlugin"
|
||||
/>
|
||||
<div
|
||||
class="dialog-item-list"
|
||||
:class="!isPC ? 'dialog-item-list-h5' : 'dialog-item-list-web'"
|
||||
>
|
||||
<template v-for="(item, index) in actionItems">
|
||||
<div
|
||||
v-if="item.renderCondition()"
|
||||
:key="item.key"
|
||||
class="list-item"
|
||||
@click="getFunction(index)"
|
||||
@mousedown="beforeCopy(item.key)"
|
||||
>
|
||||
<Icon
|
||||
:file="item.iconUrl"
|
||||
:size="'15px'"
|
||||
/>
|
||||
<span class="list-item-text">{{ item.text }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</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';
|
||||
@ -62,365 +58,384 @@ import CopyManager from '../../utils/copy';
|
||||
// #endif
|
||||
|
||||
interface IProps {
|
||||
messageItem: IMessageModel;
|
||||
isMultipleSelectMode: boolean;
|
||||
messageItem: IMessageModel;
|
||||
isMultipleSelectMode: boolean;
|
||||
}
|
||||
|
||||
interface IEmits {
|
||||
(key: 'toggleMultipleSelectMode'): void;
|
||||
(key: 'toggleMultipleSelectMode'): void;
|
||||
}
|
||||
|
||||
const emits = defineEmits<IEmits>();
|
||||
const props = withDefaults(defineProps<IProps>(), {
|
||||
isMultipleSelectMode: false,
|
||||
messageItem: () => ({}) as IMessageModel,
|
||||
isMultipleSelectMode: false,
|
||||
messageItem: () => ({} as IMessageModel)
|
||||
});
|
||||
const featureConfig = TUIChatConfig.getFeatureConfig();
|
||||
|
||||
const TYPES = TUIChatEngine.TYPES;
|
||||
|
||||
const actionItems = ref([
|
||||
{
|
||||
key: 'open',
|
||||
text: TUITranslateService.t('TUIChat.打开'),
|
||||
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);
|
||||
},
|
||||
clickEvent: openMessage,
|
||||
},
|
||||
{
|
||||
key: 'copy',
|
||||
text: TUITranslateService.t('TUIChat.复制'),
|
||||
iconUrl: copyIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.CopyMessage || !message.value) return false;
|
||||
return message.value.type === TYPES.MSG_TEXT;
|
||||
},
|
||||
clickEvent: copyMessage,
|
||||
},
|
||||
{
|
||||
key: 'revoke',
|
||||
text: TUITranslateService.t('TUIChat.撤回'),
|
||||
iconUrl: revokeIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.RevokeMessage || !message.value) return false;
|
||||
return message.value.flow === 'out' && message.value.status === 'success';
|
||||
},
|
||||
clickEvent: revokeMessage,
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
text: TUITranslateService.t('TUIChat.删除'),
|
||||
iconUrl: delIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.DeleteMessage || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: deleteMessage,
|
||||
},
|
||||
{
|
||||
key: 'forward',
|
||||
text: TUITranslateService.t('TUIChat.转发'),
|
||||
iconUrl: forwardIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.ForwardMessage || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: forwardSingleMessage,
|
||||
},
|
||||
{
|
||||
key: 'quote',
|
||||
text: TUITranslateService.t('TUIChat.引用'),
|
||||
iconUrl: quoteIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.QuoteMessage || !message.value) return false;
|
||||
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,
|
||||
},
|
||||
{
|
||||
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: 'multi-select',
|
||||
text: TUITranslateService.t('TUIChat.多选'),
|
||||
iconUrl: multipleSelectIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.MultiSelection || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: multipleSelectMessage,
|
||||
},
|
||||
{
|
||||
key: 'open',
|
||||
text: TUITranslateService.t('TUIChat.打开'),
|
||||
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);
|
||||
},
|
||||
clickEvent: openMessage
|
||||
},
|
||||
{
|
||||
key: 'copy',
|
||||
text: TUITranslateService.t('TUIChat.复制'),
|
||||
iconUrl: copyIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.CopyMessage || !message.value) return false;
|
||||
return message.value.type === TYPES.MSG_TEXT;
|
||||
},
|
||||
clickEvent: copyMessage
|
||||
},
|
||||
{
|
||||
key: 'revoke',
|
||||
text: TUITranslateService.t('TUIChat.撤回'),
|
||||
iconUrl: revokeIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.RevokeMessage || !message.value) return false;
|
||||
return message.value.flow === 'out' && message.value.status === 'success';
|
||||
},
|
||||
clickEvent: revokeMessage
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
text: TUITranslateService.t('TUIChat.删除'),
|
||||
iconUrl: delIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.DeleteMessage || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: deleteMessage
|
||||
},
|
||||
{
|
||||
key: 'forward',
|
||||
text: TUITranslateService.t('TUIChat.转发'),
|
||||
iconUrl: forwardIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.ForwardMessage || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: forwardSingleMessage
|
||||
},
|
||||
{
|
||||
key: 'quote',
|
||||
text: TUITranslateService.t('TUIChat.引用'),
|
||||
iconUrl: quoteIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.QuoteMessage || !message.value) return false;
|
||||
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,
|
||||
// },
|
||||
// {
|
||||
// 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: '举报',
|
||||
visible: false,
|
||||
iconUrl: juBao,
|
||||
renderCondition() {
|
||||
if (!featureConfig.VoiceToText || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: toReport
|
||||
},
|
||||
{
|
||||
key: 'multi-select',
|
||||
text: TUITranslateService.t('TUIChat.多选'),
|
||||
iconUrl: multipleSelectIcon,
|
||||
renderCondition() {
|
||||
if (!featureConfig.MultiSelection || !message.value) return false;
|
||||
return message.value.status === 'success';
|
||||
},
|
||||
clickEvent: multipleSelectMessage
|
||||
}
|
||||
]);
|
||||
|
||||
const message = ref<IMessageModel>();
|
||||
const messageToolDom = ref<HTMLElement>();
|
||||
|
||||
onMounted(() => {
|
||||
TUIStore.watch(StoreName.CHAT, {
|
||||
translateTextInfo: onMessageTranslationInfoUpdated,
|
||||
voiceToTextInfo: onMessageConvertInfoUpdated,
|
||||
});
|
||||
TUIStore.watch(StoreName.CHAT, {
|
||||
translateTextInfo: onMessageTranslationInfoUpdated,
|
||||
voiceToTextInfo: onMessageConvertInfoUpdated
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
TUIStore.unwatch(StoreName.CHAT, {
|
||||
translateTextInfo: onMessageTranslationInfoUpdated,
|
||||
voiceToTextInfo: onMessageConvertInfoUpdated,
|
||||
});
|
||||
TUIStore.unwatch(StoreName.CHAT, {
|
||||
translateTextInfo: onMessageTranslationInfoUpdated,
|
||||
voiceToTextInfo: onMessageConvertInfoUpdated
|
||||
});
|
||||
});
|
||||
|
||||
watchEffect(() => {
|
||||
message.value = TUIStore.getMessageModel(props.messageItem.ID);
|
||||
message.value = TUIStore.getMessageModel(props.messageItem.ID);
|
||||
});
|
||||
|
||||
const isAllActionItemInvalid = computed(() => {
|
||||
for (let i = 0; i < actionItems.value.length; ++i) {
|
||||
if (actionItems.value[i].renderCondition()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
for (let i = 0; i < actionItems.value.length; ++i) {
|
||||
if (actionItems.value[i].renderCondition()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
function getFunction(index: number) {
|
||||
// Compatible with Vue2 and WeChat Mini Program syntax, dynamic binding is not allowed.
|
||||
actionItems.value[index].clickEvent();
|
||||
// Compatible with Vue2 and WeChat Mini Program syntax, dynamic binding is not allowed.
|
||||
actionItems.value[index].clickEvent();
|
||||
}
|
||||
|
||||
function openMessage() {
|
||||
let url = '';
|
||||
switch (message.value?.type) {
|
||||
case TUIChatEngine.TYPES.MSG_FILE:
|
||||
url = message.value.payload.fileUrl;
|
||||
break;
|
||||
case TUIChatEngine.TYPES.MSG_VIDEO:
|
||||
url = message.value.payload.remoteVideoUrl;
|
||||
break;
|
||||
case TUIChatEngine.TYPES.MSG_IMAGE:
|
||||
url = message.value.payload.imageInfoArray[0].url;
|
||||
break;
|
||||
}
|
||||
window?.open(url, '_blank');
|
||||
let url = '';
|
||||
switch (message.value?.type) {
|
||||
case TUIChatEngine.TYPES.MSG_FILE:
|
||||
url = message.value.payload.fileUrl;
|
||||
break;
|
||||
case TUIChatEngine.TYPES.MSG_VIDEO:
|
||||
url = message.value.payload.remoteVideoUrl;
|
||||
break;
|
||||
case TUIChatEngine.TYPES.MSG_IMAGE:
|
||||
url = message.value.payload.imageInfoArray[0].url;
|
||||
break;
|
||||
}
|
||||
window?.open(url, '_blank');
|
||||
}
|
||||
|
||||
function revokeMessage() {
|
||||
if (!message.value) return;
|
||||
const messageModel = TUIStore.getMessageModel(message.value.ID);
|
||||
messageModel
|
||||
.revokeMessage()
|
||||
.then(() => {
|
||||
enableSampleTaskStatus('revokeMessage');
|
||||
})
|
||||
.catch((error: any) => {
|
||||
// The message cannot be recalled after the time limit was reached, which is 2 minutes by default.
|
||||
if (error.code === 20016 || error.code === 10031) {
|
||||
const message = TUITranslateService.t('TUIChat.已过撤回时限');
|
||||
Toast({
|
||||
message,
|
||||
type: TOAST_TYPE.ERROR,
|
||||
});
|
||||
}
|
||||
});
|
||||
if (!message.value) return;
|
||||
const messageModel = TUIStore.getMessageModel(message.value.ID);
|
||||
messageModel
|
||||
.revokeMessage()
|
||||
.then(() => {
|
||||
enableSampleTaskStatus('revokeMessage');
|
||||
})
|
||||
.catch((error: any) => {
|
||||
// The message cannot be recalled after the time limit was reached, which is 2 minutes by default.
|
||||
if (error.code === 20016 || error.code === 10031) {
|
||||
const message = TUITranslateService.t('TUIChat.已过撤回时限');
|
||||
Toast({
|
||||
message,
|
||||
type: TOAST_TYPE.ERROR
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deleteMessage() {
|
||||
if (!message.value) return;
|
||||
const messageModel = TUIStore.getMessageModel(message.value.ID);
|
||||
messageModel.deleteMessage();
|
||||
if (!message.value) return;
|
||||
const messageModel = TUIStore.getMessageModel(message.value.ID);
|
||||
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),
|
||||
});
|
||||
} else {
|
||||
// uni-app conditional compilation will not run the following code
|
||||
// #ifndef APP || APP-PLUS || MP || H5
|
||||
CopyManager.copySelection(message.value?.payload?.text);
|
||||
// #endif
|
||||
}
|
||||
if (isUniFrameWork) {
|
||||
TUIGlobal?.setClipboardData({
|
||||
data: transformTextWithKeysToEmojiNames(message.value?.payload?.text)
|
||||
});
|
||||
} else {
|
||||
// uni-app conditional compilation will not run the following code
|
||||
// #ifndef APP || APP-PLUS || MP || H5
|
||||
CopyManager.copySelection(message.value?.payload?.text);
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
|
||||
function beforeCopy(key: string) {
|
||||
// only pc support copy selection or copy full message text
|
||||
// uni-app and h5 only support copy full message text
|
||||
if (key !== 'copy' || isH5) {
|
||||
return;
|
||||
}
|
||||
// only pc support copy selection or copy full message text
|
||||
// uni-app and h5 only support copy full message text
|
||||
if (key !== 'copy' || isH5) {
|
||||
return;
|
||||
}
|
||||
|
||||
// uni-app conditional compilation will not run the following code
|
||||
// #ifndef APP || APP-PLUS || MP || H5
|
||||
CopyManager.saveCurrentSelection();
|
||||
// #endif
|
||||
// uni-app conditional compilation will not run the following code
|
||||
// #ifndef APP || APP-PLUS || MP || H5
|
||||
CopyManager.saveCurrentSelection();
|
||||
// #endif
|
||||
}
|
||||
|
||||
function forwardSingleMessage() {
|
||||
if (!message.value) return;
|
||||
TUIStore.update(StoreName.CUSTOM, 'singleForwardMessageID', message.value.ID);
|
||||
if (!message.value) return;
|
||||
TUIStore.update(StoreName.CUSTOM, 'singleForwardMessageID', message.value.ID);
|
||||
}
|
||||
|
||||
function quoteMessage() {
|
||||
if (!message.value) return;
|
||||
message.value.quoteMessage();
|
||||
if (!message.value) return;
|
||||
message.value.quoteMessage();
|
||||
}
|
||||
|
||||
function translateMessage() {
|
||||
const enable = TUIStore.getData(StoreName.APP, 'enabledTranslationPlugin');
|
||||
if (!enable) {
|
||||
Toast({
|
||||
message: TUITranslateService.t('TUIChat.请开通翻译功能'),
|
||||
type: TOAST_TYPE.WARNING,
|
||||
});
|
||||
return;
|
||||
}
|
||||
const enable = TUIStore.getData(StoreName.APP, 'enabledTranslationPlugin');
|
||||
if (!enable) {
|
||||
Toast({
|
||||
message: TUITranslateService.t('TUIChat.请开通翻译功能'),
|
||||
type: TOAST_TYPE.WARNING
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!message.value) return;
|
||||
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,
|
||||
});
|
||||
if (!message.value) return;
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
function convertVoiceToText() {
|
||||
const enable = TUIStore.getData(StoreName.APP, 'enabledVoiceToText');
|
||||
if (!enable) {
|
||||
Toast({
|
||||
message: TUITranslateService.t('TUIChat.请开通语音转文字功能'),
|
||||
});
|
||||
return;
|
||||
}
|
||||
const enable = TUIStore.getData(StoreName.APP, 'enabledVoiceToText');
|
||||
if (!enable) {
|
||||
Toast({
|
||||
message: TUITranslateService.t('TUIChat.请开通语音转文字功能')
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!message.value) return;
|
||||
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,
|
||||
});
|
||||
if (!message.value) return;
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
function multipleSelectMessage() {
|
||||
emits('toggleMultipleSelectMode');
|
||||
emits('toggleMultipleSelectMode');
|
||||
}
|
||||
|
||||
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');
|
||||
for (let i = 0; i < translationInfoList.length; ++i) {
|
||||
const { messageID, visible } = translationInfoList[i];
|
||||
if (messageID === props.messageItem.ID) {
|
||||
actionItems.value[idx].text = TUITranslateService.t(visible ? 'TUIChat.隐藏' : 'TUIChat.翻译');
|
||||
actionItems.value[idx].visible = !!visible;
|
||||
return;
|
||||
}
|
||||
}
|
||||
actionItems.value[idx].text = TUITranslateService.t('TUIChat.翻译');
|
||||
if (info === undefined) return;
|
||||
const translationInfoList = info.get(props.messageItem.conversationID) || [];
|
||||
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) {
|
||||
actionItems.value[idx].text = TUITranslateService.t(visible ? 'TUIChat.隐藏' : 'TUIChat.翻译');
|
||||
actionItems.value[idx].visible = !!visible;
|
||||
return;
|
||||
}
|
||||
}
|
||||
actionItems.value[idx].text = TUITranslateService.t('TUIChat.翻译');
|
||||
}
|
||||
|
||||
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');
|
||||
for (let i = 0; i < convertInfoList.length; ++i) {
|
||||
const { messageID, visible } = convertInfoList[i];
|
||||
if (messageID === props.messageItem.ID) {
|
||||
actionItems.value[idx].text = TUITranslateService.t(visible ? 'TUIChat.隐藏' : 'TUIChat.转文字');
|
||||
actionItems.value[idx].visible = !!visible;
|
||||
return;
|
||||
}
|
||||
}
|
||||
actionItems.value[idx].text = TUITranslateService.t('TUIChat.转文字');
|
||||
if (info === undefined) return;
|
||||
const convertInfoList = info.get(props.messageItem.conversationID) || [];
|
||||
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) {
|
||||
actionItems.value[idx].text = TUITranslateService.t(visible ? 'TUIChat.隐藏' : 'TUIChat.转文字');
|
||||
actionItems.value[idx].visible = !!visible;
|
||||
return;
|
||||
}
|
||||
}
|
||||
actionItems.value[idx].text = TUITranslateService.t('TUIChat.转文字');
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
messageToolDom,
|
||||
messageToolDom
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import "../../../../assets/styles/common";
|
||||
@import '../../../../assets/styles/common';
|
||||
|
||||
.dialog-item-web {
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e0e0e0;
|
||||
padding: 12px 0;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #e0e0e0;
|
||||
padding: 12px 0;
|
||||
|
||||
.dialog-item-list {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
max-width: 280px;
|
||||
.dialog-item-list {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
max-width: 280px;
|
||||
|
||||
.list-item {
|
||||
padding: 4px 12px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
.list-item {
|
||||
padding: 4px 12px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
.list-item-text {
|
||||
padding-left: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 17px;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
}
|
||||
.list-item-text {
|
||||
padding-left: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 17px;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dialog-item-h5 {
|
||||
@extend .dialog-item-web;
|
||||
@extend .dialog-item-web;
|
||||
|
||||
padding: 0;
|
||||
padding: 0;
|
||||
|
||||
.dialog-item-list {
|
||||
margin: 10px;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
max-width: 280px;
|
||||
.dialog-item-list {
|
||||
margin: 10px;
|
||||
white-space: nowrap;
|
||||
flex-wrap: wrap;
|
||||
max-width: 280px;
|
||||
|
||||
.list-item {
|
||||
padding: 0 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: #4f4f4f;
|
||||
.list-item {
|
||||
padding: 0 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
color: #4f4f4f;
|
||||
|
||||
.list-item-text {
|
||||
padding-left: 0;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
}
|
||||
.list-item-text {
|
||||
padding-left: 0;
|
||||
color: #000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -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": "退出应用"
|
||||
},
|
||||
"styles": {
|
||||
"backgroundColor": "#ffffff",
|
||||
"borderRadius": "5px",
|
||||
"title": {
|
||||
"color": "#FF2C3C"
|
||||
},
|
||||
"buttonAccept": {
|
||||
"color": "#FF2C3C"
|
||||
},
|
||||
"buttonRefuse": {
|
||||
"color": "#545454"
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"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"
|
||||
},
|
||||
"buttonAccept" : {
|
||||
"color" : "#FF2C3C"
|
||||
},
|
||||
"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
|
||||
}
|
||||
},
|
||||
|
@ -1,54 +1,58 @@
|
||||
<template>
|
||||
<view class="prpage">
|
||||
<video
|
||||
class="prvideo"
|
||||
:style="{ height: screenSafeHeight + 'px' }"
|
||||
:src="videoUrl"
|
||||
autoplay="true"
|
||||
controls="true"
|
||||
:object-fit="objectFit"></video>
|
||||
</view>
|
||||
<view class="prpage">
|
||||
<video
|
||||
class="prvideo"
|
||||
:style="{ height: screenSafeHeight + 'px' }"
|
||||
:src="videoUrl"
|
||||
autoplay="true"
|
||||
controls="true"
|
||||
:object-fit="objectFit"
|
||||
></video>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
let system = uni.getSystemInfoSync();
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
videoUrl: "",
|
||||
objectFit: "fill",
|
||||
screenSafeHeight: system.safeArea.bottom,
|
||||
};
|
||||
},
|
||||
onLoad(params) {
|
||||
let me = this;
|
||||
let videoUrl = params.videoUrl;
|
||||
this.videoUrl = videoUrl;
|
||||
let width = parseInt(params.width);
|
||||
let height = parseInt(params.height);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
data() {
|
||||
return {
|
||||
videoUrl: '',
|
||||
objectFit: 'fill',
|
||||
screenSafeHeight: system.safeArea.bottom
|
||||
};
|
||||
},
|
||||
onLoad(params) {
|
||||
let me = this;
|
||||
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);
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
if (width >= height) {
|
||||
me.objectFit = "contain";
|
||||
} else {
|
||||
me.objectFit = "fill";
|
||||
}
|
||||
},
|
||||
methods: {},
|
||||
if (width >= height) {
|
||||
me.objectFit = 'contain';
|
||||
} else {
|
||||
me.objectFit = 'fill';
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.prpage {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: #181b27;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background-color: #181b27;
|
||||
}
|
||||
.prvideo {
|
||||
width: 750rpx;
|
||||
width: 750rpx;
|
||||
}
|
||||
</style>
|
||||
|
@ -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,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();
|
||||
|
File diff suppressed because it is too large
Load Diff
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