Browse Source

物业 Web端, 修复格式错误

weiximei 6 years ago
parent
commit
728ba86db6

+ 3
- 3
VUECODE/smart-property-manage/src/api/index.js View File

1
 import request from '@/utils/request'
1
 import request from '@/utils/request'
2
 
2
 
3
 // 硬件数据统计
3
 // 硬件数据统计
4
-export function getHardData () {
4
+export function getHardData() {
5
   return request({
5
   return request({
6
     url: '/mq/open',
6
     url: '/mq/open',
7
     method: 'get'
7
     method: 'get'
9
 }
9
 }
10
 
10
 
11
 // 注册用户统计
11
 // 注册用户统计
12
-export function getSignUser () {
12
+export function getSignUser() {
13
   return request({
13
   return request({
14
     url: '/user/count',
14
     url: '/user/count',
15
     method: 'get'
15
     method: 'get'
16
   })
16
   })
17
-}
17
+}

+ 14
- 14
VUECODE/smart-property-manage/src/components/chart/chart3.vue View File

5
       <div
5
       <div
6
         v-for="(item,index) in arr"
6
         v-for="(item,index) in arr"
7
         :key="index"
7
         :key="index"
8
+        :class="{active:item.active}"
8
         @mouseover="item.active = true"
9
         @mouseover="item.active = true"
9
         @mouseout="item.active=false"
10
         @mouseout="item.active=false"
10
-        :class="{active:item.active}"
11
       >
11
       >
12
-        <div>{{item.text}}</div>
13
-        <div>{{item.num}}</div>
12
+        <div>{{ item.text }}</div>
13
+        <div>{{ item.num }}</div>
14
       </div>
14
       </div>
15
     </div>
15
     </div>
16
   </div>
16
   </div>
20
 import { mapState, mapActions } from 'vuex'
20
 import { mapState, mapActions } from 'vuex'
21
 
21
 
22
 export default {
22
 export default {
23
-  computed: {
24
-    ...mapState('trunkIndex', {
25
-      hardData: item => item.trunkIndex.hardData
26
-    })
27
-  },
28
-  data () {
23
+  data() {
29
     return {
24
     return {
30
       arr: [
25
       arr: [
31
         { text: '小区门禁开启', num: '13400次', active: false },
26
         { text: '小区门禁开启', num: '13400次', active: false },
33
         { text: '车辆进入数量', num: '5664辆', active: false },
28
         { text: '车辆进入数量', num: '5664辆', active: false },
34
         { text: '咖啡厅销量', num: '3994次', active: false },
29
         { text: '咖啡厅销量', num: '3994次', active: false },
35
         { text: '智慧食堂销量', num: '5664人次', active: false },
30
         { text: '智慧食堂销量', num: '5664人次', active: false },
36
-        { text: '健身房健身', num: '1255人次', active: false },
31
+        { text: '健身房健身', num: '1255人次', active: false }
37
       ]
32
       ]
38
     }
33
     }
39
   },
34
   },
40
-  created () {
35
+  computed: {
36
+    ...mapState('trunkIndex', {
37
+      hardData: item => item.trunkIndex.hardData
38
+    })
39
+  },
40
+  created() {
41
     this.GetHardData().then(() => {
41
     this.GetHardData().then(() => {
42
       console.log(this.hardData)
42
       console.log(this.hardData)
43
       this.hardData.forEach(item => {
43
       this.hardData.forEach(item => {
46
         } else if (item.message === '单元门开门次数') {
46
         } else if (item.message === '单元门开门次数') {
47
           this.arr[1].num = item.count + '次'
47
           this.arr[1].num = item.count + '次'
48
         }
48
         }
49
-      });
49
+      })
50
       this.arr = JSON.parse(JSON.stringify(this.arr))
50
       this.arr = JSON.parse(JSON.stringify(this.arr))
51
     })
51
     })
52
   },
52
   },
53
   methods: {
53
   methods: {
54
     ...mapActions('trunkIndex', [
54
     ...mapActions('trunkIndex', [
55
       'GetHardData'
55
       'GetHardData'
56
-    ]),
56
+    ])
57
   }
57
   }
58
 }
58
 }
59
 </script>
59
 </script>
98
     }
98
     }
