Commit 990f4a72be0c0e5ac744d9f9ae858eb54c70a082

Authored by 杨泽宇
1 parent 09881819

换接口baseurl

.env.development
1 NODE_ENV = 'development' 1 NODE_ENV = 'development'
2 VITE_APP_TITLE='中国网+智慧社区平台' 2 VITE_APP_TITLE='中国网+智慧社区平台'
3 -VITE_BASE_URL = 'https://cmstest.cnlive.com' 3 +VITE_BASE_URL = 'http://test.community.cnlive.com/'
4 VITE_PUBLIC_PATH = './' 4 VITE_PUBLIC_PATH = './'
5 \ No newline at end of file 5 \ No newline at end of file
.env.production
1 NODE_ENV = 'production' 1 NODE_ENV = 'production'
2 VITE_APP_TITLE='中国网+智慧社区平台' 2 VITE_APP_TITLE='中国网+智慧社区平台'
3 -VITE_BASE_URL = 'https://cms.cnlive.com' 3 +VITE_BASE_URL = 'http://community.cnlive.com'
4 VITE_PUBLIC_PATH = './' 4 VITE_PUBLIC_PATH = './'
5 \ No newline at end of file 5 \ No newline at end of file
.env.staging
1 NODE_ENV = 'staging' 1 NODE_ENV = 'staging'
2 VITE_APP_TITLE='中国网+智慧社区平台' 2 VITE_APP_TITLE='中国网+智慧社区平台'
3 -VITE_BASE_URL = 'https://cmstest.cnlive.com' 3 +VITE_BASE_URL = 'http://test.community.cnlive.com/'
4 VITE_PUBLIC_PATH = './' 4 VITE_PUBLIC_PATH = './'
5 \ No newline at end of file 5 \ No newline at end of file
README.md
@@ -37,10 +37,11 @@ cnlive-community-web-vue 中国网+智慧社区平台 @@ -37,10 +37,11 @@ cnlive-community-web-vue 中国网+智慧社区平台
37 ## 发布方式 37 ## 发布方式
38 38
39 ## 试用地址 39 ## 试用地址
40 - * [测试环境](http://test.community.web.cnlive.com/#/dashboard "测试环境") 40 + * [测试环境](http://testweb.community.cnlive.com/#/dashboard "测试环境")
41 41
42 ## 参考文档 42 ## 参考文档
43 + [项目仓库](http://bj.gitlab.cnlive.com/cnlive_project/cnlive-community-web-vue "项目仓库") 43 + [项目仓库](http://bj.gitlab.cnlive.com/cnlive_project/cnlive-community-web-vue "项目仓库")
  44 ++ [API接口文档](http://test.community.web.cnlive.com/doc.html "API接口文档")
44 45
45 ## 项目架构 46 ## 项目架构
46 * dist 部署包 47 * dist 部署包
src/api/property/index.ts 0 → 100644
  1 +import request from '../request'
  2 +
  3 +/**
  4 + * @description 物业列表
  5 + * @function propertyList
  6 + */
  7 +export function propertyList (params) {
  8 + for (const i in params) {
  9 + if (!(params[i] + '').trim()) {
  10 + delete params[i]
  11 + }
  12 + }
  13 + return request({
  14 + method: 'get',
  15 + url: '/property/list',
  16 + params: {
  17 + page: 1,
  18 + pageSize: 10
  19 + }
  20 + })
  21 +}
  22 +
  23 +/**
  24 + * @description 新增物业
  25 + * @function propertyAdd
  26 + */
  27 +export function propertyAdd (data) {
  28 + return request({
  29 + method: 'post',
  30 + url: '/property/add',
  31 + data: data
  32 + })
  33 +}
  34 +
  35 +/**
  36 + * @description 修改物业状态
  37 + * @function propertyStatus
  38 + */
  39 +export function propertyStatus (params) {
  40 + return request({
  41 + method: 'post',
  42 + url: '/property/updateStatus',
  43 + params: params
  44 + })
  45 +}
0 \ No newline at end of file 46 \ No newline at end of file
src/api/resident/index.ts 0 → 100644
  1 +import request from '../request'
  2 +
  3 +/**
  4 + * @description 居民列表
  5 + * @function residentList
  6 + */
  7 +export function residentList (params) {
  8 + for (const i in params) {
  9 + if (!(params[i] + '').trim()) {
  10 + delete params[i]
  11 + }
  12 + }
  13 + return request({
  14 + method: 'get',
  15 + url: '/resident/residentList',
  16 + params: {
  17 + page: 1,
  18 + pageSize: 10
  19 + }
  20 + })
  21 +}
  22 +
  23 +/**
  24 + * @description 新增住户
  25 + * @function propertyAdd
  26 + */
  27 +export function residentAdd (data) {
  28 + return request({
  29 + method: 'post',
  30 + url: '/resident/insert',
  31 + data: data
  32 + })
  33 +}
0 \ No newline at end of file 34 \ No newline at end of file
src/api/tengxi/index.ts
@@ -11,4 +11,15 @@ export function getUserInfo(id) { @@ -11,4 +11,15 @@ export function getUserInfo(id) {
11 url: '/user/list', 11 url: '/user/list',
12 params: { id } 12 params: { id }
13 }) 13 })
  14 +}
  15 +
  16 +export function propertyList () {
  17 + return request({
  18 + method: 'get',
  19 + url: '/property/list',
  20 + params: {
  21 + page: 1,
  22 + pageSize: 10
  23 + }
  24 + })
14 } 25 }
15 \ No newline at end of file 26 \ No newline at end of file
src/components/Pagination/index.vue
@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 * @author Tengxi 5 * @author Tengxi
6 */ 6 */
7 7
8 -import { scrollTo } from '@/utils/scroll' 8 +import { scrollTo } from "@/utils/scroll";
9 9
10 // TIP 每个属性都必传,不带默认值 10 // TIP 每个属性都必传,不带默认值
11 // defineProps<{ 11 // defineProps<{
@@ -43,7 +43,7 @@ const props = withDefaults(defineProps&lt;Props&gt;(), { @@ -43,7 +43,7 @@ const props = withDefaults(defineProps&lt;Props&gt;(), {
43 * @description 每页内容条数变化响应 43 * @description 每页内容条数变化响应
44 */ 44 */
45 const handleSizeChange = (val) => { 45 const handleSizeChange = (val) => {
46 - scrollTo(0, 800) 46 + scrollTo(0, 800);
47 emit("pageChange", props.currentPage, val, props.tagName); 47 emit("pageChange", props.currentPage, val, props.tagName);
48 }; 48 };
49 /** 49 /**
@@ -51,7 +51,7 @@ const handleSizeChange = (val) =&gt; { @@ -51,7 +51,7 @@ const handleSizeChange = (val) =&gt; {
51 * @description 当前页码变化响应 51 * @description 当前页码变化响应
52 */ 52 */
53 const handleCurrentChange = (val) => { 53 const handleCurrentChange = (val) => {
54 - scrollTo(0, 800) 54 + scrollTo(0, 800);
55 emit("pageChange", val, props.pageSize, props.tagName); 55 emit("pageChange", val, props.pageSize, props.tagName);
56 }; 56 };
57 const emit = defineEmits<{ 57 const emit = defineEmits<{
@@ -60,14 +60,22 @@ const emit = defineEmits&lt;{ @@ -60,14 +60,22 @@ const emit = defineEmits&lt;{
60 </script> 60 </script>
61 61
62 <template> 62 <template>
63 - <el-pagination  
64 - v-model:currentPage="currentPage"  
65 - :page-sizes="pageSizes"  
66 - :page-size="pageSize"  
67 - layout="total, sizes, prev, pager, next, jumper"  
68 - :total="total"  
69 - @size-change="handleSizeChange"  
70 - @current-change="handleCurrentChange"  
71 - >  
72 - </el-pagination> 63 + <div class="pagination-container">
  64 + <el-pagination
  65 + v-model:currentPage="currentPage"
  66 + :page-sizes="pageSizes"
  67 + :page-size="pageSize"
  68 + layout="total, sizes, prev, pager, next, jumper"
  69 + :total="total"
  70 + @size-change="handleSizeChange"
  71 + @current-change="handleCurrentChange"
  72 + >
  73 + </el-pagination>
  74 + </div>
73 </template> 75 </template>
  76 +
  77 +<style scoped lang="scss">
  78 + .pagination-container {
  79 + padding: 10px;
  80 + }
  81 +</style>
74 \ No newline at end of file 82 \ No newline at end of file
src/router/index.ts
1 import { createRouter, createWebHashHistory } from 'vue-router' 1 import { createRouter, createWebHashHistory } from 'vue-router'
  2 +import Resident from "./modules/resident"
  3 +import Property from "./modules/property"
2 import Community from "./modules/community" 4 import Community from "./modules/community"
3 import Layout from '@/layout/enter.vue' 5 import Layout from '@/layout/enter.vue'
4 const routes: Array<any> = [ 6 const routes: Array<any> = [
@@ -33,6 +35,8 @@ const routes: Array&lt;any&gt; = [ @@ -33,6 +35,8 @@ const routes: Array&lt;any&gt; = [
33 }] 35 }]
34 // component: () => import(/* webpackChunkName: "About" */ '@/views/tengxi/about.vue') 36 // component: () => import(/* webpackChunkName: "About" */ '@/views/tengxi/about.vue')
35 }, 37 },
  38 + Resident,
  39 + Property,
36 Community, 40 Community,
37 41
38 { 42 {
src/router/modules/property.ts 0 → 100644
  1 +import { RouteRecordRaw } from 'vue-router'
  2 +import Layout from '@/layout/enter.vue'
  3 +const property= {
  4 + path: '/',
  5 + component: Layout,
  6 + name: 'Property',
  7 + children: [{
  8 + path: 'property',
  9 + name: 'property',
  10 + component: () => import('@/views/property/index.vue'),
  11 + meta: { title: '物业管理' }
  12 + }]
  13 +}
  14 +
  15 +export default property
src/router/modules/resident.ts 0 → 100644
  1 +import { RouteRecordRaw } from 'vue-router'
  2 +import Layout from '@/layout/enter.vue'
  3 +const resident= {
  4 + path: '/',
  5 + component: Layout,
  6 + name: 'Resident',
  7 + children: [{
  8 + path: 'resident',
  9 + name: 'resident',
  10 + component: () => import('@/views/resident/index.vue'),
  11 + meta: { title: '业主住户管理' }
  12 + }]
  13 +}
  14 +
  15 +export default resident
src/views/dashboard/index.vue
1 <script setup lang="ts"> 1 <script setup lang="ts">
2 import {ref} from 'vue' 2 import {ref} from 'vue'
  3 +import {propertyList } from '@/api/tengxi'
3 const title = ref(import.meta.env.VITE_APP_TITLE).value 4 const title = ref(import.meta.env.VITE_APP_TITLE).value
  5 +propertyList().then(res => {
  6 + console.log(res)
  7 +}).catch(error => {
  8 + console.log(error)
  9 +})
4 </script> 10 </script>
5 11
6 <template> 12 <template>
@@ -16,6 +22,7 @@ const title = ref(import.meta.env.VITE_APP_TITLE).value @@ -16,6 +22,7 @@ const title = ref(import.meta.env.VITE_APP_TITLE).value
16 padding-top: 200px; 22 padding-top: 200px;
17 min-height: calc(100vh - 60px); 23 min-height: calc(100vh - 60px);
18 background: #f0f2f5; 24 background: #f0f2f5;
  25 + text-align: center;
19 } 26 }
20 &-logo { 27 &-logo {
21 width: 200px; 28 width: 200px;
src/views/property/index.vue 0 → 100644
  1 +<script setup lang="ts">
  2 +import { reactive, ref } from "vue";
  3 +import { propertyList } from "@/api/tengxi";
  4 +import Pagination from "@/components/Pagination/index.vue";
  5 +let data = reactive([]);
  6 +let loading = ref(false);
  7 +let params = reactive({
  8 + total: 0,
  9 + query: {
  10 + page: 1,
  11 + pageSize: 10
  12 + }
  13 +})
  14 +const handlePageChange = (page, size) => {
  15 + params.query.page = page
  16 + params.query.pageSize = size
  17 +}
  18 +propertyList()
  19 + .then((res) => {
  20 + console.log(res);
  21 + })
  22 + .catch((error) => {
  23 + console.log(error);
  24 + });
  25 +</script>
  26 +
  27 +<template>
  28 + <div class="page-container">
  29 + <el-table
  30 + :data="data"
  31 + style="width: 100%"
  32 + border
  33 + v-loading="loading"
  34 + element-loading-text="拼命加载中"
  35 + >
  36 + <el-table-column prop="date" label="日期" width="180"> </el-table-column>
  37 + <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
  38 + <el-table-column prop="address" label="地址"> </el-table-column>
  39 + <el-table-column prop="status" label="状态">
  40 + <template #default="scope">
  41 + {{ scope.row.status }}
  42 + </template>
  43 + </el-table-column>
  44 + <el-table-column label="按钮">
  45 + <template #default="scope">
  46 + <el-button type="primary">哈哈</el-button>
  47 + </template>
  48 + </el-table-column>
  49 + </el-table>
  50 + <Pagination
  51 + :total="params.total"
  52 + :currentPage="params.query.page"
  53 + :pageSize="params.query.pageSize"
  54 + @pageChange="handlePageChange"
  55 + ></Pagination>
  56 + </div>
  57 +</template>
src/views/resident/index.vue 0 → 100644
  1 +<script setup lang="ts">
  2 +</script>
  3 +
  4 +<template>
  5 + <div class="page-container">
  6 + resident index
  7 + </div>
  8 +</template>