my.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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" @click="editHead"></u--image>
  8. </view>
  9. <view>
  10. <view class='flex'>
  11. <view @click='login' style="font-weight: bold;font-size: 32rpx;">
  12. {{userInfo.nickname?userInfo.nickname:'请点击登录'}}
  13. </view>
  14. <!-- <view v-else>
  15. <u--input placeholder="请输入内容" border="bottom" v-model='userInfo.nickname'
  16. clearable></u--input>
  17. </view> -->
  18. <!-- <u-icon v-if='!edit&&userInfo.phone' @click='edit = true' name="edit-pen-fill"
  19. color="#eaad1a" size="24"></u-icon>
  20. <u-icon v-if='edit&&userInfo.phone' @click='editNickName' name="checkbox-mark"
  21. color="#eaad1a" size="24"></u-icon> -->
  22. </view>
  23. <view>{{userInfo.phone1}}</view>
  24. </view>
  25. </view>
  26. <view>
  27. <u-icon name="bell" color="#eaad1a" size="28"></u-icon>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="wrap">
  32. <!-- <view class='orderList'>
  33. <view class="orderItem align-item-center">
  34. <view style='position:relative;'>
  35. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  36. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  37. </view>
  38. <view class='orderName'>入住订单</view>
  39. </view>
  40. <view class="orderItem align-item-center">
  41. <view style='position:relative;'>
  42. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  43. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  44. </view>
  45. <view class='orderName'>特产订单</view>
  46. </view>
  47. <view class="orderItem align-item-center">
  48. <view style='position:relative;'>
  49. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  50. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  51. </view>
  52. <view class='orderName'>团购订单</view>
  53. </view>
  54. <view class="orderItem align-item-center">
  55. <view style='position:relative;'>
  56. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  57. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  58. </view>
  59. <view class='orderName'>门票订单</view>
  60. </view>
  61. </view> -->
  62. <view style='width:100%;'>
  63. <u-cell-group :border='false'>
  64. <!-- <u-cell
  65. title="收货地址"
  66. isLink
  67. url="/pages/componentsB/tag/tag"
  68. ></u-cell> -->
  69. <u-cell title="我的发布" isLink url="/pageA/my/mypublish"></u-cell>
  70. <!-- <u-cell
  71. title="房源发布"
  72. isLink
  73. url="/pages/componentsB/badge/badge"
  74. ></u-cell> -->
  75. <!-- <u-cell
  76. title="商家入驻"
  77. isLink
  78. url="/pages/componentsB/badge/badge"
  79. ></u-cell> -->
  80. <!-- <u-cell
  81. title="业务合作"
  82. isLink
  83. url="/pages/componentsB/badge/badge"
  84. ></u-cell> -->
  85. <!-- <u-cell
  86. title="广告推广"
  87. isLink
  88. url="/pages/componentsB/badge/badge"
  89. ></u-cell> -->
  90. <view class="kf">
  91. <button class="left-btn" open-type='contact'>联系客服</button>
  92. </view>
  93. <u-cell :border='false' title="去商家端" isLink url="/pageA/enter/enter"></u-cell>
  94. </u-cell-group>
  95. </view>
  96. </view>
  97. <login-pop-up ref='loginpopup' :content='"手机登录后才能查看我的哦~"'></login-pop-up>
  98. </view>
  99. </template>
  100. <script>
  101. var that;
  102. import uploadImage from '@/components/ossutil/uploadFile.js';
  103. import loginPopUp from "@/components/loginPopUp/index.vue"
  104. export default {
  105. components: {
  106. loginPopUp
  107. },
  108. data() {
  109. return {
  110. edit: false,
  111. offset: ['-2', '-27%'],
  112. type: "warning",
  113. value: '88',
  114. title: 'Hello',
  115. userInfo: {},
  116. }
  117. },
  118. onLoad() {
  119. that = this
  120. },
  121. onShow() {
  122. if (!uni.getStorageSync("userInfo").phone) {
  123. this.$refs.loginpopup.open()
  124. } else {
  125. this.userInfo = uni.getStorageSync("userInfo")
  126. var reg = /1(\d{2})\d{4}(\d{4})/g;
  127. this.userInfo.phone1 = this.userInfo.phone.replace(reg, "1$1****$2");
  128. console.log(this.userInfo)
  129. }
  130. },
  131. methods: {
  132. editNickName() {
  133. this.$request.baseRequest('admin.unimall.commonUserInfo', 'update', {
  134. commonUserInfo: JSON.stringify(this.userInfo)
  135. }, failres => {
  136. uni.showToast({
  137. icon: "none",
  138. title: failres.errmsg,
  139. duration: 3000
  140. });
  141. }).then(res => {
  142. uni.setStorageSync("userInfo", this.userInfo)
  143. this.edit = false
  144. })
  145. },
  146. login() {
  147. if (!uni.getStorageSync("userInfo").phone) {
  148. this.$refs.loginpopup.open()
  149. } else {
  150. uni.navigateTo({
  151. url: '/pages/my/editNickName'
  152. })
  153. }
  154. },
  155. editHead() {
  156. if (this.userInfo.phone) {
  157. uni.chooseImage({
  158. count: 1,
  159. sizeType: ['original', 'compressed'],
  160. success: function(res) {
  161. uploadImage(res.tempFilePaths[0], 'cardImages/',
  162. result => {
  163. that.userInfo.head = result
  164. that.$request.baseRequest('admin.unimall.commonUserInfo', 'update', {
  165. commonUserInfo: JSON.stringify(that.userInfo)
  166. }, failres => {
  167. uni.hideLoading()
  168. uni.showToast({
  169. icon: "none",
  170. title: failres.errmsg,
  171. duration: 3000
  172. });
  173. }).then(res => {
  174. uni.setStorageSync("userInfo", that.userInfo)
  175. uni.showToast({
  176. icon: "success",
  177. title: '修改成功!',
  178. duration: 2000,
  179. complete: function() {
  180. uni.switchTab({
  181. url: "/pages/my/my"
  182. })
  183. }
  184. })
  185. })
  186. }
  187. )
  188. }
  189. });
  190. } else {
  191. this.showAuthorizePhone = true
  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. }
  223. .orderList {
  224. display: flex;
  225. flex-wrap: wrap;
  226. .orderItem {
  227. width: 48%;
  228. padding: 20rpx;
  229. background: #E5EBFF;
  230. box-sizing: border-box;
  231. margin: 5rpx;
  232. border-radius: 10rpx;
  233. display: flex;
  234. }
  235. /deep/.u-badge {
  236. z-index: 50;
  237. }
  238. .orderName {
  239. margin-left: 20rpx;
  240. }
  241. }
  242. .user {
  243. background: #fff;
  244. width: 100%;
  245. padding: 10rpx 20rpx;
  246. }
  247. .userWrap {
  248. width: 92vw;
  249. margin: 0 auto;
  250. }
  251. .kf {
  252. border-bottom-width: 1px;
  253. border-bottom-style: solid;
  254. width: 100%;
  255. border-color: #d6d7d9;
  256. padding: 20rpx;
  257. box-sizing: border-box;
  258. }
  259. .left-btn {
  260. padding: 0;
  261. margin: 0;
  262. font-size: 30rpx;
  263. height: 42rpx;
  264. display: flex;
  265. align-items: center;
  266. background-color: #fff;
  267. margin-left: 10rpx;
  268. }
  269. .left-btn:after {
  270. border: none !important;
  271. }
  272. </style>