Selaa lähdekoodia

物业 Web端, 修复格式错误

weiximei 6 vuotta sitten
vanhempi
commit
728ba86db6

+ 3
- 3
VUECODE/smart-property-manage/src/api/index.js Näytä tiedosto

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

+ 14
- 14
VUECODE/smart-property-manage/src/components/chart/chart3.vue Näytä tiedosto

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

+ 7
- 7
VUECODE/smart-property-manage/src/components/chart/chart4.vue Näytä tiedosto

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

+ 1
- 1
VUECODE/smart-property-manage/src/components/chart/chart5.vue Näytä tiedosto

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

+ 31
- 31
VUECODE/smart-property-manage/src/permission.js Näytä tiedosto

@@ -8,37 +8,37 @@ import { getToken } from '@/utils/auth' // 验权
8 8
 const whiteList = ['/login'] // 不重定向白名单
9 9
 router.beforeEach((to, from, next) => {
10 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 42
   next()
43 43
 })
44 44
 

+ 1
- 1
VUECODE/smart-property-manage/src/store/getters.js Näytä tiedosto

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

+ 2
- 1
VUECODE/smart-property-manage/src/store/modules/community.js Näytä tiedosto

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

+ 2
- 2
VUECODE/smart-property-manage/src/store/modules/trunkIndex.js Näytä tiedosto

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

+ 1
- 1
VUECODE/smart-property-manage/src/store/modules/user.js Näytä tiedosto

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

+ 4
- 4
VUECODE/smart-property-manage/src/views/building/batch/batchImport.vue Näytä tiedosto

@@ -4,15 +4,15 @@
4 4
     <el-form :inline="true" :model="listQuery" class="form-listQuery">
5 5
       <el-form-item>
6 6
         <el-upload
7
-          class="upload-demo"
8
-          action="https://jsonplaceholder.typicode.com/posts/"
9 7
           :on-preview="handlePreview"
10 8
           :on-remove="handleRemove"
11 9
           :before-remove="beforeRemove"
12
-          multiple
13 10
           :limit="3"
14 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 16
           <el-button style="margin-left: 10px;" size="large" type="primary">下载模板</el-button>
17 17
           <el-button slot="trigger" size="large" type="primary">选取文件并预览</el-button>
18 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 Näytä tiedosto

@@ -5,7 +5,6 @@
5 5
       <el-form-item label="楼盘库">
6 6
         <el-select placeholder="栋">
7 7
           <el-option label="区域一" value="shanghai" />
8
-          <el-option label="区域二" value="beijing" />
9 8
         </el-select>
10 9
         <el-select placeholder="单元">
11 10
           <el-option label="区域一" value="shanghai" />
@@ -89,8 +88,8 @@ export default {
89 88
     handleCurrentChange(val) {
90 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 Näytä tiedosto

@@ -9,7 +9,7 @@
9 9
     <el-dropdown class="avatar-container" trigger="click">
10 10
       <div class="avatar-wrapper">
11 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 13
         <i class="el-icon-caret-bottom"/>
14 14
       </div>
15 15
       <el-dropdown-menu slot="dropdown" class="user-dropdown">
@@ -42,10 +42,10 @@ export default {
42 42
     ])
43 43
   },
44 44
   methods: {
45
-    toggleSideBar () {
45
+    toggleSideBar() {
46 46
       this.$store.dispatch('ToggleSideBar')
47 47
     },
48
-    logout () {
48
+    logout() {
49 49
       this.$store.dispatch('LogOut').then(() => {
50 50
         location.reload() // 为了重新实例化vue-router对象 避免bug
51 51
       })

+ 53
- 54
VUECODE/smart-property-manage/src/views/login/index.vue Näytä tiedosto

@@ -1,53 +1,53 @@
1 1
 <template>
2 2
   <div class="login-container">
3 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 22
           <el-input
33
-            v-model="loginForm.password"
34
-            name="password"
23
+            v-model="loginForm.username"
24
+            name="username"
35 25
             type="text"
36 26
             auto-complete="on"
37
-            placeholder="请输入验证码"
38
-            @keyup.enter.native="handleLogin"
27
+            placeholder="请输入手机号"
39 28
           />
40 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 51
     </div>
52 52
     <span class="bottom-desc">Copyright © 南京荟房网络科技有限公司, All Rights Reserved.</span>
53 53
   </div>
@@ -58,7 +58,7 @@ import { isvalidUsername, validatCode } from '@/utils/validate'
58 58
 
59 59
 export default {
60 60
   name: 'Login',
61
-  data () {
61
+  data() {
62 62
     const validateUsername = (rule, value, callback) => {
63 63
       if (!isvalidUsername(value)) {
64 64
         callback(new Error('请输入正确的手机号'))
@@ -90,20 +90,20 @@ export default {
90 90
   },
91 91
   watch: {
92 92
     $route: {
93
-      handler: function (route) {
93
+      handler: function(route) {
94 94
         this.redirect = route.query && route.query.redirect
95 95
       },
96 96
       immediate: true
97 97
     }
98 98
   },
99 99
   methods: {
100
-    handleLogin () {
100
+    handleLogin() {
101 101
       this.$refs.loginForm.validate(valid => {
102 102
         if (valid) {
103 103
           this.loading = true
104 104
           this.$store.dispatch('Login', this.loginForm).then((res) => {
105 105
             if (res.code === '0') {
106
-              console.log('登陆结果: ',res)
106
+              console.log('登陆结果: ', res)
107 107
               this.loading = false
108 108
               // this.$router.push({ path: this.redirect || '/index' })
109 109
               this.$router.push({ name: 'index' })
@@ -118,30 +118,29 @@ export default {
118 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 124
       // 默认为1, 1表示不成功
125
-      let resCode = 1;
125
+      let resCode = 1
126 126
       this.$store.dispatch('SendCode', this.loginForm.username).then((res) => {
127
-        // 成功则为 0 
127
+        // 成功则为 0
128 128
         resCode = res.code
129 129
         // 为0发送成功
130 130
         if (resCode === '0') {
131 131
           this.codeNum = 60
132 132
           this.isCodeNum = true
133
-          let time = setInterval(()=> {
133
+          const time = setInterval(() => {
134 134
             if (this.codeNum === 1) {
135 135
               clearInterval(time)
136 136
               this.isCodeNum = false
137 137
             }
138
-            this.codeNum --
138
+            this.codeNum--
139 139
           }, 1000)
140 140
         }
141 141
       }).catch(() => {
142 142
         console.log('error sendcode')
143 143
       })
144
-
145 144
     }
146 145
   }
147 146
 }
@@ -160,7 +159,7 @@ $light_gray: #eee;
160 159
     left: 39.5%;
161 160
     color: #fff
162 161
   }
163
-  
162
+
164 163
   .login-box{
165 164
     position: absolute;
166 165
     width: 400px;

+ 1
- 1
VUECODE/smart-property-manage/src/views/owner/index.vue Näytä tiedosto

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