components.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view class="wrap">
  3. <page-nav :desc="desc" title="nav.components"></page-nav>
  4. <view class="list-wrap">
  5. <u-cell-group title-bg-color="rgb(243, 244, 246)" :title="getGroupTitle(item)" v-for="(item, index) in list" :key="index">
  6. <u-cell-item :titleStyle="{fontWeight: 500}" @click="openPage(item1.path)" :title="getFieldTitle(item1)"
  7. v-for="(item1, index1) in item.list" :key="index1">
  8. <image slot="icon" class="u-cell-icon" :src="getIcon(item1.icon)" mode="widthFix"></image>
  9. </u-cell-item>
  10. </u-cell-group>
  11. </view>
  12. <u-gap height="70"></u-gap>
  13. <!-- <u-tabbar :list="vuex_tabbar" :mid-button="true"></u-tabbar> -->
  14. </view>
  15. </template>
  16. <script>
  17. import list from "./components.config.js";
  18. import getUrlParams from "../../utils/getUrlParams.js";
  19. export default {
  20. data() {
  21. return {
  22. list: list,
  23. //desc: '众多组件覆盖开发过程的各个需求,组件功能丰富,多端兼容。让你快速集成,开箱即用。',
  24. }
  25. },
  26. computed: {
  27. getIcon() {
  28. return path => {
  29. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  30. }
  31. },
  32. desc() {
  33. return this.$t('components.desc');
  34. }
  35. },
  36. onShow() {
  37. uni.setNavigationBarTitle({
  38. title: this.$t('nav.components')
  39. });
  40. let locationLocaturl = window.location.search;
  41. let openId = getUrlParams(locationLocaturl,"openId");
  42. let token = getUrlParams(locationLocaturl,"token");
  43. if(!!token){
  44. this.$u.vuex('vuex_token', token);
  45. };
  46. if(!this.vuex_hasLogin&&!!token){
  47. this.$u.api.getuseinfo().then(res => {
  48. console.log('getuseinfo',res.retBody);
  49. this.$u.vuex('vuex_user', res.retBody);
  50. this.$u.vuex('vuex_hasLogin', true);
  51. if(!res.retBody.tel){
  52. this.openPage('/pages/template/bindPhoneNumber/bindPhoneNumber')
  53. }
  54. })
  55. }
  56. // if(!this.vuex_hasLogin&&!!openId){
  57. // this.$u.api.getuseinfo(openId).then(res => {
  58. // console.log('getuseinfo',res.retBody);
  59. // this.$u.vuex('vuex_user', res.retBody);
  60. // this.$u.vuex('vuex_hasLogin', true);
  61. // this.$u.vuex('vuex_token', res.retBody.token);
  62. // if(!res.retBody.phone){
  63. // this.openPage('/pages/template/bindPhoneNumber/bindPhoneNumber')
  64. // }
  65. // })
  66. // }
  67. },
  68. created() {
  69. },
  70. methods: {
  71. openPage(path) {
  72. this.$u.route({
  73. url: path
  74. })
  75. },
  76. getGroupTitle(item) {
  77. return this.$i18n.locale == 'zh' ? item.groupName : item.groupName_en
  78. },
  79. getFieldTitle(item) {
  80. return this.$i18n.locale == 'zh' ? item.title : item.title_en
  81. }
  82. }
  83. }
  84. </script>
  85. <style>
  86. /* page {
  87. background-color: rgb(240, 242, 244);
  88. } */
  89. </style>
  90. <style lang="scss" scoped>
  91. .u-cell-icon {
  92. width: 36rpx;
  93. height: 36rpx;
  94. margin-right: 8rpx;
  95. }
  96. </style>