mine.vue 8.7 KB

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