Commit ebf2ef20 by Lays-lzq

Merge branch 'feature/login'

parents 8604d8bf 47ef8e7e
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
</template> </template>
<script> <script>
import { mapActions } from 'vuex'
import Bus from '@/utils/Bus' import Bus from '@/utils/Bus'
export default { export default {
name: 'BindPhoneDialog', name: 'BindPhoneDialog',
...@@ -30,7 +29,6 @@ export default { ...@@ -30,7 +29,6 @@ export default {
} }
}, },
methods: { methods: {
...mapActions({ jumpToBinding: 'users/jumpToBinding' }),
onClose() { onClose() {
this.visible = false this.visible = false
this.$toast({ this.$toast({
...@@ -43,7 +41,7 @@ export default { ...@@ -43,7 +41,7 @@ export default {
message: '正在为您转跳,请完成绑定手机操作', message: '正在为您转跳,请完成绑定手机操作',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.jumpToBinding() Bus.$emit('showLogin')
} }
}) })
} }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
</template> </template>
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters } from 'vuex'
import { CUSTOM_SOURCE_TYPE } from '@/utils/constant' import { CUSTOM_SOURCE_TYPE } from '@/utils/constant'
import Bus from '@/utils/Bus' import Bus from '@/utils/Bus'
...@@ -35,7 +35,6 @@ export default { ...@@ -35,7 +35,6 @@ export default {
Bus.$off('initDeal') Bus.$off('initDeal')
}, },
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin' }),
init() { init() {
const { uin, id } = this.$route.query const { uin, id } = this.$route.query
if (typeof complaintsDeal === 'undefined') { if (typeof complaintsDeal === 'undefined') {
...@@ -81,7 +80,7 @@ export default { ...@@ -81,7 +80,7 @@ export default {
duration: 1500, duration: 1500,
onClose() { onClose() {
if (process.client && window.self !== window.top) return if (process.client && window.self !== window.top) return
self.jumpToLogin() self.showLogin()
} }
}) })
} }
...@@ -127,6 +126,9 @@ export default { ...@@ -127,6 +126,9 @@ export default {
this.entry.classList.remove('sidebar-hidden-scroll') this.entry.classList.remove('sidebar-hidden-scroll')
}, 500) }, 500)
} }
},
showLogin() {
Bus.$emit('showLogin')
} }
} }
} }
......
...@@ -267,7 +267,7 @@ export default { ...@@ -267,7 +267,7 @@ export default {
Bus.$off('updateMain') Bus.$off('updateMain')
}, },
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin', updateInfo: 'lottery/updateInfo' }), ...mapActions({ updateInfo: 'lottery/updateInfo' }),
// 中奖后, 关闭窗口回调 // 中奖后, 关闭窗口回调
winCloseCallback() { winCloseCallback() {
this.isShowWin = false this.isShowWin = false
...@@ -305,7 +305,7 @@ export default { ...@@ -305,7 +305,7 @@ export default {
message: '请先登录', message: '请先登录',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.jumpToLogin() Bus.$emit('showLogin')
} }
}) })
return return
......
...@@ -270,7 +270,7 @@ export default { ...@@ -270,7 +270,7 @@ export default {
Bus.$off('updateMain') Bus.$off('updateMain')
}, },
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin', updateInfo: 'lottery/updateInfo' }), ...mapActions({ updateInfo: 'lottery/updateInfo' }),
// 中奖后, 关闭窗口回调 // 中奖后, 关闭窗口回调
winCloseCallback(){ winCloseCallback(){
this.isShowWin = false this.isShowWin = false
...@@ -308,7 +308,7 @@ export default { ...@@ -308,7 +308,7 @@ export default {
message: '请先登录', message: '请先登录',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.jumpToLogin() Bus.$emit('showLogin')
} }
}) })
return return
......
...@@ -24,8 +24,9 @@ ...@@ -24,8 +24,9 @@
</template> </template>
<script> <script>
import { mapGetters, mapActions } from 'vuex' import { mapGetters } from 'vuex'
import RecordsPupup from '@/components/Lottery/Instant/RecordsPupup' import RecordsPupup from '@/components/Lottery/Instant/RecordsPupup'
import Bus from '@/utils/Bus'
export default { export default {
name: 'Records', name: 'Records',
...@@ -56,7 +57,6 @@ export default { ...@@ -56,7 +57,6 @@ export default {
this.recordsAnimation() this.recordsAnimation()
}, },
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin' }),
openRecord() { openRecord() {
if (this.recordsLayouts && this.recordsLayouts.classList.contains('sidebar-hidden-scroll')) { if (this.recordsLayouts && this.recordsLayouts.classList.contains('sidebar-hidden-scroll')) {
this.recordsLayouts.classList.remove('sidebar-hidden-scroll') this.recordsLayouts.classList.remove('sidebar-hidden-scroll')
...@@ -67,7 +67,7 @@ export default { ...@@ -67,7 +67,7 @@ export default {
message: '请先登录,正在为您转跳', message: '请先登录,正在为您转跳',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.jumpToLogin() Bus.$emit('showLogin')
} }
}) })
} else { } else {
......
...@@ -141,7 +141,7 @@ export default { ...@@ -141,7 +141,7 @@ export default {
Bus.$emit('initDeal', '#093c85') Bus.$emit('initDeal', '#093c85')
}, },
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin', updateInfo: 'lottery/updateInfo' }), ...mapActions({ updateInfo: 'lottery/updateInfo' }),
// 开始抽奖 // 开始抽奖
startLottery() { startLottery() {
Bus.$emit('updateMain', { func: 'startLottery' }) Bus.$emit('updateMain', { func: 'startLottery' })
......
...@@ -146,7 +146,7 @@ export default { ...@@ -146,7 +146,7 @@ export default {
Bus.$emit('initDeal', '#093c85') Bus.$emit('initDeal', '#093c85')
}, },
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin', updateInfo: 'lottery/updateInfo' }), ...mapActions({ updateInfo: 'lottery/updateInfo' }),
// 开始抽奖 // 开始抽奖
startLottery() { startLottery() {
Bus.$emit('updateMain', { func: 'startLottery' }) Bus.$emit('updateMain', { func: 'startLottery' })
......
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
this.eventHubInit() this.eventHubInit()
}, },
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin', updateInfo: 'lottery/updateInfo' }), ...mapActions({ updateInfo: 'lottery/updateInfo' }),
eventHubInit() { eventHubInit() {
Bus.$on('updateMain', data => { Bus.$on('updateMain', data => {
for (const [key, value] of Object.entries(data)) { for (const [key, value] of Object.entries(data)) {
...@@ -113,7 +113,7 @@ export default { ...@@ -113,7 +113,7 @@ export default {
message: '请先登录', message: '请先登录',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.jumpToLogin() Bus.$emit('showLogin')
} }
}) })
} else if (this.lotteryInfo.status !== 1) { } else if (this.lotteryInfo.status !== 1) {
......
...@@ -94,7 +94,7 @@ export default { ...@@ -94,7 +94,7 @@ export default {
}) })
}, },
methods: { methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin', updateInfo: 'lottery/updateInfo' }), ...mapActions({ updateInfo: 'lottery/updateInfo' }),
eventHubInit() { eventHubInit() {
Bus.$on('updateMain', data => { Bus.$on('updateMain', data => {
for (const [key, value] of Object.entries(data)) { for (const [key, value] of Object.entries(data)) {
...@@ -134,7 +134,7 @@ export default { ...@@ -134,7 +134,7 @@ export default {
message: '请先登录', message: '请先登录',
duration: 1500, duration: 1500,
onClose: () => { onClose: () => {
this.jumpToLogin() Bus.$emit('showLogin')
} }
}) })
} else if (this.lotteryInfo.status !== 1) { } else if (this.lotteryInfo.status !== 1) {
......
...@@ -5,7 +5,94 @@ ...@@ -5,7 +5,94 @@
</div> </div>
</template> </template>
<script> <script>
export default {} import Bus from '@/utils/Bus'
import { mapActions } from 'vuex'
import loginAction from '@/plugins/UserAction/login'
export default {
data() {
return {
loginInstance: null,
}
},
mounted() {
this.initLoginCenter()
Bus.$on('showLogin', this.toggleLogin)
},
destroyed() {
Bus.$off('showLogin')
},
methods: {
...mapActions({ jumpToLogin: 'users/jumpToLogin' }),
// 云平台登录模块初始化
initLoginCenter() {
if (!window.LoginCenter) return
// eslint-disable-next-line no-undef
this.loginInstance = LoginCenter({
target: document.body,
props: {
uin: this.$route.query.uin,
zIndex: 100000,
backUrl: encodeURIComponent(window.location.href),
serviceAgreement: `//${process.env.OSS_DOMAIN}/staticPages/agreement_user.html`,
privacyAgreement: `//${process.env.OSS_DOMAIN}/staticPages/agreement_privacy.html`,
successCallback: ({ type, response }) => {
if (type === 'recover'){
this.$toast("密码修改成功!");
setTimeout(() => {
this.loginInstance.hide()
}, 500);
return
}
this.$toast("登录成功!");
if (type === 'phone'){
this.loginInstance.hide()
}
if (type === 'password'){
this.loginInstance.hide()
}
const query = this.$route.query
const onFinished = () => {
delete query.token
if (type === 'weixinPc' && 'code' in query){
delete query.code
this.$router.replace({
path: this.$route.path,
query
})
}
if (type === 'alipay' && 'auth_code' in query){
delete query.auth_code
this.$router.replace({
path: this.$route.path,
query
})
}
}
// const loginAction = require("@/plugins/UserAction/login").default;
loginAction.call(this, { token: response.data, onFinished })
},
failCallback: ({ response }) => {
this.$toast(response.errorMessage)
},
},
onMount: () => {
console.log('已挂载')
},
})
},
// 登录判断
toggleLogin() {
if (!this.loginInstance) {
this.$toast('登录模块加载失败,3秒后为您跳转到登录页')
setTimeout(() => {
this.jumpToLogin()
}, 3000)
return
}
this.loginInstance.show()
}
}
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.container { .container {
......
...@@ -127,9 +127,18 @@ export default { ...@@ -127,9 +127,18 @@ export default {
{ {
href: '//www.googletagmanager.com', href: '//www.googletagmanager.com',
rel: 'dns-prefetch' rel: 'dns-prefetch'
} },
{
rel: 'stylesheet',
href: `//${STATIC_SOURCE_DOMAIN}/custom-plugins-library/login-center/style.css`,
},
], ],
script: [{ src: `//${STATIC_SOURCE_DOMAIN}/web-component/complaintsDeal/complaintsDeal.min.js`, defer: true }] script: [
{ src: `//${STATIC_SOURCE_DOMAIN}/web-component/complaintsDeal/complaintsDeal.min.js`, defer: true },
{
src: `//${STATIC_SOURCE_DOMAIN}/custom-plugins-library/login-center/login-center.min.js`
},
]
}, },
// Global CSS: https://go.nuxtjs.dev/config-css // Global CSS: https://go.nuxtjs.dev/config-css
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
"alife-logger": "1.8.6", "alife-logger": "1.8.6",
"core-js": "^3.15.1", "core-js": "^3.15.1",
"dayjs": "^1.10.6", "dayjs": "^1.10.6",
"js-cookie": "2.2.0",
"lotteries": "^1.2.1", "lotteries": "^1.2.1",
"normalize.css": "^8.0.1", "normalize.css": "^8.0.1",
"nuxt": "^2.15.8", "nuxt": "^2.15.8",
......
import Cookie from 'js-cookie'
import action from '../pvStatisticalService'
export default async function({token, onFinished} = {token: ''}) {
token && Cookie.set('token', token, { expires: 10 });
await action()
onFinished && onFinished()
return this
}
\ No newline at end of file
...@@ -5631,6 +5631,11 @@ js-base64@^2.5.2: ...@@ -5631,6 +5631,11 @@ js-base64@^2.5.2:
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4" resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.6.4.tgz#f4e686c5de1ea1f867dbcad3d46d969428df98c4"
integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ== integrity sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ==
js-cookie@2.2.0:
version "2.2.0"
resolved "https://registry.npmmirror.com/js-cookie/-/js-cookie-2.2.0.tgz#1b2c279a6eece380a12168b92485265b35b1effb"
integrity sha512-7YAJP/LPE/MhDjHIdfIiT665HUSumCwPN2hAmO6OJZ8V3o1mtz2HeQ8BKetEjkh+3nqGxYaq1vPMViUR8kaOXw==
js-tokens@^4.0.0: js-tokens@^4.0.0:
version "4.0.0" version "4.0.0"
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
......
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 sign in to comment