From 6365ab0a976afdd247742c9b3dca15deb3a7a7a1 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期四, 17 八月 2023 17:21:40 +0800 Subject: [PATCH] 初始化1.0.1 --- h5_standard/src/views/wxLogin.vue | 68 ++-------------------------------- 1 files changed, 4 insertions(+), 64 deletions(-) diff --git a/h5_standard/src/views/wxLogin.vue b/h5_standard/src/views/wxLogin.vue index 87c9825..44af9fb 100644 --- a/h5_standard/src/views/wxLogin.vue +++ b/h5_standard/src/views/wxLogin.vue @@ -7,86 +7,26 @@ <div class="wx_login_list"> <div class="wx_login_list_item"> <img src="@/assets/icon/login_ic_code@2x.png" alt="" /> - <input type="text" v-model="from.companyId" placeholder="浼佷笟浠g爜" /> + <input type="text" placeholder="浼佷笟浠g爜" /> </div> <div class="wx_login_list_item"> <img src="@/assets/icon/login_ic_phone@2x.png" alt="" /> - <input type="text" maxlength="11" v-model="from.username" placeholder="鎵嬫満鍙�" /> + <input type="text" placeholder="鎵嬫満鍙�" /> </div> <div class="wx_login_list_item"> <img src="@/assets/icon/login_ic_password@2x.png" alt="" /> - <input type="password" v-model="from.password" placeholder="瀵嗙爜" /> + <input type="text" placeholder="瀵嗙爜" /> </div> </div> <div class="wx_login_footer"> - <div class="wx_login_footer_btn" @click="login">绔嬪嵆鐧诲綍</div> + <div class="wx_login_footer_btn">绔嬪嵆鐧诲綍</div> </div> </div> </div> </template> <script setup lang="ts"> -import { onMounted, reactive } from 'vue'; -import { useRoute, useRouter } from 'vue-router'; -import { useStore } from 'vuex'; -import { wxLogin, wxAccountLogin, getUserInfo } from '@/apis/index'; -import { Toast } from 'vant'; -const route = useRoute() -const router = useRouter() -const store = useStore() - -let from: any = reactive({ - openid: '', - unionid: '', - companyId: '', - username: '', - password: '' -}) - -const login = async () => { - if (!from.openid) return Toast('openid涓嶈兘涓虹┖') - if (!from.unionid) return Toast('unionid涓嶈兘涓虹┖') - if (!from.companyId) return Toast('浼佷笟浠g爜涓嶈兘涓虹┖') - if (!from.username) return Toast('鎵嬫満鍙蜂笉鑳戒负绌�') - if (!from.password) return Toast('瀵嗙爜涓嶈兘涓虹┖') - Toast.loading({ - message: '鐧诲綍涓�...', - forbidClick: true - }); - let res = await wxAccountLogin(from) - if (res.code === 200) { - let info = await getUserInfo() - if (info.code === 200) { - await store.commit('setEntrance', 'DD') - await store.commit('setUserInfo', info.data) - await store.dispatch('getMenuList', 2) - await router.replace('/workbench') - } - } - Toast.clear(); -} - -onMounted(() => { - wxLogin({ code: route.query.code }) - .then(async (res) => { - if (res.code === 200) { - // 鍏嶇櫥褰曪紝鐩存帴璺抽椤� - if (res.data.loginStatus == 0) { - let info = await getUserInfo() - if (info.code === 200) { - await store.commit('setEntrance', 'DD') - await store.commit('setUserInfo', info.data) - await store.dispatch('getMenuList', 2) - await router.replace('/workbench') - } - } else { - from.openid = res.data.openid - from.unionid = res.data.unionid - } - } - }) -}) </script> <style lang="scss" scoped> -- Gitblit v1.9.3