183 lines
3.2 KiB
Vue
183 lines
3.2 KiB
Vue
<script>
|
||
import {
|
||
mapState,
|
||
mapMutations
|
||
} from 'vuex'
|
||
export default {
|
||
onLaunch: function() {
|
||
let that = this;
|
||
console.log('App Launch')
|
||
// #ifdef MP-WEIXIN
|
||
uni.login({
|
||
provider: 'weixin',
|
||
success(resLogin) {
|
||
if (resLogin.errMsg === "login:ok") {
|
||
// 获取jsCode成功,通过jsCode调用微信api获取用户openId
|
||
console.log(resLogin)
|
||
that.$ajax("Demo/test", {
|
||
code: resLogin.code
|
||
})
|
||
.then(res => {
|
||
console.log(res)
|
||
if (res.code == 1) {
|
||
that.saveOpenIdSession(res.data)
|
||
}
|
||
})
|
||
return
|
||
}
|
||
},
|
||
fail() {
|
||
uni.showToast({
|
||
title: '获取用户信息失败,请重试',
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
}
|
||
});
|
||
// #endif
|
||
},
|
||
onShow: function() {
|
||
console.log('App Show')
|
||
},
|
||
onHide: function() {
|
||
console.log('App Hide')
|
||
uni.request({
|
||
|
||
})
|
||
},
|
||
methods: {
|
||
...mapMutations(['saveOpenIdSession'])
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
/* #ifndef APP-PLUS-NVUE */
|
||
/* uni.css - 通用组件、模板样式库,可以当作一套ui库应用 */
|
||
@import './common/uni.css';
|
||
|
||
/* H5 兼容 pc 所需 */
|
||
/* #ifdef H5 */
|
||
@media screen and (min-width: 768px) {
|
||
body {
|
||
overflow-y: scroll;
|
||
}
|
||
}
|
||
|
||
/* 顶栏通栏样式 */
|
||
/* .uni-top-window {
|
||
left: 0;
|
||
right: 0;
|
||
} */
|
||
|
||
uni-page-body {
|
||
min-height: 100% !important;
|
||
height: auto !important;
|
||
background: linear-gradient(to bottom right, pink, #a900ff7a, pink);
|
||
}
|
||
|
||
.uni-top-window uni-tabbar .uni-tabbar {
|
||
background-color: #fff !important;
|
||
}
|
||
|
||
.uni-app--showleftwindow .hideOnPc {
|
||
display: none !important;
|
||
}
|
||
|
||
/* #endif */
|
||
|
||
/* 以下样式用于 hello uni-app 演示所需 */
|
||
page {
|
||
background-color: #efeff4;
|
||
height: 100%;
|
||
font-size: 28rpx;
|
||
/* line-height: 1.8; */
|
||
}
|
||
|
||
.fix-pc-padding {
|
||
padding: 0 50px;
|
||
}
|
||
|
||
.uni-header-logo {
|
||
padding: 30rpx;
|
||
flex-direction: column;
|
||
justify-content: center;
|
||
align-items: center;
|
||
margin-top: 10rpx;
|
||
}
|
||
|
||
.uni-header-image {
|
||
width: 100px;
|
||
height: 100px;
|
||
}
|
||
|
||
.uni-hello-text {
|
||
color: #7A7E83;
|
||
}
|
||
|
||
.uni-hello-addfile {
|
||
text-align: center;
|
||
line-height: 300rpx;
|
||
background: #FFF;
|
||
padding: 50rpx;
|
||
margin-top: 10px;
|
||
font-size: 38rpx;
|
||
color: #808080;
|
||
}
|
||
|
||
/* #endif*/
|
||
|
||
.warp {
|
||
margin: 10rpx 15rpx;
|
||
|
||
background: linear-gradient(to bottom right, pink, #a900ff7a, pink);
|
||
}
|
||
|
||
.Grid {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: space-between;
|
||
align-content: space-between;
|
||
background: #f7f7f7;
|
||
border-radius: 15rpx;
|
||
padding-top: 10rpx;
|
||
padding-bottom: 10rpx;
|
||
background-color: transparent;
|
||
|
||
.Grid-Item {
|
||
width: 25%;
|
||
|
||
.Grid-Item-1 {
|
||
margin-left: 10rpx;
|
||
margin-right: 10rpx;
|
||
text-align: center;
|
||
border: 1rpx solid #efeded;
|
||
border-radius: 25rpx;
|
||
box-sizing: border-box;
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
justify-content: space-around;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
padding-top: 20rpx;
|
||
padding-bottom: 5rpx;
|
||
background-color: #fff;
|
||
}
|
||
|
||
.GSimg {
|
||
width: 81rpx;
|
||
height: 81rpx;
|
||
}
|
||
|
||
.GStitle {
|
||
width: 100%;
|
||
height: 34rpx;
|
||
line-height: 34rpx;
|
||
color: #06121e;
|
||
font-size: 24rpx;
|
||
margin-top: 10rpx;
|
||
}
|
||
}
|
||
}
|
||
</style>
|