| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <template>
- <view class="warp">
- <!-- <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">
- .padding {
- padding: 0 20rpx;
- }
- </style>
|