my.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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"
  8. @click="editHead"></u--image>
  9. </view>
  10. <view>
  11. <view class='flex'>
  12. <view @click='login' style="font-weight: bold;font-size: 32rpx;">
  13. {{userInfo.nickname?userInfo.nickname:'请点击登录'}}
  14. </view>
  15. <!-- <view v-else>
  16. <u--input placeholder="请输入内容" border="bottom" v-model='userInfo.nickname'
  17. clearable></u--input>
  18. </view> -->
  19. <!-- <u-icon v-if='!edit&&userInfo.phone' @click='edit = true' name="edit-pen-fill"
  20. color="#eaad1a" size="24"></u-icon>
  21. <u-icon v-if='edit&&userInfo.phone' @click='editNickName' name="checkbox-mark"
  22. color="#eaad1a" size="24"></u-icon> -->
  23. </view>
  24. <view>{{userInfo.phone1}}</view>
  25. </view>
  26. </view>
  27. <view>
  28. <u-icon @click='todetail' name="bell" color="#eaad1a" size="28"></u-icon>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="wrap">
  33. <!-- <view class='orderList'>
  34. <view class="orderItem align-item-center">
  35. <view style='position:relative;'>
  36. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  37. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  38. </view>
  39. <view class='orderName'>入住订单</view>
  40. </view>
  41. <view class="orderItem align-item-center">
  42. <view style='position:relative;'>
  43. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  44. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  45. </view>
  46. <view class='orderName'>特产订单</view>
  47. </view>
  48. <view class="orderItem align-item-center">
  49. <view style='position:relative;'>
  50. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  51. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  52. </view>
  53. <view class='orderName'>团购订单</view>
  54. </view>
  55. <view class="orderItem align-item-center">
  56. <view style='position:relative;'>
  57. <u-icon name="home-fill" color="#2979ff" size="28"></u-icon>
  58. <u-badge :offset='offset' absolute='true' bgColor='red' max="99" :value="value"></u-badge>
  59. </view>
  60. <view class='orderName'>门票订单</view>
  61. </view>
  62. </view> -->
  63. <view style='width:100%;'>
  64. <u-cell-group :border='false'>
  65. <!-- <u-cell
  66. title="收货地址"
  67. isLink
  68. url="/pages/componentsB/tag/tag"
  69. ></u-cell> -->
  70. <u-cell title="我的发布" isLink url="/pageA/my/mypublish"></u-cell>
  71. <!-- <u-cell
  72. title="房源发布"
  73. isLink
  74. url="/pages/componentsB/badge/badge"
  75. ></u-cell> -->
  76. <!-- <u-cell
  77. title="商家入驻"
  78. isLink
  79. url="/pages/componentsB/badge/badge"
  80. ></u-cell> -->
  81. <!-- <u-cell
  82. title="业务合作"
  83. isLink
  84. url="/pages/componentsB/badge/badge"
  85. ></u-cell> -->
  86. <!-- <u-cell
  87. title="广告推广"
  88. isLink
  89. url="/pages/componentsB/badge/badge"
  90. ></u-cell> -->
  91. <view class="flex justify-space-between kf">
  92. <button class="left-btn" open-type='contact'>联系客服</button>
  93. <image style='width:22px;height:22px;' src="../../static/image/yjt.png" mode=""></image>
  94. </view>
  95. <u-cell :border='false' title="去商家端" isLink url="/pageA/enter/enter"></u-cell>
  96. </u-cell-group>
  97. </view>
  98. </view>
  99. <view v-if='userInfo.nickname' class='quit-login' @click='quitLogin'>退出账号</view>
  100. <!-- <view class="exit" @click="exit" v-if="userInfo.phone">
  101. 退出账号
  102. </view> -->
  103. <u-tabbar
  104. :value="tabbarCheck"
  105. @change="tabbarChange"
  106. activeColor="#5F7DE9"
  107. >
  108. <u-tabbar-item name="team" text="加入">
  109. <image
  110. class="u-page__item__slot-icon"
  111. slot="active-icon"
  112. src="@/static/image/nav-icon/antOutline-team Copy.png"
  113. ></image>
  114. <image
  115. class="u-page__item__slot-icon"
  116. slot="inactive-icon"
  117. src="@/static/image/nav-icon/antOutline-team.png"
  118. ></image>
  119. </u-tabbar-item>
  120. <u-tabbar-item name="notification" text="通知">
  121. <image
  122. class="u-page__item__slot-icon"
  123. slot="active-icon"
  124. src="@/static/image/nav-icon/md-notifications_none Copy.png"
  125. ></image>
  126. <image
  127. class="u-page__item__slot-icon"
  128. slot="inactive-icon"
  129. src="@/static/image/nav-icon/md-notifications_none.png"
  130. ></image>
  131. </u-tabbar-item>
  132. <u-tabbar-item name="user" text="我的">
  133. <image
  134. class="u-page__item__slot-icon"
  135. slot="active-icon"
  136. src="@/static/image/nav-icon/antOutline-user1 Copy.png"
  137. ></image>
  138. <image
  139. class="u-page__item__slot-icon"
  140. slot="inactive-icon"
  141. src="@/static/image/nav-icon/antOutline-user1.png"
  142. ></image>
  143. </u-tabbar-item>
  144. </u-tabbar>
  145. <login-pop-up ref='loginpopup' :content='"手机登录后才能查看我的哦~"'></login-pop-up>
  146. </view>
  147. </template>
  148. <script>
  149. var that;
  150. import uploadImage from '@/components/ossutil/uploadFile.js';
  151. import loginPopUp from "@/components/loginPopUp/index.vue"
  152. export default {
  153. components: {
  154. loginPopUp
  155. },
  156. data() {
  157. return {
  158. edit: false,
  159. offset: ['-2', '-27%'],
  160. type: "warning",
  161. value: '88',
  162. title: 'Hello',
  163. userInfo: {},
  164. }
  165. },
  166. onLoad() {
  167. that = this
  168. },
  169. onShow() {
  170. this.userInfo = uni.getStorageSync("userInfo")
  171. if (!this.userInfo.phone) {
  172. this.$refs.loginpopup.open()
  173. } else {
  174. var reg = /1(\d{2})\d{4}(\d{4})/g;
  175. this.userInfo.phone1 = this.userInfo.phone.replace(reg, "1$1****$2");
  176. console.log(this.userInfo)
  177. }
  178. },
  179. methods: {
  180. tabbarChange(e){
  181. console.log(e)
  182. if(e=='team'){
  183. uni.navigateTo({
  184. url:'/pageA/notice/index'
  185. })
  186. }else if(e=='user'){
  187. uni.navigateTo({
  188. url:'/pageA/my/my'
  189. })
  190. }
  191. // name => tabbarCheck = name
  192. },
  193. todetail(){
  194. uni.navigateTo({
  195. url:"/pageA/notice/index"
  196. })
  197. },
  198. quitLogin(){
  199. uni.showModal({
  200. title: '提示',
  201. content: '确定退出当前账号?',
  202. success (res) {
  203. if (res.confirm) {
  204. uni.removeStorageSync("userInfo")
  205. that.userInfo = {}
  206. setTimeout(()=>{
  207. that.reload()
  208. },500)
  209. } else if (res.cancel) {
  210. console.log('用户点击取消')
  211. }
  212. }
  213. })
  214. },
  215. reload() {
  216. // 页面重载
  217. const pages = getCurrentPages()
  218. // 声明一个pages使用getCurrentPages方法
  219. const curPage = pages[pages.length - 1]
  220. // 声明一个当前页面
  221. curPage.onLoad(curPage.options) // 传入参数
  222. curPage.onShow()
  223. curPage.onReady()
  224. // 执行刷新
  225. },
  226. editNickName() {
  227. this.$request.baseRequest('admin.unimall.commonUserInfo', 'update', {
  228. commonUserInfo: JSON.stringify(this.userInfo)
  229. }, failres => {
  230. uni.showToast({
  231. icon: "none",
  232. title: failres.errmsg,
  233. duration: 3000
  234. });
  235. }).then(res => {
  236. uni.setStorageSync("userInfo", this.userInfo)
  237. this.edit = false
  238. })
  239. },
  240. login() {
  241. if (!uni.getStorageSync("userInfo").phone) {
  242. this.$refs.loginpopup.open()
  243. } else {
  244. uni.navigateTo({
  245. url: '/pages/my/editNickName'
  246. })
  247. }
  248. },
  249. exit() {
  250. uni.setStorageSync("userInfo", {})
  251. this.userInfo = {}
  252. this.$forceUpdate()
  253. },
  254. editHead() {
  255. if (this.userInfo.phone) {
  256. uni.chooseImage({
  257. count: 1,
  258. sizeType: ['original', 'compressed'],
  259. success: function(res) {
  260. uploadImage(res.tempFilePaths[0], 'cardImages/',
  261. result => {
  262. that.userInfo.head = result
  263. that.$request.baseRequest('admin.unimall.commonUserInfo', 'update', {
  264. commonUserInfo: JSON.stringify(that.userInfo)
  265. }, failres => {
  266. uni.hideLoading()
  267. uni.showToast({
  268. icon: "none",
  269. title: failres.errmsg,
  270. duration: 3000
  271. });
  272. }).then(res => {
  273. uni.setStorageSync("userInfo", that.userInfo)
  274. uni.showToast({
  275. icon: "success",
  276. title: '修改成功!',
  277. duration: 2000,
  278. complete: function() {
  279. uni.switchTab({
  280. url: "/pages/my/my"
  281. })
  282. }
  283. })
  284. })
  285. }
  286. )
  287. }
  288. });
  289. } else {
  290. this.showAuthorizePhone = true
  291. }
  292. },
  293. }
  294. }
  295. </script>
  296. <style lang='scss' scoped>
  297. .content {
  298. display: flex;
  299. flex-direction: column;
  300. align-items: center;
  301. justify-content: center;
  302. }
  303. .logo {
  304. height: 200rpx;
  305. width: 200rpx;
  306. margin-top: 200rpx;
  307. margin-left: auto;
  308. margin-right: auto;
  309. margin-bottom: 50rpx;
  310. }
  311. .text-area {
  312. display: flex;
  313. justify-content: center;
  314. }
  315. .title {
  316. font-size: 36rpx;
  317. color: #8f8f94;
  318. }
  319. .wrap{
  320. width:92vw;
  321. padding:0 20rpx;
  322. }
  323. .orderList {
  324. display: flex;
  325. flex-wrap: wrap;
  326. .orderItem {
  327. width: 48%;
  328. padding: 20rpx;
  329. background: #E5EBFF;
  330. box-sizing: border-box;
  331. margin: 5rpx;
  332. border-radius: 10rpx;
  333. display: flex;
  334. }
  335. /deep/.u-badge {
  336. z-index: 50;
  337. }
  338. .orderName {
  339. margin-left: 20rpx;
  340. }
  341. }
  342. .user {
  343. background: #fff;
  344. width: 100%;
  345. padding: 10rpx 20rpx;
  346. }
  347. .userWrap {
  348. width: 92vw;
  349. margin: 0 auto;
  350. }
  351. .kf {
  352. border-bottom-width: 1px;
  353. border-bottom-style: solid;
  354. width: 100%;
  355. border-color: #d6d7d9;
  356. padding: 20rpx;
  357. box-sizing: border-box;
  358. }
  359. .left-btn {
  360. padding: 0;
  361. margin: 0;
  362. font-size: 30rpx;
  363. height: 42rpx;
  364. display: flex;
  365. align-items: center;
  366. background-color: #fff;
  367. margin-left: 10rpx;
  368. }
  369. .left-btn:after {
  370. border: none !important;
  371. }
  372. .exit {
  373. width: 100vw;
  374. background-color: #fff;
  375. font-size: 30rpx;
  376. margin-top: 20rpx;
  377. text-align: center;
  378. padding: 20rpx;
  379. }
  380. .quit-login{
  381. background:#fff;
  382. width:91%;
  383. padding:10rpx 20rpx;
  384. text-align:center;
  385. margin:10rpx 20rpx;
  386. border-radius:10rpx;
  387. }
  388. </style>