123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- <template>
- <div class="page">
- <div class="main">
- <div class="tit">用户登录</div>
- <div class="inp-box">
- <input
- type="text"
- name="userName"
- v-model="userName"
- placeholder="请输入账号"
- />
- </div>
- <div class="inp-box">
- <input
- type="password"
- name="password"
- v-model="password"
- placeholder="请输入密码"
- />
- </div>
- <button class="btn" @click="submit">确定</button>
- <div class="login-other">
- <a class="go-register" @click="jumpRegister"
- >去注册</a
- >
- <a
- class="find-password"
- @click="jump('/pages/index/find-password')"
- >找回密码</a
- >
- </div>
- </div>
- </div>
- </template>
- <script>
- import MyImage from "../../components/image/index";
- export default {
- name: "",
- components: { MyImage },
-
- data() {
- return {
- userName: "",
- password: "",
- urlQuery:{},
- };
- },
- onLoad(opts) {
- this.urlQuery = opts;
- uni.hideLoading();
- },
- onShow() {},
-
- methods: {
- jumpRegister(){
- this.router.push({
- path:'/pages/index/register',
- query:this.urlQuery
- })
- },
- submit() {
- console.log(this.mobile);
- if (!this.userName) {
- this.fn.showToast(`请输入账号`);
- return;
- }
- if (!this.password) {
- this.fn.showToast(`请输入密码`);
- return;
- }
- uni.showLoading({
- title: "提交中",
- });
- uni.login({
- provider: "weixin",
- success: (result) => {
-
- this.login(result.code);
- },
- });
- },
- checkcode(data, res) {
- this.api
- .get("/Group/CheckCode", data, { pass: true })
- .then((res) => {
- if (res.success) {
- if (res.data.verified) {
- if (!res.data.storeId) {
- this.router.push({
- isTabBar: true,
- path: "/pages/assistant/index",
- });
- this.fn.setTabBar([3]);
- } else {
- this.router.push({
- isTabBar: true,
- path: "/pages/index/index",
- });
- this.fn.setTabBar([1, 2]);
- }
- } else {
- this.router.push({
- path: "/pages/index/register",
- query: {
- pidCode: res.data.code,
- step: 3,
- },
- });
- this.fn.setTabBar([3]);
- }
- } else {
- this.router.push({
- path: "/pages/index/register",
- query: {
- step: 2,
- },
- });
- this.fn.setTabBar([3]);
- }
- });
- },
- login(code) {
- this.api
- .post("/Login/LoginByAccount", {
- userName: this.userName,
- password: this.password,
- code: code,
- })
- .then((res) => {
- uni.hideLoading();
- if (res.success) {
-
- if (res.data.roleId && res.data.bundleId !== 0) {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- this.$store.commit("user/login", res.data);
- this.$store.commit("common/update", {
- curShop: {},
- });
- if (!res.data.storeId) {
- this.router.push({
- isTabBar: true,
- path: "/pages/assistant/index",
- });
- this.fn.setTabBar([3]);
- } else {
- this.router.push({
- isTabBar: true,
- path: "/pages/index/index",
- });
- this.fn.setTabBar([1, 2]);
- }
- this.fn.roleHandle();
- return;
- } else {
-
- this.$store.commit("user/login", res.data);
- this.$store.commit("common/update", {
- curShop: {},
- });
- this.checkcode(
- {
-
- platform: res.data.fromPlatform,
- },
- res
- );
- }
- } else {
- this.fn.showModal({
- title: "登录失败",
- content: res.message,
- showCancel: false,
- });
- }
- });
- },
- },
-
- computed: {},
-
- watch: {},
- };
- </script>
- <style lang="scss" scoped>
- .page {
- height: 100vh;
- background-color: #fff;
- }
- .main {
- padding-top: px(120);
- padding-left: px(40);
- padding-right: px(40);
- }
- .tit {
- font-size: px(50);
- padding-bottom: px(100);
- text-align: center;
- padding-bottom: px(60);
- }
- .inp-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1px solid #c3c1c2;
- padding: px(30) 0;
- margin-bottom: px(30);
- }
- .inp-box span {
- font-size: px(32);
- color: #e92e25;
- border-radius: px(15);
- border: 1px solid #e92e25;
- width: px(230);
- height: px(80);
- text-align: center;
- line-height: px(80);
- flex-shrink: 0;
- margin-left: px(30);
- }
- .inp-box input {
- width: 100%;
- }
- .inp-box .dis {
- color: #999;
- border-color: #999;
- pointer-events: none;
- }
- .btn {
- margin-top: px(120);
- color: #fff;
- background-color: rgb(0, 188, 38);
- font-size: px(44);
- }
- .find-password {
- color: #666;
- }
- .login-other {
- margin-top: px(50);
- font-size: px(44);
- display: flex;
- justify-content: space-between;
- align-items: center;
- .go-register {
- color: #4395ff;
- }
- }
- </style>
|