针对邮储音视频添加测试环境配置

This commit is contained in:
xiaogang 2024-12-26 10:42:19 +08:00
parent cbf12ed872
commit 65f0a33dfe
9 changed files with 62 additions and 29 deletions

View File

@ -1,3 +1,4 @@
NODE_ENV = 'development'
# 兴业优酷
# VITE_BASE_URL = 'http://192.168.110.50:8083'
# 邮储奶茶活动

View File

@ -1,15 +1,10 @@
# 兴业优酷
# VITE_BASE_URL = 'http://192.168.110.50:8083'
# 邮储奶茶活动(测试环境)
# VITE_BASE_URL = 'http://milk.test.api.cdlsxd.cn'
# VITE_YCNC_MERCH_CODE = '100310100018908'
NODE_ENV = 'production'
# 邮储奶茶活动(正式环境)
# VITE_BASE_URL = 'https://milk.api.cdlsxd.cn'
# VITE_YCNC_MERCH_CODE = '100510102303326'
# 邮储音视频活动(测试环境)
VITE_BASE_URL = 'https://gateway.dev.cdlsxd.cn/ycav'
# VITE_YCNC_MERCH_CODE = '100610100019042'
VITE_YCNC_MERCH_CODE = '100310100018908'
# 邮储音视频活动(生产环境)
VITE_BASE_URL = 'https://mv.h5.cdlsxd.cn'
VITE_YCNC_MERCH_CODE = '100510102303326'

10
.env.test Normal file
View File

@ -0,0 +1,10 @@
NODE_ENV = 'test'
# 邮储奶茶活动(测试环境)
# VITE_BASE_URL = 'http://milk.test.api.cdlsxd.cn'
# VITE_YCNC_MERCH_CODE = '100310100018908'
# 邮储音视频活动(测试环境)
VITE_BASE_URL = 'https://gateway.dev.cdlsxd.cn'
VITE_YCNC_MERCH_CODE = '100310100018908'

View File

@ -25,6 +25,7 @@
"build:app-ios": "uni build -p app-ios",
"build:custom": "uni build -p",
"build:h5": "uni build",
"build:h5:test": "uni build --mode test",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu",

View File

@ -1,6 +1,9 @@
import qs from 'qs'
// 请求基准地址
console.log('env------>',import.meta.env);
const baseUrl = import.meta.env.VITE_BASE_URL
@ -9,6 +12,7 @@ const baseUrl = import.meta.env.VITE_BASE_URL
const httpInterceptor = {
// 拦截前触发
invoke(options) {
console.log('拦截前参数--->',options);
// 接口请求支持通过 query 参数配置 queryString
if (options.query) {
const queryStr = qs.stringify(options.query)
@ -30,6 +34,7 @@ const httpInterceptor = {
if (token && !options.noToken) {
options.header.Authorization = `Bearer ${token}`
}
console.log('拦截后参数--->',options);
}
}

View File

@ -4,7 +4,7 @@
:class="{ 'is-checked': detail.isSelected }"
@click="selectEvent"
>
<view class="type-name">{{ detail.product_name }}</view>
<view class="type-name">{{ detail.product_type }}</view>
<view class="flex type-amount">
<view class="flex flex-col flex-justify-end icon"></view>
<view class="num">{{ detail.sell_price }}</view>

View File

@ -10,7 +10,11 @@
<template>
<view class="w-full h-full flex flex-col flex-items-center page">
<view class="wrapper">
<view class="wait" v-if="isWaiting">
<wd-loading :size="40"/>
<text class="wait-text">订单查询中...</text>
</view>
<view class="wrapper" v-if="!isWaiting">
<view class="pro-info">
<view class="title">订单详情</view>
<view class="content flex">
@ -65,7 +69,7 @@
</view>
<view class="line"></view>
</view>
<view class="btns">
<view class="btns" v-if="!isWaiting">
<view
class="btn pwd"
@click="pay(orderDetail)"
@ -93,15 +97,18 @@ import usePay from "./hooks/usePay";
const id = ref("");
const orderNo = ref("");
const orderDetail = reactive({});
const isWaiting = ref(false)
// onshow h5
onShow(() => {
const url = window.location.href;
console.log("url-->", url);
onShow(async () => {
const isPayBack = getQueryString("isPayBack");
if(isPayBack){
isWaiting.value = true
await sleep(3000)
isWaiting.value = false
}
const order_id = getQueryString("order_id");
const order_no = getQueryString("order_no");
const isPayBack = getQueryString("isPayBack");
console.log(order_id, order_no);
if (!order_id && !order_no) return;
id.value = order_id;
orderNo.value = order_no;
@ -114,15 +121,11 @@ const backIndex = () => {
});
};
const viewPwd = (detailData) => {
const { voucher_link } = detailData;
if (voucher_link) {
console.log(`跳转外部链接-->${voucher_link}`);
window.location.href = voucher_link;
} else {
console.error(`voucher_link无有效值`);
function sleep(ms) {
return new Promise((resolve) => {
setTimeout(resolve, ms);
});
}
};
const goRefund = () => {
const { id } = orderDetail;
@ -179,6 +182,21 @@ const getDetail = () => {
</script>
<style lang="scss" scoped>
.wait{
position: absolute;
top:50%;
left:50%;
transform: translate(-50%,-50%);
display: flex;
flex-direction: column;
align-items: center;
.wait-text{
font-weight: 400;
font-size: 28rpx;
color: #333333;
margin-top:20rpx;
}
}
.page {
background-color: #fafafa;
}

View File

@ -2,6 +2,9 @@
import useCode from "../pages/ycnc/hooks/useCode";
import {login} from '../api/ycnc'
//邮储音视频baseURL生产环境
const baseURL = '/ycav'
function http(options) {
uni.showLoading({
title: "加载中",
@ -10,6 +13,7 @@ function http(options) {
return new Promise((resolve, reject) => {
uni.request({
...options,
url:baseURL + options.url,
header: {
//邮储音视频
'content-type': 'application/json',

View File

@ -7,17 +7,16 @@ import dayjs from "dayjs";
import vitePluginRemoveDir from './vite.plugin'; // 自己写的删除插件
import getPages from './custom.page'
import { preprocessCSS } from 'vite'
const {exclude} = getPages();
const excludeStaticModule = exclude.filter(item => item.indexOf('.vue') === -1)
const timeStringNow = dayjs().format("MM-DD HH-mm-ss")
export default defineConfig(({ command, mode }) => {
const { UNI_PLATFORM } = process.env // 得到 mp-weixin, h5, app 等
return {
base:'/ycvideoh5/', //ycysp
// base:'/ycvideoh5/', //ycysp
base:'./',
plugins: [
UniPages({
exclude: ['**/components/**/**.*',...exclude],