''
liukangdong
2024-06-11 f49cf1c04d06333ace67926430c651ca3cc1752f
h5/App.vue
@@ -1,48 +1,54 @@
<script>
import { wxAuthorize, refreshToken } from '@/api'
export default {
   onLaunch: function () {
      var that = this
      if (!that.$store.state.openid) {
         let url = window.location.href
         let code = ''
         if (url.indexOf('code=') !== -1) {
            const query = url.split('?')
            console.log('app-app', url);
            for (const q of query) {
               if (q.indexOf('code=') !== -1) {
                  code = q.substring(q.indexOf('code=') + 5, q.length)
               }
            }
            wxAuthorize({
               code: code
            }).then(res => {
               console.log('app_ress', res);
               if (res.code === 200) {
                  that.$store.commit('setOpenId', res.data.openid)
                  if (res.data.member) {
                     that.$store.commit('setMember', res.data.member)
                  }
               }
            })
         }
      }
      // 刷新token
      const token = uni.getStorageSync('token')
      if(token){
         //  refreshToken().then(res => {
         //     if(res.code && res.code === 200){
         //       this.$store.commit('setToken', res.data)
         //    }
         // })
      }
   },
   onShow: function () {
      console.log('App Show')
   },
   onHide: function () {
      console.log('App Hide')
   }
  onLaunch: function () {
    var that = this
    if (!that.$store.state.openid) {
      let url = window.location.href
      let code = ''
      if (url.indexOf('code=') !== -1) {
        const query = url.split('?')
        console.log('app-app', url)
        for (const q of query) {
          if (q.indexOf('code=') !== -1) {
            code = q.substring(q.indexOf('code=') + 5, q.length)
          }
        }
        wxAuthorize({
          code: code
        }).then(res => {
          console.log('app_ress', res)
          if (res.code === 200) {
            that.$store.commit('setOpenId', res.data.openid)
            if (res.data.member) {
              that.$store.commit('setMember', res.data.member)
            }
          }
        })
      } else {
        // const appID = 'wx4d7c10bdec51942b'
        // let uri = encodeURIComponent(url)
        // let authURL =
        //   `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appID}&redirect_uri=${uri}&response_type=code&scope=snsapi_base&state=123#wechat_redirect`
        // window.location.href = authURL
      }
    }
    // 刷新token
    const token = uni.getStorageSync('token')
    if (token) {
      //  refreshToken().then(res => {
      //     if(res.code && res.code === 200){
      //       this.$store.commit('setToken', res.data)
      //    }
      // })
    }
  },
  onShow: function () {
    console.log('App Show')
  },
  onHide: function () {
    console.log('App Hide')
  }
}
</script>
@@ -51,187 +57,187 @@
@import "uview-ui/index.scss";
.flex-cb {
   display: flex;
   justify-content: space-between;
   align-items: center;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.container {
   height: 100%;
   width: 100%;
   max-width: 800rpx;
   overflow-y: auto;
  height: 100%;
  width: 100%;
  max-width: 800rpx;
  overflow-y: auto;
}
.doumee-container .ivu-tabs-nav {
   width: 100%;
  width: 100%;
}
.doumee-container .ivu-tabs-nav .ivu-tabs-tab {
   width: calc(100% / 3);
  width: calc(100% / 3);
}
.doumee-container .ivu-tabs-nav .ivu-tabs-tab {
   margin-right: 0;
   text-align: center;
  margin-right: 0;
  text-align: center;
}
.cell {
   background-color: #fff;
   display: flex;
   justify-content: space-between;
   align-items: center;
   min-height: 100rpx;
   padding: 24rpx 30rpx;
   box-sizing: border-box;
   border-bottom: 1rpx solid #eee;
   font-size: 15rpx;
   position: relative;
  background-color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 100rpx;
  padding: 24rpx 30rpx;
  box-sizing: border-box;
  border-bottom: 1rpx solid #eee;
  font-size: 15rpx;
  position: relative;
}
.cell .title {
   flex-shrink: 0;
   color: #222;
   line-height: 20rpx;
   height: 20rpx;
   width: 28%;
   margin-right: 5%;
  flex-shrink: 0;
  color: #222;
  line-height: 20rpx;
  height: 20rpx;
  width: 28%;
  margin-right: 5%;
}
.cell .content {
   flex: 1;
   font-size: 28rpx;
   font-weight: 400;
   color: #999999;
   display: flex;
   align-items: center;
   justify-content: flex-end;
  flex: 1;
  font-size: 28rpx;
  font-weight: 400;
  color: #999999;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.cell .content .input {
   width: 100%;
   height: 100%;
   font-size: 28rpx;
   font-weight: 400;
   color: #333333;
   text-align: right;
  width: 100%;
  height: 100%;
  font-size: 28rpx;
  font-weight: 400;
  color: #333333;
  text-align: right;
}
.cell.is-link::after {
   content: '';
   display: block;
   width: 8rpx;
   height: 8rpx;
   transform: rotate(-45deg);
   border-right: 1rpx solid #999999;
   border-bottom: 1rpx solid #999999;
   margin-left: 5rpx;
  content: "";
  display: block;
  width: 8rpx;
  height: 8rpx;
  transform: rotate(-45deg);
  border-right: 1rpx solid #999999;
  border-bottom: 1rpx solid #999999;
  margin-left: 5rpx;
}
.card {
   background-color: #fff;
   padding: 16rpx;
   position: relative;
  background-color: #fff;
  padding: 16rpx;
  position: relative;
}
.card::after {
   content: '';
   display: block;
   position: absolute;
   width: calc(100% - 32rpx);
   height: 0;
   bottom: 0;
   left: 16rpx;
   border-bottom: 1rpx solid #f7f7f7;
  content: "";
  display: block;
  position: absolute;
  width: calc(100% - 32rpx);
  height: 0;
  bottom: 0;
  left: 16rpx;
  border-bottom: 1rpx solid #f7f7f7;
}
.card .title {
   color: #777777;
   margin-bottom: 12rpx;
  color: #777777;
  margin-bottom: 12rpx;
}
.card .content {
   color: #222;
  color: #222;
}
.placeholder9 {
   color: #999999;
   font-size: 28rpx;
  color: #999999;
  font-size: 28rpx;
}
//设置圆角
checkbox .uni-checkbox-input {
   border-radius: 50%;
  border-radius: 50%;
}
checkbox .uni-checkbox-input.uni-checkbox-input-checked {
   color: #fff !important;
   border: 1px solid #4d99a8 !important;
   background-color: #4d99a8 !important;
  color: #fff !important;
  border: 1px solid #4d99a8 !important;
  background-color: #4d99a8 !important;
}
checkbox .uni-checkbox-input.uni-checkbox-input-checked:before {
   /* color: #4d99a8 !important;  */
   /* border: 1px solid #4d99a8 !important; */
   /* font-size: 58rpx; */
   /* border-radius: 50%; */
  /* color: #4d99a8 !important;  */
  /* border: 1px solid #4d99a8 !important; */
  /* font-size: 58rpx; */
  /* border-radius: 50%; */
}
//
//
view {
   box-sizing: border-box;
  box-sizing: border-box;
}
image {
   box-sizing: border-box;
   margin: 0;
   display: flex;
  box-sizing: border-box;
  margin: 0;
  display: flex;
}
input{
   font-size: 30rpx
input {
  font-size: 30rpx;
}
textarea {
   box-sizing: border-box;
   // background-color: #f7f7f7;
   font-size: 30rpx !important;
   padding: 0;
   border-radius: 8rpx;
   color: #333333 !important;
  box-sizing: border-box;
  // background-color: #f7f7f7;
  font-size: 30rpx !important;
  padding: 0;
  border-radius: 8rpx;
  color: #333333 !important;
}
.u-textarea{
   padding: 0 !important;
   color: #333333 !important;
.u-textarea {
  padding: 0 !important;
  color: #333333 !important;
}
.df_ac {
   display: flex;
   align-items: center;
  display: flex;
  align-items: center;
}
.main_app {
   padding: 0 30rpx 30rpx;
   font-size: 28rpx;
   color: #333333;
  padding: 0 30rpx 30rpx;
  font-size: 28rpx;
  color: #333333;
}
.placeholder9 {
   color: #999999;
   font-size: 28rpx;
  color: #999999;
  font-size: 28rpx;
}
.mr24 {
   margin-right: 24rpx;
  margin-right: 24rpx;
}
.mr12 {
   margin-right: 12rpx;
  margin-right: 12rpx;
}
.ml12 {
   margin-left: 12rpx;
  margin-left: 12rpx;
}
.mr6 {
   margin-right: 6rpx;
  margin-right: 6rpx;
}
</style>