From 5e3200bb78546b3b263c416503e37a3ac764362a Mon Sep 17 00:00:00 2001 From: Hx <2294602187@qq.com> Date: Fri, 28 Mar 2025 14:23:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 4 +- src/api/common.ts | 98 -------------------------- src/api/login.ts | 23 ++++++ src/api/user.ts | 9 +++ src/config/index.ts | 2 +- src/hooks/paginationLoader.ts | 128 ---------------------------------- src/hooks/useListLoadClass.ts | 125 --------------------------------- src/hooks/usePagingLoad.ts | 127 --------------------------------- src/manifest.json | 8 +-- src/pages.json | 8 +++ src/pages/login/login.vue | 105 ++++++++++++++++++++++++++++ src/pages/mine/index.vue | 25 +++++-- src/static/bg1.png | Bin 96336 -> 0 bytes src/static/card.png | Bin 208824 -> 0 bytes src/static/invite.jpg | Bin 53714 -> 0 bytes src/static/logo-bg.png | Bin 913979 -> 0 bytes src/static/logo-tran.png | Bin 53904 -> 0 bytes src/static/password.png | Bin 521 -> 0 bytes src/static/redpacket.png | Bin 4833 -> 0 bytes src/static/user.png | Bin 541 -> 0 bytes src/store/user.ts | 69 ++++++++++-------- src/utils/http.ts | 19 ++--- 22 files changed, 216 insertions(+), 534 deletions(-) delete mode 100644 src/api/common.ts create mode 100644 src/api/login.ts create mode 100644 src/api/user.ts delete mode 100644 src/hooks/paginationLoader.ts delete mode 100644 src/hooks/useListLoadClass.ts delete mode 100644 src/hooks/usePagingLoad.ts create mode 100644 src/pages/login/login.vue delete mode 100644 src/static/bg1.png delete mode 100644 src/static/card.png delete mode 100644 src/static/invite.jpg delete mode 100644 src/static/logo-bg.png delete mode 100644 src/static/logo-tran.png delete mode 100644 src/static/password.png delete mode 100644 src/static/redpacket.png delete mode 100644 src/static/user.png diff --git a/.env.development b/.env.development index 46ac588..4ed7ec7 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,5 @@ ENV='development' # base api -VITE_APP_BASE_URL = 'http://pos-api.lingji.vip' -VITE_APP_BASE_PRE = '/shenname' +VITE_APP_BASE_URL = 'https://evote.truescloud.com' +VITE_APP_BASE_PRE = '/dev-api' VITE_APP_BASE_NAME = 'POS' diff --git a/src/api/common.ts b/src/api/common.ts deleted file mode 100644 index 793bc64..0000000 --- a/src/api/common.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { request } from '@/utils/http' - -export interface sendCodeType { - phone: number | string -} - -export function sendCode(data: sendCodeType) { - return request.http({ - url: '/api/t.sms/sendCode', - data - }) -} - -// 上传图片 -export function uploadFile(file: any) { - let url = '' - // #ifdef APP-PLUS - url = import.meta.env.VITE_APP_BASE_URL - // #endif - // #ifdef H5 - url = import.meta.env.VITE_APP_BASE_PRE - // #endif - return new Promise((resolve, reject) => { - uni.uploadFile({ - url: `${url}/api/resources/upload`, - filePath: file, - name: 'file', - success: (res) => { - resolve(JSON.parse(res.data)) - }, - fail: (res) => { - reject(res) - } - }) - }) -} - -// 根据 KEY 获取对应数据 -export function getKeyData(key: string) { - return request.http({ - url: '/api/t.systemData/getCategoryByKey', - data: { key: key } - }) -} - -// 根据 KEY 获取对应系统设置 -export function getKeySetting(key: string) { - return request.http({ - url: '/api/t.systemData/getSettingByKey', - data: { key: key } - }) -} - -// 获取无限极分类数据 -export function getCategoryData() { - return request.http({ - url: '/api/t.systemData/categoryTree' - }) -} - -// 意见反馈 -export interface feedbackType { - type: useType - category_id: number - content: string - image?: string - contact_information: string -} - -export function feedback(data: feedbackType) { - return request.http({ - url: '/api/t.feedback/add', - data - }) -} - -// 购买支付接口 -export function pay(data: { policy_id: number; uid: number; pay_amount: number; version: string }) { - return request.http({ - url: '/api/t.notify/buyAgentPolicyNotify', - data - }) -} - -// 直采列表 -export function voucherQuery() { - return request.http({ - url: '/api/d.pickGiftBag/query' - }) -} - -// 直采支付 -export function voucherPay(data: { id: number }) { - return request.http({ - url: '/api/d.pickGiftBag/buy', - data - }) -} diff --git a/src/api/login.ts b/src/api/login.ts new file mode 100644 index 0000000..e1294d9 --- /dev/null +++ b/src/api/login.ts @@ -0,0 +1,23 @@ +import { request } from '@/utils/http' + +export function getOpenid(data: { code: string }) { + return request.http({ + url: '/api/openid', + data + }) +} + +export function getMobile(data: { code: string; openid: string }) { + return request.http({ + url: '/api/mobile', + data + }) +} + +export function getUserInfo(data: { mobile: string }) { + return request.http({ + url: '/api/member_mobile', + method: 'GET', + data + }) +} diff --git a/src/api/user.ts b/src/api/user.ts new file mode 100644 index 0000000..d153bf4 --- /dev/null +++ b/src/api/user.ts @@ -0,0 +1,9 @@ +import { request } from '@/utils/http' + +export function getUserList(data: { name: string }) { + return request.http({ + url: '/api/openid', + method: 'GET', + data + }) +} diff --git a/src/config/index.ts b/src/config/index.ts index 31f99ca..3b11541 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,4 +1,4 @@ -export const Prefix = 'POS_' +export const Prefix = 'Election_' export const getPrefixName = (name: string) => { return Prefix + name diff --git a/src/hooks/paginationLoader.ts b/src/hooks/paginationLoader.ts deleted file mode 100644 index bc29f5e..0000000 --- a/src/hooks/paginationLoader.ts +++ /dev/null @@ -1,128 +0,0 @@ -/* - * @description: 分页请求 - * @fileName: useListLoadClass.ts - * @author: lxx - * @date: 2023-07-08 08:55:52 - * @version: V1.0.0 - */ -import { ref } from 'vue' - -class PaginationLoader { - // 分页数据 - private data = ref([]) - - // 分页基础参数 - private requestParams = { - page: 1, - limit: 10 - } - - // 是否正在加载 - private isLoading = ref(false) - - // 是否还有更多数据 - private hasMore = ref(true) - - // 请求函数(由外部传入) - private fetchFn: (formData: Object, onSuccess: Function) => Function - - constructor(fetchFn: (formData: Object, onSuccess: Function) => Function) { - this.fetchFn = fetchFn - } - - // 获取当前数据 - get dataList() { - return this.data.value - } - - // 获取是否正在加载 - get loading() { - return this.isLoading.value - } - - // 获取是否还有更多数据 - get more() { - return this.hasMore.value - } - - // 加载下一页数据 - async loadNextPage() { - // if (this.isLoading.value || !this.hasMore.value) return - - // uni.showLoading({ title: '加载中...' }) - - // this.isLoading.value = true - - // try { - // const result = await this.fetchFn(this.currentPage.value, this.pageSize) - - // if (result.length > 0) { - // this.data.value = [...this.data.value, ...result] - // this.currentPage.value += 1 - // } else { - // this.hasMore.value = false // 没有更多数据 - // } - // } catch (error) { - // console.error('加载数据失败:', error) - // } finally { - // this.isLoading.value = false - // } - uni.showLoading({ title: '数据加载中' }) - this.isLoading.value = false - const params = { ...this.requestParams } as { [n: string]: string | number | boolean } - - setTimeout(() => { - this.fetchFn(params, ({ data }: { data: { data: any; total: number } }) => { - this.isLoading.value = true - this.requestParams.page = params.page as number - this.requestParams.limit = params.limit as number - this.data.value = [...this.data.value, ...data.data] - uni.hideLoading() - }) - }, 100) - } - - // 重置分页状态 - reset() { - this.data.value = [] - this.requestParams.page = 1 - this.hasMore.value = true - this.isLoading.value = false - } -} - -// export default PaginationLoader - -const fetchData = async (formData: any, onSuccess: Function) => { - const submitData = { ...formData } - point_order_list(submitData).then((res) => { - const { data } = res as { data: { data: any; total: number } } - onSuccess({ data }) - }) - // // 模拟接口请求 - // return new Promise<{ id: number; name: string }[]>((resolve) => { - // setTimeout(() => { - // const data = Array.from({ length: pageSize }, (_, index) => ({ - // id: (page - 1) * pageSize + index, - // name: `Item ${(page - 1) * pageSize + index}` - // })) - // resolve(data) - // }, 1000) - // }) -} - -// 创建分页加载实例 -const paginationLoader = new PaginationLoader(fetchData) - -// 加载下一页数据 -paginationLoader.loadNextPage(formDate.value) - -// 初始化加载第一页数据 -paginationLoader.loadNextPage() - -return { - dataList: paginationLoader.dataList, - loading: paginationLoader.loading, - more: paginationLoader.more, - loadNextPage -} diff --git a/src/hooks/useListLoadClass.ts b/src/hooks/useListLoadClass.ts deleted file mode 100644 index 8027773..0000000 --- a/src/hooks/useListLoadClass.ts +++ /dev/null @@ -1,125 +0,0 @@ -/* - * @description: 分页请求 - * @fileName: useListLoadClass.ts - * @author: lxx - * @date: 2023-07-08 08:55:52 - * @version: V1.0.0 - */ -import { ref, computed } from 'vue' -import { onReachBottom } from '@dcloudio/uni-app' - -class LoadDataClass { - // 请求参数 - static queryParams = { - page: 1, - limit: 10 - } - // 列表数据 - list = ref([]) - total = ref(0) - // 前置处理方法 - afterLoadData: Function | undefined - // 请求方法 - Query: Function - // 加载状态参数 - isLoading = ref(false) - // 无更多数据了 - isNoData = computed(() => { - if (LoadDataClass.queryParams.page * LoadDataClass.queryParams.limit >= this.total.value) { - return true - } else { - return false - } - }) - // 显示暂无数据 - isEmpty = computed(() => { - if (this.total.value === 0) { - return true - } else { - return false - } - }) - - constructor(apiFunctions: Function, afterLoadData?: Function, options?: any) { - this.Query = apiFunctions - this.afterLoadData = afterLoadData - // 存在额外参数拼接 - if (options) { - LoadDataClass.queryParams = { ...LoadDataClass.queryParams, ...options } - } - // 加载数据 - this.LoadData() - } - // 加载数据 - LoadData = async () => { - uni.showLoading({ - title: '加载中...' - }) - this.isLoading.value = true - const res = await this.Query(LoadDataClass.queryParams) - this.afterLoadData && this.afterLoadData(res) - this.total.value = res.data.total - this.list.value = this.list.value.concat(res.data.data) - - uni.hideLoading() - uni.stopPullDownRefresh() - this.isLoading.value = false - } - // 加载更多 - LoadMore = () => { - if (this.isNoData.value || this.isLoading.value) return // 无数据或者加载中不进行加载 - LoadDataClass.queryParams.page += 1 - this.LoadData() - } - // 重置参数 - queryParamsReset = () => { - LoadDataClass.queryParams = { - page: 1, - limit: 10 - } - } - - /** - * 刷新 - * @param isClear: 是否清空数据 - */ - ReLoad = (isClear: boolean = true) => { - this.isLoading.value = false - this.list.value = [] - if (isClear) { - this.queryParamsReset() - } else { - LoadDataClass.queryParams.page = 1 - } - - this.LoadData() - } -} -/** - * 分页加载数据方法 - * @param api: ListAPI 方法 - * @param afterLoadData: res数据前置处理方法 - * @returns - */ -interface LoadDataInt { - api: Function - afterLoadData?: Function - options?: any -} - -export function LoadData({ api, afterLoadData, options }: LoadDataInt) { - const data = new LoadDataClass(api, afterLoadData, options) - - // 下拉加载 - onReachBottom(() => { - console.log('onReachBottom') - data.LoadMore() - }) - return { - list: data.list, - isLoading: data.isLoading, - isNoData: data.isNoData, - isEmpty: data.isEmpty, - ReLoad: data.ReLoad - } -} diff --git a/src/hooks/usePagingLoad.ts b/src/hooks/usePagingLoad.ts deleted file mode 100644 index d66380f..0000000 --- a/src/hooks/usePagingLoad.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { ref, reactive, computed } from 'vue' -import { onReachBottom } from '@dcloudio/uni-app' -/* - * @description: 分页请求 - * @fileName: useListLoadClass.ts - * @author: lxx - * @date: 2023-07-08 08:55:52 - * @version: V1.0.0 - * loading状态 - * @param {*} Query 请求函数 - * @param {*} LoadData 加载数据方法 - * @param {*} ReLoad (isClear?: boolean) 刷新列表数据 isClear 传入true时将请求参数(queryParams)还原初始化状态 - */ - -export function usePagingLoad(Query: any) { - // 下拉加载 - onReachBottom(() => { - console.log('onReachBottom') - loadMore() - }) - - const isLoading = ref(false) - let queryParams = reactive({} as any) - - queryParams = { - page: 1, - limit: 10 - } - - const total = ref(0) - - const list = ref([]) - // 无更多数据了 - const isNoData = computed(() => { - if (queryParams.page * queryParams.limit >= total.value) { - return true - } else { - return false - } - }) - // 显示暂无数据 - const isEmpty = computed(() => { - if (total.value === 0) { - return true - } else { - return false - } - }) - - interface optionInt { - key: string - val: any - } - - const LoadData = async (afterLoadData?: any, option?: optionInt[]) => { - const obj: any = {} - console.log('option', option) - if (option && option?.length > 0) { - option?.map((item) => { - obj[item?.key] = item.val - }) - } - // , ...rest: any[] - // if (rest.length > 0) { - // rest.map((item) => { - // obj[item?.key] = item?.val; - // }); - // } - queryParams = reactive({ ...queryParams, ...obj }) - - uni.showLoading({ - title: '加载中...' - }) - isLoading.value = true - const res = await Query(queryParams) - total.value = res?.data?.total - - // 数据加载完成后 设置 after 钩子 - afterLoadData && afterLoadData(res.data) - console.log('res.data', res.data) - - list.value = list.value.concat(res?.data?.data) - uni.hideLoading() - uni.stopPullDownRefresh() - isLoading.value = false - } - - // const afterLoadData = (data: any) => { - // console.log(data); - // }; - - const ReLoad = (option?: optionInt[], isClear?: boolean) => { - isLoading.value = false - list.value = [] - if (isClear) { - queryParams = reactive({ - page: 1, - limit: 10 - }) - } else { - queryParams.page = 1 - } - const obj: any = {} - if (option && option?.length > 0) { - option?.map((item) => { - obj[item?.key] = item.val - }) - } - queryParams = reactive({ ...queryParams, ...obj }) - LoadData() - } - - const loadMore = () => { - if (isNoData.value || isLoading.value) return // 无数据或者加载中不进行加载 - queryParams.page += 1 - LoadData() - } - - return { - list, - LoadData, - ReLoad, - isNoData, - isEmpty, - isLoading - } -} diff --git a/src/manifest.json b/src/manifest.json index d6e3cd4..2a9524c 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -95,9 +95,9 @@ "iosStyle": "common", "androidStyle": "default", "android": { - "hdpi": "C:/Users/Lenovo/Desktop/480x762.9/res/drawable-xhdpi/480x762.9.png", - "xhdpi": "C:/Users/Lenovo/Desktop/720x1242.9/res/drawable-xhdpi/720x1242.9.png", - "xxhdpi": "C:/Users/Lenovo/Desktop/1080x1882.9/res/drawable-xhdpi/1080x1882.9.png" + "hdpi": "", + "xhdpi": "", + "xxhdpi": "" }, "ios": { "storyboard": "C:/Users/Lenovo/Desktop/CustomStoryboard.zip" @@ -109,7 +109,7 @@ "quickapp": {}, /* 小程序特有相关 */ "mp-weixin": { - "appid": "", + "appid": "wx5d1a07b75bd48225", "setting": { "urlCheck": false, "es6": true, diff --git a/src/pages.json b/src/pages.json index abaf283..8ba162d 100644 --- a/src/pages.json +++ b/src/pages.json @@ -7,6 +7,14 @@ } }, "pages": [ + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "登录", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, { "path": "pages/votingElection/index", "style": { diff --git a/src/pages/login/login.vue b/src/pages/login/login.vue new file mode 100644 index 0000000..e19b06b --- /dev/null +++ b/src/pages/login/login.vue @@ -0,0 +1,105 @@ + + + + diff --git a/src/pages/mine/index.vue b/src/pages/mine/index.vue index bee1473..e6870f6 100644 --- a/src/pages/mine/index.vue +++ b/src/pages/mine/index.vue @@ -1,17 +1,30 @@