99
   }
99
   }
100
 }
100
 }
101
-</style>
101
+</style>

+ 7
- 7
VUECODE/smart-property-manage/src/components/chart/chart4.vue View File

3
     <div class="top-title">已合作社区分布图</div>
3
     <div class="top-title">已合作社区分布图</div>
4
     <el-amap
4
     <el-amap
5
       ref="map"
5
       ref="map"
6
-      vid="amapDemo"
7
       :center="mapCenter"
6
       :center="mapCenter"
8
       :zoom="7"
7
       :zoom="7"
8
+      :map-style="setMapStyle"
9
+      vid="amapDemo"
9
       class="amap-demo"
10
       class="amap-demo"
10
-      :mapStyle="setMapStyle"
11
     >
11
     >
12
       <el-amap-marker
12
       <el-amap-marker
13
         v-for="(item,index) in markers"
13
         v-for="(item,index) in markers"
17
         :title="item.title"
17
         :title="item.title"
18
         :offset="item.offset"
18
         :offset="item.offset"
19
         :content="item.content"
19
         :content="item.content"
20
-      ></el-amap-marker>
20
+      />
21
     </el-amap>
21
     </el-amap>
22
   </div>
22
   </div>
23
 </template>
23
 </template>
32
 import light3 from '@/assets/light3.png'
32
 import light3 from '@/assets/light3.png'
33
 import light4 from '@/assets/light4.png'
33
 import light4 from '@/assets/light4.png'
34
 export default {
34
 export default {
35
-  data () {
35
+  data() {
36
     return {
36
     return {
37
       light1,
37
       light1,
38
       light2,
38
       light2,
75
       setMapStyle: 'amap://styles/blue'
75
       setMapStyle: 'amap://styles/blue'
76
     }
76
     }
77
   },
77
   },
78
-  mounted () {
78
+  mounted() {
79
     setInterval(() => {
79
     setInterval(() => {
80
       this.rander()
80
       this.rander()
81
     }, 1600)
81
     }, 1600)
82
   },
82
   },
83
   methods: {
83
   methods: {
84
-    rander () {
84
+    rander() {
85
       $('.point img').animate({ opacity: 0 }, 800).animate({ opacity: 1 }, 800)
85
       $('.point img').animate({ opacity: 0 }, 800).animate({ opacity: 1 }, 800)
86
     }
86
     }
87
   }
87
   }
122
     color: white;
122
     color: white;
123
   }
123
   }
124
 }
124
 }
125
-</style>
125
+</style>

+ 1
- 1
VUECODE/smart-property-manage/src/components/chart/chart5.vue View File

12
       signUser: item => item.trunkIndex.signUser
12
       signUser: item => item.trunkIndex.signUser
13
     })
13
     })
14
   },
14
   },
