index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. let myInfoData = reactive({
  80. jzName: '',
  81. userImg: '',
  82. realName: '',
  83. idcard: '',
  84. userName: '',
  85. from: ''
  86. });
  87. const commonDialogRef = ref(null);
  88. const passwordDialogRef = ref(null);
  89. const imageDialogRef = ref(null);
  90. const shexiangRef = ref(null);
  91. const zpRef = ref(null);
  92. const exitContent = '你确定要执行这个操作吗?';
  93. const exitTitle = '退出登录';
  94. const store = useIsCanBack();
  95. function getMyInit() {
  96. getUserInfo();
  97. }
  98. // 获取用户头像
  99. function goToPage(data) {
  100. switch (data) {
  101. case 'grcj':
  102. uni.navigateTo({
  103. url: '/pages/admin/my/myInfo?from=my'
  104. })
  105. break;
  106. /* case 'jzxx':
  107. uni.navigateTo({
  108. url: '/pages/admin/my/jzInfo'
  109. })
  110. break; */
  111. }
  112. }
  113. function getUserInfo() {
  114. getGlMineUser({}).then(res => {
  115. myInfoData.userImg = res.data.icon;
  116. myInfoData.realName = res.data.realName;
  117. myInfoData.idcard = res.data.idcard;
  118. myInfoData.userName = res.data.userName;
  119. myInfoData.jzName = res.data.jzName;
  120. })
  121. }
  122. function exitLogin() {
  123. commonDialogRef.value.handleShow();
  124. }
  125. function xgmmBtn() {
  126. passwordDialogRef.value.handleShow();
  127. }
  128. function ewmBtn() {
  129. //imageDialogRef.value.handleShow();
  130. if (!plus.runtime.isApplicationExist({
  131. pname: 'com.tencent.mm'
  132. })) {
  133. uni.showToast({
  134. title: '请先安装微信',
  135. icon: 'none'
  136. });
  137. return;
  138. }
  139. uni.share({
  140. provider: "weixin",
  141. scene: "WXSceneSession",
  142. type: 1,
  143. summary: "我正在使用HBuilderX开发uni-app,赶紧跟我一起来体验!",
  144. success: function(res) {
  145. console.log("success:" + JSON.stringify(res));
  146. },
  147. fail: function(err) {
  148. console.log("fail:" + JSON.stringify(err));
  149. }
  150. });
  151. // uni.share({
  152. // provider: "weixin",
  153. // scene: "WXSceneSession", // 分享给好友
  154. // type: 5, // 5表示小程序卡片
  155. // summary: "专业的家政服务平台,为您提供优质服务",
  156. // href: "https://www.baidu.com",
  157. // title: "家政学小程序",
  158. // imageUrl: "/static/share-thumb.jpg",
  159. // miniProgram: {
  160. // id: "wx3a4f7c01eb080d14",
  161. // path: "/pages/index/index",
  162. // type: 0,
  163. // webUrl: "https://www.baidu.com"
  164. // },
  165. // success: (res) => {
  166. // console.log("分享成功:", res);
  167. // uni.showToast({
  168. // title: '分享成功',
  169. // icon: 'success'
  170. // });
  171. // },
  172. // fail: (err) => {
  173. // console.log("分享失败:", err);
  174. // let errorMsg = '分享失败';
  175. // if (err.errMsg && err.errMsg.includes('未安装')) {
  176. // errorMsg = '未安装微信';
  177. // }
  178. // uni.showToast({
  179. // title: errorMsg,
  180. // icon: 'none'
  181. // });
  182. // }
  183. // });
  184. }
  185. function passwordBtn(data) {
  186. console.log(data, 'data');
  187. const opt = {
  188. passwordOld: data.oldPassWord,
  189. passwordNew: data.newPassWord,
  190. }
  191. getGlPasswordUpdate(opt).then(res => {
  192. if (res.data) {
  193. uni.showToast({
  194. title: '更新成功'
  195. })
  196. passwordDialogRef.value.handleClose();
  197. }
  198. })
  199. }
  200. function exitBtn() {
  201. getGlMineLogout().then(res => {
  202. toast('退出登录成功')
  203. cacheManager.clearAll();
  204. uni.reLaunch({
  205. url: '/pages/Login/index'
  206. });
  207. store.setIsCanBack(true)
  208. }).catch(err => {
  209. toast('退出登录失败,请稍后重试')
  210. store.setIsCanBack(false)
  211. })
  212. }
  213. function showMessageDl() {
  214. console.log(shexiangRef.value)
  215. shexiangRef.value.handleShow()
  216. }
  217. function showZhuaPaiConfirm() {
  218. zpRef.value.showDialog()
  219. }
  220. function zpConfirmSuccess() {
  221. zpRef.value.showDialog()
  222. }
  223. function zpConfirmError() {
  224. uni.showToast({
  225. title: '摄像头唤起异常',
  226. icon: 'none'
  227. })
  228. }
  229. onLoad(() => {
  230. })
  231. onShow(() => {
  232. getMyInit()
  233. })
  234. </script>
  235. <style>
  236. </style>