diff --git a/.env.local b/.env.local index 203b664..9905706 100644 --- a/.env.local +++ b/.env.local @@ -1,3 +1,3 @@ -VITE_API_BASE_URL=http://localhost:48080 +VITE_API_BASE_URL=https://dscp-dev.hn12301.net VITE_APP_TITLE=湖南12301文旅专区 VITE_USE_MOCK=true diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index c55bcd8..2e9d392 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,6 @@ +packages: + - '.' + allowBuilds: '@parcel/watcher': true core-js: true diff --git a/project.config.json b/project.config.json index 13a9968..8faa6c0 100644 --- a/project.config.json +++ b/project.config.json @@ -1,6 +1,6 @@ { "compileType": "miniprogram", - "libVersion": "trial", + "libVersion": "3.16.1", "packOptions": { "ignore": [], "include": [] diff --git a/project.private.config.json b/project.private.config.json index 52dc31f..7699370 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -1,6 +1,6 @@ { "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", - "projectname": "%E8%B4%A8%E6%83%A0%E6%B8%B8%E6%B5%8B%E8%AF%95", + "projectname": "zhy-mp-test", "setting": { "compileHotReLoad": true, "urlCheck": true, @@ -18,5 +18,6 @@ "useLanDebug": false, "ignoreDevUnusedFiles": true }, - "libVersion": "3.16.1" + "libVersion": "3.16.1", + "condition": {} } \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index cf6b1d4..78bd7f8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,5 @@ diff --git a/src/api/card.ts b/src/api/card.ts new file mode 100644 index 0000000..953750b --- /dev/null +++ b/src/api/card.ts @@ -0,0 +1,19 @@ +import { post } from './request' +import { BASE_URL } from '../config' +import type { UserCardListItem, QrAndUserInfoResult } from './types' + +/** 获取用户年卡列表 */ +export function getUserCardList(data: { mobile: string; saleChannel: string }): Promise { + return post(`${BASE_URL}/zhy-api/cardBag/userCardList`, data, false) +} + +/** 获取用户信息与入园码 */ +export function getQrAndUserInfo(data: { + cardNum: string + thirdId: string + mobile: string + channel: string + scenicId: string +}): Promise { + return post(`${BASE_URL}/zhy-api/cardBag/qrAndUserInfo`, data, false) +} diff --git a/src/api/order.ts b/src/api/order.ts new file mode 100644 index 0000000..cda5d76 --- /dev/null +++ b/src/api/order.ts @@ -0,0 +1,11 @@ +import { post } from './request' +import { BASE_URL } from '../config' +import type { CreateOrderParams, CreateOrderResult, PrepayParams, PrepayResult } from './types' + +export function createOrder(params: CreateOrderParams) { + return post(`${BASE_URL}/open-api/pingXiang/createOrder`, params) +} + +export function prepay(params: PrepayParams) { + return post(`${BASE_URL}/open-api/pingXiang/prepay`, params) +} diff --git a/src/api/types.ts b/src/api/types.ts index fc4d217..7531cf5 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -175,8 +175,82 @@ export interface PageResult { pageSize: number } +/** OAuth2 微信登录结果 */ +export interface OAuth2LoginResult { + mobile: string + openId: string + userId: number +} + +/** 用户年卡列表项(来自 /zhy-api/cardBag/userCardList) */ +export interface UserCardListItem { + cardNo: string + cardModelName: string + validityTime: string + cardModelPic: string + thirdId: string + needFaceImgFlag?: boolean +} + +/** 用户信息与入园码(来自 /zhy-api/cardBag/qrAndUserInfo) */ +export interface QrAndUserInfoResult { + userName: string + qrCode: string + img: string + mobile: string + idType: string + idNo: string +} + /** 分页请求参数 */ export interface PageQuery { page: number pageSize: number } + +/** Banner 项(来自 mp-api/mpContent/queryList) */ +export interface BannerItem { + id: number + channel: string + type: string + title: string + content: string | null + imageUrl: string + linkUrl: string + sortOrder: number + category: string | null + createdTime: string +} + +/** 创建订单参数(open-api/pingXiang/createOrder) */ +export interface CreateOrderParams { + cardModleId: string + buyNum: number + skuId: string + mobile: string + couponId: string +} + +/** 创建订单结果 */ +export interface CreateOrderResult { + orderId: string + outTradeNo: string +} + +/** 预支付参数(open-api/pingXiang/prepay) */ +export interface PrepayParams { + openId: string + orderNo: string + description: string + amount: number +} + +/** 预支付结果(含微信支付调起参数) */ +export interface PrepayResult { + appId: string + timeStamp: string + nonce: string + pack: string + signType: string + paySign: string +} diff --git a/src/api/user.ts b/src/api/user.ts index bc911de..64fc286 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,14 +1,19 @@ import { get, post } from './request' -import type { UserInfo, WxLoginResult } from './types' +import { BASE_URL } from '../config' +import type { WxLoginResult, OAuth2LoginResult } from './types' /** 微信小程序登录(loginCode + phoneCode) */ export function wxLogin(data: { loginCode: string; phoneCode: string }): Promise { return post('/auth/wx-login', data, false) } -/** 获取当前用户信息 */ -export function getUserInfo(): Promise { - return get('/user/info') +/** OAuth2 微信登录(code + encryptedData + iv) */ +export function wxLoginByOAuth2(data: { + code: string + encryptedData: string + iv: string +}): Promise { + return post(`${BASE_URL}/open-api/auth/oauth2`, data, false) } -export type { UserInfo, WxLoginResult } +export type { WxLoginResult, OAuth2LoginResult } diff --git a/src/components/confirm-modal.vue b/src/components/confirm-modal.vue new file mode 100644 index 0000000..ec71a82 --- /dev/null +++ b/src/components/confirm-modal.vue @@ -0,0 +1,181 @@ + + + + + diff --git a/src/manifest.json b/src/manifest.json index d9e4041..d8bc3b1 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,13 +1,16 @@ { - "vueVersion": "3", - "mp-weixin": { - "appid": "wx636bc46a6570e9fd", - "setting": { - "urlCheck": false, - "es6": true, - "postcss": false, - "minified": true + "vueVersion" : "3", + "mp-weixin" : { + "appid" : "wxae3b39ac443fedc3", + "setting" : { + "urlCheck" : false, + "es6" : true, + "postcss" : false, + "minified" : true + }, + "lazyCodeLoading" : "requiredComponents" }, - "lazyCodeLoading": "requiredComponents" - } + "appid" : "__UNI__1AFEBA3", + "name" : "爱上萍乡", + "versionName" : "1.0.0" } diff --git a/src/packages/content/pages/faq.vue b/src/packages/content/pages/faq.vue index 4503543..5936961 100644 --- a/src/packages/content/pages/faq.vue +++ b/src/packages/content/pages/faq.vue @@ -1,88 +1,31 @@