Commit 31a5a3de authored by 黄奎's avatar 黄奎

1111

parents a608cd0e 111c5e82
<template>
<div class="auth-page">
<u-popup v-model="showDialog" mode="center" :mask-close-able="false" custom-style="padding:0;background:none;">
<img :src="pageinfo.pic_url" mode="widthFix" />
<button :style="sureStyle" class="hotsopt" open-type="getUserInfo" v-if="canIUseGetUserProfile == false"
@getuserinfo="showLogin == true ? getoldUser() : ''"></button>
<button :style="sureStyle" class="hotsopt" v-if="canIUseGetUserProfile == true" @tap="showLogin == true ? getUserProfile() : ''"></button>
<button :style="cancelStyle" class="hotsopt" @click="close"></button>
</u-popup>
<coupon v-if="showCoupons" :coupon-message="couponMessage" :cform="ComeFrom" @goLook="goLook" @closeBtn="closeBtn"></coupon>
</div>
<div class="auth-page">
<u-popup
v-model="showDialog"
mode="center"
:mask-close-able="false"
custom-style="padding:0;background:none;"
>
<img :src="pageinfo.pic_url" mode="widthFix" />
<button
:style="sureStyle"
class="hotsopt"
open-type="getUserInfo"
v-if="canIUseGetUserProfile == false"
@getuserinfo="showLogin == true ? getoldUser() : ''"
></button>
<button
:style="sureStyle"
class="hotsopt"
v-if="canIUseGetUserProfile == true"
@tap="showLogin == true ? getUserProfile() : ''"
></button>
<button :style="cancelStyle" class="hotsopt" @click="close"></button>
</u-popup>
<coupon
v-if="showCoupons"
:coupon-message="couponMessage"
:cform="ComeFrom"
@goLook="goLook"
@closeBtn="closeBtn"
></coupon>
</div>
</template>
<script>
import coupon from "@/components/coupons/coupons";
export default {
components: {
coupon,
},
data() {
return {
pageinfo: {},
sureStyle: "",
cancelStyle: "",
showDialog: true,
showCoupons: false,
couponMessage: "",
ComeFrom: "",
showLogin: true,
canIUseGetUserProfile: false,
msg: {},
};
},
created() {
this.pageinfo = uni.getStorageSync("basedata") ?
uni.getStorageSync("basedata").auth_page : {};
if (wx.getUserProfile) {
console.log("进入新的");
this.canIUseGetUserProfile = true;
import coupon from "@/components/coupons/coupons";
export default {
components: {
coupon,
},
data() {
return {
pageinfo: {},
sureStyle: "",
cancelStyle: "",
showDialog: true,
showCoupons: false,
couponMessage: "",
ComeFrom: "",
showLogin: true,
canIUseGetUserProfile: false,
msg: {},
};
},
created() {
this.pageinfo = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").auth_page
: {};
if (wx.getUserProfile) {
console.log("进入新的");
this.canIUseGetUserProfile = true;
}
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;`;
},
methods: {
getoldUser() {
//旧的 兼容电脑端
//4.27注释掉 给予新的提示不能在电脑端登录
// var that = this;
// uni.login({
// provider: 'weixin',
// success: function (loginRes) {
// console.log(loginRes.authResult);
// // 获取用户信息
// uni.getUserInfo({
// provider: 'weixin',
// success: function (infoRes) {
// console.log(infoRes,'infoRes')
// that.getUserInfo(infoRes)
// }
// });
// }
// });
uni.showToast({
title: "电脑端暂时不能获取用户信息,请转到手机端使用!",
icon: "none",
});
this.showDialog = false;
this.$emit("gbAuth");
},
getUserProfile() {
//新的获取用户资料
var that = this;
wx.login({
success: res => {
let obj = {
Source: 1,
OpenId: "",
// Name: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// Gender: info.userInfo.gender,
Moblie: "",
SuperiorId: 0,
code: res.code,
}
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;`;
that.getCode(obj);
},
methods: {
getoldUser() {
//旧的 兼容电脑端
//4.27注释掉 给予新的提示不能在电脑端登录
// var that = this;
// uni.login({
// provider: 'weixin',
// success: function (loginRes) {
// console.log(loginRes.authResult);
// // 获取用户信息
// uni.getUserInfo({
// provider: 'weixin',
// success: function (infoRes) {
// console.log(infoRes,'infoRes')
// that.getUserInfo(infoRes)
// }
// });
// }
// });
uni.showToast({
title: "电脑端暂时不能获取用户信息,请转到手机端使用!",
icon: "none",
});
this.showDialog = false;
this.$emit("gbAuth");
},
getUserProfile() {
//新的获取用户资料
var that = this;
wx.getUserProfile({
desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
success: (info) => {
console.log(info);
this.msg = {
Id: 0,
AliasName: info.userInfo.nickName,
Photo: info.userInfo.avatarUrl,
};
that.getUserInfo(info);
},
fail: () => {
uni.showToast({
title: "微信登录授权失败",
icon: "none",
});
},
});
},
getUserInfo(info) {
var that = this;
that.showDialog = true;
uni.getProvider({
service: "oauth",
success: function(res) {
if (~res.provider.indexOf("weixin")) {
uni.login({
provider: "weixin",
success: (res) => {
//这里请求接口
let obj = {
Source: 1,
OpenId: "",
Name: info.userInfo.nickName,
Photo: info.userInfo.avatarUrl,
Gender: info.userInfo.gender,
Moblie: "",
SuperiorId: 0,
code: res.code,
};
that.getCode(obj);
},
fail: () => {
uni.showToast({
title: "微信登录授权失败",
icon: "none",
});
},
});
} else {
uni.showToast({
title: "请先安装微信或升级版本",
icon: "none",
});
}
},
});
},
close() {
this.showDialog = false;
this.$emit("gbAuth");
},
//调用获取code
getCode(obj) {
var that = this;
uni.showLoading({
title: "登录中",
});
//这里请求接口
var OpenId = "";
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;
that.showLogin = false;
fail: (err) => {
console.log(err,'=====err');
},
})
// wx.getUserProfile({
// desc: "用于完善资料", // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
// success: (info) => {
// console.log(info);
// this.msg = {
// Id: 0,
// AliasName: info.userInfo.nickName,
// Photo: info.userInfo.avatarUrl,
// };
// that.getUserInfo(info);
// },
// fail: (err) => {
// uni.showToast({
// title: "微信登录授权失败",
// icon: "none",
// });
// },
// });
},
getUserInfo(info) {
var that = this;
that.showDialog = true;
uni.getProvider({
service: "oauth",
success: function (res) {
if (res.provider.indexOf("weixin")) {
uni.login({
provider: "weixin",
success: (res) => {
//这里请求接口
let obj = {
Source: 1,
OpenId: "",
Name: info.userInfo.nickName,
Photo: info.userInfo.avatarUrl,
Gender: info.userInfo.gender,
Moblie: "",
SuperiorId: 0,
code: res.code,
};
that.getCode(obj);
},
fail: () => {
uni.showToast({
title: "微信登录授权失败",
icon: "none",
});
},
});
} else {
uni.showToast({
title: "请先安装微信或升级版本",
icon: "none",
});
}
},
});
},
close() {
this.showDialog = false;
this.$emit("gbAuth");
},
//调用获取code
getCode(obj) {
var that = this;
uni.showLoading({
title: "登录中",
});
//这里请求接口
var OpenId = "";
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;
that.showLogin = false;
let pid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
let Up = uni.getStorageSync("Up") ? uni.getStorageSync("Up").Up : 0;
let SmallShopId = uni.getStorageSync("SmallShopId") ?
uni.getStorageSync("SmallShopId").SmallShopId :
0;
let CounponPassword = uni.getStorageSync("CounponPassword") ?
uni.getStorageSync("CounponPassword").CounponPassword :
0;
let KeyWord = uni.getStorageSync("KeyWord") ?
uni.getStorageSync("KeyWord").KeyWord :
"";
let EduSchoolId = uni.getStorageSync("EduSchoolId") ?
uni.getStorageSync("EduSchoolId").EduSchoolId :
0;
let EduId = uni.getStorageSync("jxhData") ?
uni.getStorageSync("jxhData").Id :
0;
that.request2({
url: "/api/AppletLogin/Login",
data: {
Source: 1,
OpenId: obj.OpenId,
Name: obj.Name,
Photo: obj.Photo,
Gender: obj.Gender,
Moblie: "",
SuperiorId: pid,
SmallShopId: SmallShopId,
UserPageType: Up,
CounponPassword: CounponPassword,
KeyWord: KeyWord,
EduSchoolId: EduSchoolId,
EduId: EduId
},
},
(res) => {
console.log(186, EduSchoolId);
uni.hideLoading();
that.showLogin = true; //防止多次点击登录
if (res.resultCode == 1) {
this.showDialog = false;
uni.setStorageSync("mall_UserInfo", res.data);
that.$emit("changeuserinfo");
// ----------橙霜---------------
let AppletID = this.GetMiniAppId().TenantId;
if (AppletID === 24) {
this.updateData();
}
// --------------------------------
if (res.couponResultCode == 1) {
if (uni.getStorageSync("ComeFrom")) {
that.ComeFrom = uni.getStorageSync("ComeFrom").ComeFrom;
}
that.showCoupons = true;
that.couponMessage = res.couponMessage;
}
uni.removeStorageSync("pid");
uni.removeStorageSync("SmallShopId");
uni.removeStorageSync("Up");
uni.removeStorageSync("CounponPassword");
uni.removeStorageSync("KeyWord");
let uid = uni.getStorageSync("mall_UserInfo").UserId;
uni.removeStorageSync("EduSchoolId");
that.msg.Id = uid;
let IsOpenMiAi = uni.getStorageSync("basedata") ?
uni.getStorageSync("basedata").mall.setting.is_show_miai :
0; //是否开启相亲模式
if (IsOpenMiAi == 0) {
//不是相亲模式的时候去更新头像和昵称
that.updateuserinfo(that.msg); //更新用户头像
}
}
}
);
},
updateuserinfo(msg) {
this.request2({
url: "/api/MemberUser/SetMemberPhoto",
data: msg,
},
(res) => {
//静默处理不做任何提示
},
(error) => {}
);
},
goLook() {
this.showCoupons = false;
},
closeBtn() {
this.showCoupons = false;
},
updateData() {
this.request2({
url: "/api/Mall/GetHome",
data: {},
},
(res) => {
uni.setStorageSync("basedata", res.data);
let basedata = uni.getStorageSync("basedata");
let isAttestation = 0;
//basedata?.user_info?.isAttestation ?? 0
if (basedata && basedata.user_info && basedata.user_info.isAttestation) {
isAttestation = basedata.user_info.isAttestation;
}
let IsOpenGuide = 0;
//wx.getStorageSync("basedata") ? .mall ? .setting ? .IsOpenGuide ? ?
if (basedata && basedata.mall && basedata.mall.setting && basedata.mall.setting.IsOpenGuide) {
IsOpenGuide = basedata.mall.setting.IsOpenGuide
}
if (isAttestation === 0 && IsOpenGuide === 1) {
uni.navigateTo({
url: "/pages/user-center/user-center",
});
}
}
);
},
},
};
let pid = uni.getStorageSync("pid") ? uni.getStorageSync("pid").pid : 0;
let Up = uni.getStorageSync("Up") ? uni.getStorageSync("Up").Up : 0;
let SmallShopId = uni.getStorageSync("SmallShopId")
? uni.getStorageSync("SmallShopId").SmallShopId
: 0;
let CounponPassword = uni.getStorageSync("CounponPassword")
? uni.getStorageSync("CounponPassword").CounponPassword
: 0;
let KeyWord = uni.getStorageSync("KeyWord")
? uni.getStorageSync("KeyWord").KeyWord
: "";
let EduSchoolId = uni.getStorageSync("EduSchoolId")
? uni.getStorageSync("EduSchoolId").EduSchoolId
: 0;
let EduId = uni.getStorageSync("jxhData")
? uni.getStorageSync("jxhData").Id
: 0;
that.request2(
{
url: "/api/AppletLogin/Login",
data: {
Source: 1,
OpenId: obj.OpenId,
Name: obj.Name,
Photo: obj.Photo,
Gender: obj.Gender,
Moblie: "",
SuperiorId: pid,
SmallShopId: SmallShopId,
UserPageType: Up,
CounponPassword: CounponPassword,
KeyWord: KeyWord,
EduSchoolId: EduSchoolId,
EduId:EduId
},
},
(res) => {
console.log(186, EduSchoolId);
uni.hideLoading();
that.showLogin = true; //防止多次点击登录
if (res.resultCode == 1) {
this.showDialog = false;
uni.setStorageSync("mall_UserInfo", res.data);
that.$emit("changeuserinfo");
// ----------橙霜---------------
let AppletID = this.GetMiniAppId().TenantId;
if (AppletID === 24) {
this.updateData();
}
// --------------------------------
if (res.couponResultCode == 1) {
if (uni.getStorageSync("ComeFrom")) {
that.ComeFrom = uni.getStorageSync("ComeFrom").ComeFrom;
}
that.showCoupons = true;
that.couponMessage = res.couponMessage;
}
uni.removeStorageSync("pid");
uni.removeStorageSync("SmallShopId");
uni.removeStorageSync("Up");
uni.removeStorageSync("CounponPassword");
uni.removeStorageSync("KeyWord");
let uid = uni.getStorageSync("mall_UserInfo").UserId;
uni.removeStorageSync("EduSchoolId");
that.msg.Id = uid;
let IsOpenMiAi = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").mall.setting.is_show_miai
: 0; //是否开启相亲模式
if (IsOpenMiAi == 0) {
//不是相亲模式的时候去更新头像和昵称
that.updateuserinfo(that.msg); //更新用户头像
}
}
}
);
},
updateuserinfo(msg) {
this.request2(
{
url: "/api/MemberUser/SetMemberPhoto",
data: msg,
},
(res) => {
//静默处理不做任何提示
},
(error) => {}
);
},
goLook() {
this.showCoupons = false;
},
closeBtn() {
this.showCoupons = false;
},
updateData() {
this.request2(
{
url: "/api/Mall/GetHome",
data: {},
},
(res) => {
uni.setStorageSync("basedata", res.data);
let basedata = uni.getStorageSync("basedata");
let isAttestation = basedata?.user_info?.isAttestation ?? 0;
let IsOpenGuide =
wx.getStorageSync("basedata")?.mall?.setting?.IsOpenGuide ?? 0;
if (isAttestation === 0 && IsOpenGuide === 1) {
uni.navigateTo({
url: "/pages/user-center/user-center",
});
}
}
);
},
},
};
</script>
<style>
.auth-page img {
width: 650rpx;
height: 700rpx;
}
.auth-page img {
width: 650rpx;
height: 700rpx;
}
.auth-page .hotsopt {
position: absolute;
background: transparent;
border: none;
outline: none;
}
.auth-page .hotsopt {
position: absolute;
background: transparent;
border: none;
outline: none;
}
.auth-page .hotsopt::after {
border: none;
}
</style>
.auth-page .hotsopt::after {
border: none;
}
</style>
\ No newline at end of file
......@@ -170,17 +170,17 @@
<!-- 价格 -->
<view :style="{ color: mc }" class="the-price">
<text class="small22"></text>
<text class="numfont22" v-if="g.form_id!=1&&!g.edu_data.BookPrice">
<text class="numfont22" v-if="g.form_id!=1&&g.edu_data&&!g.edu_data.BookPrice">
{{ g.price_min == g.price_max ? g.price_min : g.price_min + '-' + g.price_max }}
</text>
<text class="numfont22" v-if="g.form_id!=1&&g.edu_data.BookPrice">
<text class="numfont22" v-if="g.form_id!=1&&g.edu_data&&g.edu_data.BookPrice">
{{ g.price_min == g.price_max ? parseFloat(g.price_min)+parseFloat(g.edu_data.BookPrice) : g.price_min + '-' + g.price_max }}
</text>
<text class="origin" v-if="g.form_id!=1&&!g.edu_data.BookPrice&& g.jjxkt_original_price && g.jjxkt_original_price > 0 && g.jjxkt_original_price>g.price">
¥{{ g.jjxkt_original_price.toFixed(2)}}
<text class="origin" v-if="g.form_id!=1&&g.edu_data&&!g.edu_data.BookPrice&& g.jjxkt_original_price && g.jjxkt_original_price > 0 && g.jjxkt_original_price>g.price">
¥{{ g.jjxkt_original_price.toFixed(2)}}
</text>
<text class="origin" v-if="g.form_id!=1&& g.edu_data.BookPrice&& g.jjxkt_original_price && g.jjxkt_original_price > 0 && g.jjxkt_original_price>g.price">
¥{{parseFloat(g.jjxkt_original_price)+parseFloat(g.edu_data.BookPrice)}}
<text class="origin" v-if="g.form_id!=1&&g.edu_data&&g.edu_data.BookPrice&& g.jjxkt_original_price && g.jjxkt_original_price > 0 && g.jjxkt_original_price>g.price">
¥{{parseFloat(g.jjxkt_original_price)+parseFloat(g.edu_data.BookPrice)}}
</text>
<!-- <text class="numfont" v-if="g.form_id==1">
{{ g.price_min }}
......@@ -349,7 +349,7 @@
<view class="content">{{ g.goods_marketing.limit }}</view>
</view>
<!-- 优惠 -->
<view class="goods-Discount" v-if="g.goodsPreferentialList&& g.goodsPreferentialList.length>0">
<view class="goods-Discount" v-if="g.goodsPreferentialList&&g.goodsPreferentialList.length>0">
<view class="discount-left">
优惠
</view>
......@@ -795,22 +795,19 @@
if (res.resultCode == 1) {
this.g = res.data.goods;
// 报名限制数组
if (res.data.goods && res.data.goods.edu_data && res.data.goods.edu_data.ClassCondition) {
res.data.goods.edu_data.ClassCondition.forEach(item2 => {
if (item2.ItemType == 1) {
this.ItemType1.push(item2)
} else if (item2.ItemType == 2) {
this.ItemType2.push(item2)
} else if (item2.ItemType == 3) {
this.ItemType3.push(item2)
} else if (item2.ItemType == 4) {
this.ItemType4.push(item2)
} else if (item2.ItemType == 5) {
this.ItemType5.push(item2)
}
})
}
res.data.goods.edu_data&&res.data.goods.edu_data.ClassCondition&&res.data.goods.edu_data.ClassCondition.forEach(item2 => {
if (item2.ItemType == 1) {
this.ItemType1.push(item2)
} else if (item2.ItemType == 2) {
this.ItemType2.push(item2)
} else if (item2.ItemType == 3) {
this.ItemType3.push(item2)
} else if (item2.ItemType == 4) {
this.ItemType4.push(item2)
} else if (item2.ItemType == 5) {
this.ItemType5.push(item2)
}
})
// 报名限制数组结束
this.g.totalStock = 0;
this.g.attr.forEach((x) => {
......
......@@ -253,7 +253,7 @@
<view class="content">{{ g.goods_marketing.limit }}</view>
</view>
<!-- 优惠 -->
<view class="goods-Discount" v-if="g.goodsPreferentialList.length>0">
<view class="goods-Discount" v-if="g.goodsPreferentialList&&g.goodsPreferentialList.length>0">
<view class="discount-left">
优惠
</view>
......
......@@ -212,7 +212,7 @@ export default {
// 获取小程序APPID
Vue.prototype.GetMiniAppId = function() {
let appObj = {};
let appType = 13;
let appType = 4;
switch (appType) {
case 1: //赞羊
appObj = {
......
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