newuser.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="column">
  3. <view class="top-content ">
  4. <view class="status_bar" :style="{height: statusBarHeight+'px'}"></view>
  5. <view class="top-title">我的</view>
  6. </view>
  7. <view class="user-cont" :style="{marginTop: `calc(${statusBarHeight}px + 88rpx)`}">
  8. <view class="user-box" v-if="user!=null">
  9. <view class="left">
  10. <u-avatar :src="user.avatar" size="50"></u-avatar>
  11. <view class="user" >
  12. <view v-if="!usertoken" class="fs40 bold" @click="loginto" >
  13. 立即登录
  14. </view>
  15. <view class="username">{{user}}</view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="company" v-if="user!=null">
  20. <image :src="imgPath+'/app/images/icon_comp.png'"></image>
  21. <view class="name">{{'暂无数据'}}</view>
  22. </view>
  23. </view>
  24. <view class="p20">
  25. <view class="menu-box" style="margin-top: -40rpx;">
  26. <view class="title-box">
  27. <image class="icon" :src="imgPath+'/app/manergevip/chang.png'"></image>
  28. <view class="title">常用功能</view>
  29. </view>
  30. <view class="line"></view>
  31. <view class="menus">
  32. <view class="menu-item" @click="navTo()">
  33. <image :src="imgPath+'/app/images/menu_info.png'"></image>
  34. <view class="m-name">销售管理</view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="p20">
  40. <view class="btn-box" v-if="usertoken">
  41. <view class="sub-btn" @click="this.show=!this.show">退出登录</view>
  42. </view>
  43. </view>
  44. <u-modal :show="show" @confirm="showLogout" :title="title" :content='content' :showCancelButton="true"
  45. @cancel='this.show=!this.show'></u-modal>
  46. </view>
  47. </template>
  48. <script>
  49. import { getwxuser } from '@/api/user.js'
  50. export default {
  51. data() {
  52. return {
  53. statusBarHeight: uni.getSystemInfoSync().statusBarHeight,
  54. user:[],
  55. show:false,
  56. title:'提示',
  57. content:'确认退出吗?',
  58. usertoken:''
  59. }
  60. },
  61. mounted() {
  62. this.usertoken=uni.getStorageSync('AppToken_MYfby')
  63. this.user=uni.getStorageSync('phoneNumber')
  64. },
  65. computed: {
  66. imgPath() {
  67. return this.$store.state.imgpath
  68. }
  69. },
  70. methods: {
  71. loginto(){
  72. uni.navigateTo({
  73. url:'/pages/auth/wxlogin'
  74. })
  75. },
  76. showLogout(){
  77. uni.removeStorageSync('AppToken_MYfby')
  78. // uni.removeStorageSync('AppToken_MYfby')
  79. uni.navigateTo({
  80. url:'/pages/auth/wxlogin'
  81. })
  82. },
  83. navTo(url){
  84. if(uni.getStorageSync('AppToken')){
  85. uni.switchTab({
  86. url:'/pages/index/index'
  87. })
  88. }else{
  89. uni.navigateTo({
  90. url:'/pages/auth/login'
  91. })
  92. }
  93. },
  94. }
  95. }
  96. </script>
  97. <style scoped lang="scss">
  98. .top-content {
  99. width: 100%;
  100. z-index: 10;
  101. position: fixed;
  102. top: 0;
  103. left: 0;
  104. background-color: #FFFFFF;
  105. .top-title {
  106. height: 88rpx;
  107. line-height: 88rpx;
  108. font-size: 42rpx;
  109. font-family: Source Han Sans CN;
  110. font-weight: bold;
  111. color: #222222;
  112. padding-left: 41rpx;
  113. background-color: #FFFFFF;
  114. }
  115. }
  116. .menu-box{
  117. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  118. width: 100%;
  119. margin-top: 30rpx;
  120. padding: 30rpx;
  121. background-color: #fff;
  122. border-radius: 15rpx;
  123. .title-box{
  124. display: flex;
  125. align-items: center;
  126. justify-content: flex-start;
  127. .icon{
  128. width: 40rpx;
  129. height:40rpx;
  130. }
  131. .title{
  132. margin-left: 10rpx;
  133. font-size: 28rpx;
  134. font-family: PingFang SC;
  135. color: #111;
  136. }
  137. }
  138. .line{
  139. margin-top: 15rpx;
  140. height: 0.5rpx;
  141. width: 100%;
  142. background-color: #efefef;
  143. }
  144. .menus{
  145. margin-top: 30rpx;
  146. display: flex;
  147. align-items: center;
  148. justify-content: flex-start;
  149. flex-wrap: wrap;
  150. }
  151. .menu-item{
  152. display: flex;
  153. flex-direction: column;
  154. align-items: center;
  155. justify-content: center;
  156. width: 25%;
  157. margin-bottom: 20rpx;
  158. image{
  159. width:60rpx;
  160. height:60rpx;
  161. }
  162. .m-name{
  163. margin-top: 10rpx;
  164. font-size: 24rpx;
  165. font-family: PingFang SC;
  166. color: #111;
  167. }
  168. }
  169. }
  170. .user-cont{
  171. background: linear-gradient(to bottom, #dae9ff, #e1e1fd);
  172. border-radius: 0px 0px 30px 30px;
  173. padding: 30rpx;
  174. border-radius: 15rpx;
  175. .user-box{
  176. width: 100%;
  177. display: flex;
  178. align-items: center;
  179. justify-content: flex-start;
  180. .left{
  181. flex:1;
  182. display: flex;
  183. align-items: center;
  184. justify-content: flex-start;
  185. image{
  186. border-radius: 50%;
  187. width:120rpx;
  188. height:120rpx;
  189. }
  190. .user{
  191. margin-left: 20rpx;
  192. width: calc(100% - 140rpx);
  193. display: flex;
  194. flex-direction: column;
  195. align-items: flex-start;
  196. justify-content: flex-start;
  197. .username{
  198. font-size: 38rpx;
  199. font-family: PingFang SC;
  200. color: #111;
  201. font-weight: bold;
  202. }
  203. .account{
  204. padding: 5rpx 0rpx;
  205. border-radius: 30rpx;
  206. margin-top: 20rpx;
  207. font-size: 24rpx;
  208. font-family: PingFang SC;
  209. color: #515151;
  210. }
  211. }
  212. }
  213. }
  214. .company{
  215. margin-top: 30rpx;
  216. display: flex;
  217. align-items: center;
  218. justify-content: flex-start;
  219. image{
  220. width:40rpx;
  221. height:40rpx;
  222. }
  223. .name{
  224. margin-left: 15rpx;
  225. font-size: 28rpx;
  226. color: #111;
  227. }
  228. }
  229. }
  230. .btn-box{
  231. margin: 30rpx 0rpx 30rpx;
  232. display: flex;
  233. align-items: center;
  234. justify-content: center;
  235. .sub-btn{
  236. box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
  237. border: 1rpx solid #f8f8f8;
  238. background: #FFFFFF;
  239. width: 100%;
  240. border-radius: 10rpx;
  241. height: 88upx;
  242. line-height: 88upx;
  243. text-align: center;
  244. font-size: 30upx;
  245. font-family: PingFang SC;
  246. color: #2979ff;
  247. }
  248. }
  249. </style>