Commit d92f40e5 authored by 罗超's avatar 罗超

调整部分样式

parent 2816875c
......@@ -49,9 +49,7 @@
<addialog v-if="d.id == 'modal' && d.data.opened" :ads="d.data" :key="di"></addialog>
<quicknav v-if="d.id == 'quick-nav' && d.data.navSwitch == 1" :navs="d.data" :key="di"></quicknav>
<pingtuan v-if="d.id == 'pintuan'" :goods="d.data" :key="di"></pingtuan>
<shopinfo v-if="d.id == 'shop-info' " :ad="d.data" :key="di" ref='son'></shopinfo>
<shopinfo v-if="d.id == 'shop-info' " :ad="d.data" :key="di" ref="son"></shopinfo>
</template>
</view>
</template>
......@@ -79,7 +77,8 @@
@goLook="goLook"
@closeBtn="closeBtn"
></coupon>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth= 'gbAuth'></auth>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
<!-- <official-account></official-account> -->
</view>
</view>
</template>
......@@ -127,9 +126,9 @@ export default {
titleStyle: "",
pagePaddingBottom: "0px",
showBack: false,
showAuth:false,
U:{},
shopData:{},
showAuth: false,
U: {},
shopData: {},
};
},
components: {
......@@ -153,8 +152,8 @@ export default {
quicknav,
coupon,
pingtuan,
shopinfo,
auth
shopinfo,
auth,
},
onLoad(options) {
console.log(options, "option");
......@@ -182,17 +181,16 @@ export default {
}
let p = 0;
if (uni.getStorageSync("navs")) {
uni.getStorageSync("navs").forEach(x=>{
uni.getStorageSync("navs").forEach((x) => {
if (x.url == queryString) {
p=1;
p = 1;
}
})
});
}
if (p == 0) {
this.showtabs = false;
this.contentHeight = this.$utils.calcContentHeight();
}
}
if (options && options.custom_params) {
let custom_params = JSON.parse(decodeURIComponent(options.custom_params));
......@@ -204,12 +202,10 @@ export default {
if (options && options.user_id) {
uni.setStorageSync("pid", { pid: options.user_id });
}
if (options && options.SmallShopId) {
uni.setStorageSync("SmallShopId", { SmallShopId: options.SmallShopId });
console.log(uni.getStorageSync("SmallShopId"))
}
if (options && options.SmallShopId) {
uni.setStorageSync("SmallShopId", { SmallShopId: options.SmallShopId });
console.log(uni.getStorageSync("SmallShopId"));
}
if (options && options.scene) {
//兼容之前小程序的调转
......@@ -221,60 +217,58 @@ export default {
withShareTicket: true,
menus: ["shareAppMessage", "shareTimeline"],
});
that.u = uni.getStorageSync("mall_UserInfo")
wx.getUserInfo({
success: function (res) {
if (uni.getStorageSync("mall_UserInfo")) {
let uid = uni.getStorageSync("mall_UserInfo").UserId;
let msg = {
Id: uid,
AliasName: res.userInfo.nickName,
Photo: res.userInfo.avatarUrl,
};
that.updateuserinfo(msg);
}else{
//静默登录操作
uni.login({
provider: 'weixin',
success: info => {
let obj ={
Name: res.userInfo.nickName,
Photo: res.userInfo.avatarUrl,
code: info.code
}
that.getCode(obj)
},
fail: () => {
uni.showToast({ title: '微信登录授权失败', icon: 'none' });
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: ""
};
that.showAuth = true;
}
}
});
}
},
fail:function(e){
uni.showToast({ title: '微信登录授权失败', icon: 'none' });
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: ""
};
that.showAuth = true;
}
}
});
that.u = uni.getStorageSync("mall_UserInfo");
wx.getUserInfo({
success: function (res) {
if (uni.getStorageSync("mall_UserInfo")) {
let uid = uni.getStorageSync("mall_UserInfo").UserId;
let msg = {
Id: uid,
AliasName: res.userInfo.nickName,
Photo: res.userInfo.avatarUrl,
};
that.updateuserinfo(msg);
} else {
//静默登录操作
uni.login({
provider: "weixin",
success: (info) => {
let obj = {
Name: res.userInfo.nickName,
Photo: res.userInfo.avatarUrl,
code: info.code,
};
that.getCode(obj);
},
fail: () => {
uni.showToast({ title: "微信登录授权失败", icon: "none" });
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: "",
};
that.showAuth = true;
}
},
});
}
},
fail: function (e) {
uni.showToast({ title: "微信登录授权失败", icon: "none" });
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: "",
};
that.showAuth = true;
}
},
});
// #endif
this.init();
this.getSmallShopById()
this.getSmallShopById();
let set = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").mall.setting
: {};
......@@ -299,21 +293,22 @@ export default {
let uid = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserId
: 0;
if(uid==0){
uid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0
}
let SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").SmallShopId
: 0;
if(SmallShopId == 0){//如果微店id为0 去找所属微店id
SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserSmallShopId
: 0;
}
if (uid == 0) {
uid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
}
let SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").SmallShopId
: 0;
if (SmallShopId == 0) {
//如果微店id为0 去找所属微店id
SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserSmallShopId
: 0;
}
console.log(uid);
return {
title: "",
query: "user_id=" + uid+"&SmallShopId=" + SmallShopId,
query: "user_id=" + uid + "&SmallShopId=" + SmallShopId,
imageUrl: "",
};
},
......@@ -325,35 +320,37 @@ export default {
let uid = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserId
: 0;
if(uid==0){
uid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0
}
let SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").SmallShopId
: 0;
if(SmallShopId == 0){//如果微店id为0 去找所属微店id
SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserSmallShopId
: 0;
}
if(SmallShopId!=0){
return{
title: this.shopData.Name
? this.shopData.Name
: uni.getStorageSync("basedata").mall.name,
path: "/pages/index/index?user_id=" + uid+"&SmallShopId=" + SmallShopId,
imageUrl: '',
}
}else{
return {
title: this.setting.share_title
? this.setting.share_title
: uni.getStorageSync("basedata").mall.name,
path: "/pages/index/index?user_id=" + uid+"&SmallShopId=" + SmallShopId,
imageUrl: this.setting.share_pic ? this.setting.share_pic : "",
};
}
if (uid == 0) {
uid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
}
let SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").SmallShopId
: 0;
if (SmallShopId == 0) {
//如果微店id为0 去找所属微店id
SmallShopId = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserSmallShopId
: 0;
}
if (SmallShopId != 0) {
return {
title: this.shopData.Name
? this.shopData.Name
: uni.getStorageSync("basedata").mall.name,
path:
"/pages/index/index?user_id=" + uid + "&SmallShopId=" + SmallShopId,
imageUrl: "",
};
} else {
return {
title: this.setting.share_title
? this.setting.share_title
: uni.getStorageSync("basedata").mall.name,
path:
"/pages/index/index?user_id=" + uid + "&SmallShopId=" + SmallShopId,
imageUrl: this.setting.share_pic ? this.setting.share_pic : "",
};
}
},
// #endif
onShow() {
......@@ -365,65 +362,66 @@ export default {
},
methods: {
//调用获取code
getCode(obj) {
var that = this;
//这里请求接口
that.request2(
{
url: '/api/mall/GetWeChatOpenId',
data: {
Code: obj.code
}
},
res => {
if (res.resultCode == 1) {
obj.OpenId = res.data;
that.getLogin(obj);
}
}
);
},
getLogin(obj) {
var that = this;
let pid = uni.getStorageSync("pid")?uni.getStorageSync("pid").pid:0;
let SmallShopId = uni.getStorageSync("SmallShopId")?uni.getStorageSync("SmallShopId").SmallShopId:0;
that.request2(
{
url: '/api/AppletLogin/Login',
data: {
Source: 1,
OpenId: obj.OpenId,
Name: obj.Name,
Photo: obj.Photo,
Moblie: '',
SuperiorId: pid,
SmallShopId:SmallShopId,
}
},
res => {
if (res.resultCode == 1) {
uni.setStorageSync('mall_UserInfo', res.data);
if(res.couponResultCode==1){
that.showCoupons = true;
that.couponMessage = res.couponMessage;
}
that.u = res.data
uni.removeStorageSync('pid');
uni.removeStorageSync('SmallShopId');
}else{
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: ""
};
that.showAuth = true;
}
}
}
);
},
//调用获取code
getCode(obj) {
var that = this;
//这里请求接口
that.request2(
{
url: "/api/mall/GetWeChatOpenId",
data: {
Code: obj.code,
},
},
(res) => {
if (res.resultCode == 1) {
obj.OpenId = res.data;
that.getLogin(obj);
}
}
);
},
getLogin(obj) {
var that = this;
let pid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
let SmallShopId = uni.getStorageSync("SmallShopId")
? uni.getStorageSync("SmallShopId").SmallShopId
: 0;
that.request2(
{
url: "/api/AppletLogin/Login",
data: {
Source: 1,
OpenId: obj.OpenId,
Name: obj.Name,
Photo: obj.Photo,
Moblie: "",
SuperiorId: pid,
SmallShopId: SmallShopId,
},
},
(res) => {
if (res.resultCode == 1) {
uni.setStorageSync("mall_UserInfo", res.data);
if (res.couponResultCode == 1) {
that.showCoupons = true;
that.couponMessage = res.couponMessage;
}
that.u = res.data;
uni.removeStorageSync("pid");
uni.removeStorageSync("SmallShopId");
} else {
if (!that.u) {
that.u = {
nickName: "未登录",
avatarUrl: "",
};
that.showAuth = true;
}
}
}
);
},
updateuserinfo(msg) {
this.request2(
{
......@@ -511,12 +509,16 @@ export default {
uni.setNavigationBarTitle({
title: res.data.home_pages.title,
});
this.pageTitleStr = res.data.home_pages.title;
if (!this.shopData.Name || this.shopData.Name == "") {
this.pageTitleStr = res.data.home_pages.title;
}
} else {
uni.setNavigationBarTitle({
title: res.data.home_pages.navs[0].name,
});
this.pageTitleStr = res.data.home_pages.navs[0].name;
if (!this.shopData.Name || this.shopData.Name == "") {
this.pageTitleStr = res.data.home_pages.navs[0].name;
}
}
// uni.setNavigationBarColor({
......@@ -536,25 +538,32 @@ export default {
(error) => {}
);
},
getSmallShopById(){
let Id = uni.getStorageSync("mall_UserInfo") ? uni.getStorageSync("mall_UserInfo").SmallShopId: 0;
if(Id==0){
Id = uni.getStorageSync("mall_UserInfo") ? uni.getStorageSync("mall_UserInfo").UserSmallShopId: 0;
}
this.request2(
{
url: '/api/AppletUser/GetSmallShopById',
data: {
Id: Id
}
},
res => {
if (res.resultCode == 1) {
this.shopData = res.data
}
}
);
},
getSmallShopById() {
let Id = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").SmallShopId
: 0;
if (Id == 0) {
Id = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserSmallShopId
: 0;
}
this.request2(
{
url: "/api/AppletUser/GetSmallShopById",
data: {
Id: Id,
},
},
(res) => {
if (res.resultCode == 1) {
this.shopData = res.data;
if (this.shopData.Name && this.shopData.Name != "") {
this.pageTitleStr = this.shopData.Name;
}
}
}
);
},
close() {
this.add_show = 2;
uni.setStorageSync("add_top_app", { add_top_app_show: 2 });
......@@ -687,15 +696,14 @@ export default {
closeBtn() {
this.showCoupons = false;
},
reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo");
this.$refs.son[0].getSmallShopById(2)//第一次登陆成功后去调取微店的信息
},
//关闭登录窗口
gbAuth(){
this.showAuth=false;
},
reloadUserinfo() {
this.u = uni.getStorageSync("mall_UserInfo");
this.$refs.son[0].getSmallShopById(2); //第一次登陆成功后去调取微店的信息
},
//关闭登录窗口
gbAuth() {
this.showAuth = false;
},
},
};
</script>
......
......@@ -56,7 +56,7 @@
}
.cdetailStyle .listbox {
width: 90%;
width: 100%;
background: #fff;
padding: 0 15px;
/* margin-top: 15px; */
......
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