123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <template>
- <view class="container">
- <navBar title="首页" :back="false" color="white" background="green" />
- <u-button text="测试网络请求" @click="testReq" type="primary"></u-button>
- <u-button text="测试vuex仓库" @click="testStore" type="primary"></u-button>
- <u-button text="测试登录-vuex仓库" @click="testLogin" type="primary"></u-button>
- <u-button text="测试登录退出登录" @click="testLogout" type="primary"></u-button>
- <u-button text="测试提示弹框" @click="$toast('测试','success')" type="primary"></u-button>
- <u-button text="测试自定义弹框" @click="show=true" type="primary"></u-button>
- <dpopup :show="show" mode="bottom" :round="10" @close="show=false">
- <view slot="content">
- <view class="top">
- 顶部
- </view>
- <view class="content" style="height: 300px;">
- 内容
- </view>
- </view>
- </dpopup>
- </view>
- </template>
- <script>
- import {
- getValidateCode
- } from '@/api/index/index.js'
- export default {
- data() {
- return {
- show: false
- }
- },
- methods: {
- async testReq() {
- console.log('testStore()111111', this.$store.getters['user/testInfo']);
- console.log('testStore()111111', this.$store.getters['user/testInfo2']);
- let res = await getValidateCode({
- phone: '15609038521',
- event: 'register'
- })
- uni.showToast({
- title: res.msg,
- icon: 'none'
- })
- console.log('发送短信验证码返回值', res);
- // if (res.code == 0) {}
- },
- testStore() {
- this.$store.dispatch('user/testAct', '6666666')
- console.log('testStore()', this.$store.getters['user/testInfo']);
- // this.$store.dispatch('testAct', '66666');
- // console.log('存入仓库后', this.$store.getters.testInfo);
- },
- async testLogin() {
- let res = await this.$store.dispatch('user/testAct2', {
- phone: '15609038533',
- event: 'register'
- })
- console.log('测试登录返回值:', res);
- },
- testLogout() {
- this.$store.dispatch('user/testAct3')
- console.log('测试退出登录返回值:', this.$store.getters['user/testInfo3']);
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "./index.scss";
- </style>
|