Parcourir la source

接口请求完善

1002884655 il y a 4 ans
Parent
révision
1910431172
35 fichiers modifiés avec 14910 ajouts et 273 suppressions
  1. 1
    0
      config/dev.js
  2. 6
    0
      config/index.js
  3. 1
    0
      config/prod.js
  4. 8
    6
      package.json
  5. 11
    11
      project.config.json
  6. 48
    1
      src/app.js
  7. 5
    1
      src/components/BannerSwiper/index.vue
  8. 3
    3
      src/components/GetUserIcon/index.vue
  9. 25
    0
      src/components/Layout/Basic/index.vue
  10. 3
    0
      src/components/Loading/index.vue
  11. 19
    7
      src/pages/HuiAiXin/EnergyStory/index.vue
  12. 19
    7
      src/pages/HuiAiXin/StarOwner/index.vue
  13. 26
    11
      src/pages/HuiAiXin/index.vue
  14. 34
    17
      src/pages/HuiQuanYi/OwnersNews/NewsDetail/index.vue
  15. 10
    0
      src/pages/HuiQuanYi/OwnersNews/NewsDetail/page.scss
  16. 18
    6
      src/pages/HuiQuanYi/OwnersNews/index.vue
  17. 17
    5
      src/pages/HuiQuanYi/index.vue
  18. 47
    8
      src/pages/HuiShengHuo/ActivityList/ActivityDetail/JoinIn/index.vue
  19. 104
    50
      src/pages/HuiShengHuo/ActivityList/ActivityDetail/index.vue
  20. 29
    20
      src/pages/HuiShengHuo/ActivityList/ActivityDetail/page.scss
  21. 24
    12
      src/pages/HuiShengHuo/ActivityList/index.vue
  22. 41
    12
      src/pages/HuiShengHuo/PhotoList/index.vue
  23. 10
    0
      src/pages/HuiShengHuo/PhotoList/page.scss
  24. 83
    56
      src/pages/HuiShengHuo/index.vue
  25. 11
    0
      src/pages/HuiShengHuo/page.scss
  26. 1
    1
      src/pages/WoDe/MyActivityList/index.vue
  27. 8
    6
      src/pages/WoDe/index.vue
  28. 3
    0
      src/store/index.js
  29. 27
    12
      src/store/index/index.js
  30. 32
    0
      src/store/user/index.js
  31. 13
    1
      src/util/Api/index.js
  32. 37
    20
      src/util/PublicMethod/index.js
  33. 28
    0
      src/util/auth-plugin.js
  34. 22
    0
      src/util/observe.js
  35. 14136
    0
      yarn.lock

+ 1
- 0
config/dev.js Voir le fichier

@@ -3,6 +3,7 @@ module.exports = {
3 3
     NODE_ENV: '"development"'
4 4
   },
5 5
   defineConstants: {
6
+    SERVER_API: '"https://dev.fangdeal.cn/liyuanhui/api/wx"'
6 7
   },
7 8
   mini: {},
8 9
   h5: {}

+ 6
- 0
config/index.js Voir le fichier

@@ -1,3 +1,5 @@
1
+const path = require('path')
2
+
1 3
 const config = {
2 4
   projectName: 'myApp',
3 5
   date: '2020-8-7',
@@ -59,6 +61,10 @@ const config = {
59 61
         }
60 62
       }
61 63
     }
64
+  },
65
+  alias: {
66
+    '@/components': path.resolve(__dirname, '..', 'src/components'),
67
+    '@/util': path.resolve(__dirname, '..', 'src/util')
62 68
   }
63 69
 }
64 70
 

+ 1
- 0
config/prod.js Voir le fichier

@@ -3,6 +3,7 @@ module.exports = {
3 3
     NODE_ENV: '"production"'
4 4
   },
5 5
   defineConstants: {
6
+    SERVER_API: '"https://dev.fangdeal.cn/liyuanhui/api/wx"'
6 7
   },
7 8
   mini: {},
8 9
   h5: {

+ 8
- 6
package.json Voir le fichier

@@ -35,7 +35,9 @@
35 35
   "license": "MIT",
36 36
   "dependencies": {
37 37
     "@babel/runtime": "^7.7.7",
38
+    "@tarojs/cli": "^3.0.7",
38 39
     "@tarojs/components": "3.0.7",
40
+    "@tarojs/mini-runner": "^3.0.7",
39 41
     "@tarojs/runtime": "3.0.7",
40 42
     "@tarojs/taro": "3.0.7",
41 43
     "qs": "^6.9.4",
@@ -44,15 +46,15 @@
44 46
     "vuex": "^3.5.1"
45 47
   },
46 48
   "devDependencies": {
47
-    "@types/webpack-env": "^1.13.6",
49
+    "@babel/core": "^7.8.0",
48 50
     "@tarojs/mini-runner": "3.0.7",
49 51
     "@tarojs/webpack-runner": "3.0.7",
50
-    "@babel/core": "^7.8.0",
52
+    "@types/webpack-env": "^1.13.6",
51 53
     "babel-preset-taro": "3.0.7",
52
-    "vue-loader": "^15.9.2",
53
-    "eslint-plugin-vue": "^6.x",
54
-    "eslint-config-taro": "3.0.7",
55 54
     "eslint": "^6.8.0",
56
-    "stylelint": "9.3.0"
55
+    "eslint-config-taro": "3.0.7",
56
+    "eslint-plugin-vue": "^6.x",
57
+    "stylelint": "9.3.0",
58
+    "vue-loader": "^15.9.2"
57 59
   }
58 60
 }

+ 11
- 11
project.config.json Voir le fichier

@@ -5,30 +5,30 @@
5 5
 	"appid": "wxd9ee3a9480a4e544",
6 6
 	"setting": {
7 7
 		"urlCheck": false,
8
+		"scopeDataCheck": false,
9
+		"coverView": true,
8 10
 		"es6": false,
9
-		"enhance": false,
10 11
 		"postcss": false,
12
+		"compileHotReLoad": false,
11 13
 		"preloadBackgroundData": false,
12 14
 		"minified": false,
15
+		"autoAudits": false,
13 16
 		"newFeature": false,
14
-		"coverView": true,
17
+		"uglifyFileName": false,
18
+		"uploadWithSourceMap": true,
19
+		"useIsolateContext": true,
15 20
 		"nodeModules": false,
16
-		"autoAudits": false,
21
+		"enhance": false,
22
+		"useCompilerModule": false,
23
+		"userConfirmedUseCompilerModuleSwitch": false,
17 24
 		"showShadowRootInWxmlPanel": true,
18
-		"scopeDataCheck": false,
19
-		"uglifyFileName": false,
20 25
 		"checkInvalidKey": true,
21 26
 		"checkSiteMap": true,
22
-		"uploadWithSourceMap": true,
23
-		"compileHotReLoad": false,
24 27
 		"babelSetting": {
25 28
 			"ignore": [],
26 29
 			"disablePlugins": [],
27 30
 			"outputPath": ""
28
-		},
29
-		"useIsolateContext": true,
30
-		"useCompilerModule": false,
31
-		"userConfirmedUseCompilerModuleSwitch": false
31
+		}
32 32
 	},
33 33
 	"compileType": "miniprogram",
34 34
 	"simulatorType": "wechat",

+ 48
- 1
src/app.js Voir le fichier

@@ -1,4 +1,7 @@
1
+import Taro from '@tarojs/taro'
1 2
 import Vue from 'vue'
3
+import BasicLayout from '@/components/Layout/Basic'
4
+import { vueAuthPlugin } from '@/util/auth-plugin'
2 5
 import store from './store/index'
3 6
 
4 7
 import './app.scss'
@@ -10,13 +13,57 @@ import './iconfont.scss'
10 13
 import ToolClass from './util/PublicMethod/index'
11 14
 Vue.prototype.ToolClass = ToolClass
12 15
 
16
+Vue.use(vueAuthPlugin)
17
+Vue.component('BasicLayout', BasicLayout)
18
+
13 19
 const App = new Vue({
14 20
   store,
15
-  onShow (options) {
21
+  onLaunch (options) {
22
+    this.login(options)
16 23
   },
17 24
   render(h) {
18 25
     // this.$slots.default 是将要会渲染的页面
19 26
     return h('block', this.$slots.default)
27
+  },
28
+  methods: {
29
+    login(options) {
30
+      Taro.login({
31
+        success (res) {
32
+          if (res.code) {
33
+            store.dispatch(
34
+              'user/MainSignIn',
35
+              { queryData: { code: res.code } }
36
+            ).then((res) => { // 获取用户信息
37
+              store.commit(
38
+                'user/EditUserInfo',
39
+                { name: 'PersonId', value: res.data.data.person.personId }
40
+              )
41
+
42
+              store.commit(
43
+                'user/EditUserInfo',
44
+                { name: 'OpenId', value: res.data.data.person.openId }
45
+              )
46
+              
47
+              store.commit(
48
+                'user/EditUserInfo',
49
+                { name: 'SessionKey', value: res.data.data.person.sessionKey }
50
+              )
51
+              
52
+              store.commit(
53
+                'user/EditUserInfo',
54
+                { name: 'Phone', value: res.data.data.person.phone }
55
+              )
56
+            })
57
+          } else {
58
+            Taro.showToast({
59
+              title: '初始化失败, 请退出重试',
60
+              icon: 'none',
61
+              duration: 3000
62
+            })
63
+          }
64
+        }
65
+      })
66
+    }
20 67
   }
21 68
 })
22 69
 

+ 5
- 1
src/components/BannerSwiper/index.vue Voir le fichier

@@ -4,7 +4,7 @@
4 4
       <block v-for="(item, index) in List" :key="index">
5 5
         <swiper-item>
6 6
           <view class="swiper-item">
7
-            <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
7
+            <image mode="aspectFill" class="centerLabel" :src="item.image" @tap="LinkTo(item)"></image>
8 8
           </view>
9 9
         </swiper-item>
10 10
       </block>
@@ -28,6 +28,10 @@ export default {
28 28
     }
29 29
   },
30 30
   methods: {
31
+    LinkTo (item) {
32
+      if (item.srcId === null) return
33
+      wx.navigateTo({ url: `../../pages/HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.advId}`})
34
+    }
31 35
   }
32 36
 }
