Merge branch 'develop' of https://gitee.com/likeshop_gitee/likeadmin-java into develop
部分调整
This commit is contained in:
commit
59f508d70f
|
|
@ -10,3 +10,8 @@ export function login(data: Record<string, any>) {
|
||||||
export function register(data: Record<string, any>) {
|
export function register(data: Record<string, any>) {
|
||||||
return request.post({ url: '/login/register', data: { ...data, client } })
|
return request.post({ url: '/login/register', data: { ...data, client } })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//忘记密码
|
||||||
|
export function forgotPassword(data: Record<string, any>) {
|
||||||
|
return request.post({ url: '/login/forgotPassword', data })
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,3 +9,20 @@ export function getIndex() {
|
||||||
export function getDecorate(data: any) {
|
export function getDecorate(data: any) {
|
||||||
return request.get({ url: '/decorate', data })
|
return request.get({ url: '/decorate', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 热门搜索
|
||||||
|
* @return { Promise }
|
||||||
|
*/
|
||||||
|
export function getHotSearch() {
|
||||||
|
return request.get({ url: '/hotSearch' })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 搜索
|
||||||
|
* @param { string } keyword 关键词
|
||||||
|
* @return { Promise }
|
||||||
|
*/
|
||||||
|
export function getSearch(data: { keyword: string, pageNo: number, pageSize: number }) {
|
||||||
|
return request.get({ url: '/search', data })
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,23 @@ export function getUserCenter() {
|
||||||
return request.get({ url: '/user/center' })
|
return request.get({ url: '/user/center' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 个人信息
|
||||||
export function getUserInfo() {
|
export function getUserInfo() {
|
||||||
return request.get({ url: '/user/info' })
|
return request.get({ url: '/user/info' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 个人编辑
|
||||||
|
export function userEdit(data: any) {
|
||||||
|
return request.post({ url: '/user/edit', data: data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 绑定手机
|
||||||
|
export function userBindMobile(data: any) {
|
||||||
|
return request.post({ url: '/user/bindMobile', data: data })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 微信电话
|
||||||
|
export function userMnpMobile(data: any) {
|
||||||
|
return request.post({ url: '/user/mnpMobile', data: data })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,3 +19,7 @@ export enum SMSEnum {
|
||||||
CHANGE_MOBILE = 103,
|
CHANGE_MOBILE = 103,
|
||||||
FIND_PASSWORD = 104
|
FIND_PASSWORD = 104
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum SearchTypeEnum {
|
||||||
|
HISTORY = 'history'
|
||||||
|
}
|
||||||
|
|
@ -2,3 +2,6 @@
|
||||||
|
|
||||||
//token
|
//token
|
||||||
export const TOKEN_KEY = 'token'
|
export const TOKEN_KEY = 'token'
|
||||||
|
|
||||||
|
// 搜索历史记录
|
||||||
|
export const HISTORY = 'history'
|
||||||
|
|
@ -2,7 +2,6 @@ import { createSSRApp } from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import plugins from './plugins'
|
import plugins from './plugins'
|
||||||
import './styles/index.scss'
|
import './styles/index.scss'
|
||||||
import './router'
|
|
||||||
export function createApp() {
|
export function createApp() {
|
||||||
const app = createSSRApp(App)
|
const app = createSSRApp(App)
|
||||||
app.use(plugins)
|
app.use(plugins)
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,12 @@
|
||||||
"navigationBarTitleText": "注册"
|
"navigationBarTitleText": "注册"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/forget_pwd/forget_pwd",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "忘记密码"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/customer_service/customer_service",
|
"path": "pages/customer_service/customer_service",
|
||||||
"style": {
|
"style": {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
<template>
|
||||||
|
<view
|
||||||
|
class="register bg-white min-h-full flex flex-col items-center px-[40rpx] pt-[100rpx] box-border"
|
||||||
|
>
|
||||||
|
<view class="w-full">
|
||||||
|
<view class="text-2xl font-medium mb-[100rpx]">忘记登录密码</view>
|
||||||
|
<u-form borderBottom :label-width="150">
|
||||||
|
<u-form-item label="手机号" borderBottom>
|
||||||
|
<u-input
|
||||||
|
class="flex-1"
|
||||||
|
v-model="formData.mobile"
|
||||||
|
:border="false"
|
||||||
|
placeholder="请输入手机号码"
|
||||||
|
/>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="验证码" borderBottom>
|
||||||
|
<u-input
|
||||||
|
class="flex-1"
|
||||||
|
v-model="formData.code"
|
||||||
|
placeholder="请输入验证码"
|
||||||
|
:border="false"
|
||||||
|
/>
|
||||||
|
<view
|
||||||
|
class="border-l border-solid border-0 border-light pl-3 text-muted leading-4 ml-3 w-[180rpx]"
|
||||||
|
@click="sendSms"
|
||||||
|
>
|
||||||
|
<u-verification-code
|
||||||
|
ref="uCodeRef"
|
||||||
|
:seconds="60"
|
||||||
|
@change="codeChange"
|
||||||
|
change-text="x秒"
|
||||||
|
/>
|
||||||
|
{{ codeTips }}
|
||||||
|
</view>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="新密码" borderBottom>
|
||||||
|
<u-input
|
||||||
|
class="flex-1"
|
||||||
|
type="password"
|
||||||
|
v-model="formData.password"
|
||||||
|
placeholder="6-20位数字+字母或符号组合"
|
||||||
|
:border="false"
|
||||||
|
/>
|
||||||
|
</u-form-item>
|
||||||
|
<u-form-item label="确认密码" borderBottom>
|
||||||
|
<u-input
|
||||||
|
class="flex-1"
|
||||||
|
type="password"
|
||||||
|
v-model="formData.password2"
|
||||||
|
placeholder="再次输入新密码"
|
||||||
|
:border="false"
|
||||||
|
/>
|
||||||
|
</u-form-item>
|
||||||
|
</u-form>
|
||||||
|
<view class="mt-[100rpx]">
|
||||||
|
<u-button type="primary" shape="circle" @click="handleConfirm"> 确定 </u-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { forgotPassword } from '@/api/account'
|
||||||
|
import { smsSend } from '@/api/app'
|
||||||
|
import { SMSEnum } from '@/enums/appEnums'
|
||||||
|
import { reactive, ref, shallowRef } from 'vue'
|
||||||
|
|
||||||
|
const uCodeRef = shallowRef()
|
||||||
|
const codeTips = ref('')
|
||||||
|
const formData = reactive({
|
||||||
|
mobile: '',
|
||||||
|
code: '',
|
||||||
|
password: '',
|
||||||
|
password2: ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const codeChange = (text: string) => {
|
||||||
|
codeTips.value = text
|
||||||
|
}
|
||||||
|
|
||||||
|
const sendSms = async () => {
|
||||||
|
if (!formData.mobile) return uni.$u.toast('请输入手机号码')
|
||||||
|
if (uCodeRef.value?.canGetCode) {
|
||||||
|
await smsSend({
|
||||||
|
scene: SMSEnum.FIND_PASSWORD,
|
||||||
|
mobile: formData.mobile
|
||||||
|
})
|
||||||
|
uni.$u.toast('发送成功')
|
||||||
|
uCodeRef.value?.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleConfirm = async () => {
|
||||||
|
if (!formData.mobile) return uni.$u.toast('请输入手机号码')
|
||||||
|
if (!formData.password) return uni.$u.toast('请输入密码')
|
||||||
|
if (!formData.password2) return uni.$u.toast('请输入确认密码')
|
||||||
|
if (formData.password != formData.password2) return uni.$u.toast('两次输入的密码不一致')
|
||||||
|
await forgotPassword(formData)
|
||||||
|
uni.$u.toast('操作成功')
|
||||||
|
uni.navigateBack()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
page {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -31,11 +31,13 @@
|
||||||
placeholder="请输入密码"
|
placeholder="请输入密码"
|
||||||
:border="false"
|
:border="false"
|
||||||
/>
|
/>
|
||||||
<view
|
<navigator url="/pages/forget_pwd/forget_pwd" hover-class="none">
|
||||||
class="border-l border-solid border-0 border-light pl-3 text-muted leading-4 ml-3"
|
<view
|
||||||
>
|
class="border-l border-solid border-0 border-light pl-3 text-muted leading-4 ml-3"
|
||||||
忘记密码?
|
>
|
||||||
</view>
|
忘记密码?
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
</u-form-item>
|
</u-form-item>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="scene == LoginTypeEnum.MOBILE">
|
<template v-if="scene == LoginTypeEnum.MOBILE">
|
||||||
|
|
@ -79,8 +81,10 @@
|
||||||
<u-checkbox v-model="isCheckAgreement" shape="circle">
|
<u-checkbox v-model="isCheckAgreement" shape="circle">
|
||||||
<view class="text-xs flex">
|
<view class="text-xs flex">
|
||||||
已阅读并同意
|
已阅读并同意
|
||||||
<navigator class="text-primary">《服务协议》</navigator>
|
<navigator class="text-primary" hover-class="none">《服务协议》</navigator>
|
||||||
和<navigator class="text-primary">《隐私协议》</navigator>
|
和<navigator class="text-primary" hover-class="none">
|
||||||
|
《隐私协议》
|
||||||
|
</navigator>
|
||||||
</view>
|
</view>
|
||||||
</u-checkbox>
|
</u-checkbox>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -97,8 +101,9 @@
|
||||||
<view v-if="scene == LoginTypeEnum.ACCOUNT" @click="scene = LoginTypeEnum.MOBILE">
|
<view v-if="scene == LoginTypeEnum.ACCOUNT" @click="scene = LoginTypeEnum.MOBILE">
|
||||||
短信验证码登录
|
短信验证码登录
|
||||||
</view>
|
</view>
|
||||||
<navigator url="/pages/register/register">注册账号</navigator>
|
<navigator url="/pages/register/register" hover-class="none">注册账号</navigator>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<view class="mt-[80rpx]">
|
<view class="mt-[80rpx]">
|
||||||
<u-divider>第三方登录</u-divider>
|
<u-divider>第三方登录</u-divider>
|
||||||
<div class="flex justify-center mt-[40rpx]">
|
<div class="flex justify-center mt-[40rpx]">
|
||||||
|
|
@ -108,6 +113,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="news" >
|
<view class="news" >
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<view class="news-search px-[24rpx] py-[14rpx] bg-white">
|
<navigator url="/pages/search/search">
|
||||||
<u-search placeholder="请输入关键词搜索" disabled :show-action="false"></u-search>
|
<view class="news-search px-[24rpx] py-[14rpx] bg-white">
|
||||||
</view>
|
<u-search placeholder="请输入关键词搜索" disabled :show-action="false"></u-search>
|
||||||
|
</view>
|
||||||
|
</navigator>
|
||||||
|
|
||||||
<!-- 内容 -->
|
<!-- 内容 -->
|
||||||
<tabs
|
<tabs
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ const accountRegister = async () => {
|
||||||
if (!accountData.password2) return uni.$u.toast('请输入确认密码')
|
if (!accountData.password2) return uni.$u.toast('请输入确认密码')
|
||||||
if (accountData.password != accountData.password2) return uni.$u.toast('两次输入的密码不一致')
|
if (accountData.password != accountData.password2) return uni.$u.toast('两次输入的密码不一致')
|
||||||
await register(accountData)
|
await register(accountData)
|
||||||
uni.$u.toast('组册成功')
|
uni.$u.toast('注册成功')
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
<template>
|
||||||
|
<view class="suggest bg-white">
|
||||||
|
|
||||||
|
<!-- 热门搜索 -->
|
||||||
|
<view class="hot" v-if="hot_search.length">
|
||||||
|
<view class="text-base font-medium pl-[24rpx] pt-[26rpx] pb-[6rpx]">热门搜索</view>
|
||||||
|
|
||||||
|
<view class="w-full pl-[24rpx] pr-[8rpx]">
|
||||||
|
<block v-for="hotItem in hot_search">
|
||||||
|
<view class="keyword" @click="handleHistoreSearch(hotItem)">{{ hotItem }}</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="mx-[24rpx] my-[40rpx] border-b border-solid border-0 border-light" v-if="hot_search.length && his_search.length"></view>
|
||||||
|
|
||||||
|
<!-- 历史搜索 -->
|
||||||
|
<view class="history" v-if="his_search.length">
|
||||||
|
<view class="flex justify-between px-[24rpx] pb-[6rpx]">
|
||||||
|
<view class="text-base font-medium">历史搜索</view>
|
||||||
|
<view class="text-xs text-muted" @click="() => emit('clear')">清空</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="w-full pl-[24rpx] pr-[8rpx]">
|
||||||
|
<block v-for="hisItem in his_search">
|
||||||
|
<view class="keyword" @click="handleHistoreSearch(hisItem)">{{ hisItem }}</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, nextTick } from "vue"
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(event: 'search', value: string): void
|
||||||
|
(event: 'clear', value: void): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps < {
|
||||||
|
hot_search?: string[],
|
||||||
|
his_search?: string[]
|
||||||
|
|
||||||
|
} > (), {
|
||||||
|
hot_search: [],
|
||||||
|
his_search: []
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleHistoreSearch = (text: string) => {
|
||||||
|
emit('search', text)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.suggest {
|
||||||
|
height: 100%;
|
||||||
|
.keyword {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 24rpx 16rpx 0 0;
|
||||||
|
padding: 8rpx 24rpx;
|
||||||
|
border-radius: 26rpx;
|
||||||
|
background-color: #F4F4F4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,123 @@
|
||||||
|
<template>
|
||||||
|
<view class="search">
|
||||||
|
<!-- 搜索框 -->
|
||||||
|
<view class="px-[24rpx] py-[14rpx] bg-white">
|
||||||
|
<u-search
|
||||||
|
v-model="keyword"
|
||||||
|
placeholder="请输入关键词搜索"
|
||||||
|
height="72"
|
||||||
|
@search="handleSearch"
|
||||||
|
@custom="handleSearch"
|
||||||
|
@clear="search.searching = false"
|
||||||
|
></u-search>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 搜索 -->
|
||||||
|
<view class="search-content">
|
||||||
|
<!-- -->
|
||||||
|
<suggest
|
||||||
|
v-show="!search.searching"
|
||||||
|
@search="handleSearch"
|
||||||
|
@clear="handleClear"
|
||||||
|
:hot_search="search.hot_search"
|
||||||
|
:his_search="search.his_search"
|
||||||
|
></suggest>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<view class="search-content-s pt-[20rpx]" v-show="search.searching">
|
||||||
|
<z-paging
|
||||||
|
ref="paging"
|
||||||
|
v-model="search.result"
|
||||||
|
@query="queryList"
|
||||||
|
:fixed="false"
|
||||||
|
height="100%"
|
||||||
|
use-page-scroll
|
||||||
|
>
|
||||||
|
<block v-for="(item, index) in search.result" :key="item.id">
|
||||||
|
<news-card :item="item" :newsId="item.id"></news-card>
|
||||||
|
</block>
|
||||||
|
</z-paging>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, shallowRef } from 'vue';
|
||||||
|
import Suggest from "./component/suggest.vue"
|
||||||
|
import { HISTORY } from "@/enums/cacheEnums"
|
||||||
|
import { getHotSearch, getSearch } from "@/api/shop"
|
||||||
|
import cache from "@/utils/cache"
|
||||||
|
|
||||||
|
interface Search {
|
||||||
|
hot_search: any
|
||||||
|
his_search: any
|
||||||
|
result: any
|
||||||
|
searching: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
const search = reactive<Search>({
|
||||||
|
hot_search: [],
|
||||||
|
his_search: [],
|
||||||
|
result: [],
|
||||||
|
searching: false
|
||||||
|
})
|
||||||
|
const keyword = ref<string>('')
|
||||||
|
const paging = shallowRef()
|
||||||
|
|
||||||
|
const handleSearch = (value: string) => {
|
||||||
|
keyword.value = value
|
||||||
|
if ( keyword.value ) {
|
||||||
|
if ( !search.his_search.includes(keyword.value) ) {
|
||||||
|
search.his_search.unshift(keyword.value)
|
||||||
|
cache.set(HISTORY, search.his_search)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
paging.value.reload()
|
||||||
|
search.searching = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const getHotSearchFunc = async () => {
|
||||||
|
try{
|
||||||
|
search.hot_search = await getHotSearch()
|
||||||
|
}catch(e){
|
||||||
|
//TODO handle the exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleClear = async (): Promise<void> => {
|
||||||
|
const resModel: any = await uni.showModal({
|
||||||
|
title: '温馨提示',
|
||||||
|
content: '是否清空历史记录?'
|
||||||
|
})
|
||||||
|
if ( resModel.confirm ) {
|
||||||
|
cache.set(HISTORY, '')
|
||||||
|
search.his_search = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const queryList = async (pageNo, pageSize) => {
|
||||||
|
const { lists } = await getSearch({
|
||||||
|
keyword: keyword.value,
|
||||||
|
pageNo, pageSize
|
||||||
|
})
|
||||||
|
|
||||||
|
search.result = lists
|
||||||
|
paging.value.complete(lists);
|
||||||
|
}
|
||||||
|
|
||||||
|
getHotSearchFunc()
|
||||||
|
search.his_search = cache.get(HISTORY) || new Array()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.search {
|
||||||
|
&-content {
|
||||||
|
height: calc(100vh - 46px - env(safe-area-inset-bottom));
|
||||||
|
&-s {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
<template>
|
|
||||||
<view class="">
|
|
||||||
<u-parse :html="agreementContent"></u-parse>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { reactive, ref } from 'vue'
|
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
|
||||||
import { AgreementEnum } from '@/enums/agreementEnums'
|
|
||||||
import { getPolicy } from '@/api/app'
|
|
||||||
|
|
||||||
let agreementType = ref('') // 协议类型
|
|
||||||
let agreementContent = ref('') // 协议内容
|
|
||||||
// let agreementName = ref('') // 协议名称
|
|
||||||
|
|
||||||
const getData = async (type) => {
|
|
||||||
let res = await getPolicy({ type })
|
|
||||||
console.log(res, 'res')
|
|
||||||
|
|
||||||
agreementContent.value = res.content
|
|
||||||
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: res.name
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
onLoad((options: any) => {
|
|
||||||
if(options.type) {
|
|
||||||
agreementType.value = options.type
|
|
||||||
getData(agreementType)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
</style>
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { merge } from 'lodash-es'
|
||||||
import { HttpRequestOptions, RequestHooks } from './type'
|
import { HttpRequestOptions, RequestHooks } from './type'
|
||||||
import { getToken } from '../auth'
|
import { getToken } from '../auth'
|
||||||
import { RequestCodeEnum } from '@/enums/requestEnums'
|
import { RequestCodeEnum } from '@/enums/requestEnums'
|
||||||
|
import { useUserStore } from '@/stores/user'
|
||||||
|
|
||||||
const requestHooks: RequestHooks = {
|
const requestHooks: RequestHooks = {
|
||||||
requestInterceptorsHook(options, config) {
|
requestInterceptorsHook(options, config) {
|
||||||
|
|
@ -32,7 +33,7 @@ const requestHooks: RequestHooks = {
|
||||||
if (!isTransformResponse) {
|
if (!isTransformResponse) {
|
||||||
return response.data
|
return response.data
|
||||||
}
|
}
|
||||||
console.log(response.data)
|
const { logout } = useUserStore()
|
||||||
const { code, data, msg } = response.data as any
|
const { code, data, msg } = response.data as any
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case RequestCodeEnum.SUCCESS:
|
case RequestCodeEnum.SUCCESS:
|
||||||
|
|
@ -52,6 +53,10 @@ const requestHooks: RequestHooks = {
|
||||||
|
|
||||||
case RequestCodeEnum.TOKEN_INVALID:
|
case RequestCodeEnum.TOKEN_INVALID:
|
||||||
case RequestCodeEnum.TOKEN_EMPTY:
|
case RequestCodeEnum.TOKEN_EMPTY:
|
||||||
|
logout()
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
})
|
||||||
return Promise.reject()
|
return Promise.reject()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,22 @@
|
||||||
* @param { Boolean } all 是否多选
|
* @param { Boolean } all 是否多选
|
||||||
* @param { ctx } context 当前组件实例
|
* @param { ctx } context 当前组件实例
|
||||||
*/
|
*/
|
||||||
export const getRect = (selector: string, all: boolean = false, context?: any) => {
|
export const getRect = (selector: string, all = false, context?: any) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let qurey = uni.createSelectorQuery()
|
let qurey = uni.createSelectorQuery()
|
||||||
if (context) {
|
if (context) {
|
||||||
qurey = uni.createSelectorQuery().in(context)
|
qurey = uni.createSelectorQuery().in(context)
|
||||||
}
|
}
|
||||||
qurey[all ? 'selectAll' : 'select'](selector).boundingClientRect(function(rect) {
|
qurey[all ? 'selectAll' : 'select'](selector)
|
||||||
if (all && Array.isArray(rect) && rect.length) {
|
.boundingClientRect(function (rect) {
|
||||||
return resolve(rect)
|
if (all && Array.isArray(rect) && rect.length) {
|
||||||
}
|
return resolve(rect)
|
||||||
if (!all && rect) {
|
}
|
||||||
return resolve(rect)
|
if (!all && rect) {
|
||||||
}
|
return resolve(rect)
|
||||||
reject('找不到元素')
|
}
|
||||||
}).exec()
|
reject('找不到元素')
|
||||||
|
})
|
||||||
|
.exec()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue