Bladeren bron

接口请求完善

1002884655 4 jaren geleden
bovenliggende
commit
1910431172
35 gewijzigde bestanden met toevoegingen van 14910 en 273 verwijderingen
  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 Bestand weergeven

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

+ 6
- 0
config/index.js Bestand weergeven

1
+const path = require('path')
2
+
1
 const config = {
3
 const config = {
2
   projectName: 'myApp',
4
   projectName: 'myApp',
3
   date: '2020-8-7',
5
   date: '2020-8-7',
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 Bestand weergeven

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

+ 8
- 6
package.json Bestand weergeven

35
   "license": "MIT",
35
   "license": "MIT",
36
   "dependencies": {
36
   "dependencies": {
37
     "@babel/runtime": "^7.7.7",
37
     "@babel/runtime": "^7.7.7",
38
+    "@tarojs/cli": "^3.0.7",
38
     "@tarojs/components": "3.0.7",
39
     "@tarojs/components": "3.0.7",
40
+    "@tarojs/mini-runner": "^3.0.7",
39
     "@tarojs/runtime": "3.0.7",
41
     "@tarojs/runtime": "3.0.7",
40
     "@tarojs/taro": "3.0.7",
42
     "@tarojs/taro": "3.0.7",
41
     "qs": "^6.9.4",
43
     "qs": "^6.9.4",
44
     "vuex": "^3.5.1"
46
     "vuex": "^3.5.1"
45
   },
47
   },
46
   "devDependencies": {
48
   "devDependencies": {
47
-    "@types/webpack-env": "^1.13.6",
49
+    "@babel/core": "^7.8.0",
48
     "@tarojs/mini-runner": "3.0.7",
50
     "@tarojs/mini-runner": "3.0.7",
49
     "@tarojs/webpack-runner": "3.0.7",
51
     "@tarojs/webpack-runner": "3.0.7",
50
-    "@babel/core": "^7.8.0",
52
+    "@types/webpack-env": "^1.13.6",
51
     "babel-preset-taro": "3.0.7",
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
     "eslint": "^6.8.0",
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 Bestand weergeven

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

+ 48
- 1
src/app.js Bestand weergeven

1
+import Taro from '@tarojs/taro'
1
 import Vue from 'vue'
2
 import Vue from 'vue'
3
+import BasicLayout from '@/components/Layout/Basic'
4
+import { vueAuthPlugin } from '@/util/auth-plugin'
2
 import store from './store/index'
5
 import store from './store/index'
3
 
6
 
4
 import './app.scss'
7
 import './app.scss'
10
 import ToolClass from './util/PublicMethod/index'
13
 import ToolClass from './util/PublicMethod/index'
11
 Vue.prototype.ToolClass = ToolClass
14
 Vue.prototype.ToolClass = ToolClass
12
 
15
 
16
+Vue.use(vueAuthPlugin)
17
+Vue.component('BasicLayout', BasicLayout)
18
+
13
 const App = new Vue({
19
 const App = new Vue({
14
   store,
20
   store,
15
-  onShow (options) {
21
+  onLaunch (options) {
22
+    this.login(options)
16
   },
23
   },
17
   render(h) {
24
   render(h) {
18
     // this.$slots.default 是将要会渲染的页面
25
     // this.$slots.default 是将要会渲染的页面
19
     return h('block', this.$slots.default)
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 Bestand weergeven

4
       <block v-for="(item, index) in List" :key="index">
4
       <block v-for="(item, index) in List" :key="index">
5
         <swiper-item>
5
         <swiper-item>
6
           <view class="swiper-item">
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
           </view>
8
           </view>
9
         </swiper-item>
9
         </swiper-item>
10
       </block>
10
       </block>
28
     }
28
     }
29
   },
29
   },
30
   methods: {
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
 </script>
37
 </script>

+ 3
- 3
src/components/GetUserIcon/index.vue Bestand weergeven

39
               scope: 'scope.userInfo',
39
               scope: 'scope.userInfo',
40
               success () {
40
               success () {
41
                 wx.getUserInfo({ // 授权成功时,获取用户信息
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 Bestand weergeven

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 Bestand weergeven

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

+ 19
- 7
src/pages/HuiAiXin/EnergyStory/index.vue Bestand weergeven

9
         </view>
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
             <view class="flex-item">
14
             <view class="flex-item">
15
-              <text>事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题</text>
15
+              <text>{{item.name}}</text>
16
               <text>副标题</text>
16
               <text>副标题</text>
17
               <text>来源</text>
17
               <text>来源</text>
18
             </view>
18
             </view>
19
             <view class="Img">
19
             <view class="Img">
20
               <view>
20
               <view>
21
-                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
21
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
22
               </view>
22
               </view>
23
             </view>
23
             </view>
24
           </navigator>
24
           </navigator>
33
 import ScrollY from '../../../components/ScrollY/index'
33
 import ScrollY from '../../../components/ScrollY/index'
34
 import { createNamespacedHelpers } from 'vuex'
34
 import { createNamespacedHelpers } from 'vuex'
35
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
35
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
36
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
36
 export default {
37
 export default {
37
   name: 'ZhengNengLiangShiJi',
38
   name: 'ZhengNengLiangShiJi',
38
   data () {
39
   data () {
39
     return {
40
     return {
41
+      PageList: [],
40
       PageData: {
42
       PageData: {
41
         pageNum: 1,
43
         pageNum: 1,
42
         pageSize: 15
44
         pageSize: 15
55
     ScrollY
57
     ScrollY
56
   },
58
   },
57
   created () {
59
   created () {
58
-    this.Init()
60
+    this.$authed(() => {
61
+      this.Init()
62
+    })
59
   },
63
   },
60
   methods: {
64
   methods: {
65
+    ...mapUserActions([
66
+      'MainSignIn' // 获取用户信息
67
+    ]),
68
+    ...mapUserMutations([
69
+      'EditUserInfo' // 编辑用户信息
70
+    ]),
61
     ...mapIndexActions([
71
     ...mapIndexActions([
62
       'GetZhengNengLiangShiJiList' // 获取正能量事迹列表
72
       'GetZhengNengLiangShiJiList' // 获取正能量事迹列表
63
     ]),
73
     ]),
68
       this.PageData.pageNum = 1
78
       this.PageData.pageNum = 1
69
       this.HasNextPage = true
79
       this.HasNextPage = true
70
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
80
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
81
+      this.PageList = []
71
       this.ToGetPageList() // 获取列表
82
       this.ToGetPageList() // 获取列表
72
     },
83
     },
73
     ToGetPageList () { // 获取列表
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
         this.DataLock = false
88
         this.DataLock = false
77
         this.IsRefreshing = false
89
         this.IsRefreshing = false
78
       }).catch(() => {
90
       }).catch(() => {

+ 19
- 7
src/pages/HuiAiXin/StarOwner/index.vue Bestand weergeven

9
         </view>
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
             <view class="Img">
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
             </view>
16
             </view>
17
-            <text class="Info">业主家庭名称</text>
17
+            <text class="Info">{{item.name}}</text>
18
           </navigator>
18
           </navigator>
19
         </view>
19
         </view>
20
 
20
 
27
 import ScrollY from '../../../components/ScrollY/index'
27
 import ScrollY from '../../../components/ScrollY/index'
28
 import { createNamespacedHelpers } from 'vuex'
28
 import { createNamespacedHelpers } from 'vuex'
29
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
29
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
30
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
30
 export default {
31
 export default {
31
   name: 'MingXingYeZhu',
32
   name: 'MingXingYeZhu',
32
   data () {
33
   data () {
33
     return {
34
     return {
35
+      PageList: [],
34
       PageData: {
36
       PageData: {
35
         pageNum: 1,
37
         pageNum: 1,
36
         pageSize: 15
38
         pageSize: 15
49
     ScrollY
51
     ScrollY
50
   },
52
   },
51
   created () {
53
   created () {
52
-    this.Init() // 初始化
54
+    this.$authed(() => {
55
+      this.Init()
56
+    })
53
   },
57
   },
54
   methods: {
58
   methods: {
59
+    ...mapUserActions([
60
+      'MainSignIn' // 获取用户信息
61
+    ]),
62
+    ...mapUserMutations([
63
+      'EditUserInfo' // 编辑用户信息
64
+    ]),
55
     ...mapIndexActions([
65
     ...mapIndexActions([
56
       'GetMingXingYeZhuList' // 获取明星业主列表
66
       'GetMingXingYeZhuList' // 获取明星业主列表
57
     ]),
67
     ]),
62
       this.PageData.pageNum = 1
72
       this.PageData.pageNum = 1
63
       this.HasNextPage = true
73
       this.HasNextPage = true
64
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
74
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
75
+      this.PageList = []
65
       this.ToGetPageList() // 获取列表
76
       this.ToGetPageList() // 获取列表
66
     },
77
     },
67
     ToGetPageList () { // 获取列表
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
         this.DataLock = false
82
         this.DataLock = false
71
         this.IsRefreshing = false
83
         this.IsRefreshing = false
72
       }).catch(() => {
84
       }).catch(() => {

+ 26
- 11
src/pages/HuiAiXin/index.vue Bestand weergeven

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

+ 34
- 17
src/pages/HuiQuanYi/OwnersNews/NewsDetail/index.vue Bestand weergeven

1
 <template>
1
 <template>
2
   <view class="page ZiXunXiangQing">
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
     </view>
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
   </view>
14
   </view>
14
 </template>
15
 </template>
15
 
16
 
16
 <script>
17
 <script>
17
-
18
+import { getCurrentInstance } from "@tarojs/taro"
19
+import { createNamespacedHelpers } from "vuex"
20
+const { mapActions: mapIndexActions } = createNamespacedHelpers("index")
18
 export default {
21
 export default {
19
-  name: 'ZiXunXiangQing',
20
-  data () {
22
+  name: "ZiXunXiangQing",
23
+  data() {
21
     return {
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
   methods: {
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
 </script>
52
 </script>
36
 
53
 
37
 <style lang="scss">
54
 <style lang="scss">
38
-@import "page.scss";
55
+@import "page.scss"
39
 </style>
56
 </style>

+ 10
- 0
src/pages/HuiQuanYi/OwnersNews/NewsDetail/page.scss Bestand weergeven

33
     margin-top: 40px;
33
     margin-top: 40px;
34
     padding: 0 20px;
34
     padding: 0 20px;
35
     padding-bottom: 40px;
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 Bestand weergeven

9
         </view>
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
             <view class="flex-item">
14
             <view class="flex-item">
15
-              <text>资讯标题</text>
16
-              <text>4567</text>
15
+              <text>{{item.title}}</text>
16
+              <text></text>
17
             </view>
17
             </view>
18
             <text class="iconfont iconjiantouright"></text>
18
             <text class="iconfont iconjiantouright"></text>
19
           </navigator>
19
           </navigator>
28
 import ScrollY from '../../../components/ScrollY/index'
28
 import ScrollY from '../../../components/ScrollY/index'
29
 import { createNamespacedHelpers } from 'vuex'
29
 import { createNamespacedHelpers } from 'vuex'
30
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
30
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
31
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
31
 export default {
32
 export default {
32
   name: 'YeZhuZiXun',
33
   name: 'YeZhuZiXun',
33
   data () {
34
   data () {
34
     return {
35
     return {
36
+      PageList: [],
35
       PageData: {
37
       PageData: {
36
         pageNum: 1,
38
         pageNum: 1,
37
         pageSize: 15
39
         pageSize: 15
50
     ScrollY
52
     ScrollY
51
   },
53
   },
52
   created () {
54
   created () {
53
-    this.Init() // 初始化
55
+    this.$authed(() => {
56
+      this.Init()
57
+    })
54
   },
58
   },
55
   methods: {
59
   methods: {
60
+    ...mapUserActions([
61
+      'MainSignIn' // 获取用户信息
62
+    ]),
63
+    ...mapUserMutations([
64
+      'EditUserInfo' // 编辑用户信息
65
+    ]),
56
     ...mapIndexActions([
66
     ...mapIndexActions([
57
       'GetYeZhuZiXunList' // 获取资讯列表
67
       'GetYeZhuZiXunList' // 获取资讯列表
58
     ]),
68
     ]),
62
     Init () { // 初始化
72
     Init () { // 初始化
63
       this.PageData.pageNum = 1
73
       this.PageData.pageNum = 1
64
       this.HasNextPage = true
74
       this.HasNextPage = true
75
+      this.PageList = []
65
       this.EmptyYeZhuZiXunList() // 清空资讯列表
76
       this.EmptyYeZhuZiXunList() // 清空资讯列表
66
       this.ToGetPageList() // 获取列表
77
       this.ToGetPageList() // 获取列表
67
     },
78
     },
68
     ToGetPageList () { // 获取列表
79
     ToGetPageList () { // 获取列表
69
       this.GetYeZhuZiXunList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取资讯列表
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
         this.DataLock = false
83
         this.DataLock = false
72
         this.IsRefreshing = false
84
         this.IsRefreshing = false
73
       }).catch(() => {
85
       }).catch(() => {

+ 17
- 5
src/pages/HuiQuanYi/index.vue Bestand weergeven

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

+ 47
- 8
src/pages/HuiShengHuo/ActivityList/ActivityDetail/JoinIn/index.vue Bestand weergeven

6
       <view class="flex-h">
6
       <view class="flex-h">
7
         <text>姓名</text>
7
         <text>姓名</text>
8
         <view class="flex-item">
8
         <view class="flex-item">
9
-          <input type="text" placeholder="请输入" />
9
+          <input type="text" placeholder="请输入" v-model="Name" />
10
         </view>
10
         </view>
11
       </view>
11
       </view>
12
       <view class="flex-h">
12
       <view class="flex-h">
13
         <text>手机号</text>
13
         <text>手机号</text>
14
         <view class="flex-item">
14
         <view class="flex-item">
15
-          <input type="number" placeholder="请输入" />
15
+          <input type="number" placeholder="请输入" v-model="Phone" />
16
         </view>
16
         </view>
17
       </view>
17
       </view>
18
       <view class="flex-h">
18
       <view class="flex-h">
19
         <text>人数</text>
19
         <text>人数</text>
20
         <view class="flex-item">
20
         <view class="flex-item">
21
-          <input type="number" placeholder="请输入" />
21
+          <input type="number" placeholder="请输入" v-model="Num" />
22
         </view>
22
         </view>
23
       </view>
23
       </view>
24
     </view>
24
     </view>
25
-    
26
-    <text>提交</text>
25
+
26
+    <text @tap="ToJoin">提交</text>
27
 
27
 
28
   </view>
28
   </view>
29
 </template>
29
 </template>
30
 
30
 
31
 <script>
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
 export default {
35
 export default {
34
   name: 'LiJiBaoMing',
36
   name: 'LiJiBaoMing',
35
   data () {
37
   data () {
36
     return {
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
   components: {
51
   components: {
41
   },
52
   },
42
   created () {
53
   created () {
43
-    this.Init()
54
+    this.CurrnetId = getCurrentInstance().router.params.id
55
+    this.$authed(() => {
56
+      this.Init()
57
+    })
44
   },
58
   },
45
   methods: {
59
   methods: {
60
+    ...mapUserActions([
61
+      'GetUserPhone',
62
+      'PostActivityJoin',
63
+      'MainSignIn' // 获取用户信息
64
+    ]),
65
+    ...mapUserMutations([
66
+      'EditUserInfo' // 编辑用户信息
67
+    ]),
46
     Init () {
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 Bestand weergeven

2
   <view class="page HuoDongXiangQing flex-v">
2
   <view class="page HuoDongXiangQing flex-v">
3
 
3
 
4
     <view class="flex-item">
4
     <view class="flex-item">
5
-      <view>
5
+      <view v-if="ActivityInfo !== null">
6
 
6
 
7
         <!-- 活动主要信息 -->
7
         <!-- 活动主要信息 -->
8
         <view class="MainInfo">
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
           <view class="Line flex-h">
10
           <view class="Line flex-h">
21
             <text>活动时间:</text>
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
           </view>
13
           </view>
24
           <view class="Line flex-h">
14
           <view class="Line flex-h">
25
             <text>活动地址:</text>
15
             <text>活动地址:</text>
26
-            <text class="flex-item">南京市江宁区丽园荟广场</text>
16
+            <text class="flex-item">{{ActivityInfo.address}}</text>
27
           </view>
17
           </view>
28
           <view class="Line flex-h">
18
           <view class="Line flex-h">
29
             <text>报名截止:</text>
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
           </view>
21
           </view>
32
         </view>
22
         </view>
33
 
23
 
34
         <!-- 活动详情 -->
24
         <!-- 活动详情 -->
35
         <view class="DetailContainer">
25
         <view class="DetailContainer">
36
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huodongxiangqing.png"></image>
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
         </view>
30
         </view>
39
 
31
 
40
         <!-- 投票 -->
32
         <!-- 投票 -->
41
-        <view class="VoteContainer">
33
+        <view class="VoteContainer" v-if="IsVote">
42
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/toupiao.png"></image>
34
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/toupiao.png"></image>
43
           <view class="List">
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
               </view>
41
               </view>
53
             </view>
42
             </view>
54
           </view>
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
         </view>
46
         </view>
57
 
47
 
58
       </view>
48
       </view>
60
 
50
 
61
     <!-- 底部栏 -->
51
     <!-- 底部栏 -->
62
     <view class="Bottom flex-h">
52
     <view class="Bottom flex-h">
63
-      <view class="flex-item">
53
+      <view class="flex-item" @tap="LinkTo('../../index')">
64
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huishenghuo.png"></image>
54
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huishenghuo.png"></image>
65
       </view>
55
       </view>
66
       <view class="flex-item">
56
       <view class="flex-item">
67
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/fenxiang.png"></image>
57
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/fenxiang.png"></image>
68
       </view>
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
     </view>
61
     </view>
71
 
62
 
72
   </view>
63
   </view>
73
 </template>
64
 </template>
74
 
65
 
75
 <script>
66
 <script>
67
+import { getCurrentInstance } from '@tarojs/taro'
76
 import { createNamespacedHelpers } from 'vuex'
68
 import { createNamespacedHelpers } from 'vuex'
77
 const { mapActions: mapIndexActions } = createNamespacedHelpers('index')
69
 const { mapActions: mapIndexActions } = createNamespacedHelpers('index')
78
-const { mapState: mapUserState } = createNamespacedHelpers('user')
70
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
79
 export default {
71
 export default {
80
   name: 'HuoDongXiangQing',
72
   name: 'HuoDongXiangQing',
81
   data () {
73
   data () {
82
     return {
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
   computed: {
85
   computed: {
108
   },
89
   },
109
   components: {
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
   created () {
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
   methods: {
109
   methods: {
110
+    ...mapUserActions([ // 活动投票
111
+      'PostActivityVote',
112
+      'GetUserPhone',
113
+      'PostActivityJoin',
114
+      'MainSignIn' // 获取用户信息
115
+    ]),
116
+    ...mapUserMutations([
117
+      'EditUserInfo' // 编辑用户信息
118
+    ]),
115
     ...mapIndexActions([
119
     ...mapIndexActions([
116
       'GetActivityDetail' // 获取活动详情
120
       'GetActivityDetail' // 获取活动详情
117
     ]),
121
     ]),
118
     Init () {
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 Bestand weergeven

97
         }
97
         }
98
         > .List {
98
         > .List {
99
           padding-top: 20px;
99
           padding-top: 20px;
100
+          padding-left: 20px;
100
           > view {
101
           > view {
101
-            padding-left: 20px;
102
             margin-bottom: 20px;
102
             margin-bottom: 20px;
103
+            align-items: flex-start;
104
+            padding: 22px 0;
105
+            border-bottom: 2px solid #f5f5f5;
103
             > text {
106
             > text {
104
-              display: block;
105
-              font-size: 28px;
106
-              color: #666;
107
+              font-size: 38px;
107
               line-height: 40px;
108
               line-height: 40px;
109
+              margin-right: 20px;
110
+              color: #fe4e45;
108
             }
111
             }
109
             > view {
112
             > view {
110
-              align-items: flex-start;
111
-              padding: 22px 0;
112
-              border-bottom: 2px solid #f5f5f5;
113
+              position: relative;
114
+              overflow: hidden;
113
               > text {
115
               > text {
114
-                font-size: 38px;
116
+                display: block;
117
+                font-size: 28px;
118
+                color: #666;
115
                 line-height: 40px;
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
           text-align: center;
133
           text-align: center;
142
           box-shadow: 0 5px 10px 5px rgba(253, 221, 57, 0.3);
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
   > .Bottom {
144
   > .Bottom {
148
     background: #fff;
145
     background: #fff;
146
+    position: relative;
147
+    overflow: hidden;
149
     > view {
148
     > view {
149
+      height: 90px;
150
       position: relative;
150
       position: relative;
151
       overflow: hidden;
151
       overflow: hidden;
152
       > image {
152
       > image {
161
     > image {
161
     > image {
162
       height: 90px;
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 Bestand weergeven

17
 
17
 
18
         <view class="ActivityList">
18
         <view class="ActivityList">
19
           <view class="List">
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
               <view class="Info">
24
               <view class="Info">
25
-                <text @tap="LinkTo('./ActivityDetail/index')">活动名称</text>
25
+                <text>{{item.name}}</text>
26
                 <view class="flex-h">
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
                 </view>
31
                 </view>
32
               </view>
32
               </view>
33
             </view>
33
             </view>
34
-            <view style="width: 100%; height: 20px;"></view>
34
+            <view style="width: 100%; height: 10px;"></view>
35
           </view>
35
           </view>
36
         </view>
36
         </view>
37
 
37
 
44
 import ScrollY from '../../../components/ScrollY/index'
44
 import ScrollY from '../../../components/ScrollY/index'
45
 import { createNamespacedHelpers } from 'vuex'
45
 import { createNamespacedHelpers } from 'vuex'
46
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
46
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
47
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
47
 export default {
48
 export default {
48
   name: 'JingCaiHuoDong',
49
   name: 'JingCaiHuoDong',
49
   data () {
50
   data () {
52
         pageNum: 1,
53
         pageNum: 1,
53
         pageSize: 15
54
         pageSize: 15
54
       },
55
       },
56
+      PageList: [],
55
       HuoDongNavList: [
57
       HuoDongNavList: [
56
         { Name: '暖场活动', Id: '1' },
58
         { Name: '暖场活动', Id: '1' },
57
         { Name: '六点半学堂', Id: '2' },
59
         { Name: '六点半学堂', Id: '2' },
75
     ScrollY
77
     ScrollY
76
   },
78
   },
77
   created () {
79
   created () {
78
-    this.Init() // 初始化
80
+    this.$authed(() => {
81
+      this.Init()
82
+    })
79
   },
83
   },
80
   methods: {
84
   methods: {
85
+    ...mapUserActions([
86
+      'MainSignIn' // 获取用户信息
87
+    ]),
88
+    ...mapUserMutations([
89
+      'EditUserInfo' // 编辑用户信息
90
+    ]),
81
     ...mapIndexActions([
91
     ...mapIndexActions([
82
       'GetActivityList' // 获取活动列表
92
       'GetActivityList' // 获取活动列表
83
     ]),
93
     ]),
87
     Init () { // 初始化
97
     Init () { // 初始化
88
       this.PageData.pageNum = 1
98
       this.PageData.pageNum = 1
89
       this.HasNextPage = true
99
       this.HasNextPage = true
100
+      this.PageList = []
90
       this.EmptyActivityList() // 清空活动列表
101
       this.EmptyActivityList() // 清空活动列表
91
       this.ToGetPageList() // 获取列表
102
       this.ToGetPageList() // 获取列表
92
     },
103
     },
110
     },
121
     },
111
     ToGetPageList () { // 获取列表
122
     ToGetPageList () { // 获取列表
112
       this.GetActivityList({ queryData: { ...this.PageData, typeId: this.CurrentNavId } }).then((res) => { // 获取活动列表
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
         this.DataLock = false
126
         this.DataLock = false
115
         this.IsRefreshing = false
127
         this.IsRefreshing = false
116
       }).catch(() => {
128
       }).catch(() => {

+ 41
- 12
src/pages/HuiShengHuo/PhotoList/index.vue Bestand weergeven

10
           </view>
10
           </view>
11
         </view>
11
         </view>
12
         <view class="List">
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
             <text>{{item.Month}}</text>
14
             <text>{{item.Month}}</text>
15
             <view>
15
             <view>
16
               <view v-for="(subItem, subIndex) in item.List" :key="subIndex">
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
               </view>
20
               </view>
19
             </view>
21
             </view>
20
           </view>
22
           </view>
22
       </view>
24
       </view>
23
 
25
 
24
     </ScrollY>
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
   </view>
31
   </view>
26
 </template>
32
 </template>
27
 
33
 
29
 import ScrollY from '../../../components/ScrollY/index'
35
 import ScrollY from '../../../components/ScrollY/index'
30
 import { createNamespacedHelpers } from 'vuex'
36
 import { createNamespacedHelpers } from 'vuex'
31
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
37
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
38
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
32
 export default {
39
 export default {
33
   name: 'HuoDongZhaoPianQiang',
40
   name: 'HuoDongZhaoPianQiang',
34
   data () {
41
   data () {
35
     return {
42
     return {
43
+      ShowBigImg: false,
44
+      BigImgUrl: null,
45
+      PageList: [],
36
       PageData: {
46
       PageData: {
37
         pageNum: 1,
47
         pageNum: 1,
38
         pageSize: 15
48
         pageSize: 15
39
       },
49
       },
40
       HasNextPage: true,
50
       HasNextPage: true,
41
       IsRefreshing: false,
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
   computed: {
55
   computed: {
57
     ScrollY
61
     ScrollY
58
   },
62
   },
59
   created () {
63
   created () {
60
-    this.Init() // 初始化
64
+    this.$authed(() => {
65
+      this.Init()
66
+    })
61
   },
67
   },
62
   methods: {
68
   methods: {
69
+    ...mapUserActions([
70
+      'MainSignIn' // 获取用户信息
71
+    ]),
72
+    ...mapUserMutations([
73
+      'EditUserInfo' // 编辑用户信息
74
+    ]),
63
     ...mapIndexActions([
75
     ...mapIndexActions([
64
       'GetPhotoList' // 获取照片墙列表
76
       'GetPhotoList' // 获取照片墙列表
65
     ]),
77
     ]),
69
     Init () { // 初始化
81
     Init () { // 初始化
70
       this.PageData.pageNum = 1
82
       this.PageData.pageNum = 1
71
       this.HasNextPage = true
83
       this.HasNextPage = true
84
+      this.PageList = []
72
       this.EmptyPhotoList() // 清空照片墙列表
85
       this.EmptyPhotoList() // 清空照片墙列表
73
       this.ToGetPageList() // 获取列表
86
       this.ToGetPageList() // 获取列表
74
     },
87
     },
88
+    CheckBigImg (url) { // 查看大图
89
+      this.BigImgUrl = url
90
+      this.ShowBigImg = true
91
+    },
75
     ToGetPageList () { // 获取列表
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
         this.DataLock = false
107
         this.DataLock = false
79
         this.IsRefreshing = false
108
         this.IsRefreshing = false
80
       }).catch(() => {
109
       }).catch(() => {

+ 10
- 0
src/pages/HuiShengHuo/PhotoList/page.scss Bestand weergeven

2
   width: 100%;
2
   width: 100%;
3
   height: 100%;
3
   height: 100%;
4
   background: #fff;
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
   .PhotoList {
15
   .PhotoList {
6
     > .flex-h {
16
     > .flex-h {
7
       padding: 0 20px;
17
       padding: 0 20px;

+ 83
- 56
src/pages/HuiShengHuo/index.vue Bestand weergeven

1
 <template>
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
         </view>
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
           </view>
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
                 </view>
28
                 </view>
27
               </view>
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
           </view>
31
           </view>
39
-          <navigator url="./ActivityList/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
40
         </view>
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
             </view>
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
               </view>
55
               </view>
54
             </view>
56
             </view>
57
+            <view style="width: 100%; height: 10px;"></view>
55
           </view>
58
           </view>
56
         </view>
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
 </template>
68
 </template>
62
 
69
 
63
 <script>
70
 <script>
65
 import BannerSwiper from '../../components/BannerSwiper/index'
72
 import BannerSwiper from '../../components/BannerSwiper/index'
66
 import { createNamespacedHelpers } from 'vuex'
73
 import { createNamespacedHelpers } from 'vuex'
67
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
74
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
75
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
68
 export default {
76
 export default {
69
   name: 'HuiShengHuo',
77
   name: 'HuiShengHuo',
70
   data () {
78
   data () {
71
     return {
79
     return {
80
+      ShowBigImg: false,
81
+      BigImgUrl: null,
82
+      PageActivityList: [],
83
+      PagePhotoList: [],
72
       RequestNum: 0,
84
       RequestNum: 0,
73
       IsRefreshing: false,
85
       IsRefreshing: false,
74
       DataLock: false
86
       DataLock: false
86
     BannerSwiper
98
     BannerSwiper
87
   },
99
   },
88
   created () {
100
   created () {
89
-    this.Init()
101
+    this.$authed(() => {
102
+      this.Init()
103
+    })
90
   },
104
   },
91
   methods: {
105
   methods: {
106
+    ...mapUserActions([
107
+      'MainSignIn' // 获取用户信息
108
+    ]),
109
+    ...mapUserMutations([
110
+      'EditUserInfo' // 编辑用户信息
111
+    ]),
92
     ...mapIndexActions([
112
     ...mapIndexActions([
93
       'GetIndexBanner', // 获取首页banner
113
       'GetIndexBanner', // 获取首页banner
94
       'GetPhotoList', // 获取照片墙列表
114
       'GetPhotoList', // 获取照片墙列表
104
       this.EmptyIndexBanner() // 清空首页banner
124
       this.EmptyIndexBanner() // 清空首页banner
105
       this.EmptyPhotoList() // 清空照片墙列表
125
       this.EmptyPhotoList() // 清空照片墙列表
106
       this.EmptyActivityList() // 清空活动列表
126
       this.EmptyActivityList() // 清空活动列表
127
+      this.PageActivityList = []
128
+      this.PagePhotoList = []
107
       this.GetIndexBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'life' } }).then(() => { // 获取首页banner
129
       this.GetIndexBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'life' } }).then(() => { // 获取首页banner
108
-        this.CheckRequestNum(2) // 判断请求接口个数
130
+        this.CheckRequestNum(3) // 判断请求接口个数
109
       }).catch(() => {
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
       }).catch(() => {
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
     CheckRequestNum (num) { // 判断请求接口个数
150
     CheckRequestNum (num) { // 判断请求接口个数
124
       this.RequestNum += 1
151
       this.RequestNum += 1

+ 11
- 0
src/pages/HuiShengHuo/page.scss Bestand weergeven

1
 .page.HuiShengHuo {
1
 .page.HuiShengHuo {
2
   width: 100%;
2
   width: 100%;
3
   height: 100%;
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
   .Banner {
15
   .Banner {
5
     width: 100%;
16
     width: 100%;
6
     padding-bottom: 38%;
17
     padding-bottom: 38%;

+ 1
- 1
src/pages/WoDe/MyActivityList/index.vue Bestand weergeven

72
     },
72
     },
73
     ToGetPageList () { // 获取列表
73
     ToGetPageList () { // 获取列表
74
       this.GetUserActivityList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取我的活动列表
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
         this.DataLock = false
76
         this.DataLock = false
77
         this.IsRefreshing = false
77
         this.IsRefreshing = false
78
       }).catch(() => {
78
       }).catch(() => {

+ 8
- 6
src/pages/WoDe/index.vue Bestand weergeven

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

+ 3
- 0
src/store/index.js Bestand weergeven

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

+ 27
- 12
src/store/index/index.js Bestand weergeven

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

+ 32
- 0
src/store/user/index.js Bestand weergeven

17
     }
17
     }
18
   },
18
   },
19
   actions: {
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
     GetUserPhone (context, payload) { // 获取用户手机号
52
     GetUserPhone (context, payload) { // 获取用户手机号
21
       payload = { ...payload, IsSigIn: true }
53
       payload = { ...payload, IsSigIn: true }
22
       return new Promise((resolve, reject) => {
54
       return new Promise((resolve, reject) => {

+ 13
- 1
src/util/Api/index.js Bestand weergeven

2
 const prefix = process.env.NODE_ENV === 'production' ? '' : ''
2
 const prefix = process.env.NODE_ENV === 'production' ? '' : ''
3
 
3
 
4
 const Api = {
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
   MainSignIn: { // 登录
17
   MainSignIn: { // 登录
6
     method: 'post',
18
     method: 'post',
7
     url: `${prefix}/login`
19
     url: `${prefix}/login`
16
   },
28
   },
17
   GetPhotoList: { // 获取照片墙列表
29
   GetPhotoList: { // 获取照片墙列表
18
     method: 'get',
30
     method: 'get',
19
-    url: `${prefix}/activity`
31
+    url: `${prefix}/gallery`
20
   },
32
   },
21
   GetActivityList: { // 获取活动列表
33
   GetActivityList: { // 获取活动列表
22
     method: 'get',
34
     method: 'get',

+ 37
- 20
src/util/PublicMethod/index.js Bestand weergeven

3
   DemoImg () {
3
   DemoImg () {
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'
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
   ReplaceURLParams (url, params) {
16
   ReplaceURLParams (url, params) {
7
     const args = { ...(params || {}), org: 'MQ' }
17
     const args = { ...(params || {}), org: 'MQ' }
8
     return Object.keys(args).reduce((acc, k) => { // 此方法对每个元素进行处理
18
     return Object.keys(args).reduce((acc, k) => { // 此方法对每个元素进行处理
26
     }
36
     }
27
     let Header = {}
37
     let Header = {}
28
     if (wx.getStorageSync('token') !== '') { // 本地获取token
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
     wx.request({
41
     wx.request({
32
-      url: `https://dev.fangdeal.cn/liyuanhui/wx${config.url}`,
42
+      url: `${SERVER_API}${config.url}`,
33
       method: config.method,
43
       method: config.method,
34
       ...(config.data || {}),
44
       ...(config.data || {}),
35
       header: { ...Header },
45
       header: { ...Header },
36
       success: (res) => {
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
         if (res.data.code - 0 === 1001) { // token失效
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
         if (config.success !== undefined && res.data.code - 0 === 1000) {
68
         if (config.success !== undefined && res.data.code - 0 === 1000) {
57
           config.success(res)
69
           config.success(res)
58
         }
70
         }
59
         if (config.error !== undefined && res.data.code - 0 !== 1000) {
71
         if (config.error !== undefined && res.data.code - 0 !== 1000) {
60
           config.error(res)
72
           config.error(res)
73
+          wx.showToast({
74
+            title: res.data.message,
75
+            icon: 'none',
76
+            duration: 2000
77
+          })
61
         }
78
         }
62
       },
79
       },
63
       fail: (res) => {
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
         if (res.data.code - 0 === 1001) { // token失效
84
         if (res.data.code - 0 === 1001) { // token失效
68
           wx.navigateTo({ url: '../../pages/SignIn/index' })
85
           wx.navigateTo({ url: '../../pages/SignIn/index' })

+ 28
- 0
src/util/auth-plugin.js Bestand weergeven

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 Bestand weergeven

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
Diff onderdrukt omdat het te groot bestand
Bestand weergeven