my.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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 @click='todetail' 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. todetail(){
  142. uni.navigateTo({
  143. url:"/pageA/notice/index"
  144. })
  145. },
  146. quitLogin(){
  147. uni.showModal({
  148. title: '提示',
  149. content: '确定退出当前账号?',
  150. success (res) {
  151. if (res.confirm) {
  152. uni.removeStorageSync("userInfo")
  153. that.userInfo = {}
  154. setTimeout(()=>{
  155. that.reload()
  156. },500)
  157. } else if (res.cancel) {
  158. console.log('用户点击取消')
  159. }
  160. }
  161. })
  162. },
  163. reload() {
  164. // 页面重载
  165. const pages = getCurrentPages()
  166. // 声明一个pages使用getCurrentPages方法
  167. const curPage = pages[pages.length - 1]
  168. // 声明一个当前页面
  169. curPage.onLoad(curPage.options) // 传入参数
  170. curPage.onShow()
  171. curPage.onReady()
  172. // 执行刷新
  173. },
  174. editNickName(){
  175. this.$request.baseRequest('admin.unimall.commonUserInfo', 'update', {
  176. commonUserInfo:JSON.stringify(this.userInfo)
  177. }, failres => {
  178. uni.showToast({
  179. icon: "none",
  180. title: failres.errmsg,
  181. duration: 3000
  182. });
  183. }).then(res => {
  184. uni.setStorageSync("userInfo",this.userInfo)
  185. this.edit=false
  186. })
  187. },
  188. login(){
  189. if(!uni.getStorageSync("userInfo").phone){
  190. this.$refs.loginpopup.open()
  191. }else{
  192. }
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang='scss' scoped>
  198. .content {
  199. display: flex;
  200. flex-direction: column;
  201. align-items: center;
  202. justify-content: center;
  203. }
  204. .logo {
  205. height: 200rpx;
  206. width: 200rpx;
  207. margin-top: 200rpx;
  208. margin-left: auto;
  209. margin-right: auto;
  210. margin-bottom: 50rpx;
  211. }
  212. .text-area {
  213. display: flex;
  214. justify-content: center;
  215. }
  216. .title {
  217. font-size: 36rpx;
  218. color: #8f8f94;
  219. }
  220. .wrap{
  221. width:92vw;
  222. padding:0 20rpx;
  223. }
  224. .orderList{
  225. display:flex;
  226. flex-wrap: wrap;
  227. .orderItem{
  228. width:48%;
  229. padding:20rpx;
  230. background:#E5EBFF;
  231. box-sizing:border-box;
  232. margin:5rpx;
  233. border-radius:10rpx;
  234. display:flex;
  235. }
  236. /deep/.u-badge{
  237. z-index:50;
  238. }
  239. .orderName{
  240. margin-left:20rpx;
  241. }
  242. }
  243. .user{
  244. background:#fff;
  245. width:100%;
  246. padding:10rpx 20rpx;
  247. }
  248. .userWrap{
  249. width:92vw;
  250. margin:0 auto;
  251. }
  252. .quit-login{
  253. background:#fff;
  254. width:91%;
  255. padding:10rpx 20rpx;
  256. text-align:center;
  257. margin:10rpx 20rpx;
  258. border-radius:10rpx;
  259. }
  260. </style>