This commit is contained in:
Shikong 2023-05-17 23:54:39 +08:00
parent 3efd57d667
commit c2edf0fc92
2 changed files with 13 additions and 3 deletions

View File

@ -83,7 +83,7 @@
</template> </template>
<script setup> <script setup>
import AMapLoader from '@amap/amap-jsapi-loader'; import AMapLoader from '@amap/amap-jsapi-loader';
import {reactive, ref, shallowReadonly, toRaw} from "vue"; import {reactive, ref} from "vue";
import DateTimeSelector from "matrix-middle-service-web/src/components/DateTimeSelector.vue"; import DateTimeSelector from "matrix-middle-service-web/src/components/DateTimeSelector.vue";
import {useQuasar} from "quasar"; import {useQuasar} from "quasar";
import moment from "moment"; import moment from "moment";
@ -91,6 +91,7 @@ import {auth} from "matrix-middle-service-web/src/api/auth/index";
import {locationRecord} from "matrix-middle-service-web/src/api/location/record/index"; import {locationRecord} from "matrix-middle-service-web/src/api/location/record/index";
import {createCanvasDir} from "matrix-middle-service-web/src/views/record/logic/icon"; import {createCanvasDir} from "matrix-middle-service-web/src/views/record/logic/icon";
import {getAvgSpeed, getMaxSpeed} from "matrix-middle-service-web/src/views/record/logic/speed"; import {getAvgSpeed, getMaxSpeed} from "matrix-middle-service-web/src/views/record/logic/speed";
import {randomColorList} from "matrix-middle-service-web/src/views/record/logic/color";
const $q = useQuasar(); const $q = useQuasar();
const COLOR = [ const COLOR = [
'#6090e0', '#30c030', '#d070d0', '#80c0f0', '#f07050', '#ffb900', '#6090e0', '#30c030', '#d070d0', '#80c0f0', '#f07050', '#ffb900',
@ -420,8 +421,7 @@ function drawMap(){
console.log("lines", view.lines) console.log("lines", view.lines)
let colorList = Array.from({ length: view.lines.length }) let colorList = randomColorList(view.lines.length)
.map(() => COLOR[Math.floor(Math.random() * COLOR.length)]);
data.polylines = [] data.polylines = []
view.lines.forEach((_data,index) => { view.lines.forEach((_data,index) => {
let path = _data.map((item) => { let path = _data.map((item) => {

View File

@ -0,0 +1,10 @@
export const COLOR = [
'#6090e0', '#30c030', '#d070d0', '#80c0f0', '#f07050', '#ffb900',
'#37a2da', '#ffdb5c', '#8378ea', '#e7bcf3', '#32c5e9', '#67e0e3',
'#dd6b66', '#759aa0', '#e69d87', '#8dc1a9', '#ea7e53', '#eedd78',
]
export function randomColorList(len:number){
return Array.from({ length: len })
.map(() => COLOR[Math.floor(Math.random() * COLOR.length)]);
}