guhongwei 2 vuotta sitten
vanhempi
commit
320a91ab22

+ 1 - 1
.env.development

@@ -3,4 +3,4 @@ VITE_OUT_DIR = "zkzxweb"
 VITE_REQUEST_BASE = ''
 VITE_APP_HOST="http://broadcast.waityou24.cn"
 VITE_APP_PAGE_SIZE=10
-VITE_APP_ROUTER="zkzxweb"
+VITE_APP_ROUTER="web"

+ 1 - 1
.env.production

@@ -3,4 +3,4 @@ VITE_OUT_DIR = "zkzxweb"
 VITE_REQUEST_BASE = ''
 VITE_APP_HOST="http://broadcast.waityou24.cn"
 VITE_APP_PAGE_SIZE=10
-VITE_APP_ROUTER="zkzxweb"
+VITE_APP_ROUTER="web"

+ 34 - 7
src/router/index.ts

@@ -1,4 +1,18 @@
-import { createRouter, createWebHistory } from 'vue-router'
+import { createRouter, createWebHistory } from 'vue-router';
+// 公共
+import common from './module/common';
+// 直播大厅
+import live from './module/live';
+// 科技频道
+import channel from './module/channel';
+// 科技超市
+import market from './module/market';
+// 交流合作
+import interflow from './module/interflow';
+// 创新服务
+import service from './module/service';
+// 科学普及
+import universal from './module/universal';
 const router = createRouter({
   history: createWebHistory(import.meta.env.BASE_URL),
   routes: [
@@ -6,14 +20,27 @@ const router = createRouter({
       path: '/',
       meta: { title: '中科在线(长春)' },
       component: () => import('@/views/homeIndex.vue')
-    }
+    },
+    ...common,
+    // 直播大厅
+    ...live,
+    // 科技频道
+    ...channel,
+    // 科技超市
+    ...market,
+    // 交流合作
+    ...interflow,
+    // 创新服务
+    ...service,
+    // 科学普及
+    ...universal
   ]
-})
+});
 router.beforeEach((to, from, next) => {
   // 赋值标题
-  document.title = `${to.meta.title}`
+  document.title = `${to.meta.title}`;
   // 向下进行
-  next()
-})
+  next();
+});
 
-export default router
+export default router;

+ 7 - 0
src/router/module/channel.ts

@@ -0,0 +1,7 @@
+export default [
+  {
+    path: '/channel',
+    meta: { title: '科技频道' },
+    component: () => import('@/views/channel/index.vue')
+  }
+];

+ 1 - 0
src/router/module/common.ts

@@ -0,0 +1 @@
+export default [];

+ 7 - 0
src/router/module/interflow.ts

@@ -0,0 +1,7 @@
+export default [
+  {
+    path: '/interflow',
+    meta: { title: '交流合作' },
+    component: () => import('@/views/interflow/index.vue')
+  }
+];

+ 7 - 0
src/router/module/live.ts

@@ -0,0 +1,7 @@
+export default [
+  {
+    path: '/live',
+    meta: { title: '直播大厅' },
+    component: () => import('@/views/live/index.vue')
+  }
+];

+ 7 - 0
src/router/module/market.ts

@@ -0,0 +1,7 @@
+export default [
+  {
+    path: '/market',
+    meta: { title: '科技超市' },
+    component: () => import('@/views/market/index.vue')
+  }
+];

+ 7 - 0
src/router/module/service.ts

@@ -0,0 +1,7 @@
+export default [
+  {
+    path: '/service',
+    meta: { title: '创新服务' },
+    component: () => import('@/views/service/index.vue')
+  }
+];

+ 7 - 0
src/router/module/universal.ts

@@ -0,0 +1,7 @@
+export default [
+  {
+    path: '/universal',
+    meta: { title: '科学普及' },
+    component: () => import('@/views/universal/index.vue')
+  }
+];

+ 38 - 0
src/views/channel/index.vue

@@ -0,0 +1,38 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">系统首页</el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  loading.value = false;
+});
+//const search = async (e: { skip: number; limit: number }) => {
+//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
+//  const res: IQueryResult = await testAxios.query(info);
+//  console.log(res);
+//};
+</script>
+<style scoped lang="scss"></style>

+ 41 - 0
src/views/homeIndex copy.vue

@@ -0,0 +1,41 @@
+<template>
+  <div id="homeIndex">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight">
+        <el-col :span="12" class="one">
+          <cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="onSubmit"></cForm>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<script setup lang="ts">
+import type { FormRules } from 'element-plus';
+import type { Ref } from 'vue';
+import { ref, reactive, onMounted } from 'vue';
+import { ElMessage } from 'element-plus';
+import { AdminStore } from '@common/src/stores/admins/admin'; // 角色
+import type { IQueryResult } from '@/util/types.util';
+const admin = AdminStore();
+let form: Ref<any> = ref({});
+// 表单
+let formFields: Ref<any[]> = ref([
+  { label: '账号', model: 'account' },
+  { label: '密码', model: 'password' }
+]);
+const rules = reactive<FormRules>({});
+onMounted(async () => {
+  await search();
+});
+const search = async () => {};
+// 提交
+const onSubmit = async (data) => {
+  let res: IQueryResult = await admin.login(data);
+  if (res.errcode == 0) {
+    ElMessage({ type: `success`, message: `登陆成功` });
+    localStorage.setItem('token', `${res.data}`);
+    console.log(res.data);
+  }
+};
+</script>
+<style scoped lang="scss"></style>

+ 39 - 23
src/views/homeIndex.vue

@@ -1,41 +1,57 @@
 <template>
   <div id="homeIndex">
     <el-row>
-      <el-col :span="24" class="main animate__animated animate__backInRight">
-        <el-col :span="12" class="one">
-          <cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="onSubmit"></cForm>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">
+          <el-button type="primary" v-for="i in list" :key="i._id" @click="toPath(i)">{{ i.name }}</el-button>
         </el-col>
       </el-col>
     </el-row>
   </div>
 </template>
+
 <script setup lang="ts">
-import type { FormRules } from 'element-plus';
+// 基础
 import type { Ref } from 'vue';
-import { ref, reactive, onMounted } from 'vue';
 import { ElMessage } from 'element-plus';
-import { AdminStore } from '@common/src/stores/admins/admin'; // 角色
-import type { IQueryResult } from '@/util/types.util';
-const admin = AdminStore();
-let form: Ref<any> = ref({});
-// 表单
-let formFields: Ref<any[]> = ref([
-  { label: '账号', model: 'account' },
-  { label: '密码', model: 'password' }
-]);
-const rules = reactive<FormRules>({});
+import { onMounted, ref } from 'vue';
+import { useRouter } from 'vue-router';
+// 接口
+import { ModuleStore } from '@common/src/stores/system/module';
+import { MenusStore } from '@common/src/stores/system/menus';
+import type { IQueryResult } from '@/util/types.util'; //
+const moduleAxios = ModuleStore();
+const menusAxios = MenusStore();
+
+// 路由
+const router = useRouter();
+// 加载中
+const loading: Ref<any> = ref(false);
+
+const list: Ref<any> = ref([]);
+
+// 请求
 onMounted(async () => {
+  loading.value = true;
   await search();
+  loading.value = false;
 });
-const search = async () => {};
-// 提交
-const onSubmit = async (data) => {
-  let res: IQueryResult = await admin.login(data);
-  if (res.errcode == 0) {
-    ElMessage({ type: `success`, message: `登陆成功` });
-    localStorage.setItem('token', `${res.data}`);
-    console.log(res.data);
+const search = async () => {
+  let name = import.meta.env.VITE_APP_ROUTER;
+  const res: IQueryResult = await moduleAxios.query({ name: name, is_use: '0' });
+  if (res && res.errcode == '0') {
+    if (res.total > 0) {
+      let moduleInfo = res.data[0];
+      let menusInfo: IQueryResult = await menusAxios.query({ module_id: moduleInfo._id });
+      if (res.errcode == '0') list.value = menusInfo.data;
+    }
+  } else {
+    ElMessage({ message: `${res.errmsg}`, type: 'error' });
   }
 };
+const toPath = (e) => {
+  console.log(e.path);
+  router.push({ path: `${e.path}` });
+};
 </script>
 <style scoped lang="scss"></style>

+ 38 - 0
src/views/interflow/index.vue

@@ -0,0 +1,38 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">系统首页</el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  loading.value = false;
+});
+//const search = async (e: { skip: number; limit: number }) => {
+//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
+//  const res: IQueryResult = await testAxios.query(info);
+//  console.log(res);
+//};
+</script>
+<style scoped lang="scss"></style>

+ 38 - 0
src/views/live/index.vue

@@ -0,0 +1,38 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">直播大厅</el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  loading.value = false;
+});
+//const search = async (e: { skip: number; limit: number }) => {
+//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
+//  const res: IQueryResult = await testAxios.query(info);
+//  console.log(res);
+//};
+</script>
+<style scoped lang="scss"></style>

+ 38 - 0
src/views/market/index.vue

@@ -0,0 +1,38 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">系统首页</el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  loading.value = false;
+});
+//const search = async (e: { skip: number; limit: number }) => {
+//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
+//  const res: IQueryResult = await testAxios.query(info);
+//  console.log(res);
+//};
+</script>
+<style scoped lang="scss"></style>

+ 38 - 0
src/views/service/index.vue

@@ -0,0 +1,38 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">系统首页</el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  loading.value = false;
+});
+//const search = async (e: { skip: number; limit: number }) => {
+//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
+//  const res: IQueryResult = await testAxios.query(info);
+//  console.log(res);
+//};
+</script>
+<style scoped lang="scss"></style>

+ 38 - 0
src/views/universal/index.vue

@@ -0,0 +1,38 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
+        <el-col :span="24" class="one">系统首页</el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+// 基础
+import type { Ref } from 'vue';
+// reactive,
+import { onMounted, ref, getCurrentInstance } from 'vue';
+// 接口
+//import { TestStore } from '@common/src/stores/test';
+//import type { IQueryResult } from '@/util/types.util';
+//const testAxios = TestStore();
+const { proxy } = getCurrentInstance() as any;
+// 加载中
+const loading: Ref<any> = ref(false);
+// 分页数据
+//  const skip = 0;
+//  const limit = proxy.limit;;
+// 请求
+onMounted(async () => {
+  loading.value = true;
+  //  await search({ skip, limit });
+  loading.value = false;
+});
+//const search = async (e: { skip: number; limit: number }) => {
+//  const info = { skip: e.skip, limit: e.limit, ...searchInfo.value  };
+//  const res: IQueryResult = await testAxios.query(info);
+//  console.log(res);
+//};
+</script>
+<style scoped lang="scss"></style>