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

1111

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