feat: 接口对接完成
This commit is contained in:
@@ -96,6 +96,7 @@
|
|||||||
"onWatcherCleanup": true,
|
"onWatcherCleanup": true,
|
||||||
"useId": true,
|
"useId": true,
|
||||||
"useModel": true,
|
"useModel": true,
|
||||||
"useTemplateRef": true
|
"useTemplateRef": true,
|
||||||
|
"useListPageRequest": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ VITE_WX_APPID = 'wxa2abb91f64032a2b'
|
|||||||
# h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base
|
# h5部署网站的base,配置到 manifest.config.ts 里的 h5.router.base
|
||||||
VITE_APP_PUBLIC_BASE=/
|
VITE_APP_PUBLIC_BASE=/
|
||||||
|
|
||||||
VITE_SERVER_BASEURL = 'https://ukw0y1.laf.run'
|
VITE_SERVER_BASEURL = 'https://mapi.foxmail555.cc'
|
||||||
VITE_UPLOAD_BASEURL = 'https://ukw0y1.laf.run/upload'
|
VITE_UPLOAD_BASEURL = 'https://ukw0y1.laf.run/upload'
|
||||||
|
|
||||||
# h5是否需要配置代理
|
# h5是否需要配置代理
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
"@dcloudio/uni-mp-xhs": "3.0.0-4020920240930001",
|
"@dcloudio/uni-mp-xhs": "3.0.0-4020920240930001",
|
||||||
"@dcloudio/uni-quickapp-webview": "3.0.0-4020920240930001",
|
"@dcloudio/uni-quickapp-webview": "3.0.0-4020920240930001",
|
||||||
"dayjs": "1.11.10",
|
"dayjs": "1.11.10",
|
||||||
|
"nprogress": "^0.2.0",
|
||||||
"pinia": "2.0.36",
|
"pinia": "2.0.36",
|
||||||
"pinia-plugin-persistedstate": "3.2.1",
|
"pinia-plugin-persistedstate": "3.2.1",
|
||||||
"qs": "6.5.3",
|
"qs": "6.5.3",
|
||||||
|
|||||||
+8
-7
@@ -32,17 +32,18 @@ export default defineUniPages({
|
|||||||
pagePath: 'pages/index/index',
|
pagePath: 'pages/index/index',
|
||||||
text: '首页',
|
text: '首页',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
iconPath: 'static/tabbar/invest.png',
|
|
||||||
selectedIconPath: 'static/tabbar/investHL.png',
|
|
||||||
pagePath: 'pages/invest/index',
|
|
||||||
text: '投资',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
iconPath: 'static/tabbar/house.png',
|
iconPath: 'static/tabbar/house.png',
|
||||||
selectedIconPath: 'static/tabbar/houseHL.png',
|
selectedIconPath: 'static/tabbar/houseHL.png',
|
||||||
pagePath: 'pages/invite/index',
|
pagePath: 'pages/invite/index',
|
||||||
text: '房屋',
|
text: '邀请好友',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
iconPath: 'static/tabbar/invest.png',
|
||||||
|
selectedIconPath: 'static/tabbar/investHL.png',
|
||||||
|
pagePath: 'pages/invest/index',
|
||||||
|
text: '理财',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
iconPath: 'static/tabbar/personal.png',
|
iconPath: 'static/tabbar/personal.png',
|
||||||
|
|||||||
Generated
+8
@@ -62,6 +62,9 @@ importers:
|
|||||||
dayjs:
|
dayjs:
|
||||||
specifier: 1.11.10
|
specifier: 1.11.10
|
||||||
version: 1.11.10
|
version: 1.11.10
|
||||||
|
nprogress:
|
||||||
|
specifier: ^0.2.0
|
||||||
|
version: 0.2.0
|
||||||
pinia:
|
pinia:
|
||||||
specifier: 2.0.36
|
specifier: 2.0.36
|
||||||
version: 2.0.36(typescript@5.7.2)(vue@3.4.21(typescript@5.7.2))
|
version: 2.0.36(typescript@5.7.2)(vue@3.4.21(typescript@5.7.2))
|
||||||
@@ -4227,6 +4230,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==}
|
resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==}
|
||||||
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
|
||||||
|
|
||||||
|
nprogress@0.2.0:
|
||||||
|
resolution: {integrity: sha512-I19aIingLgR1fmhftnbWWO3dXc0hSxqHQHQb3H8m+K3TnEn/iSeTZZOyvKXWqQESMwuUVnatlCnZdLBZZt2VSA==}
|
||||||
|
|
||||||
nth-check@2.1.1:
|
nth-check@2.1.1:
|
||||||
resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
|
resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==}
|
||||||
|
|
||||||
@@ -10967,6 +10973,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
path-key: 4.0.0
|
path-key: 4.0.0
|
||||||
|
|
||||||
|
nprogress@0.2.0: {}
|
||||||
|
|
||||||
nth-check@2.1.1:
|
nth-check@2.1.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
boolbase: 1.0.0
|
boolbase: 1.0.0
|
||||||
|
|||||||
+8
-4
@@ -11,6 +11,10 @@ onLaunch((options) => {
|
|||||||
// redirect: options.path,
|
// redirect: options.path,
|
||||||
// },
|
// },
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
if (userStore.isLogged) {
|
||||||
|
userStore.loadUserInfo()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -100,15 +104,15 @@ uni-modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.uni-modal__title {
|
.uni-modal__title {
|
||||||
@apply p-16 text-left text-16 font-600;
|
@apply p-15 text-left text-16 font-600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-modal__bd {
|
.uni-modal__bd {
|
||||||
@apply mb-16 px-16 pt-0 text-left text-14 font-medium text-#666;
|
@apply px-15 pt-0 text-left text-14 font-medium text-#666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.uni-modal__btn {
|
.uni-modal__btn {
|
||||||
@apply px-16 py-8 flex-none rounded-full shadow-none text-14;
|
@apply px-15 py-6 flex-none rounded-full shadow-none text-14;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: none;
|
content: none;
|
||||||
@@ -120,7 +124,7 @@ uni-modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.uni-modal__ft {
|
.uni-modal__ft {
|
||||||
@apply justify-end p-16 leading-normal;
|
@apply justify-end px-15 pb-10 leading-normal;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: none;
|
content: none;
|
||||||
|
|||||||
@@ -20,8 +20,9 @@ defineProps({
|
|||||||
block
|
block
|
||||||
overflow-hidden
|
overflow-hidden
|
||||||
rounded-full
|
rounded-full
|
||||||
style="background: linear-gradient(180deg, #96e517 0%, #8bc135 100%)"
|
bg-gray-100
|
||||||
class="h-full w-full"
|
class="h-full w-full"
|
||||||
|
mode="aspectFill"
|
||||||
:src="src ?? DefaultAavatar"
|
:src="src ?? DefaultAavatar"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
import { formatTime, getImageUrl } from '@/utils'
|
||||||
|
import { onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
|
||||||
|
import { computed, onMounted, ref } from 'vue'
|
||||||
|
|
||||||
|
interface PaginationRequest {
|
||||||
|
page?: number
|
||||||
|
limit?: number
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
function useListPageRequest(
|
||||||
|
request: (params: PaginationRequest) => Promise<any>,
|
||||||
|
options: {
|
||||||
|
autoBind?: boolean
|
||||||
|
autoRequest?: boolean
|
||||||
|
} = {},
|
||||||
|
) {
|
||||||
|
const { autoBind = true, autoRequest = true } = options
|
||||||
|
const list = ref<any[]>([])
|
||||||
|
// 加载中
|
||||||
|
const loading = ref(false)
|
||||||
|
// 加载更多中
|
||||||
|
const moreLoading = ref(false)
|
||||||
|
// 全部数据加载完成
|
||||||
|
const totalPage = ref(0)
|
||||||
|
const finished = computed(() => totalPage.value <= pagingParams.value.page)
|
||||||
|
const pagingParams = ref<PaginationRequest>({
|
||||||
|
page: 1,
|
||||||
|
limit: 1000,
|
||||||
|
})
|
||||||
|
const getPagingParams = computed(() => {
|
||||||
|
return {
|
||||||
|
...pagingParams.value,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let customParams: PaginationRequest = {}
|
||||||
|
|
||||||
|
const statusLoading = computed(() => {
|
||||||
|
if (moreLoading.value || loading.value) {
|
||||||
|
return 'loading'
|
||||||
|
}
|
||||||
|
if (finished.value) {
|
||||||
|
return 'noMore'
|
||||||
|
}
|
||||||
|
return 'more'
|
||||||
|
})
|
||||||
|
|
||||||
|
const loadData = async () => {
|
||||||
|
const { data } = await request({
|
||||||
|
...getPagingParams.value,
|
||||||
|
...customParams,
|
||||||
|
})
|
||||||
|
console.log(data)
|
||||||
|
data.forEach((item: any) => {
|
||||||
|
item.createtime = formatTime(item.createtime)
|
||||||
|
item.image = getImageUrl(item.image)
|
||||||
|
})
|
||||||
|
// totalPage.value = data.count ? Math.ceil(data.count / pagingParams.value.limit!) : 0
|
||||||
|
list.value.push(...data)
|
||||||
|
}
|
||||||
|
|
||||||
|
const onReload = async (params?: AnyObject) => {
|
||||||
|
loading.value = true
|
||||||
|
pagingParams.value.page = 1
|
||||||
|
if (params) {
|
||||||
|
customParams = params
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
list.value = []
|
||||||
|
await loadData()
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const onMore = async () => {
|
||||||
|
if (finished.value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
pagingParams.value.page = pagingParams.value.page! + 1
|
||||||
|
moreLoading.value = true
|
||||||
|
try {
|
||||||
|
await loadData()
|
||||||
|
} finally {
|
||||||
|
moreLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (autoRequest) {
|
||||||
|
onMounted(onReload)
|
||||||
|
}
|
||||||
|
if (autoBind) {
|
||||||
|
onPullDownRefresh(async () => {
|
||||||
|
await onReload()
|
||||||
|
uni.stopPullDownRefresh()
|
||||||
|
})
|
||||||
|
onReachBottom(onMore)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
list,
|
||||||
|
loading,
|
||||||
|
moreLoading,
|
||||||
|
finished,
|
||||||
|
statusLoading,
|
||||||
|
totalPage,
|
||||||
|
|
||||||
|
onReload,
|
||||||
|
onMore,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { useListPageRequest }
|
||||||
@@ -51,9 +51,8 @@ const httpInterceptor = {
|
|||||||
}
|
}
|
||||||
// 3. 添加 token 请求头标识
|
// 3. 添加 token 请求头标识
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const { token } = userStore.userInfo as unknown as IUserInfo
|
if (userStore.token) {
|
||||||
if (token) {
|
options.header.token = userStore.token
|
||||||
options.header.Authorization = `Bearer ${token}`
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-13
@@ -4,14 +4,17 @@
|
|||||||
* 可以设置路由白名单,或者黑名单,看业务需要选哪一个
|
* 可以设置路由白名单,或者黑名单,看业务需要选哪一个
|
||||||
* 我这里应为大部分都可以随便进入,所以使用黑名单
|
* 我这里应为大部分都可以随便进入,所以使用黑名单
|
||||||
*/
|
*/
|
||||||
|
import { getUserInfoAPI } from '@/service'
|
||||||
import { useUserStore } from '@/store'
|
import { useUserStore } from '@/store'
|
||||||
import {
|
import {
|
||||||
getNotNeedLoginPages as _getNotNeedLoginPages,
|
getNotNeedLoginPages as _getNotNeedLoginPages,
|
||||||
notNeedLoginPages as _notNeedLoginPages,
|
notNeedLoginPages as _notNeedLoginPages,
|
||||||
getIsTabbar,
|
|
||||||
} from '@/utils'
|
} from '@/utils'
|
||||||
import type { Router } from 'vue-router'
|
import type { Router } from 'vue-router'
|
||||||
import { tabBar } from '@/pages.json'
|
|
||||||
|
import NProgress from 'nprogress'
|
||||||
|
import 'nprogress/nprogress.css'
|
||||||
|
NProgress.configure({ showSpinner: true, parent: '#app' })
|
||||||
|
|
||||||
export const loginRoute = '/pages/login/index'
|
export const loginRoute = '/pages/login/index'
|
||||||
|
|
||||||
@@ -26,14 +29,26 @@ const isDev = import.meta.env.DEV
|
|||||||
const navigateToInterceptor = {
|
const navigateToInterceptor = {
|
||||||
// 注意,这里的url是 '/' 开头的,如 '/pages/index/index',跟 'pages.json' 里面的 path 不同
|
// 注意,这里的url是 '/' 开头的,如 '/pages/index/index',跟 'pages.json' 里面的 path 不同
|
||||||
invoke({ url }: { url: string }) {
|
invoke({ url }: { url: string }) {
|
||||||
const isTabbar = getIsTabbar(url)
|
// console.log(url) // /pages/route-interceptor/index?name=feige&age=30
|
||||||
console.log(url)
|
const path = url.split('?')[0]
|
||||||
// const redirectRoute = `${loginRoute}?redirect=${encodeURIComponent(url)}`
|
let notNeedLoginPages: string[] = []
|
||||||
if (isTabbar) {
|
// 为了防止开发时出现BUG,这里每次都获取一下。生产环境可以移到函数外,性能更好
|
||||||
uni.switchTab({ url })
|
if (isDev) {
|
||||||
return false
|
notNeedLoginPages = getNotNeedLoginPages()
|
||||||
|
} else {
|
||||||
|
notNeedLoginPages = _notNeedLoginPages
|
||||||
}
|
}
|
||||||
|
const isNeedLogin = notNeedLoginPages.includes(path)
|
||||||
|
if (!isNeedLogin) {
|
||||||
return true
|
return true
|
||||||
|
}
|
||||||
|
const hasLogin = isLogged()
|
||||||
|
if (hasLogin) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
// const redirectRoute = `${loginRoute}?redirect=${encodeURIComponent(url)}`
|
||||||
|
uni.navigateTo({ url: loginRoute })
|
||||||
|
return false
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +73,6 @@ export const getNotNeedLoginPages = () => {
|
|||||||
export const checkLoginUrl = (url: string) => {
|
export const checkLoginUrl = (url: string) => {
|
||||||
const path = url.split('?')[0]
|
const path = url.split('?')[0]
|
||||||
const isNotNeedLogin = getNotNeedLoginPages().includes(path.replace(/^pages/, '/pages'))
|
const isNotNeedLogin = getNotNeedLoginPages().includes(path.replace(/^pages/, '/pages'))
|
||||||
console.log(path)
|
|
||||||
return isNotNeedLogin
|
return isNotNeedLogin
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,15 +93,21 @@ export const checkNotFound = (url: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const routerBeforeEachConfig = (router: Router) => {
|
export const routerBeforeEachConfig = (router: Router) => {
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach(async (to, from, next) => {
|
||||||
|
NProgress.start()
|
||||||
if (checkWithRedirectLogin(to.path)) {
|
if (checkWithRedirectLogin(to.path)) {
|
||||||
return next({
|
return next({
|
||||||
path: loginRoute,
|
path: loginRoute,
|
||||||
// query: {
|
|
||||||
// redirect: to.fullPath,
|
|
||||||
// },
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
const userStore = useUserStore()
|
||||||
|
if (!userStore.userInfo && userStore.isLogged) {
|
||||||
|
await userStore.loadUserInfo()
|
||||||
|
}
|
||||||
return next()
|
return next()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.afterEach(() => {
|
||||||
|
NProgress.done()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-9
@@ -1,27 +1,22 @@
|
|||||||
import { createSSRApp } from 'vue'
|
import { createSSRApp } from 'vue'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
import i18n from './locale/index'
|
import { requestInterceptor, prototypeInterceptor, routerBeforeEachConfig } from './interceptors'
|
||||||
import {
|
|
||||||
routeInterceptor,
|
|
||||||
routerBeforeEachConfig,
|
|
||||||
requestInterceptor,
|
|
||||||
prototypeInterceptor,
|
|
||||||
} from './interceptors'
|
|
||||||
import 'virtual:uno.css'
|
import 'virtual:uno.css'
|
||||||
import '@/style/index.scss'
|
import '@/style/index.scss'
|
||||||
|
|
||||||
export function createApp() {
|
export function createApp() {
|
||||||
const app = createSSRApp(App)
|
const app = createSSRApp(App)
|
||||||
|
|
||||||
app.use(store)
|
app.use(store)
|
||||||
app.use(i18n)
|
// app.use(routeInterceptor)
|
||||||
app.use(routeInterceptor)
|
|
||||||
app.use(requestInterceptor)
|
app.use(requestInterceptor)
|
||||||
app.use(prototypeInterceptor)
|
app.use(prototypeInterceptor)
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
routerBeforeEachConfig((app as any).router)
|
routerBeforeEachConfig((app as any).router)
|
||||||
}, 0)
|
}, 0)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
app,
|
app,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,26 @@
|
|||||||
}
|
}
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { getMyAssetAPI } from '@/service'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
const detailInfo = ref({
|
||||||
|
point: 1,
|
||||||
|
score: 1000,
|
||||||
|
suminvest: '10000',
|
||||||
|
})
|
||||||
|
const { list: assetList } = useListPageRequest((params) =>
|
||||||
|
getMyAssetAPI(params).then((res) => {
|
||||||
|
detailInfo.value = res.data
|
||||||
|
res.data.data = res.data.list
|
||||||
|
return res.data
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="min-h-screen py-15">
|
<view class="min-h-screen py-15">
|
||||||
<view class="mx-15 text-16 font-bold text-#333">我的资产</view>
|
<view class="mx-15 text-16 font-bold text-#333">我的资产</view>
|
||||||
@@ -14,38 +34,24 @@
|
|||||||
class="mt-15 mx-15 rounded-20 text-#476FFF main-content p-15 rounded-10 shadow-[0_5px_30px_rgba(149,195,255,0.4)]"
|
class="mt-15 mx-15 rounded-20 text-#476FFF main-content p-15 rounded-10 shadow-[0_5px_30px_rgba(149,195,255,0.4)]"
|
||||||
>
|
>
|
||||||
<view class="text-14 text-#6784C7">总投资金</view>
|
<view class="text-14 text-#6784C7">总投资金</view>
|
||||||
<view class="text-35 mt-10 font-bold">10000.00</view>
|
<view class="text-35 mt-10 font-bold">{{ detailInfo.suminvest }}</view>
|
||||||
<view class="flex mt-15">
|
|
||||||
<view class="flex-1">
|
|
||||||
<view class="text-12 text-#6784C7 font-light">我的分红</view>
|
|
||||||
<view class="text-16 font-bold mt-5">10000.00</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex-1">
|
|
||||||
<view class="text-12 text-#6784C7 font-light">数字人民币</view>
|
|
||||||
<view class="text-16 font-bold mt-5">10000.00</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex-1">
|
|
||||||
<view class="text-12 text-#6784C7 font-light">认购点</view>
|
|
||||||
<view class="text-16 font-bold mt-5">10000.00</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view class="text-16 mx-15 mb-15 font-bold text-#333 mt-30">资产记录</view>
|
<view class="text-16 mx-15 mb-15 font-bold text-#333 mt-30">资产记录</view>
|
||||||
<view
|
<view
|
||||||
class="flex px-15 py-8 border-b items-center border-#E5E5E5 border-b-solid"
|
class="flex px-15 py-8 border-b items-center border-#E5E5E5 border-b-solid"
|
||||||
v-for="item in 10"
|
v-for="item in assetList"
|
||||||
:key="item"
|
:key="item.id"
|
||||||
>
|
>
|
||||||
<image src="/static/images/page-sub/invite-icon.png" class="w-32 h-32 self-center" />
|
<image src="/static/images/page-sub/invite-icon.png" class="w-32 h-32 self-center" />
|
||||||
<view class="flex flex-col flex-1 ml-15">
|
<view class="flex flex-col flex-1 ml-15">
|
||||||
<view class="text-14 text-#333">邀请好友奖励</view>
|
<view class="text-14 text-#333">{{ item.memo }}</view>
|
||||||
<view class="text-12 mt-10 text-#999">奖励</view>
|
<!-- <view class="text-12 mt-10 text-#999">奖励</view> -->
|
||||||
<view class="text-12 mt-10 text-#999">2024-12-27 10:00:00</view>
|
<view class="text-12 mt-10 text-#999">{{ item.createtime }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex flex-col items-end">
|
<view class="flex flex-col items-end">
|
||||||
<view class="text-14 font-bold text-#FF5F5F">+20 股</view>
|
<view class="text-14 font-bold text-#FF5F5F">{{ item.money }}</view>
|
||||||
<view class="text-14 mt-10 py-4 px-10 bg-#71C78A1A text-#71C78A">已到账</view>
|
<!-- <view class="text-14 mt-10 py-4 px-10 bg-#71C78A1A text-#71C78A">已到账</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -21,13 +21,20 @@
|
|||||||
<view class="mt-15">
|
<view class="mt-15">
|
||||||
<view class="flex items-center justify-between">
|
<view class="flex items-center justify-between">
|
||||||
<view class="text-14 text-#333">我的股数</view>
|
<view class="text-14 text-#333">我的股数</view>
|
||||||
<view class="text-12 text-#999">可转换股数:1202.45</view>
|
<view class="text-12 text-#999">可转换股数:{{ userStore.userInfo.score }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="flex items-center text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10"
|
class="flex items-center text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10"
|
||||||
>
|
>
|
||||||
<input type="number" placeholder="请输入股数" class="text-14 text-#333 flex-1" />
|
<input
|
||||||
<view class="text-12 text-gradient">全部</view>
|
v-model="convertNum"
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入股数"
|
||||||
|
class="text-14 text-#333 flex-1"
|
||||||
|
/>
|
||||||
|
<view class="text-12 text-gradient" @click="convertNum = userStore.userInfo.score">
|
||||||
|
全部
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="text-12 text-#889BC6 mt-15">马尔代夫股权每股价值500元</view>
|
<view class="text-12 text-#889BC6 mt-15">马尔代夫股权每股价值500元</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -49,30 +56,29 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@/components/NavBar.vue'
|
||||||
|
import { convertScoreAPI } from '@/service'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
import { mergeStep, showModal } from '@/utils'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
const convertNum = ref('')
|
||||||
|
|
||||||
const onWithdrawalDetail = () => {
|
const onWithdrawalDetail = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages-sub/withdrawal-detail/index',
|
url: '/pages-sub/asset/index',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSelectPayType = () => {
|
const onSubmit = mergeStep(async () => {
|
||||||
uni.$once('withdrawal-type', (data: any) => {
|
await showModal('确认转换?')
|
||||||
console.log(data)
|
await convertScoreAPI({
|
||||||
|
score: convertNum.value,
|
||||||
})
|
})
|
||||||
uni.navigateTo({
|
await showModal('转换成功')
|
||||||
url: '/pages-sub/withdrawal-type/index?type=select',
|
userStore.loadUserInfo()
|
||||||
|
onWithdrawalDetail()
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
const onSubmit = () => {
|
|
||||||
uni.showModal({
|
|
||||||
title: '提示',
|
|
||||||
content: '转换成功',
|
|
||||||
showCancel: false,
|
|
||||||
})
|
|
||||||
uni.navigateBack()
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|||||||
@@ -8,16 +8,27 @@
|
|||||||
</route>
|
</route>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="pt-15 pb-50 min-h-screen">
|
<view class="pt-15 pb-50 min-h-screen" v-if="introductionDetail">
|
||||||
<view class="text-center text-16 font-bold">国际钱包</view>
|
<view class="text-center text-16 font-bold">{{ introductionDetail.name }}</view>
|
||||||
<image
|
<image
|
||||||
class="w-345 h-170 rounded-10 mt-15 mx-auto block"
|
class="w-345 h-170 rounded-10 mt-15 mx-auto block"
|
||||||
src="@/static/images/page-sub/introduction.png"
|
:src="introductionDetail.image"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
<view class="text-gray-500 mx-16 text-14 mt-15">
|
<view class="text-gray-500 mx-16 text-14 mt-15 break-all">
|
||||||
国际钱包(集团)有限公司由具有160年历史的上海纺织集团和具有70年外贸历史的原东方国际集团联合重组而成,是一家拥有先进制造业与现代服务业,以时尚产业、健康产业和供应链服务为核心主业,以科技实业、产业地产、金融投资为支撑,构建“一体两翼三支撑”总体格局的大型综合性企业集团。名列中国企业500强第275位,上海企业100强第25位。
|
{{ introductionDetail.content }}
|
||||||
集团拥有总资产627亿元、员工5.8万人(海外员工占70%),2023年快报营业收入780亿元,进出口56.64亿美元(出口41.34亿美元、进口15.3亿美元)。集团在海外拥有96家业务机构,分布在五大洲27个国家和地区。所属企业389家,上市公司4家(东方创业、申达股份、龙头股份、香港联泰控股)。
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { getIntroductionAPI } from '@/service'
|
||||||
|
|
||||||
|
const { list: introductionList } = useListPageRequest((params) =>
|
||||||
|
getIntroductionAPI({ type: 3, ...params }),
|
||||||
|
)
|
||||||
|
|
||||||
|
const introductionDetail = computed(() => {
|
||||||
|
return introductionList.value[0]
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -6,24 +6,40 @@
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { getInvestmentRecordAPI } from '@/service'
|
||||||
|
|
||||||
|
const { list: investmentRecordList } = useListPageRequest(getInvestmentRecordAPI)
|
||||||
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<view class="min-h-screen pb-100">
|
<view class="min-h-screen pb-100">
|
||||||
|
<template v-if="investmentRecordList.length">
|
||||||
<view
|
<view
|
||||||
class="flex px-15 py-8 border-b border-#E5E5E5 border-b-solid"
|
class="flex px-15 py-8 border-b border-#E5E5E5 border-b-solid"
|
||||||
v-for="item in 10"
|
v-for="item in investmentRecordList"
|
||||||
:key="item"
|
:key="item.id"
|
||||||
>
|
>
|
||||||
<image src="/static/images/page-sub/money-icon.png" class="w-32 h-32 self-center" />
|
<image src="/static/images/page-sub/money-icon.png" class="w-32 h-32 self-center" />
|
||||||
<view class="flex flex-col flex-1 justify-between ml-15">
|
<view class="flex flex-col flex-1 justify-between ml-15">
|
||||||
<view class="text-14 text-#333">5G通信</view>
|
<view class="text-14 text-#333">{{ item.name }}</view>
|
||||||
<view class="text-12 text-#999">投资</view>
|
<view class="text-12 text-#999">投资</view>
|
||||||
<view class="text-12 text-#999">2024-12-27 10:00:00</view>
|
<view class="text-12 text-#999">{{ item.createtime }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex flex-col items-end">
|
<view class="flex flex-col items-end">
|
||||||
<view class="text-16 text-#FF5F5F">+1000 RMB</view>
|
<view class="text-16 text-#FF5F5F">{{ item.money }}</view>
|
||||||
<view class="text-14 mt-18 py-4 px-10 bg-#71C78A1A text-#71C78A">投资成功</view>
|
<view
|
||||||
|
class="text-14 mt-18 py-4 px-10 bg-#71C78A1A text-#71C78A"
|
||||||
|
v-if="Number(item.status) === 1"
|
||||||
|
>
|
||||||
|
投资成功
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<wd-status-tip image="content" tip="暂无内容" />
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<route lang="json5" type="page">
|
||||||
|
{
|
||||||
|
style: {
|
||||||
|
navigationBarTitleText: '新闻详情',
|
||||||
|
navigationBarBackgroundColor: '#fff',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</route>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { getIntroductionDetailAPI } from '@/service'
|
||||||
|
import { getImageUrl } from '@/utils'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
|
const newsDetail = ref<any>({})
|
||||||
|
onLoad(async (options) => {
|
||||||
|
const { data } = await getIntroductionDetailAPI({ id: options.id })
|
||||||
|
newsDetail.value = data
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<view class="min-h-screen pb-100 pt-30 px-15">
|
||||||
|
<view class="text-20 text-black font-bold">{{ newsDetail.name }}</view>
|
||||||
|
<view class="flex justify-between py-10">
|
||||||
|
<view class="text-14 text-gray-500">{{ newsDetail.source }}</view>
|
||||||
|
<view class="text-14 text-gray-500">
|
||||||
|
{{ dayjs(newsDetail.createtime * 1000).format('YYYY-MM-DD HH:mm') }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<image class="w-full mt-15" mode="widthFix" :src="getImageUrl(newsDetail.image)" />
|
||||||
|
<view class="text-14 text-gray-600 mt-15">{{ newsDetail.content }}</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<route lang="json5">
|
<route lang="json5" type="page">
|
||||||
{
|
{
|
||||||
style: {
|
style: {
|
||||||
navigationBarTitleText: '实名认证',
|
navigationBarTitleText: '实名认证',
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="withdrawal-type-edit-page pb-100 min-h-screen">
|
<view class="withdrawal-type-edit-page pb-100 min-h-screen">
|
||||||
|
<template v-if="!realnameInfo">
|
||||||
<view class="p-15 m-15 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10">
|
<view class="p-15 m-15 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10">
|
||||||
<view class="flex items-center py-15 text-14">
|
<view class="flex items-center py-15 text-14">
|
||||||
<image src="@/static/images/page-sub/realname/realname-type.png" class="w-20 h-20" />
|
<image src="@/static/images/page-sub/realname/realname-type.png" class="w-20 h-20" />
|
||||||
@@ -23,7 +24,7 @@
|
|||||||
placeholder-class=" text-#889BC6 text-right"
|
placeholder-class=" text-#889BC6 text-right"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入真实姓名"
|
placeholder="请输入真实姓名"
|
||||||
v-model="form.name"
|
v-model="form.realname"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center py-15 text-14">
|
<view class="flex items-center py-15 text-14">
|
||||||
@@ -34,16 +35,30 @@
|
|||||||
placeholder-class=" text-#889BC6 text-right"
|
placeholder-class=" text-#889BC6 text-right"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入身份证号"
|
placeholder="请输入身份证号"
|
||||||
v-model="form.idCard"
|
v-model="form.cardnum"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="fixed bottom-0 left-0 right-0 pb-safe">
|
<view class="fixed bottom-0 left-0 right-0 pb-safe">
|
||||||
<button class="btn-gradient text-white rounded-full m-15 text-16" @click="onAddType">
|
<button class="btn-gradient text-white rounded-full m-15 text-16" @click="onSubmit">
|
||||||
提交
|
提交
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex flex-col items-center" v-if="false">
|
</template>
|
||||||
|
|
||||||
|
<view v-else class="flex flex-col items-center">
|
||||||
|
<template v-if="Number(realnameInfo.status) === 1">
|
||||||
|
<image
|
||||||
|
src="@/static/images/page-sub/realname/realname-checking.png"
|
||||||
|
class="w-150 mx-auto h-150 block"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<view class="text-center mt-15 text-14 text-#999">您的实名认证正在审核中,请耐心等待</view>
|
||||||
|
<button class="btn-gradient px-30 text-white rounded-full m-15 text-16" @click="onBack">
|
||||||
|
返回
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="Number(realnameInfo.status) === 2">
|
||||||
<image
|
<image
|
||||||
src="@/static/images/page-sub/realname/realname-success.png"
|
src="@/static/images/page-sub/realname/realname-success.png"
|
||||||
class="w-150 h-150 block"
|
class="w-150 h-150 block"
|
||||||
@@ -53,36 +68,58 @@
|
|||||||
<button class="btn-gradient px-30 text-white rounded-full m-15 text-16" @click="onBack">
|
<button class="btn-gradient px-30 text-white rounded-full m-15 text-16" @click="onBack">
|
||||||
返回
|
返回
|
||||||
</button>
|
</button>
|
||||||
<image
|
</template>
|
||||||
src="@/static/images/page-sub/realname/realname-fail.png"
|
<template v-else>
|
||||||
class="w-150 h-150 block"
|
|
||||||
mode="aspectFit"
|
|
||||||
/>
|
|
||||||
<view class="text-center mt-15 text-14 text-#999">您的实名认证正在审核中,请耐心等待</view>
|
|
||||||
<button class="btn-gradient px-30 text-white rounded-full m-15 text-16" @click="onBack">
|
|
||||||
返回
|
|
||||||
</button>
|
|
||||||
<image
|
<image
|
||||||
src="@/static/images/page-sub/realname/realname-checking.png"
|
src="@/static/images/page-sub/realname/realname-checking.png"
|
||||||
class="w-150 h-150 block"
|
class="w-150 h-150 block"
|
||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
/>
|
/>
|
||||||
<view class="text-center mt-15 text-14 text-#999">您的实名认证审核未通过,请重新提交</view>
|
<view class="text-center mt-15 text-14 text-#999">您的实名认证审核未通过,请重新提交</view>
|
||||||
<button class="btn-gradient px-30 text-white rounded-full m-15 text-16">重新提交</button>
|
<button
|
||||||
|
@click="() => (realnameInfo = null)"
|
||||||
|
class="btn-gradient px-30 text-white rounded-full m-15 text-16"
|
||||||
|
>
|
||||||
|
重新提交
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { getRealNameAuthAPI, realNameAuthAPI } from '@/service'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
import { showModal } from '@/utils'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const form = ref({
|
const form = ref({
|
||||||
type: '',
|
realname: '',
|
||||||
|
cardnum: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
const onBack = () => {
|
const onBack = () => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onSubmit = async () => {
|
||||||
|
if (!form.value.realname || !form.value.cardnum) {
|
||||||
|
await showModal('请填写完整信息')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
await realNameAuthAPI(form.value)
|
||||||
|
await showModal('提交成功,请耐心等待审核!')
|
||||||
|
realnameInfo.value = await getRealNameAuthAPI().then((res) => {
|
||||||
|
return res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const realnameInfo = ref(null)
|
||||||
|
onLoad(async () => {
|
||||||
|
realnameInfo.value = await getRealNameAuthAPI().then((res) => {
|
||||||
|
return res.data
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.withdrawal-type-edit-page {
|
.withdrawal-type-edit-page {
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
mode="aspectFit"
|
mode="aspectFit"
|
||||||
/>
|
/>
|
||||||
<view class="flex flex-col">
|
<view class="flex flex-col">
|
||||||
<view class="text-14 text-#6784C7">看看人数</view>
|
<view class="text-14 text-#6784C7">邀请人数</view>
|
||||||
<view class="text-35 font-bold text-#476FFF mt-10 leading-35">1234</view>
|
<view class="text-35 font-bold text-#476FFF mt-10 leading-35">{{ totalCount }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<image
|
<image
|
||||||
@@ -45,25 +45,24 @@
|
|||||||
<view class="text-14 mt-10 text-center">{{ item.title }}</view>
|
<view class="text-14 mt-10 text-center">{{ item.title }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-25 bg-white rounded-10 w-345 mx-auto">
|
<view class="mt-25 bg-white rounded-10 w-345 mx-auto" v-if="list.length">
|
||||||
<view class="flex p-15 items-center" v-for="item in 10" :key="item">
|
<view class="flex p-15 items-center" v-for="item in list" :key="item">
|
||||||
<Avatar class="w-40 h-40" />
|
<Avatar class="w-40 h-40" :src="item.avatar" />
|
||||||
<view class="flex-1 flex flex-col ml-15">
|
<view class="flex-1 flex flex-col ml-15">
|
||||||
<view class="text-14 text-#333">用户名</view>
|
<view class="text-14 text-#333">{{ item.nickname }}</view>
|
||||||
<view class="text-12 mt-10 text-#999">1234567890</view>
|
<view class="text-12 mt-10 text-#999">{{ item.username }}</view>
|
||||||
<view class="text-12 mt-10 text-#999">2024-12-27 12:00:00</view>
|
<view class="text-12 mt-10 text-#999">{{ item.jointime }}</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="bg-#71C78A80 text-white text-12 rounded-10 px-10 py-5">邀请成功</view> -->
|
<!-- <view class="bg-#71C78A80 text-white text-12 rounded-10 px-10 py-5">邀请成功</view> -->
|
||||||
<view class="text-14 font-bold text-#FF5F5F">+20 股</view>
|
<view class="text-14 font-bold text-#FF5F5F">+{{ item.score }} 股</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="mt-25 bg-white rounded-10 w-345 mx-auto p-15" v-else>
|
||||||
|
<wd-status-tip image="content" tip="暂无内容" />
|
||||||
|
</view>
|
||||||
<wd-action-sheet v-model="showRule" title="邀请奖励规则">
|
<wd-action-sheet v-model="showRule" title="邀请奖励规则">
|
||||||
<view class="text-16 text-#333 p-15">
|
<view class="text-16 text-#333 p-15">
|
||||||
<view class="mb-10">1.每邀请一人可以获得1万投资金,2000数字人民币 1点认购点</view>
|
<view class="mb-10 text-center">每邀请一人可以获得20股马尔代夫股权</view>
|
||||||
<view class="mb-10">2.邀请满5人可以额外获得5万投资金。1万数字人民币 5点认购点</view>
|
|
||||||
<view class="mb-10">3.邀请满10人可以额外获得10万投资金。2万数字人民币 10点认购点</view>
|
|
||||||
<view class="mb-10">4.邀请满20人可以额外获得20万投资金。5万数字人民币 20点认购点</view>
|
|
||||||
<view class="mb-10">5.邀请满50人可以额外获得50万投资金。10万数字人民币 50点认购点</view>
|
|
||||||
</view>
|
</view>
|
||||||
</wd-action-sheet>
|
</wd-action-sheet>
|
||||||
</view>
|
</view>
|
||||||
@@ -72,6 +71,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Avatar from '@/components/Avatar.vue'
|
import Avatar from '@/components/Avatar.vue'
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@/components/NavBar.vue'
|
||||||
|
import { getMyTeamAPI, getMyTeamApi } from '@/service'
|
||||||
import Level1 from '@/static/images/page-sub/team/level-1.png'
|
import Level1 from '@/static/images/page-sub/team/level-1.png'
|
||||||
import Level2 from '@/static/images/page-sub/team/level-2.png'
|
import Level2 from '@/static/images/page-sub/team/level-2.png'
|
||||||
import Level3 from '@/static/images/page-sub/team/level-3.png'
|
import Level3 from '@/static/images/page-sub/team/level-3.png'
|
||||||
@@ -87,16 +87,37 @@ const levelList = ref([
|
|||||||
{
|
{
|
||||||
title: '一级用户',
|
title: '一级用户',
|
||||||
icon: Level1,
|
icon: Level1,
|
||||||
|
level: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '二级用户',
|
title: '二级用户',
|
||||||
icon: Level2,
|
icon: Level2,
|
||||||
|
level: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '三级用户',
|
title: '三级用户',
|
||||||
icon: Level3,
|
icon: Level3,
|
||||||
|
level: 3,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const totalCount = ref(0)
|
||||||
|
const { list, onReload } = useListPageRequest((...rest) => {
|
||||||
|
return getMyTeamAPI(...rest).then((res) => {
|
||||||
|
totalCount.value = (res.data as any).num
|
||||||
|
res.data.data = res.data.list
|
||||||
|
return res.data
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => unref(levelList)[currentLevelIndex.value].level,
|
||||||
|
(level) => {
|
||||||
|
onReload({
|
||||||
|
level,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -10,20 +10,58 @@
|
|||||||
<view class="min-h-screen pb-100">
|
<view class="min-h-screen pb-100">
|
||||||
<view
|
<view
|
||||||
class="flex px-15 py-8 border-b border-#E5E5E5 border-b-solid"
|
class="flex px-15 py-8 border-b border-#E5E5E5 border-b-solid"
|
||||||
v-for="item in 10"
|
v-for="item in list"
|
||||||
:key="item"
|
:key="item.id"
|
||||||
>
|
>
|
||||||
<image src="/static/images/invest/unionpay-icon.png" class="w-32 h-32 self-center" />
|
<image
|
||||||
|
src="/static/images/invest/alipay-icon.png"
|
||||||
|
class="w-32 h-32 self-center"
|
||||||
|
v-if="item.typedata === '支付宝'"
|
||||||
|
/>
|
||||||
|
<image
|
||||||
|
src="/static/images/invest/wechat-icon.png"
|
||||||
|
class="w-32 h-32 self-center"
|
||||||
|
v-if="item.typedata === '微信'"
|
||||||
|
/>
|
||||||
|
<image
|
||||||
|
src="/static/images/invest/unionpay-icon.png"
|
||||||
|
class="w-32 h-32 self-center"
|
||||||
|
v-if="item.typedata === '银联'"
|
||||||
|
/>
|
||||||
|
|
||||||
<view class="flex flex-col flex-1 justify-between ml-15">
|
<view class="flex flex-col flex-1 justify-between ml-15">
|
||||||
<view class="text-14 text-#333">银行卡</view>
|
<view class="text-14 text-#333">{{ item.typedata }}</view>
|
||||||
<view class="text-12 text-#999">提现</view>
|
<view class="text-12 text-#999">提现</view>
|
||||||
<view class="text-12 text-#999">2024-12-27 10:00:00</view>
|
<view class="text-12 text-#999">{{ item.createtime }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex flex-col items-end">
|
<view class="flex flex-col items-end">
|
||||||
<view class="text-16 text-#FF5F5F">-1000 RMB</view>
|
<view class="text-16 text-#FF5F5F">{{ item.money }}</view>
|
||||||
<view class="text-14 mt-18 py-4 px-10 bg-#71C78A1A text-#71C78A">提现成功</view>
|
<view
|
||||||
|
class="text-14 mt-18 py-4 px-10 bg-#99999990 text-#fff"
|
||||||
|
v-if="Number(item.status) === 1"
|
||||||
|
>
|
||||||
|
审核中
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="text-14 mt-18 py-4 px-10 bg-#71C78A1A text-#71C78A"
|
||||||
|
v-if="Number(item.status) === 2"
|
||||||
|
>
|
||||||
|
提现成功
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="text-14 mt-18 py-4 px-10 bg-#FF5F5F90 text-#fff"
|
||||||
|
v-if="Number(item.status) === 3"
|
||||||
|
>
|
||||||
|
提现失败
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { getWithdrawalRecordAPI } from '@/service'
|
||||||
|
|
||||||
|
const { list } = useListPageRequest(getWithdrawalRecordAPI)
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<route lang="json5">
|
<route lang="json5" type="page">
|
||||||
{
|
{
|
||||||
style: {
|
style: {
|
||||||
navigationBarTitleText: '编辑收款方式',
|
navigationBarTitleText: '编辑收款方式',
|
||||||
@@ -18,42 +18,42 @@
|
|||||||
custom-value-class="text-14 text-#889BC6 text-right"
|
custom-value-class="text-14 text-#889BC6 text-right"
|
||||||
class="flex-1"
|
class="flex-1"
|
||||||
placeholder="请选择收款类型"
|
placeholder="请选择收款类型"
|
||||||
v-model="form.type"
|
v-model="form.typedata"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
@change="handleChange"
|
|
||||||
></wd-select-picker>
|
></wd-select-picker>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center py-15 text-14">
|
<view class="flex items-center py-15 text-14" v-if="form.typedata === 3">
|
||||||
<view>开户行</view>
|
<view>开户行</view>
|
||||||
<input
|
<input
|
||||||
class="flex-1 text-right text-14"
|
class="flex-1 text-right text-14"
|
||||||
placeholder-class=" text-#889BC6 text-right"
|
placeholder-class=" text-#889BC6 text-right"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入开户行"
|
placeholder="请输入开户行"
|
||||||
v-model="form.bank"
|
v-model="form.kaihuhang"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center py-15 text-14">
|
<view class="flex items-center py-15 text-14">
|
||||||
<view>持卡人姓名</view>
|
<view>{{ typeName }}账号</view>
|
||||||
<input
|
<input
|
||||||
class="flex-1 text-right text-14"
|
class="flex-1 text-right text-14"
|
||||||
placeholder-class=" text-#889BC6 text-right"
|
placeholder-class=" text-#889BC6 text-right"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入持卡人姓名"
|
:placeholder="`请输入${typeName}账号`"
|
||||||
|
v-model="form.banknum"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="flex items-center py-15 text-14">
|
||||||
|
<view>{{ form.typedata === 3 ? '持卡人' : '' }}姓名</view>
|
||||||
|
<input
|
||||||
|
class="flex-1 text-right text-14"
|
||||||
|
placeholder-class=" text-#889BC6 text-right"
|
||||||
|
type="text"
|
||||||
|
:placeholder="`请输入${form.typedata === 3 ? '持卡人' : ''}姓名`"
|
||||||
v-model="form.name"
|
v-model="form.name"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center py-15 text-14">
|
|
||||||
<view>银行账号</view>
|
<!-- <view class="flex items-center py-15 text-14">
|
||||||
<input
|
|
||||||
class="flex-1 text-right text-14"
|
|
||||||
placeholder-class=" text-#889BC6 text-right"
|
|
||||||
type="text"
|
|
||||||
placeholder="请输入银行账号"
|
|
||||||
v-model="form.account"
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
<view class="flex items-center py-15 text-14">
|
|
||||||
<view>备注</view>
|
<view>备注</view>
|
||||||
<input
|
<input
|
||||||
class="flex-1 text-right text-14"
|
class="flex-1 text-right text-14"
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
placeholder="请输入备注"
|
placeholder="请输入备注"
|
||||||
v-model="form.remark"
|
v-model="form.remark"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="fixed bottom-0 left-0 right-0 pb-safe">
|
<view class="fixed bottom-0 left-0 right-0 pb-safe">
|
||||||
<button class="btn-gradient text-white rounded-full m-15 text-16" @click="onAddType">
|
<button class="btn-gradient text-white rounded-full m-15 text-16" @click="onAddType">
|
||||||
@@ -73,29 +73,61 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { addBankCardAPI } from '@/service'
|
||||||
|
import { mergeStep, showModal } from '@/utils'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const form = ref({
|
const form = ref({
|
||||||
type: '',
|
typedata: 1,
|
||||||
|
kaihuhang: '',
|
||||||
|
name: '',
|
||||||
|
banknum: '',
|
||||||
})
|
})
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
label: '支付宝',
|
label: '支付宝',
|
||||||
value: '1',
|
value: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '微信',
|
label: '微信',
|
||||||
value: '2',
|
value: 2,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '银行卡',
|
label: '银行卡',
|
||||||
value: '3',
|
value: 3,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const handleChange = (value: string) => {
|
const typeName = computed(() => {
|
||||||
console.log(value)
|
return ['支付宝', '微信', '银行卡'][Number(form.value.typedata) - 1]
|
||||||
|
})
|
||||||
|
|
||||||
|
const onAddType = mergeStep(async () => {
|
||||||
|
if (form.value.typedata === 3) {
|
||||||
|
if (!form.value.kaihuhang) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: '请输入开户行',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!form.value.banknum) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: '请输入账号',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!form.value.name) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: '请输入姓名',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
await addBankCardAPI(form.value)
|
||||||
|
await showModal('添加成功')
|
||||||
|
uni.navigateBack()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.withdrawal-type-edit-page {
|
.withdrawal-type-edit-page {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<route lang="json5">
|
<route lang="json5" type="page">
|
||||||
{
|
{
|
||||||
style: {
|
style: {
|
||||||
navigationBarTitleText: '收款方式',
|
navigationBarTitleText: '收款方式',
|
||||||
@@ -9,19 +9,48 @@
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="withdrawal-type-page min-h-screen pb-100">
|
<view class="withdrawal-type-page min-h-screen pb-100">
|
||||||
|
<template v-if="list.length > 0">
|
||||||
|
<wd-swipe-action v-for="item in list" :key="item.id">
|
||||||
<view
|
<view
|
||||||
class="flex items-center justify-between py-15 text-14 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10 m-15 p-15"
|
class="flex items-center justify-between py-15 text-14 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10 m-15 p-15"
|
||||||
v-for="item in 10"
|
|
||||||
:key="item"
|
|
||||||
@click="onSelectType(item)"
|
@click="onSelectType(item)"
|
||||||
>
|
>
|
||||||
<image class="w-45 h-45" src="@/static/images/invest/alipay-icon.png" mode="aspectFit" />
|
<image
|
||||||
|
v-if="Number(item.typedata) === 3"
|
||||||
|
class="w-45 h-45"
|
||||||
|
src="@/static/images/invest/unionpay-icon.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<image
|
||||||
|
v-if="Number(item.typedata) === 1"
|
||||||
|
class="w-45 h-45"
|
||||||
|
src="@/static/images/invest/alipay-icon.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
<image
|
||||||
|
v-if="Number(item.typedata) === 2"
|
||||||
|
class="w-45 h-45"
|
||||||
|
src="@/static/images/invest/wechat-icon.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
<view class="flex-1 ml-15">
|
<view class="flex-1 ml-15">
|
||||||
<view class="text-16 font-bold">支付宝</view>
|
<view class="text-16 font-bold">
|
||||||
<view class="mt-10 text-14 text-#889BC6">132****113</view>
|
{{ ['支付宝', '微信', '银行卡'][Number(item.typedata) - 1] }}
|
||||||
</view>
|
</view>
|
||||||
<wd-icon name="arrow-right" size="14px"></wd-icon>
|
<view class="mt-10 text-14 text-#889BC6">{{ item.banknum }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<wd-icon v-if="isSelect" name="arrow-right" size="14px"></wd-icon>
|
||||||
|
</view>
|
||||||
|
<template #right>
|
||||||
|
<view class="h-full flex items-center text-14 text-#889BC6">
|
||||||
|
<wd-button plain @click="onDelete(item)">删除</wd-button>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</wd-swipe-action>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<wd-status-tip image="content" tip="暂无内容" />
|
||||||
|
</template>
|
||||||
<view class="fixed bottom-0 left-0 right-0 pb-safe">
|
<view class="fixed bottom-0 left-0 right-0 pb-safe">
|
||||||
<button class="text-16 btn-gradient text-white rounded-full m-15" @click="onAddType">
|
<button class="text-16 btn-gradient text-white rounded-full m-15" @click="onAddType">
|
||||||
添加收款方式
|
添加收款方式
|
||||||
@@ -31,23 +60,25 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { deleteBankCardAPI, getBankCardAPI } from '@/service'
|
||||||
|
import { showModal } from '@/utils'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
|
||||||
let isSelect = false
|
const isSelect = ref(false)
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
if (options.type === 'select') {
|
if (options.type === 'select') {
|
||||||
isSelect = true
|
isSelect.value = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const onSelectType = (item) => {
|
const onSelectType = (item) => {
|
||||||
if (isSelect) {
|
if (isSelect.value) {
|
||||||
uni.$emit('withdrawal-type', item)
|
uni.$emit('withdrawal-type', item)
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
} else {
|
} else {
|
||||||
uni.navigateTo({
|
// uni.navigateTo({
|
||||||
url: '/pages-sub/withdrawal-type/edit?id=1',
|
// url: '/pages-sub/withdrawal-type/edit?id=1',
|
||||||
})
|
// })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,4 +87,25 @@ const onAddType = () => {
|
|||||||
url: '/pages-sub/withdrawal-type/edit',
|
url: '/pages-sub/withdrawal-type/edit',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onDelete = async (item) => {
|
||||||
|
await showModal('确认删除?')
|
||||||
|
await deleteBankCardAPI({
|
||||||
|
id: item.id,
|
||||||
|
})
|
||||||
|
await showModal('删除成功')
|
||||||
|
loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
const loadData = async () => {
|
||||||
|
list.value = (await getBankCardAPI({
|
||||||
|
limit: 1000,
|
||||||
|
page: 1,
|
||||||
|
}).then((res) => res.data)) as any
|
||||||
|
}
|
||||||
|
|
||||||
|
const list = ref([])
|
||||||
|
onShow(async () => {
|
||||||
|
loadData()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -23,10 +23,17 @@
|
|||||||
<view
|
<view
|
||||||
class="flex items-center text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10"
|
class="flex items-center text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10"
|
||||||
>
|
>
|
||||||
<input type="number" placeholder="请输入提现金额" class="text-14 text-#333 flex-1" />
|
<input
|
||||||
<view class="text-12 text-#04A9F9">全部</view>
|
v-model="form.money"
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入提现金额"
|
||||||
|
class="text-14 text-#333 flex-1"
|
||||||
|
/>
|
||||||
|
<view class="text-12 text-#04A9F9" @click="form.money = userStore.userInfo.money">
|
||||||
|
全部
|
||||||
</view>
|
</view>
|
||||||
<view class="text-12 text-#889BC6 mt-15">当前余额:10012.12</view>
|
</view>
|
||||||
|
<view class="text-12 text-#889BC6 mt-15">当前余额:{{ userStore.userInfo.money }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mt-50">
|
<view class="mt-50">
|
||||||
@@ -35,7 +42,9 @@
|
|||||||
class="flex items-center text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10"
|
class="flex items-center text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10"
|
||||||
@click="onSelectPayType"
|
@click="onSelectPayType"
|
||||||
>
|
>
|
||||||
<view class="flex-1">请选择收款方式</view>
|
<view class="flex-1">
|
||||||
|
{{ typeName ? `${typeName}:${currentBank?.card_account}` : '请选择收款方式' }}
|
||||||
|
</view>
|
||||||
<wd-icon name="arrow-right" size="16px"></wd-icon>
|
<wd-icon name="arrow-right" size="16px"></wd-icon>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -43,7 +52,12 @@
|
|||||||
<view class="mt-50">
|
<view class="mt-50">
|
||||||
<view class="text-14 text-#333">交易密码</view>
|
<view class="text-14 text-#333">交易密码</view>
|
||||||
<view class="text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10">
|
<view class="text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10">
|
||||||
<input type="password" placeholder="请输入交易密码" class="text-14 text-#333" />
|
<input
|
||||||
|
v-model="form.tpassword"
|
||||||
|
type="password"
|
||||||
|
placeholder="请输入交易密码"
|
||||||
|
class="text-14 text-#333"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -65,6 +79,17 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@/components/NavBar.vue'
|
||||||
|
import { submitWithdrawalAPI } from '@/service'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
import { showModal } from '@/utils'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
const form = ref({
|
||||||
|
money: '',
|
||||||
|
bankid: '6',
|
||||||
|
tpassword: '',
|
||||||
|
})
|
||||||
|
|
||||||
const onWithdrawalDetail = () => {
|
const onWithdrawalDetail = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
@@ -72,20 +97,45 @@ const onWithdrawalDetail = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const typeName = computed(() => {
|
||||||
|
return ['支付宝', '微信', '银行卡'][Number(unref(currentBank)?.card_type) - 1]
|
||||||
|
})
|
||||||
|
|
||||||
|
const currentBank = ref<any>(null)
|
||||||
const onSelectPayType = () => {
|
const onSelectPayType = () => {
|
||||||
uni.$once('withdrawal-type', (data: any) => {
|
uni.$once('withdrawal-type', (data: any) => {
|
||||||
console.log(data)
|
form.value.bankid = data.id
|
||||||
|
currentBank.value = data
|
||||||
})
|
})
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages-sub/withdrawal-type/index?type=select',
|
url: '/pages-sub/withdrawal-type/index?type=select',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSubmit = () => {
|
const onSubmit = async () => {
|
||||||
uni.redirectTo({
|
if (!form.value.money) {
|
||||||
url: '/pages-sub/invest-result/index',
|
return uni.showToast({
|
||||||
|
title: '请输入提现金额',
|
||||||
|
icon: 'none',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (!form.value.bankid) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: '请选择收款方式',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (!form.value.tpassword) {
|
||||||
|
return uni.showToast({
|
||||||
|
title: '请输入交易密码',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
await showModal('确认提现?')
|
||||||
|
await submitWithdrawalAPI(form.value)
|
||||||
|
await showModal('提交成功')
|
||||||
|
onWithdrawalDetail()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|||||||
+15
-7
@@ -29,17 +29,17 @@
|
|||||||
"pagePath": "pages/index/index",
|
"pagePath": "pages/index/index",
|
||||||
"text": "首页"
|
"text": "首页"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"iconPath": "static/tabbar/invest.png",
|
|
||||||
"selectedIconPath": "static/tabbar/investHL.png",
|
|
||||||
"pagePath": "pages/invest/index",
|
|
||||||
"text": "投资"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"iconPath": "static/tabbar/house.png",
|
"iconPath": "static/tabbar/house.png",
|
||||||
"selectedIconPath": "static/tabbar/houseHL.png",
|
"selectedIconPath": "static/tabbar/houseHL.png",
|
||||||
"pagePath": "pages/invite/index",
|
"pagePath": "pages/invite/index",
|
||||||
"text": "房屋"
|
"text": "邀请好友"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"iconPath": "static/tabbar/invest.png",
|
||||||
|
"selectedIconPath": "static/tabbar/investHL.png",
|
||||||
|
"pagePath": "pages/invest/index",
|
||||||
|
"text": "理财"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"iconPath": "static/tabbar/personal.png",
|
"iconPath": "static/tabbar/personal.png",
|
||||||
@@ -188,6 +188,14 @@
|
|||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "news-detail/index",
|
||||||
|
"type": "page",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "新闻详情",
|
||||||
|
"navigationBarBackgroundColor": "#fff"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "official-community/index",
|
"path": "official-community/index",
|
||||||
"type": "page",
|
"type": "page",
|
||||||
|
|||||||
+49
-13
@@ -20,11 +20,11 @@
|
|||||||
<image class="w-30 h-30" src="@/static/images/home/nav-1.png" mode="aspectFill" />
|
<image class="w-30 h-30" src="@/static/images/home/nav-1.png" mode="aspectFill" />
|
||||||
<text class="mt-8 text-14 text-#333">简介</text>
|
<text class="mt-8 text-14 text-#333">简介</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-1 flex flex-col items-center" @click="handleInvite">
|
<!-- <view class="flex-1 flex flex-col items-center" @click="handleInvite">
|
||||||
<image class="w-30 h-30" src="@/static/images/home/nav-2.png" mode="aspectFill" />
|
<image class="w-30 h-30" src="@/static/images/home/nav-2.png" mode="aspectFill" />
|
||||||
<text class="mt-8 text-14 text-#333">抽奖转盘</text>
|
<text class="mt-8 text-14 text-#333">抽奖转盘</text>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="flex-1 flex flex-col items-center" @click="handleInvite">
|
<view class="flex-1 flex flex-col items-center" @click="handleReward">
|
||||||
<image class="w-30 h-30" src="@/static/images/home/nav-2.png" mode="aspectFill" />
|
<image class="w-30 h-30" src="@/static/images/home/nav-2.png" mode="aspectFill" />
|
||||||
<text class="mt-8 text-14 text-#333">奖励制度</text>
|
<text class="mt-8 text-14 text-#333">奖励制度</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -34,22 +34,29 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="flex bg-white py-8 px-15 rounded-10 m-15">
|
<view class="flex bg-white py-8 px-15 rounded-10 m-15 items-center">
|
||||||
<view class="text-14 text-#333">系统公告</view>
|
<view class="text-14 text-#333">系统公告</view>
|
||||||
<view class="text-12 ml-15 text-#999">每邀请人可以获得20股马尔代夫股权</view>
|
<view class="flex-1">
|
||||||
|
<wd-notice-bar
|
||||||
|
color="#999999"
|
||||||
|
background-color="transparent"
|
||||||
|
:text="announcementList.map((item) => item.name)"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="bg-white py-15 px-15 rounded-10 m-15">
|
<view class="bg-white py-15 px-15 rounded-10 m-15">
|
||||||
<view class="text-14 text-#333">热点新闻</view>
|
<view class="text-14 text-#333">热点新闻</view>
|
||||||
<view class="flex mt-15" v-for="item in 10" :key="item">
|
<view
|
||||||
<image
|
class="flex mt-15"
|
||||||
class="w-85 h-85 rounded-10"
|
v-for="item in newsList"
|
||||||
src="@/static/images/home/news-2.png"
|
:key="item.id"
|
||||||
mode="aspectFill"
|
@click="handleNewsDetail(item.id)"
|
||||||
/>
|
>
|
||||||
|
<image class="w-85 h-85 rounded-10" :src="item.image" mode="aspectFill" />
|
||||||
<view class="ml-15 flex-1 flex flex-col justify-between">
|
<view class="ml-15 flex-1 flex flex-col justify-between">
|
||||||
<view text-14>#人海战术#签约!中央广播电视总台与农业农村部达成战略合作</view>
|
<view text-14>{{ item.name }}</view>
|
||||||
<view class="text-12 text-#999">证券时报网</view>
|
<view class="text-12 text-#999">{{ item.source }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -58,17 +65,34 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@/components/NavBar.vue'
|
||||||
|
import { getIntroductionAPI } from '@/service'
|
||||||
|
import { showModal } from '@/utils'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { list: newsList } = useListPageRequest((params) =>
|
||||||
|
getIntroductionAPI({ type: 1, ...params }),
|
||||||
|
)
|
||||||
|
|
||||||
|
// 系统公告
|
||||||
|
const { list: announcementList } = useListPageRequest((params) =>
|
||||||
|
getIntroductionAPI({ type: 2, ...params }),
|
||||||
|
)
|
||||||
|
|
||||||
const handleIntroduction = () => {
|
const handleIntroduction = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages-sub/introduction/index',
|
url: '/pages-sub/introduction/index',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleNewsDetail = (id: number) => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages-sub/news-detail/index?id=${id}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const handleInvite = () => {
|
const handleInvite = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages/invite/index',
|
url: '/pages/invite/index',
|
||||||
@@ -80,6 +104,18 @@ const handleOfficialCommunity = () => {
|
|||||||
url: '/pages-sub/official-community/index',
|
url: '/pages-sub/official-community/index',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleReward = () => {
|
||||||
|
showModal(
|
||||||
|
`1.注册立即送5000股马尔代夫股权;\n
|
||||||
|
2.每股马尔代夫股权价值500元;\n
|
||||||
|
3.每邀请一人可以获得20股马尔代夫股权`,
|
||||||
|
{
|
||||||
|
title: '奖励制度',
|
||||||
|
confirmText: '我知道了',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
+27
-12
@@ -16,23 +16,25 @@
|
|||||||
</NavBar>
|
</NavBar>
|
||||||
<view class="flex mt-30 flex-col mx-15 rounded-10 px-40 py-32 main-content">
|
<view class="flex mt-30 flex-col mx-15 rounded-10 px-40 py-32 main-content">
|
||||||
<view class="text-14 text-#6784C7">我的投资金</view>
|
<view class="text-14 text-#6784C7">我的投资金</view>
|
||||||
<view class="text-35 leading-35 mt-10 text-#BE7143 font-bold">1000000</view>
|
<view class="text-35 leading-35 mt-10 text-#BE7143 font-bold">
|
||||||
|
{{ userStore.userInfo?.money }}
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="mt-100">
|
<view class="mt-100">
|
||||||
<view
|
<view
|
||||||
v-for="item in 10"
|
v-for="item in investmentList"
|
||||||
:key="item"
|
:key="item.id"
|
||||||
class="invest-item relative flex flex-col items-center pt-15"
|
class="invest-item relative flex flex-col items-center pt-15"
|
||||||
>
|
>
|
||||||
<view class="text-15 text-#3F88F6">5G通讯</view>
|
<view class="text-15 text-#3F88F6">{{ item.name }}</view>
|
||||||
<view class="flex w-full mt-15">
|
<view class="flex w-full mt-15">
|
||||||
<view class="flex-1 text-center">
|
<view class="flex-1 text-center">
|
||||||
<view class="text-22 text-#333 font-bold">1000.00</view>
|
<view class="text-22 text-#333 font-bold">{{ item.money }}</view>
|
||||||
<view class="text-12 mt-4 text-blue-red">投资金额</view>
|
<view class="text-12 mt-4 text-blue-red">投资金额</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex-1 text-center">
|
<view class="flex-1 text-center">
|
||||||
<view class="text-22 text-#FF3B30 font-bold">1000.00</view>
|
<view class="text-22 text-#FF3B30 font-bold">{{ item.dividend }}</view>
|
||||||
<view class="text-12 mt-4 text-blue-red">每日分红</view>
|
<view class="text-12 mt-4 text-blue-red">每日分红</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -58,6 +60,9 @@ import NavBar from '@/components/NavBar.vue'
|
|||||||
import AlipayIcon from '@/static/images/invest/alipay-icon.png'
|
import AlipayIcon from '@/static/images/invest/alipay-icon.png'
|
||||||
import WechatIcon from '@/static/images/invest/wechat-icon.png'
|
import WechatIcon from '@/static/images/invest/wechat-icon.png'
|
||||||
import UnionpayIcon from '@/static/images/invest/unionpay-icon.png'
|
import UnionpayIcon from '@/static/images/invest/unionpay-icon.png'
|
||||||
|
import { getInvestmentListAPI, submitInvestAPI } from '@/service'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
import { mergeStep, showModal } from '@/utils'
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'Home',
|
name: 'Home',
|
||||||
@@ -78,6 +83,10 @@ const panels = ref([
|
|||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
const { list: investmentList } = useListPageRequest(getInvestmentListAPI)
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const onGoInvestDetail = () => {
|
const onGoInvestDetail = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages-sub/invest-detail/index',
|
url: '/pages-sub/invest-detail/index',
|
||||||
@@ -89,12 +98,18 @@ const onSelectPayType = ({ item, index }: any) => {
|
|||||||
alert(item.title)
|
alert(item.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onInvest = (item: any) => {
|
const onInvest = mergeStep(async (item: any) => {
|
||||||
// uni.navigateTo({
|
await showModal('确认投资?')
|
||||||
// url: '/pages-sub/invest-immediately/index',
|
await submitInvestAPI({
|
||||||
// })
|
investid: item.id,
|
||||||
showPayType.value = true
|
type: 3,
|
||||||
}
|
})
|
||||||
|
await userStore.loadUserInfo()
|
||||||
|
uni.showToast({
|
||||||
|
title: '投资成功',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -11,15 +11,18 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@/components/NavBar.vue'
|
||||||
import VueQrcode from '@chenfengyuan/vue-qrcode'
|
import VueQrcode from '@chenfengyuan/vue-qrcode'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
|
||||||
const qrcodeValue = '/pages/register/index?invite=888888'
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
const qrcodeValue =
|
||||||
|
location.origin + '/#/pages/register/index?invite=' + userStore.userInfo?.invitecode
|
||||||
|
|
||||||
const onCopy = (code: string) => {
|
const onCopy = (code: string) => {
|
||||||
uni.setClipboardData({
|
uni.setClipboardData({
|
||||||
data: code,
|
data: code,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const onLottery = () => {
|
const onLottery = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages-sub/lottery/index',
|
url: '/pages-sub/lottery/index',
|
||||||
@@ -32,9 +35,9 @@ const onLottery = () => {
|
|||||||
<NavBar />
|
<NavBar />
|
||||||
<view class="flex justify-center mt-80">
|
<view class="flex justify-center mt-80">
|
||||||
<view class="text-white btn-gradient rounded-full px-30 py-10 text-14">邀请好友</view>
|
<view class="text-white btn-gradient rounded-full px-30 py-10 text-14">邀请好友</view>
|
||||||
<view class="ml-15 bg-white rounded-full px-30 py-10 text-14" @click="onLottery">
|
<!-- <view class="ml-15 bg-white rounded-full px-30 py-10 text-14" @click="onLottery">
|
||||||
<text class="text-gradient">幸运大转盘</text>
|
<text class="text-gradient">幸运大转盘</text>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="flex flex-col items-center mt-180">
|
<view class="flex flex-col items-center mt-180">
|
||||||
<view
|
<view
|
||||||
@@ -42,7 +45,7 @@ const onLottery = () => {
|
|||||||
>
|
>
|
||||||
<view>
|
<view>
|
||||||
邀请码
|
邀请码
|
||||||
<text class="font-bold">9999999</text>
|
<text class="font-bold">{{ userStore.userInfo?.invitecode }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="btn-gradient text-white rounded-full px-15 py-4 text-12 ml-10"
|
class="btn-gradient text-white rounded-full px-15 py-4 text-12 ml-10"
|
||||||
|
|||||||
+15
-11
@@ -19,7 +19,7 @@
|
|||||||
<image class="w-24 h-24" src="@/static/images/login/phone.png" mode="aspectFit" />
|
<image class="w-24 h-24" src="@/static/images/login/phone.png" mode="aspectFit" />
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
v-model="formData.member_username"
|
v-model="formData.account"
|
||||||
placeholder-class="text-#889BC6"
|
placeholder-class="text-#889BC6"
|
||||||
class="text-right flex-1 text-14"
|
class="text-right flex-1 text-14"
|
||||||
placeholder="请输入用户名"
|
placeholder="请输入用户名"
|
||||||
@@ -29,16 +29,16 @@
|
|||||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||||
<input
|
<input
|
||||||
placeholder-class="text-#889BC6"
|
placeholder-class="text-#889BC6"
|
||||||
type="text"
|
type="password"
|
||||||
v-model="formData.member_password"
|
v-model="formData.password"
|
||||||
class="text-right flex-1 text-14"
|
class="text-right flex-1 text-14"
|
||||||
placeholder="请输入登录密码"
|
placeholder="请输入登录密码"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="ml-auto mr-0 w-fit text-gradient text-14 p-15" @click="handleEditPassword">
|
<!-- <view class="ml-auto mr-0 w-fit text-gradient text-14 p-15" @click="handleEditPassword">
|
||||||
忘记密码
|
忘记密码
|
||||||
</view>
|
</view> -->
|
||||||
<view
|
<view
|
||||||
class="mt-30 text-center py-12 rounded-full mx-15 text-15 text-white btn-gradient"
|
class="mt-30 text-center py-12 rounded-full mx-15 text-15 text-white btn-gradient"
|
||||||
@click="handleLogin"
|
@click="handleLogin"
|
||||||
@@ -57,12 +57,13 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@/components/NavBar.vue'
|
||||||
import { isLogged } from '@/interceptors/route'
|
import { isLogged } from '@/interceptors/route'
|
||||||
|
import { loginUserAPI } from '@/service'
|
||||||
import { useUserStore } from '@/store/user'
|
import { useUserStore } from '@/store/user'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const formData = ref({
|
const formData = ref({
|
||||||
member_username: '',
|
account: '',
|
||||||
member_password: '',
|
password: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
let redirect = '/'
|
let redirect = '/'
|
||||||
@@ -71,15 +72,18 @@ onLoad((options) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
if (!formData.value.member_username || !formData.value.member_password) {
|
if (!formData.value.account || !formData.value.password) {
|
||||||
return uni.showToast({
|
return uni.showToast({
|
||||||
title: '请输入用户名和密码',
|
title: '请输入用户名和密码',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
userStore.setUserInfo({
|
const {
|
||||||
token: '123456',
|
data: {
|
||||||
})
|
userinfo: { token },
|
||||||
|
},
|
||||||
|
} = await loginUserAPI(formData.value)
|
||||||
|
userStore.setToken(token)
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: redirect,
|
url: redirect,
|
||||||
})
|
})
|
||||||
|
|||||||
+18
-11
@@ -11,18 +11,24 @@
|
|||||||
<view class="my-page">
|
<view class="my-page">
|
||||||
<NavBar />
|
<NavBar />
|
||||||
<view class="flex flex-col items-center justify-center mt-30">
|
<view class="flex flex-col items-center justify-center mt-30">
|
||||||
<Avatar class="w-80 h-80 mx-auto" />
|
<Avatar class="w-80 h-80 mx-auto" :src="getImageUrl(userStore.userInfo.avatar)" />
|
||||||
<view class="text-16 mt-10">默认用户</view>
|
<view class="text-16 mt-10">{{ userStore.userInfo.nickname }}</view>
|
||||||
<view class="text-12 mt-8">账号:199****654</view>
|
<view class="text-12 mt-8">账号:{{ userStore.userInfo.username }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex justify-center text-center mt-15 items-center">
|
<view class="flex justify-center text-center mt-15 items-center px-30">
|
||||||
<view>
|
<view class="flex-1">
|
||||||
<view class="text-30 font-bold">1002</view>
|
<view class="text-30 font-bold">{{ Number(userStore.userInfo.money) }}</view>
|
||||||
<view class="text-14 mt-10 text-#3B81F3">我的余额</view>
|
<view class="text-14 mt-10 text-#3B81F3">我的余额</view>
|
||||||
</view>
|
</view>
|
||||||
<image class="w-100 h-100" src="@/static/images/my/translate.png" mode="aspectFit" />
|
<view class="w-50 h-50 relative">
|
||||||
<view>
|
<image
|
||||||
<view class="text-30 font-bold">1231</view>
|
class="w-100 h-100 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"
|
||||||
|
src="@/static/images/my/translate.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="flex-1">
|
||||||
|
<view class="text-30 font-bold">{{ Number(userStore.userInfo.score) }}</view>
|
||||||
<view class="text-14 mt-10 text-#3B81F3">我的股数</view>
|
<view class="text-14 mt-10 text-#3B81F3">我的股数</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -97,11 +103,12 @@ import Avatar from '@/components/Avatar.vue'
|
|||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@/components/NavBar.vue'
|
||||||
import { loginRoute } from '@/interceptors/route'
|
import { loginRoute } from '@/interceptors/route'
|
||||||
import { useUserStore } from '@/store/user'
|
import { useUserStore } from '@/store/user'
|
||||||
|
import { getImageUrl } from '@/utils'
|
||||||
|
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const handleLogout = () => {
|
const handleLogout = () => {
|
||||||
userStore.clearUserInfo()
|
userStore.logout()
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: loginRoute,
|
url: loginRoute,
|
||||||
})
|
})
|
||||||
@@ -143,7 +150,7 @@ const handleBankCard = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleInvite = () => {
|
const handleInvite = () => {
|
||||||
uni.navigateTo({
|
uni.switchTab({
|
||||||
url: '/pages/invite/index',
|
url: '/pages/invite/index',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<route lang="json5">
|
<route lang="json5" type="page">
|
||||||
{
|
{
|
||||||
style: {
|
style: {
|
||||||
navigationBarTitleText: '注册',
|
navigationBarTitleText: '注册',
|
||||||
@@ -7,6 +7,94 @@
|
|||||||
notNeedLogin: false,
|
notNeedLogin: false,
|
||||||
}
|
}
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import NavBar from '@/components/NavBar.vue'
|
||||||
|
import { isLogged } from '@/interceptors/route'
|
||||||
|
import { registerUserAPI } from '@/service'
|
||||||
|
import { useUserStore } from '@/store/user'
|
||||||
|
import { mergeStep } from '@/utils'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
const form = ref({
|
||||||
|
username: '',
|
||||||
|
// member_nickname: '',
|
||||||
|
password: '',
|
||||||
|
retpassword: '',
|
||||||
|
invitecode: '',
|
||||||
|
tpassword: '',
|
||||||
|
rettpassword: '',
|
||||||
|
})
|
||||||
|
|
||||||
|
let redirect = '/'
|
||||||
|
onLoad((options) => {
|
||||||
|
redirect = options.redirect ?? '/'
|
||||||
|
form.value.invitecode = options.invitecode ?? ''
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleRegister = mergeStep(async () => {
|
||||||
|
if (!form.value.username) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入用户名',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!form.value.password) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入登录密码',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (form.value.password !== form.value.retpassword) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '两次输入的密码不一致',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (!form.value.tpassword) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '请输入支付密码',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (form.value.tpassword !== form.value.rettpassword) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '两次输入的支付密码不一致',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// if (!form.value.invitecode) {
|
||||||
|
// uni.showToast({
|
||||||
|
// title: '请输入邀请码',
|
||||||
|
// icon: 'none',
|
||||||
|
// })
|
||||||
|
// return
|
||||||
|
// }
|
||||||
|
const {
|
||||||
|
data: {
|
||||||
|
userinfo: { token },
|
||||||
|
},
|
||||||
|
} = await registerUserAPI(form.value)
|
||||||
|
userStore.setToken(token)
|
||||||
|
uni.reLaunch({
|
||||||
|
url: redirect,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
onLoad(async (options) => {
|
||||||
|
if (isLogged()) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: redirect,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
form.value.invitecode = options.invite ?? ''
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="login-container relative">
|
<view class="login-container relative">
|
||||||
<NavBar />
|
<NavBar />
|
||||||
@@ -15,30 +103,17 @@
|
|||||||
<view class="flex items-center py-15">
|
<view class="flex items-center py-15">
|
||||||
<image class="w-24 h-24" src="@/static/images/login/phone.png" mode="aspectFit" />
|
<image class="w-24 h-24" src="@/static/images/login/phone.png" mode="aspectFit" />
|
||||||
<input
|
<input
|
||||||
|
v-model="form.username"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder-class="text-#889BC6"
|
placeholder-class="text-#889BC6"
|
||||||
class="text-right flex-1 text-14"
|
class="text-right flex-1 text-14"
|
||||||
placeholder="请输入用户名"
|
placeholder="请输入用户名"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center py-15">
|
|
||||||
<image class="w-24 h-24" src="@/static/images/login/message.png" mode="aspectFit" />
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
placeholder-class="text-#889BC6"
|
|
||||||
class="text-right flex-1 text-14"
|
|
||||||
placeholder="请输入短信验证码"
|
|
||||||
/>
|
|
||||||
<view
|
|
||||||
class="py-6 rounded-full ml-15 px-15 text-12 text-white btn-gradient text-14 text-#889BC6"
|
|
||||||
@click="handleGetCode"
|
|
||||||
>
|
|
||||||
获取验证码
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="flex items-center py-15">
|
<view class="flex items-center py-15">
|
||||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||||
<input
|
<input
|
||||||
|
v-model="form.password"
|
||||||
placeholder-class="text-#889BC6"
|
placeholder-class="text-#889BC6"
|
||||||
type="password"
|
type="password"
|
||||||
class="text-right flex-1 text-14"
|
class="text-right flex-1 text-14"
|
||||||
@@ -48,6 +123,7 @@
|
|||||||
<view class="flex items-center py-15">
|
<view class="flex items-center py-15">
|
||||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||||
<input
|
<input
|
||||||
|
v-model="form.retpassword"
|
||||||
placeholder-class="text-#889BC6"
|
placeholder-class="text-#889BC6"
|
||||||
type="password"
|
type="password"
|
||||||
class="text-right flex-1 text-14"
|
class="text-right flex-1 text-14"
|
||||||
@@ -57,6 +133,7 @@
|
|||||||
<view class="flex items-center py-15">
|
<view class="flex items-center py-15">
|
||||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||||
<input
|
<input
|
||||||
|
v-model="form.tpassword"
|
||||||
placeholder-class="text-#889BC6"
|
placeholder-class="text-#889BC6"
|
||||||
type="password"
|
type="password"
|
||||||
class="text-right flex-1 text-14"
|
class="text-right flex-1 text-14"
|
||||||
@@ -66,6 +143,7 @@
|
|||||||
<view class="flex items-center py-15">
|
<view class="flex items-center py-15">
|
||||||
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
<image class="w-24 h-24" src="@/static/images/login/password.png" mode="aspectFit" />
|
||||||
<input
|
<input
|
||||||
|
v-model="form.rettpassword"
|
||||||
placeholder-class="text-#889BC6"
|
placeholder-class="text-#889BC6"
|
||||||
type="password"
|
type="password"
|
||||||
class="text-right flex-1 text-14"
|
class="text-right flex-1 text-14"
|
||||||
@@ -75,8 +153,9 @@
|
|||||||
<view class="flex items-center py-15">
|
<view class="flex items-center py-15">
|
||||||
<image class="w-24 h-24" src="@/static/images/login/invite.png" mode="aspectFit" />
|
<image class="w-24 h-24" src="@/static/images/login/invite.png" mode="aspectFit" />
|
||||||
<input
|
<input
|
||||||
|
v-model="form.invitecode"
|
||||||
placeholder-class="text-#889BC6"
|
placeholder-class="text-#889BC6"
|
||||||
type="password"
|
type="text"
|
||||||
class="text-right flex-1 text-14"
|
class="text-right flex-1 text-14"
|
||||||
placeholder="请输入邀请码"
|
placeholder="请输入邀请码"
|
||||||
/>
|
/>
|
||||||
@@ -92,35 +171,6 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
|
||||||
import NavBar from '@/components/NavBar.vue'
|
|
||||||
import { isLogged } from '@/interceptors/route'
|
|
||||||
import { useUserStore } from '@/store/user'
|
|
||||||
|
|
||||||
const userStore = useUserStore()
|
|
||||||
|
|
||||||
let redirect = '/'
|
|
||||||
onLoad((options) => {
|
|
||||||
redirect = options.redirect ?? '/'
|
|
||||||
})
|
|
||||||
|
|
||||||
const handleRegister = () => {
|
|
||||||
userStore.setUserInfo({
|
|
||||||
token: '123456',
|
|
||||||
})
|
|
||||||
uni.reLaunch({
|
|
||||||
url: redirect,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
onLoad(() => {
|
|
||||||
if (isLogged()) {
|
|
||||||
uni.reLaunch({
|
|
||||||
url: redirect,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.login-container {
|
.login-container {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
import { http } from '@/utils/http'
|
||||||
|
|
||||||
|
// 注册用户
|
||||||
|
export const registerUserAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/register',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
export const loginUserAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/login',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取用户信息
|
||||||
|
export const getUserInfoAPI = () =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/index',
|
||||||
|
method: 'GET',
|
||||||
|
})
|
||||||
|
|
||||||
|
// 退出登录
|
||||||
|
export const logoutUserAPI = () =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/logout',
|
||||||
|
method: 'POST',
|
||||||
|
})
|
||||||
|
|
||||||
|
// 简介、公告、新闻
|
||||||
|
export const getIntroductionAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/index/articlelist',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 新闻详情
|
||||||
|
export const getIntroductionDetailAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/index/articledetails',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 投资理财列表
|
||||||
|
export const getInvestmentListAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/index/investlist',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 提交投资
|
||||||
|
export const submitInvestAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/submitinvest',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取投资记录
|
||||||
|
export const getInvestmentRecordAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/myinvestlist',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 查询实名认证
|
||||||
|
export const getRealNameAuthAPI = () =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/finduserauth',
|
||||||
|
method: 'POST',
|
||||||
|
})
|
||||||
|
|
||||||
|
// 实名认证
|
||||||
|
export const realNameAuthAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/userauth',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 我的邀请
|
||||||
|
export const getMyTeamAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/inviteelist',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 我的资产
|
||||||
|
export const getMyAssetAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/myassets',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 股数转换
|
||||||
|
export const convertScoreAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/conversion',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 添加银行卡
|
||||||
|
export const addBankCardAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/addbank',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取银行卡
|
||||||
|
export const getBankCardAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/banklist',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 删除银行卡
|
||||||
|
export const deleteBankCardAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/delbank',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 提交提现
|
||||||
|
export const submitWithdrawalAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/withdrawal',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 获取提现记录
|
||||||
|
export const getWithdrawalRecordAPI = (data) =>
|
||||||
|
http({
|
||||||
|
url: '/api/user/withdrawallist',
|
||||||
|
method: 'POST',
|
||||||
|
data,
|
||||||
|
})
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import { http } from '@/utils/http'
|
|
||||||
export interface IFooItem {
|
|
||||||
id: string
|
|
||||||
name: string
|
|
||||||
}
|
|
||||||
|
|
||||||
/** GET 请求 */
|
|
||||||
export const getFooAPI = (name: string) => {
|
|
||||||
return http.get<IFooItem>('/foo', { name })
|
|
||||||
}
|
|
||||||
|
|
||||||
/** POST 请求 */
|
|
||||||
export const postFooAPI = (name: string) => {
|
|
||||||
return http.post<IFooItem>('/foo', { name }, { name })
|
|
||||||
}
|
|
||||||
+28
-7
@@ -1,28 +1,49 @@
|
|||||||
|
import { getUserInfoAPI, logoutUserAPI } from '@/service'
|
||||||
|
import { mergeStep } from '@/utils'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const initState = { nickname: '', avatar: '' }
|
|
||||||
|
|
||||||
export const useUserStore = defineStore(
|
export const useUserStore = defineStore(
|
||||||
'user',
|
'user',
|
||||||
() => {
|
() => {
|
||||||
const userInfo = ref<IUserInfo>({ ...initState })
|
const userInfo = ref<IUserInfo | null>(null)
|
||||||
|
const token = ref('')
|
||||||
|
|
||||||
|
const loadUserInfo = mergeStep(async () => {
|
||||||
|
const res = await getUserInfoAPI()
|
||||||
|
userInfo.value = res.data.userinfo
|
||||||
|
})
|
||||||
|
|
||||||
const setUserInfo = (val: IUserInfo) => {
|
const setUserInfo = (val: IUserInfo) => {
|
||||||
userInfo.value = val
|
userInfo.value = val
|
||||||
}
|
}
|
||||||
|
const setToken = (val: string) => {
|
||||||
const clearUserInfo = () => {
|
token.value = val
|
||||||
userInfo.value = { ...initState }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const isLogged = computed(() => !!userInfo.value.token)
|
const clearUserInfo = () => {
|
||||||
|
userInfo.value = null
|
||||||
|
}
|
||||||
|
const clearToken = () => {
|
||||||
|
token.value = ''
|
||||||
|
}
|
||||||
|
const logout = async () => {
|
||||||
|
logoutUserAPI()
|
||||||
|
clearUserInfo()
|
||||||
|
clearToken()
|
||||||
|
}
|
||||||
|
|
||||||
|
const isLogged = computed(() => !!token.value)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
userInfo,
|
userInfo,
|
||||||
|
loadUserInfo,
|
||||||
setUserInfo,
|
setUserInfo,
|
||||||
clearUserInfo,
|
clearUserInfo,
|
||||||
isLogged,
|
isLogged,
|
||||||
|
setToken,
|
||||||
|
token,
|
||||||
|
logout,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Vendored
+2
@@ -78,6 +78,7 @@ declare global {
|
|||||||
const useCssModule: typeof import('vue')['useCssModule']
|
const useCssModule: typeof import('vue')['useCssModule']
|
||||||
const useCssVars: typeof import('vue')['useCssVars']
|
const useCssVars: typeof import('vue')['useCssVars']
|
||||||
const useId: typeof import('vue')['useId']
|
const useId: typeof import('vue')['useId']
|
||||||
|
const useListPageRequest: typeof import('../hooks/useListPageRequest')['useListPageRequest']
|
||||||
const useModel: typeof import('vue')['useModel']
|
const useModel: typeof import('vue')['useModel']
|
||||||
const useNavbarWeixin: (typeof import('../hooks/useNavbarWeixin'))['default']
|
const useNavbarWeixin: (typeof import('../hooks/useNavbarWeixin'))['default']
|
||||||
const useRequest: typeof import('../hooks/useRequest')['default']
|
const useRequest: typeof import('../hooks/useRequest')['default']
|
||||||
@@ -174,6 +175,7 @@ declare module 'vue' {
|
|||||||
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
|
readonly useCssModule: UnwrapRef<typeof import('vue')['useCssModule']>
|
||||||
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
readonly useCssVars: UnwrapRef<typeof import('vue')['useCssVars']>
|
||||||
readonly useId: UnwrapRef<typeof import('vue')['useId']>
|
readonly useId: UnwrapRef<typeof import('vue')['useId']>
|
||||||
|
readonly useListPageRequest: UnwrapRef<typeof import('../hooks/useListPageRequest')['useListPageRequest']>
|
||||||
readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
|
readonly useModel: UnwrapRef<typeof import('vue')['useModel']>
|
||||||
readonly useRequest: UnwrapRef<typeof import('../hooks/useRequest')['default']>
|
readonly useRequest: UnwrapRef<typeof import('../hooks/useRequest')['default']>
|
||||||
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
|
readonly useSlots: UnwrapRef<typeof import('vue')['useSlots']>
|
||||||
|
|||||||
Vendored
+2
-1
@@ -20,6 +20,7 @@ interface NavigateToOptions {
|
|||||||
"/pages-sub/invest-result/index" |
|
"/pages-sub/invest-result/index" |
|
||||||
"/pages-sub/invite/index" |
|
"/pages-sub/invite/index" |
|
||||||
"/pages-sub/lottery/index" |
|
"/pages-sub/lottery/index" |
|
||||||
|
"/pages-sub/news-detail/index" |
|
||||||
"/pages-sub/official-community/index" |
|
"/pages-sub/official-community/index" |
|
||||||
"/pages-sub/realname/index" |
|
"/pages-sub/realname/index" |
|
||||||
"/pages-sub/team/index" |
|
"/pages-sub/team/index" |
|
||||||
@@ -31,7 +32,7 @@ interface NavigateToOptions {
|
|||||||
interface RedirectToOptions extends NavigateToOptions {}
|
interface RedirectToOptions extends NavigateToOptions {}
|
||||||
|
|
||||||
interface SwitchTabOptions {
|
interface SwitchTabOptions {
|
||||||
url: "/pages/index/index" | "/pages/invest/index" | "/pages/invite/index" | "/pages/my/index"
|
url: "/pages/index/index" | "/pages/invite/index" | "/pages/invest/index" | "/pages/my/index"
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReLaunchOptions = NavigateToOptions | SwitchTabOptions;
|
type ReLaunchOptions = NavigateToOptions | SwitchTabOptions;
|
||||||
|
|||||||
+14
-5
@@ -16,11 +16,20 @@ type IUniUploadFileOptions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type IUserInfo = {
|
type IUserInfo = {
|
||||||
nickname?: string
|
avatar: string
|
||||||
avatar?: string
|
createtime: number
|
||||||
/** 微信的 openid,非微信没有这个字段 */
|
expires_in: number
|
||||||
openid?: string
|
expiretime: number
|
||||||
token?: string
|
id: number
|
||||||
|
invitecode: string
|
||||||
|
mobile: string
|
||||||
|
money: string
|
||||||
|
nickname: string
|
||||||
|
point: number
|
||||||
|
score: number
|
||||||
|
token: string
|
||||||
|
user_id: number
|
||||||
|
username: string
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TestEnum {
|
enum TestEnum {
|
||||||
|
|||||||
+50
-9
@@ -1,4 +1,6 @@
|
|||||||
import { CustomRequestOptions } from '@/interceptors/request'
|
import { CustomRequestOptions } from '@/interceptors/request'
|
||||||
|
import { loginRoute } from '@/interceptors/route'
|
||||||
|
import { useUserStore } from '@/store'
|
||||||
|
|
||||||
export const http = <T>(options: CustomRequestOptions) => {
|
export const http = <T>(options: CustomRequestOptions) => {
|
||||||
// 1. 返回 Promise 对象
|
// 1. 返回 Promise 对象
|
||||||
@@ -10,23 +12,62 @@ export const http = <T>(options: CustomRequestOptions) => {
|
|||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
// #endif
|
// #endif
|
||||||
// 响应成功
|
// 响应成功
|
||||||
success(res) {
|
async success(res) {
|
||||||
// 状态码 2xx,参考 axios 的设计
|
// 状态码 2xx,参考 axios 的设计
|
||||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||||
|
if (res.header['content-type'].includes('application/json')) {
|
||||||
// 2.1 提取核心数据 res.data
|
// 2.1 提取核心数据 res.data
|
||||||
resolve(res.data as IResData<T>)
|
const data = res.data as IResData<T>
|
||||||
|
if (data.code === 1) {
|
||||||
|
resolve(data as IResData<T>)
|
||||||
|
} else if (data.code === 401) {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
userStore.logout()
|
||||||
|
!options.hideErrorToast &&
|
||||||
|
(await uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: data.msg || '请求错误',
|
||||||
|
showCancel: false,
|
||||||
|
}))
|
||||||
|
uni.reLaunch({
|
||||||
|
url: loginRoute,
|
||||||
|
})
|
||||||
|
|
||||||
|
reject(res)
|
||||||
|
} else {
|
||||||
|
!options.hideErrorToast &&
|
||||||
|
(await uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: data.msg || '请求错误',
|
||||||
|
showCancel: false,
|
||||||
|
}))
|
||||||
|
reject(res)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve(res.data as any)
|
||||||
|
}
|
||||||
} else if (res.statusCode === 401) {
|
} else if (res.statusCode === 401) {
|
||||||
// 401错误 -> 清理用户信息,跳转到登录页
|
const userStore = useUserStore()
|
||||||
// userStore.clearUserInfo()
|
userStore.logout()
|
||||||
// uni.navigateTo({ url: '/pages/login/login' })
|
!options.hideErrorToast &&
|
||||||
|
(await uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: res.data.msg || '请求错误',
|
||||||
|
showCancel: false,
|
||||||
|
}))
|
||||||
|
uni.reLaunch({
|
||||||
|
url: loginRoute,
|
||||||
|
})
|
||||||
|
|
||||||
reject(res)
|
reject(res)
|
||||||
} else {
|
} else {
|
||||||
// 其他错误 -> 根据后端错误信息轻提示
|
// 其他错误 -> 根据后端错误信息轻提示
|
||||||
!options.hideErrorToast &&
|
!options.hideErrorToast &&
|
||||||
uni.showToast({
|
(await uni.showModal({
|
||||||
icon: 'none',
|
title: '提示',
|
||||||
title: (res.data as IResData<T>).msg || '请求错误',
|
content: (res.data as IResData<T>).msg || '请求错误',
|
||||||
})
|
showCancel: false,
|
||||||
|
}))
|
||||||
reject(res)
|
reject(res)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
+60
-13
@@ -1,5 +1,6 @@
|
|||||||
import { pages, subPackages, tabBar } from '@/pages.json'
|
import { pages, subPackages, tabBar } from '@/pages.json'
|
||||||
import { isMp } from './platform'
|
import { isMp } from './platform'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
|
|
||||||
export const getLastPage = () => {
|
export const getLastPage = () => {
|
||||||
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
// getCurrentPages() 至少有1个元素,所以不再额外判断
|
||||||
@@ -9,15 +10,8 @@ export const getLastPage = () => {
|
|||||||
return pages[pages.length - 1]
|
return pages[pages.length - 1]
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getPath = (url: string) => {
|
|
||||||
if (typeof url === 'string') {
|
|
||||||
return url.split('?')[0].replace(/^pages/, '/pages')
|
|
||||||
}
|
|
||||||
throw new Error('please input string type')
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 判断当前页面是否是tabbar页 */
|
/** 判断当前页面是否是tabbar页 */
|
||||||
export const getIsTabbar = (url?: string) => {
|
export const getIsTabbar = () => {
|
||||||
if (!tabBar) {
|
if (!tabBar) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -25,14 +19,29 @@ export const getIsTabbar = (url?: string) => {
|
|||||||
// 通常有tabBar的话,list不能有空,且至少有2个元素,这里其实不用处理
|
// 通常有tabBar的话,list不能有空,且至少有2个元素,这里其实不用处理
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if (url) {
|
|
||||||
console.log(tabBar.list, getPath(url))
|
|
||||||
return !!tabBar.list.some((e) => getPath(e.pagePath) === getPath(url))
|
|
||||||
} else {
|
|
||||||
const lastPage = getLastPage()
|
const lastPage = getLastPage()
|
||||||
const currPath = lastPage.route
|
const currPath = lastPage.route
|
||||||
return !!tabBar.list.some((e) => e.pagePath === currPath)
|
return !!tabBar.list.find((e) => e.pagePath === currPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前页面路由的 path 路径和 redirectPath 路径
|
||||||
|
* path 如 ‘/pages/login/index’
|
||||||
|
* redirectPath 如 ‘/pages/demo/base/route-interceptor’
|
||||||
|
*/
|
||||||
|
export const currRoute = () => {
|
||||||
|
const lastPage = getLastPage()
|
||||||
|
const currRoute = (lastPage as any).$page
|
||||||
|
// console.log('lastPage.$page:', currRoute)
|
||||||
|
// console.log('lastPage.$page.fullpath:', currRoute.fullPath)
|
||||||
|
// console.log('lastPage.$page.options:', currRoute.options)
|
||||||
|
// console.log('lastPage.options:', (lastPage as any).options)
|
||||||
|
// 经过多端测试,只有 fullPath 靠谱,其他都不靠谱
|
||||||
|
const { fullPath } = currRoute as { fullPath: string }
|
||||||
|
// console.log(fullPath)
|
||||||
|
// eg: /pages/login/index?redirect=%2Fpages%2Fdemo%2Fbase%2Froute-interceptor (小程序)
|
||||||
|
// eg: /pages/login/index?redirect=%2Fpages%2Froute-interceptor%2Findex%3Fname%3Dfeige%26age%3D30(h5)
|
||||||
|
return getUrlObj(fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
const ensureDecodeURIComponent = (url: string) => {
|
const ensureDecodeURIComponent = (url: string) => {
|
||||||
@@ -131,6 +140,9 @@ export const getEnvBaseUrl = () => {
|
|||||||
export const getEnvBaseUploadUrl = () => {
|
export const getEnvBaseUploadUrl = () => {
|
||||||
// 请求基准地址
|
// 请求基准地址
|
||||||
let baseUploadUrl = import.meta.env.VITE_UPLOAD_BASEURL
|
let baseUploadUrl = import.meta.env.VITE_UPLOAD_BASEURL
|
||||||
|
if (JSON.parse(__VITE_APP_PROXY__)) {
|
||||||
|
baseUploadUrl = `${import.meta.env.VITE_APP_PROXY_PREFIX}/${baseUploadUrl.split(import.meta.env.VITE_APP_PROXY_PREFIX + '/')[1]}`
|
||||||
|
}
|
||||||
|
|
||||||
// 小程序端环境区分
|
// 小程序端环境区分
|
||||||
if (isMp) {
|
if (isMp) {
|
||||||
@@ -180,3 +192,38 @@ export function mergeStep(wrapped: (...rest: any[]) => Promise<any>) {
|
|||||||
return _mergeStepRequestInstance
|
return _mergeStepRequestInstance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Promise 版modal
|
||||||
|
export const showModal = (
|
||||||
|
content: string,
|
||||||
|
{ showCancel, title, ...options }: UniApp.ShowModalOptions = {},
|
||||||
|
) => {
|
||||||
|
return new Promise((resolve, reject) =>
|
||||||
|
uni.showModal({
|
||||||
|
showCancel: showCancel === true,
|
||||||
|
title: title || '提示',
|
||||||
|
...options,
|
||||||
|
content,
|
||||||
|
success(e) {
|
||||||
|
if (e.confirm) {
|
||||||
|
return resolve(e)
|
||||||
|
}
|
||||||
|
reject(e)
|
||||||
|
},
|
||||||
|
fail: reject,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 格式化时间 */
|
||||||
|
export const formatTime = (time: string | number) => {
|
||||||
|
return dayjs(time).format('YYYY-MM-DD HH:mm:ss')
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取图片url */
|
||||||
|
export const getImageUrl = (image: any) => {
|
||||||
|
if (typeof image === 'string') {
|
||||||
|
return /^http|data:/.test(image) ? image : `${import.meta.env.VITE_SERVER_BASEURL}${image}`
|
||||||
|
}
|
||||||
|
return image
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user