Commit d812e117 authored by zhengke's avatar zhengke

修改

parent c62d67bf
......@@ -2,13 +2,7 @@
<div class="auth-page">
<u-popup v-model="showDialog" mode="center" custom-style="padding:0;background:none;">
<img :src="pageinfo.pic_url" mode="widthFix" />
<button
:style="sureStyle"
class="hotsopt"
open-type="getUserInfo"
@getuserinfo="getUserInfo"
></button>
<button :style="sureStyle" class="hotsopt" open-type="getUserInfo" @getuserinfo="getUserInfo"></button>
<button :style="cancelStyle" class="hotsopt" @click="close"></button>
</u-popup>
</div>
......@@ -19,8 +13,8 @@ export default {
data() {
return {
pageinfo: {},
sureStyle: "",
cancelStyle: "",
sureStyle: '',
cancelStyle: '',
showDialog: true
};
},
......@@ -30,20 +24,70 @@ export default {
: {};
let x = this.pageinfo.hotspot;
let y = this.pageinfo.hotspot_cancel;
this.sureStyle = `height:${x.height}rpx;width:${x.width}rpx;left:${
x.left
}rpx;top:${x.top}rpx;`;
this.cancelStyle = `height:${y.height}rpx;width:${y.width}rpx;left:${
y.left
}rpx;top:${y.top}rpx;`;
this.sureStyle = `height:${x.height}rpx;width:${x.width}rpx;left:${x.left}rpx;top:${x.top}rpx;`;
console.log(this.sureStyle, 'this.sureStyle');
this.cancelStyle = `height:${y.height}rpx;width:${y.width}rpx;left:${y.left}rpx;top:${y.top}rpx;`;
},
methods: {
getUserInfo(e) {
if(e.mp.detail.userInfo){
// TODO 实现用户登录
uni.setStorageSync("userinfo", e.mp.detail.userInfo);
this.$emit('changeuserinfo');
// if(e.mp.detail.userInfo){
// // TODO 实现用户登录
// uni.setStorageSync("userinfo", e.mp.detail.userInfo);
// this.$emit('changeuserinfo');
// }
var that=this;
uni.getProvider({
service: 'oauth',
success: function(res) {
if (~res.provider.indexOf('weixin')) {
uni.login({
provider: 'weixin',
success: res => {
uni.getUserInfo({
provider: 'weixin',
success: info => {
//这里请求接口
var OpenId='ow_7I5XC1-RGwwk8QANBmWKYKmOc'
console.log(res, '请求222');
console.log(info,'info');
that.request2(
{
url: '/api/AppletLogin/Login',
data: {
Source:1,
OpenId:OpenId,
Name:'^O^ 做个好梦^O^',
Photo:'https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLnsYM6ibJ4QzJqibNy4WudZy1HEhia3oIzXFhaGjUHZicDtNZeavGyxkP02ib2LVicpwDC4U7PZUZH6GuA/132',
Moblie:'',
SuperiorId:0
}
},
res => {
console.log(res, '登录了');
if(res.resultCode==1){
uni.setStorageSync("mall_UserInfo", res.data);
that.$emit('changeuserinfo');
}
}
);
},
fail: () => {
uni.showToast({ title: '微信登录授权失败', icon: 'none' });
}
});
},
fail: () => {
uni.showToast({ title: '微信登录授权失败', icon: 'none' });
}
});
} else {
uni.showToast({
title: '请先安装微信或升级版本',
icon: 'none'
});
}
}
});
},
close() {
this.showDialog = false;
......@@ -63,7 +107,7 @@ export default {
border: none;
outline: none;
}
.auth-page .hotsopt::after{
border:none;
.auth-page .hotsopt::after {
border: none;
}
</style>
......@@ -145,7 +145,7 @@ export default {
this.indexPageData = res.data.home_pages.navs[0].template.data;
this.myPageData=res.data;
wx.setStorageSync("indexdata", this.myPageData);
// wx.setStorageSync("indexdata", this.myPageData);
if (res.data.home_pages.title != "") {
uni.setNavigationBarTitle({
title: res.data.home_pages.title,
......
......@@ -92,7 +92,8 @@
<Text style="margin-top: 10rpx;">{{ meueData.user_center.copyright.description }}</Text>
</view>
</view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<!-- v-if="showAuth" -->
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
<tabbars></tabbars>
</view>
......@@ -130,18 +131,14 @@ export default {
},
onLoad() {
this.navHeight = this.$navHeight - 2;
this.u = wx.getStorageSync('userinfo');
this.u = wx.getStorageSync('basedata').user_info;
if (!this.u) {
this.u = {
nickName: '未登录',
nickname: '未登录',
avatarUrl: ''
};
this.showAuth = true;
}
this.cstyle = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').cat_style : [];
if (this.cstyle.cat_style == '4') {
}
},
mounted() {
let currentPages = getCurrentPages();
......@@ -152,7 +149,6 @@ export default {
let u = '/' + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync('basedata') ? wx.getStorageSync('basedata').bar_title : [];
console.log(wx.getStorageSync('basedata'), 'getetetettt');
// pages.forEach(x => {
// if (x.value == u) {
// this.pageTitle = x.new_name ? x.new_name : x.name;
......@@ -161,28 +157,15 @@ export default {
uni.setNavigationBarTitle({
title: '用户中心'
});
//this.userinfo();
this.getmeue();
this.userinfo();
},
methods: {
goHome() {
uni.redirectTo({ url: '/pages/index/main' });
},
//获取用户信息
userinfo() {
this.request2(
{
url: '/api/Mall/GetUserCenter',
data: {}
},
res => {
uni.hideNavigationBarLoading();
//this.isloading = false;
}
);
},
//获取菜单配置
getmeue() {
userinfo() {
uni.showNavigationBarLoading();
this.request2(
{
......@@ -190,26 +173,24 @@ export default {
data: {}
},
res => {
console.log(res, 'resssssss');
uni.hideNavigationBarLoading();
//this.isloading = false;
this.meueData = res.data.config;
this.user_info = res.data.user_info;
}
);
},
goUrl(url) {
console.log(url);
uni.navigateTo({
url: url
});
},
reloadUserinfo() {
this.u = uni.getStorageSync('userinfo');
this.userinfo();
this.u = this.user_info;
this.showAuth = false;
},
login(name) {
if (!name) {
if ((name&&name.nickname=='')||!name|| !name.nickname) {
this.showAuth = true;
}
}
......
export default {
install(Vue, options) {
Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285"
//Vue.prototype.host2 = "http://192.168.0.110:8200"
Vue.prototype.host2 = "http://192.168.0.110:8200"
//Vue.prototype.host2 = "http://mallapi.oytour.com"
Vue.prototype.request = function(param, success, failed) {
//网络请求
......@@ -48,7 +50,8 @@ export default {
OpenId: this.GetOpenId().OpenId,
UserId: this.GetOpenId().UserId,
MiniAppId: this.GetMiniAppId(),
msg: param.data
msg: param.data,
token:'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODg5MDg5MjkuMCwiZXhwIjoxNTkxNTAwOTI5LjAsIm1hbGxfdXNlckluZm8iOnsidWlkIjoiMyIsInJlcXVlc3RGcm9tIjoyfX0.wvWlZWUmi-sqoCaxB6C9kdQSvyYyMzvgleFLLRW71Sw'
},
success: res => {
if (res.data.resultCode != 1) {
......@@ -78,9 +81,16 @@ export default {
}
//获取OpenId
Vue.prototype.GetOpenId = function() {
let mall_userinfo =wx.getStorageSync('mall_UserInfo')
var obj = {
OpenId: 'ow_7I5ZQKhAB66yvOTGI35Xk-Kmg',
UserId: 19992
OpenId: '',
UserId: 0
}
if(mall_userinfo){
if(mall_userinfo.OpenId){
obj.OpenId=mall_userinfo.OpenId;
obj.UserId=mall_userinfo.UserId;
}
}
return obj
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment