|
@@ -3,105 +3,36 @@
|
|
|
<img src="../assets/login_background.png"
|
|
|
style="max-width: 100%"
|
|
|
/>
|
|
|
- <div class="card">
|
|
|
- <van-cell-group>
|
|
|
- <van-field
|
|
|
- v-model="phone"
|
|
|
- required
|
|
|
- clearable
|
|
|
- label="手机号"
|
|
|
- placeholder="请输入手机号"
|
|
|
- :error="phoneError"
|
|
|
- @click="phoneError=false"
|
|
|
- />
|
|
|
- <van-field
|
|
|
- v-model="password"
|
|
|
- required
|
|
|
- clearable
|
|
|
- type="password"
|
|
|
- label="密码"
|
|
|
- placeholder="请输入密码"
|
|
|
- :error="passError"
|
|
|
- @click="passError=false"
|
|
|
- />
|
|
|
-
|
|
|
- <van-field
|
|
|
- v-model="sms"
|
|
|
- center
|
|
|
- clearable
|
|
|
- label="短信验证码"
|
|
|
- placeholder="请输入短信验证码(暂时不用)"
|
|
|
- required
|
|
|
- disabled
|
|
|
- >
|
|
|
- <van-button slot="button" size="small" type="primary" disabled>发送验证码</van-button>
|
|
|
- </van-field>
|
|
|
- </van-cell-group>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div style="position: fixed; bottom: 5px; width:100%">
|
|
|
- <van-button type="primary" size="large" class='login' @click="Login">登录</van-button>
|
|
|
- <van-button type="default" size="large" class='register' @click="Register">注册</van-button>
|
|
|
- </div>
|
|
|
+ <h1>正在自动登录,请稍后</h1>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import 'whatwg-fetch';
|
|
|
import { BasicFunction } from '../connector/basic-service';
|
|
|
- import {
|
|
|
- Field,
|
|
|
- CellGroup,
|
|
|
- Button,
|
|
|
- } from 'vant';
|
|
|
+ import {Toast} from 'vant';
|
|
|
+
|
|
|
export default {
|
|
|
- components: {
|
|
|
- [Field.name]: Field,
|
|
|
- [CellGroup.name]: CellGroup,
|
|
|
- [Button.name]: Button
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- phone: '',
|
|
|
- phoneError: false,
|
|
|
- sms: '',
|
|
|
- password: '',
|
|
|
- passError: false
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- Login() {
|
|
|
- // 检查输入
|
|
|
- if(this.phone.length !== 11) {
|
|
|
- this.phoneError = true;
|
|
|
- return;
|
|
|
- } else if(this.password.length < 8) {
|
|
|
- this.passError = true;
|
|
|
- return;
|
|
|
+ created: function () {
|
|
|
+ let otp = this.$route.query.o;
|
|
|
+ console.log('otp: ');
|
|
|
+ console.log(otp);
|
|
|
+ let userid = '';
|
|
|
+ BasicFunction.get_data("ajaxotplogin?otp=" + otp, function (response) {
|
|
|
+ console.log("------ User Info --------");
|
|
|
+ console.log(response);
|
|
|
+ if (response.ret === "10000") {
|
|
|
+ let user = response.model.list[0];
|
|
|
+ userid = user.uid;
|
|
|
+ localStorage.setItem('frontend-userid', userid);
|
|
|
+ } else {
|
|
|
+ // 失败的处理
|
|
|
+ console.warn("获取用户信息失败");
|
|
|
+ Toast.fail('链接失效,请回到公众号重新获取链接');
|
|
|
}
|
|
|
- window.routerme = this.$router; //TODO: 考虑 encodeURIComponent(this.password)
|
|
|
- BasicFunction.get_data("ajaxlogin?u=" + this.phone + "&p=" + this.password, function (response) {
|
|
|
- console.log("------ Data Rcvd in Login --------");
|
|
|
- console.log(response);
|
|
|
- if(response.ret === "10000"){
|
|
|
- // userId
|
|
|
- localStorage.setItem("frontend-userid", response.model.userId);
|
|
|
- window.routerme.push('index');
|
|
|
- } else {
|
|
|
- // 密码错误的处理
|
|
|
- console.warn("登录失败");
|
|
|
- }
|
|
|
- }, {});
|
|
|
- },
|
|
|
- Register() {
|
|
|
- this.$router.push('verify');
|
|
|
- },
|
|
|
- SendOTP() {
|
|
|
- BasicFunction.get_data("ajaxsendotp?u=" + this.phone, function (response) {
|
|
|
- console.log('------ sms Rcvd in Login --------');
|
|
|
- console.log(response);
|
|
|
- }, {})
|
|
|
- }
|
|
|
+ }, {});
|
|
|
+ if (userid.length === 0) this.$router.push('warning');
|
|
|
+ else this.$router.push('index');
|
|
|
}
|
|
|
}
|
|
|
|