|
@@ -79,6 +79,7 @@ import {PageEnum} from '@/enums/pageEnum'
|
|
|
import {useLockFn} from '@/hooks/useLockFn'
|
|
import {useLockFn} from '@/hooks/useLockFn'
|
|
|
import {getShopConfigList} from "@/api/shop";
|
|
import {getShopConfigList} from "@/api/shop";
|
|
|
import feedback from "@/utils/feedback";
|
|
import feedback from "@/utils/feedback";
|
|
|
|
|
+import {clearAuthInfo} from "@/utils/auth";
|
|
|
|
|
|
|
|
const passwordRef = shallowRef<InputInstance>()
|
|
const passwordRef = shallowRef<InputInstance>()
|
|
|
const formRef = shallowRef<FormInstance>()
|
|
const formRef = shallowRef<FormInstance>()
|
|
@@ -123,6 +124,7 @@ const handleEnterStore = () => {
|
|
|
}
|
|
}
|
|
|
if (currentRow.value.id) {
|
|
if (currentRow.value.id) {
|
|
|
cache.set(SHOP_ID, currentRow.value.id)
|
|
cache.set(SHOP_ID, currentRow.value.id)
|
|
|
|
|
+ window.localStorage.setItem("like_admin_houseId", currentRow.value.houseId)
|
|
|
const {
|
|
const {
|
|
|
query: {redirect}
|
|
query: {redirect}
|
|
|
} = route
|
|
} = route
|
|
@@ -137,28 +139,12 @@ const handleEnter = () => {
|
|
|
}
|
|
}
|
|
|
handleLogin()
|
|
handleLogin()
|
|
|
}
|
|
}
|
|
|
-// 登录处理
|
|
|
|
|
-const handleLogin = async () => {
|
|
|
|
|
- await formRef.value?.validate()
|
|
|
|
|
- // 记住账号,缓存
|
|
|
|
|
- cache.set(ACCOUNT_KEY, {
|
|
|
|
|
- remember: remAccount.value,
|
|
|
|
|
- account: formData.account
|
|
|
|
|
- })
|
|
|
|
|
- try {
|
|
|
|
|
- let _data = {
|
|
|
|
|
- "mobile": formData.account,
|
|
|
|
|
- "passWord": formData.password,
|
|
|
|
|
- "platform": 1,//平台 1.大麦数字营销 2.大麦后台 3.麦芽 4.淘房客 5.电商中心
|
|
|
|
|
- }
|
|
|
|
|
- await userStore.login(_data)
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- // getLoginCaptcha()
|
|
|
|
|
- }
|
|
|
|
|
- getShopConfigList({"contactTel": formData.account}).then((res) => {
|
|
|
|
|
|
|
+const handleShopConfig = (params: any) => {
|
|
|
|
|
+ getShopConfigList({"contactTel": formData.account, houseIds: params}).then((res) => {
|
|
|
if (res && res.length > 0) {
|
|
if (res && res.length > 0) {
|
|
|
if (res.length == 1) {
|
|
if (res.length == 1) {
|
|
|
cache.set(SHOP_ID, res[0].id)
|
|
cache.set(SHOP_ID, res[0].id)
|
|
|
|
|
+ window.localStorage.setItem("like_admin_houseId",res[0].houseId)
|
|
|
const {
|
|
const {
|
|
|
query: {redirect}
|
|
query: {redirect}
|
|
|
} = route
|
|
} = route
|
|
@@ -169,14 +155,44 @@ const handleLogin = async () => {
|
|
|
tableData.value = res.map((item: any) => {
|
|
tableData.value = res.map((item: any) => {
|
|
|
return {
|
|
return {
|
|
|
id: item.id,
|
|
id: item.id,
|
|
|
- name: item.name
|
|
|
|
|
|
|
+ name: item.name,
|
|
|
|
|
+ houseId: item.houseId
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ clearAuthInfo()
|
|
|
router.push(PageEnum.ERROR_403)
|
|
router.push(PageEnum.ERROR_403)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+}
|
|
|
|
|
+// 登录处理
|
|
|
|
|
+const handleLogin = async () => {
|
|
|
|
|
+ await formRef.value?.validate()
|
|
|
|
|
+ // 记住账号,缓存
|
|
|
|
|
+ cache.set(ACCOUNT_KEY, {
|
|
|
|
|
+ remember: remAccount.value,
|
|
|
|
|
+ account: formData.account
|
|
|
|
|
+ })
|
|
|
|
|
+ try {
|
|
|
|
|
+ let _data = {
|
|
|
|
|
+ "mobile": formData.account,
|
|
|
|
|
+ "passWord": formData.password,
|
|
|
|
|
+ "platform": 1,//平台 1.大麦数字营销 2.大麦后台 3.麦芽 4.淘房客 5.电商中心
|
|
|
|
|
+ }
|
|
|
|
|
+ await userStore.login(_data).then((res: any) => {
|
|
|
|
|
+ if(res.type === 1){
|
|
|
|
|
+ clearAuthInfo()
|
|
|
|
|
+ router.push(PageEnum.ERROR_403)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const houseIds = res.houseList.map((item: any) => item.houseId)
|
|
|
|
|
+ handleShopConfig(houseIds)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // getLoginCaptcha()
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/*const {
|
|
/*const {
|
|
|
query: {redirect}
|
|
query: {redirect}
|
|
|
} = route
|
|
} = route
|