gemercheung 2 年之前
父節點
當前提交
d626eed76a

文件差異過大導致無法顯示
+ 538 - 496
pnpm-lock.yaml


+ 0 - 38
src/components.d.ts

@@ -7,50 +7,12 @@ export {}
 
 declare module '@vue/runtime-core' {
   export interface GlobalComponents {
-    AAvatar: typeof import('ant-design-vue/es')['Avatar']
-    AButton: typeof import('ant-design-vue/es')['Button']
-    ACard: typeof import('ant-design-vue/es')['Card']
-    ACol: typeof import('ant-design-vue/es')['Col']
-    AConfigProvider: typeof import('ant-design-vue/es')['ConfigProvider']
-    ADrawer: typeof import('ant-design-vue/es')['Drawer']
-    ADropdown: typeof import('ant-design-vue/es')['Dropdown']
-    AEmpty: typeof import('ant-design-vue/es')['Empty']
-    AForm: typeof import('ant-design-vue/es')['Form']
-    AFormItem: typeof import('ant-design-vue/es')['FormItem']
-    AInput: typeof import('ant-design-vue/es')['Input']
-    AInputNumber: typeof import('ant-design-vue/es')['InputNumber']
     ALayout: typeof import('ant-design-vue/es')['Layout']
     ALayoutContent: typeof import('ant-design-vue/es')['LayoutContent']
-    ALayoutHeader: typeof import('ant-design-vue/es')['LayoutHeader']
-    AList: typeof import('ant-design-vue/es')['List']
-    AListItem: typeof import('ant-design-vue/es')['ListItem']
-    AMenu: typeof import('ant-design-vue/es')['Menu']
-    AMenuItem: typeof import('ant-design-vue/es')['MenuItem']
-    AModal: typeof import('ant-design-vue/es')['Modal']
-    APopover: typeof import('ant-design-vue/es')['Popover']
-    AppstoreOutlined: typeof import('@ant-design/icons-vue')['AppstoreOutlined']
-    ARadioButton: typeof import('ant-design-vue/es')['RadioButton']
-    ARadioGroup: typeof import('ant-design-vue/es')['RadioGroup']
-    ARangePicker: typeof import('ant-design-vue/es')['RangePicker']
-    ARow: typeof import('ant-design-vue/es')['Row']
-    ATable: typeof import('ant-design-vue/es')['Table']
-    ATabPane: typeof import('ant-design-vue/es')['TabPane']
-    ATabs: typeof import('ant-design-vue/es')['Tabs']
-    ATextarea: typeof import('ant-design-vue/es')['Textarea']
-    BarChartOutlined: typeof import('@ant-design/icons-vue')['BarChartOutlined']
-    CloseOutlined: typeof import('@ant-design/icons-vue')['CloseOutlined']
     DataList: typeof import('./components/data-list/index.vue')['default']
-    DownOutlined: typeof import('@ant-design/icons-vue')['DownOutlined']
-    EyeOutlined: typeof import('@ant-design/icons-vue')['EyeOutlined']
-    InfoCircleOutlined: typeof import('@ant-design/icons-vue')['InfoCircleOutlined']
     Loading: typeof import('./components/loading/index.vue')['default']
     LocalePicker: typeof import('./components/localePicker/index.vue')['default']
-    PieChartOutlined: typeof import('@ant-design/icons-vue')['PieChartOutlined']
-    PlusOutlined: typeof import('@ant-design/icons-vue')['PlusOutlined']
     RouterLink: typeof import('vue-router')['RouterLink']
     RouterView: typeof import('vue-router')['RouterView']
-    SearchOutlined: typeof import('@ant-design/icons-vue')['SearchOutlined']
-    UserOutlined: typeof import('@ant-design/icons-vue')['UserOutlined']
-    VerticalAlignTopOutlined: typeof import('@ant-design/icons-vue')['VerticalAlignTopOutlined']
   }
 }

+ 2 - 1
src/store/modules/room.ts

@@ -21,7 +21,8 @@ export type Rooms = Room[]
 export type Room = SRoom & {
   miniCode?: string
   leaderMiniCode?: string
-  scenes: Scenes
+  scenes: Scenes,
+  location?: string
 }
 
 export interface ShareLinkType {

+ 115 - 16
src/views/room/edit-room/index.vue

@@ -73,12 +73,14 @@
               :disabled="isRoomEnd"
             />
           </a-form-item>
+
           <a-form-item label="位置" name="map">
             <a-input
-              v-model:value.trim="current.visitPassword"
-              :placeholder="t('room.form.titleplaceHolder')"
-              :maxlength="15"
+              v-model:value.trim="current.location"
+              placeholder=""
+              :maxlength="50"
               show-count
+              id="location"
               :disabled="isRoomEnd"
             />
             <div style="margin: 10px 0"></div>
@@ -110,6 +112,28 @@
               :disabled="isRoomEnd"
             />
           </a-form-item>
+
+          <a-form-item
+            label="头像"
+            name="title"
+            :rules="[{ required: true, message: '' }]"
+          >
+            <a-upload
+              v-model:file-list="avatarFile"
+              name="file"
+              action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
+              :headers="{
+                authorization: 'authorization-text'
+              }"
+              @change="handleAvatarChange"
+            >
+              <div class="add-item-icon">
+                <a-button shape="circle" class="button" type="primary">
+                  <plus-outlined class="add-room-icon" />
+                </a-button>
+              </div>
+            </a-upload>
+          </a-form-item>
           <!-- <h4>{{ t('room.form.selectScene') }}</h4> -->
           <a-form-item
             :label="t('room.form.addScene')"
@@ -296,6 +320,8 @@ import { addAuthUser } from '@/api'
 import { ExclamationCircleOutlined } from '@ant-design/icons-vue'
 import { useScript } from '@/hook/useScript'
 import { onMounted } from 'vue'
+import type { UploadChangeParam } from 'ant-design-vue'
+
 dayjs.extend(duration)
 // const titleValidator = ref({
 //   validator: (_, value) =>
