my.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view class="content">
  3. <view class='user'>
  4. <view class='flex userWrap justify-space-between'>
  5. <view class='flex'>
  6. <view style='margin-right:20rpx;'>
  7. <u--image width='60' height='60' :src="userInfo.head" shape="circle"></u--image>
  8. </view>
  9. <view>
  10. <view class='flex'>
  11. <view @click='login' v-if='!edit' style="font-weight: bold;font-size: 32rpx;">{{userInfo.nickname?userInfo.nickname:'请点击登录'}}</view>
  12. <view v-else> <u--input
  13. placeholder="请输入内容"
  14. border="bottom"
  15. v-model='userInfo.nickname'
  16. clearable
  17. ></u--input></view>
  18. <u-icon v-if='!edit&&userInfo.phone' @click='edit = true' name="edit-pen-fill" color="#eaad1a" size="24"></u-icon>
  19. <u-icon v-if='edit&&userInfo.phone' @click='editNickName' name="checkbox-mark" color="#eaad1a" size="24"></u-icon>
  20. </view>
  21. <view>{{userInfo.phone1}}</view>
  22. </view>
  23. </view>
  24. <view>
  25. <u-icon name="bell" color="#eaad1a" size="28"></u-icon>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="wrap">
  30. <!-- <view class='orderList'>
  31. <view class="orderItem align-item-center">
  32. <view style='position:relative;'>
  33. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  34. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  35. </view>
  36. <view class='orderName'>入住订单</view>
  37. </view>
  38. <view class="orderItem align-item-center">
  39. <view style='position:relative;'>
  40. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  41. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  42. </view>
  43. <view class='orderName'>特产订单</view>
  44. </view>
  45. <view class="orderItem align-item-center">
  46. <view style='position:relative;'>
  47. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  48. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  49. </view>
  50. <view class='orderName'>团购订单</view>
  51. </view>
  52. <view class="orderItem align-item-center">
  53. <view style='position:relative;'>
  54. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  55. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  56. </view>
  57. <view class='orderName'>门票订单</view>
  58. </view>
  59. </view> -->
  60. <view style='width:100%;'>
  61. <u-cell-group :border='false'>
  62. <!-- <u-cell
  63. title="收货地址"
  64. isLink
  65. url="/pages/componentsB/tag/tag"
  66. ></u-cell> -->
  67. <u-cell
  68. title="我的发布"
  69. isLink
  70. url="/pageA/my/mypublish"
  71. ></u-cell>
  72. <!-- <u-cell
  73. title="房源发布"
  74. isLink
  75. url="/pages/componentsB/badge/badge"
  76. ></u-cell> -->
  77. <!-- <u-cell
  78. title="商家入驻"
  79. isLink
  80. url="/pages/componentsB/badge/badge"
  81. ></u-cell> -->
  82. <!-- <u-cell
  83. title="业务合作"
  84. isLink
  85. url="/pages/componentsB/badge/badge"
  86. ></u-cell> -->
  87. <!-- <u-cell
  88. title="广告推广"
  89. isLink
  90. url="/pages/componentsB/badge/badge"
  91. ></u-cell> -->
  92. <u-cell
  93. title="联系客服"
  94. isLink
  95. url="/pages/componentsB/badge/badge"
  96. ></u-cell>
  97. <u-cell
  98. :border='false'
  99. title="去商家端"
  100. isLink
  101. url="/pageA/enter/enter"
  102. ></u-cell>
  103. </u-cell-group>
  104. </view>
  105. </view>
  106. <view v-if='userInfo.nickname' class='quit-login' @click='quitLogin'>退出登录</view>
  107. <login-pop-up ref='loginpopup' :content='"手机登录后才能查看我的哦~"'></login-pop-up>
  108. </view>
  109. </template>
  110. <script>
  111. var that
  112. import loginPopUp from "@/components/loginPopUp/index.vue"
  113. export default {
  114. components: {
  115. loginPopUp
  116. },
  117. data() {
  118. return {
  119. edit:false,
  120. offset:['-2','-27%'],
  121. type:"warning",
  122. value:'88',
  123. title: 'Hello',
  124. userInfo:{},
  125. }
  126. },
  127. onLoad() {
  128. that = this
  129. },
  130. onShow(){
  131. if(!uni.getStorageSync("userInfo").phone){
  132. this.$refs.loginpopup.open()
  133. }else{
  134. this.userInfo = uni.getStorageSync("userInfo")
  135. var reg = /1(\d{2})\d{4}(\d{4})/g;
  136. this.userInfo.phone1 = this.userInfo.phone.replace(reg,"1$1****$2");
  137. console.log(this.userInfo)
  138. }
  139. },
  140. methods: {
  141. quitLogin(){
  142. uni.showModal({
  143. title: '提示',
  144. content: '确定退出当前账号?',
  145. success (res) {
  146. if (res.confirm) {
  147. uni.removeStorageSync("userInfo")
  148. that.userInfo = {}
  149. setTimeout(()=>{
  150. that.reload()
  151. },500)
  152. } else if (res.cancel) {
  153. console.log('用户点击取消')
  154. }
  155. }
  156. })
  157. },
  158. reload() {
  159. // 页面重载
  160. const pages = getCurrentPages()
  161. // 声明一个pages使用getCurrentPages方法
  162. const curPage = pages[pages.length - 1]
  163. // 声明一个当前页面
  164. curPage.onLoad(curPage.options) // 传入参数
  165. curPage.onShow()
  166. curPage.onReady()
  167. // 执行刷新
  168. },
  169. editNickName(){
  170. this.$request.baseRequest('admin.unimall.commonUserInfo', 'update', {
  171. commonUserInfo:JSON.stringify(this.userInfo)
  172. }, failres => {
  173. uni.showToast({
  174. icon: "none",
  175. title: failres.errmsg,
  176. duration: 3000
  177. });
  178. }).then(res => {
  179. uni.setStorageSync("userInfo",this.userInfo)
  180. this.edit=false
  181. })
  182. },
  183. login(){
  184. if(!uni.getStorageSync("userInfo").phone){
  185. this.$refs.loginpopup.open()
  186. }else{
  187. }
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang='scss' scoped>
  193. .content {
  194. display: flex;
  195. flex-direction: column;
  196. align-items: center;
  197. justify-content: center;
  198. }
  199. .logo {
  200. height: 200rpx;
  201. width: 200rpx;
  202. margin-top: 200rpx;
  203. margin-left: auto;
  204. margin-right: auto;
  205. margin-bottom: 50rpx;
  206. }
  207. .text-area {
  208. display: flex;
  209. justify-content: center;
  210. }
  211. .title {
  212. font-size: 36rpx;
  213. color: #8f8f94;
  214. }
  215. .wrap{
  216. width:92vw;
  217. padding:0 20rpx;
  218. }
  219. .orderList{
  220. display:flex;
  221. flex-wrap: wrap;
  222. .orderItem{
  223. width:48%;
  224. padding:20rpx;
  225. background:#E5EBFF;
  226. box-sizing:border-box;
  227. margin:5rpx;
  228. border-radius:10rpx;
  229. display:flex;
  230. }
  231. /deep/.u-badge{
  232. z-index:50;
  233. }
  234. .orderName{
  235. margin-left:20rpx;
  236. }
  237. }
  238. .user{
  239. background:#fff;
  240. width:100%;
  241. padding:10rpx 20rpx;
  242. }
  243. .userWrap{
  244. width:92vw;
  245. margin:0 auto;
  246. }
  247. .quit-login{
  248. background:#fff;
  249. width:91%;
  250. padding:10rpx 20rpx;
  251. text-align:center;
  252. margin:10rpx 20rpx;
  253. border-radius:10rpx;
  254. }
  255. </style>