mine.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <view>
  3. <!-- 个人信息 -->
  4. <view class="person-infos">
  5. <view class="main">
  6. <view class="photo">
  7. <img v-if="userInfo.headImg" :src="userInfo.headImg" alt="">
  8. <u-avatar v-else size="120" ></u-avatar>
  9. </view>
  10. <view class="infos">
  11. <view class="name">
  12. {{userInfo.name}}
  13. </view>
  14. <view class="department-position">
  15. <view class="department" v-if="userInfo.orgName">
  16. <view class="icon">
  17. <img src="../../assets/img/department.png" alt="">
  18. </view>
  19. <view class="text">
  20. {{userInfo.orgName}}
  21. </view>
  22. </view>
  23. <view class="position">
  24. <text class="icon">
  25. <img src="../../assets/img/position.png" alt="">
  26. </text>
  27. <text class="text">
  28. 员工
  29. </text>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="to-homepage" v-if="false" >
  34. <text class="text">个人主页</text><text>
  35. <u-icon size="32" name="arrow-right" color="#80FFFFFF"></u-icon>
  36. </text>
  37. </view>
  38. </view>
  39. <view class="grid">
  40. <view class="item">
  41. <view class="amout">
  42. 0
  43. </view>
  44. <view class="text">
  45. 发布
  46. </view>
  47. </view>
  48. <view class="item" @click="gotoUrl('pages/mine/myLike')" >
  49. <view class="amout">
  50. 0
  51. </view>
  52. <view class="text">
  53. 点赞
  54. </view>
  55. </view>
  56. <view class="item" @click="gotoUrl('pages/mine/myComment')" >
  57. <view class="amout">
  58. 0
  59. </view>
  60. <view class="text">
  61. 评论
  62. </view>
  63. </view>
  64. <view class="item">
  65. <view class="amout">
  66. {{plusInfo.userPoints}}
  67. </view>
  68. <view class="text">
  69. 积分
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <!-- 功能 -->
  75. <view class="function-group group1" v-if="false">
  76. <view class="item">
  77. <view class="title">
  78. <view class="icon">
  79. <img src="../../assets/img/riLine-gift-2-line@2x.png" alt="">
  80. </view>
  81. <view class="text">
  82. 我的获奖记录
  83. </view>
  84. </view>
  85. <view class="right">
  86. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  87. </view>
  88. </view>
  89. <view class="item">
  90. <view class="title">
  91. <view class="icon">
  92. <img src="../../assets/img/riLine-coin-line@2x.png" alt="">
  93. </view>
  94. <view class="text">
  95. 积分兑换
  96. </view>
  97. </view>
  98. <view class="right">
  99. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="function-group ">
  104. <view class="item" @click="gotoUrl('pages/mine/data')">
  105. <view class="title">
  106. <view class="icon">
  107. <img src="../../assets/img/riLine-account-box-line@2x.png" alt="">
  108. </view>
  109. <view class="text">
  110. 个人资料
  111. </view>
  112. </view>
  113. <view class="right">
  114. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  115. </view>
  116. </view>
  117. <view class="item" @click="gotoUrl('pages/mine/phone')" >
  118. <view class="title">
  119. <view class="icon">
  120. <img src="../../assets/img/riLine-smartphone-line@2x.png" alt="">
  121. </view>
  122. <view class="text">
  123. 绑定手机
  124. </view>
  125. </view>
  126. <view class="right">
  127. <text class="value">{{userPhone}}</text>
  128. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  129. </view>
  130. </view>
  131. <view class="item" @click="gotoUrl('pages/mine/feedback')" >
  132. <view class="title">
  133. <view class="icon">
  134. <img src="../../assets/img/riLine-file-edit-line@2x.png" alt="">
  135. </view>
  136. <view class="text">
  137. 意见反馈
  138. </view>
  139. </view>
  140. <view class="right">
  141. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  142. </view>
  143. </view>
  144. <view class="item" v-if="false">
  145. <view class="title">
  146. <view class="icon">
  147. <img src="../../assets/img/riLine-customer-service-2-line@2x.png" alt="">
  148. </view>
  149. <view class="text">
  150. 联系我们
  151. </view>
  152. </view>
  153. <view class="right">
  154. <text class="value">0716-8888888</text>
  155. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  156. </view>
  157. </view>
  158. <view class="item" @click="logout" >
  159. <view class="title">
  160. <view class="icon">
  161. <img src="../../assets/img/riLine-logout-box-r-line@2x.png" alt="">
  162. </view>
  163. <view class="text">
  164. 退出账号
  165. </view>
  166. </view>
  167. <view class="right">
  168. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  169. </view>
  170. </view>
  171. </view>
  172. <tabbar current="2"></tabbar>
  173. </view>
  174. </template>
  175. <script>
  176. import * as API from '@/apis/pagejs/user.js'
  177. import tabbar from "../../components/Tabbar.vue"
  178. export default {
  179. components: {
  180. tabbar
  181. },
  182. data() {
  183. return {
  184. plusInfo:{},
  185. userInfo:{},
  186. userPhone:"",
  187. }
  188. },
  189. onLoad() {
  190. this.init()
  191. },
  192. onShow(){
  193. this.findByOpenId()
  194. },
  195. methods: {
  196. init(){
  197. this.plusInfo=this.carhelp.getPersonInfoPlus();
  198. this.userInfo=this.carhelp.getPersonInfo();
  199. if(this.userInfo&&this.userInfo.phone){
  200. var phone = this.userInfo.phone;
  201. var phone1 = phone.slice(0,3);
  202. var phone2 = phone.slice(-4);
  203. this.userPhone = phone1 + '****' + phone2;
  204. }
  205. },
  206. findByOpenId(){
  207. API.findByOpenId({
  208. noerror:true,
  209. openId: this.carhelp.getOpenId(),
  210. }).then((response) => {
  211. this.carhelp.setPersonInfo(response.data.regUser);
  212. this.carhelp.setPersonInfoPlus(response.data)
  213. this.init();
  214. }).catch(error => {
  215. uni.hideLoading();
  216. })
  217. },
  218. logoutApi(){
  219. uni.showLoading({
  220. title: "加载中",
  221. mask: true,
  222. })
  223. var data = {
  224. };
  225. API.logout(data).then((res) => {
  226. this.carhelp.logoff();
  227. uni.reLaunch({
  228. url:"/"
  229. })
  230. }).catch(error => {
  231. uni.showToast({
  232. title: error
  233. })
  234. })
  235. },
  236. phone(){
  237. uni.makePhoneCall({
  238. phoneNumber:this.tel //仅为示例
  239. });
  240. },
  241. logout(){
  242. uni.showModal({
  243. title: '提示',
  244. content: '确认是否退出?',
  245. success: res=> {
  246. if (res.confirm) {
  247. //付钱 改为组件
  248. this.logoutApi();
  249. } else if (res.cancel) {
  250. console.log('用户点击取消');
  251. }
  252. }
  253. });
  254. },
  255. }
  256. }
  257. </script>
  258. <style lang="scss" scoped>
  259. // 个人信息
  260. .person-infos {
  261. background: linear-gradient(45.45deg, rgba(6, 50, 130, 1) -0.45%, rgba(0, 88, 209, 1) 23.41%, rgba(0, 53, 153, 1) 52.12%, rgba(0, 66, 178, 1) 77.4%, rgba(0, 20, 130, 1) 100.65%);
  262. color: rgba(255, 255, 255, 1);
  263. padding: 40rpx 32rpx 116rpx 32rpx;
  264. .main {
  265. display: flex;
  266. align-items: center;
  267. .photo {
  268. img {
  269. width: 120rpx;
  270. height: 120rpx;
  271. border-radius: 50px;
  272. }
  273. }
  274. .infos {
  275. margin-left: 24rpx;
  276. .name {
  277. line-height: 28px;
  278. font-size: 20px;
  279. }
  280. .department-position {
  281. display: flex;
  282. align-items: center;
  283. margin-top: 16rpx;
  284. .icon {
  285. margin-right: 8rpx;
  286. img {
  287. width: 28rpx;
  288. height: 28rpx;
  289. }
  290. }
  291. .department {
  292. display: flex;
  293. .text{
  294. line-height: 16px;
  295. }
  296. }
  297. .position {
  298. display: flex;
  299. margin-left: 24rpx;
  300. .text{
  301. line-height: 16px;
  302. }
  303. }
  304. }
  305. }
  306. .to-homepage {
  307. margin-left: auto;
  308. .text {
  309. font-size: 16px;
  310. margin-right: 8rpx;
  311. }
  312. }
  313. }
  314. .grid {
  315. width: 100%;
  316. display: flex;
  317. flex-direction: row;
  318. flex-wrap: wrap;
  319. align-items: center;
  320. margin-top: 24rpx;
  321. .item {
  322. width: 25%;
  323. text-align: center;
  324. .amout {
  325. font-size: 48rpx;
  326. line-height: 64rpx;
  327. }
  328. .text {
  329. font-size: 32rpx;
  330. line-height: 44rpx;
  331. }
  332. }
  333. }
  334. }
  335. // 功能
  336. .group1 {
  337. margin-top: -72rpx !important;
  338. }
  339. .function-group {
  340. border-radius: 8px 8px 0px 0px;
  341. background-color: rgba(255, 255, 255, 1);
  342. padding: 0 0 0 24rpx;
  343. margin: 0 32rpx;
  344. margin-top: 24rpx;
  345. .item {
  346. display: flex;
  347. justify-content: space-between;
  348. align-items: center;
  349. height: 96rpx;
  350. border-bottom: 1px solid #E6E6E6;
  351. .title {
  352. display: flex;
  353. align-items: center;
  354. .icon {
  355. margin-right: 24rpx;
  356. img {
  357. width: 40rpx;
  358. height: 40rpx;
  359. vertical-align: middle;
  360. }
  361. }
  362. .text {
  363. color: rgba(51, 51, 51, 1);
  364. font-weight: bold;
  365. }
  366. }
  367. .right {
  368. margin-right: 16rpx;
  369. margin-left: 8rpx;
  370. display: flex;
  371. }
  372. }
  373. }
  374. </style>