33 37
 </script>

+ 3
- 3
src/components/GetUserIcon/index.vue Voir le fichier

@@ -39,9 +39,9 @@ export default {
39 39
               scope: 'scope.userInfo',
40 40
               success () {
41 41
                 wx.getUserInfo({ // 授权成功时,获取用户信息
42
-                  success (res) {
43
-                    _that.EditUserInfo({ name: 'Icon', value: res.userInfo.avatarUrl })
44
-                    _that.EditUserInfo({ name: 'Name', value: res.userInfo.nickName })
42
+                  success (subRes) {
43
+                    _that.EditUserInfo({ name: 'Icon', value: subRes.userInfo.avatarUrl })
44
+                    _that.EditUserInfo({ name: 'Name', value: subRes.userInfo.nickName })
45 45
                   }
46 46
                 })
47 47
               }

+ 25
- 0
src/components/Layout/Basic/index.vue Voir le fichier

@@ -0,0 +1,25 @@
1
+<template>
2
+  <block>
3
+    <block v-if="user.PersonId">
4
+      <slot v-bind:user="user"></slot>
5
+    </block>
6
+    <Loading v-else />
7
+  </block>
8
+</template>
9
+
10
+<script>
11
+import { mapState } from 'vuex'
12
+import Loading from '@/components/Loading'
13
+
14
+export default {
15
+  name: 'BasicLayout',
16
+  components: {
17
+    Loading
18
+  },
19
+  computed: {
20
+    ...mapState({
21
+      user: s => s.user.UserInfo || {}
22
+    })
23
+  }
24
+}
25
+</script>

+ 3
- 0
src/components/Loading/index.vue Voir le fichier

@@ -0,0 +1,3 @@
1
+<template>
2
+  <view style="text-align: center; margin-top: 20vh">Loading</view>
3
+</template>

+ 19
- 7
src/pages/HuiAiXin/EnergyStory/index.vue Voir le fichier

@@ -9,16 +9,16 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
12
-        <view class="List" v-if="ZhengNengLiangShiJiList.length">
13
-          <navigator v-for="(item, index) in ZhengNengLiangShiJiList" :key="index" url="./EnergyStoryDetail/index" hover-class="other-navigator-hover" class="Item flex-h">
12
+        <view class="List" v-if="PageList.length">
13
+          <navigator v-for="(item, index) in PageList" :key="index" :url="`../../HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item flex-h">
14 14
             <view class="flex-item">
15
-              <text>事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题</text>
15
+              <text>{{item.name}}</text>
16 16
               <text>副标题</text>
17 17
               <text>来源</text>
18 18
             </view>
19 19
             <view class="Img">
20 20
               <view>
21
-                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
21
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
22 22
               </view>
23 23
             </view>
24 24
           </navigator>
@@ -33,10 +33,12 @@
33 33
 import ScrollY from '../../../components/ScrollY/index'
34 34
 import { createNamespacedHelpers } from 'vuex'
35 35
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
36
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
36 37
 export default {
37 38
   name: 'ZhengNengLiangShiJi',
38 39
   data () {
39 40
     return {
41
+      PageList: [],
40 42
       PageData: {
41 43
         pageNum: 1,
42 44
         pageSize: 15
@@ -55,9 +57,17 @@ export default {
55 57
     ScrollY
56 58
   },
57 59
   created () {
58
-    this.Init()
60
+    this.$authed(() => {
61
+      this.Init()
62
+    })
59 63
   },
60 64
   methods: {
65
+    ...mapUserActions([
66
+      'MainSignIn' // 获取用户信息
67
+    ]),
68
+    ...mapUserMutations([
69
+      'EditUserInfo' // 编辑用户信息
70
+    ]),
61 71
     ...mapIndexActions([
62 72
       'GetZhengNengLiangShiJiList' // 获取正能量事迹列表
63 73
     ]),
@@ -68,11 +78,13 @@ export default {
68 78
       this.PageData.pageNum = 1
69 79
       this.HasNextPage = true
70 80
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
81
+      this.PageList = []
71 82
       this.ToGetPageList() // 获取列表
72 83
     },
73 84
     ToGetPageList () { // 获取列表
74
-      this.GetZhengNengLiangShiJiList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取正能量事迹列表
75
-        this.HasNextPage = res.data.data.hasNextPage
85
+      this.GetZhengNengLiangShiJiList({ queryData: { ...this.PageData, typeId: 6 } }).then((res) => { // 获取正能量事迹列表
86
+        this.PageList = [...this.ZhengNengLiangShiJiList]
87
+        this.HasNextPage = res.data.data.current < res.data.data.pages
76 88
         this.DataLock = false
77 89
         this.IsRefreshing = false
78 90
       }).catch(() => {

+ 19
- 7
src/pages/HuiAiXin/StarOwner/index.vue Voir le fichier

@@ -9,12 +9,12 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
12
-        <view class="List" v-if="MingXingYeZhuList.length">
13
-          <navigator v-for="(item, index) in MingXingYeZhuList" :key="index" url="./StarOwnerDetail/index" hover-class="other-navigator-hover" class="Item">
12
+        <view class="List" v-if="PageList.length">
13
+          <navigator v-for="(item, index) in PageList" :key="index" :url="`../../HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item">
14 14
             <view class="Img">
15
-              <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
15
+              <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
16 16
             </view>
17
-            <text class="Info">业主家庭名称</text>
17
+            <text class="Info">{{item.name}}</text>
18 18
           </navigator>
19 19
         </view>
20 20
 
@@ -27,10 +27,12 @@
27 27
 import ScrollY from '../../../components/ScrollY/index'
28 28
 import { createNamespacedHelpers } from 'vuex'
29 29
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
30
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
30 31
 export default {
31 32
   name: 'MingXingYeZhu',
32 33
   data () {
33 34
     return {
35
+      PageList: [],
34 36
       PageData: {
35 37
         pageNum: 1,
36 38
         pageSize: 15
@@ -49,9 +51,17 @@ export default {
49 51
     ScrollY
50 52
   },
51 53
   created () {
52
-    this.Init() // 初始化
54
+    this.$authed(() => {
55
+      this.Init()
56
+    })
53 57
   },
54 58
   methods: {
59
+    ...mapUserActions([
60
+      'MainSignIn' // 获取用户信息
61
+    ]),
62
+    ...mapUserMutations([
63
+      'EditUserInfo' // 编辑用户信息
64
+    ]),
55 65
     ...mapIndexActions([
56 66
       'GetMingXingYeZhuList' // 获取明星业主列表
57 67
     ]),
@@ -62,11 +72,13 @@ export default {
62 72
       this.PageData.pageNum = 1
63 73
       this.HasNextPage = true
64 74
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
75
+      this.PageList = []
65 76
       this.ToGetPageList() // 获取列表
66 77
     },
67 78
     ToGetPageList () { // 获取列表
68
-      this.GetMingXingYeZhuList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取明星业主列表
69
-        this.HasNextPage = res.data.data.hasNextPage
79
+      this.GetMingXingYeZhuList({ queryData: { ...this.PageData, typeId: 1 } }).then((res) => { // 获取明星业主列表
80
+        this.PageList = [...this.MingXingYeZhuList]
81
+        this.HasNextPage = res.data.data.current < res.data.data.pages
70 82
         this.DataLock = false
71 83
         this.IsRefreshing = false
72 84
       }).catch(() => {

+ 26
- 11
src/pages/HuiAiXin/index.vue Voir le fichier

@@ -17,14 +17,14 @@
17 17
           </view>
18 18
           <navigator url="./StarOwner/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
19 19
         </view>
20
-        <view class="ListContainer" v-if="MingXingYeZhuList.length">
20
+        <view class="ListContainer" v-if="PageStarList.length">
21 21
           <scroll-view scroll-x="true">
22 22
             <view class="List">
23
-              <navigator v-for="(item, index) in MingXingYeZhuList" :key="index" url="./StarOwner/StarOwnerDetail/index" hover-class="other-navigator-hover" class="Item">
23
+              <navigator v-for="(item, index) in PageStarList" :key="index" :url="`../HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item">
24 24
                 <view class="Img">
25
-                  <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
25
+                  <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
26 26
                 </view>
27
-                <text class="Info">业主家庭名称</text>
27
+                <text class="Info">{{item.name}}</text>
28 28
               </navigator>
29 29
             </view>
30 30
             <view style="width: 100%; height: 20px;"></view>
@@ -40,16 +40,16 @@
40 40
           </view>
41 41
           <navigator url="./EnergyStory/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
42 42
         </view>
43
-        <view class="List" v-if="ZhengNengLiangShiJiList.length">
44
-          <navigator v-for="(item, index) in ZhengNengLiangShiJiList" :key="index" url="./EnergyStory/EnergyStoryDetail/index" hover-class="other-navigator-hover" class="Item flex-h">
43
+        <view class="List" v-if="PageStoryList.length">
44
+          <navigator v-for="(item, index) in PageStoryList" :key="index" :url="`../HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item flex-h">
45 45
             <view class="flex-item">
46
-              <text>事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题</text>
46
+              <text>{{item.name}}</text>
47 47
               <text>副标题</text>
48 48
               <text>来源</text>
49 49
             </view>
50 50
             <view class="Img">
51 51
               <view>
52
-                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
52
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
53 53
               </view>
54 54
             </view>
55 55
           </navigator>
@@ -65,10 +65,13 @@ import ScrollY from '../../components/ScrollY/index'
65 65
 import BannerSwiper from '../../components/BannerSwiper/index'
66 66
 import { createNamespacedHelpers } from 'vuex'
67 67
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
68
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
68 69
 export default {
69 70
   name: 'HuiAiXin',
70 71
   data () {
71 72
     return {
73
+      PageStarList: [],
74
+      PageStoryList: [],
72 75
       RequestNum: 0,
73 76
       IsRefreshing: false,
74 77
       DataLock: false
@@ -86,9 +89,17 @@ export default {
86 89
     BannerSwiper
87 90
   },
88 91
   created () {
89
-    this.Init()
92
+    this.$authed(() => {
93
+      this.Init()
94
+    })
90 95
   },
91 96
   methods: {
97
+    ...mapUserActions([
98
+      'MainSignIn' // 获取用户信息
99
+    ]),
100
+    ...mapUserMutations([
101
+      'EditUserInfo' // 编辑用户信息
102
+    ]),
92 103
     ...mapIndexActions([
93 104
       'GetHuiAiXinBanner', // 获取荟爱心banner
94 105
       'GetMingXingYeZhuList', // 获取明星业主列表
@@ -104,17 +115,21 @@ export default {
104 115
       this.EmptyHuiAiXinBanner() // 清空荟爱心banner
105 116
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
106 117
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
118
+      this.PageStarList = []
119
+      this.PageStoryList = []
107 120
       this.GetHuiAiXinBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'love' } }).then(() => { // 获取荟爱心banner
108 121
         this.CheckRequestNum(3) // 判断请求接口个数
109 122
       }).catch(() => {
110 123
         this.CheckRequestNum(3) // 判断请求接口个数
111 124
       })
112
-      this.GetMingXingYeZhuList({ queryData: { accountId: 5, pageNum: 1, pageSize: 10 } }).then(() => { // 获取明星业主列表
125
+      this.GetMingXingYeZhuList({ queryData: { pageNum: 1, pageSize: 10, typeId: 2 } }).then(() => { // 获取明星业主列表
126
+        this.PageStarList = [...this.MingXingYeZhuList]
113 127
         this.CheckRequestNum(3) // 判断请求接口个数
114 128
       }).catch(() => {
115 129
         this.CheckRequestNum(3) // 判断请求接口个数
116 130
       })
117
-      this.GetZhengNengLiangShiJiList({ queryData: { accountId: 5, pageNum: 1, pageSize: 10 } }).then(() => { // 获取正能量事迹列表
131
+      this.GetZhengNengLiangShiJiList({ queryData: { pageNum: 1, pageSize: 10, typeId: 6 } }).then(() => { // 获取正能量事迹列表
132
+        this.PageStoryList = [...this.ZhengNengLiangShiJiList]
118 133
         this.CheckRequestNum(3) // 判断请求接口个数
119 134
       }).catch(() => {
120 135
         this.CheckRequestNum(3) // 判断请求接口个数

+ 34
- 17
src/pages/HuiQuanYi/OwnersNews/NewsDetail/index.vue Voir le fichier

@@ -1,39 +1,56 @@
1 1
 <template>
2 2
   <view class="page ZiXunXiangQing">
3
-    
4 3
     <!-- 标题 -->
5
-    <view class="MainTitle">
6
-      <text>标题</text>
7
-      <text class="iconfont iconguanbi"></text>
4
+    <view class="MainTitle" v-if="Info !== null">
5
+      <text>{{Info.title}}</text>
6
+      <text class="iconfont iconguanbi" @tap="GoBack"></text>
8 7
     </view>
9 8
 
10 9
     <!-- 内容 -->
11
-    <view class="Container"></view>
12
-    
10
+    <view class="Container" v-if="Info !== null">
11
+      <image mode="widthFix" class="Img" :src="Info.thumb"></image>
12
+      <text>{{Info.content}}</text>
13
+    </view>
13 14
   </view>
14 15
 </template>
15 16
 
16 17
 <script>
17
-
18
+import { getCurrentInstance } from "@tarojs/taro"
19
+import { createNamespacedHelpers } from "vuex"
20
+const { mapActions: mapIndexActions } = createNamespacedHelpers("index")
18 21
 export default {
19
-  name: 'ZiXunXiangQing',
20
-  data () {
22
+  name: "ZiXunXiangQing",
23
+  data() {
21 24
     return {
22
-
25
+      CurrnetId: null,
26
+      Info: null
23 27
     }
24 28
   },
25
-  components: {
26
-  },
27
-  created () {
28
-    this.Init()
29
+  components: {},
30
+  created() {
31
+    this.CurrnetId = getCurrentInstance().router.params.id
32
+    this.$authed(() => {
33
+      this.Init()
34
+    })
29 35
   },
30 36
   methods: {
31
-    Init () {
37
+    ...mapIndexActions([
38
+      "GetNewsDetail", // 获取资讯详情
39
+    ]),
40
+    Init() {
41
+      this.GetNewsDetail({
42
+        urlData: { id: this.CurrnetId }
43
+      }).then((res) => {
44
+        this.Info = res.data.data || null
45
+      })
46
+    },
47
+    GoBack () {
48
+      wx.navigateBack()
32 49
     }
33
-  }
50
+  },
34 51
 }
35 52
 </script>
36 53
 
37 54
 <style lang="scss">
38
-@import "page.scss";
55
+@import "page.scss"
39 56
 </style>

+ 10
- 0
src/pages/HuiQuanYi/OwnersNews/NewsDetail/page.scss Voir le fichier

@@ -33,5 +33,15 @@
33 33
     margin-top: 40px;
34 34
     padding: 0 20px;
35 35
     padding-bottom: 40px;
36
+    > image {
37
+      width: 100%;
38
+    }
39
+    > text {
40
+      display: block;
41
+      font-size: 28px;
42
+      line-break: 40px;
43
+      color: #666;
44
+      margin-top: 20px;
45
+    }
36 46
   }
37 47
 }

+ 18
- 6
src/pages/HuiQuanYi/OwnersNews/index.vue Voir le fichier

@@ -9,11 +9,11 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
12
-        <view class="List" v-if="YeZhuZiXunList.length">
13
-          <navigator url="./NewsDetail/index" hover-class="other-navigator-hover" v-for="(item, index) in YeZhuZiXunList" :key="index" class="Item flex-h">
12
+        <view class="List" v-if="PageList.length">
13
+          <navigator :url="`./NewsDetail/index?id=${item.newsId}`" hover-class="other-navigator-hover" v-for="(item, index) in PageList" :key="index" class="Item flex-h">
14 14
             <view class="flex-item">
15
-              <text>资讯标题</text>
16
-              <text>4567</text>
15
+              <text>{{item.title}}</text>
16
+              <text></text>
17 17
             </view>
18 18
             <text class="iconfont iconjiantouright"></text>
19 19
           </navigator>
@@ -28,10 +28,12 @@
28 28
 import ScrollY from '../../../components/ScrollY/index'
29 29
 import { createNamespacedHelpers } from 'vuex'
30 30
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
31
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
31 32
 export default {
32 33
   name: 'YeZhuZiXun',
33 34
   data () {
34 35
     return {
36
+      PageList: [],
35 37
       PageData: {
36 38
         pageNum: 1,
37 39
         pageSize: 15
@@ -50,9 +52,17 @@ export default {
50 52
     ScrollY
51 53
   },
52 54
   created () {
53
-    this.Init() // 初始化
55
+    this.$authed(() => {
56
+      this.Init()
57
+    })
54 58
   },
55 59
   methods: {
60
+    ...mapUserActions([
61
+      'MainSignIn' // 获取用户信息
62
+    ]),
63
+    ...mapUserMutations([
64
+      'EditUserInfo' // 编辑用户信息
65
+    ]),
56 66
     ...mapIndexActions([
57 67
       'GetYeZhuZiXunList' // 获取资讯列表
58 68
     ]),
@@ -62,12 +72,14 @@ export default {
62 72
     Init () { // 初始化
63 73
       this.PageData.pageNum = 1
64 74
       this.HasNextPage = true
75
+      this.PageList = []
65 76
       this.EmptyYeZhuZiXunList() // 清空资讯列表
66 77
       this.ToGetPageList() // 获取列表
67 78
     },
68 79
     ToGetPageList () { // 获取列表
69 80
       this.GetYeZhuZiXunList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取资讯列表
70
-        this.HasNextPage = res.data.data.hasNextPage
81
+        this.PageList = [...this.YeZhuZiXunList]
82
+        this.HasNextPage = res.data.data.current < res.data.data.pages
71 83
         this.DataLock = false
72 84
         this.IsRefreshing = false
73 85
       }).catch(() => {

+ 17
- 5
src/pages/HuiQuanYi/index.vue Voir le fichier

@@ -17,12 +17,12 @@
17 17
           </view>
18 18
           <navigator url="./OwnersNews/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
19 19
         </view>
20
-        <view class="List" v-if="YeZhuZiXunList.length">
21
-          <navigator v-for="(item, index) in YeZhuZiXunList" class="flex-h" :key="index" url="./OwnersNews/NewsDetail/index" hover-class="other-navigator-hover">
20
+        <view class="List" v-if="PageList.length">
21
+          <navigator v-for="(item, index) in PageList" class="flex-h" :key="index" :url="`./OwnersNews/NewsDetail/index?id=${item.newsId}`" hover-class="other-navigator-hover">
22 22
             <view class="Num"><text>{{index + 1}}</text></view>
23 23
             <view class="flex-item">
24
-              <text>资讯标题</text>
25
-              <text>1234</text>
24
+              <text>{{item.title}}</text>
25
+              <text></text>
26 26
             </view>
27 27
           </navigator>
28 28
         </view>
@@ -37,10 +37,12 @@ import ScrollY from '../../components/ScrollY/index'
37 37
 import BannerSwiper from '../../components/BannerSwiper/index'
38 38
 import { createNamespacedHelpers } from 'vuex'
39 39
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
40
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
40 41
 export default {
41 42
   name: 'HuiQuanYi',
42 43
   data () {
43 44
     return {
45
+      PageList: [],
44 46
       RequestNum: 0,
45 47
       IsRefreshing: false,
46 48
       DataLock: false
@@ -57,9 +59,17 @@ export default {
57 59
     BannerSwiper
58 60
   },
59 61
   created () {
60
-    this.Init()
62
+    this.$authed(() => {
63
+      this.Init()
64
+    })
61 65
   },
62 66
   methods: {
67
+    ...mapUserActions([
68
+      'MainSignIn' // 获取用户信息
69
+    ]),
70
+    ...mapUserMutations([
71
+      'EditUserInfo' // 编辑用户信息
72
+    ]),
63 73
     ...mapIndexActions([
64 74
       'GetHuiQuanYiBanner', // 获取荟权益banner
65 75
       'GetYeZhuZiXunList' // 获取业主资讯列表
@@ -70,6 +80,7 @@ export default {
70 80
     ]),
71 81
     Init () {
72 82
       this.RequestNum = 0
83
+      this.PageList = []
73 84
       this.EmptyQuanYiBanner() // 清空荟权益banner
74 85
       this.EmptyYeZhuZiXunList() // 清空业主资讯列表
75 86
       this.GetHuiQuanYiBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'rights' } }).then(() => { // 获取荟权益banner
@@ -78,6 +89,7 @@ export default {
78 89
         this.CheckRequestNum(2) // 判断请求接口个数
79 90
       })
80 91
       this.GetYeZhuZiXunList({ queryData: { pageNum: 1, pageSize: 10 } }).then(() => { // 获取业主资讯列表
92
+        this.PageList = [...this.YeZhuZiXunList]
81 93
         this.CheckRequestNum(2) // 判断请求接口个数
82 94
       }).catch(() => {
83 95
         this.CheckRequestNum(2) // 判断请求接口个数

+ 47
- 8
src/pages/HuiShengHuo/ActivityList/ActivityDetail/JoinIn/index.vue Voir le fichier

@@ -6,44 +6,83 @@
6 6
       <view class="flex-h">
7 7
         <text>姓名</text>
8 8
         <view class="flex-item">
9
-          <input type="text" placeholder="请输入" />
9
+          <input type="text" placeholder="请输入" v-model="Name" />
10 10
         </view>
11 11
       </view>
12 12
       <view class="flex-h">
13 13
         <text>手机号</text>
14 14
         <view class="flex-item">
15
-          <input type="number" placeholder="请输入" />
15
+          <input type="number" placeholder="请输入" v-model="Phone" />
16 16
         </view>
17 17
       </view>
18 18
       <view class="flex-h">
19 19
         <text>人数</text>
20 20
         <view class="flex-item">
21
-          <input type="number" placeholder="请输入" />
21
+          <input type="number" placeholder="请输入" v-model="Num" />
22 22
         </view>
23 23
       </view>
24 24
     </view>
25
-    
26
-    <text>提交</text>
25
+
26
+    <text @tap="ToJoin">提交</text>
27 27
 
28 28
   </view>
29 29
 </template>
30 30
 
31 31
 <script>
32
-
32
+import { getCurrentInstance } from '@tarojs/taro'
33
+import { createNamespacedHelpers } from 'vuex'
34
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
33 35
 export default {
34 36
   name: 'LiJiBaoMing',
35 37
   data () {
36 38
     return {
37
-
39
+      Name: '',
40
+      Phone: '',
41
+      Num: '',
42
+      CurrnetId: null,
43
+      DataLock: false
38 44
     }
39 45
   },
46
+  computed: {
47
+    ...mapUserState({
48
+      UserInfo: x => x.UserInfo // 用户信息
49
+    })
50
+  },
40 51
   components: {
41 52
   },
42 53
   created () {
43
-    this.Init()
54
+    this.CurrnetId = getCurrentInstance().router.params.id
55
+    this.$authed(() => {
56
+      this.Init()
57
+    })
44 58
   },
45 59
   methods: {
60
+    ...mapUserActions([
61
+      'GetUserPhone',
62
+      'PostActivityJoin',
63
+      'MainSignIn' // 获取用户信息
64
+    ]),
65
+    ...mapUserMutations([
66
+      'EditUserInfo' // 编辑用户信息
67
+    ]),
46 68
     Init () {
69
+    },
70
+    ToJoin () { // 去报名
71
+      if (this.DataLock) return
72
+      this.DataLock = true
73
+      this.PostActivityJoin({
74
+        urlData: { id: this.ActivityInfo.activityId },
75
+        data: { data: { enrollName: this.Name, enrollPhone: this.Phone, enrollNum: this.Num } }
76
+      }).then((res) => {
77
+        this.DataLock = false
78
+        wx.showToast({
79
+          title: '报名成功',
80
+          icon: 'none',
81
+          duration: 2000
82
+        })
83
+      }).catch(() => {
84
+        this.DataLock = false
85
+      })
47 86
     }
48 87
   }
49 88
 }

+ 104
- 50
src/pages/HuiShengHuo/ActivityList/ActivityDetail/index.vue Voir le fichier

@@ -2,57 +2,47 @@
2 2
   <view class="page HuoDongXiangQing flex-v">
3 3
 
4 4
     <view class="flex-item">
5
-      <view>
5
+      <view v-if="ActivityInfo !== null">
6 6
 
7 7
         <!-- 活动主要信息 -->
8 8
         <view class="MainInfo">
9
-          <text>活动名称</text>
10
-          <view class="SubInfo flex-h">
11
-            <view class="flex-item">
12
-              <text class="iconfont iconxianshi"></text>
13
-              <text>1245</text>
14
-            </view>
15
-            <view class="Time">
16
-              <text class="iconfont iconshijian"></text>
17
-              <text>2020-08-07</text>
18
-            </view>
19
-          </view>
9
+          <text>{{ActivityInfo.name}}</text>
20 10
           <view class="Line flex-h">
21 11
             <text>活动时间:</text>
22
-            <text class="flex-item">2020-08-07 至 2020-08-08</text>
12
+            <text class="flex-item">{{ToolClass.DateFormat(new Date(ActivityInfo.startDate).getTime())}} 至 {{ToolClass.DateFormat(new Date(ActivityInfo.endDate).getTime())}}</text>
23 13
           </view>
24 14
           <view class="Line flex-h">
25 15
             <text>活动地址:</text>
26
-            <text class="flex-item">南京市江宁区丽园荟广场</text>
16
+            <text class="flex-item">{{ActivityInfo.address}}</text>
27 17
           </view>
28 18
           <view class="Line flex-h">
29 19
             <text>报名截止:</text>
30
-            <text class="flex-item">2020-08-06 18:30</text>
20
+            <text class="flex-item">{{ToolClass.DateFormat(new Date(ActivityInfo.enrollEnd).getTime())}}</text>
31 21
           </view>
32 22
         </view>
33 23
 
34 24
         <!-- 活动详情 -->
35 25
         <view class="DetailContainer">
36 26
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huodongxiangqing.png"></image>
37
-          <view class="Text"></view>
27
+          <view class="Text">
28
+            <rich-text :nodes="ActivityInfo.detail"></rich-text>
29
+          </view>
38 30
         </view>
39 31
 
40 32
         <!-- 投票 -->
41
-        <view class="VoteContainer">
33
+        <view class="VoteContainer" v-if="IsVote">
42 34
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/toupiao.png"></image>
43 35
           <view class="List">
44
-            <view v-for="(item, index) in VoteList" :key="index">
45
-              <text>{{index + 1}}.{{item.Question}}</text>
46
-              <view class="flex-h" v-for="(subItem, subIndex) in item.Answer" :key="subIndex">
47
-                <text class="iconfont iconweigouxuan" v-if="!subItem.active"></text>
48
-                <text class="iconfont icongouxuan" v-else></text>
49
-                <view class="flex-item">
50
-                  <text>{{subItem.name}}</text>
51
-                </view>
36
+            <view v-for="(item, index) in VoteList" :key="index" class="flex-h" @tap="VoteIndex = index">
37
+              <text class="iconfont iconweigouxuan" v-if="VoteIndex !== index"></text>
38
+              <text class="iconfont icongouxuan" v-else></text>
39
+              <view class="flex-item">
40
+                <text>{{item.name}}</text>
52 41
               </view>
53 42
             </view>
54 43
           </view>
55
-          <text>提交</text>
44
+          <text @tap="ToPostActivityVote">提交</text>
45
+          <button open-type="getPhoneNumber" class="GetPhoneBtn" v-if="!DataLock && ShowGetPhoneBtn" @getphonenumber="GetPhoneNumber">授权手机号</button>
56 46
         </view>
57 47
 
58 48
       </view>
@@ -60,45 +50,36 @@
60 50
 
61 51
     <!-- 底部栏 -->
62 52
     <view class="Bottom flex-h">
63
-      <view class="flex-item">
53
+      <view class="flex-item" @tap="LinkTo('../../index')">
64 54
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huishenghuo.png"></image>
65 55
       </view>
66 56
       <view class="flex-item">
67 57
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/fenxiang.png"></image>
68 58
       </view>
69
-      <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/lijibaomingbtn.png"></image>
59
+      <image mode="heightFix" v-if="IsEnroll" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/lijibaomingbtn.png" @tap="ToJoin"></image>
60
+      <button open-type="getPhoneNumber" class="GetPhoneBottomBtn" v-if="!DataLock && ShowGetPhoneBtn && IsEnroll" @getphonenumber="GetPhoneNumber">授权手机号</button>
70 61
     </view>
71 62
 
72 63
   </view>
73 64
 </template>
74 65
 
75 66
 <script>
67
+import { getCurrentInstance } from '@tarojs/taro'
76 68
 import { createNamespacedHelpers } from 'vuex'
77 69
 const { mapActions: mapIndexActions } = createNamespacedHelpers('index')
78
-const { mapState: mapUserState } = createNamespacedHelpers('user')
70
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
79 71
 export default {
80 72
   name: 'HuoDongXiangQing',
81 73
   data () {
82 74
     return {
83
-      DataLock: false,
84
-      VoteList: [
85
-        {
86
-          Question: '问题1',
87
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
88
-        }, {
89
-          Question: '问题2',
90
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
91
-        }, {
92
-          Question: '问题3',
93
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
94
-        }, {
95
-          Question: '问题4',
96
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
97
-        }, {
98
-          Question: '问题5',
99
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
100
-        }
101
-      ]
75
+      ShowGetPhoneBtn: false,
76
+      VoteIndex: null,
77
+      VoteList: [],
78
+      ActivityInfo: null,
79
+      IsVote: false,
80
+      IsEnroll: false,
81
+      CurrnetId: null,
82
+      DataLock: false
102 83
     }
103 84
   },
104 85
   computed: {
@@ -108,15 +89,88 @@ export default {
108 89
   },
109 90
   components: {
110 91
   },
92
+  onShareAppMessage () {
93
+    return {
94
+      title: this.ActivityInfo.shareTitle,
95
+      path: `/pages/HuiShengHuo/ActivityList/ActivityDetail/index?id=${this.ActivityInfo.activityId}`,
96
+      imageUrl: this.ActivityInfo.shareImg
97
+    }
98
+  },
111 99
   created () {
112
-    this.Init()
100
+    wx.showShareMenu({
101
+      withShareTicket: true,
102
+      menus: ['shareAppMessage', 'shareTimeline']
103
+    })
104
+    this.CurrnetId = getCurrentInstance().router.params.id
105
+    this.$authed(() => {
106
+      this.Init()
107
+    })
113 108
   },
114 109
   methods: {
110
+    ...mapUserActions([ // 活动投票
111
+      'PostActivityVote',
112
+      'GetUserPhone',
113
+      'PostActivityJoin',
114
+      'MainSignIn' // 获取用户信息
115
+    ]),
116
+    ...mapUserMutations([
117
+      'EditUserInfo' // 编辑用户信息
118
+    ]),
115 119
     ...mapIndexActions([
116 120
       'GetActivityDetail' // 获取活动详情
117 121
     ]),
118 122
     Init () {
119
-      this.GetActivityDetail({ urlData: { id: 1 } })
123
+      this.ShowGetPhoneBtn = this.UserInfo === null || this.UserInfo.Phone === undefined || this.UserInfo.Phone === null
124
+      this.GetActivityDetail({ urlData: { id: this.CurrnetId } }).then((res) => {
125
+        this.ActivityInfo = res.data.data
126
+        this.IsEnroll = this.ActivityInfo.isEnroll
127
+        if (this.ActivityInfo.isVote) {
128
+          this.VoteList = this.ActivityInfo.voteItemList.slice(0)
129
+        }
130
+        this.IsVote = this.ActivityInfo.isVote
131
+        wx.ShareAppMessage({
132
+          title: this.ActivityInfo.shareTitle,
133
+          imageUrl: this.ActivityInfo.shareImg
134
+        })
135
+      })
136
+    },
137
+    LinkTo (url) {
138
+      wx.switchTab({ url })
139
+    },
140
+    ToJoin () { // 报名
141
+      wx.navigateTo({ url: `./JoinIn/index?id=${this.ActivityInfo.activityId}` })
142
+    },
143
+    ToPostActivityVote () { // 活动投票
144
+      if (this.DataLock || this.VoteIndex === null) return
145
+      this.DataLock = true
146
+      this.PostActivityVote({
147
+        urlData: { id: this.ActivityInfo.activityId },
148
+        data: { data: { itemId: this.VoteList[this.VoteIndex].itemId } }
149
+      }).then(() => {
150
+        this.DataLock = false
151
+        wx.showToast({
152
+          title: '投票成功',
153
+          icon: 'none',
154
+          duration: 2000
155
+        })
156
+      }).catch(() => {
157
+        this.DataLock = false
158
+      })
159
+    },
160
+    GetPhoneNumber (e) {
161
+      if (this.DataLock) return
162
+      this.DataLock = true
163
+      this.GetUserPhone({
164
+        urlData: { personId: this.UserInfo.PersonId },
165
+        data: { data: { sessionKey: this.UserInfo.SessionKey, encryptedData: e.detail.encryptedData, iv: e.detail.iv } }
166
+      }).then((res) => {
167
+        this.ShowGetPhoneBtn = false
168
+        this.EditUserInfo({ name: 'OpenId', value: res.data.data.openId })
169
+        this.EditUserInfo({ name: 'Phone', value: res.data.data.phone })
170
+        this.DataLock = false
171
+      }).catch(() => {
172
+        this.DataLock = false
173
+      })
120 174
     }
121 175
   }
122 176
 }

+ 29
- 20
src/pages/HuiShengHuo/ActivityList/ActivityDetail/page.scss Voir le fichier

@@ -97,34 +97,26 @@
97 97
         }
98 98
         > .List {
99 99
           padding-top: 20px;
100
+          padding-left: 20px;
100 101
           > view {
101
-            padding-left: 20px;
102 102
             margin-bottom: 20px;
103
+            align-items: flex-start;
104
+            padding: 22px 0;
105
+            border-bottom: 2px solid #f5f5f5;
103 106
             > text {
104
-              display: block;
105
-              font-size: 28px;
106
-              color: #666;
107
+              font-size: 38px;
107 108
               line-height: 40px;
109
+              margin-right: 20px;
110
+              color: #fe4e45;
108 111
             }
109 112
             > view {
110
-              align-items: flex-start;
111
-              padding: 22px 0;
112
-              border-bottom: 2px solid #f5f5f5;
113
+              position: relative;
114
+              overflow: hidden;
113 115
               > text {
114
-                font-size: 38px;
116
+                display: block;
117
+                font-size: 28px;
118
+                color: #666;
115 119
                 line-height: 40px;
116
-                margin-right: 20px;
117
-                color: #fe4e45;
118
-              }
119
-              > view {
120
-                position: relative;
121
-                overflow: hidden;
122
-                > text {
123
-                  display: block;
124
-                  font-size: 28px;
125
-                  color: #666;
126
-                  line-height: 40px;
127
-                }
128 120
               }
129 121
             }
130 122
           }
@@ -141,12 +133,20 @@
141 133
           text-align: center;
142 134
           box-shadow: 0 5px 10px 5px rgba(253, 221, 57, 0.3);
143 135
         }
136
+        > .GetPhoneBtn {
137
+          line-height: 100px;
138
+          margin-top: -100px;
139
+          opacity: 0;
140
+        }
144 141
       }
145 142
     }
146 143
   }
147 144
   > .Bottom {
148 145
     background: #fff;
146
+    position: relative;
147
+    overflow: hidden;
149 148
     > view {
149
+      height: 90px;
150 150
       position: relative;
151 151
       overflow: hidden;
152 152
       > image {
@@ -161,5 +161,14 @@
161 161
     > image {
162 162
       height: 90px;
163 163
     }
164
+    > .GetPhoneBottomBtn {
165
+      height: 90px;
166
+      width: 380px;
167
+      display: block;
168
+      position: absolute;
169
+      right: 0;
170
+      top: 0;
171
+      opacity: 0;
172
+    }
164 173
   }
165 174
 }

+ 24
- 12
src/pages/HuiShengHuo/ActivityList/index.vue Voir le fichier

@@ -17,21 +17,21 @@
17 17
 
18 18
         <view class="ActivityList">
19 19
           <view class="List">
20
-            <view class="Item" v-for="(item, index) in ActivityList" :key="index">
21
-              <view class="Img" @tap="LinkTo('./ActivityDetail/index')">
22
-                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
23
-              </view>
20
+            <view class="Item" v-for="(item, index) in PageList" :key="index">
21
+              <navigator class="Img" :url="`./ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover">
22
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
23
+              </navigator>
24 24
               <view class="Info">
25
-                <text @tap="LinkTo('./ActivityDetail/index')">活动名称</text>
25
+                <text>{{item.name}}</text>
26 26
                 <view class="flex-h">
27
-                  <text class="flex-item">参与截止时间:2020-08-20 16:00</text>
28
-                  <navigator url="./ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即报名</navigator>
29
-                  <navigator url="./ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即投票</navigator>
30
-                  <view @tap="LinkTo('./ActivityDetail/index')">已结束</view>
27
+                  <text class="flex-item">参与截止时间:{{ToolClass.DateFormat(new Date(item.enrollEnd).getTime())}}</text>
28
+                  <navigator :url="`./ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Btn" v-if="item.isEnroll">立即报名</navigator>
29
+                  <navigator :url="`./ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Btn" v-if="item.isVote">立即投票</navigator>
30
+                  <view v-if="new Date(item.endDate).getTime() <= Date.now()">已结束</view>
31 31
                 </view>
32 32
               </view>
33 33
             </view>
34
-            <view style="width: 100%; height: 20px;"></view>
34
+            <view style="width: 100%; height: 10px;"></view>
35 35
           </view>
36 36
         </view>
37 37
 
@@ -44,6 +44,7 @@
44 44
 import ScrollY from '../../../components/ScrollY/index'
45 45
 import { createNamespacedHelpers } from 'vuex'
46 46
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
47
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
47 48
 export default {
48 49
   name: 'JingCaiHuoDong',
49 50
   data () {
@@ -52,6 +53,7 @@ export default {
52 53
         pageNum: 1,
53 54
         pageSize: 15
54 55
       },
56
+      PageList: [],
55 57
       HuoDongNavList: [
56 58
         { Name: '暖场活动', Id: '1' },
57 59
         { Name: '六点半学堂', Id: '2' },
@@ -75,9 +77,17 @@ export default {
75 77
     ScrollY
76 78
   },
77 79
   created () {
78
-    this.Init() // 初始化
80
+    this.$authed(() => {
81
+      this.Init()
82
+    })
79 83
   },
80 84
   methods: {
85
+    ...mapUserActions([
86
+      'MainSignIn' // 获取用户信息
87
+    ]),
88
+    ...mapUserMutations([
89
+      'EditUserInfo' // 编辑用户信息
90
+    ]),
81 91
     ...mapIndexActions([
82 92
       'GetActivityList' // 获取活动列表
83 93
     ]),
@@ -87,6 +97,7 @@ export default {
87 97
     Init () { // 初始化
88 98
       this.PageData.pageNum = 1
89 99
       this.HasNextPage = true
100
+      this.PageList = []
90 101
       this.EmptyActivityList() // 清空活动列表
91 102
       this.ToGetPageList() // 获取列表
92 103
     },
@@ -110,7 +121,8 @@ export default {
110 121
     },
111 122
     ToGetPageList () { // 获取列表
112 123
       this.GetActivityList({ queryData: { ...this.PageData, typeId: this.CurrentNavId } }).then((res) => { // 获取活动列表
113
-        this.HasNextPage = res.data.data.hasNextPage
124
+        this.PageList = [...this.ActivityList]
125
+        this.HasNextPage = res.data.data.current < res.data.data.pages
114 126
         this.DataLock = false
115 127
         this.IsRefreshing = false
116 128
       }).catch(() => {

+ 41
- 12
src/pages/HuiShengHuo/PhotoList/index.vue Voir le fichier

@@ -10,11 +10,13 @@
10 10
           </view>
11 11
         </view>
12 12
         <view class="List">
13
-          <view v-for="(item, index) in List" :key="index">
13
+          <view v-for="(item, index) in PageList" :key="index">
14 14
             <text>{{item.Month}}</text>
15 15
             <view>
16 16
               <view v-for="(subItem, subIndex) in item.List" :key="subIndex">
17
-                <navigator url="./PhotoDetail/index" hover-class="other-navigator-hover" class="Img"></navigator>
17
+                <view class="Img" @tap="CheckBigImg(subItem.imgUrl)">
18
+                  <image mode="aspectFill" class="centerLabel" :src="subItem.imgUrl"></image>
19
+                </view>
18 20
               </view>
19 21
             </view>
20 22
           </view>
@@ -22,6 +24,10 @@
22 24
       </view>
23 25
 
24 26
     </ScrollY>
27
+
28
+    <view class="BigImg" v-if="ShowBigImg" @tap="ShowBigImg = false">
29
+      <image mode="aspectFit" class="centerLabel" :src="BigImgUrl"></image>
30
+    </view>
25 31
   </view>
26 32
 </template>
27 33
 
@@ -29,23 +35,21 @@
29 35
 import ScrollY from '../../../components/ScrollY/index'
30 36
 import { createNamespacedHelpers } from 'vuex'
31 37
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
38
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
32 39
 export default {
33 40
   name: 'HuoDongZhaoPianQiang',
34 41
   data () {
35 42
     return {
43
+      ShowBigImg: false,
44
+      BigImgUrl: null,
45
+      PageList: [],
36 46
       PageData: {
37 47
         pageNum: 1,
38 48
         pageSize: 15
39 49
       },
40 50
       HasNextPage: true,
41 51
       IsRefreshing: false,
42
-      DataLock: false,
43
-      List: [
44
-        { Month: '8月份', List: ['', '', '', '', '', '', '', '', '', ''] },
45
-        { Month: '7月份', List: ['', '', '', '', '', '', '', '', '', ''] },
46
-        { Month: '6月份', List: ['', '', '', '', '', '', '', '', '', ''] },
47
-        { Month: '5月份', List: ['', '', '', '', '', '', '', '', '', ''] }
48
-      ]
52
+      DataLock: false
49 53
     }
50 54
   },
51 55
   computed: {
@@ -57,9 +61,17 @@ export default {
57 61
     ScrollY
58 62
   },
59 63
   created () {
60
-    this.Init() // 初始化
64
+    this.$authed(() => {
65
+      this.Init()
66
+    })
61 67
   },
62 68
   methods: {
69
+    ...mapUserActions([
70
+      'MainSignIn' // 获取用户信息
71
+    ]),
72
+    ...mapUserMutations([
73
+      'EditUserInfo' // 编辑用户信息
74
+    ]),
63 75
     ...mapIndexActions([
64 76
       'GetPhotoList' // 获取照片墙列表
65 77
     ]),
@@ -69,12 +81,29 @@ export default {
69 81
     Init () { // 初始化
70 82
       this.PageData.pageNum = 1
71 83
       this.HasNextPage = true
84
+      this.PageList = []
72 85
       this.EmptyPhotoList() // 清空照片墙列表
73 86
       this.ToGetPageList() // 获取列表
74 87
     },
88
+    CheckBigImg (url) { // 查看大图
89
+      this.BigImgUrl = url
90
+      this.ShowBigImg = true
91
+    },
75 92
     ToGetPageList () { // 获取列表
76
-      this.GetPhotoList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取照片墙列表
77
-        this.HasNextPage = res.data.data.hasNextPage
93
+      this.GetPhotoList({ queryData: { ...this.PageData } }).then((res) => { // 获取照片墙列表
94
+        let Arr = []
95
+        this.PhotoList.map((item) => {
96
+          let Year = new Date(item.createDate).getFullYear()
97
+          let Month = new Date(item.createDate).getMonth() + 1
98
+          Month = Month > 9 ? Month : `0${Month}`
99
+          if (Arr.length && `${Year}-${Month}` === Arr[Arr.length - 1].Month) {
100
+            Arr[Arr.length - 1].List.push({ ...item })
101
+          } else {
102
+            Arr.push({ Month: `${Year}-${Month}`, List: [{ ...item} ] })
103
+          }
104
+        })
105
+        this.PageList = Arr
106
+        this.HasNextPage = res.data.data.current < res.data.data.pages
78 107
         this.DataLock = false
79 108
         this.IsRefreshing = false
80 109
       }).catch(() => {

+ 10
- 0
src/pages/HuiShengHuo/PhotoList/page.scss Voir le fichier

@@ -2,6 +2,16 @@
2 2
   width: 100%;
3 3
   height: 100%;
4 4
   background: #fff;
5
+  >.BigImg {
6
+    width: 100%;
7
+    position: absolute;
8
+    left: 0;
9
+    top: 0;
10
+    bottom: 0;
11
+    z-index: 100;
12
+    background: rgba(0, 0, 0, 0.7);
13
+    overflow: hidden;
14
+  }
5 15
   .PhotoList {
6 16
     > .flex-h {
7 17
       padding: 0 20px;

+ 83
- 56
src/pages/HuiShengHuo/index.vue Voir le fichier

@@ -1,63 +1,70 @@
1 1
 <template>
2
-  <view class="page HuiShengHuo">
3
-    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
2
+  <BasicLayout>
3
+    <view class="page HuiShengHuo">
4
+      <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
4 5
 
5
-      <!-- banner -->
6
-      <view class="Banner">
7
-        <view>
8
-          <BannerSwiper :List="IndexBanner"></BannerSwiper>
6
+        <!-- banner -->
7
+        <view class="Banner">
8
+          <view>
9
+            <BannerSwiper :List="IndexBanner"></BannerSwiper>
10
+          </view>
9 11
         </view>
10
-      </view>
11 12
 
12
-      <!-- 活动照片墙 -->
13
-      <view class="PhotoList">
14
-        <view class="flex-h">
15
-          <view class="flex-item">
16
-            <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huodongzhaopianqiang.png"></image>
13
+        <!-- 活动照片墙 -->
14
+        <view class="PhotoList">
15
+          <view class="flex-h">
16
+            <view class="flex-item">
17
+              <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huodongzhaopianqiang.png"></image>
18
+            </view>
19
+            <navigator url="./PhotoList/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
17 20
           </view>
18
-          <navigator url="./PhotoList/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
19
-        </view>
20
-        <view class="ListContainer" v-if="PhotoList.length">
21
-          <scroll-view scroll-x="true">
22
-            <view class="List">
23
-              <view v-for="(item, index) in PhotoList" :key="index">
24
-                <view>
25
-                  <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
21
+          <view class="ListContainer" v-if="PhotoList.length">
22
+            <scroll-view scroll-x="true">
23
+              <view class="List">
24
+                <view v-for="(item, index) in PhotoList" :key="index">
25
+                  <view @tap="CheckBigImg(item.imgUrl)">
26
+                    <image mode="aspectFill" class="centerLabel" :src="item.imgUrl"></image>
27
+                  </view>
26 28
                 </view>
27 29
               </view>
28
-            </view>
29
-          </scroll-view>
30
-        </view>
31
-      </view>
32
-
33
-      <!-- 精彩活动 -->
34
-      <view class="ActivityList">
35
-        <view class="flex-h">
36
-          <view class="flex-item">
37
-            <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/jingcaihuodong.png"></image>
30
+            </scroll-view>
38 31
           </view>
39
-          <navigator url="./ActivityList/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
40 32
         </view>
41
-        <view class="List" v-if="ActivityList.length">
42
-          <view class="Item" v-for="(item, index) in ActivityList" :key="index">
43
-            <view class="Img">
44
-              <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
33
+
34
+        <!-- 精彩活动 -->
35
+        <view class="ActivityList">
36
+          <view class="flex-h">
37
+            <view class="flex-item">
38
+              <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/jingcaihuodong.png"></image>
45 39
             </view>
46
-            <view class="Info">
47
-              <text>活动名称</text>
48
-              <view class="flex-h">
49
-                <text class="flex-item">参与截止时间:2020-08-20 16:00</text>
50
-                <navigator url="./ActivityList/ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即报名</navigator>
51
-                <navigator url="./ActivityList/ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即投票</navigator>
52
-                <view>已结束</view>
40
+            <navigator url="./ActivityList/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
41
+          </view>
42
+          <view class="List" v-if="ActivityList.length">
43
+            <view class="Item" v-for="(item, index) in ActivityList" :key="index">
44
+              <navigator class="Img" :url="`./ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover">
45
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
46
+              </navigator>
47
+              <view class="Info">
48
+                <text>{{item.name}}</text>
49
+                <view class="flex-h">
50
+                  <text class="flex-item">参与截止时间:{{ToolClass.DateFormat(new Date(item.enrollEnd).getTime())}}</text>
51
+                  <navigator :url="`./ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Btn" v-if="item.isEnroll">立即报名</navigator>
52
+                  <navigator :url="`./ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Btn" v-if="item.isVote">立即投票</navigator>
53
+                  <view v-if="new Date(item.endDate).getTime() <= Date.now()">已结束</view>
54
+                </view>
53 55
               </view>
54 56
             </view>
57
+            <view style="width: 100%; height: 10px;"></view>
55 58
           </view>
56 59
         </view>
57
-      </view>
58 60
 
59
-    </ScrollY>
60
-  </view>
61
+      </ScrollY>
62
+
63
+      <view class="BigImg" v-if="ShowBigImg" @tap="ShowBigImg = false">
64
+        <image mode="aspectFit" class="centerLabel" :src="BigImgUrl"></image>
65
+      </view>
66
+    </view>
67
+  </BasicLayout>
61 68
 </template>
62 69
 
63 70
 <script>
@@ -65,10 +72,15 @@ import ScrollY from '../../components/ScrollY/index'
65 72
 import BannerSwiper from '../../components/BannerSwiper/index'
66 73
 import { createNamespacedHelpers } from 'vuex'
67 74
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
75
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
68 76
 export default {
69 77
   name: 'HuiShengHuo',
70 78
   data () {
71 79
     return {
80
+      ShowBigImg: false,
81
+      BigImgUrl: null,
82
+      PageActivityList: [],
83
+      PagePhotoList: [],
72 84
       RequestNum: 0,
73 85
       IsRefreshing: false,
74 86
       DataLock: false
@@ -86,9 +98,17 @@ export default {
86 98
     BannerSwiper
87 99
   },
88 100
   created () {
89
-    this.Init()
101
+    this.$authed(() => {
102
+      this.Init()
103
+    })
90 104
   },
91 105
   methods: {
106
+    ...mapUserActions([
107
+      'MainSignIn' // 获取用户信息
108
+    ]),
109
+    ...mapUserMutations([
110
+      'EditUserInfo' // 编辑用户信息
111
+    ]),
92 112
     ...mapIndexActions([
93 113
       'GetIndexBanner', // 获取首页banner
94 114
       'GetPhotoList', // 获取照片墙列表
@@ -104,21 +124,28 @@ export default {
104 124
       this.EmptyIndexBanner() // 清空首页banner
105 125
       this.EmptyPhotoList() // 清空照片墙列表
106 126
       this.EmptyActivityList() // 清空活动列表
127
+      this.PageActivityList = []
128
+      this.PagePhotoList = []
107 129
       this.GetIndexBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'life' } }).then(() => { // 获取首页banner
108
-        this.CheckRequestNum(2) // 判断请求接口个数
130
+        this.CheckRequestNum(3) // 判断请求接口个数
109 131
       }).catch(() => {
110
-        this.CheckRequestNum(2) // 判断请求接口个数
132
+        this.CheckRequestNum(3) // 判断请求接口个数
111 133
       })
112
-      // this.GetPhotoList({ queryData: { pageNum: 1, pageSize: 10, typeId: 2 } }).then(() => { // 获取照片墙列表
113
-      //   this.CheckRequestNum(2) // 判断请求接口个数
114
-      // }).catch(() => {
115
-      //   this.CheckRequestNum(2) // 判断请求接口个数
116
-      // })
117
-      this.GetActivityList({ queryData: { pageNum: 1, pageSize: 10, typeId: 1 } }).then(() => { // 获取活动列表
118
-        this.CheckRequestNum(2) // 判断请求接口个数
134
+      this.GetPhotoList({ queryData: { pageNum: 1, pageSize: 10 } }).then(() => { // 获取照片墙列表
135
+        this.CheckRequestNum(3) // 判断请求接口个数
119 136
       }).catch(() => {
120
-        this.CheckRequestNum(2) // 判断请求接口个数
137
+        this.CheckRequestNum(3) // 判断请求接口个数
121 138
       })
139
+      this.GetActivityList({ queryData: { pageNum: 1, pageSize: 10, typeId: 2 } }).then(() => { // 获取活动列表
140
+        this.PageActivityList = [...this.ActivityList]
141
+        this.CheckRequestNum(3) // 判断请求接口个数
142
+      }).catch(() => {
143
+        this.CheckRequestNum(3) // 判断请求接口个数
144
+      })
145
+    },
146
+    CheckBigImg (url) { // 查看大图
147
+      this.BigImgUrl = url
148
+      this.ShowBigImg = true
122 149
     },
123 150
     CheckRequestNum (num) { // 判断请求接口个数
124 151
       this.RequestNum += 1

+ 11
- 0
src/pages/HuiShengHuo/page.scss Voir le fichier

@@ -1,6 +1,17 @@
1 1
 .page.HuiShengHuo {
2 2
   width: 100%;
3 3
   height: 100%;
4
+  position: relative;
5
+  >.BigImg {
6
+    width: 100%;
7
+    position: absolute;
8
+    left: 0;
9
+    top: 0;
10
+    bottom: 0;
11
+    z-index: 100;
12
+    background: rgba(0, 0, 0, 0.7);
13
+    overflow: hidden;
14
+  }
4 15
   .Banner {
5 16
     width: 100%;
6 17
     padding-bottom: 38%;

+ 1
- 1
src/pages/WoDe/MyActivityList/index.vue Voir le fichier

@@ -72,7 +72,7 @@ export default {
72 72
     },
73 73
     ToGetPageList () { // 获取列表
74 74
       this.GetUserActivityList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取我的活动列表
75
-        this.HasNextPage = res.data.data.hasNextPage
75
+        this.HasNextPage = res.data.data.current < res.data.data.pages
76 76
         this.DataLock = false
77 77
         this.IsRefreshing = false
78 78
       }).catch(() => {

+ 8
- 6
src/pages/WoDe/index.vue Voir le fichier

@@ -13,7 +13,7 @@
13 13
           <view class="flex-item">
14 14
             <navigator url="../SignIn/index" hover-class="other-navigator-hover" class="SiginIn" v-if="UserInfo === null || UserInfo.Phone === undefined || UserInfo.Phone === null">立即登录</navigator>
15 15
             <text v-else>{{UserInfo.Name}}</text>
16
-            <text v-else>{{UserInfo.Phone}}</text>
16
+            <text  v-if="!(UserInfo === null || UserInfo.Phone === undefined || UserInfo.Phone === null)">{{UserInfo.Phone}}</text>
17 17
           </view>
18 18
         </view>
19 19
       </view>
@@ -28,13 +28,13 @@
28 28
         <text class="flex-item">我的报名</text>
29 29
         <text class="iconfont iconjiantouright"></text>
30 30
       </navigator>
31
-      <navigator url="./Feedback/index" hover-class="other-navigator-hover" class="flex-h">
31
+      <!-- <navigator url="./Feedback/index" hover-class="other-navigator-hover" class="flex-h">
32 32
         <view>
33 33
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/wodeicon2.png"></image>
34 34
         </view>
35 35
         <text class="flex-item">意见反馈</text>
36 36
         <text class="iconfont iconjiantouright"></text>
37
-      </navigator>
37
+      </navigator> -->
38 38
     </view>
39 39
 
40 40
     <!-- 授权头像获取弹窗 -->
@@ -62,14 +62,16 @@ export default {
62 62
     GetUserIcon
63 63
   },
64 64
   created () {
65
-    this.Init() // 初始化
65
+    this.$authed(() => {
66
+      this.Init()
67
+    })
66 68
   },
67 69
   methods: {
68 70
     ...mapUserActions([
69
-      ''
71
+      'MainSignIn' // 获取用户信息
70 72
     ]),
71 73
     ...mapUserMutations([
72
-      ''
74
+      'EditUserInfo' // 编辑用户信息
73 75
     ]),
74 76
     Init () { // 初始化
75 77
     }

+ 3
- 0
src/store/index.js Voir le fichier

@@ -1,8 +1,11 @@
1 1
 import Vue from 'vue'
2 2
 import Vuex from 'vuex'
3
+import { storeAuthPlugin } from '@/util/auth-plugin'
4
+
3 5
 Vue.use(Vuex)
4 6
 
5 7
 const store = new Vuex.Store({
8
+  plugins: [storeAuthPlugin],
6 9
   state: {
7 10
   },
8 11
   mutations: {

+ 27
- 12
src/store/index/index.js Voir le fichier

@@ -79,6 +79,21 @@ export default {
79 79
     }
80 80
   },
81 81
   actions: {
82
+    GetNewsDetail (context, payload) { // 获取资讯详情
83
+      return new Promise((resolve, reject) => {
84
+        ToolClass.WxRequest({
85
+          url: Api.GetNewsDetail.url,
86
+          method: Api.GetNewsDetail.method,
87
+          ...payload,
88
+          success (res) {
89
+            resolve(res)
90
+          },
91
+          error (res) {
92
+            reject(res)
93
+          }
94
+        })
95
+      })
96
+    },
82 97
     GetUserActivityList (context, payload) { // 获取我的活动列表
83 98
       return new Promise((resolve, reject) => {
84 99
         ToolClass.WxRequest({
@@ -86,7 +101,7 @@ export default {
86 101
           method: Api.GetUserActivityList.method,
87 102
           ...payload,
88 103
           success (res) {
89
-            context.commit('UpdateUserActivityList', res.data.data.list)
104
+            context.commit('UpdateUserActivityList', res.data.data.records)
90 105
             resolve(res)
91 106
           },
92 107
           error (res) {
@@ -102,7 +117,7 @@ export default {
102 117
           method: Api.GetHuoDongNavList.method,
103 118
           ...payload,
104 119
           success (res) {
105
-            context.commit('UpdateHuoDongNavList', res.data.data.list)
120
+            context.commit('UpdateHuoDongNavList', res.data.data.records)
106 121
             resolve(res)
107 122
           },
108 123
           error (res) {
@@ -118,7 +133,7 @@ export default {
118 133
           method: Api.GetZhengNengLiangShiJiList.method,
119 134
           ...payload,
120 135
           success (res) {
121
-            context.commit('UpdateZhengNengLiangShiJiList', res.data.data.list)
136
+            context.commit('UpdateZhengNengLiangShiJiList', res.data.data.records)
122 137
             resolve(res)
123 138
           },
124 139
           error (res) {
@@ -134,7 +149,7 @@ export default {
134 149
           method: Api.GetMingXingYeZhuList.method,
135 150
           ...payload,
136 151
           success (res) {
137
-            context.commit('UpdateMingXingYeZhuList', res.data.data.list)
152
+            context.commit('UpdateMingXingYeZhuList', res.data.data.records)
138 153
             resolve(res)
139 154
           },
140 155
           error (res) {
@@ -150,7 +165,7 @@ export default {
150 165
           method: Api.GetHuiAiXinBanner.method,
151 166
           ...payload,
152 167
           success (res) {
153
-            context.commit('UpdateHuiAiXinBanner', res.data.data.list)
168
+            context.commit('UpdateHuiAiXinBanner', res.data.data.records)
154 169
             resolve(res)
155 170
           },
156 171
           error (res) {
@@ -166,7 +181,7 @@ export default {
166 181
           method: Api.GetYeZhuZiXunList.method,
167 182
           ...payload,
168 183
           success (res) {
169
-            context.commit('UpdateYeZhuZiXunList', res.data.data.list)
184
+            context.commit('UpdateYeZhuZiXunList', res.data.data.records)
170 185
             resolve(res)
171 186
           },
172 187
           error (res) {
@@ -182,7 +197,7 @@ export default {
182 197
           method: Api.GetHuiQuanYiBanner.method,
183 198
           ...payload,
184 199
           success (res) {
185
-            context.commit('UpdateQuanYiBanner', res.data.data.list)
200
+            context.commit('UpdateQuanYiBanner', res.data.data.records)
186 201
             resolve(res)
187 202
           },
188 203
           error (res) {
@@ -198,7 +213,7 @@ export default {
198 213
           method: Api.GetIndexBanner.method,
199 214
           ...payload,
200 215
           success (res) {
201
-            context.commit('UpdateIndexBanner', res.data.data.list)
216
+            context.commit('UpdateIndexBanner', res.data.data.records)
202 217
             resolve(res)
203 218
           },
204 219
           error (res) {
@@ -214,7 +229,7 @@ export default {
214 229
           method: Api.GetPhotoList.method,
215 230
           ...payload,
216 231
           success (res) {
217
-            context.commit('UpdatePhotoList', res.data.data.list)
232
+            context.commit('UpdatePhotoList', res.data.data.records)
218 233
             resolve(res)
219 234
           },
220 235
           error (res) {
@@ -241,11 +256,11 @@ export default {
241 256
     GetActivityList (context, payload) { // 获取活动列表
242 257
       return new Promise((resolve, reject) => {
243 258
         ToolClass.WxRequest({
244
-          url: Api.GetPhotoList.url,
245
-          method: Api.GetPhotoList.method,
259
+          url: Api.GetActivityList.url,
260
+          method: Api.GetActivityList.method,
246 261
           ...payload,
247 262
           success (res) {
248
-            context.commit('UpdateActivityList', res.data.data.list)
263
+            context.commit('UpdateActivityList', res.data.data.records)
249 264
             resolve(res)
250 265
           },
251 266
           error (res) {

+ 32
- 0
src/store/user/index.js Voir le fichier

@@ -17,6 +17,38 @@ export default {
17 17
     }
18 18
   },
19 19
   actions: {
20
+    PostActivityJoin (context, payload) { // 活动报名
21
+      payload = { ...payload, IsSigIn: true }
22
+      return new Promise((resolve, reject) => {
23
+        ToolClass.WxRequest({
24
+          url: Api.PostActivityJoin.url,
25
+          method: Api.PostActivityJoin.method,
26
+          ...payload,
27
+          success (res) {
28
+            resolve(res)
29
+          },
30
+          error (res) {
31
+            reject(res)
32
+          }
33
+        })
34
+      })
35
+    },
36
+    PostActivityVote (context, payload) { // 活动投票
37
+      payload = { ...payload, IsSigIn: true }
38
+      return new Promise((resolve, reject) => {
39
+        ToolClass.WxRequest({
40
+          url: Api.PostActivityVote.url,
41
+          method: Api.PostActivityVote.method,
42
+          ...payload,
43
+          success (res) {
44
+            resolve(res)
45
+          },
46
+          error (res) {
47
+            reject(res)
48
+          }
49
+        })
50
+      })
51
+    },
20 52
     GetUserPhone (context, payload) { // 获取用户手机号
21 53
       payload = { ...payload, IsSigIn: true }
22 54
       return new Promise((resolve, reject) => {

+ 13
- 1
src/util/Api/index.js Voir le fichier

@@ -2,6 +2,18 @@
2 2
 const prefix = process.env.NODE_ENV === 'production' ? '' : ''
3 3
 
4 4
 const Api = {
5
+  GetNewsDetail: { // 获取资讯详情
6
+    method: 'get',
7
+    url: `${prefix}/news/:id`
8
+  },
9
+  PostActivityJoin: { // 活动报名
10
+    method: 'post',
11
+    url: `${prefix}/activity/:id/enroll`
12
+  },
13
+  PostActivityVote: { // 活动投票
14
+    method: 'post',
15
+    url: `${prefix}/activity/:id/vote`
16
+  },
5 17
   MainSignIn: { // 登录
6 18
     method: 'post',
7 19
     url: `${prefix}/login`
@@ -16,7 +28,7 @@ const Api = {
16 28
   },
17 29
   GetPhotoList: { // 获取照片墙列表
18 30
     method: 'get',
19
-    url: `${prefix}/activity`
31
+    url: `${prefix}/gallery`
20 32
   },
21 33
   GetActivityList: { // 获取活动列表
22 34
     method: 'get',

+ 37
- 20
src/util/PublicMethod/index.js Voir le fichier

@@ -3,6 +3,16 @@ const ToolClass = {
3 3
   DemoImg () {
4 4
     return 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1597250549302&di=7483208ccacdeb49188263423a9c8316&imgtype=0&src=http%3A%2F%2Ft9.baidu.com%2Fit%2Fu%3D3363001160%2C1163944807%26fm%3D79%26app%3D86%26f%3DJPEG%3Fw%3D1280%26h%3D830'
5 5
   },
6
+  DateFormat (timestamp) { // 格式化时间
7
+    if (timestamp) {
8
+      let YY = new Date(timestamp).getFullYear()
9
+      let MM = new Date(timestamp).getMonth() + 1
10
+      let DD = new Date(timestamp).getDate()
11
+      let hh = new Date(timestamp).getHours()
12
+      let mm = new Date(timestamp).getMinutes()
13
+      return `${YY}-${MM > 9 ? MM : '0' + MM}-${DD > 9 ? DD : '0' + DD} ${hh > 9 ? hh : '0' + hh}:${mm > 9 ? mm : '0' + mm}`
14
+    }
15
+  },
6 16
   ReplaceURLParams (url, params) {
7 17
     const args = { ...(params || {}), org: 'MQ' }
8 18
     return Object.keys(args).reduce((acc, k) => { // 此方法对每个元素进行处理
@@ -26,43 +36,50 @@ const ToolClass = {
26 36
     }
27 37
     let Header = {}
28 38
     if (wx.getStorageSync('token') !== '') { // 本地获取token
29
-      Header['X-Authorization-JWT'] = wx.getStorageSync('token')
39
+      Header['X-Authorization-Jwt'] = wx.getStorageSync('token')
30 40
     }
31 41
     wx.request({
32
-      url: `https://dev.fangdeal.cn/liyuanhui/wx${config.url}`,
42
+      url: `${SERVER_API}${config.url}`,
33 43
       method: config.method,
34 44
       ...(config.data || {}),
35 45
       header: { ...Header },
36 46
       success: (res) => {
37
-        if (res.header['X-Authorization-JWT'] !== undefined) { // 更新本地存储token
38
-          wx.setStorageSync('token', res.header['X-Authorization-JWT'])
47
+        const token = res.header['X-Authorization-Jwt'] || res.header['X-Authorization-JWT']
48
+        if (token) { // 更新本地存储token
49
+          wx.setStorageSync('token', token)
39 50
         }
40 51
         if (res.data.code - 0 === 1001) { // token失效
41
-          wx.login({ // 微信获取code
42
-            success (subRes) {
43
-              wx.request({ // 登录获取token
44
-                url: `https://dev.fangdeal.cn/liyuanhui/wx/login?code=${subRes.code}`,
45
-                method: `post`,
46
-                success: (cRes) => {
47
-                  if (cRes.header['X-Authorization-JWT'] !== undefined) { // 更新本地存储token
48
-                    wx.setStorageSync('token', cRes.header['X-Authorization-JWT'])
49
-                    _that.WxRequest(config) // 获得token之后重新请求接口
50
-                  }
51
-                }
52
-              })
53
-            }
54
-          })
52
+          // wx.login({ // 微信获取code
53
+          //   success (subRes) {
54
+          //     wx.request({ // 登录获取token
55
+          //       url: `${SERVER_API}/login?code=${subRes.code}`,
56
+          //       method: `post`,
57
+          //       success: (cRes) => {
58
+          //         const token = cRes.header['X-Authorization-Jwt'] || cRes.header['X-Authorization-JWT']
59
+          //         if (token) { // 更新本地存储token
60
+          //           wx.setStorageSync('token', token)
61
+          //           _that.WxRequest(config) // 获得token之后重新请求接口
62
+          //         }
63
+          //       }
64
+          //     })
65
+          //   }
66
+          // })
55 67
         }
56 68
         if (config.success !== undefined && res.data.code - 0 === 1000) {
57 69
           config.success(res)
58 70
         }
59 71
         if (config.error !== undefined && res.data.code - 0 !== 1000) {
60 72
           config.error(res)
73
+          wx.showToast({
74
+            title: res.data.message,
75
+            icon: 'none',
76
+            duration: 2000
77
+          })
61 78
         }
62 79
       },
63 80
       fail: (res) => {
64
-        if (res.header['X-Authorization-JWT'] !== undefined) { // 更新本地存储token
65
-          wx.setStorageSync('token', res.header['X-Authorization-JWT'])
81
+        if (res.header['X-Authorization-Jwt'] !== undefined) { // 更新本地存储token
82
+          wx.setStorageSync('token', res.header['X-Authorization-Jwt'])
66 83
         }
67 84
         if (res.data.code - 0 === 1001) { // token失效
68 85
           wx.navigateTo({ url: '../../pages/SignIn/index' })

+ 28
- 0
src/util/auth-plugin.js Voir le fichier

@@ -0,0 +1,28 @@
1
+import observe from './observe'
2
+
3
+const monitor = observe()
4
+
5
+// 只执行一次
6
+let done = false
7
+
8
+// VUEX 插件
9
+export function storeAuthPlugin(store) {
10
+  store.subscribe((mutation, state) => {
11
+    if (!done && mutation.type === 'user/EditUserInfo') {
12
+      monitor.notify()
13
+      done = true
14
+    }
15
+  })
16
+}
17
+
18
+// VUE 插件
19
+export function vueAuthPlugin(Vue, options) {
20
+  // 添加实例 $authed 方法
21
+  Vue.prototype.$authed = function(next) {
22
+    if (done) {
23
+      next()
24
+    } else {
25
+      monitor.subscribe(next)
26
+    }
27
+  }
28
+}

+ 22
- 0
src/util/observe.js Voir le fichier

@@ -0,0 +1,22 @@
1
+
2
+export default function observe() {
3
+  const listeners = []
4
+
5
+  function notify(...args) {
6
+    listeners.forEach(listener => listener(...args))
7
+  }
8
+
9
+  function subscribe (listener) {
10
+    listeners.push(listener)
11
+
12
+    return function unsubscribe() {
13
+      const index = listeners.indexOf(listener)
14
+      listeners.splice(index, 1)
15
+    }
16
+  }
17
+
18
+  return {
19
+    notify,
20
+    subscribe
21
+  }
22
+}

+ 14136
- 0
yarn.lock
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier