Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
source-trace-manage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenqikuai
source-trace-manage
Commits
eeec60b6
Commit
eeec60b6
authored
Apr 26, 2022
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复密码自动填充的问题
parent
4b41edb8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
204 additions
and
190 deletions
+204
-190
deploy.sh
deploy.sh
+6
-0
package-lock.json
package-lock.json
+3
-3
package.json
package.json
+1
-1
SignIn.vue
src/views/SignIn.vue
+192
-184
vite.config.ts
vite.config.ts
+2
-2
No files found.
deploy.sh
0 → 100644
View file @
eeec60b6
tar
-czf
sy2.tar sy2
scp sy2.tar root@121.37.141.165:/var/www/html/personal/sy2.tar
rm
-rf
sy2.tar
rm
-rf
sy2
ssh root@121.37.141.165
'cd /var/www/html/personal/ && rm -rf sy2 && tar -xzf sy2.tar && rm -rf sy2.tar'
echo
'done. 👉 http://121.37.141.165:8903'
package-lock.json
View file @
eeec60b6
...
...
@@ -822,9 +822,9 @@
}
},
"cqk-sy-ui"
:
{
"version"
:
"1.
1.48
"
,
"resolved"
:
"https://registry.npmjs.org/cqk-sy-ui/-/cqk-sy-ui-1.
1.48
.tgz"
,
"integrity"
:
"sha512-
1x/KceNV+t1hppxBTX663FXtDHUb3M7k8QdDm8QpkZVpu90jRO8Iok0juXxgW87U/xly7rcDgKEJ3lbVdwM+i
g=="
,
"version"
:
"1.
2.0
"
,
"resolved"
:
"https://registry.npmjs.org/cqk-sy-ui/-/cqk-sy-ui-1.
2.0
.tgz"
,
"integrity"
:
"sha512-
0FV2qSan6EDELqmbebWVGkbKU6V2ybTVjN0C0zkf+Weaet+7q1Y6ZTFthn0Ca9yE9lc0IbNedzQeQGNbQYft6
g=="
,
"requires"
:
{
"axios"
:
"^0.26.1"
,
"crypto-js"
:
"^4.1.1"
,
...
...
package.json
View file @
eeec60b6
...
...
@@ -9,7 +9,7 @@
},
"dependencies"
:
{
"
axios
"
:
"^0.26.1"
,
"
cqk-sy-ui
"
:
"^1.
1.48
"
,
"
cqk-sy-ui
"
:
"^1.
2.0
"
,
"
crypto-js
"
:
"^4.1.1"
,
"
element-plus
"
:
"^2.1.9"
,
"
js-md5
"
:
"^0.7.3"
,
...
...
src/views/SignIn.vue
View file @
eeec60b6
<
template
>
<syTraceLoginPage
:set-pwd=
"setPwd"
:handle-login=
"handleLogin"
:send-verification-code=
"sendVerificationCode"
></syTraceLoginPage>
<!-- fake fields are a workaround for chrome autofill getting the wrong fields -->
<input
style=
"display: none"
type=
"text"
name=
"fakeusernameremembered"
/>
<input
style=
"display: none"
type=
"password"
name=
"fakepasswordremembered"
/>
<syTraceLoginPage
:set-pwd=
"setPwd"
:handle-login=
"handleLogin"
:send-verification-code=
"sendVerificationCode"
></syTraceLoginPage>
</
template
>
<
script
lang=
"ts"
setup
>
import
{
syTraceLoginPage
,
GO_URLS
}
from
"cqk-sy-ui"
;
import
{
ElMessage
}
from
"element-plus"
;
import
{
$ajax
}
from
"@/service/index"
;
import
*
as
storage
from
"@/service/storage"
;
import
md5
from
"js-md5"
;
import
{
router
}
from
"@/router"
;
const
setPwd
:
any
=
async
(
setPwdType
:
string
,
accountType
:
string
,
account
:
any
,
code
:
any
,
pwd
:
string
|
any
[]
)
=>
{
let
data
=
{};
if
(
accountType
===
"email"
)
{
data
=
{
email
:
account
,
pwd
:
md5
(
String
(
pwd
)
+
md5
(
String
(
pwd
.
length
))),
code
:
code
,
code_type
:
1
,
};
}
else
{
data
=
{
phone
:
account
,
pwd
:
md5
(
String
(
pwd
)
+
md5
(
String
(
pwd
.
length
))),
code
:
code
,
code_type
:
0
,
};
}
const
res
=
await
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
setPwd
,
params
:
data
,
});
import
{
syTraceLoginPage
,
GO_URLS
}
from
"cqk-sy-ui"
import
{
ElMessage
}
from
"element-plus"
import
{
$ajax
}
from
"@/service/index"
import
*
as
storage
from
"@/service/storage"
import
md5
from
'js-md5'
import
{
router
}
from
"@/router"
const
setPwd
:
any
=
async
(
setPwdType
:
string
,
accountType
:
string
,
account
:
any
,
code
:
any
,
pwd
:
string
|
any
[])
=>
{
let
data
=
{};
if
(
accountType
===
'email'
)
{
data
=
{
email
:
account
,
pwd
:
md5
(
String
(
pwd
)
+
md5
(
String
(
pwd
.
length
))
),
code
:
code
,
code_type
:
1
,
};
if
(
res
?.
data
)
{
var
message
=
""
;
if
(
setPwdType
===
"setPwd"
)
{
message
=
"密码设置成功"
;
}
else
if
(
setPwdType
===
"resetPwd"
)
{
message
=
"密码重置成功"
;
}
ElMessage
({
message
:
message
,
type
:
"success"
,
});
return
true
;
}
else
{
return
res
?.
msg
;
}
};
const
handleLogin
:
any
=
async
(
accountType
:
string
,
account
:
any
,
verificationMethod
:
string
,
verificationStr
:
any
,
remember
:
any
,
setError
:
any
)
=>
{
if
(
accountType
===
"email"
)
{
let
params
=
{};
if
(
verificationMethod
===
"code"
)
{
params
=
{
login_type
:
3
,
email
:
account
,
code
:
verificationStr
,
};
}
else
{
data
=
{
phone
:
account
,
pwd
:
md5
(
String
(
pwd
)
+
md5
(
String
(
pwd
.
length
))
),
code
:
code
,
code_type
:
0
,
};
params
=
{
login_type
:
2
,
email
:
account
,
pwd
:
md5
(
String
(
verificationStr
)
+
md5
(
String
(
verificationStr
.
length
))),
};
}
const
res
=
await
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
setPwd
,
params
:
data
,
type
:
"post"
,
url
:
GO_URLS
.
login
,
params
:
params
,
});
if
(
res
?.
data
)
{
var
message
=
""
;
if
(
setPwdType
===
'setPwd'
)
{
message
=
"密码设置成功"
;
}
else
if
(
setPwdType
===
'resetPwd'
)
{
message
=
"密码重置成功"
;
}
ElMessage
({
message
:
message
,
type
:
"success"
,
});
return
true
;
}
else
{
return
res
?.
msg
;
if
(
res
&&
res
.
data
)
{
sessionStorage
.
setItem
(
"login_type"
,
"2"
);
if
(
accountType
===
"email"
)
{
storage
.
setLogin
(
res
.
data
,
{
login_type
:
2
,
email
:
account
,
pwd
:
verificationMethod
,
},
remember
||
false
);
}
router
.
push
({
path
:
"/categoryManage"
});
return
true
;
}
else
{
return
res
?.
msg
;
}
}
const
handleLogin
:
any
=
async
(
accountType
:
string
,
account
:
any
,
verificationMethod
:
string
,
verificationStr
:
any
,
remember
:
any
,
setError
:
any
)
=>
{
if
(
accountType
===
'email'
)
{
let
params
=
{};
if
(
verificationMethod
===
'code'
)
{
params
=
{
login_type
:
3
,
email
:
account
,
code
:
verificationStr
,
};
}
else
{
params
=
{
login_type
:
2
,
email
:
account
,
pwd
:
md5
(
String
(
verificationStr
)
+
md5
(
String
(
verificationStr
.
length
))
)
};
}
const
res
=
await
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
login
,
params
:
params
,
});
if
(
res
&&
res
.
data
)
{
sessionStorage
.
setItem
(
"login_type"
,
'2'
);
if
(
accountType
===
'email'
)
{
storage
.
setLogin
(
res
.
data
,
{
login_type
:
2
,
email
:
account
,
pwd
:
verificationMethod
,
},
remember
||
false
);
}
router
.
push
({
path
:
"/categoryManage"
});
return
true
;
}
else
{
return
res
?.
msg
;
}
}
else
if
(
accountType
===
'phone'
)
{
let
params
=
{};
if
(
verificationMethod
===
'code'
)
{
params
=
{
login_type
:
1
,
phone
:
account
,
code
:
verificationStr
,
};
}
else
{
params
=
{
login_type
:
0
,
phone
:
account
,
pwd
:
md5
(
String
(
verificationStr
)
+
md5
(
String
(
verificationStr
.
length
))
),
};
}
const
res
=
await
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
login
,
params
:
params
,
});
}
else
if
(
accountType
===
"phone"
)
{
let
params
=
{};
if
(
verificationMethod
===
"code"
)
{
params
=
{
login_type
:
1
,
phone
:
account
,
code
:
verificationStr
,
};
}
else
{
params
=
{
login_type
:
0
,
phone
:
account
,
pwd
:
md5
(
String
(
verificationStr
)
+
md5
(
String
(
verificationStr
.
length
))),
};
}
const
res
=
await
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
login
,
params
:
params
,
});
if
(
res
&&
res
.
data
)
{
sessionStorage
.
setItem
(
"login_type"
,
'1'
);
storage
.
setLogin
(
res
.
data
,
{
login_type
:
0
,
phone
:
account
,
pwd
:
verificationStr
,
},
remember
||
false
);
router
.
push
({
path
:
"/categoryManage"
});
return
true
;
}
else
{
return
res
?.
msg
;
}
if
(
res
&&
res
.
data
)
{
sessionStorage
.
setItem
(
"login_type"
,
"1"
);
storage
.
setLogin
(
res
.
data
,
{
login_type
:
0
,
phone
:
account
,
pwd
:
verificationStr
,
},
remember
||
false
);
router
.
push
({
path
:
"/categoryManage"
});
return
true
;
}
else
{
return
false
;
return
res
?.
msg
;
}
}
}
else
{
return
false
;
}
};
const
sendVerificationCode
=
async
(
accountType
:
string
,
account
:
any
,
usedFor
:
string
)
=>
{
let
res
=
null
as
any
;
if
(
usedFor
===
'login'
)
{
if
(
accountType
===
'phone'
)
{
res
=
await
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
sendSms
,
params
:
{
phone
:
account
,
template_id
:
0
,
},
});
}
else
if
(
accountType
===
'email'
)
{
res
=
await
$ajax
({
url
:
GO_URLS
.
sendEmail
,
type
:
"post"
,
params
:
{
email
:
account
,
template_id
:
0
,
},
});
}
}
else
if
(
usedFor
===
'setpwd'
)
{
if
(
accountType
===
'phone'
)
{
res
=
await
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
sendSms
,
params
:
{
phone
:
account
,
template_id
:
1
,
},
});
}
else
if
(
accountType
===
'email'
)
{
res
=
await
$ajax
({
url
:
GO_URLS
.
sendEmail
,
type
:
"post"
,
params
:
{
email
:
account
,
template_id
:
1
,
},
});
}
const
sendVerificationCode
=
async
(
accountType
:
string
,
account
:
any
,
usedFor
:
string
)
=>
{
let
res
=
null
as
any
;
if
(
usedFor
===
"login"
)
{
if
(
accountType
===
"phone"
)
{
res
=
await
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
sendSms
,
params
:
{
phone
:
account
,
template_id
:
0
,
},
});
}
else
if
(
accountType
===
"email"
)
{
res
=
await
$ajax
({
url
:
GO_URLS
.
sendEmail
,
type
:
"post"
,
params
:
{
email
:
account
,
template_id
:
0
,
},
});
}
if
(
res
)
{
ElMessage
({
message
:
"短信已发送"
,
type
:
"success"
,
});
return
true
;
}
else
return
false
;
}
</
script
>
\ No newline at end of file
}
else
if
(
usedFor
===
"setpwd"
)
{
if
(
accountType
===
"phone"
)
{
res
=
await
$ajax
({
type
:
"post"
,
url
:
GO_URLS
.
sendSms
,
params
:
{
phone
:
account
,
template_id
:
1
,
},
});
}
else
if
(
accountType
===
"email"
)
{
res
=
await
$ajax
({
url
:
GO_URLS
.
sendEmail
,
type
:
"post"
,
params
:
{
email
:
account
,
template_id
:
1
,
},
});
}
}
if
(
res
)
{
ElMessage
({
message
:
"短信已发送"
,
type
:
"success"
,
});
return
true
;
}
else
return
false
;
};
</
script
>
vite.config.ts
View file @
eeec60b6
...
...
@@ -20,8 +20,8 @@ export default defineConfig({
server
:
{
proxy
:
{
"^/api"
:
{
//
target: "http://121.37.141.165:46790/",
target
:
"https://sy.8n.cn/api"
,
target
:
"http://121.37.141.165:46790/"
,
//
target: "https://sy.8n.cn/api",
changeOrigin
:
true
,
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment