| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <template>
- <view class="container" :style="{ height: $global.windowHeight + 'px' }">
- <!-- <uni-section title="地点列表" type="line">
- <uni-data-select v-model="placeId" :localdata="placeList" placeholder="请选择地点" @change="handleShopChange"
- class="padding" />
- </uni-section> -->
- <uni-section v-if="actionList.length > 0" title="活动列表" type="line">
- <uni-list>
- <uni-list-item v-for="item in actionList" :key="item.id" showArrow :title="item.name" :clickable="true"
- @click="handleItemClick(item.id)" />
- </uni-list>
- </uni-section>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapGetters
- } from 'vuex'
- import {
- DefaultRequest,
- IdRequest
- } from "@/grpc/base_pb.js"
- export default {
- components: {},
- data() {
- return {
- placeId: 0,
- actionList: [],
- }
- },
- computed: {
- ...mapState([
- 'username', // 映射 this.username 为 store.state.username
- ]),
- ...mapGetters([
- 'metadata'
- ]),
- },
- mounted() {},
- onLoad() {
- this.loadData()
- },
- methods: {
- async loadData() {
- this.actionList = await this.getToActionList()
- },
- async getToActionList() {
- try {
- return new Promise((resolve, reject) => {
- // 创建请求参数并赋值
- var request = new DefaultRequest()
- // 调用客户端相应的grpc方法,发送grpc请求,并接受后台发送回来的返回值
- this.$client.toActionList(request, this.metadata, (err,
- response) => {
- if (err) {
- console.warn(`[toActionList] err: code = ${err.code}` +
- `, message = "${err.message}"`)
- reject(err)
- } else {
- let res = response.toObject()
- // console.log('[toActionList]', res)
- resolve(res.listList)
- }
- })
- });
- } catch (e) {
- console.log('[getToActionList] err', e)
- reject(e)
- }
- },
- // handleShopChange(actionId) {
- // console.log("actionId:" + actionId)
- // this.getControlInfoList(actionId)
- // this.getShopMap(actionId)
- // },
- handleItemClick(actionId) {
- console.log("actionId:" + actionId)
- uni.navigateTo({
- // url: '/pages/checkPoint/checkPointDetail',
- url: './mapShow?actionId=' + actionId
- })
- },
- }
- }
- </script>
- <style lang="scss">
- .container {
- // height: 100vh;
- // height: 100%;
- // overflow: hidden;
- }
- .padding {
- padding: 0 20rpx;
- }
- </style>
|