123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- <template>
- <view class="page YeZhuZiXun">
- <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh" @ScrollBottom="ScrollBottom">
- <view class="Container">
-
- <!-- 标题 -->
- <view class="Title">
- <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/yezhuzixun.png"></image>
- </view>
-
- <!-- 列表 -->
- <view class="List" v-if="PageList.length">
- <navigator :url="`./NewsDetail/index?id=${item.newsId}`" hover-class="other-navigator-hover" v-for="(item, index) in PageList" :key="index" class="Item flex-h">
- <view class="flex-item">
- <text>{{item.title}}</text>
- <text></text>
- </view>
- <text class="iconfont iconjiantouright"></text>
- </navigator>
- </view>
-
- </view>
- </ScrollY>
- </view>
- </template>
-
- <script>
- import ScrollY from '../../../components/ScrollY/index'
- import { createNamespacedHelpers } from 'vuex'
- const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
- const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
- export default {
- name: 'YeZhuZiXun',
- data () {
- return {
- PageList: [],
- PageData: {
- pageNum: 1,
- pageSize: 15
- },
- HasNextPage: true,
- IsRefreshing: false,
- DataLock: false
- }
- },
- computed: {
- ...mapIndexState({
- YeZhuZiXunList: x => x.YeZhuZiXunList // 业主资讯列表
- })
- },
- components: {
- ScrollY
- },
- created () {
- let _that = this
- wx.login({
- success (res) {
- _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
- _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
- _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
- _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
- if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
- _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
- }
- _that.Init()
- })
- }
- })
- },
- methods: {
- ...mapUserActions([
- 'MainSignIn' // 获取用户信息
- ]),
- ...mapUserMutations([
- 'EditUserInfo' // 编辑用户信息
- ]),
- ...mapIndexActions([
- 'GetYeZhuZiXunList' // 获取资讯列表
- ]),
- ...mapIndexMutations([
- 'EmptyYeZhuZiXunList' // 清空资讯列表
- ]),
- Init () { // 初始化
- this.PageData.pageNum = 1
- this.HasNextPage = true
- this.PageList = []
- this.EmptyYeZhuZiXunList() // 清空资讯列表
- this.ToGetPageList() // 获取列表
- },
- ToGetPageList () { // 获取列表
- this.GetYeZhuZiXunList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取资讯列表
- this.PageList = [...this.YeZhuZiXunList]
- this.HasNextPage = res.data.data.current < res.data.data.pages
- this.DataLock = false
- this.IsRefreshing = false
- }).catch(() => {
- this.DataLock = false
- this.IsRefreshing = false
- })
- },
- ScrollBottom () { // 上拉加载
- if (this.DataLock || !this.HasNextPage) return
- this.DataLock = true
- this.PageData.pageNum += 1
- this.ToGetPageList() // 获取列表
- },
- Refresh (e) { // 页面下拉刷新
- if (this.DataLock) return
- this.DataLock = true
- this.IsRefreshing = true
- setTimeout(() => {
- this.Init() // 初始化
- }, 1000)
- }
- }
- }
- </script>
-
- <style lang="scss">
- @import "page.scss";
- </style>
|