'获取用户信息'
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<view class="con_imgview">
|
||||
<!-- scaleToFill aspectFit -->
|
||||
<u-swiper height="370rpx" :list="list" :circular="true" imgMode="widthFix" keyName="image"
|
||||
:imgMode="aspectFit"></u-swiper>
|
||||
</view>
|
||||
@@ -26,19 +25,6 @@
|
||||
<text class="typetxt">退车</text>
|
||||
<image class="type_img" src="@/static/images/images/cart_reception.png"></image>
|
||||
</view>
|
||||
|
||||
<!-- <view class="typeview_one" @click="toFault">
|
||||
<text class="typetxt">故障维修</text>
|
||||
<image class="type_img" src="@/static/images/images/troubleshooting.png"></image>
|
||||
</view>
|
||||
<view class="typeview_one" @click="toAccident">
|
||||
<text class="typetxt">事故维修</text>
|
||||
<image class="type_img" src="@/static/images/images/maintenance_reception.png"></image>
|
||||
</view>
|
||||
<view class="typeview_one" @click="toRefund">
|
||||
<text class="typetxt">退车</text>
|
||||
<image class="type_img" src="@/static/images/images/cart_reception.png"></image>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="foottxt">
|
||||
<text>服务专线:400-9966-409</text>
|
||||
@@ -52,11 +38,6 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
// list: [
|
||||
// require('../../static/home/imgCar.png'),
|
||||
// require('../../static/home/imgCar1.png'),
|
||||
// require('../../static/home/imgCar2.png'),
|
||||
// ],
|
||||
list: [],
|
||||
carousel: {
|
||||
limit: 20,
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
<template>
|
||||
<view class="u-flex-column u-flex-fill" style="padding:30rpx;">
|
||||
<!-- 微信登录 -->
|
||||
<view class="u-flex-column u-flex-fill" style="margin-top: 86rpx;">
|
||||
<!-- <u-button
|
||||
type="success"
|
||||
shape="circle"
|
||||
:loading="loading"
|
||||
throttleTime="1000"
|
||||
openType="getPhoneNumber"
|
||||
@getphonenumber="getphonenumber"
|
||||
text="微信登录"/> -->
|
||||
</view>
|
||||
<u-popup :show="show" :round="10" mode="bottom">
|
||||
<view class="outsideview">
|
||||
<view class="topview">
|
||||
@@ -24,12 +14,6 @@
|
||||
<a class='con_a' href="https://www.uviewui.com">《隐私政策》</a>和<a class='con_a'
|
||||
href="https://www.uviewui.com">《用户协议》</a>
|
||||
</view>
|
||||
<!-- <view>
|
||||
欢迎使用“星桔EV”小程序,在您使用本小程序之前,请您在您使用本小程序之前,请您在您使用本小程序之前,请您在您使用本小程序之前,请您仔细阅读
|
||||
<u-link href="https://uviewui.com/" text="《隐私政策》" color="#13AFA8"></u-link>和
|
||||
<u-link href="https://uviewui.com/" text="《用户协议》" color="#13AFA8"></u-link>
|
||||
</view> -->
|
||||
|
||||
<view style="margin-top: 20rpx;">
|
||||
<text class="foottxt">
|
||||
请您在您使用本小程序之前,请您在您使用本小程序之前,请您仔细阅读
|
||||
@@ -92,19 +76,17 @@
|
||||
})
|
||||
},
|
||||
//微信小程序登录
|
||||
getphonenumber({
|
||||
detail
|
||||
}) {
|
||||
// console.log(detail,'对象解构里面的');
|
||||
getphonenumber({ detail }) {
|
||||
console.log(detail,'对象解构里面的');
|
||||
this.loading = true
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: wx => {
|
||||
// console.log(wx,'第一个success');
|
||||
console.log(wx,'第一个success');
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: s => {
|
||||
// console.log(s,'第二个success');
|
||||
console.log(s,'第二个success');
|
||||
loginPhone({
|
||||
jsCode: s.code,
|
||||
code: wx.code,
|
||||
@@ -112,15 +94,14 @@
|
||||
iv: detail.iv,
|
||||
type: 'routine'
|
||||
}).then(res => {
|
||||
// console.log(res,'手机号授权-then里面的');
|
||||
console.log(res,'手机号授权-then里面的');
|
||||
if (res.data.type === 'login') {
|
||||
setToken(res.data.token)
|
||||
this.$store.dispatch('GetInfo')
|
||||
setTimeout(() => {
|
||||
if (uni.getStorageSync('oldPage')) {
|
||||
uni.reLaunch({
|
||||
url: uni
|
||||
.getStorageSync(
|
||||
'oldPage'),
|
||||
url: uni.getStorageSync('oldPage'),
|
||||
})
|
||||
} else {
|
||||
uni.switchTab({
|
||||
@@ -138,7 +119,9 @@
|
||||
key: res.data.key
|
||||
}
|
||||
getUserPhone(Wxform).then(r => {
|
||||
console.log('注册', res);
|
||||
setToken(res.data.token)
|
||||
this.$store.dispatch('GetInfo')
|
||||
uni.switchTab({
|
||||
url: '/pages/home/index'
|
||||
})
|
||||
@@ -152,6 +135,9 @@
|
||||
this.loading = false
|
||||
this.$u.toast(err)
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
console.log('login-err', err);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,44 +1,5 @@
|
||||
<template>
|
||||
<view class="mine-container" :style="{height: `${windowHeight}px`}">
|
||||
<!--顶部个人信息栏-->
|
||||
<!-- <view class="header-section">
|
||||
<view class="flex justify-end">
|
||||
<u-icon name="setting-fill" @click="gotoSet" />
|
||||
</view>
|
||||
<view class="flex justify-between">
|
||||
<view class="flex align-center">
|
||||
<view v-if="!avatar" class="cu-avatar xl round bg-white">
|
||||
<view class="iconfont icon-people text-gray icon"></view>
|
||||
</view>
|
||||
<image v-if="avatar" :src="avatar" class="cu-avatar xl round" mode="widthFix" />
|
||||
<view v-if="!name" @click="handleToLogin" class="login-tip">
|
||||
点击登录
|
||||
</view>
|
||||
<view v-if="name" @click="handleToInfo" class="user-info">
|
||||
<view class="u_title">
|
||||
{{ name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view @click="handleToInfo" class="flex align-center">
|
||||
<view class="iconfont icon-right"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- view class="branner-box">
|
||||
<u-swiper :list="brannerList" keyName="advertisingPicture" @change="changePic" @click="clickPic"></u-swiper>
|
||||
</view>
|
||||
<view class="content-section">
|
||||
<view class="mine-actions grid col-4 text-center">
|
||||
<view class="action-item" @click="checkTabItem(item)" v-for="item in tabList" :key="item.id">
|
||||
<view class="image-box">
|
||||
<image :src="item.pic" mode="widthFix"></image>
|
||||
</view>
|
||||
<text class="text">{{item.name}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- 1111111111111111111111111111111111111111111- -->
|
||||
<!--顶部个人信息栏-->
|
||||
<view class="header-info" :style="{ backgroundImage: `url(${header_bgimg})` }">
|
||||
<!-- 未登录 -->
|
||||
@@ -146,6 +107,7 @@
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
console.log('用户信息', this.$store.state.user.userInfo);
|
||||
// this.getUserMenuData()
|
||||
// this.getBranner()
|
||||
this.getMineInfo()
|
||||
|
||||
@@ -49,32 +49,6 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <view>
|
||||
<view class="search">
|
||||
<u-search placeholder="搜索城市" @search="searchCity"></u-search>
|
||||
</view>
|
||||
<view class="now-city">
|
||||
<view class="">
|
||||
当前城市
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="">
|
||||
{{ citySave }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="hot-city">
|
||||
<view class="" v-for="(item,index) in hotCity" :key="index">
|
||||
{{item}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="city-list">
|
||||
|
||||
</view>
|
||||
<view class="search-city">
|
||||
|
||||
</view>
|
||||
</view> -->
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -31,7 +31,7 @@ list.forEach(item => {
|
||||
uni.addInterceptor(item, {
|
||||
invoke(to) {
|
||||
console.log('页面拦截', to);
|
||||
console.log('页面token', getToken());
|
||||
// console.log('页面token', getToken());
|
||||
if (getToken()) {
|
||||
if (to.url === loginPage) {
|
||||
uni.navigateTo({ url: "/" })
|
||||
@@ -42,7 +42,7 @@ list.forEach(item => {
|
||||
return true
|
||||
}
|
||||
console.log("触发页面验证拦截", to.url)
|
||||
uni.setStorageSync('oldPage', to.url)
|
||||
uni.setStorageSync('oldPage', to.url)
|
||||
uni.navigateTo({ url: loginPage })
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -3,12 +3,14 @@ import storage from '@/utils/storage'
|
||||
import constant from '@/utils/constant'
|
||||
import { login, logout, getInfo, phoneLogin, weixinPhoneLogin } from '@/api/login'
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||
import { getAllMineInfoAPI } from '@/api/mine'
|
||||
|
||||
const baseUrl = config.baseUrl
|
||||
|
||||
const user = {
|
||||
state: {
|
||||
token: getToken(),
|
||||
userInfo: uni.getStorageSync('userInfo') || {},
|
||||
name: storage.get(constant.name),
|
||||
avatar: storage.get(constant.avatar),
|
||||
roles: storage.get(constant.roles),
|
||||
@@ -23,6 +25,9 @@ const user = {
|
||||
SET_TOKEN: (state, token) => {
|
||||
state.token = token
|
||||
setToken(token)
|
||||
},
|
||||
SET_USERINFO: (state, data) => {
|
||||
state.userInfo = data
|
||||
},
|
||||
SET_NAME: (state, name) => {
|
||||
state.name = name
|
||||
@@ -78,29 +83,11 @@ const user = {
|
||||
// 获取用户信息
|
||||
GetInfo({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
const user = res.data
|
||||
const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : user.avatar
|
||||
const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName
|
||||
const nickname = (user == null || user.nickName == "" || user.nickName == null) ? "" : user.nickName
|
||||
const phonenumber = (user == null || user.phonenumber == "" || user.phonenumber == null) ? "" : user.phonenumber
|
||||
const sex = (user == null || user.sex == "" || user.sex == null) ? "" : user.sex
|
||||
const birthDay = (user == null || user.birthDay == "" || user.birthDay == null) ? "" : user.birthDay
|
||||
|
||||
console.log(phonenumber,'phonenumber123456');
|
||||
|
||||
if (res.roles && res.roles.length > 0) {
|
||||
commit('SET_ROLES', res.roles)
|
||||
commit('SET_PERMISSIONS', res.permissions)
|
||||
} else {
|
||||
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
||||
}
|
||||
commit('SET_NAME', username)
|
||||
commit('SET_AVATAR', avatar)
|
||||
commit('SET_NICK', nickname)
|
||||
commit('SET_PHONE', phonenumber)
|
||||
commit('SET_SEX', sex)
|
||||
commit('SET_BIRTHDAY', birthDay)
|
||||
getAllMineInfoAPI().then(res => {
|
||||
console.log(res);
|
||||
let user = res.data
|
||||
commit('SET_USERINFO', user)
|
||||
uni.setStorageSync('userInfo', user)
|
||||
resolve(res)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
|
||||
@@ -38,10 +38,10 @@ function baseRequest(url, method, data, {
|
||||
else if (res.data.code == 200)
|
||||
reslove(res.data, res);
|
||||
else if ([410000, 410001, 410002, 401, 402].indexOf(res.data.code) !== -1) {
|
||||
util.toLogin();
|
||||
util.toLogin();
|
||||
reject(res.data);
|
||||
} else if (res.data.code == 500) {
|
||||
uni.$emit('z-paging-error-emit');
|
||||
uni.$emit('z-paging-error-emit');
|
||||
if (res.data.message && res.data.message.indexOf('登录信息已过期') != -1) {
|
||||
util.toLogin();
|
||||
}
|
||||
@@ -52,7 +52,7 @@ function baseRequest(url, method, data, {
|
||||
}
|
||||
},
|
||||
fail: (msg) => {
|
||||
uni.$emit('z-paging-error-emit');
|
||||
uni.$emit('z-paging-error-emit');
|
||||
reject('请求失败');
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
import {
|
||||
TOKENNAME,
|
||||
|
||||
Reference in New Issue
Block a user