我有两个要以“用户”和“工人”身份登录的组件。它们的数据在两个集合名称中分别是“用户”,“工人”。这是我的“用户登录”功能。
const browser = await puppeteer.launch({
headless: false,
executablePath: "path/to/brave",
userDataDir: "path/to/profile/dir"
});
所以在这个功能中我可以使用'workers'收集数据登录,这意味着'Worker'可以使用'User login'组件登录。那么如何解决呢?请帮助我。
这是我的“工作人员登录”功能
SignIn(email, password) {
this.value = this.afs.collection( 'users' , ref =>
ref.where('email', '==', email)
).valueChanges();
this.value.subscribe(data => {
this.datas = data;
console.log(this.datas )
return this.afAuth.auth.signInWithEmailAndPassword(email, password).then((result) => {
this.ngZone.run(() => {
this.router.navigate(['home']);
});
}).catch((error) => {
window.alert(error);
this.router.navigateByUrl('signinu');
})
});
}
答案 0 :(得分:1)
在登录页面中,创建一个下拉菜单,用户可以在其中选择自己是<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<style></style>
</head>
<body>
<article>
<pre>
I am the egg man
They are the egg men
I am the walrus
Goo goo g'joob
</pre>
</article>
<script>
/*!
* Convert a given elements (1st param - selector) text into an <a>nchor tag
* that when clicked, will jump to translate.google.com site and translates the
* text within the <a>nchor to a given language (3rd param - langB).
**
* @param {String} selector The reference of the element (aka tag) to convert.
* @param {String} langA The original language text is in.
* @param {String} langB The language to which the text will be translated to.
**
* @return {Object} The new DOM Object/tag.
*/
/*
Pass the selector string of target tag,
the current language as a two letter abbreviation,
and the two letter abbreviation of the language that the text will be translated to
*/
const transLink = (selector, langA, langB) => {
// Reference the target tag
const tag = document.querySelector(selector);
// Get the text of tag and encode it.
let encoded = encodeURIComponent(tag.textContent);
// Interpolate values into a template literal of the new URI
const uri = `https://translate.google.com/?hl=en&op=translate&sl=${langA}&tl=${langB}&text=${encoded}`;
// Interpolate values into a template literal of the new <a>nchor
const link = `<a href="${uri}" target='_blank'>${decodeURIComponent(encoded)}</a>`;
// Make a Range Object to facilitate selection of tag content
let range = document.createRange();
// Select all content within tag
range.selectNodeContents(tag);
// Delete the content
range.deleteContents();
// Prepend and render the htmlString "link"
tag.insertAdjacentHTML('afterbegin', link);
// return tag
return tag;
}
/*
Find the first <pre> then covert its contents from English text into a link
with Spanish text
*/
console.log(transLink('pre', 'en', 'es'));
</script>
</body>
</html>
还是user
,然后在worker
方法中添加另一个名为{{1 }}:
signin
然后检查类型是否等于type
,然后使用集合SignIn(email, password, type)
;否则,如果类型等于user
,则使用集合user
。检索时,您已经在使用worker
来查询电子邮件在worker
集合或where
集合中是否存在。如果用户是user
,并且他们单击了worker
,则由于您正在执行查询以检查电子邮件,因此不会检索到任何内容,并且可以显示警报。