优化小程序和app登录的逻辑,优化部分页面样式错乱的问题,优化跳转页面后部分页面无法接受url参数的问题,优化app端的兼容问题
This commit is contained in:
@ -58,7 +58,7 @@ export default {
|
|||||||
default: () => {}
|
default: () => {}
|
||||||
},
|
},
|
||||||
cartNum: {
|
cartNum: {
|
||||||
type: String,
|
type: Number,
|
||||||
default: () => 1
|
default: () => 1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
23
main.js
23
main.js
@ -33,8 +33,6 @@ Vue.prototype.$validator = function(rule) {
|
|||||||
return new schema(rule);
|
return new schema(rule);
|
||||||
};
|
};
|
||||||
|
|
||||||
Vue.prototype.$dialog = dialog;
|
|
||||||
|
|
||||||
const CACHE_KEY = "clear_0.0.1";
|
const CACHE_KEY = "clear_0.0.1";
|
||||||
|
|
||||||
if (!cookie.has(CACHE_KEY)) {
|
if (!cookie.has(CACHE_KEY)) {
|
||||||
@ -54,6 +52,7 @@ Vue.mixin({
|
|||||||
const {
|
const {
|
||||||
$mp
|
$mp
|
||||||
} = this.$root
|
} = this.$root
|
||||||
|
console.log($mp)
|
||||||
this._route = parseRoute($mp)
|
this._route = parseRoute($mp)
|
||||||
// this.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL;
|
// this.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL;
|
||||||
this._data.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL;
|
this._data.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL;
|
||||||
@ -79,24 +78,28 @@ Object.defineProperty(Vue.prototype, '$yroute', {
|
|||||||
Vue.prototype.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL
|
Vue.prototype.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL
|
||||||
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
|
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
// H5编译的代码
|
||||||
|
Vue.prototype.$deviceType = 'H5'
|
||||||
|
// #endif
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
// App平台编译的代码
|
// App平台编译的代码
|
||||||
Vue.prototype.$deviceType = 'App'
|
Vue.prototype.$deviceType = 'App'
|
||||||
Vue.prototype.$platform = uni.getSystemInfoSync().platform
|
Vue.prototype.$platform = uni.getSystemInfoSync().platform
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifndef H5
|
|
||||||
// H5编译的代码
|
|
||||||
Vue.prototype.$deviceType = 'H5'
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
// 微信小程序编译的代码
|
// 微信小程序编译的代码
|
||||||
Vue.prototype.$deviceType = 'Weixin'
|
Vue.prototype.$deviceType = 'Weixin'
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
if(wx){
|
console.log(wx,121212)
|
||||||
Vue.prototype.$deviceType = 'Weixin'
|
console.log(Vue.prototype.$deviceType)
|
||||||
}
|
// if(wx){
|
||||||
|
// Vue.prototype.$deviceType = 'Weixin'
|
||||||
|
// }
|
||||||
|
|
||||||
app.$mount()
|
app.$mount()
|
||||||
|
@ -1,36 +1,56 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="lottie-bg">
|
<view class="lottie-bg">
|
||||||
<view id="lottie"><image src="../../static/images/live-logo.gif" rel="preload" mode="widthFix" style="width: 100%;" /></view>
|
<view id="lottie">
|
||||||
|
<image
|
||||||
|
src="../../static/images/live-logo.gif"
|
||||||
|
rel="preload"
|
||||||
|
mode="widthFix"
|
||||||
|
style="width: 100%;"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapMutations, mapActions } from 'vuex';
|
import { mapState, mapMutations, mapActions } from "vuex";
|
||||||
// 组件
|
// 组件
|
||||||
// import request from "@//api/request";
|
// import request from "@//api/request";
|
||||||
import { wxappAuth, getUser } from '@/api/user';
|
import { wxappAuth, getUser } from "@/api/user";
|
||||||
import dayjs from 'dayjs';
|
import dayjs from "dayjs";
|
||||||
import cookie from '@/utils/store/cookie';
|
import cookie from "@/utils/store/cookie";
|
||||||
import { parseQuery, login, handleQrCode } from '@/utils';
|
import { parseQuery, login, handleQrCode } from "@/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Loading',
|
name: "Loading",
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
mounted() {
|
onShow() {
|
||||||
var url = handleQrCode();
|
var url = handleQrCode();
|
||||||
// 判断是否是分销
|
// 判断是否是分销
|
||||||
if (url) {
|
if (url) {
|
||||||
var spread = cookie.get('spread');
|
var spread = cookie.get("spread");
|
||||||
let urlSpread = parseInt(url.spread);
|
let urlSpread = parseInt(url.spread);
|
||||||
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
|
if (!Number.isNaN(urlSpread) && spread !== urlSpread) {
|
||||||
cookie.set('spread', urlSpread || 0);
|
cookie.set("spread", urlSpread || 0);
|
||||||
} else if (spread === 0 || typeof spread !== 'number') {
|
} else if (spread === 0 || typeof spread !== "number") {
|
||||||
cookie.set('spread', urlSpread || 0);
|
cookie.set("spread", urlSpread || 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.$store.getters.token) {
|
||||||
|
this.toLaunch();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(this.$store.getters.token, 9999);
|
||||||
|
cookie.get("spread");
|
||||||
// this.toLaunch();
|
// this.toLaunch();
|
||||||
|
if (this.$deviceType == 'App') {
|
||||||
|
// this.toLaunch();
|
||||||
|
this.$yrouter.switchTab({
|
||||||
|
path: '/pages/home/index',
|
||||||
|
});
|
||||||
|
return
|
||||||
|
}
|
||||||
login({
|
login({
|
||||||
fail: () => {
|
fail: () => {
|
||||||
this.toLaunch();
|
this.toLaunch();
|
||||||
@ -38,12 +58,12 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['changeAuthorization', 'changeUserInfo']),
|
...mapActions(["changeAuthorization", "setUserInfo"]),
|
||||||
toLaunch() {
|
toLaunch() {
|
||||||
console.log(this);
|
console.log(this);
|
||||||
this.changeAuthorization(false);
|
this.changeAuthorization(false);
|
||||||
this.$yrouter.switchTab({
|
this.$yrouter.switchTab({
|
||||||
path: '/pages/home/index',
|
path: "/pages/home/index"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
:key="combinationListIndex"
|
:key="combinationListIndex"
|
||||||
@click="link(item.id)"
|
@click="link(item.id)"
|
||||||
>
|
>
|
||||||
|
<text>{{item.id}}</text>
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="item.image" />
|
<image :src="item.image" />
|
||||||
</view>
|
</view>
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
<view class="bnt bg-color-violet" @click="openAlone">单独购买</view>
|
<view class="bnt bg-color-violet" @click="openAlone">单独购买</view>
|
||||||
<view class="bnt bg-color-red" @click="openTeam">立即开团</view>
|
<view class="bnt bg-color-red" @click="openTeam">立即开团</view>
|
||||||
</view>
|
</view>
|
||||||
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow>
|
<ProductWindow v-if="cartNum" v-on:changeFun="changeFun" :attr="attr" :cartNum="cartNum"></ProductWindow>
|
||||||
<StorePoster
|
<StorePoster
|
||||||
v-on:setPosterImageStatus="setPosterImageStatus"
|
v-on:setPosterImageStatus="setPosterImageStatus"
|
||||||
:posterImageStatus="posterImageStatus"
|
:posterImageStatus="posterImageStatus"
|
||||||
@ -122,18 +122,6 @@
|
|||||||
></StorePoster>
|
></StorePoster>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
|
||||||
.noscroll {
|
|
||||||
height: 100%;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
.product-con .footer-group .bnt {
|
|
||||||
width: 43%;
|
|
||||||
}
|
|
||||||
.product-con .footer-group .bnt.bg-color-violet {
|
|
||||||
background-color: #fa8013;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import { swiper, swiperSlide } from "vue-awesome-swiper";
|
// import { swiper, swiperSlide } from "vue-awesome-swiper";
|
||||||
@ -211,7 +199,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted: function() {
|
onShow: function() {
|
||||||
this.mountedStart();
|
this.mountedStart();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -220,6 +208,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mountedStart: function() {
|
mountedStart: function() {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
console.log(that)
|
||||||
let id = that.$yroute.query.id;
|
let id = that.$yroute.query.id;
|
||||||
getCombinationDetail(id).then(res => {
|
getCombinationDetail(id).then(res => {
|
||||||
that.$set(that, "storeInfo", res.data.storeInfo);
|
that.$set(that, "storeInfo", res.data.storeInfo);
|
||||||
@ -336,4 +325,14 @@ export default {
|
|||||||
.product-con .wrapper {
|
.product-con .wrapper {
|
||||||
padding-bottom: 0.26rem;
|
padding-bottom: 0.26rem;
|
||||||
}
|
}
|
||||||
|
.noscroll {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.product-con .footer-group .bnt {
|
||||||
|
width: 43%;
|
||||||
|
}
|
||||||
|
.product-con .footer-group .bnt.bg-color-violet {
|
||||||
|
background-color: #fa8013;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -40,7 +40,7 @@ export default {
|
|||||||
this.changeAuthorization(false);
|
this.changeAuthorization(false);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(["changeAuthorization", "changeUserInfo"]),
|
...mapActions(["changeAuthorization", "setUserInfo"]),
|
||||||
...mapMutations(["UPDATE_AUTHORIZATIONPAGE", "CHANGE_TABTAR"]),
|
...mapMutations(["UPDATE_AUTHORIZATIONPAGE", "CHANGE_TABTAR"]),
|
||||||
back() {
|
back() {
|
||||||
this.$yrouter.switchTab({
|
this.$yrouter.switchTab({
|
||||||
|
@ -252,7 +252,7 @@ export default {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted: function() {
|
onShow: function() {
|
||||||
let that = this;
|
let that = this;
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title:'加载中'
|
title:'加载中'
|
||||||
|
@ -7,29 +7,24 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="whiteBg" v-if="formItem === 1">
|
<view class="whiteBg" v-if="formItem === 1">
|
||||||
<view class="title acea-row row-center-wrapper">
|
<view class="title acea-row row-center-wrapper">
|
||||||
<view
|
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" @click="navTap(index)"
|
||||||
class="item"
|
:key="index">{{ item }}</view>
|
||||||
:class="current === index ? 'on' : ''"
|
|
||||||
v-for="(item, index) in navList"
|
|
||||||
@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">
|
<view class="item">
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="acea-row row-between-wrapper">
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-phone_" />
|
<use xlink:href="#icon-phone_" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="text" placeholder="输入手机号码" v-model="account" required />
|
<input type="text" placeholder="输入手机号码" v-model="account" required />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="acea-row row-between-wrapper">
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-code_" />
|
<use xlink:href="#icon-code_" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="password" placeholder="填写登录密码" v-model="password" required />
|
<input type="password" placeholder="填写登录密码" v-model="password" required />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -38,24 +33,19 @@
|
|||||||
<view class="list" :hidden="current !== 1">
|
<view class="list" :hidden="current !== 1">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="acea-row row-between-wrapper">
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-phone_" />
|
<use xlink:href="#icon-phone_" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="text" placeholder="输入手机号码" v-model="account" />
|
<input type="text" placeholder="输入手机号码" v-model="account" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="align-left">
|
<view class="align-left">
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-code_1" />
|
<use xlink:href="#icon-code_1" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||||
<button
|
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button>
|
||||||
class="code"
|
|
||||||
:disabled="disabled"
|
|
||||||
:class="disabled === true ? 'on' : ''"
|
|
||||||
@click="code"
|
|
||||||
>{{ text }}</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -71,31 +61,26 @@
|
|||||||
<view class="list">
|
<view class="list">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view>
|
<view>
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-phone_" />
|
<use xlink:href="#icon-phone_" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="text" placeholder="输入手机号码" v-model="account" />
|
<input type="text" placeholder="输入手机号码" v-model="account" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="align-left">
|
<view class="align-left">
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-code_1" />
|
<use xlink:href="#icon-code_1" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||||
<button
|
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button>
|
||||||
class="code"
|
|
||||||
:disabled="disabled"
|
|
||||||
:class="disabled === true ? 'on' : ''"
|
|
||||||
@click="code"
|
|
||||||
>{{ text }}</button>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view>
|
<view>
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-code_" />
|
<use xlink:href="#icon-code_" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="password" placeholder="填写您的登录密码" v-model="password" />
|
<input type="password" placeholder="填写您的登录密码" v-model="password" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -111,12 +96,25 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import sendVerifyCode from "@/mixins/SendVerifyCode";
|
import sendVerifyCode from "@/mixins/SendVerifyCode";
|
||||||
import { login, loginMobile, registerVerify, register } from "@/api/user";
|
import {
|
||||||
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate";
|
login,
|
||||||
import { validatorDefaultCatch } from "@/utils/dialog";
|
loginMobile,
|
||||||
|
registerVerify,
|
||||||
|
register
|
||||||
|
} from "@/api/user";
|
||||||
|
import attrs, {
|
||||||
|
required,
|
||||||
|
alpha_num,
|
||||||
|
chs_phone
|
||||||
|
} from "@/utils/validate";
|
||||||
|
import {
|
||||||
|
validatorDefaultCatch
|
||||||
|
} from "@/utils/dialog";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import cookie from "@/utils/store/cookie";
|
import cookie from "@/utils/store/cookie";
|
||||||
|
|
||||||
|
import {handleGetUserInfo} from '@/utils'
|
||||||
|
|
||||||
const BACK_URL = "login_back_url";
|
const BACK_URL = "login_back_url";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -136,7 +134,10 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
async loginMobile() {
|
async loginMobile() {
|
||||||
var that = this;
|
var that = this;
|
||||||
const { account, captcha } = that;
|
const {
|
||||||
|
account,
|
||||||
|
captcha
|
||||||
|
} = that;
|
||||||
try {
|
try {
|
||||||
await that
|
await that
|
||||||
.$validator({
|
.$validator({
|
||||||
@ -164,11 +165,7 @@ export default {
|
|||||||
.then(res => {
|
.then(res => {
|
||||||
var data = res.data;
|
var data = res.data;
|
||||||
that.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
|
that.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
|
||||||
const backUrl = cookie.get(BACK_URL) || "/";
|
handleGetUserInfo()
|
||||||
cookie.remove(BACK_URL);
|
|
||||||
that.$yrouter.replace({
|
|
||||||
path: backUrl
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@ -180,7 +177,11 @@ export default {
|
|||||||
},
|
},
|
||||||
async register() {
|
async register() {
|
||||||
var that = this;
|
var that = this;
|
||||||
const { account, captcha, password } = that;
|
const {
|
||||||
|
account,
|
||||||
|
captcha,
|
||||||
|
password
|
||||||
|
} = that;
|
||||||
try {
|
try {
|
||||||
await that
|
await that
|
||||||
.$validator({
|
.$validator({
|
||||||
@ -230,7 +231,9 @@ export default {
|
|||||||
},
|
},
|
||||||
async code() {
|
async code() {
|
||||||
var that = this;
|
var that = this;
|
||||||
const { account } = that;
|
const {
|
||||||
|
account
|
||||||
|
} = that;
|
||||||
try {
|
try {
|
||||||
await that
|
await that
|
||||||
.$validator({
|
.$validator({
|
||||||
@ -271,7 +274,10 @@ export default {
|
|||||||
},
|
},
|
||||||
async submit() {
|
async submit() {
|
||||||
console.log("spread:" + cookie.get("spread"));
|
console.log("spread:" + cookie.get("spread"));
|
||||||
const { account, password } = this;
|
const {
|
||||||
|
account,
|
||||||
|
password
|
||||||
|
} = this;
|
||||||
try {
|
try {
|
||||||
await this.$validator({
|
await this.$validator({
|
||||||
account: [
|
account: [
|
||||||
@ -297,13 +303,18 @@ export default {
|
|||||||
password,
|
password,
|
||||||
spread: cookie.get("spread")
|
spread: cookie.get("spread")
|
||||||
})
|
})
|
||||||
.then(({ data }) => {
|
.then(({
|
||||||
|
data
|
||||||
|
}) => {
|
||||||
this.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
|
this.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
|
||||||
const backUrl = cookie.get(BACK_URL) || "/";
|
handleGetUserInfo()
|
||||||
cookie.remove(BACK_URL);
|
// let replace=this.$yroute.query.replace
|
||||||
this.$yrouter.replace({
|
// if(replace){
|
||||||
path: backUrl
|
|
||||||
});
|
// }
|
||||||
|
// this.$yrouter.replace({
|
||||||
|
// path: this.$yroute.query.replace || '/pages/home/index'
|
||||||
|
// });
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
@ -10,17 +10,17 @@
|
|||||||
<view class="list">
|
<view class="list">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view>
|
<view>
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-phone_" />
|
<use xlink:href="#icon-phone_" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="text" placeholder="输入手机号码" />
|
<input type="text" placeholder="输入手机号码" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="align-left">
|
<view class="align-left">
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-code_1" />
|
<use xlink:href="#icon-code_1" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="text" placeholder="填写验证码" class="codeIput" />
|
<input type="text" placeholder="填写验证码" class="codeIput" />
|
||||||
<button
|
<button
|
||||||
class="code"
|
class="code"
|
||||||
@ -32,9 +32,9 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view>
|
<view>
|
||||||
<svg class="icon" aria-hidden="true">
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
<use xlink:href="#icon-code_" />
|
<use xlink:href="#icon-code_" />
|
||||||
</svg>
|
</svg> -->
|
||||||
<input type="text" placeholder="填写您的登录密码" />
|
<input type="text" placeholder="填写您的登录密码" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
<view class="title acea-row row-between-wrapper">
|
<view class="title acea-row row-between-wrapper">
|
||||||
<text>我的订单</text>
|
<text>我的订单</text>
|
||||||
<text @click="goMyOrder()" class="allOrder">
|
<text @click="goMyOrder()" class="allOrder">
|
||||||
全部订单
|
<text>全部订单</text>
|
||||||
<text class="iconfont icon-jiantou"></text>
|
<text class="iconfont icon-jiantou"></text>
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
@ -67,8 +67,8 @@
|
|||||||
<image :src="$VUE_APP_RESOURCES_URL + '/images/dfk.png'" />
|
<image :src="$VUE_APP_RESOURCES_URL + '/images/dfk.png'" />
|
||||||
<text
|
<text
|
||||||
class="order-status-num"
|
class="order-status-num"
|
||||||
v-if="orderStatusNum.unpaidCount > 0"
|
v-if="userInfo.orderStatusNum.unpaidCount > 0"
|
||||||
>{{ orderStatusNum.unpaidCount }}</text>
|
>{{ userInfo.orderStatusNum.unpaidCount }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view>待付款</view>
|
<view>待付款</view>
|
||||||
</view>
|
</view>
|
||||||
@ -142,11 +142,11 @@
|
|||||||
</view>
|
</view>
|
||||||
<view style="text-align: center;margin-top: 1rem">By@意象</view>
|
<view style="text-align: center;margin-top: 1rem">By@意象</view>
|
||||||
<view class="footer-line-height"></view>
|
<view class="footer-line-height"></view>
|
||||||
<SwitchWindow
|
<!-- <SwitchWindow
|
||||||
v-on:changeswitch="changeswitch"
|
v-on:changeswitch="changeswitch"
|
||||||
:switchActive="switchActive"
|
:switchActive="switchActive"
|
||||||
:login_type="userInfo.login_type"
|
:login_type="userInfo.login_type"
|
||||||
></SwitchWindow>
|
></SwitchWindow> -->
|
||||||
</view>
|
</view>
|
||||||
<Authorization v-else />
|
<Authorization v-else />
|
||||||
</view>
|
</view>
|
||||||
@ -310,7 +310,7 @@ export default {
|
|||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
console.log(this.userInfo);
|
console.log(this.userInfo);
|
||||||
if (this.userInfo.uid) {
|
if (this.$store.getters.token) {
|
||||||
this.User();
|
this.User();
|
||||||
this.MenuUser();
|
this.MenuUser();
|
||||||
this.isWeixin = isWeixin();
|
this.isWeixin = isWeixin();
|
||||||
|
@ -17,7 +17,7 @@ const vuexStore = new Vuex.Store({
|
|||||||
// 是否授权
|
// 是否授权
|
||||||
isAuthorization: false,
|
isAuthorization: false,
|
||||||
token: store.get(LOGIN_KEY) || null,
|
token: store.get(LOGIN_KEY) || null,
|
||||||
userInfo: null
|
userInfo: store.get('userInfo')
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
SHOW_FOOTER(state) {
|
SHOW_FOOTER(state) {
|
||||||
@ -81,8 +81,13 @@ const vuexStore = new Vuex.Store({
|
|||||||
changeLogin({ state, commit }, data, date) {
|
changeLogin({ state, commit }, data, date) {
|
||||||
commit("LOGIN", data, date);
|
commit("LOGIN", data, date);
|
||||||
},
|
},
|
||||||
changeUserInfo({ state, commit }, user) {
|
setUserInfo({ state, commit }, user) {
|
||||||
commit("UPDATE_USERINFO", user.user);
|
commit("UPDATE_USERINFO", user);
|
||||||
|
if (user) {
|
||||||
|
store.set('userInfo', user)
|
||||||
|
} else {
|
||||||
|
store.set('userInfo', null)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
changeAuthorizationPage({ state, commit }, index) {
|
changeAuthorizationPage({ state, commit }, index) {
|
||||||
commit("UPDATE_AUTHORIZATIONPAGE", index);
|
commit("UPDATE_AUTHORIZATIONPAGE", index);
|
||||||
|
104
utils/index.js
104
utils/index.js
@ -120,7 +120,7 @@ export const replaceLogin = (msg) => {
|
|||||||
console.log(Vue.prototype.$deviceType)
|
console.log(Vue.prototype.$deviceType)
|
||||||
// 这里代表已经失去登录状态以及401强制推出登录了
|
// 这里代表已经失去登录状态以及401强制推出登录了
|
||||||
store.commit('LOGOUT')
|
store.commit('LOGOUT')
|
||||||
|
console.log(uni, 989)
|
||||||
if (Vue.prototype.$deviceType == 'Weixin') {
|
if (Vue.prototype.$deviceType == 'Weixin') {
|
||||||
// 如果是微信小程序,跳转到授权页
|
// 如果是微信小程序,跳转到授权页
|
||||||
replace({
|
replace({
|
||||||
@ -132,9 +132,9 @@ export const replaceLogin = (msg) => {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 如果不是小程序跳转到登录页
|
// 如果不是小程序跳转到登录页
|
||||||
replace({
|
push({
|
||||||
path: '/pages/user/Login/index',
|
path: '/pages/user/Login/index',
|
||||||
query: query || {
|
query: {
|
||||||
redirect: `/${getCurrentPageUrl()}`,
|
redirect: `/${getCurrentPageUrl()}`,
|
||||||
...parseQuery()
|
...parseQuery()
|
||||||
}
|
}
|
||||||
@ -220,52 +220,7 @@ export const login = (option) => {
|
|||||||
store.commit("LOGIN", data.token, dayjs(data.expires_time));
|
store.commit("LOGIN", data.token, dayjs(data.expires_time));
|
||||||
console.log('登录成功5')
|
console.log('登录成功5')
|
||||||
|
|
||||||
getUser().then(res => {
|
handleGetUserInfo()
|
||||||
store.dispatch('changeUserInfo', {
|
|
||||||
user: res.data
|
|
||||||
})
|
|
||||||
console.log('登录成功6')
|
|
||||||
console.log(option)
|
|
||||||
// option && option.success ? option.success() : null
|
|
||||||
var pages = getCurrentPages() //获取加载的页面
|
|
||||||
console.log('登录成功7')
|
|
||||||
|
|
||||||
var currentPage = pages[pages.length - 1] //获取当前页面的对象
|
|
||||||
let url = "/pages/home/index"
|
|
||||||
let query = {}
|
|
||||||
console.log('登录成功8')
|
|
||||||
console.log(currentPage)
|
|
||||||
|
|
||||||
if (currentPage) {
|
|
||||||
// 获取到最后一个页面
|
|
||||||
if (
|
|
||||||
currentPage.route != 'pages/Loading/index'
|
|
||||||
&&
|
|
||||||
currentPage.route != 'pages/user/Login/index'
|
|
||||||
) {
|
|
||||||
url = currentPage.route
|
|
||||||
}
|
|
||||||
if (currentPage.route == 'pages/authorization/index') {
|
|
||||||
const {
|
|
||||||
redirect,
|
|
||||||
...querys
|
|
||||||
} = currentPage.options
|
|
||||||
url = redirect
|
|
||||||
query = {
|
|
||||||
...querys
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log('登录成功9')
|
|
||||||
console.log({
|
|
||||||
path: url,
|
|
||||||
query
|
|
||||||
})
|
|
||||||
switchTab({
|
|
||||||
path: `${url}`,
|
|
||||||
query
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject()
|
reject()
|
||||||
@ -304,6 +259,51 @@ export const login = (option) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const handleGetUserInfo = () => {
|
||||||
|
getUser().then(res => {
|
||||||
|
console.log(res.data, '登录后的样式')
|
||||||
|
store.dispatch('setUserInfo', res.data)
|
||||||
|
console.log('登录成功6')
|
||||||
|
var pages = getCurrentPages() //获取加载的页面
|
||||||
|
console.log('登录成功7')
|
||||||
|
|
||||||
|
var currentPage = pages[pages.length - 1] //获取当前页面的对象
|
||||||
|
let url = "/pages/home/index"
|
||||||
|
let query = {}
|
||||||
|
console.log('登录成功8')
|
||||||
|
console.log(currentPage)
|
||||||
|
|
||||||
|
if (currentPage) {
|
||||||
|
// 获取到最后一个页面
|
||||||
|
if (
|
||||||
|
currentPage.route != 'pages/Loading/index' &&
|
||||||
|
currentPage.route != 'pages/user/Login/index'
|
||||||
|
) {
|
||||||
|
url = currentPage.route
|
||||||
|
}
|
||||||
|
if (currentPage.route == 'pages/authorization/index') {
|
||||||
|
const {
|
||||||
|
redirect,
|
||||||
|
...querys
|
||||||
|
} = currentPage.options
|
||||||
|
url = redirect
|
||||||
|
query = {
|
||||||
|
...querys
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('登录成功9')
|
||||||
|
console.log({
|
||||||
|
path: url,
|
||||||
|
query
|
||||||
|
})
|
||||||
|
switchTab({
|
||||||
|
path: `${url}`,
|
||||||
|
query
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const handleFail = (option, msg) => {
|
const handleFail = (option, msg) => {
|
||||||
// 此处是处理登录失效的问题的
|
// 此处是处理登录失效的问题的
|
||||||
@ -332,11 +332,11 @@ export function parseRoute($mp) {
|
|||||||
return {
|
return {
|
||||||
path: `/${path}`,
|
path: `/${path}`,
|
||||||
params: {},
|
params: {},
|
||||||
query: _$mp.query,
|
query: _$mp.query || _$mp.page.options,
|
||||||
hash: '',
|
hash: '',
|
||||||
fullPath: parseUrl({
|
fullPath: parseUrl({
|
||||||
path: `/${path}`,
|
path: `/${path}`,
|
||||||
query: _$mp.query
|
query: _$mp.query || _$mp.page.options
|
||||||
}),
|
}),
|
||||||
name: path && path.replace(/\/(\w)/g, ($0, $1) => $1.toUpperCase())
|
name: path && path.replace(/\/(\w)/g, ($0, $1) => $1.toUpperCase())
|
||||||
}
|
}
|
||||||
@ -376,7 +376,7 @@ export const handleLoginStatus = (location, complete, fail, success) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log(store.getters.userInfo, '用户信息')
|
console.log(store.getters.userInfo, '用户信息')
|
||||||
if (!store.getters.userInfo.uid) {
|
if (!store.getters.token) {
|
||||||
page.map((item) => {
|
page.map((item) => {
|
||||||
console.log(item.path == path)
|
console.log(item.path == path)
|
||||||
if (item.path == path) {
|
if (item.path == path) {
|
||||||
|
Reference in New Issue
Block a user