feat: 新增商家入驻隐私协议页,源码相关的api/utils目录规范化到src,配置vite代理api,axios接口拦截减少一层,添加env.local开发环境变量配置
This commit is contained in:
parent
088c1122c3
commit
8b682bf546
1
.env.local
Normal file
1
.env.local
Normal file
@ -0,0 +1 @@
|
||||
VUE_APP_BASE_URL = https://mall.gpxscs.cn
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@ -9,3 +9,5 @@ docs/_book
|
||||
# TODO: where does this rule come from?
|
||||
test/
|
||||
|
||||
node_modules/
|
||||
.history
|
||||
10
components.d.ts
vendored
10
components.d.ts
vendored
@ -8,25 +8,15 @@ export {}
|
||||
/* prettier-ignore */
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
ElAutocomplete: typeof import('element-plus/es')['ElAutocomplete']
|
||||
ElButton: typeof import('element-plus/es')['ElButton']
|
||||
ElCarousel: typeof import('element-plus/es')['ElCarousel']
|
||||
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
|
||||
ElCascader: typeof import('element-plus/es')['ElCascader']
|
||||
ElCol: typeof import('element-plus/es')['ElCol']
|
||||
ElForm: typeof import('element-plus/es')['ElForm']
|
||||
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||
ElInput: typeof import('element-plus/es')['ElInput']
|
||||
ElOption: typeof import('element-plus/es')['ElOption']
|
||||
ElRadio: typeof import('element-plus/es')['ElRadio']
|
||||
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
|
||||
ElRow: typeof import('element-plus/es')['ElRow']
|
||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||
ElStatistic: typeof import('element-plus/es')['ElStatistic']
|
||||
ElStep: typeof import('element-plus/es')['ElStep']
|
||||
ElSteps: typeof import('element-plus/es')['ElSteps']
|
||||
ElUpload: typeof import('element-plus/es')['ElUpload']
|
||||
FloatingMenu: typeof import('./src/components/floatingMenu.vue')['default']
|
||||
Login: typeof import('./src/components/login.vue')['default']
|
||||
Register: typeof import('./src/components/register.vue')['default']
|
||||
|
||||
23
src/App.vue
23
src/App.vue
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<template v-if="!isFullpage">
|
||||
<div>
|
||||
<HeadMenu @open-login-form="showLoginForm = true" @open-register-form="showRegisterForm = true" />
|
||||
<div class="contain">
|
||||
<router-view class="routerView" />
|
||||
@ -9,17 +10,35 @@
|
||||
</div>
|
||||
<Login :isVisible="showLoginForm" @close-login-form="showLoginForm = false" />
|
||||
<Register :isVisible="showRegisterForm" @close-register-form="showRegisterForm = false" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<router-view class="routerView" />
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch, computed, onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import HeadMenu from '@/views/HeadMenu.vue';
|
||||
|
||||
import Footer from '@/views/Footer.vue';
|
||||
import Login from '@/components/login.vue';
|
||||
import Register from '@/components/register.vue';
|
||||
import Feedback from './components/floatingMenu.vue';
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const showLoginForm = ref(false);
|
||||
const showRegisterForm = ref(false); // 定义控制注册组件显示的变量
|
||||
const fullpageRef = ref(true);
|
||||
|
||||
// 计算属性:根据当前路由的 meta 决定是否显示页头页脚
|
||||
const isFullpage = computed(() => {
|
||||
return route?.meta?.isFullpage || false;
|
||||
});
|
||||
|
||||
fullpageRef.value = isFullpage.value
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
13
src/api/content.ts
Normal file
13
src/api/content.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import http from '@/utils/http';
|
||||
|
||||
export const CONTENT_API = {
|
||||
getAgreement(params) {
|
||||
const str = new URLSearchParams(params).toString();
|
||||
return http({
|
||||
method:'GET',
|
||||
url:`/api/mobile/account/login/protocol?${str}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default CONTENT_API
|
||||
@ -35,7 +35,7 @@
|
||||
import { ref, defineProps, defineEmits, watch, onMounted, onUnmounted } from 'vue';
|
||||
import { useUserStore } from '@/stores/userStore';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { GetLogin, GetSmsCode, GetVerifyCode, GetAccountLogin } from '../../api/login';
|
||||
import { GetLogin, GetSmsCode, GetVerifyCode, GetAccountLogin } from '@/api/login';
|
||||
import { ElMessage } from 'element-plus/es';
|
||||
|
||||
const props = defineProps({
|
||||
|
||||
@ -53,8 +53,8 @@
|
||||
import { ref, defineProps, defineEmits, onMounted, onUnmounted } from 'vue';
|
||||
import { useUserStore } from '@/stores/userStore';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { GetSmsCode, GetLogin } from '../../api/login';
|
||||
import { getApproval_status } from '../../api/login';
|
||||
import { GetSmsCode, GetLogin } from '@/api/login';
|
||||
import { getApproval_status } from '@/api/login';
|
||||
import { ElMessage } from 'element-plus';
|
||||
|
||||
|
||||
|
||||
@ -37,6 +37,14 @@ const routes=[
|
||||
name:'check',
|
||||
component:()=>import('../views/start/check.vue')
|
||||
},
|
||||
{
|
||||
path:'/businessAgreementPrivacy',
|
||||
name:'businessAgreementPrivacy',
|
||||
component:()=>import('@/views/business/agreement/privacy.vue'),
|
||||
meta:{
|
||||
isFullpage: true
|
||||
}
|
||||
},
|
||||
];
|
||||
const router = createRouter({
|
||||
history:createWebHistory(),
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
import axios from "axios";
|
||||
// import store from '@/store'
|
||||
|
||||
const baseURL = "https://mall.gpxscs.cn/mobile";
|
||||
const baseURL = import.meta.env.VUE_APP_BASE_URL;
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: baseURL, // url = base url + request url
|
||||
headers: {
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Content-Type": "application/json-patch+json",
|
||||
// "X-Requested-With": "XMLHttpRequest",
|
||||
// "Content-Type": "application/json",
|
||||
},
|
||||
timeout: 5000, // request timeout
|
||||
});
|
||||
@ -29,7 +29,7 @@ service.interceptors.request.use(
|
||||
// response interceptor
|
||||
service.interceptors.response.use(
|
||||
(response) => {
|
||||
return response;
|
||||
return response.data;
|
||||
},
|
||||
(error) => {
|
||||
if (error.response.status === 401) {
|
||||
@ -67,7 +67,7 @@
|
||||
import { ref, onMounted, watch, onUnmounted } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useUserStore } from '@/stores/userStore';
|
||||
import { getApproval_status } from '../../api/login';
|
||||
import { getApproval_status } from '@/api/login';
|
||||
|
||||
const emits = defineEmits(['open-login-form', 'open-register-form']);
|
||||
|
||||
|
||||
27
src/views/business/agreement/privacy.vue
Normal file
27
src/views/business/agreement/privacy.vue
Normal file
@ -0,0 +1,27 @@
|
||||
<template>
|
||||
<div class="container" v-html="html"></div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import CONTENT_API from '@/api/content';
|
||||
|
||||
const html = ref("")
|
||||
|
||||
const getContentData = async () => {
|
||||
const res = await CONTENT_API.getAgreement({
|
||||
protocols_key: 'joininPrivacyAgreement'
|
||||
});
|
||||
if (res?.status === 200) {
|
||||
html.value = res.data.document;
|
||||
}
|
||||
};
|
||||
|
||||
getContentData()
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.container{
|
||||
padding: 20px;
|
||||
}
|
||||
</style>
|
||||
@ -26,7 +26,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { Plus } from '@element-plus/icons-vue';
|
||||
import { uploadFile } from '../../../api/upload'; // 引入新的 API 方法
|
||||
import { uploadFile } from '@/api/upload'; // 引入新的 API 方法
|
||||
|
||||
const feedbackObj = reactive({
|
||||
describe: '',
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
clickable Avatar: undefined
|
||||
<template>
|
||||
<div class="slider">
|
||||
<div class="slider-container">
|
||||
|
||||
@ -216,10 +216,10 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { getApproval_status, re_apply } from '../../../api/login';
|
||||
import { getApproval_status, re_apply } from '@/api/login';
|
||||
import { onMounted, ref, reactive } from 'vue';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { GetStoreCategories, transformStoreCategories, GetPostion, GetBank, merchApply, GetMerchDetail } from '../../../api/login';
|
||||
import { GetStoreCategories, transformStoreCategories, GetPostion, GetBank, merchApply, GetMerchDetail } from '@/api/login';
|
||||
import { useUserStore } from '@/stores/userStore';
|
||||
import cityData from '../../stores/cityData';
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
|
||||
@ -228,7 +228,7 @@ import type { CityDataStructure } from '../../stores/cityData';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { useUserStore } from '@/stores/userStore';
|
||||
import { Plus } from '@element-plus/icons-vue'
|
||||
import { GetStoreCategories, transformStoreCategories, GetPostion, GetBank, merchApply, GetAppDistrict } from '../../../api/login';
|
||||
import { GetStoreCategories, transformStoreCategories, GetPostion, GetBank, merchApply, GetAppDistrict } from '@/api/login';
|
||||
|
||||
const active = ref(1);
|
||||
const formRef = ref(null);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "api/login.js", "public/xiaofa_font"],
|
||||
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "src/api/login.js", "public/xiaofa_font"],
|
||||
"exclude": ["src/**/__tests__/*"],
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
|
||||
@ -82,5 +82,15 @@ export default defineConfig({
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'https://mall.gpxscs.cn/',
|
||||
changeOrigin: true,
|
||||
secure: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user