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

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' # VITE_BASE_URL = 'http://192.168.110.50:8083'
# 邮储奶茶活动 # 邮储奶茶活动

View File

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

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:app-ios": "uni build -p app-ios",
"build:custom": "uni build -p", "build:custom": "uni build -p",
"build:h5": "uni build", "build:h5": "uni build",
"build:h5:test": "uni build --mode test",
"build:h5:ssr": "uni build --ssr", "build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay", "build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu", "build:mp-baidu": "uni build -p mp-baidu",

View File

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

View File

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

View File

@ -10,7 +10,11 @@
<template> <template>
<view class="w-full h-full flex flex-col flex-items-center page"> <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="pro-info">
<view class="title">订单详情</view> <view class="title">订单详情</view>
<view class="content flex"> <view class="content flex">
@ -65,7 +69,7 @@
</view> </view>
<view class="line"></view> <view class="line"></view>
</view> </view>
<view class="btns"> <view class="btns" v-if="!isWaiting">
<view <view
class="btn pwd" class="btn pwd"
@click="pay(orderDetail)" @click="pay(orderDetail)"
@ -93,15 +97,18 @@ import usePay from "./hooks/usePay";
const id = ref(""); const id = ref("");
const orderNo = ref(""); const orderNo = ref("");
const orderDetail = reactive({}); const orderDetail = reactive({});
const isWaiting = ref(false)
// onshow h5 // onshow h5
onShow(() => { onShow(async () => {
const url = window.location.href; const isPayBack = getQueryString("isPayBack");
console.log("url-->", url); if(isPayBack){
isWaiting.value = true
await sleep(3000)
isWaiting.value = false
}
const order_id = getQueryString("order_id"); const order_id = getQueryString("order_id");
const order_no = getQueryString("order_no"); const order_no = getQueryString("order_no");
const isPayBack = getQueryString("isPayBack");
console.log(order_id, order_no);
if (!order_id && !order_no) return; if (!order_id && !order_no) return;
id.value = order_id; id.value = order_id;
orderNo.value = order_no; orderNo.value = order_no;
@ -114,15 +121,11 @@ const backIndex = () => {
}); });
}; };
const viewPwd = (detailData) => { function sleep(ms) {
const { voucher_link } = detailData; return new Promise((resolve) => {
if (voucher_link) { setTimeout(resolve, ms);
console.log(`跳转外部链接-->${voucher_link}`); });
window.location.href = voucher_link; }
} else {
console.error(`voucher_link无有效值`);
}
};
const goRefund = () => { const goRefund = () => {
const { id } = orderDetail; const { id } = orderDetail;
@ -179,6 +182,21 @@ const getDetail = () => {
</script> </script>
<style lang="scss" scoped> <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 { .page {
background-color: #fafafa; background-color: #fafafa;
} }

View File

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

View File

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