user - 副本.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="page-container">
  3. <image :src="$getImages('/assetsMobile/images/setting/bg.png')" class="background-image"></image>
  4. <view class="munes">
  5. <Sidebar
  6. label="设置"
  7. :sidebarList="munesList"
  8. :hasTitle="false"
  9. :span="4"
  10. @handleLogout="handleLogout"
  11. @handleGetH5SkuUrl="handleGetH5SkuUrl"
  12. direction='user'
  13. >
  14. </Sidebar>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import * as dd from 'dingtalk-jsapi'; // 此方式为整体加载,也可按需进行加载
  20. import Sidebar from '@/components/sidebar'
  21. import Vue from 'vue'
  22. import {getH5SkuUrl} from '@/api/common/system.js'
  23. import { openAuth } from 'dingtalk-design-libs/biz/openAuth';
  24. export default {
  25. components: {
  26. Sidebar,
  27. },
  28. data() {
  29. let that = this;
  30. return {
  31. munesList: [ // 监控中心
  32. {
  33. permission: '*', // 权限
  34. label: '个人资料', // 标题
  35. icon: `https://www.yihaocg.com/mobile/image/setting/profile_icon.png`, // 图片
  36. url: '/pagesBase/userData/userData', // 路径
  37. },
  38. {
  39. permission: '*', // 权限
  40. label: '密码设置', // 标题
  41. icon: `https://www.yihaocg.com/mobile/image/setting/pwd_icon.png`, // 图片
  42. url: '/pagesBase/changePassword/changePassword', // 路径
  43. },
  44. {
  45. permission: 'mobile:setting:ziliao', // 权限
  46. label: '培训资料', // 标题
  47. icon: this.$getImages('/assetsMobile/images/setting/tranin.png'), // 图片
  48. url: '/peixun/ziliao/ziliao', // 路径
  49. },
  50. {
  51. permission: '*', // 权限
  52. label: '钉钉内购', // 标题
  53. icon: 'https://www.yihaocg.com/mobile/image/setting/peixun_icon.png', // 图片
  54. event: 'handleGetH5SkuUrl', // 事件
  55. url: '/peixun/ziliao/ziliao', // 路径
  56. isShow: Vue.prototype.hasHostPlat(["dingH5"])
  57. },
  58. {
  59. permission: '*', // 权限
  60. label: '退出登录', // 标题
  61. icon: `https://www.yihaocg.com/mobile/image/setting/logout_icon.png`, // 图片
  62. event: 'handleLogout', // 事件
  63. isShow: !Vue.prototype.hasHostPlat(["dingH5"])
  64. },
  65. ]
  66. };
  67. },
  68. mounted() {
  69. },
  70. methods: {
  71. handleLogout() {
  72. let that = this;
  73. uni.showModal({
  74. title: '提示',
  75. content: '确定退出登录?',
  76. cancelText: '取消',
  77. confirmText: '确定',
  78. success: function(res) {
  79. if (res.confirm) {
  80. that.$store.dispatch('LogOut').then(() => {
  81. uni.reLaunch({
  82. url: '/pages/login/login'
  83. })
  84. })
  85. }
  86. }
  87. })
  88. },
  89. //钉钉内购
  90. handleGetH5SkuUrl() {
  91. openAuth({
  92. clientId: 'suitemikul1sbf3gohcnt', // 应用ID(唯一标识)
  93. corpId: uni.getStorageSync('corpId'), // 当前组织的corpId
  94. rpcScope:'qyapi_appstore_internal',
  95. // fieldScope:'Contact.User.mobile',
  96. type: 1 // 0 标识授权个人信息;1 标识授权组织信息
  97. }).then((res)=>{
  98. const {status,result} = res
  99. // console.log(res,'resresres')
  100. if(status == 'ok') {
  101. getH5SkuUrl({
  102. corpId: uni.getStorageSync('corpId')
  103. }).then((res) => {
  104. dd.openLink({
  105. url:res.data,//要打开链接的地址
  106. onSuccess : function(result) {
  107. /**/
  108. },
  109. onFail : function(err) {}
  110. })
  111. })
  112. }
  113. })
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss" scoped>
  119. .page-container {
  120. font-family: PingFangSC, PingFang SC;
  121. .background-image {
  122. position: absolute;
  123. top: 0;
  124. right: 0;
  125. width: 100%;
  126. height: 240rpx;
  127. }
  128. .munes {
  129. border-radius: 20rpx;
  130. background: #fff;
  131. position: absolute;
  132. top: 80px;
  133. left: 20rpx;
  134. width: calc(100% - 42rpx);
  135. min-height: 220rpx;
  136. padding-bottom: 30rpx;
  137. z-index: 100;
  138. }
  139. }
  140. </style>