This commit is contained in:
parent
bfce50f2b5
commit
b61382401f
|
|
@ -17,7 +17,7 @@ pnpm dev:h5 / build:h5 # H5 target
|
|||
|
||||
Other targets follow `pnpm dev:<platform>` / `pnpm build:<platform>` (`alipay`, `swan`, `tt`, `qq`, `jd`, `rn`, `harmony-hybrid`).
|
||||
|
||||
**Running the mini-program:** builds output to `./dist`. Open `./dist` in WeChat DevTools (`project.config.json` already points `miniprogramRoot` there; appId `wx6d4f6f29c41aff93`).
|
||||
**Running the mini-program:** builds output to `./dist`. Open `./dist` in WeChat DevTools (`project.config.json` already points `miniprogramRoot` there; appId `wxf8a8961f30396c19`).
|
||||
|
||||
**There is no test runner and no lint script in `package.json`.** ESLint (`taro/react`) and Stylelint are configured but run manually. The only enforced gate is a Husky `commit-msg` hook running **commitlint** (Conventional Commits) — non-conforming commit messages are rejected.
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"miniprogramRoot": "./dist",
|
||||
"projectname": "corp-mp",
|
||||
"description": "",
|
||||
"appid": "wx6d4f6f29c41aff93",
|
||||
"appid": "wxf8a8961f30396c19",
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": false,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
import { buildFeedbackPayload, COMPLAINT_TYPES } from './feedback'
|
||||
import { buildFeedbackPayload, COMPLAINT_TYPES, getFeedbackImageSrc } from './feedback'
|
||||
|
||||
describe('complaint types', () => {
|
||||
it('uses the five Chinese labels from the design as type values', () => {
|
||||
|
|
@ -13,6 +13,19 @@ describe('complaint types', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('feedback image preview', () => {
|
||||
it('prefers the uploaded URL over an Android temporary file path', () => {
|
||||
expect(getFeedbackImageSrc({
|
||||
url: 'https://cdn.example/a.jpg',
|
||||
preview: 'wxfile://tmp_android_a.jpg',
|
||||
})).toBe('https://cdn.example/a.jpg')
|
||||
})
|
||||
|
||||
it('falls back to the local path before upload completes', () => {
|
||||
expect(getFeedbackImageSrc({ preview: 'wxfile://tmp_a.jpg' })).toBe('wxfile://tmp_a.jpg')
|
||||
})
|
||||
})
|
||||
|
||||
describe('buildFeedbackPayload', () => {
|
||||
it('sends contact, content, images, Chinese type and order identifiers', () => {
|
||||
expect(buildFeedbackPayload({
|
||||
|
|
|
|||
|
|
@ -8,6 +8,10 @@ export const COMPLAINT_TYPES = [
|
|||
|
||||
export type ComplaintType = (typeof COMPLAINT_TYPES)[number]['value']
|
||||
|
||||
export function getFeedbackImageSrc (image: { url?: string, preview?: string }) {
|
||||
return image.url || image.preview || ''
|
||||
}
|
||||
|
||||
export type FeedbackOrder = {
|
||||
order_id?: string
|
||||
out_trade_no?: string
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
describe('parseMiniProgramScheme', () => {
|
||||
it('reads the default weixin business scheme query', () => {
|
||||
expect(parseMiniProgramScheme(DEFAULT_LAUNCH_SCHEME)).toEqual({
|
||||
appId: 'wx6d4f6f29c41aff93',
|
||||
appId: 'wxf8a8961f30396c19',
|
||||
path: 'pages/index/index',
|
||||
scene: '/h/KZ9Q',
|
||||
token: '6224a1fe-d88c-443c-8972-e6a0942d17fd',
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export type LaunchQuery = {
|
|||
}
|
||||
|
||||
export const DEFAULT_LAUNCH_SCHEME =
|
||||
'weixin://dl/business/?appid=wx6d4f6f29c41aff93&path=pages/index/index&query=scene%3D%2Fh%2FKZ9Q%26token%3D6224a1fe-d88c-443c-8972-e6a0942d17fd%26host%3Dnb.batiao8.com%26package%3D10044%26phone%3D17316703138'
|
||||
'weixin://dl/business/?appid=wxf8a8961f30396c19&path=pages/index/index&query=scene%3D%2Fh%2FKZ9Q%26token%3D6224a1fe-d88c-443c-8972-e6a0942d17fd%26host%3Dnb.batiao8.com%26package%3D10044%26phone%3D17316703138'
|
||||
|
||||
export function parseMiniProgramScheme (scheme: string) {
|
||||
const search = scheme.split('?')[1] || ''
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import Taro, { useLoad } from '@tarojs/taro'
|
|||
import { useState } from 'react'
|
||||
import { report, uploadImage } from '@/api/user'
|
||||
import { LOCAL_IMAGES } from '@/lib/assets'
|
||||
import { buildFeedbackPayload, COMPLAINT_TYPES, type ComplaintType } from '@/lib/feedback'
|
||||
import { buildFeedbackPayload, COMPLAINT_TYPES, getFeedbackImageSrc, type ComplaintType } from '@/lib/feedback'
|
||||
import { getOrderDraft } from '@/lib/orderDraft'
|
||||
import { getOrderDisplayName, type OrderLike, type UploadedImage } from '@/lib/order'
|
||||
import './index.scss'
|
||||
|
|
@ -186,7 +186,7 @@ export default function ComplaintPage () {
|
|||
<View className='complaint-uploads'>
|
||||
{images.map((image, index) => (
|
||||
<View className='complaint-upload' key={`${image.id}-${index}`}>
|
||||
<Image className='complaint-upload__image' src={image.preview || image.url} mode='aspectFill' />
|
||||
<Image className='complaint-upload__image' src={getFeedbackImageSrc(image)} mode='aspectFill' />
|
||||
<Image
|
||||
className='complaint-upload__remove'
|
||||
src={LOCAL_IMAGES.close}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ export default function Index () {
|
|||
setInputPhone(session.phone)
|
||||
setContact(pickServiceContact(session.config))
|
||||
setReady(true)
|
||||
if (session.phone) {
|
||||
await queryOrders(session.phone)
|
||||
}
|
||||
} catch (error) {
|
||||
Taro.showToast({
|
||||
title: error instanceof Error ? error.message : '初始化失败',
|
||||
|
|
@ -54,7 +57,7 @@ export default function Index () {
|
|||
}
|
||||
})
|
||||
|
||||
const queryOrders = async (phone: string) => {
|
||||
async function queryOrders (phone: string) {
|
||||
if (!phone) {
|
||||
Taro.showToast({ title: '请输入联系电话', icon: 'none' })
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in New Issue