测试
This commit is contained in:
parent
dd9b2984b2
commit
2a1f4a2405
93
App.vue
93
App.vue
@ -19,7 +19,8 @@ import { isWxApp } from "@/utils/im/index";
|
|||||||
/** 国际化*/
|
/** 国际化*/
|
||||||
import { setLanguage } from "@/utils/im/i18n";
|
import { setLanguage } from "@/utils/im/i18n";
|
||||||
import BASE_URL from "@/utils/config.js"
|
import BASE_URL from "@/utils/config.js"
|
||||||
|
import my_api from '@/api/my_api.js'
|
||||||
|
import GlobalDialog from "@/components/GlobalDialog.vue"
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
/** 推送插件 */
|
/** 推送插件 */
|
||||||
const nimPushPlugin = uni.requireNativePlugin("NIMUniPlugin-PluginModule");
|
const nimPushPlugin = uni.requireNativePlugin("NIMUniPlugin-PluginModule");
|
||||||
@ -44,6 +45,32 @@ export default {
|
|||||||
let push_clientid = res.cid
|
let push_clientid = res.cid
|
||||||
uni.setStorageSync("push_clientid", push_clientid)
|
uni.setStorageSync("push_clientid", push_clientid)
|
||||||
console.log('客户端推送标识cid:',push_clientid)
|
console.log('客户端推送标识cid:',push_clientid)
|
||||||
|
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
console.log("systemInfo:", systemInfo)
|
||||||
|
|
||||||
|
|
||||||
|
let userInfo= uni.getStorageSync('userInfo')
|
||||||
|
console.log("userinfo:", userInfo)
|
||||||
|
if(!userInfo){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if(userInfo.uuid){
|
||||||
|
let client_type = ""
|
||||||
|
if (systemInfo.platform === 'android') {
|
||||||
|
client_type = "A"
|
||||||
|
} else if (systemInfo.platform === 'ios') {
|
||||||
|
client_type = "I"
|
||||||
|
}
|
||||||
|
console.log("client_type:", client_type)
|
||||||
|
if(client_type){
|
||||||
|
my_api.addUniappCid({
|
||||||
|
user_uuid: userInfo.uuid,
|
||||||
|
client_type:client_type,
|
||||||
|
cid: push_clientid
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
console.error("unipush: ", err)
|
console.error("unipush: ", err)
|
||||||
@ -53,6 +80,9 @@ export default {
|
|||||||
|
|
||||||
uni.onPushMessage((res)=>{
|
uni.onPushMessage((res)=>{
|
||||||
console.log("收到推送消息:", res)
|
console.log("收到推送消息:", res)
|
||||||
|
|
||||||
|
let app_isback = uni.getStorageSync("app_isback")
|
||||||
|
console.log("app_isback:", app_isback)
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: res.data.title,
|
title: res.data.title,
|
||||||
content: res.type,
|
content: res.type,
|
||||||
@ -62,6 +92,7 @@ export default {
|
|||||||
if(res.type === 'click' ){
|
if(res.type === 'click' ){
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
if(app_isback){
|
||||||
uni.createPushMessage({
|
uni.createPushMessage({
|
||||||
title: res.data.title,
|
title: res.data.title,
|
||||||
content: res.data.content,
|
content: res.data.content,
|
||||||
@ -71,10 +102,17 @@ export default {
|
|||||||
console.log("创建推送消息成功", res)
|
console.log("创建推送消息成功", res)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}else{
|
||||||
|
console.log('[App] emit global-dialog:show', res)
|
||||||
|
uni.$emit('global-dialog:show', {
|
||||||
|
title: res.data.title || '消息通知',
|
||||||
|
content: res.data.content || '',
|
||||||
|
confirmText: '我知道了',
|
||||||
|
position: 'top',
|
||||||
|
offsetTop: '160rpx'
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 设置语言 (此处为了方便demo切换语言,将其存到本地,实际需根据业务情况设置)*/
|
/** 设置语言 (此处为了方便demo切换语言,将其存到本地,实际需根据业务情况设置)*/
|
||||||
@ -141,23 +179,25 @@ export default {
|
|||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
console.log("onShow");
|
console.log("onShow");
|
||||||
uni?.$UIKitNIM?.V2NIMSettingService?.setAppBackground(false);
|
uni?.$UIKitNIM?.V2NIMSettingService?.setAppBackground(false);
|
||||||
|
uni.setStorageSync("app_isback", false)
|
||||||
// 点击通知栏推送监听
|
// 点击通知栏推送监听
|
||||||
nimPushPlugin.addOpenNotificationListener((res) => {
|
// nimPushPlugin.addOpenNotificationListener((res) => {
|
||||||
console.log("推送监听");
|
// console.log("推送监听");
|
||||||
console.log("res",res);
|
// console.log("res",res);
|
||||||
if (typeof res == "object" && res?.sessionId && res?.sessionType) {
|
// if (typeof res == "object" && res?.sessionId && res?.sessionType) {
|
||||||
// 当前登录账号id 具体获取根据您的业务逻辑调整
|
// // 当前登录账号id 具体获取根据您的业务逻辑调整
|
||||||
const imOptions = uni.getStorageSync(STORAGE_KEY);
|
// const imOptions = uni.getStorageSync(STORAGE_KEY);
|
||||||
// 会话类型
|
// // 会话类型
|
||||||
const type = res?.sessionType;
|
// const type = res?.sessionType;
|
||||||
// 拼装会话ID
|
// // 拼装会话ID
|
||||||
startByNotificationId = `${imOptions.account}|${type}|${res?.sessionId}`;
|
// startByNotificationId = `${imOptions.account}|${type}|${res?.sessionId}`;
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
|
console.log("onHide");
|
||||||
|
uni.setStorageSync("app_isback", true)
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
uni?.$UIKitNIM?.V2NIMSettingService?.setAppBackground(true);
|
uni?.$UIKitNIM?.V2NIMSettingService?.setAppBackground(true);
|
||||||
// #endif
|
// #endif
|
||||||
@ -165,6 +205,9 @@ export default {
|
|||||||
// 重置推送 startByNotificationId
|
// 重置推送 startByNotificationId
|
||||||
startByNotificationId = "";
|
startByNotificationId = "";
|
||||||
},
|
},
|
||||||
|
components:{
|
||||||
|
GlobalDialog
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initNim(opts) {
|
initNim(opts) {
|
||||||
console.log("initNim1111111111");
|
console.log("initNim1111111111");
|
||||||
@ -349,12 +392,12 @@ export default {
|
|||||||
// appId: "",
|
// appId: "",
|
||||||
// certificateName: "",
|
// certificateName: "",
|
||||||
// },
|
// },
|
||||||
// oppoPush: {
|
oppoPush: {
|
||||||
// appId: "",
|
appId: "3364888",
|
||||||
// appKey: "",
|
appKey: "75D5Vqsg63wok0S0w4SKog0w8",
|
||||||
// certificateName: "",
|
certificateName: "Expert_Op_Push",
|
||||||
// secret: "",
|
secret: "9e93Ce2AbA97E15F3852279b639b014e",
|
||||||
// },
|
},
|
||||||
vivoPush: {
|
vivoPush: {
|
||||||
appId: "100034326",
|
appId: "100034326",
|
||||||
appKey: "e789634c1f76c8f184b1def1101ce824",
|
appKey: "e789634c1f76c8f184b1def1101ce824",
|
||||||
@ -464,6 +507,10 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<GlobalDialog />
|
||||||
|
</template>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
|
||||||
/*每个页面公共css */
|
/*每个页面公共css */
|
||||||
|
|||||||
@ -22,6 +22,9 @@ const my_api = {
|
|||||||
|
|
||||||
startpage() {
|
startpage() {
|
||||||
return request('/expertAPI/startpage', {}, 'post', true);
|
return request('/expertAPI/startpage', {}, 'post', true);
|
||||||
|
},
|
||||||
|
addUniappCid(data) {
|
||||||
|
return request('/expertAPI/addUniappCid', data, 'post', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
169
components/GlobalDialog.vue
Normal file
169
components/GlobalDialog.vue
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
<template>
|
||||||
|
<view v-show="visible" class="gd-mask" :class="alignClass" :style="maskStyle">
|
||||||
|
<view
|
||||||
|
class="gd-dialog"
|
||||||
|
@touchstart="onTouchStart"
|
||||||
|
@touchmove="onTouchMove"
|
||||||
|
@touchend="onTouchEnd"
|
||||||
|
>
|
||||||
|
<view class="gd-title">{{ title }}</view>
|
||||||
|
<scroll-view class="gd-content" scroll-y>
|
||||||
|
<text class="gd-text">{{ content }}</text>
|
||||||
|
</scroll-view>
|
||||||
|
<!-- <view class="gd-footer">
|
||||||
|
<view class="gd-btn gd-confirm" @click="handleConfirm">{{ confirmText }}</view>
|
||||||
|
</view> -->
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted, onBeforeUnmount, computed } from 'vue'
|
||||||
|
|
||||||
|
const visible = ref(false)
|
||||||
|
const title = ref('消息通知')
|
||||||
|
const content = ref('')
|
||||||
|
const confirmText = ref('我知道了')
|
||||||
|
const position = ref('center') // 'center' | 'top'
|
||||||
|
const offsetTop = ref('20rpx')
|
||||||
|
const autoHideTimer = ref(null)
|
||||||
|
|
||||||
|
const startY = ref(0)
|
||||||
|
const hasSwipedUp = ref(false)
|
||||||
|
|
||||||
|
const emit = defineEmits(['confirm'])
|
||||||
|
|
||||||
|
function handleConfirm(){
|
||||||
|
visible.value = false
|
||||||
|
emit('confirm')
|
||||||
|
}
|
||||||
|
|
||||||
|
function show(payload = {}){
|
||||||
|
title.value = payload.title || '消息通知'
|
||||||
|
content.value = payload.content || ''
|
||||||
|
confirmText.value = payload.confirmText || '我知道了'
|
||||||
|
position.value = payload.position === 'top' ? 'top' : 'center'
|
||||||
|
offsetTop.value = payload.offsetTop || '20rpx'
|
||||||
|
visible.value = true
|
||||||
|
// 自动 5 秒后消失
|
||||||
|
if (autoHideTimer.value) clearTimeout(autoHideTimer.value)
|
||||||
|
autoHideTimer.value = setTimeout(() => {
|
||||||
|
hide()
|
||||||
|
}, 5000)
|
||||||
|
}
|
||||||
|
|
||||||
|
function hide(){
|
||||||
|
visible.value = false
|
||||||
|
if (autoHideTimer.value) {
|
||||||
|
clearTimeout(autoHideTimer.value)
|
||||||
|
autoHideTimer.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTouchStart(e){
|
||||||
|
const touch = e.changedTouches ? e.changedTouches[0] : (e.touches ? e.touches[0] : null)
|
||||||
|
if (!touch) return
|
||||||
|
startY.value = touch.clientY || touch.pageY || 0
|
||||||
|
hasSwipedUp.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTouchMove(e){
|
||||||
|
const touch = e.changedTouches ? e.changedTouches[0] : (e.touches ? e.touches[0] : null)
|
||||||
|
if (!touch) return
|
||||||
|
const currentY = touch.clientY || touch.pageY || 0
|
||||||
|
const deltaY = currentY - startY.value
|
||||||
|
if (deltaY < -60) {
|
||||||
|
hasSwipedUp.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTouchEnd(){
|
||||||
|
if (hasSwipedUp.value) {
|
||||||
|
hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
console.log('[GlobalDialog] mounted')
|
||||||
|
uni.$on('global-dialog:show', show)
|
||||||
|
uni.$on('global-dialog:hide', hide)
|
||||||
|
// 便于全局手动触发测试
|
||||||
|
// @ts-ignore
|
||||||
|
uni.$showGlobalDialog = (payload = {}) => {
|
||||||
|
console.log('[GlobalDialog] uni.$showGlobalDialog called', payload)
|
||||||
|
uni.$emit('global-dialog:show', payload)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
onBeforeUnmount(() => {
|
||||||
|
uni.$off('global-dialog:show', show)
|
||||||
|
uni.$off('global-dialog:hide', hide)
|
||||||
|
})
|
||||||
|
|
||||||
|
const alignClass = computed(() => position.value === 'top' ? 'is-top' : 'is-center')
|
||||||
|
const maskStyle = computed(() => position.value === 'top' ? { paddingTop: offsetTop.value } : {})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.gd-mask{
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
// 非模态:容器不截获事件
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
.gd-mask.is-top{
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.gd-dialog{
|
||||||
|
width: 600rpx;
|
||||||
|
max-width: 90%;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
// 允许对话框自己接收事件(容器为非模态)
|
||||||
|
pointer-events: auto;
|
||||||
|
// 轻微上滑消失的过渡体验
|
||||||
|
transition: transform 0.2s ease, opacity 0.2s ease;
|
||||||
|
}
|
||||||
|
.gd-title{
|
||||||
|
padding: 28rpx 32rpx 12rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #111;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
.gd-content{
|
||||||
|
max-height: 420rpx;
|
||||||
|
padding: 0 32rpx 24rpx;
|
||||||
|
}
|
||||||
|
.gd-text{
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 1.7;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
.gd-footer{
|
||||||
|
padding: 16rpx 24rpx 24rpx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.gd-btn{
|
||||||
|
min-width: 200rpx;
|
||||||
|
padding: 20rpx 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
.gd-confirm{
|
||||||
|
background: #2979ff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
@ -33,11 +33,13 @@
|
|||||||
<!-- <view class="active-indicator" v-if="currentTab === index"></view> -->
|
<!-- <view class="active-indicator" v-if="currentTab === index"></view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<GlobalDialog />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, nextTick } from 'vue';
|
import { ref, reactive, onMounted, nextTick } from 'vue';
|
||||||
import { onShow, onLoad } from "@dcloudio/uni-app";
|
import { onShow, onLoad } from "@dcloudio/uni-app";
|
||||||
|
import GlobalDialog from "@/components/GlobalDialog.vue"
|
||||||
import home from '@/static/home_nor.png'
|
import home from '@/static/home_nor.png'
|
||||||
import homeOn from '@/static/home_sel.png'
|
import homeOn from '@/static/home_sel.png'
|
||||||
import classroom from "@/static/classroom.png"
|
import classroom from "@/static/classroom.png"
|
||||||
|
|||||||
@ -21,8 +21,7 @@
|
|||||||
"Payment" : {},
|
"Payment" : {},
|
||||||
"Share" : {},
|
"Share" : {},
|
||||||
"Webview-x5" : {},
|
"Webview-x5" : {},
|
||||||
"UIWebview" : {},
|
"UIWebview" : {}
|
||||||
"Push" : {}
|
|
||||||
},
|
},
|
||||||
/* 模块配置 */
|
/* 模块配置 */
|
||||||
"distribute" : {
|
"distribute" : {
|
||||||
@ -77,23 +76,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"speech" : {},
|
"speech" : {},
|
||||||
"push" : {
|
"push" : {}
|
||||||
"unipush" : {
|
|
||||||
"version" : "2",
|
|
||||||
"offline" : false,
|
|
||||||
"hms" : {},
|
|
||||||
"oppo" : {},
|
|
||||||
"vivo" : {},
|
|
||||||
"mi" : {},
|
|
||||||
"meizu" : {},
|
|
||||||
"honor" : {},
|
|
||||||
"icons" : {
|
|
||||||
"small" : {
|
|
||||||
"xxhdpi" : "D:/uniapp/专家版图标/72.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"splashscreen" : {
|
"splashscreen" : {
|
||||||
"androidStyle" : "common",
|
"androidStyle" : "common",
|
||||||
|
|||||||
@ -69,18 +69,6 @@
|
|||||||
"title": "用户服务协议" // 协议名称
|
"title": "用户服务协议" // 协议名称
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"buttons": { // 自定义页面下方按钮仅全屏模式生效(3.1.14+ 版本支持)
|
|
||||||
"iconWidth": "45px", // 图标宽度(高度等比例缩放) 默认值:45px
|
|
||||||
"list": [{
|
|
||||||
"provider": "apple",
|
|
||||||
"iconPath": "/static/apple.png" // 图标路径仅支持本地图片
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"provider": "weixin",
|
|
||||||
"iconPath": "/static/wechat.png" // 图标路径仅支持本地图片
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
success(res) { // 登录成功
|
success(res) { // 登录成功
|
||||||
@ -89,6 +77,9 @@
|
|||||||
fail(res) { // 登录失败
|
fail(res) { // 登录失败
|
||||||
console.log(res.errCode)
|
console.log(res.errCode)
|
||||||
console.log(res.errMsg)
|
console.log(res.errMsg)
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages_app/login/login?univerify=0'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
|
|||||||
@ -16,9 +16,9 @@
|
|||||||
|
|
||||||
<!-- 手机号显示 -->
|
<!-- 手机号显示 -->
|
||||||
<!-- #ifdef APP -->
|
<!-- #ifdef APP -->
|
||||||
<view class="phone-display">
|
<!-- <view class="phone-display">
|
||||||
<text class="phone-number">176****8628</text>
|
<text class="phone-number">176****8628</text>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<!-- 登录按钮 -->
|
<!-- 登录按钮 -->
|
||||||
<view class="login-button" @click="onOneClickLogin">
|
<view class="login-button" @click="onOneClickLogin">
|
||||||
@ -129,15 +129,16 @@
|
|||||||
};
|
};
|
||||||
// 一键登录
|
// 一键登录
|
||||||
const onOneClickLogin = () => {
|
const onOneClickLogin = () => {
|
||||||
if (!isAgreed.value) {
|
const res = checkUniverifyLogin()
|
||||||
uni.showToast({
|
if(res){
|
||||||
title: '请先同意相关协议',
|
uni.redirectTo({
|
||||||
icon: 'none'
|
url: '/pages/univerify/univerify'
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages_app/smsLogin/smsLogin'
|
||||||
});
|
});
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('一键登录');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 短信验证码登录
|
// 短信验证码登录
|
||||||
@ -320,11 +321,31 @@
|
|||||||
url:'/pages/index/index'
|
url:'/pages/index/index'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const univerify = ref(1)
|
||||||
// 页面加载
|
// 页面加载
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
console.log('登录页面加载完成');
|
console.log('登录页面加载完成');
|
||||||
// #ifdef APP
|
onLoad((options) => {
|
||||||
|
if(options.univerify){
|
||||||
|
univerify.value = options.univerify // 已支持 App-Plus
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const res = checkUniverifyLogin()
|
||||||
|
if(res){
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/univerify/univerify'
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages_app/smsLogin/smsLogin'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const checkUniverifyLogin=()=>{
|
||||||
|
let res = false
|
||||||
|
// #ifdef APP
|
||||||
uni.getProvider({
|
uni.getProvider({
|
||||||
service: 'oauth',
|
service: 'oauth',
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
@ -334,32 +355,26 @@
|
|||||||
provider: 'univerify',
|
provider: 'univerify',
|
||||||
success(){ //预登录成功
|
success(){ //预登录成功
|
||||||
// 显示一键登录选项
|
// 显示一键登录选项
|
||||||
uni.redirectTo({
|
if(univerify.value == 1){
|
||||||
url: '/pages/univerify/univerify'
|
return true
|
||||||
});
|
}
|
||||||
},
|
},
|
||||||
fail(res){ // 预登录失败
|
fail(res){ // 预登录失败
|
||||||
// 不显示一键登录选项(或置灰)
|
// 不显示一键登录选项(或置灰)
|
||||||
// 根据错误信息判断失败原因,如有需要可将错误提交给统计服务器
|
// 根据错误信息判断失败原因,如有需要可将错误提交给统计服务器
|
||||||
console.log(res.errCode)
|
console.log(res.errCode)
|
||||||
console.log(res.errMsg)
|
console.log(res.errMsg)
|
||||||
uni.redirectTo({
|
return false
|
||||||
url: '/pages_app/smsLogin/smsLogin'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
uni.redirectTo({
|
return false
|
||||||
url: '/pages_app/smsLogin/smsLogin'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #endif
|
// #endif
|
||||||
});
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
// 页面显示
|
// 页面显示
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
|||||||
17
uniCloud-aliyun/cloudfunctions/allPush/index.js
Normal file
17
uniCloud-aliyun/cloudfunctions/allPush/index.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// 简单的使用示例
|
||||||
|
'use strict';
|
||||||
|
const uniPush = uniCloud.getPushManager({
|
||||||
|
appId: "__UNI__89F511F"
|
||||||
|
})
|
||||||
|
exports.main = async (event) => {
|
||||||
|
let obj = JSON.parse(event.body)
|
||||||
|
const res = await uniPush.sendMessage({
|
||||||
|
"title": obj.title,
|
||||||
|
"content": obj.content,
|
||||||
|
"settings": obj.settings,
|
||||||
|
"payload": obj.payload,
|
||||||
|
"force_notification": false,
|
||||||
|
"request_id": obj.request_id,
|
||||||
|
})
|
||||||
|
return res;
|
||||||
|
};
|
||||||
7
uniCloud-aliyun/cloudfunctions/allPush/package.json
Normal file
7
uniCloud-aliyun/cloudfunctions/allPush/package.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "allPush",
|
||||||
|
"dependencies": {},
|
||||||
|
"extensions": {
|
||||||
|
"uni-cloud-push": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,15 +6,13 @@ appId: "__UNI__89F511F"
|
|||||||
exports.main = async (event) => {
|
exports.main = async (event) => {
|
||||||
let obj = JSON.parse(event.body)
|
let obj = JSON.parse(event.body)
|
||||||
const res = await uniPush.sendMessage({
|
const res = await uniPush.sendMessage({
|
||||||
"push_clientid": obj.cids, // 设备id,支持多个以数组的形式指定多个设备,如["cid-1","cid-2"],数组长度不大于1000
|
"push_clientid": obj.cids,
|
||||||
"title": obj.title, // 标题
|
"title": obj.title,
|
||||||
"content": obj.content, // 内容
|
"content": obj.content,
|
||||||
"settings": obj.settings, // 消息有效期
|
"settings": obj.settings,
|
||||||
"payload": obj.payload, // 数据
|
"payload": obj.payload,
|
||||||
"category": obj.category, // HarmonyOS NEXT系统(纯血鸿蒙、非安卓鸿蒙)的消息分类,要给鸿蒙设备推送时才必传
|
"force_notification": false,
|
||||||
"force_notification": true, //填写true,客户端就会对在线消息自动创建“通知栏消息”,不填写则需要客户端自己处理。
|
"request_id": obj.request_id,
|
||||||
"request_id": obj.request_id ,//请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
|
|
||||||
"options":obj.options //消息分类,没申请可以不传这个参数
|
|
||||||
})
|
})
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
// 简单的使用示例
|
||||||
|
'use strict';
|
||||||
|
const uniPush = uniCloud.getPushManager({
|
||||||
|
appId: "__UNI__89F511F"
|
||||||
|
})
|
||||||
|
exports.main = async (event) => {
|
||||||
|
const res = await uniPush.getClientDetailByCid('27ab08ad61e30572654bd2b3bf05ad9c')
|
||||||
|
return res;
|
||||||
|
};
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"name": "getClientDetailByCid",
|
||||||
|
"dependencies": {},
|
||||||
|
"extensions": {
|
||||||
|
"uni-cloud-push": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user