Commit 83afa45d by 前端

Merge branch 'v3.0.0' into 'master'

V3.0.0

See merge request !1
2 parents 34651bdd 8abac9a9
Showing 92 changed files with 1112 additions and 100 deletions
...@@ -488,6 +488,22 @@ ...@@ -488,6 +488,22 @@
"tslib": "^2.0.3" "tslib": "^2.0.3"
} }
}, },
"echarts": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/echarts/-/echarts-5.4.0.tgz",
"integrity": "sha512-uPsO9VRUIKAdFOoH3B0aNg7NRVdN7aM39/OjovjO9MwmWsAkfGyeXJhK+dbRi51iDrQWliXV60/XwLA7kg3z0w==",
"requires": {
"tslib": "2.3.0",
"zrender": "5.4.0"
},
"dependencies": {
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
}
}
},
"error-ex": { "error-ex": {
"version": "1.3.2", "version": "1.3.2",
"resolved": "https://registry.npmmirror.com/error-ex/-/error-ex-1.3.2.tgz", "resolved": "https://registry.npmmirror.com/error-ex/-/error-ex-1.3.2.tgz",
...@@ -1425,6 +1441,21 @@ ...@@ -1425,6 +1441,21 @@
"resolved": "https://registry.npmmirror.com/yaml/-/yaml-1.10.2.tgz", "resolved": "https://registry.npmmirror.com/yaml/-/yaml-1.10.2.tgz",
"integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==",
"dev": true "dev": true
},
"zrender": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/zrender/-/zrender-5.4.0.tgz",
"integrity": "sha512-rOS09Z2HSVGFs2dn/TuYk5BlCaZcVe8UDLLjj1ySYF828LATKKdxuakSZMvrDz54yiKPDYVfjdKqcX8Jky3BIA==",
"requires": {
"tslib": "2.3.0"
},
"dependencies": {
"tslib": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz",
"integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="
}
}
} }
} }
} }
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
}, },
"dependencies": { "dependencies": {
"axios": "^0.27.2", "axios": "^0.27.2",
"echarts": "^5.4.0",
"js-sha1": "^0.6.0", "js-sha1": "^0.6.0",
"lib-flexible": "^0.3.2", "lib-flexible": "^0.3.2",
"md5": "^2.3.0", "md5": "^2.3.0",
......
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:59:01
* @LastEditors: huyue
* @LastEditTime: 2022-10-28 17:10:10
*/
module.exports = { module.exports = {
"plugins": { "plugins": {
"postcss-pxtorem": { "postcss-pxtorem": {
rootValue: 37.5, // 75 表示 750 设计稿,37.5 表示 37.5 表示 375 设计稿 rootValue: 75, // 75 表示 750 设计稿,37.5 表示 37.5 表示 375 设计稿
unitPrecision: 6, // 计算结果保留 6 位小数 unitPrecision: 6, // 计算结果保留 6 位小数
selectorBlackList: ['.no-rem', 'no-rem'], // 要忽略的选择器并保留为px selectorBlackList: ['.no-rem', 'no-rem'], // 要忽略的选择器并保留为px
propList: ['*'], // 可以从 px 更改为 rem 的属性 感叹号开头的不转化 propList: ['*'], // 可以从 px 更改为 rem 的属性 感叹号开头的不转化
......
<template> <template>
<router-view /> <router-view />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup></script>
</script>
<style> <style>
.flex-grow { .flex-grow {
flex-grow: 1; flex-grow: 1;
......
<svg width="128" height="128" xmlns="http://www.w3.org/2000/svg">
<path
d="M127.88 73.143c0 1.412-.506 2.635-1.518 3.669-1.011 1.033-2.209 1.55-3.592 1.55h-17.887c0 9.296-1.783 17.178-5.35 23.645l16.609 17.044c1.011 1.034 1.517 2.257 1.517 3.67 0 1.412-.506 2.635-1.517 3.668-.958 1.033-2.155 1.55-3.593 1.55-1.438 0-2.635-.517-3.593-1.55l-15.811-16.063a15.49 15.49 0 0 1-1.196 1.06c-.532.434-1.65 1.208-3.353 2.322a50.104 50.104 0 0 1-5.192 2.974c-1.758.87-3.94 1.658-6.546 2.364-2.607.706-5.189 1.06-7.748 1.06V47.044H58.89v73.062c-2.716 0-5.417-.367-8.106-1.102-2.688-.734-5.003-1.631-6.945-2.692a66.769 66.769 0 0 1-5.268-3.179c-1.571-1.057-2.73-1.94-3.476-2.65L33.9 109.34l-14.611 16.877c-1.066 1.14-2.344 1.711-3.833 1.711-1.277 0-2.422-.434-3.434-1.304-1.012-.978-1.557-2.187-1.635-3.627-.079-1.44.333-2.705 1.236-3.794l16.129-18.51c-3.087-6.197-4.63-13.644-4.63-22.342H5.235c-1.383 0-2.58-.517-3.592-1.55S.125 74.545.125 73.132c0-1.412.506-2.635 1.518-3.668 1.012-1.034 2.21-1.55 3.592-1.55h17.887V43.939L9.308 29.833c-1.012-1.033-1.517-2.256-1.517-3.669 0-1.412.505-2.635 1.517-3.668 1.012-1.034 2.21-1.55 3.593-1.55s2.58.516 3.593 1.55l13.813 14.106h67.396l13.814-14.106c1.012-1.034 2.21-1.55 3.592-1.55 1.384 0 2.581.516 3.593 1.55 1.012 1.033 1.518 2.256 1.518 3.668 0 1.413-.506 2.636-1.518 3.67l-13.814 14.105v23.975h17.887c1.383 0 2.58.516 3.593 1.55 1.011 1.033 1.517 2.256 1.517 3.668l-.005.01zM89.552 26.175H38.448c0-7.23 2.489-13.386 7.466-18.469C50.892 2.623 56.92.082 64 .082c7.08 0 13.108 2.541 18.086 7.624 4.977 5.083 7.466 11.24 7.466 18.469z"
/>
</svg>
\ No newline at end of file \ No newline at end of file
// 已结束
.box-report {
display: flex;
flex-wrap: wrap;
font-size: 22px;
text-align: center;
background: linear-gradient(0deg, #ffe1c8 0%, #fff2e0 100%);
border-radius: 10px;
padding: 10px;
margin-top: 30px;
.p-t-10 {
padding-top: 10px;
}
.report-item {
// display: flex;
// justify-content: center;
width: calc((100% - 5px) / 3);
.icon {
display: inline-block;
width: 50px;
height: 50px;
}
.icon-1 {
background: url("@/assets/images/activityReport/1.png") no-repeat;
background-size: 50px;
}
.icon-2 {
background: url("@/assets/images/activityReport/2.png") no-repeat;
background-size: 50px;
}
.icon-3 {
background: url("@/assets/images/activityReport/3.png") no-repeat;
background-size: 50px;
}
.icon-4 {
background: url("@/assets/images/activityReport/4.png") no-repeat;
background-size: 50px;
}
.icon-5 {
background: url("@/assets/images/activityReport/5.png") no-repeat;
background-size: 50px;
}
.icon-6 {
background: url("@/assets/images/activityReport/6.png") no-repeat;
background-size: 50px;
}
.report-name {
margin-bottom: 5px;
font-weight: 400;
color: #333333;
line-height: 32px;
}
.report-value {
display: inline-flex;
color: #ff333a;
align-items: flex-end;
margin-bottom: 10px;
.report-number {
font-size: 36px;
font-weight: 600;
margin-right: 8px;
line-height: 40px;
}
.report-number:last-child {
margin-right: 0;
}
.report-unit {
display: inline-block;
line-height: 36px;
}
}
}
.border-right {
border-right: 1px solid rgba(255, 208, 171, 0.8);
}
.border-bottom {
border-bottom: 1px solid rgba(255, 208, 171, 0.8);
}
}
.finish-activty {
margin-top: 50px;
text-align: center;
min-height: 85px;
.activty-text {
display: inline-block;
background: linear-gradient(0deg, #ffd7b7 0%, #ffebdb 100%);
border-radius: 8px;
padding: 13px 21px;
width: 460px;
font-size: 24px;
font-weight: 500;
color: #262525;
line-height: 32px;
.activty-flag {
color: #ff363b;
font-size: 32px;
font-weight: 500;
}
}
}
.icon-horn {
position: absolute;
bottom: 20px;
left: 0;
width: 157px;
height: 131px;
}
.icon-fireworks {
position: absolute;
bottom: 35px;
right: 4px;
width: 275px;
height: 205px;
}
.vs-bg {
position: absolute;
top: 44px;
width: 687px;
height: 356px;
z-index: 0;
}
.vs-box {
display: flex;
position: relative;
width: 687px;
.vs-item {
width: 50%;
text-align: center;
.vs-title {
font-size: 28px;
font-weight: 600;
color: #333333;
line-height: 32px;
}
.vs-content {
margin-top: 16px;
padding: 24px 30px;
.content-item {
display: flex;
font-size: 22px;
font-weight: 400;
color: #333333;
line-height: 22px;
margin-bottom: 15px;
.content-label {
margin-right: 30px;
}
.content-value {
color: #ff333a;
font-size: 22px;
.content-number {
display: inline-block;
min-width: 100px;
text-align: left;
font-size: 36px;
font-weight: 600;
font-style: italic;
}
}
}
.left-content {
background: linear-gradient(90deg, rgba(255, 211, 177, 0.7) 0%, rgba(255, 226, 205, 0) 100%);
// opacity: 0.7;
border-radius: 22px;
padding: 14px 20px 8px;
}
.right-content {
background: linear-gradient(270deg, rgba(255, 167, 152, 0.6) 0%, rgba(254, 177, 164, 0) 100%);
// opacity: 0.6;
border-radius: 22px;
padding: 14px 20px 8px;
display: flex;
justify-content: flex-end;
}
}
}
}
.summary {
font-size: 30px;
font-weight: 600;
color: #333333;
line-height: 30px;
text-align: center;
width: 100%;
margin-top: 40px;
margin-bottom: 10px;
}
.vs-tip {
display: flex;
justify-content: center;
font-size: 22px;
font-weight: 400;
text-align: center;
color: #333333;
line-height: 34px;
margin-bottom: -1px;
div {
width: 578px;
}
}
.box-body-head {
display: flex;
padding: 29px 0 21px 0;
font-size: 28px;
font-weight: 600;
color: #333333;
div {
flex: 1;
text-align: center;
}
}
.box-body-wrap {
display: flex;
justify-content: center;
&-vessel {
width: 50%;
height: 374px;
background: linear-gradient(0deg, #ffefe2 0%, #fff6ea 100%);
box-shadow: 0px 0px 10px 0px rgba(255, 193, 88, 0.2);
border-radius: 10px;
&:nth-child(1) {
margin-right: 13px;
}
.box-rate {
width: 203px;
height: 56px;
img {
width: 100%;
height: 100%;
}
}
.icon {
width: 8px;
height: 8px;
background: #ff664b;
border-radius: 50%;
margin-right: 10px;
}
.brand-wrap-container {
margin-top: 20px;
}
.brand-wrap {
margin: 0 24px 24px 30px;
}
.brand-text {
font-size: 20px;
font-weight: 400;
color: #333333;
align-items: center;
margin-bottom: 20px;
}
}
.box-body-details {
margin: 30px 35px 0px;
.info {
margin-bottom: 34px;
display: flex;
align-items: center;
justify-content: space-around;
.info-text {
min-width: 109px;
font-size: 22px;
font-weight: 400;
color: #333333;
text-align: left;
white-space: nowrap;
}
span {
font-size: 36px;
font-family: PingFang SC;
font-weight: 600;
font-style: italic;
color: #ff333a;
line-height: 32px;
min-width: 130px;
text-align: left;
label {
font-size: 22px;
font-weight: 400;
color: #ff343a;
line-height: 32px;
margin-left: 8px;
}
}
}
.icon {
width: 8px;
height: 8px;
background: #ff664b;
border-radius: 50%;
margin-right: 11px;
&.color_f {
background: #ffc154;
}
}
.statistical-text {
font-size: 20px;
font-weight: 400;
color: #333333;
align-items: center;
width: 70%;
text-align: left;
margin: 2px auto 19px auto;
span {
flex: 1;
}
}
}
}
.box-body-summary {
display: flex;
flex-direction: column;
align-items: center;
margin-top: 50px;
text-align: center;
.title {
font-size: 30px;
font-weight: 600;
color: #333333;
line-height: 30px;
margin-bottom: 14px;
}
.content {
// text-align: center;
font-size: 22px;
font-weight: 400;
color: #333333;
line-height: 34px;
width: 578px;
div {
}
}
}
#app { #app {
position: relative; position: relative;
width: 100%;
height: 100vh;
// background-color: #F8F6F5;
z-index: 1;
overflow-y: auto;
} }
.gray-code { .bg {
font-size: 14px; position: absolute;
color: #bcbcbc; left: 0;
font-weight: 400; // right: 0;
line-height: 20px; top: 0;
// bottom: 0;
width: 100%;
z-index: -1;
// height: 100%;
} }
.code { .x-center {
color: #FB7034; position: absolute;
left: 50%;
transform: translateX(-50%);
}
.mrg-22{
margin:0 22px;
}
.flex{
display:flex;
}
.mgb19{
margin-bottom:19px;
} }
\ No newline at end of file \ No newline at end of file
$good-color: #ffd2b2;
.product-box {
top: 395px;
display: inline-block;
background: url("@/assets/images/goodNews/line-bg.png");
background-repeat: repeat-x;
background-size: 4px 57px;
width: auto;
// margin: 0 43px;
font-size: 23px;
color: $good-color;
line-height: 30px;
}
.product-name {
position: relative;
padding: 14px 0;
box-sizing: border-box;
div {
// width: 100%;
box-sizing: border-box;
max-width: 425px;
white-space: nowrap;
padding: 0 15px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.product-icon {
position: absolute;
width: 30px;
height: 57px;
}
.icon-left {
left: -29px;
top: 0;
}
.icon-right {
right: -29px;
top: 0;
}
.store-name {
top: 466px;
color: $good-color;
font-size: 26px;
font-weight: 500;
}
.employee-avatar {
top: 700px;
width: 124px;
height: 124px;
border-radius: 50%;
}
.ribbon {
top: 775px;
img {
width: 610px;
height: 70px;
}
&-content {
position: relative;
}
&-text {
display: flex;
bottom: 7px;
color: $good-color;
font-size: 22px;
height: 30px;
line-height: 30px;
span {
display: inline-block;
vertical-align: middle;
text-align: center;
}
span:first-child {
display: inline-block;
// transform: rotate(6deg);
}
span:last-child {
display: inline-block;
// transform: rotate(-6deg);
}
}
&-other-text {
display: flex;
justify-content: center;
span {
display: inline-block;
max-width: 180px;
font-weight: 800;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
&-name {
flex: 1;
vertical-align: -webkit-baseline-middle;
// line-height: 46px;
padding: 0 12px;
font-weight: 800;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.ranking {
top: 1123px;
color: $good-color;
width: 405px;
}
.sales {
display: flex;
align-items: baseline;
top: 850px;
color: $good-color;
font-size: 30px;
font-weight: 600;
// text-shadow: 0px 2px 5px rgba(50, 0, 0, 0.3);
div {
background-image: linear-gradient(-18deg, #ffb376 0%, #ffe6af 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.number {
display: inline-block;
font-size: 100px;
flex: 1;
padding: 0 6px;
font-weight: 800;
font-style: italic;
}
}
.table {
&-box {
padding-top: 4px;
font-size: 20px;
}
&-header {
display: flex;
align-items: center;
height: 45px;
opacity: 0.7;
}
&-th,
&-td {
width: 20%;
text-align: center;
}
&-body {
width: 100%;
}
&-item {
display: flex;
align-items: center;
height: 40px;
margin-bottom: 16px;
background-color: #830e13;
border-radius: 20px;
}
// &-item:nth-child(odd) {
// background-color: #830e13;
// border-radius: 20px;
// }
&-avatar {
width: 30px;
height: 30px;
border-radius: 50%;
}
&-td {
&:first-child {
display: flex;
align-items: center;
justify-content: center;
}
position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.sales-number {
font-size: 32px;
font-weight: 600;
}
.first-ranking {
position: relative;
img {
width: 40px;
height: 33px;
}
.ranking-number {
color: #ffffff;
}
}
.ranking-bg {
width: 26px;
height: 26px;
background-color: #bf1c20;
border-radius: 50%;
}
.ranking-number {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
\ No newline at end of file \ No newline at end of file
import { App } from '@vue/runtime-dom'
import Component from './index.vue'
export default {
install (app: App) {
app.component('EchartBox', Component)
}
}
<!--
* @Description:
* @Author: huyue
* @Date: 2022-10-14 18:32:54
* @LastEditors: 前端 qianduan01@didihu.com.cn
* @LastEditTime: 2022-10-26 17:41:24
-->
<template>
<div :ref="id" class="canvas"></div>
</template>
<script lang="ts" setup>
import { onMounted, ref } from "vue";
// 按需引入 echarts
import * as echarts from "echarts";
import { PropType, watch } from "@vue/runtime-core";
let chart: any = null;
const client = ref();
const props = defineProps({
colors: {
type: Array as PropType<string[]>,
default: () => ["#FFC154", "#FF9671"],
},
value: {
type: Array,
default: [],
},
id: {
type: String,
default: "",
},
height: {
type: String,
default: "160px",
},
});
const id = (el: HTMLElement) => {
if (el) {
client.value = el;
}
};
onMounted(() => {
chart = echarts.init(client.value);
chart.setOption(getChartSetOption());
window.addEventListener("resize", resizeHandler);
});
watch(props, (count, prevCount) => {
chart = echarts.init(client.value);
chart.setOption(getChartSetOption());
window.addEventListener("resize", resizeHandler);
});
const resizeHandler = () => {
if (chart) {
chart.resize();
}
};
const getChartSetOption = () => {
console.log(props.value);
var option = {
color: props.colors,
series: [
{
type: "pie",
radius: ["40%", "88%"],
center: ["50%", "50%"],
avoidLabelOverlap: false,
label: {
formatter: "{d}%",
position: "inside",
fontSize: 10,
color: "#ffffff",
},
emphasis: {
label: {
show: false,
},
},
labelLine: {
show: false,
},
data: props.value,
},
],
};
return option;
};
</script>
<style scoped>
.canvas {
width: 100%;
height: 160px;
}
</style>
import { App } from '@vue/runtime-dom'
import Component from './index.vue'
export default {
install (app: App) {
app.component('ReportTable', Component)
}
}
<!--
* @Description: 表格页面
* @Author: huyue
* @Date: 2022-10-10 16:21:55
* @LastEditors: huyue
* @LastEditTime: 2022-10-20 17:47:04
-->
<template>
<div class="table-box ranking">
<div class="table-header">
<div
class="table-th"
v-for="(item, index) in data.tableHeader"
:key="index"
:style="{ width: `${100 / data.column}%` }"
>
{{ item.name }}
</div>
</div>
<div class="table-body">
<div
class="table-item"
v-for="(item, index) in data.tableData"
:key="index"
>
<template v-for="(it, idx) in data.tableHeader" :key="idx">
<template v-if="it.prop === 'index'">
<template v-if="index < 3">
<div
class="table-td first-ranking"
:style="{ width: `${100 / data.column}%` }"
>
<img :src="getImageUrl(data.medals[index])" alt="" />
<span class="ranking-number" style="top: 44%">{{
index + 1
}}</span>
</div>
</template>
<template v-else>
<div class="table-td" :style="{ width: `${100 / data.column}%` }">
<span class="ranking-bg"></span>
<span class="ranking-number">{{ index + 1 }}</span>
</div>
</template>
</template>
<template v-else>
<div class="table-td" :style="{ width: `${100 / data.column}%` }">
{{ item[it.prop] }}
</div>
</template>
</template>
<!-- <div class="table-td">{{ item.departement }}</div>
<div class="table-td">{{ item.departement }}</div>
<div class="table-td">{{ item.departement }}</div>
<div class="table-td">{{ item.name }}</div>
<div class="table-td sales-number">{{ item.salesNumber }}</div> -->
</div>
</div>
</div>
</template>
<script lang="ts">
import { defineComponent, computed, reactive } from "vue";
interface Props {
iconClass: string;
className: string;
tableData: object;
tableHeader: object;
}
export default defineComponent({
name: "ReportTable",
props: ["tableData", "tableHeader"],
setup(props: Props) {
console.log(props.tableData);
console.log(props.tableHeader);
const data = reactive({
tableData: props.tableData,
tableHeader: props.tableHeader,
medals: ["first", "second", "third"],
column: Object.values(props.tableHeader).length,
});
return {
data,
getImageUrl(name: any) {
return new URL(`./images/${name}.png`, import.meta.url).href;
},
};
},
});
</script>
<style lang="scss" scoped>
.table {
&-box {
width: 100%;
padding: 20px 0;
font-size: 20px;
}
&-header {
display: flex;
align-items: center;
height: 56px;
background: linear-gradient(0deg, #ffe1c8 0%, #fff2e0 100%);
border-radius: 8px;
font-size: 22px;
font-weight: 500;
color: #333333;
}
&-th,
&-td {
// width: 20%;
text-align: center;
}
&-body {
width: 100%;
}
&-item {
display: flex;
align-items: center;
height: 60px;
border-bottom: 1px solid rgba(255, 142, 67, 0.15);
}
&-td {
&:first-child {
display: flex;
display: flex;
align-items: center;
justify-content: center;
}
position: relative;
font-size: 20px;
font-weight: 500;
color: #333333;
// line-height: 18px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.first-ranking {
position: relative;
img {
width: 40px;
height: 33px;
}
.ranking-number {
color: #ffffff;
}
}
.ranking-bg {
width: 26px;
height: 26px;
background: linear-gradient(0deg, #ff2f37 0%, #ff9a77 100%);
opacity: 0.3;
border-radius: 50%;
}
.ranking-number {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #ae5648;
}
</style>
import { App } from '@vue/runtime-dom'
import Component from './index.vue'
export default {
install (app: App) {
app.component('SvgIcon', Component)
}
}
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2022-10-13 10:13:46
*/
import { createApp } from 'vue' import { createApp } from 'vue'
import store from './store' import store from './store'
import axios from 'axios' import axios from 'axios'
// import apis from './api/index' // import apis from './api/index'
import router, { setupRouter } from './router' import router, { setupRouter } from './router'
import App from './App.vue' import App from './App.vue'
import SvgIcon from 'comps/SvgIcon/index.vue'
import 'lib-flexible/flexible' import 'lib-flexible/flexible'
import 'utils/rem' import 'utils/rem'
import fetchConfig from './utils/config' import fetchConfig from './utils/config'
...@@ -14,7 +20,11 @@ const app = createApp(App) ...@@ -14,7 +20,11 @@ const app = createApp(App)
let vConsole: object = {} let vConsole: object = {}
import { components } from './libs/vant' import { components } from './libs/vant'
components.forEach(component => app.use(component)); components.forEach(component => app.use(component));
app.component('svg-icon', SvgIcon) // 自动注册全局组件
const modules = import.meta.globEager('./components/**/index.ts')
for (const path in modules) {
app.use(modules[path].default)
}
fetchConfig().then(res => { fetchConfig().then(res => {
// axios.defaults.baseURL = res.request.baseURL // axios.defaults.baseURL = res.request.baseURL
......
import { readFileSync, readdirSync } from 'fs'
let idPerfix = ''
const svgTitle = /<svg([^>+].*?)>/
const clearHeightWidth = /(width|height)="([^>+].*?)"/g
const hasViewBox = /(viewBox="[^>+].*?")/g
const clearReturn = /(\r)|(\n)/g
function findSvgFile(dir) {
const svgRes = []
const dirents = readdirSync(dir, {
withFileTypes: true
})
for (const dirent of dirents) {
if (dirent.isDirectory()) {
svgRes.push(...findSvgFile(dir + dirent.name + '/'))
} else {
const svg = readFileSync(dir + dirent.name)
.toString()
.replace(clearReturn, '')
.replace(svgTitle, ($1, $2) => {
// console.log(++i)
// console.log(dirent.name)
let width = 0
let height = 0
let content = $2.replace(clearHeightWidth, (s1, s2, s3) => {
if (s2 === 'width') {
width = s3
} else if (s2 === 'height') {
height = s3
}
return ''
})
if (!hasViewBox.test($2)) {
content += `viewBox="0 0 ${width} ${height}"`
}
return `<symbol id="${idPerfix}-${dirent.name.replace('.svg', '')}" ${content}>`
})
.replace('</svg>', '</symbol>')
svgRes.push(svg)
}
}
return svgRes
}
export const svgBuilder = (path, perfix = 'icon') => {
if (path === '') return
idPerfix = perfix
const res = findSvgFile(path)
// console.log(res.length)
// const res = []
return {
name: 'svg-transform',
transformIndexHtml(html) {
return html.replace(
'<body>',
`
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position: absolute; width: 0; height: 0">
${res.join('')}
</svg>
`
)
}
}
}
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2022-10-19 11:19:00
*/
import HelloWorld from 'comps/HelloWorld.vue' import HelloWorld from 'comps/HelloWorld.vue'
const staticRoutes = Object.freeze([ const staticRoutes = Object.freeze([
...@@ -8,6 +15,30 @@ const staticRoutes = Object.freeze([ ...@@ -8,6 +15,30 @@ const staticRoutes = Object.freeze([
title: '喜报', title: '喜报',
backgroundColor: '#F8F6F5' backgroundColor: '#F8F6F5'
} }
},
{
path: '/goodNews',
component: () => import('views/crowdfunding/goodNews.vue'),
meta: {
title: '喜报',
backgroundColor: '#F8F6F5'
}
},
{
path: '/activiting',
component: () => import('views/crowdfunding/activiting.vue'),
meta: {
title: '进行中战报',
backgroundColor: '#FE3C41'
}
},
{
path: '/activited',
component: () => import('views/crowdfunding/activited.vue'),
meta: {
title: '已结束战报',
backgroundColor: '#FE3C41'
}
} }
]) ])
......
/*
* @Description: 配置
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2022-10-14 16:45:59
*/
const fetchConfig = function (isEnv = true) { const fetchConfig = function (isEnv = true) {
return window.fetch('https://oss-config.test.glsx.com.cn/mock/618cb9331072f92988f05a23/wx/integral-config', {}).then(res => res.json()) return window.fetch('https://oss-config.test.glsx.com.cn/mock/618cb9331072f92988f05a23/wx/h5-config', {}).then(res => res.json())
} }
// const $mockConfig = await fetchConfig() // const $mockConfig = await fetchConfig()
export default fetchConfig export default fetchConfig
\ No newline at end of file \ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:59:01
* @LastEditors: huyue
* @LastEditTime: 2022-10-29 14:54:02
*/
let baseSize = 37.5 let baseSize = 37.5
function setRem() { function setRem() {
const scale = document.documentElement.clientWidth / 375 const scale = document.documentElement.clientWidth / 375
document.documentElement.style.fontSize = baseSize * Math.min(scale, 2) + 'px' document.documentElement.style.fontSize = baseSize * Math.min(scale, 3) + 'px'
}
function throttle(func, wait) {
let timeout
return function () {
if (!timeout) {
timeout = setTimeout(function () {
func()
timeout = null
}, wait)
}
}
} }
setRem() setRem()
window.onresize = () => { window.onresize = throttle(() => {
setRem() setRem()
}
\ No newline at end of file \ No newline at end of file
}, 1000)
\ No newline at end of file \ No newline at end of file
import http from './http' import http from './http'
import { useUserStore } from '../store/user' import { useUserStore } from '../store/user'
const PATH = 'rop-scrm-renewal/router' const PATH = 'rop-scrm-shopmall/router'
const req: any = (url: string, data: any = {}, returnAll = false, method = 'POST', ) => { const req: any = (url: string, data: any = {}, returnAll = false, method = 'POST', ) => {
let sessionId = useUserStore().getSession let sessionId = useUserStore().getSession
// let sessionId = '2dfdf8ff-fe50-4b07-bfd4-bdaec96ad717' // let sessionId = '2dfdf8ff-fe50-4b07-bfd4-bdaec96ad717'
if (sessionId) data.loginSessionId = sessionId // if (sessionId) data.loginSessionId = sessionId
data.method = url data.method = url
const options = { const options = {
url: PATH, url: PATH,
......
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2022-10-20 10:12:09
*/
import sha1 from 'sha1' import sha1 from 'sha1'
import qs from 'qs' import qs from 'qs'
export const Util = { export const Util = {
...@@ -25,6 +32,12 @@ export const Util = { ...@@ -25,6 +32,12 @@ export const Util = {
}, []) }, [])
collect.sign = sha1(secret + str.join('') + secret).toUpperCase() collect.sign = sha1(secret + str.join('') + secret).toUpperCase()
return collect return collect
},
rgb: function(){//rgb颜色随机
const r = Math.floor(Math.random()*256);
const g = Math.floor(Math.random()*256);
const b = Math.floor(Math.random()*256);
return `rgb(${r},${g},${b})`;
} }
} }
......
...@@ -3,8 +3,132 @@ ...@@ -3,8 +3,132 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-10-10 15:26:23 * @Date: 2022-10-10 15:26:23
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2022-10-10 15:36:14 * @LastEditTime: 2022-10-25 17:51:32
--> -->
<template> <template>
<div>喜报</div> <img class="bg" src="@/assets/images/goodNews/bg.png" alt="" />
<div class="product-box x-center">
<div class="product-name">
<img
class="icon-left product-icon"
src="@/assets/images/goodNews/icon-left.png"
alt=""
/>
<div>{{ data.storeInfo.goodsName }}</div>
<img
class="icon-right product-icon"
src="@/assets/images/goodNews/icon-right.png"
alt=""
/>
</div>
</div>
<div class="store-name x-center">{{ data.storeInfo.merchantName }}</div>
<img class="employee-avatar x-center" :src="data.storeInfo.avatar" alt="" />
<div class="ribbon x-center">
<div class="ribbon-content">
<img src="@/assets/images/goodNews/ribbon.png" alt="" />
<div class="ribbon-text x-center">
<template v-if="data.storeInfo.type == 2">
{{ data.storeInfo.department }}
<span class="ribbon-name">{{ data.storeInfo.name }}</span>
为团队助力
</template>
<template v-if="data.storeInfo.type == 1">
<div class="ribbon-other-text">
<span>{{ data.storeInfo.name }}</span
>为团队助力
</div>
</template>
</div>
</div>
</div>
<div class="sales x-center">
<div>第</div>
<div class="number">{{ data.storeInfo.orderCount }}</div>
<div>单</div>
</div>
<div class="table-box ranking x-center">
<div class="table-header">
<div class="table-th">排名</div>
<div class="table-th">头像</div>
<div class="table-th">部门</div>
<div class="table-th">姓名</div>
<div class="table-th">单量</div>
</div>
<div class="table-body">
<div
class="table-item"
v-for="(item, index) in data.storeInfo.orderRankList"
:key="index"
>
<template v-if="index < 3">
<div class="table-td first-ranking">
<img :src="getImageUrl(data.medals[index])" alt="" />
<span class="ranking-number" style="top: 44%">{{ index + 1 }}</span>
</div>
</template>
<template v-else>
<div class="table-td">
<span class="ranking-bg"></span>
<span class="ranking-number">{{ index + 1 }}</span>
</div>
</template>
<div class="table-td">
<img class="table-avatar" :src="item.avator" alt="" />
</div>
<div class="table-td">{{ item.department }}</div>
<div class="table-td">{{ item.name }}</div>
<div class="table-td sales-number">{{ item.orderCount }}</div>
</div>
</div>
</div>
</template> </template>
<script lang="ts" setup>
import { reactive, onMounted } from "vue";
import req from "../../utils/request";
import { useRoute } from "vue-router";
const route = useRoute();
interface params {
activityId?: number | string;
orderCode?: number | string;
}
type listStyle = {
avator?: string;
department?: string;
name?: string;
orderCount?: number;
};
let query: params = {};
const data = reactive({
medals: ["first", "second", "third"],
storeInfo: {
merchantName: "",
goodsName: "",
orderCount: "",
name: "",
orderRankList: [],
department: "",
},
});
const getInfo = async () => {
data.storeInfo = await req(
"scrm.api.shopmall.activity.good.report.param",
query
);
};
const getImageUrl = (name: any) => {
return new URL(`./images/${name}.png`, import.meta.url).href;
};
onMounted(() => {
if (route.query) {
query = route.query;
getInfo();
}
});
</script>
<style lang="scss" scoped>
@import "src/assets/styles/goodNews.scss";
</style>
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2022-10-24 10:10:51
*/
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import styleImport, { VantResolve } from 'vite-plugin-style-import'; import styleImport, { VantResolve } from 'vite-plugin-style-import';
import path from 'path' import path from 'path'
import { svgBuilder } from './src/plugins/svgBuilder'
const resolve = (dir: string) => path.join(__dirname, dir) const resolve = (dir: string) => path.join(__dirname, dir)
// https://vitejs.dev/config/ // https://vitejs.dev/config/
...@@ -10,7 +16,6 @@ export default defineConfig({ ...@@ -10,7 +16,6 @@ export default defineConfig({
base: './', base: './',
plugins: [ plugins: [
vue(), vue(),
[svgBuilder('./src/assets/icons/svg/')], // 这里已经将src/icons/svg/下的svg全部导入,无需再单独导入
styleImport({ styleImport({
resolves: [VantResolve()], resolves: [VantResolve()],
libs: [ libs: [
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!