提交 de529cf5 authored 作者: 王鹏飞's avatar 王鹏飞

登录支持公众号登录

上级 bb87c761
......@@ -12,4 +12,4 @@
}
resizeRoot()
win.addEventListener('resize', resizeRoot, false)
})(window, document)</script><link href=/css/chunk-28e90e1f.15f611d8.css rel=prefetch><link href=/css/chunk-3ee98f8a.b376d8d9.css rel=prefetch><link href=/css/chunk-7d5f6513.4909f3fd.css rel=prefetch><link href=/css/chunk-da161232.6e8b52de.css rel=prefetch><link href=/js/chunk-07a68fe4.3a51594b.js rel=prefetch><link href=/js/chunk-28e90e1f.aa7008c7.js rel=prefetch><link href=/js/chunk-2d0aa22f.ea880408.js rel=prefetch><link href=/js/chunk-2d21ef2c.b8a454c7.js rel=prefetch><link href=/js/chunk-3ee98f8a.3fd67aa8.js rel=prefetch><link href=/js/chunk-7d5f6513.f2ed0eae.js rel=prefetch><link href=/js/chunk-da161232.d69668cc.js rel=prefetch><link href=/css/app.f63499c3.css rel=preload as=style><link href=/css/chunk-vendors.c67203ba.css rel=preload as=style><link href=/js/app.6cd3c3f8.js rel=preload as=script><link href=/js/chunk-vendors.cb632111.js rel=preload as=script><link href=/css/chunk-vendors.c67203ba.css rel=stylesheet><link href=/css/app.f63499c3.css rel=stylesheet></head><body><noscript><strong>We're sorry but ezijing-office-h5 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.cb632111.js></script><script src=/js/app.6cd3c3f8.js></script></body></html>
\ No newline at end of file
})(window, document)</script><link href=/css/chunk-3ee98f8a.b376d8d9.css rel=prefetch><link href=/css/chunk-652387d3.15f611d8.css rel=prefetch><link href=/css/chunk-7d5f6513.4909f3fd.css rel=prefetch><link href=/css/chunk-da161232.6e8b52de.css rel=prefetch><link href=/js/chunk-07a68fe4.3a51594b.js rel=prefetch><link href=/js/chunk-2d0aa22f.8af7e3f1.js rel=prefetch><link href=/js/chunk-2d21ef2c.57e349b6.js rel=prefetch><link href=/js/chunk-3ee98f8a.1431c8ff.js rel=prefetch><link href=/js/chunk-652387d3.68182a91.js rel=prefetch><link href=/js/chunk-7d5f6513.02b7026a.js rel=prefetch><link href=/js/chunk-da161232.cb9623ff.js rel=prefetch><link href=/css/app.f63499c3.css rel=preload as=style><link href=/css/chunk-vendors.c67203ba.css rel=preload as=style><link href=/js/app.0122284e.js rel=preload as=script><link href=/js/chunk-vendors.cb632111.js rel=preload as=script><link href=/css/chunk-vendors.c67203ba.css rel=stylesheet><link href=/css/app.f63499c3.css rel=stylesheet></head><body><noscript><strong>We're sorry but ezijing-office-h5 doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.cb632111.js></script><script src=/js/app.0122284e.js></script></body></html>
\ No newline at end of file
差异被折叠。
差异被折叠。
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0aa22f"],{1071:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"main"},[n("div",{staticClass:"form-tips"},[t._v(t._s(t.page.tips))]),n("v-form",{ref:"form",attrs:{model:t.formModel,fields:t.page.form.fields},on:{submit:t.onSubmit}}),n("div",{staticClass:"fixed-box"},[n("div",{staticClass:"fixed-inner"},[n("div",{staticClass:"fixed-button",on:{click:t.handleSubmit}},[t._v("提交")])])])],1)},a=[],r=(n("ac1f"),n("5319"),n("d0af")),o=n("c84f"),s=n("8477"),u=n("365c"),c={name:"Edit",components:{VForm:s["a"]},metaInfo:function(){return{title:this.page.title}},data:function(){return{formModel:{}}},watch:{$route:{immediate:!0,deep:!0,handler:function(t){var e=this;t.query.channel||this.$dialog.alert({message:"请选择事务"}).then((function(){e.$router.replace({name:"index",query:e.$route.query})}))}}},computed:{page:function(){var t=this.$route.query.channel;return o["a"][t]?o["a"][t]["edit"]:{}},channelId:function(){return this.$route.query.channel_id},viewId:function(){return this.$route.query.view_id}},methods:{handleSubmit:function(){this.$refs.form.submit()},onSubmit:function(t){var e=this;if(t.affair_id=this.channelId,t.payment_instrument){var n=Object(r["a"])(t.payment_instrument,1),i=n[0],a=void 0===i?{url:""}:i;t.payment_instrument=a.url}u["h"](this.viewId,t).then((function(t){t.success?e.$dialog.alert({confirmButtonText:"确定",message:"修改成功"}).then((function(){e.$router.push({name:"list",query:e.$route.query})})):e.$toast(t.message)}))},getDetail:function(){var t=this,e=this.$toast.loading({message:"加载中...",forbidClick:!0,duration:0});u["c"](this.viewId).then((function(n){t.formModel=n.form,e.clear()})).catch(e.clear)}},beforeMount:function(){this.getDetail()}},f=c,l=n("2877"),d=Object(l["a"])(f,i,a,!1,null,null,null);e["default"]=d.exports}}]);
//# sourceMappingURL=chunk-2d0aa22f.ea880408.js.map
\ No newline at end of file
//# sourceMappingURL=chunk-2d0aa22f.8af7e3f1.js.map
\ No newline at end of file
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d21ef2c"],{d879:function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"main"},[n("div",{staticClass:"form-tips"},[t._v(t._s(t.page.tips))]),n("v-form",{ref:"form",attrs:{fields:t.page.form.fields},on:{submit:t.onSubmit}}),n("div",{staticClass:"fixed-box"},[n("div",{staticClass:"fixed-inner"},[n("div",{staticClass:"fixed-button",on:{click:t.handleSubmit}},[t._v("提交")])])])],1)},a=[],r=(n("ac1f"),n("5319"),n("d0af")),s=n("c84f"),u=n("8477"),o=n("365c"),c={name:"Create",components:{VForm:u["a"]},metaInfo:function(){return{title:this.page.title}},data:function(){return{}},watch:{$route:{immediate:!0,deep:!0,handler:function(t){var e=this;t.query.channel||this.$dialog.alert({message:"请选择事务"}).then((function(){e.$router.replace({name:"index",query:e.$route.query})}))}}},computed:{page:function(){var t=this.$route.query.channel;return s["a"][t]?s["a"][t]["create"]:{}},channelId:function(){return this.$route.query.channel_id}},methods:{handleSubmit:function(){this.$refs.form.submit()},onSubmit:function(t){var e=this;if(t.affair_id=this.channelId,t.payment_instrument){var n=Object(r["a"])(t.payment_instrument,1),i=n[0],a=void 0===i?{url:""}:i;t.payment_instrument=a.url}o["a"](t).then((function(t){t.success?e.$dialog.alert({confirmButtonText:"确定",message:"提交成功"}).then((function(){e.$router.push({name:"list",query:e.$route.query})})):e.$toast(t.message)}))}}},f=c,l=n("2877"),m=Object(l["a"])(f,i,a,!1,null,null,null);e["default"]=m.exports}}]);
//# sourceMappingURL=chunk-2d21ef2c.b8a454c7.js.map
\ No newline at end of file
//# sourceMappingURL=chunk-2d21ef2c.57e349b6.js.map
\ No newline at end of file
差异被折叠。
差异被折叠。
This source diff could not be displayed because it is too large. You can view the blob instead.
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-da161232"],{"34d4":function(t,i,a){},ca9c:function(t,i,a){"use strict";var s=a("34d4"),e=a.n(s);e.a},d504:function(t,i,a){"use strict";a.r(i);var s=function(){var t=this,i=t.$createElement,a=t._self._c||i;return a("div",{staticClass:"choose"},[a("h2",{staticClass:"choose-title"},[t._v("请选择事务")]),a("div",{staticClass:"choose-list"},[a("van-radio-group",{model:{value:t.radio,callback:function(i){t.radio=i},expression:"radio"}},t._l(t.affairTypes,(function(i){return a("div",{key:i.value,staticClass:"choose-item"},[a("van-radio",{attrs:{name:i.id}},[t._v(t._s(i.affair_name))])],1)})),0)],1),a("div",{staticClass:"fixed-box"},[a("div",{staticClass:"fixed-inner"},[a("div",{staticClass:"fixed-button",on:{click:t.toListPage}},[t._v("下一步")])])])])},e=[],n=(a("7db0"),a("d0af")),r={data:function(){return{radio:""}},computed:{affairTypes:function(){return this.$store.state.affairTypes},currentItem:function(){var t=this;return this.affairTypes.find((function(i){return i.id===t.radio}))}},methods:{toListPage:function(){this.radio?this.$router.push({name:"list",query:Object.assign(this.$route.query,{channel:this.currentItem.form_name,channel_id:this.radio})}):this.$toast("请选择事务")},getList:function(){if(this.affairTypes.length){var t=Object(n["a"])(this.affairTypes,1),i=t[0];this.radio=i.id}else this.$store.dispatch("getAffairTypes")}},beforeMount:function(){this.getList()}},o=r,c=(a("ca9c"),a("2877")),u=Object(c["a"])(o,s,e,!1,null,null,null);i["default"]=u.exports}}]);
//# sourceMappingURL=chunk-da161232.d69668cc.js.map
\ No newline at end of file
//# sourceMappingURL=chunk-da161232.cb9623ff.js.map
\ No newline at end of file
......@@ -12,6 +12,7 @@
"axios": "^0.19.2",
"core-js": "^3.6.5",
"dayjs": "^1.8.24",
"js-cookie": "^2.2.1",
"md5": "^2.2.1",
"qs": "^6.9.3",
"vant": "^2.6.1",
......
......@@ -8,6 +8,14 @@ export function login(data) {
data
})
}
// 绑定微信
export function bindWechat(data) {
return httpRequest({
url: '/api/passport/rest/wechat/bind-unionid',
method: 'post',
data
})
}
// 重置密码
export function resetPassword(data) {
return httpRequest({
......
......@@ -45,19 +45,24 @@
</div>
</template>
<script>
import Cookies from 'js-cookie'
import * as api from '@/api/account'
import Password from './Password.vue'
export default {
components: { Password },
data() {
const UA = navigator.userAgent.toLowerCase()
return {
ruleForm: {
account: '',
password: '',
RememberMe: false
},
passwordVisible: false
passwordVisible: false,
isWechat: /micromessenger/.test(UA),
unionid: Cookies.get('wechat_login_no_phone_error')
}
},
computed: {
......@@ -75,7 +80,7 @@ export default {
} else if (!this.ruleForm.password) {
this.$notify('请输入密码')
} else {
this.loginRequest()
this.unionid ? this.bindWechat() : this.loginRequest()
}
},
// 登录
......@@ -93,6 +98,21 @@ export default {
error.response && this.$notify(error.response.data.message)
})
},
// 绑定微信并登录
bindWechat() {
let data = Object.assign({}, this.ruleForm, {
unionid: this.unionid,
type: 1
})
api
.bindWechat(data)
.then(response => {
this.loginSuccess(response)
})
.catch(error => {
error.response && this.$notify(error.response.data.message)
})
},
// 登录成功
loginSuccess(response) {
if (response.code === 0) {
......@@ -104,6 +124,28 @@ export default {
} else {
this.$notify(response.msg)
}
},
wechatLogin() {
const appId = 'wx451c01d40d090d7a'
// 回调地址
const redirectURI = `https://passport2.ezijing.com/rest/wechat/oauth-callback?needCheck=false&identity=friend&redirectUrl=${location.origin}`
// 微信的地址
const wechatUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(
redirectURI
)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
// 打开地址
location.href = wechatUrl
},
checkWechatLogin() {
return !!(
Cookies.get('wechat_login_error') ||
Cookies.get('wechat_login_no_phone_error')
)
}
},
created() {
if (this.isWechat && !this.checkWechatLogin()) {
this.wechatLogin()
}
}
}
......
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论