1 Star 1 Fork 73

学海云/YYC松鼠短视频前端源码-开源--优雅草科技官方发布

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
App.vue 11.20 KB
一键复制 编辑 原始数据 按行查看 历史
yangjiasong 提交于 2022-06-30 18:13 . 首页问题修改
<script>
import Vue from 'vue';
import store from './store'
// import jpushIM from "./common/im.js"
export default {
onLaunch: function() {
uni.getSystemInfo({
success: res => {
this.$store.commit('setSystemInfo', res)
}
})
this.$store.dispatch('getConfig')
//检测网络状况
uni.getNetworkType({
success: function(res) {
if (res.networkType == 'none') {
uni.showModal({
title: '警告',
content: '当前无网络连接,请检测网络是否通畅!',
showCancel: false,
cancelText: '',
confirmText: '确定',
success: res => {
//#ifdef APP-PLUS
plus.runtime.quit();
//#endif
},
fail: () => {},
complete: () => {}
});
}
}
});
uni.onNetworkStatusChange(function(res) {
if (!res.isConnected) {
uni.showModal({
title: '警告',
content: '当前无网络连接,请检测网络是否通畅!',
showCancel: false,
cancelText: '',
confirmText: '确定',
success: res => {},
fail: () => {},
complete: () => {}
});
} else {
uni.showToast({
title: '网络已连接,当前网络:' + res.networkType,
icon: 'none'
});
}
});
console.log('App Launch');
// #ifdef APP-PLUS
// 锁定屏幕方向
plus.screen.lockOrientation('portrait-primary'); //锁定
var domModule = weex.requireModule('dom');
domModule.addRule('fontFace', {
'fontFamily': "uniicons",
'src': "url('./static/uni.ttf')"
});
// #endif
uni.getSystemInfo({
success: function(e) {
Vue.prototype.statusBar = e.statusBarHeight
// #ifndef MP
if (e.platform == 'android') {
Vue.prototype.customBar = e.statusBarHeight + 50
} else {
Vue.prototype.customBar = e.statusBarHeight + 45
}
// #endif
// #ifdef MP-WEIXIN
let custom = wx.getMenuButtonBoundingClientRect()
Vue.prototype.customBar = custom.bottom + custom.top - e.statusBarHeight
// #endif
// #ifdef MP-ALIPAY
Vue.prototype.customBar = e.statusBarHeight + e.titleBarHeight
// #endif
}
})
this.$store.dispatch('getUserInfo');
this.$store.dispatch("getAdvert");
this.$store.dispatch("getConfig");
// /* 配置openinstall统计 */
// const openinstall = uni.requireNativePlugin('openinstall-plugin');
// openinstall.registerWakeUp(function(result){
// console.log('getWakeup : channel=' + result.channelCode + ', data=' + result.bindData);
// });
// /* im-start */
// // #ifdef APP-PLUS
// this.$store.dispatch("update");
// // 初始化一定要在APP刚启动的时候就调用,这里是示例按钮,用于注册接上消息事件
// // jpushIM.init();
// // 点击通知栏,跳转链接,这里的跳转会保留当前页面(支持Android)
// jpushIM.addClickMessageNotificationListener(function(notification) {
// // console.log(notification);
// uni.navigateTo({
// url: '/pages/im-chat/im-chat?title=' + notification.fromName + '&fromUser=' + JSON.stringify(notification.fromUser),
// });
// })
// // 监听新消息
// jpushIM.addReceiveMessageListener(function(notification) {
// // console.log("addReceiveMessageListener:" + JSON.stringify(notification) );
// if (!notification.messageType) {
// // 如果没有类型,不做处理
// plus.nativeUI.toast(notification.messageString);
// } else if (notification.messageType == "event") {
// // 行为事件
// plus.nativeUI.toast(notification.messageString);
// store.commit("setReceiveMessage", notification);
// } else {
// // 设置了消息免打扰
// if (notification.target.isNoDisturb) {
// // 消息免打扰,不作消息提醒(群组设置中有)
// } else {
// var title = notification.fromName; // 如果用户没有昵称,fromName就是空的
// if (!title) {
// title = notification.fromUser.username;
// }
// // 获取未读消息总数后赋值给tabbar
// jpushIM.getAllUnreadCount((count) => {
// if (count < 1) {
// uni.removeTabBarBadge({
// index: 1
// })
// } else {
// uni.setTabBarBadge({
// index: 1,
// text: count.toString()
// })
// }
// })
// // console.log(JSON.stringify(notification));
// // 长震动,实际项目上可开启
// // uni.vibrateLong({
// // success: function() {
// plus.nativeUI.toast("您有来自" + title + "的新消息");
// // console.log('success');
// // }
// // });
// }
// store.commit("setReceiveMessage", notification);
// }
// })
// // 登录状态变更
// jpushIM.addLoginStateChangedListener(function(notification) {
// // console.log("登录状态变更:" + JSON.stringify(notification))
// uni.showModal({
// title: '登录状态变更',
// content: JSON.stringify(notification),
// showCancel: false,
// cancelText: '',
// confirmText: '关闭'
// });
// // if(notification.status == 1){
// store.commit("logout");
// // }
// store.commit("setLoginStateChanged", notification);
// })
// // 消息发送结果回执
// jpushIM.addSendMessageResponseCallbackListener(function(notification) {
// // console.log("消息发送结果回执:" + JSON.stringify(notification))
// store.commit("setSendMessageResponse", notification);
// })
// // 监听好友事件
// jpushIM.addfriendInvitiaonChangeListener(function(notification) {
// console.log(notification);
// uni.showModal({
// title: '您有新的好友事件',
// content: "来自用户" + notification.fromUser.username + "的好友请求!",
// showCancel: false,
// // cancelText: '知道了',
// // confirmText: '',
// success: res => {
// jpushIM.acceptInvitation({
// "username": notification.fromUser.username
// }, (res) => {
// if (res.errorCode == 0) {
// uni.showToast({
// title: "添加成功!",
// icon: 'none'
// });
// } else {
// uni.showModal({
// title: '操作失败',
// content: "原因:" + res.errorMsg,
// showCancel: false,
// cancelText: '',
// confirmText: '关闭'
// });
// }
// })
// // if (res.confirm) {
// // uni.navigateTo({
// // url: '/pages/friend-invitiaon/friend-invitiaon',
// // });
// // }
// }
// });
// // console.log(notification);
// store.commit("addFriendInvitiaonChange", notification);
// })
// // 申请入群事件回调
// jpushIM.addReceiveApplyJoinGroupApprovalListener(function(notification) {
// // console.log("JMessagePlugin 入群申请:" + JSON.stringify(notification))
// uni.showModal({
// title: '有新的入群申请',
// content: JSON.stringify(notification),
// cancelText: '知道了',
// confirmText: '去查看',
// success: res => {
// if (res.confirm) {
// uni.navigateTo({
// url: '/pages/group-apply/group-apply',
// });
// }
// }
// });
// store.commit("addReceiveApplyJoinGroupApproval", notification);
// })
// // #endif
// /* im-end */
// },
// onShow () {
// console.log('App Show')
// /* im-start */
// // #ifdef APP-PLUS
// 获取未读消息总数后赋值给tabbar
// jpushIM.getAllUnreadCount((count) => {
// if (count < 1) {
// uni.removeTabBarBadge({
// index: 1
// })
// } else {
// uni.setTabBarBadge({
// index: 1,
// text: count.toString()
// })
// }
// this.jpushIM.setBadge(count);
// })
// // #endif
// /* im-end */
},
onError: function(e) {
console.log("App Error", e);
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/* #ifndef APP-PLUS-NVUE */
@import 'colorui/main.css';
@import 'colorui/icon.css';
@import './common/uni.css';
page {
background:#fff;
height: 100%;
font-size: 28rpx;
}
.card {
border-radius: 8rpx;
background-color: #FFFFFF;
box-shadow: 0 8rpx 12rpx rgba($color: #000000, $alpha: .25);
}
.card-1 {
border-radius: 8rpx;
background-color: #FFFFFF;
box-shadow: 0 4rpx 8rpx rgba($color: #000000, $alpha: .25);
}
.active {
color: $uni-text-color-active;
}
.view-hover {
background-color: rgba($color: #000000, $alpha: .05) !important;
}
.loading:after {
content: "";
position: absolute;
top: 50%;
left: 24rpx;
width: 250rpx;
border-bottom: 1rpx solid rgba($color: #000000, $alpha: 0.05);
}
.loading:before {
content: "";
position: absolute;
top: 50%;
right: 24rpx;
width: 250rpx;
border-bottom: 1rpx solid rgba($color: #000000, $alpha: 0.05);
}
.loading {
color: rgba($color: #000000, $alpha: 0.5);
position: relative;
width: 750rpx;
justify-content: center;
align-items: center;
align-content: center;
}
/* im-start */
.common-search-form {
width: 100%;
display: flex;
align-items: center;
padding: 20rpx 30rpx;
background-color: #f1f1f1;
box-sizing: border-box;
}
.common-search-form .input-view {
display: flex;
flex: 1;
align-items: center;
background-color: #fff;
height: 66rpx;
border-radius: 20rpx;
padding: 0 10rpx;
font-size: 26rpx;
color: #999;
}
.input-view .input {
margin-left: 10rpx;
}
/* im-end */
/* #endif*/
.square{
width: 20px;
height: 20px;
border:1px rgba(0,0,0,0.2) solid;
margin: 36px auto;
position: relative;
-webkit-animation: fill_color 5s linear infinite;
-moz-animation: fill_color 5s linear infinite;
animation: fill_color 5s linear infinite;
}
.square:after{
width: 4px;
height: 4px;
position: absolute;
content: "";
background-color: rgba(0,0,0,0.7);
top: -8px;
left: 0px;
-webkit-animation: square_check 1s ease-in-out infinite;
-moz-animation: square_check 1s ease-in-out infinite;
animation: square_check 1s ease-in-out infinite;
}
@-webkit-keyframes square_check{
25%{ left: 22px; top: -8px;}
50%{ left: 22px; top: 22px;}
75%{ left: -9px; top: 22px;}
100%{ left: -9px; top: -7px;}
}
@-moz-keyframes square_check{
25%{ left: 22px; top: -8px;}
50%{ left: 22px; top: 22px;}
75%{ left: -9px; top: 22px;}
100%{ left: -9px; top: -7px;}
}
@keyframes square_check{
25%{ left: 22px; top: -8px;}
50%{ left: 22px; top: 22px;}
75%{ left: -9px; top: 22px;}
100%{ left: -9px; top: -7px;}
}
@-webkit-keyframes fill_color{
0%{ box-shadow: inset 0px 0px 0px 0px rgba(0,0,0,0.1);}
100%{ box-shadow: inset 0px -20px 0px 0px rgba(0,0,0,0.7);}
}
@-moz-keyframes fill_color{
0%{ box-shadow: inset 0px 0px 0px 0px rgba(0,0,0,0.1);}
100%{ box-shadow: inset 0px -20px 0px 0px rgba(0,0,0,0.7);}
}
@keyframes fill_color{
0%{ box-shadow: inset 0px 0px 0px 0px rgba(0,0,0,0.1);}
100%{ box-shadow: inset 0px -20px 0px 0px rgba(0,0,0,0.7);}
}
</style>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/xuehaiyun/songshu-video-page.git
git@gitee.com:xuehaiyun/songshu-video-page.git
xuehaiyun
songshu-video-page
YYC松鼠短视频前端源码-开源--优雅草科技官方发布
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385