进一步整合js工具

This commit is contained in:
aixianling
2022-03-03 16:18:54 +08:00
parent c521c38af3
commit d546d47f3d

View File

@@ -10,6 +10,8 @@
</template> </template>
<script> <script>
import tools from '../utils/util'
export default { export default {
name: 'AiLogin', name: 'AiLogin',
data() { data() {
@@ -21,11 +23,11 @@ export default {
}, },
methods: { methods: {
show() { show() {
this.$getUserProfile().then(data => { tools.$getUserProfile().then(data => {
this.userData = data.userInfo; this.userData = data.userInfo;
this.userPhoneShow = true; this.userPhoneShow = true;
}) })
this.$getLoginCode().then(res => { tools.$getLoginCode().then(res => {
this.code = res.code; this.code = res.code;
}) })
}, },
@@ -35,7 +37,7 @@ export default {
getPhoneNumber(arg) { getPhoneNumber(arg) {
const {encryptedData, errMsg, iv} = arg.detail const {encryptedData, errMsg, iv} = arg.detail
if (errMsg == 'getPhoneNumber:ok') { if (errMsg == 'getPhoneNumber:ok') {
this.$getLoginCode().then(() => { tools.$getLoginCode().then(() => {
// let body = {...this.userData, encryptedData, iv, code: res.code} // let body = {...this.userData, encryptedData, iv, code: res.code}
this.$instance.post(`/app/appwechatuser/getWechatUserPhone`, { this.$instance.post(`/app/appwechatuser/getWechatUserPhone`, {
encryptedData, iv, encryptedData, iv,
@@ -43,13 +45,12 @@ export default {
}, {withoutToken: true}).then(d => { }, {withoutToken: true}).then(d => {
if (d.data) { if (d.data) {
let data = {...this.userData, phone: d.data}; let data = {...this.userData, phone: d.data};
this.$autoLogin(data).then(res=>{ this.$autoLogin(data, this.$store).then(res => {
this.$emit("success", res); this.$emit("success", res);
}); });
} }
}) })
}) })
} }
} }
} }
@@ -59,6 +60,7 @@ export default {
.confirm-button { .confirm-button {
background-color: #fff !important; background-color: #fff !important;
} }
.confirm-button::after { .confirm-button::after {
border: none !important; border: none !important;
} }