setup.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view>
  3. <view class="page padding-main">
  4. <!-- 主体内容 -->
  5. <block v-if="data_list_loding_status == 3">
  6. <view class="padding-horizontal-main border-radius-main bg-white oh spacing-mb">
  7. <view class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right oh" data-value="/pages/personal/personal" @tap="url_event">
  8. <image :src="(user.avatar || default_avatar)" mode="widthFix" class="circle br fl user-avatar"></image>
  9. <view class="fl margin-left">
  10. <view>{{user.user_name_view || '用户名'}}</view>
  11. <view v-if="(user || null) != null" class="br-main cr-main round tc padding-left-lg padding-right-lg margin-top-xs dis-inline-block">ID {{user.id}}</view>
  12. </view>
  13. </view>
  14. <view class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right br-t" data-value="/pages/login/login?opt_form=bind_verify" @tap="url_event">
  15. <text>更换手机</text>
  16. <text class="fr cr-grey">{{user.mobile_security || ''}} 点击更换</text>
  17. </view>
  18. </view>
  19. <view class="padding-horizontal-main border-radius-main bg-white oh spacing-mb">
  20. <view class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right" data-value="/pages/user-address/user-address" @tap="url_event">
  21. <text>地址管理</text>
  22. <text class="fr cr-grey">点击管理</text>
  23. </view>
  24. <view v-if="(plugins_invoice || null) != null" class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right br-t" data-value="/pages/plugins/invoice/user/user" @tap="url_event">
  25. <text>发票管理</text>
  26. <text class="fr cr-grey">点击前往</text>
  27. </view>
  28. </view>
  29. <view class="padding-horizontal-main border-radius-main bg-white oh spacing-mb">
  30. <!-- #ifdef MP -->
  31. <view class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right br-b" @tap="open_setting_event">
  32. <text>权限设置</text>
  33. <text class="fr cr-grey">点击管理</text>
  34. </view>
  35. <!-- #endif -->
  36. <view class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right br-b" @tap="remove_user_cache_event">
  37. <text>清除缓存</text>
  38. <text class="fr cr-grey">点击清除</text>
  39. </view>
  40. <view v-if="(common_app_customer_service_tel || null) != null" class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right br-b" @tap="call_event">
  41. <text>客服电话</text>
  42. <text class="fr cr-grey">{{common_app_customer_service_tel || ''}} 点击拨打</text>
  43. </view>
  44. <view class="padding-top-xxl padding-bottom-xxl padding-right-xxxl arrow-right" data-value="/pages/logout/logout" @tap="url_event">
  45. <text>账号注销</text>
  46. <text class="fr cr-grey">注销后无法恢复</text>
  47. </view>
  48. </view>
  49. </block>
  50. <!-- 错误提示 -->
  51. <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. const app = getApp();
  57. import componentNoData from "../../components/no-data/no-data";
  58. export default {
  59. data() {
  60. return {
  61. data_list_loding_status: 1,
  62. data_list_loding_msg: '',
  63. default_avatar: app.globalData.data.default_user_head_src,
  64. user: null,
  65. common_app_customer_service_tel: null,
  66. plugins_invoice: null
  67. }
  68. },
  69. components: {
  70. componentNoData
  71. },
  72. onShow() {
  73. // 数据加载
  74. this.init();
  75. // 初始化配置
  76. this.init_config();
  77. },
  78. methods: {
  79. // 初始化配置
  80. init_config(status) {
  81. if ((status || false) == true) {
  82. this.setData({
  83. common_app_customer_service_tel: app.globalData.get_config('config.common_app_customer_service_tel'),
  84. plugins_invoice: app.globalData.get_config('plugins_base.invoice', null)
  85. });
  86. } else {
  87. app.globalData.is_config(this, 'init_config');
  88. }
  89. },
  90. // 获取数据
  91. init() {
  92. var user = app.globalData.get_user_info(this, 'init');
  93. if (user != false) {
  94. // 用户未绑定用户则转到登录页面
  95. if (app.globalData.user_is_need_login(user)) {
  96. uni.redirectTo({
  97. url: "/pages/login/login?event_callback=init"
  98. });
  99. this.setData({
  100. data_list_loding_status: 0,
  101. data_list_loding_msg: '请先绑定手机'
  102. });
  103. return false;
  104. } else {
  105. this.setData({
  106. data_list_loding_status: 3,
  107. user: user
  108. });
  109. }
  110. } else {
  111. this.setData({
  112. data_list_loding_status: 0,
  113. data_list_loding_msg: '请先登录'
  114. });
  115. }
  116. },
  117. // url事件
  118. url_event(e) {
  119. app.globalData.url_event(e);
  120. },
  121. // 打开小程序权限中心
  122. open_setting_event() {
  123. uni.openSetting();
  124. },
  125. // 客服电话
  126. call_event() {
  127. if (this.common_app_customer_service_tel == null) {
  128. app.globalData.showToast('客服电话有误');
  129. } else {
  130. app.globalData.call_tel(this.common_app_customer_service_tel);
  131. }
  132. },
  133. // 清除缓存
  134. remove_user_cache_event(e) {
  135. app.globalData.remove_user_cache_event();
  136. },
  137. }
  138. }
  139. </script>
  140. <style>
  141. @import './setup.css';
  142. </style>