mine.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="mine">
  3. <uni-nav-bar :border='border' title="我的" statusBar="true" :backgroundColor="backgroundColor" color="#FFFFFF" fixed="true" ></uni-nav-bar>
  4. <view class="header-bg">
  5. <image :src="headimg" class="headimg"></image>
  6. <view class="headbox">
  7. <!-- <image class="headImage" :src="userInfo.avatar || '../../static/image/pic_mine_hp.png'" mode=""></image> -->
  8. <view class="headleft">
  9. <image class="headImage" src="../../static/image/pic_mine_hp.png" mode=""></image>
  10. <view style="display: flex;align-items: flex-start;width: 100%;">
  11. <view class="headtxt">
  12. <text class="txt">{{userInfo.userName||''}}</text>
  13. <view>
  14. <view class="man-bg" v-if="userInfo.dept.deptName">
  15. <image src="../../static/image/icon_mine_tel.png" class="manimg"></image>
  16. {{userInfo.dept.deptName||''}}
  17. </view>
  18. </view>
  19. </view>
  20. <!-- <view class="headright">
  21. <image :src="adrimg"></image>
  22. 黄柏镇
  23. </view> -->
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="nmin">
  29. <view class="nmbox" v-for="(item,index) in card_listpeo" :key="index" :isShadow="true" @click="goNavs(index)">
  30. <image class="card-image" :src="item.url" mode=""></image>
  31. <view style="flex: 1;">
  32. <text class="txt2">{{item.txt2}}</text>
  33. <view class="txt3" v-if="index !== 1">
  34. {{item.txt3}}
  35. </view>
  36. <view class="txt3" v-else>
  37. {{getTimeNow()}}
  38. </view>
  39. </view>
  40. <view style="flex: 0 0 auto;">
  41. <image style="width: 16rpx;height: 25rpx;" src="../../static/image/icon_mine_listenter.png" mode=""></image>
  42. </view>
  43. </view>
  44. <!-- <uni-card extra="额外信息" >
  45. </uni-card> -->
  46. </view>
  47. <u-toast ref="uToast" />
  48. <uni-popup ref="logoutPopup" type="center">
  49. <uni-popup-dialog-logout type="info" title="退出登录" content="是否确认退出当前账号?" @confirm="logoutConfirm" ></uni-popup-dialog-logout>
  50. </uni-popup>
  51. <!-- 底部 导航栏 currentPage 当前页面ID -->
  52. <tab-bar :currentPage="2"></tab-bar>
  53. </view>
  54. </template>
  55. <script>
  56. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  57. import uniPopupDialogLogout from '@/components/uni-popup/uni-popup-dialog-logout.vue'
  58. import hostUrl from "@/util/url";
  59. let {host, imgDomain} = hostUrl
  60. import tabBar from "@/components/tabbar/tabbar.vue"
  61. export default {
  62. components: {
  63. uniPopup,
  64. uniPopupDialogLogout,
  65. tabBar
  66. },
  67. data() {
  68. return {
  69. headimg:require("@/static/image/pic_mine_dbbg.png"),
  70. adrimg:require("@/static/image/adr.png"),
  71. backgroundColor:'transparent',
  72. border:false,
  73. userInfo: {
  74. dept:{
  75. deptName:'',
  76. }
  77. },
  78. // 人口
  79. card_listpeo: [
  80. {url:'../../static/image/icon_mine_ymxx.png',txt2: '人口信息',txt3:'查看/修改我提交的人口信息'},
  81. {url:'../../static/image/icon_mine_jztj.png',txt2: '常住人口统计',txt3:''},
  82. {url:'../../static/image/scan.png',txt2: '扫码登录',txt3:'扫描二维码一键登录'},
  83. {url:'../../static/image/logout.png',txt2: '退出登录',txt3:'退出当前账号登录状态'}
  84. ]
  85. }
  86. },
  87. onShow() {
  88. },
  89. mounted() {
  90. // console.log('mounted')
  91. this.getUserInfo()
  92. },
  93. methods:{
  94. checkLogin() {
  95. var token = uni.getStorageSync('token')
  96. // var token = "df057579-73c8-4bdd-8312-f64db8efd699"
  97. if (token == undefined || token == '') {
  98. uni.reLaunch({
  99. url: '/pages/login/login'
  100. })
  101. return false
  102. }
  103. return true
  104. },
  105. getUserInfo() {
  106. this.$http.get('system/user/getInfo').then(res=>{
  107. // console.log(JSON.stringify(res))
  108. if(res.code == 200 ) {
  109. this.userInfo = res.user
  110. // 手机号是否展示
  111. // var d=['city01','queryApp','queryApp','city02']
  112. var roles=res.roles.some((ite,idx)=>{
  113. if(ite=='queryApp'){
  114. return true
  115. }
  116. })
  117. uni.setStorageSync('roles', roles)
  118. // var regexp = new RegExp("((http|ftp|https)://)(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,4})*/?", "g");
  119. // this.userInfo.avatar = this.userInfo.avatar.replace(regexp, imgDomain + '/');
  120. // console.log('avatar ' + this.userInfo.avatar)
  121. // console.log('hone ' + this.userInfo.phonenumber)
  122. uni.setStorageSync('phone', this.userInfo.phonenumber)
  123. }
  124. })
  125. },
  126. logoutConfirm(done) {
  127. done()
  128. uni.clearStorage()
  129. uni.reLaunch({
  130. url: '/pages/login/login'
  131. })
  132. },
  133. /* 获取当前时间 */
  134. getTimeNow () {
  135. let re = this.h_util.getDateTime('yyyy年MM月dd日hh时',new Date())
  136. return re
  137. },
  138. /* 跳转路由 */
  139. goNav(index) {
  140. if(index == 0) {
  141. uni.navigateTo({
  142. url:'/home/pages/recordthree/recordthree'
  143. })
  144. }else if (index == 1) {
  145. uni.navigateTo({
  146. url:'/home/pages/recordthree/recordthree'
  147. })
  148. }else if (index == 2) {
  149. this.$refs.uToast.show({
  150. title: '该功能暂未开放',
  151. type: 'error'
  152. })
  153. }else if (index == 3) {
  154. if (!this.checkLogin()) {
  155. return
  156. }
  157. uni.navigateTo({
  158. url:'/add/pages/addvacfrom/scan'
  159. })
  160. }else if (index == 4) {
  161. this.$refs.logoutPopup.open()
  162. }else{
  163. this.$refs.uToast.show({
  164. title: '该功能暂未开放',
  165. type: 'error'
  166. })
  167. }
  168. },
  169. goNavs(index){
  170. if(index == 0) {
  171. uni.navigateTo({
  172. url:'/home/pages/recordthree/recordpeople'
  173. })
  174. }else if (index == 1) {
  175. uni.navigateTo({
  176. url:'/pages/home/resident'
  177. })
  178. }else if (index == 2) {
  179. if (!this.checkLogin()) {
  180. return
  181. }
  182. uni.navigateTo({
  183. url:'/add/pages/addvacfrom/scan'
  184. })
  185. }else if(index == 3){
  186. this.$refs.logoutPopup.open()
  187. }else{
  188. this.$refs.uToast.show({
  189. title: '该功能暂未开放',
  190. type: 'error'
  191. })
  192. }
  193. }
  194. }
  195. }
  196. </script>
  197. <style scoped lang="scss">
  198. .mine{min-height: 100vh;background: #FFFFFF;}
  199. .header-bg {
  200. position: relative;
  201. .headimg{
  202. width: 100%;
  203. height:386rpx;
  204. }
  205. .headbox{position: absolute;left: 0;top: 0;right: 0;bottom: 0;box-sizing: border-box;padding:70rpx 0 0 52rpx;display: flex;align-items: center;
  206. .headleft{
  207. display: flex;align-items: center;flex: 1;
  208. .headImage {
  209. width: 132rpx;
  210. height: 132rpx;
  211. flex: 0 0 auto;margin-right: 28rpx;
  212. }
  213. .headtxt{
  214. display: flex;
  215. flex-direction: column;
  216. flex: 1;
  217. .txt{
  218. font-size: 34rpx;
  219. font-family: PingFang SC;
  220. font-weight: bold;
  221. color: #FFFFFF;
  222. margin-bottom: 20rpx;
  223. }
  224. .man-bg{
  225. min-width: 200rpx;
  226. height: 44rpx;
  227. background: #688EEC;
  228. border-radius:22rpx;
  229. padding: 6rpx;
  230. box-sizing: border-box;
  231. display: inline-flex;
  232. align-items: center;
  233. font-size: 26rpx;
  234. color: #CBDDFD;
  235. line-height: 18px;
  236. .manimg{width: 32rpx;height:32rpx;margin-right: 8rpx;}
  237. }
  238. }
  239. .headright{flex: 0 0 auto;background: #688EEC;
  240. border-radius: 22rpx 0 0 22rpx;width: 174rpx;height: 44rpx;display: flex;align-items: center;font-size: 26rpx;color: #CBDDFD;
  241. image{width: 34rpx;height: 34rpx;margin-right: 14rpx;}
  242. }
  243. }
  244. }
  245. }
  246. .nmin{
  247. }
  248. .nmbox{height: 138rpx;
  249. background: #ECF1FE;
  250. border-radius:6rpx;width: 684rpx;margin: 0 auto 24rpx;display: flex;align-items: center;padding: 0 32rpx;box-sizing: border-box;}
  251. .card-image{
  252. width:60rpx;
  253. height:60upx;
  254. margin-right: 26rpx;flex: 0 0 auto;
  255. }
  256. .txt2{
  257. font-size: 30rpx;
  258. font-family: PingFang SC;
  259. font-weight: bold;
  260. color: #464E58;
  261. line-height: 18px;
  262. }
  263. .txt3{
  264. margin-top: 15rpx;
  265. font-size: 26rpx;
  266. font-family: PingFang SC;
  267. font-weight: 400;
  268. color: #AAAAAA;
  269. line-height: 18px;
  270. }
  271. </style>