代码拉取完成,页面将自动刷新
<script setup>
import { onLaunch, onShow, onHide, onUnload, onError } from '@dcloudio/uni-app';
import { ShoproInit } from './sheep';
import { useWebSocket } from '@/sheep/hooks/useWebSocket';
import { WebSocketMessageTypeConstants } from '@/sheep/util/const';
onLaunch(() => {
// 隐藏原生导航栏 使用自定义底部导航
//uni.hideTabBar();
// 加载Shopro底层依赖
ShoproInit();
});
onError((err) => {
console.log('AppOnError:', err);
});
onShow((options) => {
// #ifdef APP-PLUS
// 获取urlSchemes参数
const args = plus.runtime.arguments;
if (args) {
}
// 获取剪贴板
uni.getClipboardData({
success: (res) => { },
});
// #endif
// #ifdef MP-WEIXIN
// 确认收货回调结果
console.log(options,'options');
// #endif
// 禁止截屏
if (wx.setVisualEffectOnCapture) {
wx.setVisualEffectOnCapture({
visualEffect: 'hidden',
complete: function(res) {}
})
}
if (wx.setVisualEffectOnCapture) {
let that = this
wx.onUserCaptureScreen(function (res) {
uni.showToast({
icon: 'none',
title: '禁止截屏!',
position: 'bottom'
})
that.flushed()
})
}
console.log('App Show')
});
onHide(() => {
if (wx.setVisualEffectOnCapture) {
wx.setVisualEffectOnCapture({
visualEffect: 'none',
complete: function(res) {}
})
}
});
onUnload(() => {
if (wx.setVisualEffectOnCapture) {
wx.setVisualEffectOnCapture({
visualEffect: 'none',
complete: function(res) {}
})
}
});
//======================= 聊天工具相关 end =======================
/* const { options } = useWebSocket({
// 连接成功
onConnected: async () => {
console.log('连接成功');
},
// 收到消息
onMessage: async (data) => {
console.log('接收消息');
const type = data.type;
if (!type) {
console.error('未知的消息类型:' + data.value);
return;
}
if (type == WebSocketMessageTypeConstants.IM_MESSAGE_READ) {
console.log('刷新消息');
setTimeout(function(){
uni.$emit(WebSocketMessageTypeConstants.IM_MESSAGE_READ, data);
},1000);
return;
}
if (type == WebSocketMessageTypeConstants.IM_MESSAGE_NEWS) {
uni.$emit(WebSocketMessageTypeConstants.IM_MESSAGE_NEWS, data);
return;
}
// 2.2 消息类型:KEFU_MESSAGE_TYPE
if (type == WebSocketMessageTypeConstants.KEFU_MESSAGE_TYPE) {
console.log('刷新消息');
// 刷新消息列表
//await messageListRef.value.refreshMessageList(JSON.parse(data.content));
return;
}
// 2.3 消息类型:KEFU_MESSAGE_ADMIN_READ
if (type == WebSocketMessageTypeConstants.KEFU_MESSAGE_ADMIN_READ) {
console.log('管理员已读消息');
}
},
}); */
</script>
<style lang="scss">
@import '@/sheep/scss/index.scss';
@import "@/static/css/iconfont.css";
@import "@/uni_modules/vk-uview-ui/index.scss";
::-webkit-scrollbar {
width: 0 !important;
height: 0 !important;
color: transparent !important;
display: none;
}
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。