@@ -326,6 +352,9 @@ export default defineComponent({
     const isRoomEnd = computed(() => props.room?.roomStatus === 2)
     const { getLocale } = useLocale()
     const { t } = useI18n()
+
+    const avatarFile = ref([])
+
     const returnLocale = computed(() => {
       if (unref(getLocale).includes('zh')) {
         return 'zh'
@@ -482,26 +511,81 @@ export default defineComponent({
       // const center = [120.262337, 30.178285]
       const map = new AMap.Map(unref(mapRef), {
         zoom: 15,
+        resizeEnable: true
         // center: center,
-        viewMode: '3D',
-        resizeEnable: true,
-        floorControl: true,
-        showIndoorMap: true
-      })
-
-      AMap.plugin('AMap.Geocoder', function () {
-        var geocoder = new AMap.Geocoder({
-          city: '全国' // city 指定进行编码查询的城市,支持传入城市名、adcode 和 citycode
-        })
-        console.log('geocoder', geocoder)
+        // viewMode: '3D',
+        // resizeEnable: true,
+        // floorControl: true,
+        // showIndoorMap: true
       })
-      console.log('map', map)
+      AMap.plugin(
+        [
+          'AMap.Scale',
+          'AMap.Geocoder',
+          'AMap.Toolbar',
+          'AMap.AutoComplete',
+          'AMap.PlaceSearch',
+          'AMap.Geolocation'
+        ],
+        function () {
+          const autoOptions = {
+            city: '珠海',
+            input: 'location'
+          }
+          const autocomplete = new AMap.Autocomplete(autoOptions)
+          const placeSearch = new AMap.PlaceSearch({
+            city: '珠海', // 默认城市,一定要有,不然没有放大效果
+            map: map // 地图,选中会有放大功能,绑定上面创建的地图即可
+          })
+          AMap.Event.addListener(autocomplete, 'select', function (e: any) {
+            placeSearch.search(e.poi.name)
+            console.log('location', e.poi.location) // 获取选中的的地址的经纬度
+          })
+          var geolocation = new AMap.Geolocation({
+              // 是否使用高精度定位,默认:true
+              enableHighAccuracy: true,
+              // 设置定位超时时间,默认:无穷大
+              timeout: 10000,
+              // 定位按钮的停靠位置的偏移量,默认:Pixel(10, 20)
+              buttonOffset: new AMap.Pixel(10, 20),
+              //  定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
+              zoomToAccuracy: true,
+              //  定位按钮的排放位置,  RB表示右下
+              buttonPosition: 'RB'
+            })
+
+            geolocation.getCurrentPosition()
+            AMap.Event.addListener(geolocation, 'complete', onComplete)
+            AMap.Event.addListener(geolocation, 'error', onError)
+
+            function onComplete(data: any) {
+              console.log('data', data)
+              // data是具体的定位信息
+            }
+
+            function onError(data: any) {
+              console.log('data', data)
+              // 定位出错
+            }
+        }
+      )
     }
 
     onMounted(() => {
       initMap()
     })
 
+    const handleAvatarChange = (info: UploadChangeParam) => {
+      if (info.file.status !== 'uploading') {
+        console.log(info.file, info.fileList)
+      }
+      if (info.file.status === 'done') {
+        message.success(`${info.file.name} file uploaded successfully`)
+      } else if (info.file.status === 'error') {
+        message.error(`${info.file.name} file upload failed.`)
+      }
+    }
+
     return {
       handleNickRegex,
       returnLocale,
@@ -529,7 +613,9 @@ export default defineComponent({
       ExclamationCircleOutlined,
       onRangeChange,
       onCancel,
-      mapRef
+      mapRef,
+      avatarFile,
+      handleAvatarChange
     }
   }
 })
@@ -696,4 +782,17 @@ export default defineComponent({
     margin: 0;
   }
 }
+.add-item-icon {
+  width: 120px;
+  height: 120px;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border: 1px solid #ebedf0;
+  .button {
+    background: linear-gradient(144deg, #00aefb 0%, #0076f6 100%);
+    width: 40px;
+    height: 40px;
+  }
+}
 </style>

+ 1 - 0
src/views/room/edit-room/scene-list.vue

@@ -102,6 +102,7 @@ const selectScenes = () => {
   .button {
     width: 40px;
     height: 40px;
+    line-height: 34px;
     background: linear-gradient(144deg, #00aefb 0%, #0076f6 100%);
   }
 

+ 7 - 3
src/views/scene/list.vue

@@ -55,6 +55,7 @@ import { useSceneStore } from '@/store/modules/scene'
 import DataList from '@/components/data-list/index.vue'
 import type { Scene } from '@/store/modules/scene'
 import { useI18n } from '@/hook/useI18n'
+import { TableColumnsType } from 'ant-design-vue'
 
 const { t } = useI18n()
 
@@ -78,16 +79,19 @@ const filterScenes = computed(() =>
 
 sceneStore.fetch()
 
-const sceneColumns = [
+const sceneColumns: TableColumnsType = [
   {
     title: t('room.form.scene'),
     dataIndex: 'cover',
-    key: 'cover'
+    key: 'cover',
+    width: 100
   },
   {
     title: t('room.form.name'),
     dataIndex: 'title',
-    key: 'title'
+    key: 'title',
+    ellipsis: true,
+    width: 300
   },
   {
     title: t('room.form.time'),

+ 14 - 7
src/views/statistic/tab/tab2.vue

@@ -118,31 +118,38 @@ const columns: TableColumnProps[] = [
   // },
   {
     title: t('room.roomTitle'),
-    dataIndex: 'roomTitle'
+    dataIndex: 'roomTitle',
+    width: 130
   },
   {
     title: t('statistic.relatedScenes'),
-    dataIndex: 'sceneNameListStr'
+    dataIndex: 'sceneNameListStr',
+   
   },
   {
     title: t('statistic.duration'),
-    dataIndex: 'lookTime'
+    dataIndex: 'lookTime',
+    width: 100
   },
   {
     title: t('statistic.createTime'),
-    dataIndex: 'createTime'
+    dataIndex: 'createTime',
+    width: 130
   },
   {
     title: t('statistic.status'),
-    dataIndex: 'roomStatus'
+    dataIndex: 'roomStatus',
+    width: 80
   },
   {
     title: t('statistic.watch'),
-    dataIndex: 'lookManCount'
+    dataIndex: 'lookManCount',
+    width: 70
   },
   {
     title: t('statistic.share'),
-    dataIndex: 'shareCount'
+    dataIndex: 'shareCount',
+    width: 70
   }
 ]