Commit f0504fc7 authored by Facius's avatar Facius
parents ab109c95 bd51154d
Pipeline #2827 canceled with stages
import request from "@/utils/request.js"
export function getUserInfo() {
return request({
url: `/rest/user`,
method: 'GET',
})
}
export function sendCode(data) {
return request({
url: `/anno/moblie/sendCode`,
method: 'GET',
data
})
}
......@@ -68,7 +68,7 @@ export default {
billingTypeOptions,
takePhotoIcon:indexBaseUrl+'shangchuanbeizhu@3x.png',
takePhotoSuccessIcon:indexBaseUrl+'shangchuanbeizhuchenggong@3x.png',
show: true,
show: false,
customStyle: {
width: '104rpx',
height: '48rpx',
......
<template>
<view class="billing-category">
<uni-swiper-dot :info="swiperList" :current="current" field="content" :mode="mode" :dotsStyles="dotsStyles">
<swiper class="swiper" circular :indicator-dots="false" indicator-color="#8d8d8d" indicator-active-color="#02A074" :autoplay="false" :duration="duration" @change="change">
<swiper class="swiper" :indicator-dots="false" indicator-color="#8d8d8d" indicator-active-color="#02A074" :autoplay="false" :duration="duration" @change="change">
<swiper-item v-for="(swiper, swiperIndex) in swiperList" :key="swiperIndex">
<view class="swiper-item">
<view class="billing-category-item" :class="{ active: item.value === checked }" v-for="(item, index) in list" :key="index" @click="handleCheck(item)">
......@@ -24,6 +24,9 @@ import { billingCategoryOptions } from '@/utils/options/index/index.js';
import { billBaseUrl } from '@/utils/config.js';
export default {
name: 'billing-category',
components:{
UniSwiperDot
},
props: {
checked: {
type: Number | String,
......@@ -39,10 +42,12 @@ export default {
current:0,
mode:'round',
dotsStyles:{
width:8,
bottom:10,
width:6,
bottom:0,
backgroundColor:'#8d8d8d',
selectedBackgroundColor:'#02A074'
selectedBackgroundColor:'#02A074',
border:'none',
selectedBorder:'none'
}
};
},
......@@ -52,7 +57,6 @@ export default {
},
change(e) {
this.current = e.detail.current;
console.log(this.current)
}
}
};
......
......@@ -319,7 +319,6 @@
"selectedColor": "#303133",
"backgroundColor": "#FFFFFF",
"borderStyle": "black",
"spacing":"6px",
"list": [{
"pagePath": "pages/index/index",
"iconPath": "/static/image/index/shouye0@3x.png",
......
......@@ -6,23 +6,23 @@
</view>
<view class="user-info">
<view class="user-nickname">
<text v-if="userInfo.nickname">{{ userInfo.nickname }}</text>
<text v-if="userInfo.id">{{ userInfo.nickname }}</text>
<text v-else>立即登录</text>
</view>
<view class="license-num">
<text v-if="userInfo.nickname">{{ userInfo.nickname }}</text>
<text v-if="userInfo.id">{{ userInfo.repairShopName }}</text>
<text v-else>登录可体验更多功能</text>
</view>
<view class="vip" v-if="!userInfo.nickname">
<view class="vip" v-if="userInfo.id">
<view class="vip-icon">
<image :src="isVip" mode="" v-if="userInfo.day > 0"></image>
<image :src="isVip" mode="" v-if="userInfo.vip"></image>
<image :src="notVip" mode="" v-else></image>
</view>
<view class="vip-text">
<text class="vip-text-is" v-if="userInfo.day > 0">会员权益剩余{{}}天</text>
<text class="vip-text-is" v-if="userInfo.vip">会员权益剩余{{}}天</text>
<text class="vip-text-no" v-else>您还不是会员</text>
</view>
<view class="vip-renew" v-if="userInfo.day > 0">
<view class="vip-renew" v-if="userInfo.vip">
<text>续费</text>
<u-icon name="arrow-right" class="vip-renew-icon"></u-icon>
</view>
......@@ -52,8 +52,9 @@ export default {
},
notVip(){
return this.baseUrl+'bushihuiyuan@3x.png'
}
}
},
},
};
</script>
......
......@@ -39,6 +39,7 @@
<script>
import log from '@/utils/log.js'
import {showToast} from "@/utils/common.js"
import { mapGetters } from 'vuex';
export default {
components: {},
......@@ -270,6 +271,16 @@ export default {
}
this.$store.dispatch('Auto_login',params).then((res)=>{
console.log("登录成功",res)
this.$store.dispatch('Get_UserInfo').then(()=>{
showToast('登录成功');
setTimeout(()=>{
uni.switchTab({
url:"/pages/index/index"
})
},1000)
}).catch(()=>{
showToast('获取用户信息失败');
})
}).catch((err)=>{
showToast('登录失败');
console.log("登录失败",err)
......
......@@ -6,7 +6,6 @@ import {
} from "@/utils/common.js"
import {whiteList} from "@/utils/config.js"
import store from "../store/index.js"
console.log("store",store)
import {
getCode
} from "@/utils/auth.js"
......@@ -39,28 +38,44 @@ const router = createRouter({
console.log("需要鉴权")
if(checkToken()){
next()
}else{
next()
// if(store.getters.platform==='4'){
// showToast('登录已过期,请重新登录')
// setTimeout(()=>{
// next({
// path:'/pages/login/login'
// })
// },1500)
// }else{
// store.dispatch('Auto_login').then(()=>{
// next()
// }).catch(()=>{
// showToast('自动登录失败');
// setTimeout(()=>{
// next({
// path:'/pages/login/login'
// })
// },1500)
}else {
// next()
if(store.getters.platform==='4'){
showToast('登录已过期,请重新登录')
setTimeout(()=>{
next({
path:'/pages/login/login'
})
},1500)
}else{
store.dispatch('Auto_login').then(()=>{
next()
// if(!store.getters.userInfo||!store.getters.userInfo.id){
// console.log("未获取到用户信息")
// store.dispatch('Get_UserInfo').then(()=>{
// next()
// }).catch(()=>{
// showToast('获取用户信息失败');
// setTimeout(()=>{
// next({
// path:'/pages/login/login'
// })
// },1500)
// })
// }else{
// next()
// }
}).catch(()=>{
showToast('自动登录失败');
setTimeout(()=>{
next({
path:'/pages/login/login'
})
},1500)
// })
// }
})
}
}
}
......
......@@ -12,11 +12,10 @@ import {
} from "@/utils/config.js"
import {
userAuthLogin,
getProfile,
getDVRHost,
getHeadImageHost,
subscribeCyzn
} from "@/api/login/index.js";
import {
getUserInfo,
} from "@/api/user/index.js";
import {
wxLogin
} from "@/utils/auth.js"
......@@ -140,8 +139,7 @@ const actions = {
loginChannel:loginChannel,
code:code,
}
console.log(code)
return false
// return false
if(params){
info={
...info,
......@@ -149,23 +147,26 @@ const actions = {
}
}
let res = await userAuthLogin(info)
let {token}=res.data
setTimetamp()
setToken(res.token)
setToken(token)
await dispatch('Get_UserInfo')
resolve(res)
} catch (e) {
console.log(e)
reject()
console.log("Auto_login错误",e)
reject(e)
}
})
},
// 获取用户信息
GetInfo({
Get_UserInfo({
commit,
state
state,
dispatch
}) {
return new Promise(async (resolve, reject) => {
try {
let res = await getProfile()
let res = await getUserInfo()
let {
code,
data
......@@ -174,6 +175,7 @@ const actions = {
commit("SET_USERINFO", data)
resolve(res)
} catch (e) {
dispatch("LogOut")
console.log(e)
reject()
}
......
## 1.2.0(2021-11-19)
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-swiper-dot](https://uniapp.dcloud.io/component/uniui/uni-swiper-dot)
## 1.1.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.6(2021-05-12)
- 新增 示例地址
- 修复 示例项目缺少组件的Bug
## 1.0.5(2021-02-05)
- 调整为uni_modules目录规范
- 新增 clickItem 事件,支持指示点控制轮播
- 新增 支持 pc 可用
{
"id": "uni-swiper-dot",
"displayName": "uni-swiper-dot 轮播图指示点",
"version": "1.2.0",
"description": "自定义轮播图指示点组件",
"keywords": [
"uni-ui",
"uniui",
"轮播图指示点",
"dot",
"swiper"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
},
"uni_modules": {
"dependencies": ["uni-scss"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}
\ No newline at end of file
## SwiperDot 轮播图指示点
> **组件名:uni-swiper-dot**
> 代码块: `uSwiperDot`
自定义轮播图指示点
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-swiper-dot)
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
\ No newline at end of file
......@@ -97,7 +97,7 @@ export function checkToken() {
let backToken = getToken()
let backTime = uni.getStorageSync(TIMETAMP)
if (backToken) {
if (backTime && time - backTime <= 24 * 60 * 60 * 1000) {
if (backTime && time - backTime <= 8 * 60 * 60 * 1000) {
return true;
} else {
removeUserinfo()
......@@ -132,7 +132,7 @@ export function checkCodeTimetamp() {
let time = new Date().getTime()
let backTime = getCodeTimetamp()
if (backTime) {
if (time - backTime <= 2 * 60 * 60 * 1000) {
if (time - backTime <= 8 * 60 * 60 * 1000) {
return true;
} else {
removeCodeTimetamp()
......
......@@ -46,7 +46,8 @@ function request({
console.log("requestUrl=" + url)
// console.log("请求参数===")
// console.log(data)
header["Authorization"] = token
// header["Authorization"] ='Basic '+ token
header["token"] ='Bearer ' + token
if (!noLoading) {
uni.showLoading({
title: '加载中',
......@@ -64,7 +65,7 @@ function request({
// 重置时间戳
setTimetamp()
// console.log(res)
if (res.data.code === 200) {
if (res.data.code === 0) {
if (!noLoading) {
uni.hideLoading()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment