|
|
@ -0,0 +1,8 @@
|
|||
# 忽略依赖目录
|
||||
/node_modules/
|
||||
|
||||
# 忽略 UniApp 编译输出目录
|
||||
/unpackage/
|
||||
|
||||
# 忽略 VS Code 配置目录
|
||||
/.vscode/
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"version" : "1.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"playground" : "custom",
|
||||
"type" : "uni-app:app-ios"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -0,0 +1,216 @@
|
|||
<template>
|
||||
<view class="popup-picker" v-if="show">
|
||||
<!-- 遮罩层 -->
|
||||
<view
|
||||
class="popup-mask"
|
||||
v-if="show"
|
||||
:class="{ show: show }"
|
||||
@click="handleClose"
|
||||
></view>
|
||||
|
||||
<!-- 选择器内容 -->
|
||||
<view class="popup-content" :class="{ show: show }">
|
||||
<!-- 头部 -->
|
||||
<view class="popup-header">
|
||||
<text class="cancel" @click="handleClose">取消</text>
|
||||
<text class="title">{{ title }}</text>
|
||||
<text class="confirm" @click="handleConfirm">确定</text>
|
||||
</view>
|
||||
|
||||
<!-- 选择器 -->
|
||||
<picker-view
|
||||
:value="currentValue"
|
||||
@change="handleChange"
|
||||
class="picker-view"
|
||||
immediate-change
|
||||
>
|
||||
<picker-view-column v-for="(column, index) in columns" :key="index">
|
||||
<view
|
||||
class="picker-item"
|
||||
v-for="(item, itemIndex) in column"
|
||||
:key="item.id"
|
||||
>
|
||||
{{ item[labelKey] || item.title }}
|
||||
</view>
|
||||
</picker-view-column>
|
||||
</picker-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "PopupPicker",
|
||||
props: {
|
||||
// 是否显示
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
// 标题
|
||||
title: {
|
||||
type: String,
|
||||
default: "请选择",
|
||||
},
|
||||
// 选项数据
|
||||
columns: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
// 当前选中的值
|
||||
value: {
|
||||
type: Array,
|
||||
default: () => [0],
|
||||
},
|
||||
// 选项的标签字段
|
||||
labelKey: {
|
||||
type: String,
|
||||
default: "label",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentValue: this.value,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
handler(val) {
|
||||
console.log("selectedType.id", val);
|
||||
this.currentValue = val;
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
// 处理选择变化
|
||||
handleChange(e) {
|
||||
console.log(e.detail.value, "e.detail.value");
|
||||
this.currentValue = e.detail.value;
|
||||
},
|
||||
|
||||
// 处理关闭
|
||||
handleClose() {
|
||||
this.$emit("close");
|
||||
setTimeout(() => {
|
||||
this.show = false;
|
||||
}, 300);
|
||||
},
|
||||
|
||||
// 处理确认
|
||||
handleConfirm() {
|
||||
const selectedItems = this.columns;
|
||||
console.log(selectedItems, "selectedItems");
|
||||
if (this.currentValue[0] >= selectedItems[0].length) {
|
||||
this.currentValue = [0];
|
||||
}
|
||||
this.$emit("confirm", {
|
||||
value: this.currentValue[0],
|
||||
items: selectedItems[0],
|
||||
item: selectedItems[0][this.currentValue[0] || 0],
|
||||
});
|
||||
this.handleClose();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.popup-picker {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
/* 遮罩层 */
|
||||
.popup-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.popup-mask.show {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* 内容区 */
|
||||
.popup-content {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #ffffff;
|
||||
border-radius: 24rpx 24rpx 0 0;
|
||||
transform: translateY(-100%);
|
||||
opacity: 0;
|
||||
transition: all 0.3s ease;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.popup-content.show {
|
||||
transform: translateY(0);
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* 头部 */
|
||||
.popup-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 88rpx;
|
||||
padding: 0 32rpx;
|
||||
border-bottom: 1rpx solid #eeeeee;
|
||||
}
|
||||
|
||||
.cancel {
|
||||
font-size: 32rpx;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.confirm {
|
||||
font-size: 32rpx;
|
||||
color: #4080ff;
|
||||
}
|
||||
|
||||
/* 选择器 */
|
||||
.picker-view {
|
||||
width: 100%;
|
||||
height: 480rpx;
|
||||
}
|
||||
|
||||
.picker-item {
|
||||
line-height: 68rpx;
|
||||
text-align: center;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
/* 平台适配 */
|
||||
/* #ifdef H5 */
|
||||
.popup-content {
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
/* #ifdef MP-WEIXIN */
|
||||
.popup-content {
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
/* #endif */
|
||||
</style>
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
[appleAppid]
|
||||
appleAppid=cn.mrrsj
|
||||
|
||||
[iosStyle]
|
||||
iosStyle=
|
||||
|
||||
[universalLinks]
|
||||
universalLinks=https://app.mrrweb.com.cn/
|
||||
spaceid=mp-908e3a8e-a3ae-4a70-aaa7-545c9d98f662
|
||||
|
||||
[universalLinks_qq]
|
||||
universalLinks_qq=
|
||||
spaceid_qq=
|
||||
|
||||
[universalLinks_weibo]
|
||||
universalLinks_weibo=
|
||||
spaceid_weibo=
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
iosProfile=E:/sjsyrzs/sj/cs/mrrsj.mobileprovision
|
||||
ioscertFile=E:/sjsyrzs/sj/cs/cs.p12
|
||||
ioscertPassword=ep/Tdjka4Y7WYqDB6/S7dw==
|
||||
|
|
@ -1 +0,0 @@
|
|||
forceInstall
|
||||
|
|
@ -1 +0,0 @@
|
|||
forceInstall
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
import { UTSAndroid } from 'io.dcloud.uts';
|
||||
import Context from 'android.content.Context';
|
||||
import TIMPushManager from 'com.tencent.qcloud.tim.push.TIMPushManager';
|
||||
import TIMPushConfig from 'com.tencent.qcloud.tim.push.config.TIMPushConfig';
|
||||
import { PushCallbackOptions } from './push-callback-options.uts';
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
import PushCallback from './push-callback.uts';
|
||||
import PushListener from './push-listener.uts';
|
||||
|
||||
const context: Context | null = UTSAndroid.getAppContext();
|
||||
console.warn('Push | package.name:', context?.getPackageName());
|
||||
TIMPushConfig.getInstance().setRunningPlatform(2);
|
||||
const Push = TIMPushManager.getInstance();
|
||||
|
||||
export class EVENT {
|
||||
static MESSAGE_RECEIVED: string = 'message_received'
|
||||
static MESSAGE_REVOKED: string = 'message_revoked'
|
||||
static NOTIFICATION_CLICKED: string = 'notification_clicked'
|
||||
}
|
||||
|
||||
let disableNotification = false;
|
||||
export function disablePostNotificationInForeground(disable: boolean): void {
|
||||
console.log('Push | disablePostNotificationInForeground', disable);
|
||||
disableNotification = disable;
|
||||
Push.disablePostNotificationInForeground(disableNotification);
|
||||
}
|
||||
|
||||
export function registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void): void {
|
||||
if (SDKAppID == 0) {
|
||||
onError?.(9010001, 'Invalid SDKAppID');
|
||||
} else if (appKey == '') {
|
||||
onError?.(9010002, 'Invalid appKey');
|
||||
}
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'registerPush',
|
||||
success: (res?: any) => {
|
||||
Push.disablePostNotificationInForeground(disableNotification);
|
||||
// 强转下类型,避免类型推断错误
|
||||
let token: string = res as string;
|
||||
onSuccess(token);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
onError?.(errCode, errMsg);
|
||||
}
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.registerPush(context, SDKAppID.toInt(), appKey, new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function setRegistrationID(registrationID: string, onSuccess: () => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'setRegistrationID',
|
||||
success: (res?: any) => {
|
||||
onSuccess();
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
}
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.setRegistrationID(registrationID, new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function getRegistrationID(onSuccess: (registrationID: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'getRegistrationID',
|
||||
success: (res?: any) => {
|
||||
// 强转下类型,避免类型推断错误
|
||||
let registrationID: string = res as string;
|
||||
onSuccess(registrationID);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
}
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.getRegistrationID(new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function unRegisterPush(onSuccess: () => void, onError?: (errCode: number, errMsg: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'unRegisterPush',
|
||||
success: (res?: any) => {
|
||||
onSuccess();
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
},
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.unRegisterPush(new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function createNotificationChannel(options: any, onSuccess: (extInfo: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'createNotificationChannel',
|
||||
success: (res?: any) => {
|
||||
let ret: string = res as string;
|
||||
onSuccess(ret);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
},
|
||||
};
|
||||
Push.callExperimentalAPI('createNotificationChannel', JSON.stringify(options), new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function getNotificationExtInfo(onSuccess: (extInfo: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'getNotificationExtInfo',
|
||||
success: (res?: any) => {
|
||||
let ret: string = res as string;
|
||||
onSuccess(ret);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
},
|
||||
};
|
||||
Push.callExperimentalAPI('getNotificationExtInfo', null, new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
const listenerMap = new Map<string, Array<(res: any) => void>>();
|
||||
|
||||
const pushListenerOptions: PushListenerOptions = {
|
||||
listener: (eventName: string, data: any) => {
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
item(data);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const pushListener = new PushListener(pushListenerOptions);
|
||||
|
||||
@UTSJS.keepAlive
|
||||
export function addPushListener(eventName: string, listener: (res: any) => void): void {
|
||||
if(listenerMap.size === 0) {
|
||||
Push.addPushListener(pushListener);
|
||||
}
|
||||
const listeners:Array<(res: any) => void> = [listener];
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
listeners.push(item);
|
||||
})
|
||||
listenerMap.set(eventName, listeners);
|
||||
}
|
||||
|
||||
|
||||
export function removePushListener(eventName: string, listener?: (res: any) => void): void {
|
||||
listenerMap.delete(eventName);
|
||||
if(listenerMap.size === 0) {
|
||||
Push.removePushListener(pushListener);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
export type PushCallbackOptions = {
|
||||
apiName: string
|
||||
success: (res?: any) => void
|
||||
fail: (errCode: number, errMsg: string) => void
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
import TIMPushCallback from 'com.tencent.qcloud.tim.push.TIMPushCallback';
|
||||
import { PushCallbackOptions } from './push-callback-options.uts';
|
||||
|
||||
const LOG_PREFIX: string = 'Push |';
|
||||
export default class PushCallback implements TIMPushCallback<any> {
|
||||
private apiName: string;
|
||||
private success: (data?: any) => void;
|
||||
private fail: (errCode: number, errMsg: string) => void;
|
||||
|
||||
constructor(options: PushCallbackOptions) {
|
||||
this.apiName = options.apiName;
|
||||
this.success = options.success;
|
||||
this.fail = options.fail;
|
||||
}
|
||||
|
||||
override onSuccess(data?: any) {
|
||||
console.log(`${LOG_PREFIX} ${this.apiName} ok, data:`, data);
|
||||
if (data == null) {
|
||||
this.success?.('');
|
||||
} else {
|
||||
this.success?.(data);
|
||||
}
|
||||
}
|
||||
|
||||
override onError(errCode: Int, errMsg: string, data?: any) {
|
||||
this.fail?.(errCode as number, errMsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export type PushListenerOptions = {
|
||||
listener: (eventType: string, data: any) => void
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import TIMPushListener from 'com.tencent.qcloud.tim.push.TIMPushListener';
|
||||
import TIMPushMessage from 'com.tencent.qcloud.tim.push.TIMPushMessage';
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
|
||||
const LOG_PREFIX: string = 'Push | PushListener';
|
||||
export default class PushListener implements TIMPushListener {
|
||||
private listener: (eventType: string, data: any) => void;
|
||||
|
||||
constructor(options: PushListenerOptions) {
|
||||
this.listener = options.listener;
|
||||
console.log(`${LOG_PREFIX} ok`);
|
||||
}
|
||||
|
||||
override onRecvPushMessage(message: TIMPushMessage) {
|
||||
this.listener('message_received', { data: message });
|
||||
}
|
||||
|
||||
override onRevokePushMessage(messageID: string) {
|
||||
this.listener('message_revoked', { data: messageID });
|
||||
}
|
||||
|
||||
override onNotificationClicked(ext: string) {
|
||||
this.listener('notification_clicked', { data: ext });
|
||||
}
|
||||
}
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
import { TIMPushManager } from "TIMPush"
|
||||
import { NSObject } from "DCloudUTSFoundation"
|
||||
import PushListener from './push-listener.uts'
|
||||
import { PushListenerOptions } from './push-listener-options.uts'
|
||||
|
||||
const LOG_PREFIX = 'Push |';
|
||||
|
||||
export class EVENT {
|
||||
static MESSAGE_RECEIVED: string = 'message_received'
|
||||
static MESSAGE_REVOKED: string = 'message_revoked'
|
||||
static NOTIFICATION_CLICKED: string = 'notification_clicked'
|
||||
}
|
||||
|
||||
function setRunningPlatform(): void {
|
||||
console.log(LOG_PREFIX, 'setRunningPlatform');
|
||||
const param = new NSString("{\"runningPlatform\":2}");
|
||||
TIMPushManager.callExperimentalAPI('setPushConfig', param = param, succ = (ext?: NSObject): void => {
|
||||
let platform: string = ext as string;
|
||||
console.log(LOG_PREFIX, 'setRunningPlatform ok. platform:', platform);
|
||||
}, fail = (code?: Int32 ,desc?:String): void => {
|
||||
console.log(LOG_PREFIX, `setRunningPlatform fail. code: ${code}, desc: ${desc}`);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
let disableNotification = false;
|
||||
|
||||
export function disablePostNotificationInForeground(_disable: boolean): void {
|
||||
console.log(LOG_PREFIX, 'disablePostNotificationInForeground', _disable);
|
||||
disableNotification = _disable;
|
||||
TIMPushManager.disablePostNotificationInForeground(disable = disableNotification);
|
||||
}
|
||||
|
||||
export function registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void): void {
|
||||
if (SDKAppID == 0) {
|
||||
onError?.(9010001, 'Invalid SDKAppID');
|
||||
} else if (appKey == '') {
|
||||
onError?.(9010002, 'Invalid appKey');
|
||||
}
|
||||
setRunningPlatform();
|
||||
TIMPushManager.registerPush(SDKAppID.toInt32(), appKey = appKey, succ = (deviceToken?: Data): void => {
|
||||
TIMPushManager.disablePostNotificationInForeground(disable = disableNotification);
|
||||
console.log('devicetoken ->', deviceToken, deviceToken?.count);
|
||||
onSuccess('');
|
||||
}, fail = (code?: Int32 ,desc?:String): void => {
|
||||
onError?.(code as number, desc as string);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function unRegisterPush(onSuccess: () => void, onError: (errCode: number, errMsg: string) => void): void {
|
||||
TIMPushManager.unRegisterPush((): void => {
|
||||
onSuccess();
|
||||
}, fail = (code?: Int32 ,desc?:String): void => {
|
||||
onError(code as number, desc as string);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function setRegistrationID(registrationID: string, onSuccess: () => void): void {
|
||||
console.log(LOG_PREFIX, 'setRegistrationID', `registrationID:${registrationID}`);
|
||||
TIMPushManager.setRegistrationID(registrationID, callback = (): void => {
|
||||
console.log(LOG_PREFIX, 'setRegistrationID ok');
|
||||
onSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
export function getRegistrationID(onSuccess: (registrationID: string) => void): void {
|
||||
TIMPushManager.getRegistrationID((value ?: string): void => {
|
||||
// 这里需要转一下,否则会有问题
|
||||
let ret: string = value as string;
|
||||
onSuccess(ret);
|
||||
});
|
||||
}
|
||||
|
||||
export function createNotificationChannel(options: any, onSuccess: (data: string) => void): void {
|
||||
// 空实现
|
||||
}
|
||||
|
||||
// 注意!!!这里的 extInfo 不能写成 ext,否则会跟内部的 ext?:NSObject 有冲突;也不能写成 extension,否则会导致编译错误
|
||||
export function getNotificationExtInfo(onSuccess: (extInfo: string) => void): void {
|
||||
console.log(LOG_PREFIX, 'getNotificationExtInfo');
|
||||
TIMPushManager.callExperimentalAPI('getNotificationExtInfo', param = {}, succ = (ext?: NSObject): void => {
|
||||
let str: string = ext as string;
|
||||
console.log(LOG_PREFIX, 'getNotificationExtInfo ok. ext:', str);
|
||||
onSuccess(str);
|
||||
}, fail = (code?: Int32 ,desc?:String): void => {
|
||||
// 空实现
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const listenerMap = new Map<string, Array<(res: any) => void>>();
|
||||
|
||||
const pushListenerOptions: PushListenerOptions = {
|
||||
listener: (eventName: string, data: any) => {
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
item(data);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const pushListener = new PushListener(pushListenerOptions);
|
||||
|
||||
@UTSJS.keepAlive
|
||||
export function addPushListener(eventName: string, _listener: (res: any) => void): void {
|
||||
console.log(LOG_PREFIX, 'addPushListener', eventName);
|
||||
if(listenerMap.size === 0) {
|
||||
TIMPushManager.addPushListener(listener = pushListener);
|
||||
}
|
||||
const listeners:Array<(res: any) => void> = [_listener];
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
listeners.push(item);
|
||||
})
|
||||
listenerMap.set(eventName, listeners);
|
||||
}
|
||||
|
||||
export function removePushListener(eventName: string, _listener?: (res: any) => void): void {
|
||||
console.log(LOG_PREFIX, 'removePushListener', eventName);
|
||||
listenerMap.delete(eventName);
|
||||
if(listenerMap.size === 0) {
|
||||
TIMPushManager.removePushListener(listener = pushListener);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export type PushListenerOptions = {
|
||||
listener: (eventType: string, data: any) => void
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import { TIMPushListener, TIMPushMessage} from "TIMPush"
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
|
||||
const LOG_PREFIX: string = 'Push | PushListener';
|
||||
export default class PushListener implements TIMPushListener {
|
||||
private listener: (eventType: string, data: any) => void;
|
||||
|
||||
constructor(options: PushListenerOptions) {
|
||||
this.listener = options.listener;
|
||||
console.log(`${LOG_PREFIX} ok`);
|
||||
}
|
||||
|
||||
onRecvPushMessage(message: TIMPushMessage) {
|
||||
this.listener('message_received', { data: message });
|
||||
}
|
||||
|
||||
onRevokePushMessage(messageID: string) {
|
||||
this.listener('message_revoked', { data: messageID });
|
||||
}
|
||||
|
||||
onNotificationClicked(ext: string) {
|
||||
this.listener('notification_clicked', { data: ext });
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
export interface Push {
|
||||
setRegistrationID(registrationID: string, onSuccess: () => void): void,
|
||||
registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void): void,
|
||||
getRegistrationID(onSuccess: (registrationID: string) => void): void,
|
||||
unRegisterPush(onSuccess: () => void, onError?: (errCode: number, errMsg: string) => void): void,
|
||||
getNotificationExtInfo(onSuccess: (extInfo: string) => void): void
|
||||
addPushListener(eventName: string, listener: (res: any) => void): void
|
||||
removePushListener(eventName: string, listener?: (res: any) => void): void
|
||||
disablePostNotificationInForeground(disable: boolean): void
|
||||
createNotificationChannel(options: any, onSuccess: (data: string) => void): void
|
||||
}
|
||||
|
||||
export type SetRegistrationID = (registrationID: string, onSuccess: () => void) => void;
|
||||
export type RegisterPush = (SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void) => void;
|
||||
export type GetRegistrationID = (onSuccess: (registrationID: string) => void) => void;
|
||||
export type UnRegisterPush = (onSuccess: () => void, onError?: (errCode: number, errMsg: string) => void) => void;
|
||||
export type GetNotificationExtInfo = (onSuccess: (extInfo: string) => void) => void;
|
||||
export type AddPushListener = (eventName: string, listener: (res: any) => void) => void;
|
||||
export type RemovePushListener = (eventName: string, listener?: (res: any) => void) => void;
|
||||
export type DisablePostNotificationInForeground = (disable: boolean) => void;
|
||||
export type CreateNotificationChannel = (options: any, onSuccess: (data: string) => void) => void;
|
||||
export enum EVENT {
|
||||
MESSAGE_RECEIVED = 'message_received',
|
||||
MESSAGE_REVOKED = 'message_revoked',
|
||||
NOTIFICATION_CLICKED = 'notification_clicked'
|
||||
}
|
||||
|
|
@ -1,152 +0,0 @@
|
|||
import { UTSAndroid } from 'io.dcloud.uts';
|
||||
import Context from 'android.content.Context';
|
||||
import TIMPushManager from 'com.tencent.qcloud.tim.push.TIMPushManager';
|
||||
import TIMPushConfig from 'com.tencent.qcloud.tim.push.config.TIMPushConfig';
|
||||
import { PushCallbackOptions } from './push-callback-options.uts';
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
import PushCallback from './push-callback.uts';
|
||||
import PushListener from './push-listener.uts';
|
||||
|
||||
const context: Context | null = UTSAndroid.getAppContext();
|
||||
console.warn('Push | package.name:', context?.getPackageName());
|
||||
TIMPushConfig.getInstance().setRunningPlatform(2);
|
||||
const Push = TIMPushManager.getInstance();
|
||||
|
||||
export class EVENT {
|
||||
static MESSAGE_RECEIVED: string = 'message_received'
|
||||
static MESSAGE_REVOKED: string = 'message_revoked'
|
||||
static NOTIFICATION_CLICKED: string = 'notification_clicked'
|
||||
}
|
||||
|
||||
let disableNotification = false;
|
||||
export function disablePostNotificationInForeground(disable: boolean): void {
|
||||
console.log('Push | disablePostNotificationInForeground', disable);
|
||||
disableNotification = disable;
|
||||
Push.disablePostNotificationInForeground(disableNotification);
|
||||
}
|
||||
|
||||
export function registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void): void {
|
||||
if (SDKAppID == 0) {
|
||||
onError?.(9010001, 'Invalid SDKAppID');
|
||||
} else if (appKey == '') {
|
||||
onError?.(9010002, 'Invalid appKey');
|
||||
}
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'registerPush',
|
||||
success: (res?: any) => {
|
||||
Push.disablePostNotificationInForeground(disableNotification);
|
||||
// 强转下类型,避免类型推断错误
|
||||
let token: string = res as string;
|
||||
onSuccess(token);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
onError?.(errCode, errMsg);
|
||||
}
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.registerPush(context, SDKAppID.toInt(), appKey, new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function setRegistrationID(registrationID: string, onSuccess: () => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'setRegistrationID',
|
||||
success: (res?: any) => {
|
||||
onSuccess();
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
}
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.setRegistrationID(registrationID, new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function getRegistrationID(onSuccess: (registrationID: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'getRegistrationID',
|
||||
success: (res?: any) => {
|
||||
// 强转下类型,避免类型推断错误
|
||||
let registrationID: string = res as string;
|
||||
onSuccess(registrationID);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
}
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.getRegistrationID(new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function unRegisterPush(onSuccess: () => void, onError?: (errCode: number, errMsg: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'unRegisterPush',
|
||||
success: (res?: any) => {
|
||||
onSuccess();
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
},
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.unRegisterPush(new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function createNotificationChannel(options: any, onSuccess: (extInfo: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'createNotificationChannel',
|
||||
success: (res?: any) => {
|
||||
let ret: string = res as string;
|
||||
onSuccess(ret);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
},
|
||||
};
|
||||
Push.callExperimentalAPI('createNotificationChannel', JSON.stringify(options), new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
export function getNotificationExtInfo(onSuccess: (extInfo: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'getNotificationExtInfo',
|
||||
success: (res?: any) => {
|
||||
let ret: string = res as string;
|
||||
onSuccess(ret);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
},
|
||||
};
|
||||
Push.callExperimentalAPI('getNotificationExtInfo', null, new PushCallback(pushCbOptions));
|
||||
}
|
||||
|
||||
const listenerMap = new Map<string, Array<(res: any) => void>>();
|
||||
|
||||
const pushListenerOptions: PushListenerOptions = {
|
||||
listener: (eventName: string, data: any) => {
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
item(data);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const pushListener = new PushListener(pushListenerOptions);
|
||||
|
||||
@UTSJS.keepAlive
|
||||
export function addPushListener(eventName: string, listener: (res: any) => void): void {
|
||||
if(listenerMap.size === 0) {
|
||||
Push.addPushListener(pushListener);
|
||||
}
|
||||
const listeners:Array<(res: any) => void> = [listener];
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
listeners.push(item);
|
||||
})
|
||||
listenerMap.set(eventName, listeners);
|
||||
}
|
||||
|
||||
|
||||
export function removePushListener(eventName: string, listener?: (res: any) => void): void {
|
||||
listenerMap.delete(eventName);
|
||||
if(listenerMap.size === 0) {
|
||||
Push.removePushListener(pushListener);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
export type PushCallbackOptions = {
|
||||
apiName: string
|
||||
success: (res?: any) => void
|
||||
fail: (errCode: number, errMsg: string) => void
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
import TIMPushCallback from 'com.tencent.qcloud.tim.push.TIMPushCallback';
|
||||
import { PushCallbackOptions } from './push-callback-options.uts';
|
||||
|
||||
const LOG_PREFIX: string = 'Push |';
|
||||
export default class PushCallback implements TIMPushCallback<any> {
|
||||
private apiName: string;
|
||||
private success: (data?: any) => void;
|
||||
private fail: (errCode: number, errMsg: string) => void;
|
||||
|
||||
constructor(options: PushCallbackOptions) {
|
||||
this.apiName = options.apiName;
|
||||
this.success = options.success;
|
||||
this.fail = options.fail;
|
||||
}
|
||||
|
||||
override onSuccess(data?: any) {
|
||||
console.log(`${LOG_PREFIX} ${this.apiName} ok, data:`, data);
|
||||
if (data == null) {
|
||||
this.success?.('');
|
||||
} else {
|
||||
this.success?.(data);
|
||||
}
|
||||
}
|
||||
|
||||
override onError(errCode: Int, errMsg: string, data?: any) {
|
||||
this.fail?.(errCode as number, errMsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export type PushListenerOptions = {
|
||||
listener: (eventType: string, data: any) => void
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import TIMPushListener from 'com.tencent.qcloud.tim.push.TIMPushListener';
|
||||
import TIMPushMessage from 'com.tencent.qcloud.tim.push.TIMPushMessage';
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
|
||||
const LOG_PREFIX: string = 'Push | PushListener';
|
||||
export default class PushListener implements TIMPushListener {
|
||||
private listener: (eventType: string, data: any) => void;
|
||||
|
||||
constructor(options: PushListenerOptions) {
|
||||
this.listener = options.listener;
|
||||
console.log(`${LOG_PREFIX} ok`);
|
||||
}
|
||||
|
||||
override onRecvPushMessage(message: TIMPushMessage) {
|
||||
this.listener('message_received', { data: message });
|
||||
}
|
||||
|
||||
override onRevokePushMessage(messageID: string) {
|
||||
this.listener('message_revoked', { data: messageID });
|
||||
}
|
||||
|
||||
override onNotificationClicked(ext: string) {
|
||||
this.listener('notification_clicked', { data: ext });
|
||||
}
|
||||
}
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
import { TIMPushManager } from "TIMPush"
|
||||
import { NSObject } from "DCloudUTSFoundation"
|
||||
import PushListener from './push-listener.uts'
|
||||
import { PushListenerOptions } from './push-listener-options.uts'
|
||||
|
||||
const LOG_PREFIX = 'Push |';
|
||||
|
||||
export class EVENT {
|
||||
static MESSAGE_RECEIVED: string = 'message_received'
|
||||
static MESSAGE_REVOKED: string = 'message_revoked'
|
||||
static NOTIFICATION_CLICKED: string = 'notification_clicked'
|
||||
}
|
||||
|
||||
function setRunningPlatform(): void {
|
||||
console.log(LOG_PREFIX, 'setRunningPlatform');
|
||||
const param = new NSString("{\"runningPlatform\":2}");
|
||||
TIMPushManager.callExperimentalAPI('setPushConfig', param = param, succ = (ext?: NSObject): void => {
|
||||
let platform: string = ext as string;
|
||||
console.log(LOG_PREFIX, 'setRunningPlatform ok. platform:', platform);
|
||||
}, fail = (code?: Int32 ,desc?:String): void => {
|
||||
console.log(LOG_PREFIX, `setRunningPlatform fail. code: ${code}, desc: ${desc}`);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
let disableNotification = false;
|
||||
|
||||
export function disablePostNotificationInForeground(_disable: boolean): void {
|
||||
console.log(LOG_PREFIX, 'disablePostNotificationInForeground', _disable);
|
||||
disableNotification = _disable;
|
||||
TIMPushManager.disablePostNotificationInForeground(disable = disableNotification);
|
||||
}
|
||||
|
||||
export function registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void): void {
|
||||
if (SDKAppID == 0) {
|
||||
onError?.(9010001, 'Invalid SDKAppID');
|
||||
} else if (appKey == '') {
|
||||
onError?.(9010002, 'Invalid appKey');
|
||||
}
|
||||
setRunningPlatform();
|
||||
TIMPushManager.registerPush(SDKAppID.toInt32(), appKey = appKey, succ = (deviceToken?: Data): void => {
|
||||
TIMPushManager.disablePostNotificationInForeground(disable = disableNotification);
|
||||
console.log('devicetoken ->', deviceToken, deviceToken?.count);
|
||||
onSuccess('');
|
||||
}, fail = (code?: Int32 ,desc?:String): void => {
|
||||
onError?.(code as number, desc as string);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function unRegisterPush(onSuccess: () => void, onError: (errCode: number, errMsg: string) => void): void {
|
||||
TIMPushManager.unRegisterPush((): void => {
|
||||
onSuccess();
|
||||
}, fail = (code?: Int32 ,desc?:String): void => {
|
||||
onError(code as number, desc as string);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
export function setRegistrationID(registrationID: string, onSuccess: () => void): void {
|
||||
console.log(LOG_PREFIX, 'setRegistrationID', `registrationID:${registrationID}`);
|
||||
TIMPushManager.setRegistrationID(registrationID, callback = (): void => {
|
||||
console.log(LOG_PREFIX, 'setRegistrationID ok');
|
||||
onSuccess();
|
||||
});
|
||||
}
|
||||
|
||||
export function getRegistrationID(onSuccess: (registrationID: string) => void): void {
|
||||
TIMPushManager.getRegistrationID((value ?: string): void => {
|
||||
// 这里需要转一下,否则会有问题
|
||||
let ret: string = value as string;
|
||||
onSuccess(ret);
|
||||
});
|
||||
}
|
||||
|
||||
export function createNotificationChannel(options: any, onSuccess: (data: string) => void): void {
|
||||
// 空实现
|
||||
}
|
||||
|
||||
// 注意!!!这里的 extInfo 不能写成 ext,否则会跟内部的 ext?:NSObject 有冲突;也不能写成 extension,否则会导致编译错误
|
||||
export function getNotificationExtInfo(onSuccess: (extInfo: string) => void): void {
|
||||
console.log(LOG_PREFIX, 'getNotificationExtInfo');
|
||||
TIMPushManager.callExperimentalAPI('getNotificationExtInfo', param = {}, succ = (ext?: NSObject): void => {
|
||||
let str: string = ext as string;
|
||||
console.log(LOG_PREFIX, 'getNotificationExtInfo ok. ext:', str);
|
||||
onSuccess(str);
|
||||
}, fail = (code?: Int32 ,desc?:String): void => {
|
||||
// 空实现
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const listenerMap = new Map<string, Array<(res: any) => void>>();
|
||||
|
||||
const pushListenerOptions: PushListenerOptions = {
|
||||
listener: (eventName: string, data: any) => {
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
item(data);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
const pushListener = new PushListener(pushListenerOptions);
|
||||
|
||||
@UTSJS.keepAlive
|
||||
export function addPushListener(eventName: string, _listener: (res: any) => void): void {
|
||||
console.log(LOG_PREFIX, 'addPushListener', eventName);
|
||||
if(listenerMap.size === 0) {
|
||||
TIMPushManager.addPushListener(listener = pushListener);
|
||||
}
|
||||
const listeners:Array<(res: any) => void> = [_listener];
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
listeners.push(item);
|
||||
})
|
||||
listenerMap.set(eventName, listeners);
|
||||
}
|
||||
|
||||
export function removePushListener(eventName: string, _listener?: (res: any) => void): void {
|
||||
console.log(LOG_PREFIX, 'removePushListener', eventName);
|
||||
listenerMap.delete(eventName);
|
||||
if(listenerMap.size === 0) {
|
||||
TIMPushManager.removePushListener(listener = pushListener);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export type PushListenerOptions = {
|
||||
listener: (eventType: string, data: any) => void
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
import { TIMPushListener, TIMPushMessage} from "TIMPush"
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
|
||||
const LOG_PREFIX: string = 'Push | PushListener';
|
||||
export default class PushListener implements TIMPushListener {
|
||||
private listener: (eventType: string, data: any) => void;
|
||||
|
||||
constructor(options: PushListenerOptions) {
|
||||
this.listener = options.listener;
|
||||
console.log(`${LOG_PREFIX} ok`);
|
||||
}
|
||||
|
||||
onRecvPushMessage(message: TIMPushMessage) {
|
||||
this.listener('message_received', { data: message });
|
||||
}
|
||||
|
||||
onRevokePushMessage(messageID: string) {
|
||||
this.listener('message_revoked', { data: messageID });
|
||||
}
|
||||
|
||||
onNotificationClicked(ext: string) {
|
||||
this.listener('notification_clicked', { data: ext });
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
export interface Push {
|
||||
setRegistrationID(registrationID: string, onSuccess: () => void): void,
|
||||
registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void): void,
|
||||
getRegistrationID(onSuccess: (registrationID: string) => void): void,
|
||||
unRegisterPush(onSuccess: () => void, onError?: (errCode: number, errMsg: string) => void): void,
|
||||
getNotificationExtInfo(onSuccess: (extInfo: string) => void): void
|
||||
addPushListener(eventName: string, listener: (res: any) => void): void
|
||||
removePushListener(eventName: string, listener?: (res: any) => void): void
|
||||
disablePostNotificationInForeground(disable: boolean): void
|
||||
createNotificationChannel(options: any, onSuccess: (data: string) => void): void
|
||||
}
|
||||
|
||||
export type SetRegistrationID = (registrationID: string, onSuccess: () => void) => void;
|
||||
export type RegisterPush = (SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void) => void;
|
||||
export type GetRegistrationID = (onSuccess: (registrationID: string) => void) => void;
|
||||
export type UnRegisterPush = (onSuccess: () => void, onError?: (errCode: number, errMsg: string) => void) => void;
|
||||
export type GetNotificationExtInfo = (onSuccess: (extInfo: string) => void) => void;
|
||||
export type AddPushListener = (eventName: string, listener: (res: any) => void) => void;
|
||||
export type RemovePushListener = (eventName: string, listener?: (res: any) => void) => void;
|
||||
export type DisablePostNotificationInForeground = (disable: boolean) => void;
|
||||
export type CreateNotificationChannel = (options: any, onSuccess: (data: string) => void) => void;
|
||||
export enum EVENT {
|
||||
MESSAGE_RECEIVED = 'message_received',
|
||||
MESSAGE_REVOKED = 'message_revoked',
|
||||
NOTIFICATION_CLICKED = 'notification_clicked'
|
||||
}
|
||||
|
|
@ -1,138 +0,0 @@
|
|||
import { UTSAndroid } from 'io.dcloud.uts';
|
||||
import Context from 'android.content.Context';
|
||||
import TIMPushManager from 'com.tencent.qcloud.tim.push.TIMPushManager';
|
||||
import TIMPushConfig from 'com.tencent.qcloud.tim.push.config.TIMPushConfig';
|
||||
import { PushCallbackOptions } from './push-callback-options.uts';
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
import PushCallback from './push-callback.uts';
|
||||
import PushListener from './push-listener.uts';
|
||||
const context: Context | null = UTSAndroid.getAppContext();
|
||||
console.warn('Push | package.name:', context?.getPackageName());
|
||||
TIMPushConfig.getInstance().setRunningPlatform(2);
|
||||
const Push = TIMPushManager.getInstance();
|
||||
export class EVENT {
|
||||
static MESSAGE_RECEIVED: string = 'message_received';
|
||||
static MESSAGE_REVOKED: string = 'message_revoked';
|
||||
static NOTIFICATION_CLICKED: string = 'notification_clicked';
|
||||
}
|
||||
let disableNotification = false;
|
||||
export function disablePostNotificationInForeground(disable: boolean): void {
|
||||
console.log('Push | disablePostNotificationInForeground', disable);
|
||||
disableNotification = disable;
|
||||
Push.disablePostNotificationInForeground(disableNotification);
|
||||
}
|
||||
export function registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void): void {
|
||||
if (SDKAppID == 0) {
|
||||
onError?.(9010001, 'Invalid SDKAppID');
|
||||
}
|
||||
else if (appKey == '') {
|
||||
onError?.(9010002, 'Invalid appKey');
|
||||
}
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'registerPush',
|
||||
success: (res?: any) => {
|
||||
Push.disablePostNotificationInForeground(disableNotification);
|
||||
// 强转下类型,避免类型推断错误
|
||||
let token: string = res as string;
|
||||
onSuccess(token);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
onError?.(errCode, errMsg);
|
||||
}
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.registerPush(context, SDKAppID.toInt(), appKey, new PushCallback(pushCbOptions));
|
||||
}
|
||||
export function setRegistrationID(registrationID: string, onSuccess: () => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'setRegistrationID',
|
||||
success: (res?: any) => {
|
||||
onSuccess();
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
}
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.setRegistrationID(registrationID, new PushCallback(pushCbOptions));
|
||||
}
|
||||
export function getRegistrationID(onSuccess: (registrationID: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'getRegistrationID',
|
||||
success: (res?: any) => {
|
||||
// 强转下类型,避免类型推断错误
|
||||
let registrationID: string = res as string;
|
||||
onSuccess(registrationID);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
}
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.getRegistrationID(new PushCallback(pushCbOptions));
|
||||
}
|
||||
export function unRegisterPush(onSuccess: () => void, onError?: (errCode: number, errMsg: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'unRegisterPush',
|
||||
success: (res?: any) => {
|
||||
onSuccess();
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
},
|
||||
};
|
||||
// 注意!!! 这里不要写成 new PushCallback({ api, success, fail }),否则会因类型推断不一致导致编译错误
|
||||
Push.unRegisterPush(new PushCallback(pushCbOptions));
|
||||
}
|
||||
export function createNotificationChannel(options: any, onSuccess: (extInfo: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'createNotificationChannel',
|
||||
success: (res?: any) => {
|
||||
let ret: string = res as string;
|
||||
onSuccess(ret);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
},
|
||||
};
|
||||
Push.callExperimentalAPI('createNotificationChannel', JSON.stringify(options), new PushCallback(pushCbOptions));
|
||||
}
|
||||
export function getNotificationExtInfo(onSuccess: (extInfo: string) => void): void {
|
||||
const pushCbOptions: PushCallbackOptions = {
|
||||
apiName: 'getNotificationExtInfo',
|
||||
success: (res?: any) => {
|
||||
let ret: string = res as string;
|
||||
onSuccess(ret);
|
||||
},
|
||||
fail: (errCode: number, errMsg: string) => {
|
||||
// 空实现
|
||||
},
|
||||
};
|
||||
Push.callExperimentalAPI('getNotificationExtInfo', null, new PushCallback(pushCbOptions));
|
||||
}
|
||||
const listenerMap = new Map<string, Array<(res: any) => void>>();
|
||||
const pushListenerOptions: PushListenerOptions = {
|
||||
listener: (eventName: string, data: any) => {
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
item(data);
|
||||
});
|
||||
},
|
||||
};
|
||||
const pushListener = new PushListener(pushListenerOptions);
|
||||
@UTSJS.keepAlive
|
||||
export function addPushListener(eventName: string, listener: (res: any) => void): void {
|
||||
if (listenerMap.size === 0) {
|
||||
Push.addPushListener(pushListener);
|
||||
}
|
||||
const listeners: Array<(res: any) => void> = [listener];
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
listeners.push(item);
|
||||
});
|
||||
listenerMap.set(eventName, listeners);
|
||||
}
|
||||
export function removePushListener(eventName: string, listener?: (res: any) => void): void {
|
||||
listenerMap.delete(eventName);
|
||||
if (listenerMap.size === 0) {
|
||||
Push.removePushListener(pushListener);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
export type PushCallbackOptions = {
|
||||
apiName: string;
|
||||
success: (res?: any) => void;
|
||||
fail: (errCode: number, errMsg: string) => void;
|
||||
};
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import TIMPushCallback from 'com.tencent.qcloud.tim.push.TIMPushCallback';
|
||||
import { PushCallbackOptions } from './push-callback-options.uts';
|
||||
const LOG_PREFIX: string = 'Push |';
|
||||
export default class PushCallback implements TIMPushCallback<any> {
|
||||
private apiName: string;
|
||||
private success: (data?: any) => void;
|
||||
private fail: (errCode: number, errMsg: string) => void;
|
||||
constructor(options: PushCallbackOptions) {
|
||||
this.apiName = options.apiName;
|
||||
this.success = options.success;
|
||||
this.fail = options.fail;
|
||||
}
|
||||
override onSuccess(data?: any) {
|
||||
console.log(`${LOG_PREFIX} ${this.apiName} ok, data:`, data);
|
||||
if (data == null) {
|
||||
this.success?.('');
|
||||
}
|
||||
else {
|
||||
this.success?.(data);
|
||||
}
|
||||
}
|
||||
override onError(errCode: Int, errMsg: string, data?: any) {
|
||||
this.fail?.(errCode as number, errMsg);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export type PushListenerOptions = {
|
||||
listener: (eventType: string, data: any) => void;
|
||||
};
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
import TIMPushListener from 'com.tencent.qcloud.tim.push.TIMPushListener';
|
||||
import TIMPushMessage from 'com.tencent.qcloud.tim.push.TIMPushMessage';
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
const LOG_PREFIX: string = 'Push | PushListener';
|
||||
export default class PushListener implements TIMPushListener {
|
||||
private listener: (eventType: string, data: any) => void;
|
||||
constructor(options: PushListenerOptions) {
|
||||
this.listener = options.listener;
|
||||
console.log(`${LOG_PREFIX} ok`);
|
||||
}
|
||||
override onRecvPushMessage(message: TIMPushMessage) {
|
||||
this.listener('message_received', { data: message });
|
||||
}
|
||||
override onRevokePushMessage(messageID: string) {
|
||||
this.listener('message_revoked', { data: messageID });
|
||||
}
|
||||
override onNotificationClicked(ext: string) {
|
||||
this.listener('notification_clicked', { data: ext });
|
||||
}
|
||||
}
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
import { TIMPushManager } from "TIMPush";
|
||||
import { NSObject } from "DCloudUTSFoundation";
|
||||
import PushListener from './push-listener.uts';
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
const LOG_PREFIX = 'Push |';
|
||||
export class EVENT {
|
||||
static MESSAGE_RECEIVED: string = 'message_received';
|
||||
static MESSAGE_REVOKED: string = 'message_revoked';
|
||||
static NOTIFICATION_CLICKED: string = 'notification_clicked';
|
||||
}
|
||||
function setRunningPlatform(): void {
|
||||
console.log(LOG_PREFIX, 'setRunningPlatform');
|
||||
const param = new NSString("{\"runningPlatform\":2}");
|
||||
TIMPushManager.callExperimentalAPI('setPushConfig', param = param, succ = (ext?: NSObject): void => {
|
||||
let platform: string = ext as string;
|
||||
console.log(LOG_PREFIX, 'setRunningPlatform ok. platform:', platform);
|
||||
}, fail = (code?: Int32, desc?: String): void => {
|
||||
console.log(LOG_PREFIX, `setRunningPlatform fail. code: ${code}, desc: ${desc}`);
|
||||
});
|
||||
}
|
||||
let disableNotification = false;
|
||||
export function disablePostNotificationInForeground(_disable: boolean): void {
|
||||
console.log(LOG_PREFIX, 'disablePostNotificationInForeground', _disable);
|
||||
disableNotification = _disable;
|
||||
TIMPushManager.disablePostNotificationInForeground(disable = disableNotification);
|
||||
}
|
||||
export function registerPush(SDKAppID: number, appKey: string, onSuccess: (data: string) => void, onError?: (errCode: number, errMsg: string) => void): void {
|
||||
if (SDKAppID == 0) {
|
||||
onError?.(9010001, 'Invalid SDKAppID');
|
||||
}
|
||||
else if (appKey == '') {
|
||||
onError?.(9010002, 'Invalid appKey');
|
||||
}
|
||||
setRunningPlatform();
|
||||
TIMPushManager.registerPush(SDKAppID.toInt32(), appKey = appKey, succ = (deviceToken?: Data): void => {
|
||||
TIMPushManager.disablePostNotificationInForeground(disable = disableNotification);
|
||||
console.log('devicetoken ->', deviceToken, deviceToken?.count);
|
||||
onSuccess('');
|
||||
}, fail = (code?: Int32, desc?: String): void => {
|
||||
onError?.(code as number, desc as string);
|
||||
});
|
||||
}
|
||||
export function unRegisterPush(onSuccess: () => void, onError: (errCode: number, errMsg: string) => void): void {
|
||||
TIMPushManager.unRegisterPush((): void => {
|
||||
onSuccess();
|
||||
}, fail = (code?: Int32, desc?: String): void => {
|
||||
onError(code as number, desc as string);
|
||||
});
|
||||
}
|
||||
export function setRegistrationID(registrationID: string, onSuccess: () => void): void {
|
||||
console.log(LOG_PREFIX, 'setRegistrationID', `registrationID:${registrationID}`);
|
||||
TIMPushManager.setRegistrationID(registrationID, callback = (): void => {
|
||||
console.log(LOG_PREFIX, 'setRegistrationID ok');
|
||||
onSuccess();
|
||||
});
|
||||
}
|
||||
export function getRegistrationID(onSuccess: (registrationID: string) => void): void {
|
||||
TIMPushManager.getRegistrationID((value?: string): void => {
|
||||
// 这里需要转一下,否则会有问题
|
||||
let ret: string = value as string;
|
||||
onSuccess(ret);
|
||||
});
|
||||
}
|
||||
export function createNotificationChannel(options: any, onSuccess: (data: string) => void): void {
|
||||
// 空实现
|
||||
}
|
||||
// 注意!!!这里的 extInfo 不能写成 ext,否则会跟内部的 ext?:NSObject 有冲突;也不能写成 extension,否则会导致编译错误
|
||||
export function getNotificationExtInfo(onSuccess: (extInfo: string) => void): void {
|
||||
console.log(LOG_PREFIX, 'getNotificationExtInfo');
|
||||
TIMPushManager.callExperimentalAPI('getNotificationExtInfo', param = {}, succ = (ext?: NSObject): void => {
|
||||
let str: string = ext as string;
|
||||
console.log(LOG_PREFIX, 'getNotificationExtInfo ok. ext:', str);
|
||||
onSuccess(str);
|
||||
}, fail = (code?: Int32, desc?: String): void => {
|
||||
// 空实现
|
||||
});
|
||||
}
|
||||
const listenerMap = new Map<string, Array<(res: any) => void>>();
|
||||
const pushListenerOptions: PushListenerOptions = {
|
||||
listener: (eventName: string, data: any) => {
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
item(data);
|
||||
});
|
||||
},
|
||||
};
|
||||
const pushListener = new PushListener(pushListenerOptions);
|
||||
@UTSJS.keepAlive
|
||||
export function addPushListener(eventName: string, _listener: (res: any) => void): void {
|
||||
console.log(LOG_PREFIX, 'addPushListener', eventName);
|
||||
if (listenerMap.size === 0) {
|
||||
TIMPushManager.addPushListener(listener = pushListener);
|
||||
}
|
||||
const listeners: Array<(res: any) => void> = [_listener];
|
||||
listenerMap.get(eventName)?.forEach(item => {
|
||||
listeners.push(item);
|
||||
});
|
||||
listenerMap.set(eventName, listeners);
|
||||
}
|
||||
export function removePushListener(eventName: string, _listener?: (res: any) => void): void {
|
||||
console.log(LOG_PREFIX, 'removePushListener', eventName);
|
||||
listenerMap.delete(eventName);
|
||||
if (listenerMap.size === 0) {
|
||||
TIMPushManager.removePushListener(listener = pushListener);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export type PushListenerOptions = {
|
||||
listener: (eventType: string, data: any) => void;
|
||||
};
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
import { TIMPushListener, TIMPushMessage } from "TIMPush";
|
||||
import { PushListenerOptions } from './push-listener-options.uts';
|
||||
const LOG_PREFIX: string = 'Push | PushListener';
|
||||
export default class PushListener implements TIMPushListener {
|
||||
private listener: (eventType: string, data: any) => void;
|
||||
constructor(options: PushListenerOptions) {
|
||||
this.listener = options.listener;
|
||||
console.log(`${LOG_PREFIX} ok`);
|
||||
}
|
||||
onRecvPushMessage(message: TIMPushMessage) {
|
||||
this.listener('message_received', { data: message });
|
||||
}
|
||||
onRevokePushMessage(messageID: string) {
|
||||
this.listener('message_revoked', { data: messageID });
|
||||
}
|
||||
onNotificationClicked(ext: string) {
|
||||
this.listener('notification_clicked', { data: ext });
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
|
@ -1,25 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<script>
|
||||
var __UniViewStartTime__ = Date.now();
|
||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
|
||||
CSS.supports('top: constant(a)'))
|
||||
document.write(
|
||||
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
|
||||
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||
</script>
|
||||
<title>View</title>
|
||||
<link rel="stylesheet" href="view.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="__uniappes6.js"></script>
|
||||
<script src="view.umd.min.js"></script>
|
||||
<script src="app-view.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"version" : "1",
|
||||
"prompt" : "template",
|
||||
"title" : "美融融平台服务协议及隐私政策",
|
||||
"message" : "您注册为美融融用户的过程中,需要完成我们的注册流程并且以点击的形式在线签署以下协议, 请您务必仔细阅读、充分理解协议中的条款内容后点击同意: <a href=\"https://www.mrrweb.com.cn/junit/system/sjappzcxy\">《美融融商家服务协议》</a>和<a href=\"https://www.mrrweb.com.cn/junit/system/sjappyszc\">《隐私政策》</a>",
|
||||
"buttonAccept" : "同意",
|
||||
"buttonRefuse" : "不同意",
|
||||
"hrefLoader" : "system",
|
||||
"backToExit" : "false",
|
||||
"disagreeMode" : {
|
||||
"support" : false,
|
||||
"loadNativePlugins" : false,
|
||||
"visitorEntry" : false,
|
||||
"showAlways" : false
|
||||
},
|
||||
"styles" : {
|
||||
"backgroundColor" : "#ffffff",
|
||||
"borderRadius" : "5px",
|
||||
"title" : {
|
||||
"color" : "#000000"
|
||||
},
|
||||
"buttonAccept" : {
|
||||
"color" : "#f00"
|
||||
},
|
||||
"buttonRefuse" : {
|
||||
"color" : "#000"
|
||||
},
|
||||
"buttonVisitor" : {
|
||||
"color" : "#00ffff"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
(function(e){function r(r){for(var n,l,i=r[0],p=r[1],a=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in p)Object.prototype.hasOwnProperty.call(p,n)&&(e[n]=p[n]);f&&f(r);while(s.length)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var p=t[i];0!==o[p]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={"app-config":0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e["default"]}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonp"]=this["webpackJsonp"]||[],p=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var f=p;t()})([]);
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1 +0,0 @@
|
|||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
||||
|
|
@ -1,693 +0,0 @@
|
|||
/* 自定义字体 */
|
||||
@font-face {
|
||||
font-family: "shuHeiTi";
|
||||
src: url("/static/Font/shuHeiTi.ttf") format("truetype");
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
/* 定义 DIN-Bold 字重 */
|
||||
@font-face {
|
||||
font-family: "DINPro"; /* 自定义字体名称(后续引用时需一致) */
|
||||
src: url("/static/Font/DIN-Bold.otf") format("opentype"); /* 字体文件路径(根据项目结构调整) */
|
||||
font-weight: 700; /* 对应 Bold 字重(700 表示粗体) */
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
/* 定义 DIN-Regular 字重 */
|
||||
@font-face {
|
||||
font-family: "DINPro"; /* 与上方字体名称一致,实现“同一字体族”的不同字重 */
|
||||
src: url("/static/Font/DIN-Regular.otf") format("opentype");
|
||||
font-weight: 400; /* 对应 Regular 字重(400 表示常规) */
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
/* 定义 DIN-Medium 字重(若有) */
|
||||
@font-face {
|
||||
font-family: "DINPro";
|
||||
src: url("/static/Font/DINPro-Medium.otf") format("opentype");
|
||||
font-weight: 500; /* 对应 Medium 字重(500 表示中等粗体) */
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
/* 粗体文本(自动匹配 DIN-Bold) */
|
||||
.num_bold_text {
|
||||
font-weight: 700;
|
||||
font-family: "DINPro";
|
||||
}
|
||||
|
||||
/* 常规文本(自动匹配 DIN-Regular) */
|
||||
.num_regular_text {
|
||||
font-weight: 400;
|
||||
font-family: "DINPro";
|
||||
}
|
||||
|
||||
/* 中等粗体文本(自动匹配 DINPro-Medium) */
|
||||
.num_medium_text {
|
||||
font-weight: 500;
|
||||
font-family: "DINPro";
|
||||
}
|
||||
|
||||
/* 重置样式 */
|
||||
page {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica,
|
||||
Segoe UI, Arial, Roboto, "PingFang SC", "miui", "Hiragino Sans GB",
|
||||
"Microsoft Yahei", sans-serif;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
color: #333;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.picker-view {
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.picker-view-column {
|
||||
line-height: normal !important;
|
||||
}
|
||||
/* 通用布局 */
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.flex-wrap {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.flex-1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* 对齐方式 */
|
||||
.justify-start {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.justify-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.justify-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.justify-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.align-start {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.align-end {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.align-center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.align-stretch {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
/* 间距 */
|
||||
.m-10 {
|
||||
margin: 10rpx;
|
||||
}
|
||||
.m-20 {
|
||||
margin: 20rpx;
|
||||
}
|
||||
.m-30 {
|
||||
margin: 30rpx;
|
||||
}
|
||||
.m-40 {
|
||||
margin: 40rpx;
|
||||
}
|
||||
|
||||
.mt-10 {
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
.mt-20 {
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
.mt-30 {
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.mt-40 {
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.mb-10 {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.mb-20 {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.mb-30 {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.mb-40 {
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.ml-10 {
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
.ml-20 {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.ml-30 {
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
.ml-40 {
|
||||
margin-left: 40rpx;
|
||||
}
|
||||
|
||||
.mr-10 {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.mr-20 {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.mr-30 {
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
.mr-40 {
|
||||
margin-right: 40rpx;
|
||||
}
|
||||
|
||||
.p-10 {
|
||||
padding: 10rpx;
|
||||
}
|
||||
.p-20 {
|
||||
padding: 20rpx;
|
||||
}
|
||||
.p-30 {
|
||||
padding: 30rpx;
|
||||
}
|
||||
.p-40 {
|
||||
padding: 40rpx;
|
||||
}
|
||||
|
||||
.pt-10 {
|
||||
padding-top: 10rpx;
|
||||
}
|
||||
.pt-20 {
|
||||
padding-top: 20rpx;
|
||||
}
|
||||
.pt-30 {
|
||||
padding-top: 30rpx;
|
||||
}
|
||||
.pt-40 {
|
||||
padding-top: 40rpx;
|
||||
}
|
||||
|
||||
.pb-10 {
|
||||
padding-bottom: 10rpx;
|
||||
}
|
||||
.pb-20 {
|
||||
padding-bottom: 20rpx;
|
||||
}
|
||||
.pb-30 {
|
||||
padding-bottom: 30rpx;
|
||||
}
|
||||
.pb-40 {
|
||||
padding-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.pl-10 {
|
||||
padding-left: 10rpx;
|
||||
}
|
||||
.pl-20 {
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
.pl-30 {
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
.pl-40 {
|
||||
padding-left: 40rpx;
|
||||
}
|
||||
|
||||
.pr-10 {
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
.pr-20 {
|
||||
padding-right: 20rpx;
|
||||
}
|
||||
.pr-30 {
|
||||
padding-right: 30rpx;
|
||||
}
|
||||
.pr-40 {
|
||||
padding-right: 40rpx;
|
||||
}
|
||||
.pr-240 {
|
||||
padding-right: 240rpx;
|
||||
}
|
||||
|
||||
/* 文本样式 */
|
||||
.text-left {
|
||||
text-align: left;
|
||||
}
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-primary {
|
||||
color: #007aff;
|
||||
}
|
||||
.text-success {
|
||||
color: #4cd964;
|
||||
}
|
||||
.text-warning {
|
||||
color: #f0ad4e;
|
||||
}
|
||||
.text-danger {
|
||||
color: #dd524d;
|
||||
}
|
||||
.text-info {
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.text-sm {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.text-md {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.text-lg {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
.text-xl {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.text-normal {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* 背景颜色 */
|
||||
.bg-white {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.bg-primary {
|
||||
background-color: #007aff;
|
||||
}
|
||||
.bg-success {
|
||||
background-color: #4cd964;
|
||||
}
|
||||
.bg-warning {
|
||||
background-color: #f0ad4e;
|
||||
}
|
||||
.bg-danger {
|
||||
background-color: #dd524d;
|
||||
}
|
||||
.bg-info {
|
||||
background-color: #909399;
|
||||
}
|
||||
.bg-gray {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
/* 边框 */
|
||||
.border {
|
||||
border-width: 1rpx;
|
||||
border-style: solid;
|
||||
border-color: #e5e5e5;
|
||||
}
|
||||
|
||||
.border-top {
|
||||
border-top-width: 1rpx;
|
||||
border-top-style: solid;
|
||||
border-top-color: #e5e5e5;
|
||||
}
|
||||
|
||||
.border-bottom {
|
||||
border-bottom-width: 1rpx;
|
||||
border-bottom-style: solid;
|
||||
border-bottom-color: #e5e5e5;
|
||||
}
|
||||
|
||||
.border-left {
|
||||
border-left-width: 1rpx;
|
||||
border-left-style: solid;
|
||||
border-left-color: #e5e5e5;
|
||||
}
|
||||
|
||||
.border-right {
|
||||
border-right-width: 1rpx;
|
||||
border-right-style: solid;
|
||||
border-right-color: #e5e5e5;
|
||||
}
|
||||
|
||||
/* 圆角 */
|
||||
.rounded {
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
|
||||
.rounded-lg {
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.rounded-xl {
|
||||
border-radius: 24rpx;
|
||||
}
|
||||
|
||||
.rounded-circle {
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
/* 阴影 */
|
||||
.shadow {
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.shadow-lg {
|
||||
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 定位 */
|
||||
.relative {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.absolute {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.fixed {
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
/* 平台特定样式 */
|
||||
/* #ifdef H5 */
|
||||
/* 适配H5端的安全区域 */
|
||||
.safe-area-inset-bottom {
|
||||
padding-bottom: constant(safe-area-inset-bottom);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
/* 常用组件样式 */
|
||||
/* 按钮 */
|
||||
.btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20rpx 40rpx;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.5;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: #007aff;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background-color: #4cd964;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-warning {
|
||||
background-color: #f0ad4e;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: #dd524d;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.btn-info {
|
||||
background-color: #909399;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
/* 卡片 */
|
||||
.card {
|
||||
background-color: #ffffff;
|
||||
border-radius: 8rpx;
|
||||
padding: 20rpx;
|
||||
margin: 20rpx;
|
||||
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 列表 */
|
||||
.list-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx;
|
||||
background-color: #ffffff;
|
||||
border-bottom: 1rpx solid #e5e5e5;
|
||||
}
|
||||
|
||||
/* 加载状态 */
|
||||
.loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.loading-text {
|
||||
margin-left: 10rpx;
|
||||
color: #909399;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40rpx;
|
||||
}
|
||||
|
||||
.empty-image {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: #909399;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.text-overflow {
|
||||
/* #ifdef MP-WEIXIN || APP-PLUS */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
/* #endif */
|
||||
}
|
||||
.text-overflow-nvue {
|
||||
/* #ifdef APP-PLUS */
|
||||
lines: 2;
|
||||
text-overflow: ellipsis;
|
||||
/* #endif */
|
||||
/* #ifdef MP-WEIXIN */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
/* #endif */
|
||||
}
|
||||
.white-space-nowrap {
|
||||
width: 300rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.text-overflow-1 {
|
||||
/* #ifdef MP-WEIXIN || APP-PLUS */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
/* #endif */
|
||||
}
|
||||
.text-overflow-nvue1 {
|
||||
/* height: 76rpx; */
|
||||
/* #ifdef APP-PLUS */
|
||||
lines: 1;
|
||||
text-overflow: ellipsis;
|
||||
/* #endif */
|
||||
/* #ifdef MP-WEIXIN */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
/* #endif */
|
||||
/* #ifdef H5 */
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
/* #endif */
|
||||
}
|
||||
.box-cont {
|
||||
background-color: #fff;
|
||||
margin: 24rpx;
|
||||
box-shadow: 0 0 12rpx 0 rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.btn-box {
|
||||
height: 64rpx;
|
||||
text-align: center;
|
||||
line-height: 64rpx;
|
||||
background-color: #E8101E;
|
||||
border-radius: 32rpx;
|
||||
position: fixed;
|
||||
left: 24rpx;
|
||||
bottom: 68rpx;
|
||||
right: 24rpx;
|
||||
z-index: 999;
|
||||
}
|
||||
.btn-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ffffff;
|
||||
}
|
||||
.agree-btn {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
.fixed-box {
|
||||
padding: 32rpx 24rpx;
|
||||
background-color: #ffffff;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
z-index: 9999;
|
||||
/* #ifdef APP-PLUS || MP-WEIXIN */
|
||||
padding-bottom: calc(32rpx + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
|
||||
/* #endif */
|
||||
}
|
||||
.fixed-btn {
|
||||
height: 80rpx;
|
||||
background: #E8101E;
|
||||
border-radius: 40rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.fixed-text {
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
font-weight: 500;
|
||||
}
|
||||
.arrow-right {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.permission {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 24rpx;
|
||||
right: 24rpx;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 24rpx;
|
||||
z-index: 9;
|
||||
box-shadow: 0 8rpx 16rpx 0 rgba(0, 0, 0, 0.05);
|
||||
opacity: 0;
|
||||
transition: all 0.3s;
|
||||
visibility: hidden;
|
||||
}
|
||||
.per-tit {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: #007aff;
|
||||
}
|
||||
.per-cont {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
display: none;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
-webkit-appearance: none;
|
||||
background: transparent;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
|
||||
.flex-row-center-between{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.flex-row-start-between{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.flex-row-center-center{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.flex-row-center{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.flex-row-start{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.flex-row-end-between{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-end;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 438 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 5.9 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 722 B |