jiangping
2023-08-25 282e032b5771da13d224214d3b0b71f3efde9a42
minipro_standard/pages/index/index.vue
@@ -1,73 +1,44 @@
<template>
   <view>
      <myTabbar :index="0" />
   <view class="index">
      <web-view v-if="show" @onPostMessage="onMessage" :src="'https://dmtest.ahapp.net/doumeeplant_h5/#/appletLogin?code=' + code"></web-view>
      <!-- <myTabbar :index="0" /> -->
   </view>
</template>
<script>
   import myTabbar from "@/components/myTabber.vue"
   // import myTabbar from "@/components/myTabber.vue"
   export default {
      components: {
         myTabbar
      },
      // components: {
      //    myTabbar
      // },
      data() {
         return {
            form: {
               account: '',
               password: '',
            },
            logining: false,
            openId: ''
            code: '',
            show: false
         }
      },
      onLoad() {
         // uni.login({
         //    success: data => {
         //       this.wxLogin(data.code)
         //    },
         //    fail: err => {
         //       uni.$u.toast(err)
         //    }
         // })
         var that = this
         uni.login({
            provider: 'weixin',
            success: function (loginRes) {
               // console.log(loginRes);
               that.code = loginRes.code
               that.show = true
            }
         });
      },
      methods: {
         // loginAction() {
         //    if (!this.form.account || !this.form.password) {
         //       uni.$u.toast('账号或者密码不能为空')
         //    }
         //    this.logining = true
         //    coustomLogin({...this.form, openid: this.openId})
         //       .then(res => {
         //          this.$store.commit('SETTOKEN', res.token)
         //          this.$store.commit('SETUSERINFO', res)
         //          uni.navigateTo({
         //             url:'/pages/projectList/projectList'
         //          })
         //       })
         //       .finally(() => {
         //          this.logining = false
         //       })
         // },
         // wxLogin(code) {
         //    wxEmpower({code})
         //       .then(res => {
         //          this.openId = res.openid
         //          if (res.userInfo) {
         //             this.$store.commit('SETTOKEN', res.userInfo.token)
         //             this.$store.commit('SETUSERINFO', res.userInfo)
         //             uni.navigateTo({
         //                url:'/pages/projectList/projectList'
         //             })
         //          }
         //       })
         //       .catch(err => {
         //          uni.$u.toast(err)
         //       })
         // }
         onMessage(e) {
            console.log('12345654321')
         }
      }
   }
</script>
<style lang="scss" scoped>
   .index {
      width: 100vw;
      height: 100vh;
   }
</style>