diff --git a/README.md b/README.md index 9658ee9..bd0eabb 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ ``` #### 2. 页面或组件传创建的方法需要以当前文件名称作为对象按照驼峰命名 ``` - const detail = { + const Detail = { handleConfirmHour: () => { if (totalHour.value <= 0) { toast.info('至少起订N小时') @@ -33,7 +33,7 @@ #### 3. 页面或组件传创建的内部方法需要放在函数最下面,这种方法前面不需要加上handle ``` - const detail = { + const Detail = { handleConfirmHour: () => { if (totalHour.value <= 0) { toast.info('至少起订N小时') @@ -59,7 +59,7 @@ #### 4. 如果组件名称与定义的对象函数名冲突,则对象函数名后面加上s ``` import coupon from '@/components/coupon/coupon.vue' - const coupons = { + const Coupons = { handleConfirmHour: () => { if (totalHour.value <= 0) { toast.info('至少起订N小时') diff --git a/env/.env b/env/.env index b85e6c8..4bc22a7 100644 --- a/env/.env +++ b/env/.env @@ -23,3 +23,8 @@ VITE_API_SECONDARY_URL = 'https://cz.stnav.com' # 公众号APPID VITE_WX_SERVICE_ACCOUNT_APPID = 'wx0224f558e3b3f499' + +# 默认地址 +VITE_DEFAULT_LONGITUDE = 113.665412 +VITE_DEFAULT_LATITUDE = 34.757975 +VITE_DEFAULT_ADDRESS = '上海市' \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 8bb200c..d0a7234 100644 --- a/src/App.vue +++ b/src/App.vue @@ -5,7 +5,7 @@ import {snsapiBaseAuthorize} from '@/hooks/useWeiXin' import {initJweixinSDK} from '@/utils/jwexin' - onLaunch((options) => { + onLaunch(async (options) => { // 处理直接进入页面路由的情况:如h5直接输入路由、微信小程序分享后进入等 // https://github.com/unibest-tech/unibest/issues/192 console.log('App Launch', options) @@ -17,8 +17,7 @@ } // 微信静默授权 - snsapiBaseAuthorize() - initJweixinSDK() + await initJweixinSDK() }) onShow((options) => { console.log('App Show', options) diff --git a/src/api/city.ts b/src/api/city.ts new file mode 100644 index 0000000..88bd304 --- /dev/null +++ b/src/api/city.ts @@ -0,0 +1,18 @@ +import { http } from '@/http/alova' + +/** + * 获取城市 + */ +export interface ICityParams { + longitude: number + latitude: number +} + +export function getCity(data: ICityParams) { + return http.Post('/api/Area/getArea', + data, + { + meta: { ignoreAuth: true} + } + ) +} \ No newline at end of file diff --git a/src/api/home.ts b/src/api/home.ts index 4f23fae..6302c74 100644 --- a/src/api/home.ts +++ b/src/api/home.ts @@ -4,24 +4,45 @@ import type { IIndexResult } from '@/api/types/home' /** * 获取首页数据 */ -export interface IIndexData { +export interface IIndexParams { id: number } -export function getDecorate(data: IIndexData) { - return http.Get('/api/index/decorate', {params: data}) +export function getDecorate(data: IIndexParams) { + return http.Get('/api/index/decorate', { + params: data, + meta: { ignoreAuth: true} + }) } /** * 获取茶艺师等级 */ export function getTeaSpecialistLevels() { - return http.Post('/api/Teamaster/teamasterLevel') + return http.Post('/api/Teamaster/teamasterLevel', + null, + { + meta: { ignoreAuth: true} + } + ) } /** * 获取茶艺师列表 */ -export function getTeaSpecialist() { - return http.Post('/api/Teamaster/teamasterLevel') +export interface ITeaSpecialistParams { + level_id: string + page: number + size: number + latitude: number + longitude: number +} + +export function getTeaSpecialist(data: ITeaSpecialistParams) { + return http.Post('/api/Teamaster/teamasterList', + data, + { + meta: { ignoreAuth: true } + } + ) } diff --git a/src/api/jwexin.ts b/src/api/jwexin.ts index 8cb84c9..9b24fa6 100644 --- a/src/api/jwexin.ts +++ b/src/api/jwexin.ts @@ -9,5 +9,8 @@ export interface IJweiXinSignature { } export function wxSignature(data: IJweiXinSignature) { - return http.Get('/api/wechat/jsConfig', { params: data }) + return http.Get('/api/wechat/jsConfig', { + params: data, + meta: { ignoreAuth: true }, // 用于切换请求地址 + }) } diff --git a/src/api/login.ts b/src/api/login.ts index 852f4d5..64006cf 100644 --- a/src/api/login.ts +++ b/src/api/login.ts @@ -11,22 +11,12 @@ export interface IWxSnsapiBaseLoginForm { } export function wxSnsapiBaseLogin(data: IWxSnsapiBaseLoginForm) { - return http.Post('/api/login/oaLogin', data, { - meta: { ignoreAuth: true }, // 忽略认证 - }) -} - -/** - * 手机验证码登录 - */ -export interface IPhoneLoginForm { - account: number, - scene: number, - terminal: number -} - -export function phoneLogin(data: IPhoneLoginForm) { - return http.Post('/api/login/oaLogin', data) + return http.Post('/api/login/oaLogin', + data, + { + meta: { ignoreAuth: true } // 忽略认证 + } + ) } /** @@ -38,7 +28,12 @@ export interface ISMSLogin { } export function smsCode(data: ISMSLogin) { - return http.Post('/api/sms/sendCode',data) + return http.Post('/api/sms/sendCode', + data, + { + meta: { ignoreAuth: true } // 忽略认证 + } + ) } /** diff --git a/src/api/tea.ts b/src/api/tea.ts new file mode 100644 index 0000000..1283054 --- /dev/null +++ b/src/api/tea.ts @@ -0,0 +1,20 @@ +import { http } from '@/http/alova' +import type { ITeaSpecialistDetailsResult } from '@/api/types/tea' + +/** + * 获取茶艺师详情 + */ +export interface ITeaSpecialistDetailsParams { + id: number + longitude: number + latitude: number +} + +export function getTeaSpecialistDetails(data: ITeaSpecialistDetailsParams) { + return http.Post('/api/Teamaster/teamasterDetails', + data, + { + meta: { ignoreAuth: true } + } + ) +} diff --git a/src/api/types/home.ts b/src/api/types/home.ts index ccfbde6..21aa9b5 100644 --- a/src/api/types/home.ts +++ b/src/api/types/home.ts @@ -4,3 +4,14 @@ export interface IIndexResult { data: String } + +/** + * 首页列表数据返回 + */ +export interface IIndexListResult { + count: Number + list: Array + more: Number + page: string + size: string +} \ No newline at end of file diff --git a/src/api/types/tea.ts b/src/api/types/tea.ts new file mode 100644 index 0000000..79274d6 --- /dev/null +++ b/src/api/types/tea.ts @@ -0,0 +1,28 @@ +/** + * 茶艺师详情返回结果 + */ +export interface ITeaSpecialistDetailsResult { + teamaster: Array +} + +/** + * 茶艺师详情字段 + */ +export interface ITeaSpecialistDetailsFields { + name: string + star: number + reservation_num: number + distance: number + speed: number + real: { + gender: number + both: number + height: number + weight: number + interests: string + } + teamasterlabel: Array + teamasterLevel: Array + price: number + fare_price: number +} \ No newline at end of file diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index a1e6e4f..8e6fe1e 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -3,7 +3,7 @@