15
-  mounted () {
15
+  mounted() {
16
     this.GetSignUser().then(() => {
16
     this.GetSignUser().then(() => {
17
       this.rander()
17
       this.rander()
18
     })
18
     })

+ 31
- 31
VUECODE/smart-property-manage/src/permission.js View File

8
 const whiteList = ['/login'] // 不重定向白名单
8
 const whiteList = ['/login'] // 不重定向白名单
9
 router.beforeEach((to, from, next) => {
9
 router.beforeEach((to, from, next) => {
10
   NProgress.start()
10
   NProgress.start()
11
-  console.log("路径: ", to.path)
12
-  // if (getToken()) {
13
-  //   if (to.path === '/login') {
14
-  //     next({ path: '/' })
15
-  //     NProgress.done() // if current page is dashboard will not trigger	afterEach hook, so manually handle it
16
-  //   }else {
17
-  //     if (store.getters.roles.length === 0) {
18
-  //       store.dispatch('GetInfo').then(res => { // 拉取用户信息
19
-  //         next()
20
-  //       }).catch((err) => {
21
-  //         store.dispatch('FedLogOut').then(() => {
22
-  //           Message.error(err || 'Verification failed, please login again')
23
-  //           next({ path: '/' })
24
-  //         })
25
-  //       })
26
-  //     } else {
27
-  //       next()
28
-  //     }
29
-  //   }
30
-  // } else {
31
-  //   // if (to.path === '/') {
32
-  //   //   next(`/login?redirect=${to.path}`)
33
-  //   //   NProgress.done()
34
-  //   // }
35
-  //   if (whiteList.indexOf(to.path) !== -1) {
36
-  //     next()
37
-  //   } else {
38
-  //     next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
39
-  //     NProgress.done()
40
-  //   }
41
-  // }
11
+  console.log('路径: ', to.path)
12
+  if (getToken()) {
13
+    if (to.path === '/login') {
14
+      next({ path: '/' })
15
+      NProgress.done() // if current page is dashboard will not trigger	afterEach hook, so manually handle it
16
+    } else {
17
+      if (store.getters.roles.length === 0) {
18
+        store.dispatch('GetInfo').then(res => { // 拉取用户信息
19
+          next()
20
+        }).catch((err) => {
21
+          store.dispatch('FedLogOut').then(() => {
22
+            Message.error(err || 'Verification failed, please login again')
23
+            next({ path: '/' })
24
+          })
25
+        })
26
+      } else {
27
+        next()
28
+      }
29
+    }
30
+  } else {
31
+    // if (to.path === '/') {
32
+    //   next(`/login?redirect=${to.path}`)
33
+    //   NProgress.done()
34
+    // }
35
+    if (whiteList.indexOf(to.path) !== -1) {
36
+      next()
37
+    } else {
38
+      next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
39
+      NProgress.done()
40
+    }
41
+  }
42
   next()
42
   next()
43
 })
43
 })
44
 
44
 

+ 1
- 1
VUECODE/smart-property-manage/src/store/getters.js View File

6
   name: state => state.user.name,
6
   name: state => state.user.name,
7
   roles: state => state.user.roles,
7
   roles: state => state.user.roles,
8
   userData: state => state.user.userData,
8
   userData: state => state.user.userData,
9
-  trunkIndex: state => state.trunkIndex.trunkIndex,
9
+  trunkIndex: state => state.trunkIndex.trunkIndex
10
 }
10
 }
11
 export default getters
11
 export default getters

+ 2
- 1
VUECODE/smart-property-manage/src/store/modules/community.js View File

21
       state.list = list
21
       state.list = list
22
     },
22
     },
23
     Insert_LIST: (state, detail) => {
23
     Insert_LIST: (state, detail) => {
24
-      state.list = [detail, ...list]
24
+      // state.list = [detail, ...list]
25
+      state.list = [detail, ...state.list]
25
     },
26
     },
