user.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view class="page-container">
  3. <view class="head">
  4. <view class="name-container">
  5. <view class="name">
  6. <view class="nickName">{{$store.state.user.nickName}}</view>
  7. <view class="account">账号:{{$store.state.user.name}}</view>
  8. </view>
  9. <image :src="$getImages(`${$store.state.user.avatar?$store.state.user.avatar: '/assetsMobile/images/setting/new240902/touxiang.png'}`)" class="avatar" />
  10. </view>
  11. </view>
  12. <view class="buy" v-if="hasHostPlat(['dingH5'])">
  13. <image class="buy-bg" :src="$getImages('/assetsMobile/images/setting/new240902/buy-back.png')"></image>
  14. <image
  15. class="buy-btn"
  16. :src="$getImages('/assetsMobile/images/setting/new240902/buy.png')"
  17. @click="handleGetH5SkuUrl"
  18. ></image>
  19. </view>
  20. <view class="body">
  21. <view class="munes">
  22. <template v-for="(item,index) in munesList">
  23. <view class="munes-item"
  24. @click="handleFun(item)"
  25. v-if="$hasPermi(item.permission) && (item.hasOwnProperty('isShow')?item.isShow: true)"
  26. >
  27. <image class="icon" :src="item.icon"></image>
  28. <view class="label">{{item.label}}</view>
  29. <view class="arror">
  30. <u-icon name="arrow-right" color="#999999"></u-icon>
  31. </view>
  32. </view>
  33. </template>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import * as dd from 'dingtalk-jsapi'; // 此方式为整体加载,也可按需进行加载
  40. import Sidebar from '@/components/sidebar'
  41. import Vue from 'vue'
  42. import {getH5SkuUrl} from '@/api/common/system.js'
  43. import { openAuth } from 'dingtalk-design-libs/biz/openAuth';
  44. export default {
  45. components: {
  46. Sidebar,
  47. },
  48. data() {
  49. let that = this;
  50. return {
  51. munesList: [ // 监控中心
  52. {
  53. permission: '*', // 权限
  54. label: '个人资料', // 标题
  55. icon: this.$getImages('/assetsMobile/images/setting/new240902/profile_icon.png'), // 图片
  56. url: '/pagesBase/userData/userData', // 路径
  57. },
  58. {
  59. permission: '*', // 权限
  60. label: '密码设置', // 标题
  61. icon: this.$getImages('/assetsMobile/images/setting/new240902/pwd_icon.png'), // 图片
  62. url: '/pagesBase/changePassword/changePassword', // 路径
  63. isShow: !Vue.prototype.hasHostPlat(["dingH5"])
  64. },
  65. {
  66. permission: 'mobile:setting:ziliao', // 权限
  67. label: '培训资料', // 标题
  68. icon: this.$getImages('/assetsMobile/images/setting/new240902/tranin.png'), // 图片
  69. url: '/peixun/ziliao/ziliao', // 路径
  70. },
  71. {
  72. permission: '*', // 权限
  73. label: '退出登录', // 标题
  74. icon: this.$getImages('/assetsMobile/images/setting/new240902/logout_icon.png'), // 图片
  75. event: 'handleLogout', // 事件
  76. isShow: !Vue.prototype.hasHostPlat(["dingH5"])
  77. },
  78. ]
  79. };
  80. },
  81. mounted() {
  82. },
  83. methods: {
  84. handleFun(item) {
  85. if(item.event) {
  86. this[item.event]()
  87. } else if (item.url) {
  88. uni.navigateTo({
  89. url: item.url,
  90. })
  91. }else {
  92. uni.showToast({
  93. title: '功能正在开发',
  94. icon: 'none'
  95. })
  96. }
  97. },
  98. handleLogout() {
  99. let that = this;
  100. uni.showModal({
  101. title: '提示',
  102. content: '确定退出登录?',
  103. cancelText: '取消',
  104. confirmText: '确定',
  105. success: function(res) {
  106. if (res.confirm) {
  107. that.$store.dispatch('LogOut').then(() => {
  108. uni.reLaunch({
  109. url: '/pages/login/login'
  110. })
  111. })
  112. }
  113. }
  114. })
  115. },
  116. //钉钉内购
  117. handleGetH5SkuUrl() {
  118. openAuth({
  119. clientId: 'suitemikul1sbf3gohcnt', // 应用ID(唯一标识)
  120. corpId: uni.getStorageSync('corpId'), // 当前组织的corpId
  121. rpcScope:'qyapi_appstore_internal',
  122. // fieldScope:'Contact.User.mobile',
  123. type: 1 // 0 标识授权个人信息;1 标识授权组织信息
  124. }).then((res)=>{
  125. const {status,result} = res
  126. // console.log(res,'resresres')
  127. if(status == 'ok') {
  128. getH5SkuUrl({
  129. corpId: uni.getStorageSync('corpId')
  130. }).then((res) => {
  131. dd.openLink({
  132. url:res.data,//要打开链接的地址
  133. onSuccess : function(result) {
  134. /**/
  135. },
  136. onFail : function(err) {}
  137. })
  138. })
  139. }
  140. })
  141. }
  142. }
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. .page-container {
  147. font-family: PingFangSC, PingFang SC;
  148. background-color: #F6F6F6;
  149. .head {
  150. margin-bottom: 16rpx;
  151. height: 222rpx;
  152. background: #FFFFFF;
  153. display: flex;
  154. align-items: center;
  155. padding: 0 48rpx;
  156. .name-container {
  157. flex: 1;
  158. display: flex;
  159. justify-content: flex-start;
  160. .name {
  161. flex: 1;
  162. display: flex;
  163. flex-direction: column;
  164. justify-content: center;
  165. gap: 10rpx 0;
  166. .nickName {
  167. font-family: PingFangSC, PingFang SC;
  168. font-weight: 400;
  169. font-size: 44rpx;
  170. color: #232323;
  171. text-align: left;
  172. font-style: normal;
  173. }
  174. .account {
  175. font-family: PingFangSC, PingFang SC;
  176. font-weight: 400;
  177. font-size: 24rpx;
  178. color: #888888;
  179. text-align: left;
  180. font-style: normal;
  181. }
  182. }
  183. .avatar {
  184. flex-basis: 140rpx;
  185. flex-shrink: 0;
  186. width: 140rpx;
  187. height: 140rpx;
  188. border-radius: 50%;
  189. background: #d2d2d2;
  190. }
  191. }
  192. }
  193. .buy {
  194. margin-bottom: 16rpx;
  195. background: #FFFFFF;
  196. position: relative;
  197. height: 116rpx;
  198. .buy-bg {
  199. width: 100%;
  200. height: 116rpx;
  201. }
  202. .buy-btn {
  203. position: absolute;
  204. right: 50rpx;
  205. top: calc(50% - 25rpx);
  206. width: 152rpx;
  207. height: 50rpx;
  208. }
  209. }
  210. .body {
  211. margin-bottom: 16rpx;
  212. background: #FFFFFF;
  213. .munes {
  214. display: flex;
  215. flex-direction: column;
  216. .munes-item{
  217. height: 96rpx;
  218. display: flex;
  219. flex-direction: row;
  220. align-items: center;
  221. padding: 0 30rpx;
  222. gap: 0 22rpx;
  223. .icon {
  224. flex-basis: 48rpx;
  225. flex-shrink: 0;
  226. width: 48rpx;
  227. height: 48rpx;
  228. }
  229. .label {
  230. flex: 1;
  231. font-family: PingFangSC, PingFang SC;
  232. font-weight: 600;
  233. font-size: 28rpx;
  234. color: #000000;
  235. text-align: left;
  236. font-style: normal;
  237. }
  238. .arrow {
  239. flex-basis: 40rpx;
  240. flex-shrink: 0;
  241. width: 40rpx;
  242. height: 40rpx;
  243. }
  244. }
  245. }
  246. }
  247. }
  248. </style>