index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  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="xgmmBtn">
  25. <icon class="list-icon mm-icon"></icon>
  26. <text>修改密码</text>
  27. </view>
  28. <view class="list-row" @click="ewmBtn">
  29. <icon class="list-icon code-icon"></icon>
  30. <text>二维码</text>
  31. </view>
  32. <view class="list-row" @click="exitLogin">
  33. <icon class="list-icon login-out-icon"></icon>
  34. <text>退出登录</text>
  35. </view>
  36. </view>
  37. <!-- 底部区域 -->
  38. <customTabbarClient :currentTab="3"></customTabbarClient>
  39. <common-dialog ref="commonDialogRef" :title="exitTitle" :content="exitContent"
  40. @confirm-btn="exitBtn"></common-dialog>
  41. <shexiangDialogVue ref="shexiangRef" title="摄像头说明"></shexiangDialogVue>
  42. <password-dialog ref="passwordDialogRef" @confirm-btn="passwordBtn"></password-dialog>
  43. <image-dialog ref="imageDialogRef"></image-dialog>
  44. <!-- 摄像头确认 -->
  45. <zhuapaiConfrimVue ref="zpRef" @error="zpConfirmError" title="摄像头测试"></zhuapaiConfrimVue>
  46. </view>
  47. </template>
  48. <script setup>
  49. import {
  50. toast
  51. } from "@/utils/common";
  52. import {
  53. onLoad,
  54. onShow
  55. } from '@dcloudio/uni-app';
  56. import cacheManager from '@/utils/cacheManager.js';
  57. import {
  58. getGlMineUser,
  59. getGlMineLogout,
  60. getGlPasswordUpdate
  61. } from '@/api/my.js'
  62. import {
  63. reactive,
  64. ref
  65. } from "vue";
  66. import customTabbarClient from "@/components/custom-tabbar/custom-tabbar-admin.vue"
  67. import commonDialog from '@/components/dialog/commonDialog.vue';
  68. import passwordDialog from './passwordDialog.vue';
  69. import imageDialog from './imageDialog.vue';
  70. import shexiangDialogVue from "@/components/dialog/shexiangDialog.vue";
  71. import zhuapaiConfrimVue from "@/components/zhuapaiConfirm/index.vue";
  72. import {
  73. useIsCanBack
  74. } from "@/store/isCanBack.js"
  75. let myInfoData = reactive({
  76. jzName: '',
  77. userImg: '',
  78. realName: '',
  79. idcard: '',
  80. userName: '',
  81. from: ''
  82. });
  83. const commonDialogRef = ref(null);
  84. const passwordDialogRef = ref(null);
  85. const imageDialogRef = ref(null);
  86. const shexiangRef = ref(null);
  87. const zpRef = ref(null);
  88. const exitContent = '你确定要执行这个操作吗?';
  89. const exitTitle = '退出登录';
  90. const store = useIsCanBack();
  91. function getMyInit() {
  92. getUserInfo();
  93. }
  94. // 获取用户头像
  95. function goToPage(data) {
  96. switch (data) {
  97. case 'grcj':
  98. uni.navigateTo({
  99. url: '/pages/admin/my/myInfo?from=my'
  100. })
  101. break;
  102. }
  103. }
  104. function getUserInfo() {
  105. getGlMineUser({}).then(res => {
  106. myInfoData.userImg = res.data.icon;
  107. myInfoData.realName = res.data.realName;
  108. myInfoData.idcard = res.data.idcard;
  109. myInfoData.userName = res.data.userName;
  110. myInfoData.jzName = res.data.jzName;
  111. })
  112. }
  113. function exitLogin() {
  114. commonDialogRef.value.handleShow();
  115. }
  116. function xgmmBtn() {
  117. passwordDialogRef.value.handleShow();
  118. }
  119. function ewmBtn() {
  120. //imageDialogRef.value.handleShow();
  121. if (!plus.runtime.isApplicationExist({
  122. pname: 'com.tencent.mm'
  123. })) {
  124. uni.showToast({
  125. title: '请先安装微信',
  126. icon: 'none'
  127. });
  128. return;
  129. }
  130. uni.share({
  131. provider: "weixin",
  132. scene: "WXSceneSession",
  133. type: 1,
  134. summary: "我正在使用HBuilderX开发uni-app,赶紧跟我一起来体验!",
  135. success: function(res) {
  136. console.log("success:" + JSON.stringify(res));
  137. },
  138. fail: function(err) {
  139. console.log("fail:" + JSON.stringify(err));
  140. }
  141. });
  142. // uni.share({
  143. // provider: "weixin",
  144. // scene: "WXSceneSession", // 分享给好友
  145. // type: 5, // 5表示小程序卡片
  146. // summary: "专业的家政服务平台,为您提供优质服务",
  147. // href: "https://www.baidu.com",
  148. // title: "家政学小程序",
  149. // imageUrl: "/static/share-thumb.jpg",
  150. // miniProgram: {
  151. // id: "wx3a4f7c01eb080d14",
  152. // path: "/pages/index/index",
  153. // type: 0,
  154. // webUrl: "https://www.baidu.com"
  155. // },
  156. // success: (res) => {
  157. // console.log("分享成功:", res);
  158. // uni.showToast({
  159. // title: '分享成功',
  160. // icon: 'success'
  161. // });
  162. // },
  163. // fail: (err) => {
  164. // console.log("分享失败:", err);
  165. // let errorMsg = '分享失败';
  166. // if (err.errMsg && err.errMsg.includes('未安装')) {
  167. // errorMsg = '未安装微信';
  168. // }
  169. // uni.showToast({
  170. // title: errorMsg,
  171. // icon: 'none'
  172. // });
  173. // }
  174. // });
  175. }
  176. function passwordBtn(data) {
  177. console.log(data, 'data');
  178. const opt = {
  179. passwordOld: data.oldPassWord,
  180. passwordNew: data.newPassWord,
  181. }
  182. getGlPasswordUpdate(opt).then(res => {
  183. if (res.data) {
  184. uni.showToast({
  185. title: '更新成功'
  186. })
  187. passwordDialogRef.value.handleClose();
  188. }
  189. })
  190. }
  191. function exitBtn() {
  192. getGlMineLogout().then(res => {
  193. toast('退出登录成功')
  194. cacheManager.clearAll();
  195. uni.reLaunch({
  196. url: '/pages/Login/index'
  197. });
  198. store.setIsCanBack(true)
  199. }).catch(err => {
  200. toast('退出登录失败,请稍后重试')
  201. store.setIsCanBack(false)
  202. })
  203. }
  204. function showMessageDl() {
  205. console.log(shexiangRef.value)
  206. shexiangRef.value.handleShow()
  207. }
  208. function showZhuaPaiConfirm() {
  209. zpRef.value.showDialog()
  210. }
  211. function zpConfirmSuccess() {
  212. zpRef.value.showDialog()
  213. }
  214. function zpConfirmError() {
  215. uni.showToast({
  216. title: '摄像头唤起异常',
  217. icon: 'none'
  218. })
  219. }
  220. onLoad(() => {
  221. })
  222. onShow(() => {
  223. getMyInit()
  224. })
  225. </script>
  226. <style>
  227. </style>