index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <template>
  2. <view class="client-my-page">
  3. <view class="jzgs-name-box">
  4. <text>{{myInfoData.jzName}}</text>
  5. </view>
  6. <view class="admin-head-box">
  7. <view class="head-img-box">
  8. <img class="head-img" :src="myInfoData.userImg" v-if="myInfoData.userImg">
  9. <icon class="phone-default-userImg" v-else></icon>
  10. </view>
  11. <view class="head-content-box">
  12. <text>{{myInfoData.realName}}</text>
  13. <view class="head-content-row-box" v-if="myInfoData.userName">
  14. <icon class="tel-icon"></icon>
  15. <text class="content-text">{{myInfoData.userName}}</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="my-list-box">
  20. <view class="list-row" @click="goToPage('grcj')">
  21. <icon class="list-icon user-icon"></icon>
  22. <text>修改个人信息</text>
  23. </view>
  24. <view class="list-row" @click="goToPage('jzxx')">
  25. <icon class="list-icon jzxx-icon"></icon>
  26. <text>家政信息维护</text>
  27. </view>
  28. <view class="list-row" @click="xgmmBtn">
  29. <icon class="list-icon mm-icon"></icon>
  30. <text>修改密码</text>
  31. </view>
  32. <view class="list-row" @click="ewmBtn">
  33. <icon class="list-icon code-icon"></icon>
  34. <text>二维码</text>
  35. </view>
  36. <view class="list-row" @click="exitLogin">
  37. <icon class="list-icon login-out-icon"></icon>
  38. <text>退出登录</text>
  39. </view>
  40. </view>
  41. <!-- 底部区域 -->
  42. <customTabbarClient :currentTab="3"></customTabbarClient>
  43. <common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent"
  44. @confirm-btn="exitBtn"></common-dialog>
  45. <shexiangDialogVue ref="shexiangRef" title="摄像头说明"></shexiangDialogVue>
  46. <password-dialog ref="passwordDialogRef" @confirm-btn="passwordBtn"></password-dialog>
  47. <image-dialog ref="imageDialogRef"></image-dialog>
  48. <!-- 摄像头确认 -->
  49. <zhuapaiConfrimVue ref="zpRef" @error="zpConfirmError" title="摄像头测试"></zhuapaiConfrimVue>
  50. </view>
  51. </template>
  52. <script setup>
  53. import {
  54. toast
  55. } from "@/utils/common";
  56. import {
  57. onLoad,
  58. onShow
  59. } from '@dcloudio/uni-app';
  60. import cacheManager from '@/utils/cacheManager.js';
  61. import {
  62. getGlMineUser,
  63. getGlMineLogout,
  64. getGlPasswordUpdate
  65. } from '@/api/my.js'
  66. import {
  67. reactive,
  68. ref
  69. } from "vue";
  70. import customTabbarClient from "@/components/custom-tabbar/custom-tabbar-admin.vue"
  71. import commonDialog from '@/components/dialog/commonDialog.vue';
  72. import passwordDialog from './passwordDialog.vue';
  73. import imageDialog from './imageDialog.vue';
  74. import shexiangDialogVue from "@/components/dialog/shexiangDialog.vue";
  75. import zhuapaiConfrimVue from "@/components/zhuapaiConfirm/index.vue";
  76. import {
  77. useIsCanBack
  78. } from "@/store/isCanBack.js"
  79. // #ifndef APP-HARMONY
  80. import UniShare from '@/uni_modules/uni-share/js_sdk/uni-share.js';
  81. const uniShare = new UniShare();
  82. // #endif
  83. // #ifdef APP-HARMONY
  84. import {
  85. uniShare
  86. } from "@/uni_modules/uni-share"
  87. // #endif
  88. let myInfoData = reactive({
  89. jzName: '',
  90. userImg: '',
  91. realName: '',
  92. idcard: '',
  93. userName: '',
  94. from: ''
  95. });
  96. const commonDialogRef = ref(null);
  97. const passwordDialogRef = ref(null);
  98. const imageDialogRef = ref(null);
  99. const shexiangRef = ref(null);
  100. const zpRef = ref(null);
  101. const exitContent = '你确定要执行这个操作吗?';
  102. const exitTitle = '退出登录';
  103. const store = useIsCanBack();
  104. function getMyInit() {
  105. getUserInfo();
  106. }
  107. // 获取用户头像
  108. function goToPage(data) {
  109. switch (data) {
  110. case 'grcj':
  111. uni.navigateTo({
  112. url: '/pages/admin/my/myInfo?from=my'
  113. })
  114. break;
  115. case 'jzxx':
  116. uni.navigateTo({
  117. url: '/pages/admin/my/jzInfo'
  118. })
  119. break;
  120. }
  121. }
  122. function getUserInfo() {
  123. getGlMineUser({}).then(res => {
  124. myInfoData.userImg = res.data.icon;
  125. myInfoData.realName = res.data.realName;
  126. myInfoData.idcard = res.data.idcard;
  127. myInfoData.userName = res.data.userName;
  128. myInfoData.jzName = res.data.jzName;
  129. })
  130. }
  131. function exitLogin() {
  132. commonDialogRef.value.handleShow();
  133. }
  134. function xgmmBtn() {
  135. passwordDialogRef.value.handleShow();
  136. }
  137. function ewmBtn() {
  138. //imageDialogRef.value.handleShow();
  139. if (!plus.runtime.isApplicationExist({
  140. pname: 'com.tencent.mm'
  141. })) {
  142. uni.showToast({
  143. title: '请先安装微信',
  144. icon: 'none'
  145. });
  146. return;
  147. }
  148. uni.share({
  149. provider: 'weixin',
  150. scene: "WXSceneSession",
  151. type: 5,
  152. imageUrl: 'https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/share-logo@3.png',
  153. title: '欢迎体验uniapp12312',
  154. miniProgram: {
  155. id: 'gh_fa5889151e7d',
  156. path: 'pages/index/index',
  157. type: 1,
  158. webUrl: 'http://uniapp.dcloud.io'
  159. },
  160. success: ret => {
  161. console.log(JSON.stringify(ret));
  162. }
  163. });
  164. // // #ifdef APP-HARMONY
  165. // uniShare(['https://img-cdn-aliyun.dcloud.net.cn/stream/icon/__UNI__HelloUniApp.png'])
  166. // // #endif
  167. // // #ifndef APP-HARMONY
  168. // uniShare.show({
  169. // content: { //公共的分享参数配置 类型(type)、链接(herf)、标题(title)、summary(描述)、imageUrl(缩略图)
  170. // type: 5,
  171. // href: 'https://uniapp.dcloud.io/',
  172. // title: '标题',
  173. // summary: '描述阿斯顿发啥发啥发',
  174. // imageUrl: 'https://img-cdn-aliyun.dcloud.net.cn/stream/icon/__UNI__HelloUniApp.png',
  175. // miniProgram: {
  176. // id: 'gh_abcdefg',
  177. // path: 'pages/index/index',
  178. // type: 0,
  179. // webUrl: 'http://uniapp.dcloud.io'
  180. // },
  181. // },
  182. // menus: [{
  183. // "img": "/static/app-plus/sharemenu/wechatfriend.png",
  184. // "text": "微信好友",
  185. // "share": { //当前项的分享参数配置。可覆盖公共的配置如下:分享到微信小程序,配置了type=5
  186. // "provider": "weixin",
  187. // "scene": "WXSceneSession"
  188. // }
  189. // }, {
  190. // "img": "/static/app-plus/sharemenu/wechatmoments.png",
  191. // "text": "微信朋友圈",
  192. // "share": {
  193. // "provider": "weixin",
  194. // "scene": "WXSceneTimeline"
  195. // }
  196. // }],
  197. // cancelText: "取消分享",
  198. // }, e => { //callback
  199. // console.log(uniShare.isShow);
  200. // console.log(e);
  201. // })
  202. // // #endif
  203. }
  204. function passwordBtn(data) {
  205. console.log(data, 'data');
  206. const opt = {
  207. passwordOld: data.oldPassWord,
  208. passwordNew: data.newPassWord,
  209. }
  210. getGlPasswordUpdate(opt).then(res => {
  211. if (res.data) {
  212. uni.showToast({
  213. title: '更新成功'
  214. })
  215. passwordDialogRef.value.handleClose();
  216. }
  217. })
  218. }
  219. function exitBtn() {
  220. getGlMineLogout().then(res => {
  221. toast('退出登录成功')
  222. cacheManager.clearAll();
  223. uni.reLaunch({
  224. url: '/pages/Login/index'
  225. });
  226. store.setIsCanBack(true)
  227. }).catch(err => {
  228. toast('退出登录失败,请稍后重试')
  229. store.setIsCanBack(false)
  230. })
  231. }
  232. function showMessageDl() {
  233. console.log(shexiangRef.value)
  234. shexiangRef.value.handleShow()
  235. }
  236. function showZhuaPaiConfirm() {
  237. zpRef.value.showDialog()
  238. }
  239. function zpConfirmSuccess() {
  240. zpRef.value.showDialog()
  241. }
  242. function zpConfirmError() {
  243. uni.showToast({
  244. title: '摄像头唤起异常',
  245. icon: 'none'
  246. })
  247. }
  248. onLoad(() => {
  249. })
  250. onShow(() => {
  251. getMyInit()
  252. })
  253. </script>
  254. <style>
  255. </style>