26
     UpdateList: (state, detail) => {
27
     UpdateList: (state, detail) => {
27
       state.list = state.list.map(item => {
28
       state.list = state.list.map(item => {

+ 2
- 2
VUECODE/smart-property-manage/src/store/modules/trunkIndex.js View File

18
   },
18
   },
19
   actions: {
19
   actions: {
20
     // 硬件数据统计
20
     // 硬件数据统计
21
-    GetHardData ({ commit }) {
21
+    GetHardData({ commit }) {
22
       return new Promise((resolve, reject) => {
22
       return new Promise((resolve, reject) => {
23
         getHardData().then(response => {
23
         getHardData().then(response => {
24
           const data = response.data
24
           const data = response.data
31
     },
31
     },
32
 
32
 
33
     // 注册用户统计
33
     // 注册用户统计
34
-    GetSignUser ({ commit }) {
34
+    GetSignUser({ commit }) {
35
       return new Promise((resolve, reject) => {
35
       return new Promise((resolve, reject) => {
36
         getSignUser().then(response => {
36
         getSignUser().then(response => {
37
           const data = response.data
37
           const data = response.data

+ 1
- 1
VUECODE/smart-property-manage/src/store/modules/user.js View File

68
     SendCode({ commit, state }, userName) {
68
     SendCode({ commit, state }, userName) {
69
       return new Promise((resolve, reject) => {
69
       return new Promise((resolve, reject) => {
70
         sendCode(userName).then(response => {
70
         sendCode(userName).then(response => {
71
-          //const data = response.message
71
+          // const data = response.message
72
           // resolve(data)
72
           // resolve(data)
73
           resolve(response)
73
           resolve(response)
74
         }).catch(error => {
74
         }).catch(error => {

+ 4
- 4
VUECODE/smart-property-manage/src/views/building/batch/batchImport.vue View File

4
     <el-form :inline="true" :model="listQuery" class="form-listQuery">
4
     <el-form :inline="true" :model="listQuery" class="form-listQuery">
5
       <el-form-item>
5
       <el-form-item>
6
         <el-upload
6
         <el-upload
7
-          class="upload-demo"
8
-          action="https://jsonplaceholder.typicode.com/posts/"
9
           :on-preview="handlePreview"
7
           :on-preview="handlePreview"
10
           :on-remove="handleRemove"
8
           :on-remove="handleRemove"
11
           :before-remove="beforeRemove"
9
           :before-remove="beforeRemove"
12
-          multiple
13
           :limit="3"
10
           :limit="3"
14
           :on-exceed="handleExceed"
11
           :on-exceed="handleExceed"
15
-          :file-list="fileList">
12
+          :file-list="fileList"
13
+          class="upload-demo"
14
+          action="https://jsonplaceholder.typicode.com/posts/"
15
+          multiple>
16
           <el-button style="margin-left: 10px;" size="large" type="primary">下载模板</el-button>
16
           <el-button style="margin-left: 10px;" size="large" type="primary">下载模板</el-button>
17
           <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
17
           <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
18
           <el-button style="margin-left: 10px;" size="large" type="success" @click="submitUpload">提交</el-button>
18
           <el-button style="margin-left: 10px;" size="large" type="success" @click="submitUpload">提交</el-button>

+ 2
- 3
VUECODE/smart-property-manage/src/views/building/index.vue View File

5
       <el-form-item label="楼盘库">
5
       <el-form-item label="楼盘库">
6
         <el-select placeholder="栋">
6
         <el-select placeholder="栋">
7
           <el-option label="区域一" value="shanghai" />
7
           <el-option label="区域一" value="shanghai" />
8
-          <el-option label="区域二" value="beijing" />
9
         </el-select>
8
         </el-select>
10
         <el-select placeholder="单元">
9
         <el-select placeholder="单元">
11
           <el-option label="区域一" value="shanghai" />
10
           <el-option label="区域一" value="shanghai" />
89
     handleCurrentChange(val) {
88
     handleCurrentChange(val) {
90
       console.log(`当前页: ${val}`)
89
       console.log(`当前页: ${val}`)
91
     },
90
     },
92
-    dialogBatchImport(){
93
-      this.$router.push({ name: 'batch-import'})
91
+    dialogBatchImport() {
92
+      this.$router.push({ name: 'batch-import' })
94
     }
93
     }
95
   }
94
   }
96
 }
95
 }

+ 3
- 3
VUECODE/smart-property-manage/src/views/layout/components/Navbar.vue View File

9
     <el-dropdown class="avatar-container" trigger="click">
9
     <el-dropdown class="avatar-container" trigger="click">
10
       <div class="avatar-wrapper">
10
       <div class="avatar-wrapper">
11
         <span style="position: relative;top: -15px;right:5px;">{{ userData.userName }}</span>
11
         <span style="position: relative;top: -15px;right:5px;">{{ userData.userName }}</span>
12
-        <img :src="userData.headPortrait" class="user-avatar" v-if="userData.headPortrait != '' && userData.headPortrait != undefined">
12
+        <img v-if="userData.headPortrait != '' && userData.headPortrait != undefined" :src="userData.headPortrait" class="user-avatar">
13
         <i class="el-icon-caret-bottom"/>
13
         <i class="el-icon-caret-bottom"/>
14
       </div>
14
       </div>
15
       <el-dropdown-menu slot="dropdown" class="user-dropdown">
15
       <el-dropdown-menu slot="dropdown" class="user-dropdown">
42
     ])
42
     ])
43
   },
43
   },
44
   methods: {
44
   methods: {
45
-    toggleSideBar () {
45
+    toggleSideBar() {
46
       this.$store.dispatch('ToggleSideBar')
46
       this.$store.dispatch('ToggleSideBar')
47
     },
47
     },
48
-    logout () {
48
+    logout() {
49
       this.$store.dispatch('LogOut').then(() => {
49
       this.$store.dispatch('LogOut').then(() => {
50
         location.reload() // 为了重新实例化vue-router对象 避免bug
50
         location.reload() // 为了重新实例化vue-router对象 避免bug
51
       })
51
       })

+ 53
- 54
VUECODE/smart-property-manage/src/views/login/index.vue View File

1
 <template>
1
 <template>
2
   <div class="login-container">
2
   <div class="login-container">
3
     <div class="login-box">
3
     <div class="login-box">
4
-    <el-form
5
-      ref="loginForm"
6
-      :model="loginForm"
7
-      :rules="loginRules"
8
-      class="login-form"
9
-      auto-complete="on"
10
-      label-position="left"
11
-    >
12
-      <div class="logo">
13
-        <img
14
-          src="http://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/1543283673332.png?Expires=1545111060&OSSAccessKeyId=LTAIkc75dpkJw8Lb&Signature=HqQy2E2tWJ4Vbc8HClE3jqPTx0s%3D"
15
-        >
16
-      </div>
17
-      <h3 class="title">智慧社区物业平台</h3>
18
-      <el-form-item prop="username">
19
-        <span class="svg-container">
20
-          <svg-icon icon-class="user"/>
21
-        </span>
22
-        <el-input
23
-          v-model="loginForm.username"
24
-          name="username"
25
-          type="text"
26
-          auto-complete="on"
27
-          placeholder="请输入手机号"
28
-        />
29
-      </el-form-item>
30
-      <div class="pwdSend">
31
-        <el-form-item prop="password">
4
+      <el-form
5
+        ref="loginForm"
6
+        :model="loginForm"
7
+        :rules="loginRules"
8
+        class="login-form"
9
+        auto-complete="on"
10
+        label-position="left"
11
+      >
12
+        <div class="logo">
13
+          <img
14
+            src="http://jingcheng-h5temp.oss-cn-shanghai.aliyuncs.com/1543283673332.png?Expires=1545111060&OSSAccessKeyId=LTAIkc75dpkJw8Lb&Signature=HqQy2E2tWJ4Vbc8HClE3jqPTx0s%3D"
15
+          >
16
+        </div>
17
+        <h3 class="title">智慧社区物业平台</h3>
18
+        <el-form-item prop="username">
19
+          <span class="svg-container">
20
+            <svg-icon icon-class="user"/>
21
+          </span>
32
           <el-input
22
           <el-input
33
-            v-model="loginForm.password"
34
-            name="password"
23
+            v-model="loginForm.username"
24
+            name="username"
35
             type="text"
25
             type="text"
36
             auto-complete="on"
26
             auto-complete="on"
37
-            placeholder="请输入验证码"
38
-            @keyup.enter.native="handleLogin"
27
+            placeholder="请输入手机号"
39
           />
28
           />
40
         </el-form-item>
29
         </el-form-item>
41
-        <el-button type="primary" @click="sendCode();" v-if="isCodeNum == false">发送验证码</el-button>
42
-        <el-button type="primary" disabled v-else>{{ codeNum + '秒后重新获取' }}</el-button>
43
-      </div>
44
-      <el-button
45
-        :loading="loading"
46
-        type="primary"
47
-        style="width:100%;"
48
-        @click.native.prevent="handleLogin"
49
-      >登录</el-button>
50
-    </el-form>
30
+        <div class="pwdSend">
31
+          <el-form-item prop="password">
32
+            <el-input
33
+              v-model="loginForm.password"
34
+              name="password"
35
+              type="text"
36
+              auto-complete="on"
37
+              placeholder="请输入验证码"
38
+              @keyup.enter.native="handleLogin"
39
+            />
40
+          </el-form-item>
41
+          <el-button v-if="isCodeNum == false" type="primary" @click="sendCode();">发送验证码</el-button>
42
+          <el-button v-else type="primary" disabled>{{ codeNum + '秒后重新获取' }}</el-button>
43
+        </div>
44
+        <el-button
45
+          :loading="loading"
46
+          type="primary"
47
+          style="width:100%;"
48
+          @click.native.prevent="handleLogin"
49
+        >登录</el-button>
50
+      </el-form>
51
     </div>
51
     </div>
52
     <span class="bottom-desc">Copyright © 南京荟房网络科技有限公司, All Rights Reserved.</span>
52
     <span class="bottom-desc">Copyright © 南京荟房网络科技有限公司, All Rights Reserved.</span>
53
   </div>
53
   </div>
58
 
58
 
59
 export default {
59
 export default {
60
   name: 'Login',
60
   name: 'Login',
61
-  data () {
61
+  data() {
62
     const validateUsername = (rule, value, callback) => {
62
     const validateUsername = (rule, value, callback) => {
63
       if (!isvalidUsername(value)) {
63
       if (!isvalidUsername(value)) {
64
         callback(new Error('请输入正确的手机号'))
64
         callback(new Error('请输入正确的手机号'))
90
   },
90
   },
91
   watch: {
91
   watch: {
92
     $route: {
92
     $route: {
93
-      handler: function (route) {
93
+      handler: function(route) {
94
         this.redirect = route.query && route.query.redirect
94
         this.redirect = route.query && route.query.redirect
95
       },
95
       },
96
       immediate: true
96
       immediate: true
97
     }
97
     }
98
   },
98
   },
99
   methods: {
99
   methods: {
100
-    handleLogin () {
100
+    handleLogin() {
101
       this.$refs.loginForm.validate(valid => {
101
       this.$refs.loginForm.validate(valid => {
102
         if (valid) {
102
         if (valid) {
103
           this.loading = true
103
           this.loading = true
104
           this.$store.dispatch('Login', this.loginForm).then((res) => {
104
           this.$store.dispatch('Login', this.loginForm).then((res) => {
105
             if (res.code === '0') {
105
             if (res.code === '0') {
106
-              console.log('登陆结果: ',res)
106
+              console.log('登陆结果: ', res)
107
               this.loading = false
107
               this.loading = false
108
               // this.$router.push({ path: this.redirect || '/index' })
108
               // this.$router.push({ path: this.redirect || '/index' })
109
               this.$router.push({ name: 'index' })
109
               this.$router.push({ name: 'index' })
118
           return false
118
           return false
119
         }
119
         }
120
       })
120
       })
121
-       this.$router.push({ path: this.redirect || '/index' })
121
+      this.$router.push({ path: this.redirect || '/index' })
122
     },
122
     },
123
-    sendCode () {
123
+    sendCode() {
124
       // 默认为1, 1表示不成功
124
       // 默认为1, 1表示不成功
125
-      let resCode = 1;
125
+      let resCode = 1
126
       this.$store.dispatch('SendCode', this.loginForm.username).then((res) => {
126
       this.$store.dispatch('SendCode', this.loginForm.username).then((res) => {
127
-        // 成功则为 0 
127
+        // 成功则为 0
128
         resCode = res.code
128
         resCode = res.code
129
         // 为0发送成功
129
         // 为0发送成功
130
         if (resCode === '0') {
130
         if (resCode === '0') {
131
           this.codeNum = 60
131
           this.codeNum = 60
132
           this.isCodeNum = true
132
           this.isCodeNum = true
133
-          let time = setInterval(()=> {
133
+          const time = setInterval(() => {
134
             if (this.codeNum === 1) {
134
             if (this.codeNum === 1) {
135
               clearInterval(time)
135
               clearInterval(time)
136
               this.isCodeNum = false
136
               this.isCodeNum = false
137
             }
137
             }
138
-            this.codeNum --
138
+            this.codeNum--
139
           }, 1000)
139
           }, 1000)
140
         }
140
         }
141
       }).catch(() => {
141
       }).catch(() => {
142
         console.log('error sendcode')
142
         console.log('error sendcode')
143
       })
143
       })
144
-
145
     }
144
     }
146
   }
145
   }
147
 }
146
 }
160
     left: 39.5%;
159
     left: 39.5%;
161
     color: #fff
160
     color: #fff
162
   }
161
   }
163
-  
162
+
164
   .login-box{
163
   .login-box{
165
     position: absolute;
164
     position: absolute;
166
     width: 400px;
165
     width: 400px;

+ 1
- 1
VUECODE/smart-property-manage/src/views/owner/index.vue View File

5
 
5
 
6
 <script>
6
 <script>
7
 export default {
7
 export default {
8
-  
8
+
9
 }
9
 }
10
 </script>
10
 </script>
11
 
11