Browse Source

修改错误提示不弹出的问题

master
Gao xiaosong 3 years ago
parent
commit
6f12083ef1
  1. 172
      pages/order/OrderReturnDetail/index.vue
  2. 71
      pages/order/submitExpress/index.vue
  3. 283
      pages/user/Login/index.vue

172
pages/order/OrderReturnDetail/index.vue

@ -31,19 +31,13 @@
<view class="money"> <view class="money">
<view class="top"> <view class="top">
<text>退款总金额</text> <text>退款总金额</text>
<text class="colorRed">{{ orderDetail.refundAmount || 0}}</text> <text class="colorRed">{{ orderDetail.refundAmount || 0 }}</text>
</view> </view>
<view class="express" v-if="orderDetail.serviceType === 1"> <view class="express" v-if="orderDetail.serviceType === 1">
<view class="title">商家已同意退货申请请尽快发货</view> <view class="title">商家已同意退货申请请尽快发货</view>
<view class="info people"> <view class="info people"> 收货人 {{ orderDetail.consignee || '' }} </view>
收货人 {{ orderDetail.consignee || '' }} <view class="info address"> 收货地址 {{ orderDetail.address || '' }} </view>
</view> <view class="info phone"> 收货电话 {{ orderDetail.phoneNumber || '' }} </view>
<view class="info address">
收货地址 {{ orderDetail.address || '' }}
</view>
<view class="info phone">
收货电话 {{ orderDetail.phoneNumber || '' }}
</view>
</view> </view>
<!-- 退款信息 --> <!-- 退款信息 -->
<view class="tips" v-if="orderDetail.state === 0"> <view class="tips" v-if="orderDetail.state === 0">
@ -70,17 +64,9 @@
</view> </view>
</view> --> </view> -->
<view class="bottom"> <view class="bottom">
<view class="btns redBtn" <view class="btns redBtn" v-if="orderDetail.salesState === 0 && orderDetail.serviceType === 1 && orderDetail.state === 1" @click="toExpress">填写物流</view>
v-if="orderDetail.salesState === 0 <view class="btns def" v-if="orderDetail.salesState === 0" @click="cancelReq">撤销申请</view>
&& orderDetail.serviceType === 1 <!-- <view class="btns redBtn" @click="editReq">修改申请</view>-->
&& orderDetail.state === 1"
@click="toExpress"
>填写物流</view>
<view class="btns def"
v-if="orderDetail.salesState === 0"
@click="cancelReq"
>撤销申请</view>
<!-- <view class="btns redBtn" @click="editReq">修改申请</view>-->
</view> </view>
</view> </view>
<!-- 退款信息 --> <!-- 退款信息 -->
@ -88,10 +74,7 @@
<view class="top"> <view class="top">
退款信息 退款信息
</view> </view>
<view class="rebackItem" <view class="rebackItem" v-for="item in orderDetail.cartInfo" :key="item.id">
v-for="item in orderDetail.cartInfo"
:key="item.id"
>
<image class="img" :src="item.productInfo.image" mode=""></image> <image class="img" :src="item.productInfo.image" mode=""></image>
<view class="info"> <view class="info">
<view class="productName"> <view class="productName">
@ -115,9 +98,7 @@
<view class="left"> <view class="left">
退款金额: 退款金额:
</view> </view>
<view class="right"> <view class="right"> {{ orderDetail.refundAmount || 0 }} </view>
{{ orderDetail.refundAmount || 0 }}
</view>
</view> </view>
<view class="reason"> <view class="reason">
<view class="left"> <view class="left">
@ -141,17 +122,14 @@
</template> </template>
<script> <script>
import{ import { getAfterSealsDetail, rebackAfterSeals } from '@/api/aftersales.js'
getAfterSealsDetail,
rebackAfterSeals
} from '@/api/aftersales.js';
export default { export default {
data() { data() {
return { return {
orderId: '', orderId: '',
id: '', id: '',
orderInfo: {}, orderInfo: {},
orderDetail: {} orderDetail: {},
} }
}, },
mounted() { mounted() {
@ -162,106 +140,108 @@ export default {
methods: { methods: {
/** state售后状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3已完成 */ /** state售后状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3已完成 */
async getReturnDetail() { async getReturnDetail() {
const res = await getAfterSealsDetail(this.orderId, this.id) getAfterSealsDetail(this.orderId, this.id)
if (res.status === 200) { .then(res => {
this.orderDetail = res.data this.orderDetail = res.data
} else { })
.catch(err => {
uni.showToast({ uni.showToast({
title: "订单异常", title: '订单异常',
icon: "none", icon: 'none',
duration: 2000, duration: 2000,
}); })
} })
}, },
toExpress () { toExpress() {
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/order/submitExpress/index', path: '/pages/order/submitExpress/index',
query: { query: {
orderCode: this.orderId orderCode: this.orderId,
} },
}) })
}, },
// //
async cancelReq() { async cancelReq() {
const res = await rebackAfterSeals(this.orderId, this.id) rebackAfterSeals(this.orderId, this.id)
if (res.status === 200) { .then(res => {
uni.showToast({ uni.showToast({
title: "已撤销", title: '已撤销',
icon: "none", icon: 'none',
duration: 2000, duration: 2000,
}); })
setTimeout(() => { setTimeout(() => {
this.$yrouter.back(); this.$yrouter.back()
}, 1500) }, 1500)
} else { })
.catch(err => {
uni.showToast({ uni.showToast({
title: "撤销失败", title: '撤销失败',
icon: "none", icon: 'none',
duration: 2000, duration: 2000,
}); })
} })
}, },
// //
editReq() {} editReq() {},
} },
} }
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
$red: #EB3729; $red: #eb3729;
.returnList{ .returnList {
.colorRed{ .colorRed {
color: $red; color: $red;
} }
.bgRed{ .bgRed {
background-color: $red; background-color: $red;
} }
.data{ .data {
width: 100%; width: 100%;
height: 150rpx; height: 150rpx;
line-height: 150rpx; line-height: 150rpx;
padding-left: 30rpx; padding-left: 30rpx;
color: #FFF; color: #fff;
} }
.money{ .money {
background-color: #FFF; background-color: #fff;
.top{ .top {
padding: 20rpx 30rpx; padding: 20rpx 30rpx;
font-size: 30rpx; font-size: 30rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
border-bottom: 2rpx solid #F3F4F5; border-bottom: 2rpx solid #f3f4f5;
} }
.express{ .express {
padding: 20rpx 30rpx; padding: 20rpx 30rpx;
font-size: 26rpx; font-size: 26rpx;
.title{ .title {
color: #333333; color: #333333;
} }
.info{ .info {
color: #999999; color: #999999;
} }
} }
.tips{ .tips {
height: 160rpx; height: 160rpx;
padding: 20rpx 30rpx; padding: 20rpx 30rpx;
color: #999999; color: #999999;
border-bottom: 2rpx solid #F3F4F5; border-bottom: 2rpx solid #f3f4f5;
font-size: 26rpx; font-size: 26rpx;
.title{ .title {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.content{ .content {
font-size: 20rpx; font-size: 20rpx;
} }
} }
.bottom{ .bottom {
padding: 20rpx 30rpx; padding: 20rpx 30rpx;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
.btns{ .btns {
width: 160rpx; width: 160rpx;
height: 58rpx; height: 58rpx;
margin: 0 10rpx; margin: 0 10rpx;
@ -270,62 +250,62 @@ $red: #EB3729;
line-height: 58rpx; line-height: 58rpx;
border-radius: 180rpx; border-radius: 180rpx;
} }
.def{ .def {
color: #DDDDDD; color: #dddddd;
border: 2rpx solid #DDDDDD; border: 2rpx solid #dddddd;
} }
.redBtn{ .redBtn {
color: #FFF; color: #fff;
background-color: $red; background-color: $red;
} }
} }
} }
.rebackInfo{ .rebackInfo {
padding: 0 30rpx; padding: 0 30rpx;
background-color: #FFF; background-color: #fff;
.top{ .top {
height: 80rpx; height: 80rpx;
margin: 20rpx 0; margin: 20rpx 0;
line-height: 80rpx; line-height: 80rpx;
font-size: 30rpx; font-size: 30rpx;
font-weight: bold; font-weight: bold;
color: #333333; color: #333333;
border-bottom: 2rpx solid #F3F4F5; border-bottom: 2rpx solid #f3f4f5;
} }
.rebackItem{ .rebackItem {
padding: 20rpx 0; padding: 20rpx 0;
font-size: 28rpx; font-size: 28rpx;
display: flex; display: flex;
border-bottom: 2rpx solid #F3F4F5; border-bottom: 2rpx solid #f3f4f5;
.img{ .img {
width: 120rpx; width: 120rpx;
height: 120rpx; height: 120rpx;
} }
.info{ .info {
margin-left: 16rpx; margin-left: 16rpx;
flex: 1; flex: 1;
.productName{ .productName {
width: 100%; width: 100%;
height: 80rpx; height: 80rpx;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
color: #333333; color: #333333;
} }
.sku{ .sku {
font-size: 24rpx; font-size: 24rpx;
color: #CCCCCC; color: #cccccc;
} }
} }
} }
.bottom{ .bottom {
padding: 20rpx 0; padding: 20rpx 0;
.reason{ .reason {
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.right{ .right {
color: #AAAAAA; color: #aaaaaa;
} }
} }
} }

71
pages/order/submitExpress/index.vue

@ -3,11 +3,7 @@
<view class="submitExpress"> <view class="submitExpress">
<!-- 填写物流 --> <!-- 填写物流 -->
<view class="form"> <view class="form">
<picker class="picker" <picker class="picker" :value="express" :range="expressPicker" @change="changeExpress">
:value="express"
:range="expressPicker"
@change="changeExpress"
>
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
<view class="title"> <view class="title">
<view class="point"> <view class="point">
@ -39,37 +35,34 @@
</template> </template>
<script> <script>
import { import { getExpressData, addExpressData } from '@/api/aftersales.js'
getExpressData,
addExpressData
} from '@/api/aftersales.js'
export default { export default {
data () { data() {
return { return {
expressQuery: { expressQuery: {
code: '', // code: '', //
name: '', // name: '', //
postalCode: 'SF1213132132', // postalCode: 'SF1213132132', //
orderCode: '' // orderCode: '', //
}, },
expressList: [], expressList: [],
expressPicker: [], expressPicker: [],
express: '' express: '',
} }
}, },
mounted () { mounted() {
this.expressQuery.orderCode = this.$yroute.query.orderCode this.expressQuery.orderCode = this.$yroute.query.orderCode
this.getExpress() this.getExpress()
}, },
methods: { methods: {
async getExpress () { async getExpress() {
const res = await getExpressData() const res = await getExpressData()
console.log(res) console.log(res)
this.expressList = res.data.map(item => { this.expressList = res.data.map(item => {
return { return {
id: item.id, id: item.id,
name: item.name, name: item.name,
code: item.code code: item.code,
} }
}) })
this.expressPicker = res.data.map(item => { this.expressPicker = res.data.map(item => {
@ -77,11 +70,11 @@ export default {
}) })
}, },
changeExpress(e) { changeExpress(e) {
this.express = this.expressPicker[e.mp.detail.value]; this.express = this.expressPicker[e.mp.detail.value]
this.expressQuery.code = this.expressList[e.mp.detail.value].code this.expressQuery.code = this.expressList[e.mp.detail.value].code
this.expressQuery.name = this.expressList[e.mp.detail.value].name this.expressQuery.name = this.expressList[e.mp.detail.value].name
}, },
async addExpress () { async addExpress() {
let errMsg = '请选择' let errMsg = '请选择'
if (!this.expressQuery.code || !this.expressQuery.code) { if (!this.expressQuery.code || !this.expressQuery.code) {
errMsg += ' 快递公司 ' errMsg += ' 快递公司 '
@ -96,55 +89,55 @@ export default {
duration: 2000, duration: 2000,
}) })
} }
console.log(this.expressQuery) addExpressData(this.expressQuery)
const res = await addExpressData(this.expressQuery) .then(res => {
if (res.status === 200) {
uni.showToast({ uni.showToast({
title: '物流填写成功!', title: '物流填写成功!',
icon: 'none', icon: 'none',
duration: 2000, duration: 2000,
}) })
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/order/ReturnList/index' path: '/pages/order/ReturnList/index',
}) })
} else { })
.catch(err => {
uni.showToast({ uni.showToast({
title: '提交物流信息失败!', title: '提交物流信息失败!',
icon: 'none', icon: 'none',
duration: 2000, duration: 2000,
}) })
} })
} },
} },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.submitExpress{ .submitExpress {
.form{ .form {
margin-bottom: 170rpx; margin-bottom: 170rpx;
.picker{ .picker {
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 28rpx; font-size: 28rpx;
color: #999999; color: #999999;
} }
.item{ .item {
width: 100%; width: 100%;
height: 80rpx; height: 80rpx;
padding: 0 32rpx; padding: 0 32rpx;
line-height: 80rpx; line-height: 80rpx;
background-color: #FFF; background-color: #fff;
display: flex; display: flex;
.title{ .title {
font-size: 28rpx; font-size: 28rpx;
color: #333333; color: #333333;
display: flex; display: flex;
.point{ .point {
color: #EA3729; color: #ea3729;
} }
} }
.input{ .input {
height: 80rpx; height: 80rpx;
line-height: 80rpx; line-height: 80rpx;
font-size: 28rpx; font-size: 28rpx;
@ -152,22 +145,22 @@ export default {
} }
} }
} }
.btnContainer{ .btnContainer {
width: 100%; width: 100%;
height: 170rpx; height: 170rpx;
background-color: #FFF; background-color: #fff;
box-shadow: 0px 0px 0px rgba(197, 202, 207, 0.5); box-shadow: 0px 0px 0px rgba(197, 202, 207, 0.5);
position: fixed; position: fixed;
bottom: 0; bottom: 0;
.addBtn{ .addBtn {
height: 90rpx; height: 90rpx;
margin: 40rpx 30rpx; margin: 40rpx 30rpx;
line-height: 90rpx; line-height: 90rpx;
text-align: center; text-align: center;
border-radius: 50rpx; border-radius: 50rpx;
font-size: 28rpx; font-size: 28rpx;
color: #FFF; color: #fff;
background: linear-gradient(90deg, #E93526 0%, #FF8E3C 100%); background: linear-gradient(90deg, #e93526 0%, #ff8e3c 100%);
} }
} }
} }

283
pages/user/Login/index.vue

@ -2,16 +2,14 @@
<view class="register absolute"> <view class="register absolute">
<view class="whiteBg" v-if="formItem === 1"> <view class="whiteBg" v-if="formItem === 1">
<view class="title acea-row"> <view class="title acea-row">
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" <view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" @click="navTap(index)" :key="index">{{ item }}</view>
@click="navTap(index)" :key="index">{{ item }}</view>
</view> </view>
<!-- 手机号登录 --> <!-- 手机号登录 -->
<view class="list" :hidden="current !== 0"> <view class="list" :hidden="current !== 0">
<form @submit.prevent="submit"> <form @submit.prevent="submit">
<view class="item getPhoneCode"> <view class="item getPhoneCode">
<view class="phoneInput acea-row row-between-wrapper"> <view class="phoneInput acea-row row-between-wrapper">
<input type="text" placeholder="输入手机号码" <input type="text" placeholder="输入手机号码" v-model="account" required />
v-model="account" required/>
</view> </view>
<view class="phoneCode" @click="sendCode"> <view class="phoneCode" @click="sendCode">
{{ clockText }} {{ clockText }}
@ -72,8 +70,7 @@
<use xlink:href="#icon-code_1" /> <use xlink:href="#icon-code_1" />
</svg>--> </svg>-->
<input name="verifyCode" type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> <input name="verifyCode" type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" <button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button>
@click="code">{{ text }}</button>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@ -94,7 +91,6 @@
</view> </view>
</view> </view>
<!-- #endif --> <!-- #endif -->
</view> </view>
<view class="logon" @click="register">注册</view> <view class="logon" @click="register">注册</view>
<view class="tip"> <view class="tip">
@ -105,90 +101,69 @@
</view> </view>
</template> </template>
<script> <script>
import sendVerifyCode from "@/mixins/SendVerifyCode"; import sendVerifyCode from '@/mixins/SendVerifyCode'
import { import { login, loginMobile, registerVerify, register } from '@/api/user'
login, import attrs, { required, alpha_num, chs_phone } from '@/utils/validate'
loginMobile, import { validatorDefaultCatch } from '@/utils/dialog'
registerVerify, import dayjs from 'dayjs'
register import cookie from '@/utils/store/cookie'
} from "@/api/user";
import attrs, {
required,
alpha_num,
chs_phone
} from "@/utils/validate";
import {
validatorDefaultCatch
} from "@/utils/dialog";
import dayjs from "dayjs";
import cookie from "@/utils/store/cookie";
import { import { handleGetUserInfo } from '@/utils'
handleGetUserInfo
} from "@/utils";
const BACK_URL = "login_back_url"; const BACK_URL = 'login_back_url'
export default { export default {
name: "Login", name: 'Login',
mixins: [sendVerifyCode], mixins: [sendVerifyCode],
data: function () { data: function() {
return { return {
navList: ["手机号登录", "密码登录"], navList: ['手机号登录', '密码登录'],
// navList: ["",], // navList: ["",],
current: 0, current: 0,
account: "", account: '',
password: "", password: '',
captcha: "", captcha: '',
inviteCode: "", inviteCode: '',
formItem: 1, formItem: 1,
type: "login", type: 'login',
timer: null, timer: null,
clock: 60, clock: 60,
clockText: '验证码' clockText: '验证码',
}; }
}, },
methods: { methods: {
async loginMobile() { async loginMobile() {
var that = this; var that = this
const { const { account, captcha } = that
account,
captcha
} = that;
try { try {
await that await that
.$validator({ .$validator({
account: [ account: [required(required.message('手机号码')), chs_phone(chs_phone.message())],
required(required.message("手机号码")), captcha: [required(required.message('验证码')), alpha_num(alpha_num.message('验证码'))],
chs_phone(chs_phone.message())
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
]
}) })
.validate({ .validate({
account, account,
captcha captcha,
}); })
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e)
} }
const res = await loginMobile({ loginMobile({
account: that.account, account: that.account,
captcha: that.captcha, captcha: that.captcha,
spread: cookie.get("spread") spread: cookie.get('spread'),
}) })
if (res.status === 200) { .then(res => {
this.$store.commit("login", res.data.token, dayjs(res.data.expires_time)); this.$store.commit('login', res.data.token, dayjs(res.data.expires_time))
handleGetUserInfo(); handleGetUserInfo()
} else { })
.catch(err => {
uni.showToast({ uni.showToast({
title: res.msg || res.response.data.msg || err.response.data.message, title: res.msg || res.response.data.msg || err.response.data.message,
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
} })
// .then(res => { // .then(res => {
// that.$store.commit("login", res.data.token, dayjs(res.data.expires_time)); // that.$store.commit("login", res.data.token, dayjs(res.data.expires_time));
// handleGetUserInfo(); // handleGetUserInfo();
@ -203,100 +178,72 @@
// }); // });
}, },
async register() { async register() {
var that = this; var that = this
const { const { account, captcha, password } = that
account,
captcha,
password
} = that;
try { try {
await that await that
.$validator({ .$validator({
account: [ account: [required(required.message('手机号码')), chs_phone(chs_phone.message())],
required(required.message("手机号码")), captcha: [required(required.message('验证码')), alpha_num(alpha_num.message('验证码'))],
chs_phone(chs_phone.message()) password: [required(required.message('密码')), attrs.range([6, 16], attrs.range.message('密码')), alpha_num(alpha_num.message('密码'))],
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
],
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
]
}) })
.validate({ .validate({
account, account,
captcha, captcha,
password password,
}); })
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e)
} }
register({ register({
account: that.account, account: that.account,
captcha: that.captcha, captcha: that.captcha,
password: that.password, password: that.password,
inviteCode: that.inviteCode, inviteCode: that.inviteCode,
spread: cookie.get("spread") spread: cookie.get('spread'),
}) })
.then(res => { .then(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "success", icon: 'success',
duration: 2000 duration: 2000,
}); })
that.formItem = 1; that.formItem = 1
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message, title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
// //
async code() { async code() {
const { const { account } = this
account
} = this;
try { try {
await this await this.$validator({
.$validator({ account: [required(required.message('手机号码')), chs_phone(chs_phone.message())],
account: [ }).validate({
required(required.message("手机号码")), account,
chs_phone(chs_phone.message())
]
}) })
.validate({
account
});
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e)
} }
if (this.formItem == 2) this.type = "register"; if (this.formItem == 2) this.type = 'register'
this.showCode() this.showCode()
}, },
// //
async sendCode () { async sendCode() {
const { const { account } = this
account
} = this;
try { try {
await this await this.$validator({
.$validator({ account: [required(required.message('手机号码')), chs_phone(chs_phone.message())],
account: [ }).validate({
required(required.message("手机号码")), account,
chs_phone(chs_phone.message())
]
}) })
.validate({
account
});
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e)
} }
// //
if (this.clock !== 60) { if (this.clock !== 60) {
@ -321,87 +268,79 @@
showCode() { showCode() {
return registerVerify({ return registerVerify({
phone: this.account, phone: this.account,
type: this.type type: this.type,
}) })
.then(res => { .then(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "success", icon: 'success',
duration: 2000 duration: 2000,
}); })
this.sendCode(); this.sendCode()
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message, title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
},
navTap(index) {
this.current = index
}, },
navTap(index) { this.current = index; },
async submit() { async submit() {
const { const { account, password } = this
account,
password
} = this;
try { try {
await this.$validator({ await this.$validator({
account: [ account: [required(required.message('账号')), attrs.range([5, 16], attrs.range.message('账号')), alpha_num(alpha_num.message('账号'))],
required(required.message("账号")), password: [required(required.message('密码')), attrs.range([6, 16], attrs.range.message('密码')), alpha_num(alpha_num.message('密码'))],
attrs.range([5, 16], attrs.range.message("账号")),
alpha_num(alpha_num.message("账号"))
],
password: [
required(required.message("密码")),
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
]
}).validate({ }).validate({
account, account,
password password,
}); })
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e)
} }
//
const res = await login({ login({
username: account, username: account,
password, password,
spread: cookie.get("spread") spread: cookie.get('spread'),
}) })
if (res.status === 200) { .then(res => {
this.$store.commit("login", res.data.token, dayjs(res.data.expires_time)); this.$store.commit('login', res.data.token, dayjs(res.data.expires_time))
handleGetUserInfo(); handleGetUserInfo()
} else { })
.catch(err => {
uni.showToast({ uni.showToast({
title: res.msg || res.response.data.msg || err.response.data.message, title: err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
} })
} },
} },
}; }
</script> </script>
<style lang="scss"> <style lang="scss">
.register .whiteBg .title .item{ .register .whiteBg .title .item {
border-bottom: 2px solid; border-bottom: 2px solid;
} }
.register .whiteBg .title .item.on{ .register .whiteBg .title .item.on {
border-bottom-color: #f35749; border-bottom-color: #f35749;
} }
.getPhoneCode{ .getPhoneCode {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.phoneInput{ .phoneInput {
width: 70%; width: 70%;
} }
.phoneCode{ .phoneCode {
width: 30%; width: 30%;
text-align: center; text-align: center;
color: #FFFFFF; color: #ffffff;
background-color: #f35749; background-color: #f35749;
padding: 12rpx; padding: 12rpx;
font-size: 28rpx; font-size: 28rpx;

Loading…
Cancel
Save