Commit 2a11fe3a by 李嘉林

登录页组件

parent 92c423be
...@@ -36,5 +36,8 @@ console.log(process.env,'-----------------config------') ...@@ -36,5 +36,8 @@ console.log(process.env,'-----------------config------')
get_open_id_by_code(options){ get_open_id_by_code(options){
return requestGET(`${process.env.OLSHOP_URL}/wx/get_open_id_by_code?code=${options.code}&channel=1`,) return requestGET(`${process.env.OLSHOP_URL}/wx/get_open_id_by_code?code=${options.code}&channel=1`,)
}, },
getLogin(data) {
return requestPOST(`${process.env.OLSHOP_URL}/login`, data)
},
} }
\ No newline at end of file
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
<script> <script>
export default { export default {
props: { props: {
pageCode: {
type:Number,
default: 1
}
}, },
components : { components : {
// 'area-navigation' : () => import('~/components/theme/components/other/area-navigation') // 'area-navigation' : () => import('~/components/theme/components/other/area-navigation')
...@@ -32,13 +36,13 @@ export default { ...@@ -32,13 +36,13 @@ export default {
}, },
created(){ created(){
if (this.mpApp.globalData.pageList) { if (this.mpApp.globalData.pageList) {
this.pageInfo = this.mpApp.globalData.pageList.filter((item) => item.pageCode == 1)[0]; this.pageInfo = this.mpApp.globalData.pageList.filter((item) => item.pageCode == this.pageCode)[0];
this.pageSettingData = JSON.parse(this.pageInfo.pageSettingData); this.pageSettingData = JSON.parse(this.pageInfo.pageSettingData);
console.log(this.pageInfo.pageSettingData,'kl') console.log(this.pageInfo.pageSettingData,'kl')
}else{ }else{
let _this = this let _this = this
this.mpApp.indexBgCallBack = function(data){ this.mpApp.indexBgCallBack = function(data){
_this.pageInfo = _this.mpApp.globalData.pageList.filter((item) => item.pageCode == 1)[0]; _this.pageInfo = _this.mpApp.globalData.pageList.filter((item) => item.pageCode == _this.pageCode)[0];
_this.pageSettingData = JSON.parse(_this.pageInfo.pageSettingData); _this.pageSettingData = JSON.parse(_this.pageInfo.pageSettingData);
console.log(_this.pageSettingData,'kl1') console.log(_this.pageSettingData,'kl1')
_this.bacImage = `url(${_this.pageSettingData.backgroundImage})` _this.bacImage = `url(${_this.pageSettingData.backgroundImage})`
......
<template>
<!-- 登录操作模块 -->
<div class="loginBox">
<div
class="toCLogin"
:style="{
'margin-top': paddingTop + 'px',
'margin-bottom': paddingBottom + 'px',
'margin-left': paddingLeft + 'px',
'margin-right': paddingRight + 'px',
}"
>
<div class="btn_info flex">
<div
class="btn"
:style="{
'border-radius': loginBtnOrderRadius + 'px',
'background-color':loginBtnStyleType == 1 ? customLoginBtnBackground : '',
'color': loginBtnStyleType == 1 ? customLoginBtnColor : '',
'font-size':loginBtnStyleType == 1 ? customLoginBtnSize + 'px' : ''
}"
lang="zh_CN"
@click="getUserProfile"
v-if="wxLoginFlag && !phoneLoginFlag"
>
微信一键登录
</div>
<div class="phoneLogin" v-if="phoneLoginFlag">
<div class="phoneLabel flex">
<span
:style="{
'font-size':labelStyleType == 1 ? customLabelSize + 'px' : '',
'color': labelStyleType == 1 ? customLabelColor : ''
}"
>账号</span
>
<input
:style="{ background: inputBackground }"
type="number"
v-model="loginMsg.account"
maxlength="11"
:placeholder="phoneInputPlaceholder"
/>
</div>
<div class="passLabel flex">
<span
:style="{
'font-size': labelStyleType == 1 ? customLabelSize + 'px' : '',
'color': labelStyleType == 1 ? customLabelColor : ''
}"
>密码</span
>
<input
:style="{ background: inputBackground }"
type="password"
v-model="loginMsg.password"
:placeholder="pwdInputPlaceholder"
/>
<div
class="forgetPassword"
v-if="forgetPasswordType == 1"
@click="forgetPassword"
>
忘记密码
</div>
</div>
<div class="loginIn flex">
<div
class="loginBtn flex"
:style="{
'border-radius': loginBtnOrderRadius + 'px',
'background-color':loginBtnStyleType == 1 ? customLoginBtnBackground : '',
'color': loginBtnStyleType == 1 ? customLoginBtnColor : '',
'font-size':loginBtnStyleType == 1 ? customLoginBtnSize + 'px' : ''
}"
@click="loginIn"
>
登录
</div>
</div>
<div
class="wxLogin"
v-if="phoneLoginFlag && wxLoginFlag"
@click="getUserProfile"
>
微信一键登录
</div>
</div>
</div>
</div>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: "loginBox",
props: {
render: {
type: Boolean,
default: false,
},
datas: {
type: Object,
default: () => {
return {
componentData: {},
};
},
},
isShowPhone: {
type: Boolean,
default: false,
},
showGetPhoneBtn: {
type: Boolean,
default: false,
},
},
data() {
return {
loginMsg: {
account: "",
password: "",
loginType: 0,
},
};
},
components: {},
computed: {
wxLoginFlag() {
return this.datas.componentData.wxLoginFlag;
},
phoneLoginFlag() {
return this.datas.componentData.phoneLoginFlag;
},
forgetPasswordType() {
return this.datas.componentData.forgetPasswordType;
},
forgetPasswordTips() {
return this.datas.componentData.forgetPasswordTips;
},
phoneInputPlaceholder() {
return this.datas.componentData.phoneInputPlaceholder;
},
pwdInputPlaceholder() {
return this.datas.componentData.pwdInputPlaceholder;
},
paddingTop() {
return this.datas.componentData.paddingTop;
},
paddingBottom() {
return this.datas.componentData.paddingBottom;
},
paddingLeft() {
return this.datas.componentData.paddingLeft;
},
paddingRight() {
return this.datas.componentData.paddingRight;
},
loginBtnOrderRadius() {
return this.datas.componentData.loginBtnOrderRadius;
},
inputBackground() {
return this.datas.componentData.inputBackground;
},
labelStyleType() {
return this.datas.componentData.labelStyleType;
},
customLabelColor() {
return this.datas.componentData.customLabelColor;
},
customLabelSize() {
return this.datas.componentData.customLabelSize;
},
loginBtnStyleType() {
return this.datas.componentData.loginBtnStyleType;
},
customLoginBtnBackground() {
return this.datas.componentData.customLoginBtnBackground;
},
customLoginBtnColor() {
return this.datas.componentData.customLoginBtnColor;
},
customLoginBtnSize() {
return this.datas.componentData.customLoginBtnSize;
},
},
created() {},
mounted() {},
methods: {
getUserProfile() {
if (!this.render) return;
this.$emit("getUserProfile");
},
getPhoneNumber(e) {
if (!this.render) return;
this.$emit("getPhoneNumber", e);
},
handbindHandle() {
if (!this.render) return;
this.$emit("handbindHandle");
},
cancelLogin() {
if (!this.render) return;
this.$emit("cancelLogin");
},
loginIn() {
if (!this.render) return;
this.$emit("loginIn", this.loginMsg);
},
forgetPassword() {
if (!this.render) return;
this.$emit("forgetPassword", this.forgetPasswordTips);
},
},
};
</script>
<style lang="scss" scoped>
input {
background: none;
outline: none;
border: none;
}
.loginBox {
.toCLogin {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
.btn_info {
width: 100%;
color: #000;
align-items: center;
justify-content: space-around;
.btn {
background-color: #07c160;
color: #fff;
height: 45px;
width: 200px;
display: flex;
justify-content: center;
align-items: center;
}
}
.enterpriseLogin {
position: absolute;
bottom: -100px;
left: 50%;
transform: translateX(-50%);
color: #333;
text-decoration: underline;
font-size: 15px;
}
}
.phoneLogin {
background: #fff;
margin: 0 20px;
padding: 30px 20px;
border-radius: 8px;
.phoneLabel,
.passLabel {
align-items: center;
border-bottom: 1px solid #e5e5e5;
padding-bottom: 6px;
margin-bottom: 20px;
position: relative;
span {
color: #333;
font-size: 16px;
}
input {
margin-left: 30px;
width: 44%;
}
}
.passLabel {
margin-top: 10px;
margin-bottom: 0;
.forgetPassword {
position: absolute;
right: 0;
color: #444;
padding-left: 6px;
border-left: 1px solid #444;
}
}
.loginIn {
width: 100%;
justify-content: center;
align-items: center;
margin-top: 20px;
.loginBtn {
width: 100%;
justify-content: center;
align-items: center;
background: #333;
color: #fff;
font-size: 16px;
height: 50px;
}
}
.wxLogin {
margin-top: 20px;
text-align: center;
font-size: 16px;
color: #333;
}
}
}
</style>
<template>
<!-- 登录logo名字模块 -->
<div class="loginLogo" :style="{'padding-top':paddingTop + 'px','padding-bottom':paddingBottom + 'px'}">
<div class="imgBox" v-if="useUrl" :style="{'width': logoSize + 'px','height': logoSize + 'px'}">
<img v-if="!render" class="img" :src="useUrl" />
<image v-else class="img" mode="aspectFit" :src="useUrl" />
</div>
<p class="shopName" :style="{'padding-top':pictureTextSpacing + 'px','font-size':titleSize + 'px'}" v-if="useTitle">{{ useTitle }}</p>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: "loginLogo",
props: {
render: {
type: Boolean,
default: false,
},
datas: {
type: Object,
default: () => {
return {
componentData: {},
}
},
},
logoUrl: {
type: String,
default: "http://cdn.mayi888.com/public/png/b034d103-bf1d-47eb-ba4c-df78ce24307e.png",
},
shopName: {
type: String,
default: "商城名",
},
},
data() {
return {};
},
components: {},
computed: {
useUrl() {
return this.useLogoType==1 ? this.customLogoUrl : this.logoUrl
},
useTitle() {
return this.useTitleType==1 ? this.customTitle : this.shopName
},
useLogoType(){
return this.datas.componentData.useLogoType
},
customLogoUrl(){
return this.datas.componentData.customLogoUrl
},
useTitleType(){
return this.datas.componentData.useTitleType
},
customTitle(){
return this.datas.componentData.customTitle
},
paddingTop(){
return this.datas.componentData.paddingTop
},
paddingBottom(){
return this.datas.componentData.paddingBottom
},
pictureTextSpacing(){
return this.datas.componentData.pictureTextSpacing
},
logoSize(){
return this.datas.componentData.logoSize
},
titleSize(){
return this.datas.componentData.titleSize
},
},
created() {},
mounted() {},
methods: {},
};
</script>
<style lang="scss" scoped>
.loginLogo {
display: flex;
flex-direction: column;
align-items: center;
.shopName {
font-weight: bold;
color: #333;
}
.imgBox{
.img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
}
</style>
<template>
<!-- 用户协议模块 -->
<div class="loginUserAgreement" :style="{'position':positionType==1?'relative':'fixed','bottom':positionType==1?'':'20px', 'padding-top':paddingTop + 'px','padding-bottom': paddingBottom + 'px'}" v-if="content">
<!-- <div style="width: 100%; height: 60px"></div> -->
<div class="readAgreement flex" :style="{'font-size':textSize + 'px'}">
<van-checkbox :value="checked" @click="conF1"
>{{text1}}</van-checkbox
>
<p class="link" @click="contentShow = true">{{text2}}</p>
</div>
<van-popup
:show="contentShow"
custom-style="width:80vw;height:80vh;background:#fff;"
:close-on-click-overlay="true"
@close="closeDia"
>
<div class="posterWrap">
<div v-html="content"></div>
</div>
<div class="posterWrap_btn">
<div @click="conF">我已阅读并同意</div>
</div>
</van-popup>
</div>
</template>
<script type="text/ecmascript-6">
export default {
name: "",
props: {
render: {
type: Boolean,
default: false,
},
datas: {
type: Object,
default: () => {
return {
componentData: {},
};
},
},
content: {
type: String,
default: "用户隐私协议",
},
},
data() {
return {
checked: false,
contentShow: false,
};
},
components: {},
computed: {
positionType() {
return this.datas.componentData.positionType;
},
text1() {
return this.datas.componentData.text1;
},
text2() {
return this.datas.componentData.text2;
},
paddingTop() {
return this.datas.componentData.paddingTop;
},
paddingBottom() {
return this.datas.componentData.paddingBottom;
},
textSize() {
return this.datas.componentData.textSize;
},
},
created() {},
mounted() {},
methods: {
conF() {
if (!this.render) return;
this.contentShow = false;
this.checked = true;
this.$emit("conF");
},
conF1() {
this.checked = !this.checked;
this.$emit("conF");
},
closeDia() {
if (!this.render) return;
this.contentShow = false;
},
},
};
</script>
<style lang="scss" scoped>
.loginUserAgreement {
width: 100%;
.readAgreement {
width: 100%;
font-size: 12px;
display: flex;
justify-content: center;
color: #1989fa;
align-items: center;
.link{
flex-shrink: 0;
}
}
.posterWrap {
box-sizing: border-box;
height: 100%;
overflow: auto;
padding: 0 16px;
padding-bottom: 46px;
}
.posterWrap_btn {
position: absolute;
bottom: 0px;
background: #fff;
width: 100%;
height: 46px;
display: flex;
justify-content: center;
box-sizing: border-box;
padding: 5px;
div {
padding: 0 20px;
color: #fff;
background-color: red;
border-radius: 20px;
line-height: 36px;
height: 36px;
}
}
}
</style>
<template> <template>
<div class="domain"> <div class="domain">
<div class="toCLogin"> <ThemeDataPlant :pageCode="14"></ThemeDataPlant>
<image class="img" mode="aspectFit" :src="logoUrl" /> <div class="tabbar" :style="{'height' : tabbarHeight + 'px','padding-top':systemInfo.statusBarHeight + 'px'}" @click="back">
<p class="shopName" v-if="shopName">{{shopName}}</p> <div class="tab-back">
<div class="btn_info"> <van-icon name="arrow-left" />
<button class="btn" lang="zh_CN" @click="getUserProfile">微信一键登录</button>
</div> </div>
</div> </div>
<div v-for="(item,index) in pageData" :key="index">
<!-- 登录logo名字模块 -->
<loginLogo
v-if="item.componentCode=='login-logo' && item.componentInfo.visible == 1"
:datas="item"
:render="true"
:logoUrl="logoUrl"
:shopName="shopName"
></loginLogo>
<!-- 登录操作模块 -->
<loginBox
v-if="item.componentCode=='login-box' && item.componentInfo.visible == 1"
:datas="item"
:render="true"
:isShowPhone="isShowPhone"
:showGetPhoneBtn="showGetPhoneBtn"
@getUserProfile="getUserProfile"
@getPhoneNumber="getPhoneNumber"
@handbindHandle="handbindHandle"
@cancelLogin="cancelLogin"
@loginIn="loginIn"
@forgetPassword="forgetPassword"
></loginBox>
<!-- 用户协议模块 -->
<loginUserAgreement
v-if="item.componentCode=='login-userAgreement' && item.componentInfo.visible == 1"
:datas="item"
:render="true"
:content="content"
@conF="conF"
></loginUserAgreement>
</div>
<div class="toCLogin1" v-if="isShowPhone"> <div class="toCLogin1" v-if="isShowPhone">
<div class="btn_info1"> <div class="btn_info1">
<h1>绑定手机号</h1> <h1>绑定手机号</h1>
<p class="hint">绑定手机号,同步历史订单</p> <p class="hint">绑定手机号,同步历史订单</p>
<button class="btn" v-if="showGetPhoneBtn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信授权一键绑定</button> <button
class="btn"
v-if="showGetPhoneBtn"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
>
微信授权一键绑定
</button>
<div class="btn2" @click="handbindHandle">手动绑定手机号</div> <div class="btn2" @click="handbindHandle">手动绑定手机号</div>
<div class="cancelLogin" @click="cancelLogin">暂不登录</div> <div class="cancelLogin" @click="cancelLogin">暂不登录</div>
</div> </div>
<!-- <div class="layer" @click="isShowPhone=false"></div> -->
</div>
<div class="readAgreement" v-if="content">
<van-checkbox :value="checked" @click="checked = !checked">我已阅读并同意</van-checkbox>
<span @click="contentShow = true">《用户协议》</span>
</div> </div>
<van-popup
:show="contentShow"
custom-style="width:80vw;height:80vh;background:#fff;"
:close-on-click-overlay="true"
@close="closeDia"
>
<div class="posterWrap">
<div v-html="content"></div>
</div>
<div class="posterWrap_btn">
<div @click="conF">我已阅读并同意</div>
</div>
</van-popup>
</div> </div>
</template> </template>
<script> <script>
import { serialize } from "@/utils/index"; import { serialize } from "@/utils/index";
import { checkTabbarPage } from "@/utils/mayi"; import { checkTabbarPage, checkShowConditionIds } from "@/utils/mayi";
import { wx_decode } from "@/utils/wxIndex.js"; import { wx_decode } from "@/utils/wxIndex.js";
import login from "@/api/login"; import login from "@/api/login";
import shop from "@/api/shop"; import shop from "@/api/shop";
import indexApi from "@/api/index.js"; import indexApi from "@/api/index.js";
import { createdUserJWTApi } from "@/api/daoke"; import { createdUserJWTApi } from "@/api/daoke";
import loginLogo from '../../components/login/loginLogo.vue';
import loginBox from '../../components/login/loginBox.vue';
import loginUserAgreement from '../../components/login/loginUserAgreement.vue';
import ThemeDataPlant from "../../components/ThemeDataPlant"
const app = getApp(); const app = getApp();
const { log } = app; const { log } = app;
export default { export default {
components: {
ThemeDataPlant,
loginLogo,
loginBox,
loginUserAgreement
},
data() { data() {
return { return {
checked: false, checked: false,
contentShow: false,
code: "", code: "",
content: '', content: '',
session_key: "", session_key: "",
...@@ -85,6 +114,10 @@ export default { ...@@ -85,6 +114,10 @@ export default {
wxUserInfo:{}, wxUserInfo:{},
queryOptions:{}, queryOptions:{},
isOnLoad: false, isOnLoad: false,
systemInfo : {},
tabbarHeight : 0,
pageInfo: {},
pageData: {},
}; };
}, },
computed: { computed: {
...@@ -105,6 +138,7 @@ export default { ...@@ -105,6 +138,7 @@ export default {
wx.login({ wx.login({
success: res => { success: res => {
this.code = res.code; this.code = res.code;
console.log(this.code,'---------------------123')
}, },
fail: err => { fail: err => {
} }
...@@ -123,11 +157,10 @@ export default { ...@@ -123,11 +157,10 @@ export default {
}) })
}, },
onLoad(options) { onLoad(options) {
this.isOnLoad = true; let that = this;
console.log('----------------------login-onload')
console.log(options,'----------------------login-onload-options') console.log(options,'----------------------login-onload-options')
console.log(options.params,'----------------------login-onload-options.params')
log.info(options,'----------------------login-onload-options') log.info(options,'----------------------login-onload-options')
this.getShopUserProtocol(); this.getShopUserProtocol();
Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化 Object.assign(this.$data, this.$options.data()); //mpvue 的混合周期 使用小程序生命周期数据未初始化
options.scene && (this.scene=options.scene) options.scene && (this.scene=options.scene)
...@@ -152,15 +185,32 @@ export default { ...@@ -152,15 +185,32 @@ export default {
} }
this.getshop(); this.getshop();
this.queryOptions = options; this.queryOptions = options;
this.isOnLoad = true;
this.systemInfo = wx.getSystemInfoSync()
console.log(this.systemInfo,'-----------systemInfo')
let menuButtonInfo = wx.getMenuButtonBoundingClientRect()
console.log(menuButtonInfo,'menuButtonInfo')
this.tabbarHeight = (menuButtonInfo.top - this.systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + this.systemInfo.statusBarHeight
console.log(this.tabbarHeight,'-----------tabbarHeight')
// 获取页面数据
if (this.mpApp.globalData.pageList) {
console.log(this.mpApp.globalData.pageList,'-----------------this.mpApp.globalData.pageList')
this.init(this.mpApp.globalData.pageList);
} else {
this.mpApp.pageCallBack = (params) => {
console.log(params,'-----------------this.mpApp.globalData.pageList')
that.init(params);
};
}
}, },
methods: { methods: {
back() {
wx.navigateBack()
},
conF() { conF() {
this.contentShow = false;
this.checked = true; this.checked = true;
}, },
closeDia() {
this.contentShow = false;
},
getshop() { getshop() {
this.shopName = wx.getStorageSync("shopName"); this.shopName = wx.getStorageSync("shopName");
this.logoUrl = wx.getStorageSync("logoUrl"); this.logoUrl = wx.getStorageSync("logoUrl");
...@@ -184,6 +234,120 @@ export default { ...@@ -184,6 +234,120 @@ export default {
} }
}, },
init() { init() {
console.log("----------------------207")
this.setVisible(this.mpApp.globalData.pageList,(res)=>{
this.pageInfo = res;
this.pageData = JSON.parse(this.pageInfo.pageData);
console.log(this.pageData,'----------pageData')
});
},
async setVisible(pageList, cb) {
// 首页显示条件
let pageInfo = pageList.filter((item) => item.pageCode == 14)[0];
console.log(pageInfo,'-----------pageInfo')
let pageData = JSON.parse(pageInfo.pageData);
// 查询显示条件id
let showConditionIds = checkShowConditionIds(pageData);
// 查询可显示的条件
let { data: ids ,isAreaNavigation} = await this.checkCondition(showConditionIds);
// 没有定位组件
// if (!isAreaNavigation) {
// cb()
// return
// }
// 设置visible
pageInfo.pageData = this.updateCondition(pageData, ids);
log.info(showConditionIds, "--------------5454", ids, pageInfo);
cb(pageInfo)
},
checkCondition({ allCondition }) {
return new Promise((resolve, reject) => {
// 获取
let params = { showConditionIds:allCondition, region: "" };
shop
.checkShowCondition(params)
.then((res) => {
log.info(params, "check显示条件", res.data);
if (res.data.code == 200) {
resolve(res.data);
}
})
.catch((err) => {
log.info("check显示条件失败", err);
});
});
},
updateCondition(pageData, ids) {
pageData.forEach((item) => {
pollCondition(item);
});
function pollCondition(data) {
if (Object.prototype.toString.call(data) === "[object Object]") {
if (data.visible && data.visible > 1 && data.visibleCopy == undefined) {
data.visibleCopy = data.visible;
console.log(data.visibleCopy,'--data.visibleCopy')
}
if ((data.visibleCopy == 2 && wx.getStorageSync('sessionid')) ||
(data.visibleCopy == 3 && !wx.getStorageSync('sessionid'))
) {
data.visible = 1;
} else if ((data.visibleCopy == 2 && !wx.getStorageSync('sessionid')) ||
(data.visibleCopy == 3 && wx.getStorageSync('sessionid'))
) {
data.visible = 0;
} else {
if (data.condition != "" && data.condition != undefined) {
data.visible = ids.some((item) => {
return item == data.condition;
})
? 1
: 0;
}
}
for (const key in data) {
if (data.hasOwnProperty(key)) {
const element = data[key];
if (
Object.prototype.toString.call(element) === "[object Object]"
) {
if (element.visible && element.visible > 1 && element.visibleCopy == undefined) {
element.visibleCopy = element.visible;
}
if ((element.visibleCopy == 2 && wx.getStorageSync('sessionid')) ||
(element.visibleCopy == 3 && !wx.getStorageSync('sessionid'))
) {
element.visible = 1;
} else if ((element.visibleCopy == 2 && !wx.getStorageSync('sessionid')) ||
(element.visibleCopy == 3 && wx.getStorageSync('sessionid'))
) {
element.visible = 0;
} else {
if (element.condition != "" && element.condition != undefined) {
console.log("979797", element.condition);
element.visible = ids.some((item) => {
return item == element.condition;
})
? 1
: 0;
}
}
pollCondition(element);
} else if (
Object.prototype.toString.call(element) === "[object Array]" &&
element.length > 0
) {
element.forEach((item) => {
pollCondition(item);
});
}
}
}
}
}
return JSON.stringify(pageData);
},
initUser() {
let _this = this; let _this = this;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let query = { let query = {
...@@ -252,7 +416,8 @@ export default { ...@@ -252,7 +416,8 @@ export default {
success: (e) => { success: (e) => {
_this.wxUserInfo = e.userInfo; _this.wxUserInfo = e.userInfo;
log.info('获取wx.getUserProfile用户信息',_this.wxUserInfo); log.info('获取wx.getUserProfile用户信息',_this.wxUserInfo);
this.init() console.log(_this.wxUserInfo,'--_this.wxUserInfo')
this.initUser()
.then(res => { .then(res => {
//存入openid //存入openid
try { try {
...@@ -568,6 +733,51 @@ export default { ...@@ -568,6 +733,51 @@ export default {
delta: 1 delta: 1
}); });
}, },
// 账号密码登录
loginIn(val) {
console.log(val,'-----------loginIn')
log.info(val,'-----------loginIn')
if (val.account == "") {
return wx.showToast({title: "账号不能为空",icon: "none"});
}
if (val.password == "") {
return wx.showToast({title: "请输入密码", icon: "none"});
}
if(this.content&&!this.checked) {
wx.showToast({
title: '您还未同意协议',
icon: "none"
});
return
}
wx.showLoading({
title: '登录中...',
mask: true
})
login
.getLogin(val)
.then(res => {
if (res.data.code == 200) {
this.backParams += `&sessionid=${
res.data.data.sessionId
}&needCertified=${res.data.data.NEED_CERTIFIED}`;
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
});
this.pushPageType();
} else {
wx.showToast({title: res.data.msg, icon: "none"})
}
wx.hideLoading();
})
},
// 忘记密码
forgetPassword(val) {
if(!val) return;
wx.showToast({ title: val, icon: "none" });
},
getShopUserProtocol() { getShopUserProtocol() {
login.getShopUserProtocol().then(res => { login.getShopUserProtocol().then(res => {
log.info('获取用户协议',res) log.info('获取用户协议',res)
...@@ -575,100 +785,38 @@ export default { ...@@ -575,100 +785,38 @@ export default {
this.content = res.data.data; this.content = res.data.data;
} }
}); });
} },
} }
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.posterWrap_btn {
position: absolute;
bottom: 0px;
background: #fff;
width: 100%;
height: 46px;
display: flex;
justify-content: center;
box-sizing: border-box;
padding: 5px;
div {
padding: 0 20px;
color: #fff;
background-color: red;
border-radius: 20px;
line-height: 36px;
height: 36px;
}
}
.posterWrap {
box-sizing: border-box;
height: 100%;
overflow: auto;
padding: 0 16px;
padding-bottom: 46px;
}
.readAgreement {
width: 100%;
position: fixed;
bottom: 20px;
font-size: 12px;
display: flex;
justify-content: center;
color: #1989fa;
align-items: center;
}
.domain { .domain {
position: relative; position: relative;
.toCLogin { width: 100vw;
display: flex; height: 100vh;
overflow-y: auto;
.tabbar{
width: 100%; width: 100%;
// padding: 0 35px; box-sizing: border-box;
margin-top: 20%; display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center; align-items: center;
.shopName { padding-left: 12px;
font-size: 16px; .tab-back{
font-weight: bold; /deep/.van-icon-arrow-left{
color: #333; font-size: 22px;
}
.img {
width: 100px;
height: 100px;
}
.btn_info {
margin-top: 75px;
color: #000;
align-items: center;
justify-content: space-around;
.btn {
background-color: #07c160;
color: #fff;
height: 45px;
width: 200px;
border-radius: 45px;
display: flex;
justify-content: center;
align-items: center;
} }
} }
.enterpriseLogin {
position: absolute;
bottom: -100px;
left: 50%;
transform: translateX(-50%);
color: #333;
text-decoration: underline;
font-size: 15px;
}
} }
.toCLogin1 { .toCLogin1 {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
bottom: 0;
right: 0;
width: 100%; width: 100%;
background: #fff; background: #fff;
z-index: 1;
.btn_info1 { .btn_info1 {
margin: 80px 20px; margin: 80px 20px;
color: #000; color: #000;
...@@ -685,7 +833,7 @@ export default { ...@@ -685,7 +833,7 @@ export default {
margin: 10px 15px; margin: 10px 15px;
font-weight: normal; font-weight: normal;
} }
.hint{ .hint {
color: #888; color: #888;
font-size: 15px; font-size: 15px;
text-align: center; text-align: center;
...@@ -693,8 +841,8 @@ export default { ...@@ -693,8 +841,8 @@ export default {
} }
.btn { .btn {
margin-top: 25px; margin-top: 25px;
background-color: #5CB83B; background-color: #5cb83b;
color: #FFFAFA; color: #fffafa;
height: 45px; height: 45px;
border-radius: 22.5px; border-radius: 22.5px;
font-size: 15px; font-size: 15px;
...@@ -709,7 +857,7 @@ export default { ...@@ -709,7 +857,7 @@ export default {
font-size: 15px; font-size: 15px;
line-height: 45px; line-height: 45px;
} }
.cancelLogin{ .cancelLogin {
text-align: center; text-align: center;
color: #999; color: #999;
font-size: 14px; font-size: 14px;
......
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
"van-checkbox": "/static/vant/checkbox/index", "van-checkbox": "/static/vant/checkbox/index",
"van-popup":"/static/vant/popup/index", "van-popup":"/static/vant/popup/index",
"van-icon":"/static/vant/icon/index" "van-icon":"/static/vant/icon/index"
} },
"navigationStyle":"custom"
} }
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