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 { ...@@ -68,7 +68,7 @@ export default {
billingTypeOptions, billingTypeOptions,
takePhotoIcon:indexBaseUrl+'shangchuanbeizhu@3x.png', takePhotoIcon:indexBaseUrl+'shangchuanbeizhu@3x.png',
takePhotoSuccessIcon:indexBaseUrl+'shangchuanbeizhuchenggong@3x.png', takePhotoSuccessIcon:indexBaseUrl+'shangchuanbeizhuchenggong@3x.png',
show: true, show: false,
customStyle: { customStyle: {
width: '104rpx', width: '104rpx',
height: '48rpx', height: '48rpx',
......
<template> <template>
<view class="billing-category"> <view class="billing-category">
<uni-swiper-dot :info="swiperList" :current="current" field="content" :mode="mode" :dotsStyles="dotsStyles"> <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"> <swiper-item v-for="(swiper, swiperIndex) in swiperList" :key="swiperIndex">
<view class="swiper-item"> <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)"> <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'; ...@@ -24,6 +24,9 @@ import { billingCategoryOptions } from '@/utils/options/index/index.js';
import { billBaseUrl } from '@/utils/config.js'; import { billBaseUrl } from '@/utils/config.js';
export default { export default {
name: 'billing-category', name: 'billing-category',
components:{
UniSwiperDot
},
props: { props: {
checked: { checked: {
type: Number | String, type: Number | String,
...@@ -39,10 +42,12 @@ export default { ...@@ -39,10 +42,12 @@ export default {
current:0, current:0,
mode:'round', mode:'round',
dotsStyles:{ dotsStyles:{
width:8, width:6,
bottom:10, bottom:0,
backgroundColor:'#8d8d8d', backgroundColor:'#8d8d8d',
selectedBackgroundColor:'#02A074' selectedBackgroundColor:'#02A074',
border:'none',
selectedBorder:'none'
} }
}; };
}, },
...@@ -52,7 +57,6 @@ export default { ...@@ -52,7 +57,6 @@ export default {
}, },
change(e) { change(e) {
this.current = e.detail.current; this.current = e.detail.current;
console.log(this.current)
} }
} }
}; };
......
...@@ -319,7 +319,6 @@ ...@@ -319,7 +319,6 @@
"selectedColor": "#303133", "selectedColor": "#303133",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"borderStyle": "black", "borderStyle": "black",
"spacing":"6px",
"list": [{ "list": [{
"pagePath": "pages/index/index", "pagePath": "pages/index/index",
"iconPath": "/static/image/index/shouye0@3x.png", "iconPath": "/static/image/index/shouye0@3x.png",
......
...@@ -6,23 +6,23 @@ ...@@ -6,23 +6,23 @@
</view> </view>
<view class="user-info"> <view class="user-info">
<view class="user-nickname"> <view class="user-nickname">
<text v-if="userInfo.nickname">{{ userInfo.nickname }}</text> <text v-if="userInfo.id">{{ userInfo.nickname }}</text>
<text v-else>立即登录</text> <text v-else>立即登录</text>
</view> </view>
<view class="license-num"> <view class="license-num">
<text v-if="userInfo.nickname">{{ userInfo.nickname }}</text> <text v-if="userInfo.id">{{ userInfo.repairShopName }}</text>
<text v-else>登录可体验更多功能</text> <text v-else>登录可体验更多功能</text>
</view> </view>
<view class="vip" v-if="!userInfo.nickname"> <view class="vip" v-if="userInfo.id">
<view class="vip-icon"> <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> <image :src="notVip" mode="" v-else></image>
</view> </view>
<view class="vip-text"> <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> <text class="vip-text-no" v-else>您还不是会员</text>
</view> </view>
<view class="vip-renew" v-if="userInfo.day > 0"> <view class="vip-renew" v-if="userInfo.vip">
<text>续费</text> <text>续费</text>
<u-icon name="arrow-right" class="vip-renew-icon"></u-icon> <u-icon name="arrow-right" class="vip-renew-icon"></u-icon>
</view> </view>
...@@ -52,8 +52,9 @@ export default { ...@@ -52,8 +52,9 @@ export default {
}, },
notVip(){ notVip(){
return this.baseUrl+'bushihuiyuan@3x.png' return this.baseUrl+'bushihuiyuan@3x.png'
} },
} },
}; };
</script> </script>
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
<script> <script>
import log from '@/utils/log.js' import log from '@/utils/log.js'
import {showToast} from "@/utils/common.js"
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
export default { export default {
components: {}, components: {},
...@@ -270,6 +271,16 @@ export default { ...@@ -270,6 +271,16 @@ export default {
} }
this.$store.dispatch('Auto_login',params).then((res)=>{ this.$store.dispatch('Auto_login',params).then((res)=>{
console.log("登录成功",res) console.log("登录成功",res)
this.$store.dispatch('Get_UserInfo').then(()=>{
showToast('登录成功');
setTimeout(()=>{
uni.switchTab({
url:"/pages/index/index"
})
},1000)
}).catch(()=>{
showToast('获取用户信息失败');
})
}).catch((err)=>{ }).catch((err)=>{
showToast('登录失败'); showToast('登录失败');
console.log("登录失败",err) console.log("登录失败",err)
......
...@@ -6,7 +6,6 @@ import { ...@@ -6,7 +6,6 @@ import {
} from "@/utils/common.js" } from "@/utils/common.js"
import {whiteList} from "@/utils/config.js" import {whiteList} from "@/utils/config.js"
import store from "../store/index.js" import store from "../store/index.js"
console.log("store",store)
import { import {
getCode getCode
} from "@/utils/auth.js" } from "@/utils/auth.js"
...@@ -39,28 +38,44 @@ const router = createRouter({ ...@@ -39,28 +38,44 @@ const router = createRouter({
console.log("需要鉴权") console.log("需要鉴权")
if(checkToken()){ if(checkToken()){
next() next()
}else{ }else {
next() // next()
// if(store.getters.platform==='4'){ if(store.getters.platform==='4'){
// showToast('登录已过期,请重新登录') showToast('登录已过期,请重新登录')
// setTimeout(()=>{ setTimeout(()=>{
// next({ next({
// path:'/pages/login/login' path:'/pages/login/login'
// }) })
// },1500) },1500)
// }else{ }else{
// store.dispatch('Auto_login').then(()=>{ store.dispatch('Auto_login').then(()=>{
// next() next()
// }).catch(()=>{ // if(!store.getters.userInfo||!store.getters.userInfo.id){
// showToast('自动登录失败'); // console.log("未获取到用户信息")
// setTimeout(()=>{ // store.dispatch('Get_UserInfo').then(()=>{
// next({ // next()
// path:'/pages/login/login' // }).catch(()=>{
// }) // showToast('获取用户信息失败');
// },1500) // setTimeout(()=>{
// next({
// path:'/pages/login/login'
// })
// },1500)
// })
// }else{
// next()
// }
}).catch(()=>{
showToast('自动登录失败');
setTimeout(()=>{
next({
path:'/pages/login/login'
})
},1500)
// }) })
// } }
} }
} }
......
...@@ -12,11 +12,10 @@ import { ...@@ -12,11 +12,10 @@ import {
} from "@/utils/config.js" } from "@/utils/config.js"
import { import {
userAuthLogin, userAuthLogin,
getProfile,
getDVRHost,
getHeadImageHost,
subscribeCyzn
} from "@/api/login/index.js"; } from "@/api/login/index.js";
import {
getUserInfo,
} from "@/api/user/index.js";
import { import {
wxLogin wxLogin
} from "@/utils/auth.js" } from "@/utils/auth.js"
...@@ -140,8 +139,7 @@ const actions = { ...@@ -140,8 +139,7 @@ const actions = {
loginChannel:loginChannel, loginChannel:loginChannel,
code:code, code:code,
} }
console.log(code) // return false
return false
if(params){ if(params){
info={ info={
...info, ...info,
...@@ -149,23 +147,26 @@ const actions = { ...@@ -149,23 +147,26 @@ const actions = {
} }
} }
let res = await userAuthLogin(info) let res = await userAuthLogin(info)
let {token}=res.data
setTimetamp() setTimetamp()
setToken(res.token) setToken(token)
await dispatch('Get_UserInfo')
resolve(res) resolve(res)
} catch (e) { } catch (e) {
console.log(e) console.log("Auto_login错误",e)
reject() reject(e)
} }
}) })
}, },
// 获取用户信息 // 获取用户信息
GetInfo({ Get_UserInfo({
commit, commit,
state state,
dispatch
}) { }) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
let res = await getProfile() let res = await getUserInfo()
let { let {
code, code,
data data
...@@ -174,6 +175,7 @@ const actions = { ...@@ -174,6 +175,7 @@ const actions = {
commit("SET_USERINFO", data) commit("SET_USERINFO", data)
resolve(res) resolve(res)
} catch (e) { } catch (e) {
dispatch("LogOut")
console.log(e) console.log(e)
reject() 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() { ...@@ -97,7 +97,7 @@ export function checkToken() {
let backToken = getToken() let backToken = getToken()
let backTime = uni.getStorageSync(TIMETAMP) let backTime = uni.getStorageSync(TIMETAMP)
if (backToken) { if (backToken) {
if (backTime && time - backTime <= 24 * 60 * 60 * 1000) { if (backTime && time - backTime <= 8 * 60 * 60 * 1000) {
return true; return true;
} else { } else {
removeUserinfo() removeUserinfo()
...@@ -132,7 +132,7 @@ export function checkCodeTimetamp() { ...@@ -132,7 +132,7 @@ export function checkCodeTimetamp() {
let time = new Date().getTime() let time = new Date().getTime()
let backTime = getCodeTimetamp() let backTime = getCodeTimetamp()
if (backTime) { if (backTime) {
if (time - backTime <= 2 * 60 * 60 * 1000) { if (time - backTime <= 8 * 60 * 60 * 1000) {
return true; return true;
} else { } else {
removeCodeTimetamp() removeCodeTimetamp()
......
...@@ -46,7 +46,8 @@ function request({ ...@@ -46,7 +46,8 @@ function request({
console.log("requestUrl=" + url) console.log("requestUrl=" + url)
// console.log("请求参数===") // console.log("请求参数===")
// console.log(data) // console.log(data)
header["Authorization"] = token // header["Authorization"] ='Basic '+ token
header["token"] ='Bearer ' + token
if (!noLoading) { if (!noLoading) {
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
...@@ -64,7 +65,7 @@ function request({ ...@@ -64,7 +65,7 @@ function request({
// 重置时间戳 // 重置时间戳
setTimetamp() setTimetamp()
// console.log(res) // console.log(res)
if (res.data.code === 200) { if (res.data.code === 0) {
if (!noLoading) { if (!noLoading) {
uni.hideLoading() 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