1 line
9.0 KiB
Plaintext
1 line
9.0 KiB
Plaintext
{"version":3,"file":"s-auth-modal.js","sources":["../../../../../../src/sheep/components/s-auth-modal/s-auth-modal.vue","../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL3NyYy9zaGVlcC9jb21wb25lbnRzL3MtYXV0aC1tb2RhbC9zLWF1dGgtbW9kYWwudnVl"],"sourcesContent":["<template>\r\n <!-- 规格弹窗 -->\r\n <su-popup :show=\"authType !== ''\" round=\"10\" :showClose=\"true\" @close=\"closeAuthModal\">\r\n <view class=\"login-wrap\">\r\n <!-- 1. 账号密码登录 accountLogin -->\r\n <account-login\r\n v-if=\"authType === 'accountLogin'\"\r\n :agreeStatus=\"state.protocol\"\r\n @onConfirm=\"onConfirm\"\r\n />\r\n\r\n <!-- 2. 短信登录 smsLogin -->\r\n <sms-login\r\n v-if=\"authType === 'smsLogin'\"\r\n :agreeStatus=\"state.protocol\"\r\n @onConfirm=\"onConfirm\"\r\n />\r\n\r\n <!-- 3. 忘记密码 resetPassword-->\r\n <reset-password v-if=\"authType === 'resetPassword'\" />\r\n\r\n <!-- 4. 绑定手机号 changeMobile -->\r\n <change-mobile v-if=\"authType === 'changeMobile'\" />\r\n\r\n <!-- 5. 修改密码 changePassword-->\r\n <changePassword v-if=\"authType === 'changePassword'\" />\r\n\r\n <!-- 6. 微信小程序授权 -->\r\n <mp-authorization v-if=\"authType === 'mpAuthorization'\" />\r\n\r\n <!-- 7. 第三方登录 -->\r\n <view\r\n v-if=\"['accountLogin', 'smsLogin'].includes(authType)\"\r\n class=\"auto-login-box ss-flex ss-flex-col ss-row-center ss-col-center\"\r\n >\r\n <!-- 7.1 微信小程序的快捷登录 -->\r\n <view v-if=\"sheep.$platform.name === 'WechatMiniProgram'\" class=\"ss-flex register-box\">\r\n <view class=\"register-title\">还没有账号?</view>\r\n <button\r\n class=\"ss-reset-button login-btn\"\r\n open-type=\"getPhoneNumber\"\r\n @getphonenumber=\"getPhoneNumber\"\r\n >\r\n 快捷登录\r\n </button>\r\n <view class=\"circle\" />\r\n </view>\r\n\r\n <!-- 7.2 微信的公众号、App、小程序的登录,基于 openid + code -->\r\n <button\r\n v-if=\"\r\n ['WechatOfficialAccount', 'WechatMiniProgram', 'App'].includes(sheep.$platform.name) &&\r\n sheep.$platform.isWechatInstalled\r\n \"\r\n @tap=\"thirdLogin('wechat')\"\r\n class=\"ss-reset-button auto-login-btn\"\r\n >\r\n <image\r\n class=\"auto-login-img\"\r\n :src=\"sheep.$url.static('/static/img/shop/platform/wechat.png')\"\r\n />\r\n </button>\r\n\r\n <!-- 7.3 iOS 登录 TODO 芋艿:等后面搞 App 再弄 -->\r\n <button\r\n v-if=\"sheep.$platform.os === 'ios' && sheep.$platform.name === 'App'\"\r\n @tap=\"thirdLogin('apple')\"\r\n class=\"ss-reset-button auto-login-btn\"\r\n >\r\n <image\r\n class=\"auto-login-img\"\r\n :src=\"sheep.$url.static('/static/img/shop/platform/apple.png')\"\r\n />\r\n </button>\r\n </view>\r\n\r\n <!-- 用户协议的勾选 -->\r\n <view\r\n v-if=\"['accountLogin', 'smsLogin'].includes(authType)\"\r\n class=\"agreement-box ss-flex ss-row-center\"\r\n :class=\"{ shake: currentProtocol }\"\r\n >\r\n <label class=\"radio ss-flex ss-col-center\" @tap=\"onChange\">\r\n <radio\r\n :checked=\"state.protocol\"\r\n color=\"var(--ui-BG-Main)\"\r\n style=\"transform: scale(0.8)\"\r\n @tap.stop=\"onChange\"\r\n />\r\n <view class=\"agreement-text ss-flex ss-col-center ss-m-l-8\">\r\n 我已阅读并遵守\r\n <view class=\"tcp-text\" @tap.stop=\"onProtocol('用户协议')\">《用户协议》</view>\r\n <view class=\"agreement-text\">与</view>\r\n <view class=\"tcp-text\" @tap.stop=\"onProtocol('隐私协议')\">《隐私协议》</view>\r\n </view>\r\n </label>\r\n </view>\r\n <view class=\"safe-box\" />\r\n </view>\r\n </su-popup>\r\n</template>\r\n\r\n<script setup>\r\nimport { computed, reactive, ref } from 'vue'\r\nimport sheep from '@/sheep'\r\nimport accountLogin from './components/account-login.vue'\r\nimport smsLogin from './components/sms-login.vue'\r\nimport resetPassword from './components/reset-password.vue'\r\nimport changeMobile from './components/change-mobile.vue'\r\nimport changePassword from './components/change-password.vue'\r\nimport mpAuthorization from './components/mp-authorization.vue'\r\nimport { closeAuthModal, showAuthModal } from '@/sheep/hooks/useModal'\r\n\r\nconst appInfo = computed(() => sheep.$store('app').info)\r\n\r\nconst modalStore = sheep.$store('modal')\r\n// 授权弹窗类型\r\nconst authType = computed(() => modalStore.auth)\r\n\r\nconst state = reactive({\r\n protocol: false,\r\n})\r\n\r\nconst currentProtocol = ref(false)\r\n\r\n// 勾选协议\r\nfunction onChange() {\r\n state.protocol = !state.protocol\r\n}\r\n\r\n// 查看协议\r\nfunction onProtocol(title) {\r\n closeAuthModal()\r\n sheep.$router.go('/modules/mall/public/richtext', {\r\n title,\r\n })\r\n}\r\n\r\n// 点击登录 / 注册事件\r\nfunction onConfirm(e) {\r\n currentProtocol.value = e\r\n setTimeout(() => {\r\n currentProtocol.value = false\r\n }, 1000)\r\n}\r\n\r\n// 第三方授权登陆(微信小程序、Apple)\r\nconst thirdLogin = async (provider) => {\r\n if (!state.protocol) {\r\n currentProtocol.value = true\r\n setTimeout(() => {\r\n currentProtocol.value = false\r\n }, 1000)\r\n sheep.$helper.toast('请勾选同意')\r\n return\r\n }\r\n const loginRes = await sheep.$platform.useProvider(provider).login()\r\n if (loginRes) {\r\n closeAuthModal()\r\n // 触发小程序授权信息弹框\r\n // #ifdef MP-WEIXIN\r\n showAuthModal('mpAuthorization')\r\n // #endif\r\n }\r\n}\r\n\r\n// 微信小程序的“手机号快速验证”:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html\r\nconst getPhoneNumber = async (e) => {\r\n if (e.detail.errMsg !== 'getPhoneNumber:ok') {\r\n sheep.$helper.toast('快捷登录失败')\r\n return\r\n }\r\n const result = await sheep.$platform.useProvider().mobileLogin(e.detail)\r\n if (result) {\r\n closeAuthModal()\r\n }\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n \r\n@import './index.scss';\r\n\r\n.shake {\r\n animation: shake 0.05s linear 4 alternate;\r\n}\r\n\r\n@keyframes shake {\r\n from {\r\n transform: translateX(-10rpx);\r\n }\r\n to {\r\n transform: translateX(10rpx);\r\n }\r\n}\r\n\r\n.register-box {\r\n position: relative;\r\n justify-content: center;\r\n .register-btn {\r\n color: #999999;\r\n font-size: 30rpx;\r\n font-weight: 500;\r\n }\r\n .register-title {\r\n color: #999999;\r\n font-size: 30rpx;\r\n font-weight: 400;\r\n margin-right: 24rpx;\r\n }\r\n .or-title {\r\n margin: 0 16rpx;\r\n color: #999999;\r\n font-size: 30rpx;\r\n font-weight: 400;\r\n }\r\n .login-btn {\r\n color: var(--ui-BG-Main);\r\n font-size: 30rpx;\r\n font-weight: 500;\r\n }\r\n .circle {\r\n position: absolute;\r\n right: 0rpx;\r\n top: 18rpx;\r\n width: 8rpx;\r\n height: 8rpx;\r\n border-radius: 8rpx;\r\n background: var(--ui-BG-Main);\r\n }\r\n}\r\n.safe-box {\r\n height: calc(constant(safe-area-inset-bottom) / 5 * 3);\r\n height: calc(env(safe-area-inset-bottom) / 5 * 3);\r\n}\r\n\r\n.tcp-text {\r\n color: var(--ui-BG-Main);\r\n}\r\n\r\n.agreement-text {\r\n color: $dark-9;\r\n}\r\n</style>\r\n","import Component from 'D:/App/Work/addr/acdr-ui/src/sheep/components/s-auth-modal/s-auth-modal.vue'\nwx.createComponent(Component)"],"names":["computed","sheep","reactive","ref","closeAuthModal","showAuthModal"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyGA,MAAM,eAAe,MAAW;AAChC,MAAM,WAAW,MAAW;AAC5B,MAAM,gBAAgB,MAAW;AACjC,MAAM,eAAe,MAAW;AAChC,MAAM,iBAAiB,MAAW;AAClC,MAAM,kBAAkB,MAAW;;;;AAGnBA,kBA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