新增成长礼包活动页
32
App.vue
|
|
@ -16,6 +16,9 @@ import request from './utils/request'
|
|||
import {
|
||||
setVersion
|
||||
} from './utils/version.js'
|
||||
import {
|
||||
APP_BACK_BASE_URL
|
||||
} from './utils/appBackBase.js'
|
||||
//初始化一键登录插件
|
||||
const aLiSDKModule = uni.requireNativePlugin('AliCloud-NirvanaPns');
|
||||
export default {
|
||||
|
|
@ -66,38 +69,13 @@ export default {
|
|||
// await setVersion()
|
||||
|
||||
//获取访问路由
|
||||
// 发起 GET 请求
|
||||
let version = uni.getStorageSync('setVersion')
|
||||
let baseUrl
|
||||
await uni.request({
|
||||
url: 'https://api.mrrwlkj.top/api/openPuc/getSjApiUrl', // 接口地址
|
||||
method: 'GET', // 请求方法(默认 GET)
|
||||
header: {
|
||||
'Content-Type': 'application/json', // 请求头
|
||||
'VersionCode': version.VersionCode,
|
||||
'DeviceBrand': version.DeviceBrand,
|
||||
'DeviceType': version.DeviceType
|
||||
},
|
||||
success: (res) => {
|
||||
|
||||
if (res.data.code == 200) {
|
||||
// #ifndef MP-WEIXIN
|
||||
uni.setStorageSync('baseUrl', res.data.data.url)
|
||||
uni.setStorageSync('baseUrl', APP_BACK_BASE_URL)
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.setStorageSync('baseUrl', res.data.data.url)
|
||||
wx.setStorageSync('baseUrl', APP_BACK_BASE_URL)
|
||||
// #endif
|
||||
this.$store.commit("setLocation", true)
|
||||
}
|
||||
console.log('请求成功', res.data);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('请求失败', err);
|
||||
},
|
||||
complete: () => {
|
||||
console.log('请求完成(无论成功失败都会执行)');
|
||||
}
|
||||
});
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
//禁止手机横屏
|
||||
|
|
|
|||
14
pages.json
|
|
@ -31,6 +31,20 @@
|
|||
"enablePullDownRefresh": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/home/growth-package",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/home/growth-package-result",
|
||||
"style": {
|
||||
"navigationBarTitleText": "支付结果",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/message/message",
|
||||
"style": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,167 @@
|
|||
<template>
|
||||
<view class="growth-package-result-page">
|
||||
<custom-navbar
|
||||
title="支付结果"
|
||||
:showBack="true"
|
||||
backgroundColor="#F7F7F7"
|
||||
borderBottom="none"
|
||||
></custom-navbar>
|
||||
|
||||
<view class="result-main">
|
||||
<view class="result-icon" :class="isFail ? 'is-fail' : 'is-success'">
|
||||
<block v-if="isFail">
|
||||
<view class="fail-line"></view>
|
||||
<view class="fail-dot"></view>
|
||||
</block>
|
||||
<view v-else class="success-check"></view>
|
||||
</view>
|
||||
<view class="result-title">{{ resultInfo.title }}</view>
|
||||
<view class="result-desc">{{ resultInfo.desc }}</view>
|
||||
<view class="primary-btn" @tap="handlePrimaryTap">{{ isFail ? "重新支付" : "返回首页" }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CustomNavbar from "@/components/custom-navbar/custom-navbar.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CustomNavbar,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
status: "success",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isFail() {
|
||||
return this.status === "fail";
|
||||
},
|
||||
resultInfo() {
|
||||
if (this.isFail) {
|
||||
return {
|
||||
title: "报名失败",
|
||||
desc: "最后一步出了点问题 请重新支付",
|
||||
};
|
||||
}
|
||||
return {
|
||||
title: "报名成功",
|
||||
desc: "您已完成支付 感谢你对美融融的支持",
|
||||
};
|
||||
},
|
||||
},
|
||||
onLoad(options) {
|
||||
this.status = options.status === "fail" ? "fail" : "success";
|
||||
},
|
||||
methods: {
|
||||
handlePrimaryTap() {
|
||||
if (this.isFail) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/home/growth-package",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.switchTab({
|
||||
url: "/pages/home/home",
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.growth-package-result-page {
|
||||
min-height: 100vh;
|
||||
background: #ffffff;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.result-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 246rpx 40rpx 0;
|
||||
}
|
||||
|
||||
.result-icon {
|
||||
width: 104rpx;
|
||||
height: 104rpx;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.result-icon.is-success {
|
||||
background: #12c76b;
|
||||
}
|
||||
|
||||
.result-icon.is-fail {
|
||||
background: #ff4652;
|
||||
}
|
||||
|
||||
.success-check {
|
||||
width: 44rpx;
|
||||
height: 24rpx;
|
||||
border-left: 8rpx solid #ffffff;
|
||||
border-bottom: 8rpx solid #ffffff;
|
||||
transform: rotate(-45deg);
|
||||
margin-top: -8rpx;
|
||||
}
|
||||
|
||||
.fail-line {
|
||||
width: 8rpx;
|
||||
height: 46rpx;
|
||||
border-radius: 8rpx;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.fail-dot {
|
||||
width: 8rpx;
|
||||
height: 8rpx;
|
||||
margin-left: -8rpx;
|
||||
margin-top: 58rpx;
|
||||
border-radius: 50%;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.result-title {
|
||||
margin-top: 34rpx;
|
||||
font-weight: 600;
|
||||
font-size: 40rpx;
|
||||
color: #333333;
|
||||
line-height: 56rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.result-desc {
|
||||
margin-top: 8rpx;
|
||||
font-weight: 400;
|
||||
font-size: 26rpx;
|
||||
color: #b9b9b9;
|
||||
line-height: 38rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.primary-btn {
|
||||
width: 350rpx;
|
||||
height: 80rpx;
|
||||
margin-top: 144rpx;
|
||||
border: 1rpx solid #ff4b67;
|
||||
border-radius: 40rpx;
|
||||
box-sizing: border-box;
|
||||
background: #ffffff;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 400;
|
||||
font-size: 30rpx;
|
||||
color: #ff4767;
|
||||
line-height: 42rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,348 @@
|
|||
<template>
|
||||
<view class="growth-package-page">
|
||||
<image class="content-image" src="@/static/images/home/growth-package/intro.png" mode="widthFix"></image>
|
||||
<view class="deal-carousel">
|
||||
<swiper class="deal-swiper" autoplay circular :interval="3000" previous-margin="40rpx"
|
||||
next-margin="40rpx" :current="dealCurrentIndex" @change="handleDealChange">
|
||||
<swiper-item v-for="(item, index) in dealSlides" :key="item">
|
||||
<view class="deal-slide" :class="getDealSlideClass(index)">
|
||||
<image class="deal-slide-image" :src="item" mode="aspectFit"></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="deal-indicator">
|
||||
<view class="indicator-track" v-for="(item, index) in dealSlides" :key="item"
|
||||
:class="{ active: index === dealCurrentIndex }"></view>
|
||||
</view>
|
||||
</view>
|
||||
<image class="content-image" src="@/static/images/home/growth-package/plan.png" mode="widthFix"></image>
|
||||
|
||||
<view class="fixed-action" @tap="handlePayTap">
|
||||
<image class="action-image" :src="actionImage" mode="widthFix"></image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from "@/utils/request";
|
||||
|
||||
export default {
|
||||
name: "GrowthPackage",
|
||||
data() {
|
||||
return {
|
||||
dealCurrentIndex: 0,
|
||||
isPaying: false,
|
||||
isJoined: false,
|
||||
dealSlides: [
|
||||
"/static/images/home/growth-package/deal-1.png",
|
||||
"/static/images/home/growth-package/deal-2.png",
|
||||
"/static/images/home/growth-package/deal-3.png",
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
actionImage() {
|
||||
return this.isJoined
|
||||
? "/static/images/home/growth-package/action-success.png"
|
||||
: "/static/images/home/growth-package/action.png";
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
this.getGrowthPackageStatus();
|
||||
},
|
||||
methods: {
|
||||
async getGrowthPackageStatus() {
|
||||
if (!uni.getStorageSync("accessToken")) {
|
||||
this.isJoined = false;
|
||||
return;
|
||||
}
|
||||
if (this.isPaying) return;
|
||||
uni.showLoading({
|
||||
title: "查询报名状态...",
|
||||
mask: true,
|
||||
});
|
||||
try {
|
||||
const res = await request.post(
|
||||
"/sj/growthPackage/status",
|
||||
{},
|
||||
{
|
||||
hideLoading: true,
|
||||
}
|
||||
);
|
||||
this.isJoined = !!(res && res.code === 200 && res.data && Number(res.data.is_joined) === 1);
|
||||
} catch (error) {
|
||||
console.log("growthPackageStatus error", error);
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
handleDealChange(event) {
|
||||
this.dealCurrentIndex = event.detail.current;
|
||||
},
|
||||
getDealSlideClass(index) {
|
||||
const length = this.dealSlides.length;
|
||||
const prevIndex = (this.dealCurrentIndex + length - 1) % length;
|
||||
const nextIndex = (this.dealCurrentIndex + 1) % length;
|
||||
if (index === this.dealCurrentIndex) {
|
||||
return "is-active";
|
||||
}
|
||||
if (index === prevIndex) {
|
||||
return "is-prev";
|
||||
}
|
||||
if (index === nextIndex) {
|
||||
return "is-next";
|
||||
}
|
||||
return "";
|
||||
},
|
||||
handlePayTap() {
|
||||
if (this.isPaying) return;
|
||||
if (this.isJoined) return;
|
||||
if (!uni.getStorageSync("accessToken")) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/blogPopup/blogPopup",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showActionSheet({
|
||||
itemList: ["微信支付", "支付宝支付"],
|
||||
success: (res) => {
|
||||
const payKind = res.tapIndex === 0 ? 2 : 3;
|
||||
this.createGrowthPackagePay(payKind);
|
||||
},
|
||||
});
|
||||
},
|
||||
async createGrowthPackagePay(payKind) {
|
||||
this.isPaying = true;
|
||||
uni.showLoading({
|
||||
title: "支付中...",
|
||||
mask: true,
|
||||
});
|
||||
try {
|
||||
const payRes = await request.post(
|
||||
"/sj/growthPackage/pay",
|
||||
{
|
||||
pay_kind: payKind,
|
||||
},
|
||||
{
|
||||
hideLoading: true,
|
||||
}
|
||||
);
|
||||
if (!payRes || payRes.code !== 200) {
|
||||
uni.hideLoading();
|
||||
this.isPaying = false;
|
||||
if (payRes && payRes.data && (payRes.data.id || payRes.data.number)) {
|
||||
this.goToPayResult("fail", payRes.data);
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: (payRes && payRes.msg) || "支付请求失败",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
const orderInfo = payRes.data || {};
|
||||
if (Number(orderInfo.is_joined) === 1) {
|
||||
uni.hideLoading();
|
||||
this.isPaying = false;
|
||||
this.isJoined = true;
|
||||
this.goToPayResult("success", orderInfo.order || {});
|
||||
return;
|
||||
}
|
||||
const paymentParams = orderInfo.pay_params || orderInfo.orderInfo;
|
||||
if (!paymentParams) {
|
||||
uni.hideLoading();
|
||||
this.isPaying = false;
|
||||
if (orderInfo.id || orderInfo.number) {
|
||||
this.goToPayResult("fail", orderInfo);
|
||||
return;
|
||||
}
|
||||
uni.showToast({
|
||||
title: "支付参数缺失",
|
||||
icon: "none",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.hideLoading();
|
||||
this.requestGrowthPackagePayment(payKind, paymentParams, orderInfo);
|
||||
} catch (error) {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: "支付请求失败",
|
||||
icon: "none",
|
||||
});
|
||||
this.isPaying = false;
|
||||
console.log("growthPackagePay error", error);
|
||||
}
|
||||
},
|
||||
requestGrowthPackagePayment(payKind, paymentParams, orderInfo) {
|
||||
const provider = payKind === 2 ? "wxpay" : "alipay";
|
||||
let payOrderInfo = paymentParams;
|
||||
if (payKind === 2 && paymentParams && typeof paymentParams === "object") {
|
||||
payOrderInfo = {
|
||||
...paymentParams,
|
||||
};
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
if (systemInfo.platform === "ios" && payOrderInfo.appid) {
|
||||
payOrderInfo.appId = payOrderInfo.appid;
|
||||
delete payOrderInfo.appid;
|
||||
}
|
||||
}
|
||||
uni.requestPayment({
|
||||
provider,
|
||||
orderInfo: payOrderInfo,
|
||||
success: () => {
|
||||
this.queryGrowthPackagePay(orderInfo);
|
||||
},
|
||||
fail: (err) => {
|
||||
this.isPaying = false;
|
||||
console.log("growthPackage requestPayment fail", err);
|
||||
this.goToPayResult("fail", orderInfo);
|
||||
},
|
||||
});
|
||||
},
|
||||
async queryGrowthPackagePay(orderInfo) {
|
||||
try {
|
||||
const queryRes = await request.post(
|
||||
"/sj/growthPackage/queryPay",
|
||||
{
|
||||
id: orderInfo.id,
|
||||
number: orderInfo.number,
|
||||
},
|
||||
{
|
||||
hideLoading: true,
|
||||
}
|
||||
);
|
||||
const order = queryRes && queryRes.data && queryRes.data.order;
|
||||
if (queryRes && queryRes.code === 200 && order && Number(order.state) === 2) {
|
||||
this.isJoined = true;
|
||||
this.goToPayResult("success", order);
|
||||
return;
|
||||
}
|
||||
this.goToPayResult("fail", orderInfo);
|
||||
} catch (error) {
|
||||
console.log("growthPackageQueryPay error", error);
|
||||
this.goToPayResult("fail", orderInfo);
|
||||
} finally {
|
||||
this.isPaying = false;
|
||||
}
|
||||
},
|
||||
goToPayResult(status, orderInfo = {}) {
|
||||
const params = [`status=${status}`];
|
||||
if (orderInfo.number) {
|
||||
params.push(`number=${encodeURIComponent(orderInfo.number)}`);
|
||||
}
|
||||
if (orderInfo.pay_money || orderInfo.order_money) {
|
||||
params.push(`money=${encodeURIComponent(orderInfo.pay_money || orderInfo.order_money)}`);
|
||||
}
|
||||
uni.redirectTo({
|
||||
url: `/pages/home/growth-package-result?${params.join("&")}`,
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background: #150903;
|
||||
}
|
||||
|
||||
.growth-package-page {
|
||||
min-height: 100vh;
|
||||
padding-bottom: 259rpx;
|
||||
background: #150903;
|
||||
|
||||
.content-image {
|
||||
display: block;
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
.deal-carousel {
|
||||
position: relative;
|
||||
width: 750rpx;
|
||||
height: 1342rpx;
|
||||
background: #000000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.deal-swiper {
|
||||
width: 750rpx;
|
||||
height: 1280rpx;
|
||||
background: #000000;
|
||||
}
|
||||
|
||||
.deal-slide {
|
||||
position: relative;
|
||||
width: 670rpx;
|
||||
height: 1280rpx;
|
||||
background: #000000;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.deal-slide-image {
|
||||
display: block;
|
||||
width: 670rpx;
|
||||
height: 1280rpx;
|
||||
}
|
||||
|
||||
.deal-slide.is-prev,
|
||||
.deal-slide.is-next {
|
||||
height: 1169rpx;
|
||||
margin-top: 56rpx;
|
||||
}
|
||||
|
||||
.deal-slide.is-prev .deal-slide-image,
|
||||
.deal-slide.is-next .deal-slide-image {
|
||||
position: absolute;
|
||||
top: -56rpx;
|
||||
}
|
||||
|
||||
.deal-slide.is-prev .deal-slide-image {
|
||||
right: 10rpx;
|
||||
border-top-right-radius: 20rpx;
|
||||
border-bottom-right-radius: 20rpx;
|
||||
}
|
||||
|
||||
.deal-slide.is-next .deal-slide-image {
|
||||
left: 10rpx;
|
||||
border-top-left-radius: 20rpx;
|
||||
border-bottom-left-radius: 20rpx;
|
||||
}
|
||||
|
||||
.deal-indicator {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 62rpx;
|
||||
column-gap: 8rpx;
|
||||
background: #000000;
|
||||
}
|
||||
|
||||
.indicator-track {
|
||||
width: 146rpx;
|
||||
height: 8rpx;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(255, 255, 255, 0.42);
|
||||
}
|
||||
|
||||
.indicator-track.active {
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.fixed-action {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 20;
|
||||
width: 750rpx;
|
||||
height: 259rpx;
|
||||
background: #150903;
|
||||
}
|
||||
|
||||
.action-image {
|
||||
display: block;
|
||||
width: 750rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -20,6 +20,10 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<view class="home-banner" @tap="goToGrowthPackage">
|
||||
<image class="home-banner-img" src="@/static/images/home/banner.png" mode="aspectFill"></image>
|
||||
</view>
|
||||
|
||||
<view class="setup-modal-mask" v-if="showSetupModal" catchtouchmove="true">
|
||||
<view class="setup-modal-content">
|
||||
<image class="modal-bg"
|
||||
|
|
@ -472,6 +476,11 @@ export default {
|
|||
});
|
||||
}
|
||||
},
|
||||
goToGrowthPackage() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/home/growth-package'
|
||||
});
|
||||
},
|
||||
// 弹窗中的快捷跳转功能
|
||||
closeSetupModal() {
|
||||
this.showSetupModal = false;
|
||||
|
|
@ -1100,7 +1109,7 @@ page {
|
|||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 40rpx;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.user-info {
|
||||
display: flex;
|
||||
|
|
@ -1203,6 +1212,23 @@ page {
|
|||
}
|
||||
}
|
||||
|
||||
.home-banner {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
width: 710rpx;
|
||||
height: 266rpx;
|
||||
margin-left: -4rpx;
|
||||
margin-bottom: 24rpx;
|
||||
border-radius: 24rpx;
|
||||
overflow: hidden;
|
||||
|
||||
.home-banner-img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.settlement-guide {
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 486 KiB |
|
After Width: | Height: | Size: 509 KiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 3.4 MiB |
|
After Width: | Height: | Size: 1.4 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 10 MiB |
|
After Width: | Height: | Size: 18 MiB |
|
|
@ -0,0 +1 @@
|
|||
export const APP_BACK_BASE_URL = "http://test.mrrwlkj.top";
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { getToken, setToken, removeToken } from "./auth";
|
||||
import { setVersion } from "../utils/version.js";
|
||||
import { getBaseUrl } from "../utils/version.js";
|
||||
import { APP_BACK_BASE_URL } from "./appBackBase.js";
|
||||
|
||||
let baseURL;
|
||||
setVersion();
|
||||
|
|
@ -84,51 +84,14 @@ const responseInterceptor = async (options, response, resolve, reject) => {
|
|||
// 请求方法
|
||||
const request = async (options, isUpdate) => {
|
||||
// 合并配置
|
||||
let url = uni.getStorageSync("baseUrl");
|
||||
let url = APP_BACK_BASE_URL;
|
||||
uni.setStorageSync("baseUrl", APP_BACK_BASE_URL);
|
||||
if (uni.getStorageSync("setVersion").VersionCode == "") {
|
||||
setVersion();
|
||||
}
|
||||
|
||||
if (!url) {
|
||||
await new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: "https://api.mrrwlkj.top/api/openPuc/getSjApiUrl", // 接口地址
|
||||
method: "GET", // 请求方法(默认 GET)
|
||||
header: {
|
||||
"Content-Type": "application/json", // 请求头
|
||||
VersionCode: uni.getStorageSync("setVersion").VersionCode,
|
||||
DeviceBrand: uni.getStorageSync("setVersion").DeviceBrand,
|
||||
DeviceType: uni.getStorageSync("setVersion").DeviceType,
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.code == 200) {
|
||||
uni.setStorageSync("baseUrl", res.data.data.url);
|
||||
url = res.data.data.url;
|
||||
resolve(url);
|
||||
}
|
||||
console.log("请求成功", res.data);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log("请求失败", err);
|
||||
},
|
||||
complete: () => {
|
||||
console.log("请求完成(无论成功失败都会执行)");
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
baseURL = url; // 发布到生产环境时,此处代码会被摇树移除掉。
|
||||
baseURL = "http://test.mrrwlkj.top"; // 发布到生产环境时,此处代码会被摇树移除掉。
|
||||
//baseURL = 'http://dev.mrrwlkj.top'; // 发布到生产环境时,此处代码会被摇树移除掉。
|
||||
// baseURL = "https://app.mrrweb.com.cn";
|
||||
} else {
|
||||
baseURL = url; // 发布到生产环境时,此处代码会被摇树移除掉。
|
||||
baseURL = "http://test.mrrwlkj.top"; // 发布到生产环境时,此处代码会被摇树移除掉。
|
||||
//baseURL = 'http://dev.mrrwlkj.top'; // 发布到生产环境时,此处代码会被摇树移除掉。
|
||||
// baseURL = "https://app.mrrweb.com.cn";
|
||||
|
||||
baseURL = url;
|
||||
if (process.env.NODE_ENV !== "development") {
|
||||
console.log("生产环境");
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +113,10 @@ const request = async (options, isUpdate) => {
|
|||
options = {
|
||||
...config,
|
||||
...options,
|
||||
url: !isUpdate ? `${config.baseURL}${options.url}` : options.url,
|
||||
url:
|
||||
!isUpdate && !/^https?:\/\//i.test(options.url)
|
||||
? `${config.baseURL}${options.url}`
|
||||
: options.url,
|
||||
};
|
||||
|
||||
// 请求拦截
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
|
||||
import { APP_BACK_BASE_URL } from './appBackBase.js'
|
||||
|
||||
let VersionCode = '';
|
||||
let DeviceType = '';
|
||||
let platform = '';
|
||||
|
|
@ -60,30 +62,6 @@ export function setVersion() {
|
|||
}
|
||||
|
||||
export async function getBaseUrl() {
|
||||
let version = uni.getStorageSync('setVersion')
|
||||
await uni.request({
|
||||
url: 'https://api.mrrwlkj.top/api/openPuc/getSjApiUrl', // 接口地址
|
||||
method: 'GET', // 请求方法(默认 GET)
|
||||
header: {
|
||||
'Content-Type': 'application/json', // 请求头
|
||||
'VersionCode': version.VersionCode,
|
||||
'DeviceBrand': version.DeviceBrand,
|
||||
'DeviceType': version.DeviceType
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.code == 200) {
|
||||
uni.setStorageSync('baseUrl', res.data.data.url)
|
||||
// store.commit('setBaseUrl', res.data.data.url)
|
||||
}
|
||||
return res.data.data.url;
|
||||
console.log('请求成功', res.data);
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log('请求失败', err);
|
||||
return 'http://60.247.146.5:93';
|
||||
},
|
||||
complete: () => {
|
||||
console.log('请求完成(无论成功失败都会执行)');
|
||||
}
|
||||
});
|
||||
uni.setStorageSync('baseUrl', APP_BACK_BASE_URL)
|
||||
return APP_BACK_BASE_URL
|
||||
}
|
||||