Merge branch 'dev-sws' into dev-yxl

v1.0.0
于肖磊 2024-09-04 17:08:07 +08:00
commit c607ab2984
15 changed files with 123 additions and 76 deletions

View File

@ -1,4 +1,4 @@
![输入图片说明](%E8%A3%85%E4%BF%AE-%E6%A0%87%E9%A2%981-%E9%A1%B5%E9%9D%A2%E8%AE%BE%E7%BD%AE.png)
![输入图片说明](md-demo.png)
# vue3-vite
This template should help get you started developing with Vue 3 in Vite.

BIN
md-demo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -4,7 +4,7 @@ class CouponAPI {
/** 领取优惠券列表 */
static getCoupon(data: any) {
return request({
url: `?s=plugins/index/pluginsname/coupon/pluginscontrol/diyapi/pluginsaction/receivecouponlist`,
url: `plugins/index/pluginsname/coupon/pluginscontrol/diyapi/pluginsaction/receivecouponlist`,
method: 'post',
data,
});

View File

@ -53,7 +53,7 @@ class UrlValueAPI {
/** 获取优惠券列表 */
static getCouponList(data: any) {
return request({
url: `?s=plugins/index/pluginsname/coupon/pluginscontrol/diyapi/pluginsaction/couponlist`,
url: `plugins/index/pluginsname/coupon/pluginscontrol/diyapi/pluginsaction/couponlist`,
method: 'post',
data,
});

View File

@ -5,6 +5,7 @@
</div>
</template>
<script>
import { commonStore } from '@/store';
export default defineComponent({
props: {
modelValue: {
@ -26,11 +27,17 @@ export default defineComponent({
},
type: {
type: String,
default: '1', // 1./2./3./4.
default: 'baidu', // 1.tianditu/2.baidu/3.tencent/4.amap
},
},
emits: ['point'],
setup(props, context) {
const common_store = commonStore();
const common_amap_map_ak = common_store.common.config.common_amap_map_ak;
const common_amap_map_safety_ak = common_store.common.config.common_amap_map_safety_ak;
const common_baidu_map_ak = common_store.common.config.common_baidu_map_ak;
const common_tencent_map_ak = common_store.common.config.common_tencent_map_ak;
const common_tianditu_map_ak = common_store.common.config.common_tianditu_map_ak;
const map = ref(null);
const lng = ref(121.47894);
const lat = ref(31.223);
@ -49,21 +56,21 @@ export default defineComponent({
let script = document.createElement('script');
script.type = 'text/javascript';
script.className = 'loadmap'; // script
if (props.type === '1') {
if (props.type === 'tianditu') {
//
script.src = 'https://api.tianditu.gov.cn/api?v=4.0&tk=bf0676d6b99ee6f7f917640a54af0415';
} else if (props.type === '2') {
script.src = `https://api.tianditu.gov.cn/api?v=4.0&tk=${common_tianditu_map_ak || 'bf0676d6b99ee6f7f917640a54af0415'}`;
} else if (props.type === 'baidu') {
//
script.src = 'https://api.map.baidu.com/getscript?v=3.0&ak=XSdiGjfg3wOHiKjpYEMG6CYA';
} else if (props.type === '3') {
script.src = `https://api.map.baidu.com/getscript?v=3.0&ak=${common_baidu_map_ak || 'XSdiGjfg3wOHiKjpYEMG6CYA'}`;
} else if (props.type === 'tencent') {
//
script.src = 'https://map.qq.com/api/js?v=2.exp&key=IMYBZ-QJ6C3-QPZ3Y-OUKL6-IVU5S-ZYBKA&callback=init';
} else if (props.type === '4') {
script.src = `https://map.qq.com/api/js?v=2.exp&key=${common_tencent_map_ak || 'IMYBZ-QJ6C3-QPZ3Y-OUKL6-IVU5S-ZYBKA'}&callback=init`;
} else if (props.type === 'amap') {
//
script.src = 'https://webapi.amap.com/maps?v=2.0&key=3e92c6bfdd5ddb4aac39ed5e4d0db663';
script.src = `https://webapi.amap.com/maps?v=2.0&key=${common_amap_map_ak || '3e92c6bfdd5ddb4aac39ed5e4d0db663'}`;
}
// 使script.onload
if (props.type === '3') {
if (props.type === 'tencent') {
window.init = () => {
init();
};
@ -80,9 +87,9 @@ export default defineComponent({
document.body.removeChild(loadmap[i]);
}
}
if (props.type === '4') {
if (props.type === 'amap') {
window._AMapSecurityConfig = {
securityJsCode: '6d68c17c7b2a96a0616b1b8c371f391f',
securityJsCode: common_amap_map_safety_ak || '6d68c17c7b2a96a0616b1b8c371f391f',
};
}
document.body.appendChild(script);
@ -93,7 +100,7 @@ export default defineComponent({
let script = document.createElement('script');
script.type = 'text/javascript';
script.className = 'loadmap2'; // script
script.src = 'https://map.qq.com/api/gljs?v=1.exp&key=IMYBZ-QJ6C3-QPZ3Y-OUKL6-IVU5S-ZYBKA&libraries=service';
script.src = `https://map.qq.com/api/gljs?v=1.exp&key=${common_tencent_map_ak || 'IMYBZ-QJ6C3-QPZ3Y-OUKL6-IVU5S-ZYBKA'}&libraries=service`;
let loadmap2 = document.getElementsByClassName('loadmap2');
if (loadmap2) {
// append scriptscript
@ -106,7 +113,7 @@ export default defineComponent({
//
const init = () => {
switch (props.type) {
case '1':
case 'tianditu':
const T = window.T;
//
map.value = new T.Map('map');
@ -135,7 +142,7 @@ export default defineComponent({
});
}
break;
case '2':
case 'baidu':
const BMap = window.BMap;
map.value = new BMap.Map('map', {
enableMapClick: false,
@ -169,7 +176,7 @@ export default defineComponent({
cr.addCopyright({ id: 1, content: '<div class="map-dragging-tips"><span>' + '拖动红色图标直接定位' + '</span></div>', bounds: bs });
}
break;
case '3':
case 'tencent':
const qq_maps = window.qq.maps;
let point3 = new qq_maps.LatLng(lat.value, lng.value);
map.value = new qq_maps.Map('map', {
@ -188,7 +195,7 @@ export default defineComponent({
context.emit('point', lng, lat);
});
break;
case '4':
case 'amap':
const AMap = window.AMap;
map.value = new AMap.Map('map', {
zoomEnable: true,
@ -224,7 +231,7 @@ export default defineComponent({
};
const map_event = (value) => {
switch (props.type) {
case '1':
case 'tianditu':
let geo = new T.Geocoder();
geo.getPoint(value, function (result) {
let point = result.getLocationPoint();
@ -239,7 +246,7 @@ export default defineComponent({
}
});
break;
case '2':
case 'baidu':
//
let geo2 = new window.BMap.Geocoder();
// ,
@ -258,7 +265,7 @@ export default defineComponent({
'全国'
);
break;
case '3':
case 'tencent':
let geo3 = new TMap.service.Geocoder();
geo3.getLocation({ address: value }).then((result) => {
let lnglat = result.result.location;
@ -268,7 +275,7 @@ export default defineComponent({
context.emit('point', lng.value, lat.value);
});
break;
case '4':
case 'amap':
AMap.plugin('AMap.Geocoder', () => {
new AMap.Geocoder().getLocation(value, (status, result) => {
if (status === 'complete' && result.geocodes.length) {

View File

@ -33,7 +33,7 @@
<el-input v-model="form.address" class="link-input" placeholder="请输入地址" type="1" @change="address_change" />
</el-form-item>
<el-form-item label="经纬度">
<maps v-model="map_address" type="4" @point="map_point"></maps>
<maps v-model="map_address" :type="common_map_type" @point="map_point"></maps>
<!-- <t-map v-model="map_address" @point="map_point"></t-map> -->
<!-- <bd-map v-model="map_address" @point="map_point"></bd-map> -->
<!-- <gd-map v-model="map_address" @point="map_point"></gd-map> -->
@ -48,6 +48,9 @@
</template>
<script lang="ts" setup>
import type { FormInstance } from 'element-plus';
import { commonStore } from '@/store';
const common_store = commonStore();
const common_map_type = common_store.common.config.common_map_type || 'baidu';
const props = defineProps({
status: {
type: Boolean,

View File

@ -8,7 +8,7 @@
<div class="coupon-theme-1-content tc" :style="'background-image: url(' + theme_bg_img.url_1 + ');background-size: 100% 100%;'">
<div class="name text-line-1">{{ item.name }}</div>
<div class="price">
<span v-if="item.type == '0'" class="symbol">¥</span>
<span v-if="item.type == '0'" class="symbol">{{ currency_symbol }}</span>
<span class="number">{{ item.discount_value }}</span>
<span v-if="item.type == '1'" class="symbol"></span>
</div>
@ -22,7 +22,7 @@
<div v-for="item in data_list" :key="item" class="item" :style="'background-image: url(' + theme_bg_img.url_2 + ');background-size: 100% 100%;'">
<div class="tc">
<div class="price">
<span v-if="item.type == '0'" class="symbol">¥</span>
<span v-if="item.type == '0'" class="symbol">{{ currency_symbol }}</span>
<span class="number">{{ item.discount_value }}</span>
<span v-if="item.type == '1'" class="symbol"></span>
</div>
@ -38,7 +38,7 @@
<div v-for="item in data_list" :key="item" class="item">
<div class="left">
<div class="price">
<span v-if="item.type == '0'" class="symbol">¥</span>
<span v-if="item.type == '0'" class="symbol">{{ currency_symbol }}</span>
<span class="number">{{ item.discount_value }}</span>
<span v-if="item.type == '1'" class="symbol self-e"></span>
</div>
@ -64,7 +64,7 @@
<div v-for="item in data_list" :key="item" class="item">
<div class="type">通用券</div>
<div class="price">
<span v-if="item.type == '0'" class="symbol">¥</span>
<span v-if="item.type == '0'" class="symbol">{{ currency_symbol }}</span>
<span class="number">{{ item.discount_value }}</span>
<span v-if="item.type == '1'" class="symbol"></span>
</div>
@ -86,7 +86,7 @@
<div v-for="item in data_list" :key="item" class="item">
<div class="left" :style="'background-image: url(' + theme_bg_img.url_3 + ');background-size: 100% 100%;'">
<div class="price">
<span v-if="item.type == '0'" class="symbol">¥</span>
<span v-if="item.type == '0'" class="symbol">{{ currency_symbol }}</span>
<span class="number">{{ item.discount_value }}</span>
<span v-if="item.type == '1'" class="symbol"></span>
</div>
@ -103,7 +103,7 @@
<div v-for="item in data_list" :key="item" class="item">
<div class="top">
<div class="price">
<span v-if="item.type == '0'" class="symbol">¥</span>
<span v-if="item.type == '0'" class="symbol">{{ currency_symbol }}</span>
<span class="number">{{ item.discount_value }}</span>
<span v-if="item.type == '1'" class="symbol"></span>
</div>
@ -120,7 +120,7 @@
<div v-for="item in data_list" :key="item" class="item">
<div class="left">
<div class="price">
<span v-if="item.type == '0'" class="symbol">¥</span>
<span v-if="item.type == '0'" class="symbol">{{ currency_symbol }}</span>
<span class="number">{{ item.discount_value }}</span>
<span v-if="item.type == '1'" class="symbol"></span>
</div>
@ -140,6 +140,9 @@
import { common_styles_computer, gradient_computer, online_url } from '@/utils';
import { isEmpty, cloneDeep } from 'lodash';
import CouponAPI from '@/api/coupon';
import { commonStore } from '@/store';
const common_store = commonStore();
const currency_symbol = common_store.common.config.currency_symbol;
const props = defineProps({
value: {
type: Object,

View File

@ -28,7 +28,7 @@
</el-form-item>
</template>
<template v-else>
<el-form-item label="文章分类">
<el-form-item label="">
<el-select v-model="form.type" multiple collapse-tags placeholder="请选择优惠券类型">
<el-option v-for="item in base_list.coupon_type_list" :key="item.value" :label="item.name" :value="item.value" />
</el-select>
@ -74,7 +74,7 @@ const new_url = ref('');
const base_list = reactive({
data_type_list: [
{ name: '默认', value: '0' },
{ name: '动', value: '1' },
{ name: '动', value: '1' },
],
themeList: Array.from({ length: 7 }, (_, index) => ({
id: String(index + 1),

View File

@ -16,16 +16,21 @@ export const constantRoutes: RouteRecordRaw[] = [
{
path: '/',
component: Layout,
redirect: '/dashboard',
children: [
{
path: 'dashboard',
component: () => import('@/views/dashboard/index.vue'),
name: 'Dashboard',
meta: { title: 'dashboard', icon: 'homepage', affix: true },
},
],
meta: { hidden: true },
},
// {
// path: '/',
// component: Layout,
// redirect: '/dashboard',
// children: [
// {
// path: 'dashboard',
// component: () => import('@/views/dashboard/index.vue'),
// name: 'Dashboard',
// meta: { title: 'dashboard', icon: 'homepage', affix: true },
// },
// ],
// },
];
/**
*

View File

@ -12,6 +12,16 @@ export const commonStore = defineStore('common', () => {
module_list: [] as any[], //---- 模块列表
page_link_list: [] as any[], //---- 页面链接
plugins: {} as any, //---- 插件
config: {
common_amap_map_ak: '',
common_amap_map_safety_ak: '',
common_baidu_map_ak: '',
common_map_type: '',
common_tencent_map_ak: '',
common_tianditu_map_ak: '',
currency_symbol: '',
attachment_host: '',
} as any, // 基础数据配置参数
});
// 存储链接数据
const set_common = (data: any) => {

View File

@ -1,4 +1,8 @@
import { isEmpty } from 'lodash';
import { commonStore } from '@/store';
const { common } = commonStore();
// 定义一组预定义的颜色数组,用于在各种场景中轻松引用这些颜色
// 这些颜色包括从白色到黑色的不同灰度以及一些鲜艳的颜色格式有十六进制、RGB、RGBA、HSV、HSL等
export const predefine_colors = ['#fff', '#ddd', '#ccc', '#999', '#666', '#333', '#000', '#ff4500', '#ff8c00', '#ffd700', '#90ee90', '#00ced1', '#c71585', 'rgba(255, 69, 0, 0.68)', 'rgb(255, 120, 0)', 'hsv(51, 100, 98)', 'hsva(120, 40, 94, 0.5)', 'hsl(181, 100%, 37%)', '#1F93FF', '#c7158577'];
/**
*
@ -67,7 +71,7 @@ export function gradient_handle(color_list: color_list[], direction: string, is_
if (color_list.length == 1) {
container_common_styles += ` ${item.color_percentage || 0}%, ${item.color} 100%`;
} else {
if (typeof item.color_percentage === "number") {
if (typeof item.color_percentage === 'number') {
if (index == color_list.length - 1) {
container_common_styles += ` ${item.color_percentage}%`;
} else {
@ -332,10 +336,11 @@ export const tabs_style = (color: string, style: string | number | boolean | und
* @returns {Promise<string>} PromiseURL
*/
export const online_url = async (directory: string) => {
const attachemnt_host = common.config.attachment_host;
if (import.meta.env.VITE_APP_BASE_API == '/dev-api') {
let temp_data = await import(import.meta.env.VITE_APP_BASE_API == '/dev-api' ? '../../temp.d' : '../../temp_pro.d');
return temp_data.default.temp_attachment_host + directory;
} else {
return get_cookie('attachment_host') + directory;
return attachemnt_host + directory;
}
};

View File

@ -1,6 +1,20 @@
import axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';
import { ElMessage, ElMessageBox } from 'element-plus';
import { ElMessage, ElMessageBox, type MessageHandler } from 'element-plus';
import { get_cookie } from './index';
// 提示拦截
let messageInstance: MessageHandler;
const message_error = (info: string) => {
if (messageInstance) {
messageInstance.close();
}
messageInstance = ElMessage.error(info);
};
// 创建一个状态变量来跟踪是否已经弹出了退出登录的弹窗
const isLogoutModalShown = ref(true);
// 创建 axios 实例
const index = window.location.href.lastIndexOf('?s=');
const pro_url = window.location.href.substring(0, index);
@ -37,23 +51,26 @@ service.interceptors.response.use(
if (code == 0) {
return response.data;
} else if (code == -400) {
ElMessageBox.alert(msg, '温馨提示', {
confirmButtonText: '确定',
showClose: false,
type: 'warning',
}).then(() => {
localStorage.clear(); // @vueuse/core 自动导入
window.location.href = data;
});
if (isLogoutModalShown.value) {
isLogoutModalShown.value = false;
ElMessageBox.alert(msg, '温馨提示', {
confirmButtonText: '确定',
showClose: false,
type: 'warning',
}).then(() => {
localStorage.clear(); // @vueuse/core 自动导入
window.location.href = data;
});
}
} else {
ElMessage.error(msg || message || '系统出错');
message_error(msg || message || '系统出错');
return Promise.reject(new Error(msg || 'Error'));
}
},
(error: any) => {
if (error.response.data) {
const { msg, message } = error.response.data;
ElMessage.error(msg || message || '系统出错');
message_error(msg || message || '系统出错');
}
return Promise.reject(error.message);
}

View File

@ -1,13 +0,0 @@
<template>
<main class="main">这是首页</main>
</template>
<script setup lang="ts"></script>
<style lang="scss" scoped>
.main {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 1rem;
}
</style>

View File

@ -57,11 +57,21 @@ const modelValue = defineModel({ type: Object, default: {} });
// #region --------------------start
const is_custom_dialog = ref(false);
const dialog_visible = ref(false);
watch(dialog_visible, (val) => {
if (val) {
form.value = {
logo: modelValue.value.logo.length > 0 ? [{ url: modelValue.value.logo }] : [],
name: modelValue.value.name,
describe: modelValue.value.describe,
is_enable: modelValue.value.is_enable,
};
}
});
const form = ref({
logo: modelValue.value.logo.length > 0 ? [{ url: modelValue.value.logo }] : [],
name: modelValue.value.name,
describe: modelValue.value.describe,
is_enable: modelValue.value.is_enable,
logo: [] as any[],
name: '',
describe: '',
is_enable: '',
});
const ruleFormRef = ref<FormInstance>();
const rules = reactive<FormRules>({

View File

@ -113,11 +113,11 @@ export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
rollupOptions: {
output: {
// 自定义 chunk 文件的输出路径和文件名格式
chunkFileNames: 'static/admin/default/diy/js/chunk/[name]-[hash].js',
chunkFileNames: 'diy/js/chunk/[name]-[hash].js',
// 自定义 entry chunk 的输出路径和文件名格式
entryFileNames: 'static/admin/default/diy/js/entry/[name]-[hash].js',
entryFileNames: 'diy/js/entry/[name]-[hash].js',
//非js文件夹按照文件类型分类css,png,jpg
assetFileNames: 'static/admin/default/diy/[ext]/[name]-[hash].[ext]',
assetFileNames: 'diy/[ext]/[name]-[hash].[ext]',
},
},
},