合成照相馆小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
photo_uniapp/App.vue

91 lines
2.5 KiB

<style lang="scss">
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
@import "@/uni_modules/uview-ui/index.scss";
@import "@/static/css/iconfont.css";
</style>
<script>
export default {
onLaunch: function(options) {
console.log('App Launch');
console.log('参数',options);
var _this =this;
//系统信息
uni.getSystemInfo({
success:(res) => {
console.log(res);
_this.$user.session('app_system_info',res);
//检测当前平台,如果是安卓则启动安卓更新
_this.$user.session('app_system',res.platform);
}
});
// #ifdef APP-PLUS
// 锁定屏幕方向
plus.screen.lockOrientation('portrait-primary'); //锁定11
// #endif
},
onShow: function(options) {
var _this =this;
console.log('App Show');
console.log('App Show参数',options);
// #ifdef MP
//这里目前微信小程序和抖音功能基本一样
uni.getProvider({
service: 'oauth',
success: function (res) {
console.log(res.provider)
var provider = res.provider[0];
uni.login({
provider:provider,
scopes:'auth_base',
success: function (rs) {
console.log(rs);
//发起网络请求
var post = {
js_code: rs.code,
};
//三方登录类型;applet:小程序,app_wechat:app端微信,official_account:公众号
// #ifdef MP
post.login_type = 'applet';
// #endif
// #ifdef APP
post.login_type = 'app_wechat';
// #endif
// #ifdef H5
post.login_type = 'official_account';
// #endif
//如果有邀请码
if(!_this.$com.isNull(options.query.invite_code))
{
post.invite_code = options.query.invite_code;
}
_this.$api.post('api/login', post,function(rs){
console.log(rs);
_this.$user.session('userInfo',rs);
_this.$user.session('user_id',rs.id);
_this.$user.session('token',rs.token);
});
},
fail:function(rs){
console.log('登录失败'+rs.errMsg);
}
});
}
});
// #endif
},
onHide: function() {
console.log('App Hide')
}
}
</script>