Commit d812e117 authored by zhengke's avatar zhengke

修改

parent c62d67bf
<template> <template>
<div class="auth-page"> <div class="auth-page">
<u-popup v-model="showDialog" mode="center" custom-style="padding:0;background:none;"> <u-popup v-model="showDialog" mode="center" custom-style="padding:0;background:none;">
<img :src="pageinfo.pic_url" mode="widthFix" /> <img :src="pageinfo.pic_url" mode="widthFix" />
<button <button :style="sureStyle" class="hotsopt" open-type="getUserInfo" @getuserinfo="getUserInfo"></button>
:style="sureStyle" <button :style="cancelStyle" class="hotsopt" @click="close"></button>
class="hotsopt" </u-popup>
open-type="getUserInfo" </div>
@getuserinfo="getUserInfo"
></button>
<button :style="cancelStyle" class="hotsopt" @click="close"></button>
</u-popup>
</div>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
pageinfo: {}, pageinfo: {},
sureStyle: "", sureStyle: '',
cancelStyle: "", cancelStyle: '',
showDialog: true showDialog: true
}; };
}, },
created() { created() {
this.pageinfo = uni.getStorageSync("basedata") this.pageinfo = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").auth_page ? uni.getStorageSync("basedata").auth_page
: {}; : {};
let x = this.pageinfo.hotspot; let x = this.pageinfo.hotspot;
let y = this.pageinfo.hotspot_cancel; let y = this.pageinfo.hotspot_cancel;
this.sureStyle = `height:${x.height}rpx;width:${x.width}rpx;left:${ this.sureStyle = `height:${x.height}rpx;width:${x.width}rpx;left:${x.left}rpx;top:${x.top}rpx;`;
x.left console.log(this.sureStyle, 'this.sureStyle');
}rpx;top:${x.top}rpx;`; this.cancelStyle = `height:${y.height}rpx;width:${y.width}rpx;left:${y.left}rpx;top:${y.top}rpx;`;
this.cancelStyle = `height:${y.height}rpx;width:${y.width}rpx;left:${ },
y.left methods: {
}rpx;top:${y.top}rpx;`; getUserInfo(e) {
}, // if(e.mp.detail.userInfo){
methods: { // // TODO 实现用户登录
getUserInfo(e) { // uni.setStorageSync("userinfo", e.mp.detail.userInfo);
if(e.mp.detail.userInfo){ // this.$emit('changeuserinfo');
// TODO 实现用户登录 // }
uni.setStorageSync("userinfo", e.mp.detail.userInfo); var that=this;
this.$emit('changeuserinfo'); uni.getProvider({
} service: 'oauth',
}, success: function(res) {
close() { if (~res.provider.indexOf('weixin')) {
this.showDialog = false; 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;
}
}
}; };
</script> </script>
<style> <style>
.auth-page img { .auth-page img {
width: 650rpx; width: 650rpx;
height: 700rpx; height: 700rpx;
} }
.auth-page .hotsopt { .auth-page .hotsopt {
position: absolute; position: absolute;
background: transparent; background: transparent;
border: none; border: none;
outline: none; outline: none;
} }
.auth-page .hotsopt::after{ .auth-page .hotsopt::after {
border:none; border: none;
} }
</style> </style>
\ No newline at end of file
...@@ -145,7 +145,7 @@ export default { ...@@ -145,7 +145,7 @@ export default {
this.indexPageData = res.data.home_pages.navs[0].template.data; this.indexPageData = res.data.home_pages.navs[0].template.data;
this.myPageData=res.data; this.myPageData=res.data;
wx.setStorageSync("indexdata", this.myPageData); // wx.setStorageSync("indexdata", this.myPageData);
if (res.data.home_pages.title != "") { if (res.data.home_pages.title != "") {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: res.data.home_pages.title, title: res.data.home_pages.title,
......
...@@ -92,7 +92,8 @@ ...@@ -92,7 +92,8 @@
<Text style="margin-top: 10rpx;">{{ meueData.user_center.copyright.description }}</Text> <Text style="margin-top: 10rpx;">{{ meueData.user_center.copyright.description }}</Text>
</view> </view>
</view> </view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> --> <!-- v-if="showAuth" -->
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
<tabbars></tabbars> <tabbars></tabbars>
</view> </view>
...@@ -130,18 +131,14 @@ export default { ...@@ -130,18 +131,14 @@ export default {
}, },
onLoad() { onLoad() {
this.navHeight = this.$navHeight - 2; this.navHeight = this.$navHeight - 2;
this.u = wx.getStorageSync('userinfo'); this.u = wx.getStorageSync('basedata').user_info;
if (!this.u) { if (!this.u) {
this.u = { this.u = {
nickName: '未登录', nickname: '未登录',
avatarUrl: '' avatarUrl: ''
}; };
this.showAuth = true; this.showAuth = true;
} }
this.cstyle = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').cat_style : [];
if (this.cstyle.cat_style == '4') {
}
}, },
mounted() { mounted() {
let currentPages = getCurrentPages(); let currentPages = getCurrentPages();
...@@ -152,7 +149,6 @@ export default { ...@@ -152,7 +149,6 @@ export default {
let u = '/' + currentPages[currentPages.length - 1].route; let u = '/' + currentPages[currentPages.length - 1].route;
let pages = wx.getStorageSync('basedata') ? wx.getStorageSync('basedata').bar_title : []; let pages = wx.getStorageSync('basedata') ? wx.getStorageSync('basedata').bar_title : [];
console.log(wx.getStorageSync('basedata'), 'getetetettt');
// pages.forEach(x => { // pages.forEach(x => {
// if (x.value == u) { // if (x.value == u) {
// this.pageTitle = x.new_name ? x.new_name : x.name; // this.pageTitle = x.new_name ? x.new_name : x.name;
...@@ -161,28 +157,15 @@ export default { ...@@ -161,28 +157,15 @@ export default {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: '用户中心' title: '用户中心'
}); });
//this.userinfo(); this.userinfo();
this.getmeue();
}, },
methods: { methods: {
goHome() { goHome() {
uni.redirectTo({ url: '/pages/index/main' }); uni.redirectTo({ url: '/pages/index/main' });
}, },
//获取用户信息
userinfo() {
this.request2(
{
url: '/api/Mall/GetUserCenter',
data: {}
},
res => {
uni.hideNavigationBarLoading();
//this.isloading = false;
}
);
},
//获取菜单配置 //获取菜单配置
getmeue() { userinfo() {
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
this.request2( this.request2(
{ {
...@@ -190,26 +173,24 @@ export default { ...@@ -190,26 +173,24 @@ export default {
data: {} data: {}
}, },
res => { res => {
console.log(res, 'resssssss');
uni.hideNavigationBarLoading(); uni.hideNavigationBarLoading();
//this.isloading = false;
this.meueData = res.data.config; this.meueData = res.data.config;
this.user_info = res.data.user_info; this.user_info = res.data.user_info;
} }
); );
}, },
goUrl(url) { goUrl(url) {
console.log(url);
uni.navigateTo({ uni.navigateTo({
url: url url: url
}); });
}, },
reloadUserinfo() { reloadUserinfo() {
this.u = uni.getStorageSync('userinfo'); this.userinfo();
this.u = this.user_info;
this.showAuth = false; this.showAuth = false;
}, },
login(name) { login(name) {
if (!name) { if ((name&&name.nickname=='')||!name|| !name.nickname) {
this.showAuth = true; this.showAuth = true;
} }
} }
......
export default { export default {
install(Vue, options) { install(Vue, options) {
Vue.prototype.host = "https://wx.weibaoge.cn/web/index.php?_mall_id=1285" 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://192.168.0.110:8200"
//Vue.prototype.host2 = "http://mallapi.oytour.com" //Vue.prototype.host2 = "http://mallapi.oytour.com"
Vue.prototype.request = function(param, success, failed) { Vue.prototype.request = function(param, success, failed) {
//网络请求 //网络请求
...@@ -48,8 +50,9 @@ export default { ...@@ -48,8 +50,9 @@ export default {
OpenId: this.GetOpenId().OpenId, OpenId: this.GetOpenId().OpenId,
UserId: this.GetOpenId().UserId, UserId: this.GetOpenId().UserId,
MiniAppId: this.GetMiniAppId(), MiniAppId: this.GetMiniAppId(),
msg: param.data msg: param.data,
}, token:'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODg5MDg5MjkuMCwiZXhwIjoxNTkxNTAwOTI5LjAsIm1hbGxfdXNlckluZm8iOnsidWlkIjoiMyIsInJlcXVlc3RGcm9tIjoyfX0.wvWlZWUmi-sqoCaxB6C9kdQSvyYyMzvgleFLLRW71Sw'
},
success: res => { success: res => {
if (res.data.resultCode != 1) { if (res.data.resultCode != 1) {
// wx.showModal({ // wx.showModal({
...@@ -78,10 +81,17 @@ export default { ...@@ -78,10 +81,17 @@ export default {
} }
//获取OpenId //获取OpenId
Vue.prototype.GetOpenId = function() { Vue.prototype.GetOpenId = function() {
let mall_userinfo =wx.getStorageSync('mall_UserInfo')
var obj = { var obj = {
OpenId: 'ow_7I5ZQKhAB66yvOTGI35Xk-Kmg', OpenId: '',
UserId: 19992 UserId: 0
} }
if(mall_userinfo){
if(mall_userinfo.OpenId){
obj.OpenId=mall_userinfo.OpenId;
obj.UserId=mall_userinfo.UserId;
}
}
return obj return obj
} }
//公用判断图片地址 判断是否包含http //公用判断图片地址 判断是否包含http
......
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