|
@@ -21,9 +21,22 @@
|
|
|
请输入正确的手机号码
|
|
请输入正确的手机号码
|
|
|
</div>
|
|
</div>
|
|
|
</li>
|
|
</li>
|
|
|
- <li class="password">
|
|
|
|
|
|
|
+ <li class="password" v-if="!bindShow">
|
|
|
<input placeholder="请输入密码" type="password" v-model="passwordNum"/>
|
|
<input placeholder="请输入密码" type="password" v-model="passwordNum"/>
|
|
|
</li>
|
|
</li>
|
|
|
|
|
+ <li v-if="bindShow" class="code clearfix">
|
|
|
|
|
+ <input placeholder="请输入验证码" type="tel" v-model="codeNum" style="margin-left: 0;"/>
|
|
|
|
|
+ <span class="pull-right codeBtn" @click="getCode()">
|
|
|
|
|
+ {{showExtraTime ? getExtraTime + 'S' : '获取验证码'}}
|
|
|
|
|
+ </span>
|
|
|
|
|
+ </li>
|
|
|
|
|
+ <li class="wechat-view-info clearfix" v-if="bindShow">
|
|
|
|
|
+ <div v-show="codeerror" class="pull-left">
|
|
|
|
|
+ 验证码错误
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="pull-right" @click="bindShow = false">用户名密码登录</div>
|
|
|
|
|
+ </li>
|
|
|
|
|
+ <li class="toInfoBind" @click="toInfoBind()" v-if="!bindShow">通过短信绑定</li>
|
|
|
</ul>
|
|
</ul>
|
|
|
<div class="loginBtn" @click="login">确定绑定已有账号登录</div>
|
|
<div class="loginBtn" @click="login">确定绑定已有账号登录</div>
|
|
|
<div class="register">还没有优软账号,直接<span @click="resgiter">创建新账号</span></div>
|
|
<div class="register">还没有优软账号,直接<span @click="resgiter">创建新账号</span></div>
|
|
@@ -37,7 +50,7 @@
|
|
|
</nuxt-link>
|
|
</nuxt-link>
|
|
|
</div>
|
|
</div>
|
|
|
<remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
|
|
<remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
|
|
|
- <div class="listAlert" ref="userContent" v-show="wechatInfo.enterprises">
|
|
|
|
|
|
|
+ <div class="listAlert" ref="userContent" v-show="wechatInfo.enterprises && enuu === ''">
|
|
|
<ul>
|
|
<ul>
|
|
|
<li v-for="(item, index) in wechatInfo.enterprises" @click="clickItem(item)">
|
|
<li v-for="(item, index) in wechatInfo.enterprises" @click="clickItem(item)">
|
|
|
{{item.enName}}
|
|
{{item.enName}}
|
|
@@ -63,7 +76,13 @@
|
|
|
timeoutCount: 0,
|
|
timeoutCount: 0,
|
|
|
telerror: false,
|
|
telerror: false,
|
|
|
telphoneNum: '',
|
|
telphoneNum: '',
|
|
|
- passwordNum: ''
|
|
|
|
|
|
|
+ passwordNum: '',
|
|
|
|
|
+ codeNum: '',
|
|
|
|
|
+ bindShow: false, // 选择手机验证码绑定
|
|
|
|
|
+ codeerror: false, // 显示验证码错误
|
|
|
|
|
+ showExtraTime: false, // 倒计时
|
|
|
|
|
+ getExtraTime: 60,
|
|
|
|
|
+ enuu: ''
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
@@ -71,18 +90,29 @@
|
|
|
if (this.$route.query.url) {
|
|
if (this.$route.query.url) {
|
|
|
localStorage.setItem('RETURNURL', this.$route.query.url || '')
|
|
localStorage.setItem('RETURNURL', this.$route.query.url || '')
|
|
|
}
|
|
}
|
|
|
|
|
+ if (this.$route.query.enuu) {
|
|
|
|
|
+ this.enuu = this.$route.query.enuu
|
|
|
|
|
+ }
|
|
|
let ua = this.$store.state.option.userAgent.toLowerCase()
|
|
let ua = this.$store.state.option.userAgent.toLowerCase()
|
|
|
if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && !this.$route.query.code && !info) {
|
|
if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && !this.$route.query.code && !info) {
|
|
|
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
|
|
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
|
|
|
} else if (info) {
|
|
} else if (info) {
|
|
|
|
|
+ // 绑定过的用户一定存在openid
|
|
|
info = JSON.parse(info)
|
|
info = JSON.parse(info)
|
|
|
if (info.openid) {
|
|
if (info.openid) {
|
|
|
- this.$store.dispatch('GerWechatInfo', {code: '', openId: info.openid})
|
|
|
|
|
|
|
+ this.$store.dispatch('GerWechatInfo', {code: '', openId: info.openid}).then(res => {
|
|
|
|
|
+ // 存在enuu
|
|
|
|
|
+ if (this.enuu) {
|
|
|
|
|
+ this.loginFromEnuu()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
localStorage.removeItem('USOFTMALLWECHATINFO')
|
|
localStorage.removeItem('USOFTMALLWECHATINFO')
|
|
|
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
|
|
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ // 用户第一次进入公众号
|
|
|
|
|
+ // this.$store.dispatch('GerWechatInfo', {code: '', openId: 'o2o8JwgMp9I8Es7yneC88JD7H2ts'}) // 测试用的数据
|
|
|
this.$store.dispatch('GerWechatInfo', {code: this.$route.query.code})
|
|
this.$store.dispatch('GerWechatInfo', {code: this.$route.query.code})
|
|
|
}
|
|
}
|
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -96,6 +126,17 @@
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ // 路由带有enuu
|
|
|
|
|
+ loginFromEnuu() {
|
|
|
|
|
+ let _item = {}
|
|
|
|
|
+ this.wechatInfo.enterprises.forEach((item) => {
|
|
|
|
|
+ if (item.uu === parseInt(this.enuu)) {
|
|
|
|
|
+ _item = item
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ this.clickItem(_item)
|
|
|
|
|
+ },
|
|
|
|
|
+ // 选择账套登录
|
|
|
clickItem(item) {
|
|
clickItem(item) {
|
|
|
let userAccount = this.baseUtils.deepCopy(this.$store.state.option.wechatInfo.data.userAccount)
|
|
let userAccount = this.baseUtils.deepCopy(this.$store.state.option.wechatInfo.data.userAccount)
|
|
|
userAccount.spaceUU = item.uu
|
|
userAccount.spaceUU = item.uu
|
|
@@ -117,29 +158,52 @@
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ // 手机号码失去焦点
|
|
|
telphoneBlur() {
|
|
telphoneBlur() {
|
|
|
|
|
+ if (this.telphoneNum === '') { return }
|
|
|
this.telerror = false
|
|
this.telerror = false
|
|
|
if (!/^1[3|5|7|8]\d{9}$/.test(this.telphoneNum)) {
|
|
if (!/^1[3|5|7|8]\d{9}$/.test(this.telphoneNum)) {
|
|
|
this.telerror = true
|
|
this.telerror = true
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ // 绑定操作
|
|
|
login() {
|
|
login() {
|
|
|
|
|
+ let openid = this.$store.state.option.wechatInfo.data.openid
|
|
|
if (this.telerror === true) {
|
|
if (this.telerror === true) {
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
- if (!this.passwordNum || this.passwordNum === '') {
|
|
|
|
|
- this.collectResult = '密码不能为空'
|
|
|
|
|
|
|
+ if (!this.telphoneNum || this.telphoneNum === '') {
|
|
|
|
|
+ this.collectResult = '手机号码不能为空'
|
|
|
this.timeoutCount++
|
|
this.timeoutCount++
|
|
|
return false
|
|
return false
|
|
|
}
|
|
}
|
|
|
- let openid = this.$store.state.option.wechatInfo.data.openid
|
|
|
|
|
- this.$http.post('/wx/bindUser', {userTel: this.telphoneNum, userPwd: this.passwordNum, openId: openid}).then(res => {
|
|
|
|
|
|
|
+ // 'o2o8JwgMp9I8Es7yneC88JD7H2ts'
|
|
|
|
|
+ let _item = {
|
|
|
|
|
+ userTel: this.telphoneNum,
|
|
|
|
|
+ openId: openid
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.bindShow === true) {
|
|
|
|
|
+ if (!this.codeNum || this.codeNum === '') {
|
|
|
|
|
+ this.collectResult = '验证码不能为空'
|
|
|
|
|
+ this.timeoutCount++
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ _item.code = this.codeNum
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (!this.passwordNum || this.passwordNum === '') {
|
|
|
|
|
+ this.collectResult = '密码不能为空'
|
|
|
|
|
+ this.timeoutCount++
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ _item.userPwd = this.passwordNum
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$http.post('/wx/bindUser', _item).then(res => {
|
|
|
if (res.data.success) {
|
|
if (res.data.success) {
|
|
|
this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', res.data)
|
|
this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', res.data)
|
|
|
localStorage.setItem('USOFTMALLWECHATINFO', JSON.stringify(res.data))
|
|
localStorage.setItem('USOFTMALLWECHATINFO', JSON.stringify(res.data))
|
|
|
} else {
|
|
} else {
|
|
|
localStorage.removeItem('USOFTMALLWECHATINFO')
|
|
localStorage.removeItem('USOFTMALLWECHATINFO')
|
|
|
- this.collectResult = res.data.message
|
|
|
|
|
|
|
+ this.collectResult = res.data.message || res.data.errMsg
|
|
|
this.timeoutCount++
|
|
this.timeoutCount++
|
|
|
}
|
|
}
|
|
|
}, err => {
|
|
}, err => {
|
|
@@ -154,6 +218,44 @@
|
|
|
window.location.href = response.data.content
|
|
window.location.href = response.data.content
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ },
|
|
|
|
|
+ // 选择短信绑定操作
|
|
|
|
|
+ toInfoBind() {
|
|
|
|
|
+ this.bindShow = true
|
|
|
|
|
+ },
|
|
|
|
|
+ getCode() {
|
|
|
|
|
+ if (this.telerror) {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!this.telphoneNum || this.telphoneNum === '') {
|
|
|
|
|
+ this.collectResult = '手机号码不能为空'
|
|
|
|
|
+ this.timeoutCount++
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.showExtraTime) {
|
|
|
|
|
+ this.collectResult = '获取验证码已发送,请查收'
|
|
|
|
|
+ this.timeoutCount++
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ // todo 这里走请求验证码接口
|
|
|
|
|
+ this.$http.get(`/wx/sendSmsCode?mobile=${this.telphoneNum}`).then((data) => {
|
|
|
|
|
+ if (data.data.success) {
|
|
|
|
|
+ this.showExtraTime = true
|
|
|
|
|
+ this.$timer = setInterval(() => {
|
|
|
|
|
+ this.getExtraTime--
|
|
|
|
|
+ if (this.getExtraTime === 0) {
|
|
|
|
|
+ this.showExtraTime = false
|
|
|
|
|
+ clearInterval(this.$timer)
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 1000)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.collectResult = data.data.errMsg
|
|
|
|
|
+ this.timeoutCount++
|
|
|
|
|
+ }
|
|
|
|
|
+ }, err => {
|
|
|
|
|
+ this.collectResult = err.response.data || '获取失败'
|
|
|
|
|
+ this.timeoutCount++
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
components: {
|
|
components: {
|
|
@@ -166,7 +268,7 @@
|
|
|
},
|
|
},
|
|
|
headerImg() {
|
|
headerImg() {
|
|
|
// return ''
|
|
// return ''
|
|
|
- return this.wechatInfo.headimgurl
|
|
|
|
|
|
|
+ return this.wechatInfo.headimgurl || '/images/mobile/@2x/wechat/header-img.png'
|
|
|
},
|
|
},
|
|
|
wechatInfo() {
|
|
wechatInfo() {
|
|
|
return this.$store.state.option.wechatInfo.data
|
|
return this.$store.state.option.wechatInfo.data
|
|
@@ -282,6 +384,26 @@
|
|
|
vertical-align: top;
|
|
vertical-align: top;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ &.code {
|
|
|
|
|
+ border-bottom: 1px solid #eee;
|
|
|
|
|
+ }
|
|
|
|
|
+ &.toInfoBind {
|
|
|
|
|
+ color: #3872f4;
|
|
|
|
|
+ font-size: 0.28rem;
|
|
|
|
|
+ text-align: right;
|
|
|
|
|
+ margin-top: 0.2rem;
|
|
|
|
|
+ margin-bottom: 0.2rem;
|
|
|
|
|
+ }
|
|
|
|
|
+ .codeBtn {
|
|
|
|
|
+ font-size: 0.28rem;
|
|
|
|
|
+ color: #376ef3;
|
|
|
|
|
+ width: 1.8rem;
|
|
|
|
|
+ height: 0.5rem;
|
|
|
|
|
+ line-height: 0.5rem;
|
|
|
|
|
+ border-radius: 0.04rem;
|
|
|
|
|
+ border: 1px solid #376ef3;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
.loginBtn {
|
|
.loginBtn {
|
|
|
width: 5.8rem;
|
|
width: 5.8rem;
|
|
@@ -292,7 +414,7 @@
|
|
|
color: #fff;
|
|
color: #fff;
|
|
|
background: #376ef3;
|
|
background: #376ef3;
|
|
|
border-radius: 5px;
|
|
border-radius: 5px;
|
|
|
- margin: 1.29rem auto 0;
|
|
|
|
|
|
|
+ margin: 1rem auto 0;
|
|
|
}
|
|
}
|
|
|
.register {
|
|
.register {
|
|
|
width: 5.8rem;
|
|
width: 5.8rem;
|