mine.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view class="">
  3. <view class="bg">
  4. </view>
  5. <view class="mine position">
  6. <view class="top">
  7. <view class="img">
  8. <image :src="vuex_user.headimg?vuex_user.headimg:default_img" mode=""></image>
  9. <!-- <open-data type="userAvatarUrl"></open-data> -->
  10. </view>
  11. <view class="info">
  12. <view class="name">
  13. {{vuex_user.name?vuex_user.name:'--'}}
  14. <image src="../../static/images/edit.png" mode="" @click="to_info()"></image>
  15. </view>
  16. <view class="grade">
  17. {{vuex_user.class ?vuex_user.class : '--'}}
  18. <!-- 2017级 硕士 现就职河南第一附属医院检验科 -->
  19. </view>
  20. <view class="local">
  21. <image src="../../static/images/local.png" mode=""></image>
  22. <text>{{vuex_user.work_address?vuex_user.work_address:'--'}}</text>
  23. </view>
  24. <view class="edit" @click="changePwd">
  25. 修改密码>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="center">
  30. <!-- <view class="item" @click="to_active">
  31. <view class="left">
  32. <view class="img">
  33. <image src="../../static/images/my_active.png" mode=""></image>
  34. </view>
  35. <text>我的活动</text>
  36. </view>
  37. <view class="right">
  38. <image src="../../static/images/angle-right.png" mode=""></image>
  39. </view>
  40. </view> -->
  41. <!-- <view class="item" @click="to_info">
  42. <view class="left">
  43. <view class="img">
  44. <image src="../../static/images/my_info.png" mode=""></image>
  45. </view>
  46. <text>个人信息</text>
  47. </view>
  48. <view class="right">
  49. <image src="../../static/images/angle-right.png" mode=""></image>
  50. </view>
  51. </view> -->
  52. <view class="item" @click="to_creat_news">
  53. <view class="left">
  54. <view class="img">
  55. <image src="../../static/images/my_account.png" mode=""></image>
  56. </view>
  57. <text>新闻发布</text>
  58. </view>
  59. <view class="right">
  60. <image src="../../static/images/angle-right.png" mode=""></image>
  61. </view>
  62. </view>
  63. <view class="item" @click="to_search">
  64. <view class="left">
  65. <view class="img">
  66. <image src="../../static/images/my_info.png" mode=""></image>
  67. </view>
  68. <text>查找校友</text>
  69. </view>
  70. <view class="right">
  71. <image src="../../static/images/angle-right.png" mode=""></image>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="bottom" @click="logout" v-if="vuex_token">
  76. <!-- <view class="left">
  77. <view class="img">
  78. <image src="../../static/images/my_account.png" mode=""></image>
  79. </view>
  80. <text>账号设置</text>
  81. </view>
  82. <view class="right">
  83. <image src="../../static/images/angle-right.png" mode=""></image>
  84. </view> -->
  85. 退出登录
  86. </view>
  87. <view class="bottom" v-else @click="to_login">
  88. 去登陆
  89. </view>
  90. <view class="banben">
  91. v1.0.3
  92. </view>
  93. </view>
  94. <view class="tel" @click="contact">
  95. 联系我们
  96. </view>
  97. </view>
  98. </template>
  99. <script>
  100. export default {
  101. data() {
  102. return {
  103. default_img: '../../static/images/default.jpg',
  104. phone: ''
  105. }
  106. },
  107. onShow() {
  108. // if (this.vuex_token == '') {
  109. // console.log(11111111111)
  110. // uni.reLaunch({
  111. // url: '../login/index'
  112. // })
  113. // }
  114. },
  115. onLoad() {
  116. this.getSetting()
  117. },
  118. methods: {
  119. //获取配置
  120. getSetting() {
  121. this.$u.post('/setting', {
  122. keys: 'FOOTER_TEL',
  123. }).then(res => {
  124. console.log(res.data.FOOTER_TEL, 'set')
  125. this.phone = res.data.FOOTER_TEL
  126. })
  127. },
  128. to_active() {
  129. if (this.vuex_token != '') {
  130. uni.navigateTo({
  131. url: 'my_active'
  132. })
  133. } else {
  134. uni.reLaunch({
  135. url: '../login/index'
  136. })
  137. }
  138. },
  139. to_info() {
  140. uni.navigateTo({
  141. url: '/pages/mine/my_info'
  142. })
  143. },
  144. to_search() {
  145. if (this.vuex_token != '') {
  146. uni.navigateTo({
  147. url: '/pages/mine/search'
  148. })
  149. } else {
  150. uni.reLaunch({
  151. url: '../login/index'
  152. })
  153. }
  154. },
  155. logout() {
  156. let that = this
  157. uni.showModal({
  158. title: '提示',
  159. content: '确定退出登录吗?',
  160. success: function(res) {
  161. if (res.confirm) {
  162. that.$u.get('/auth/logout').then(res => {
  163. that.$u.vuex('vuex_token', '');
  164. that.$u.vuex('vuex_user', '');
  165. console.log(res)
  166. uni.reLaunch({
  167. url: '../index/index'
  168. })
  169. })
  170. } else if (res.cancel) {
  171. console.log('用户点击取消');
  172. }
  173. }
  174. });
  175. // this.$u.get('/auth/logout').then(res=>{
  176. // console.log(res)
  177. // })
  178. },
  179. to_login() {
  180. uni.reLaunch({
  181. url: '../login/index'
  182. })
  183. },
  184. to_creat_news() {
  185. console.log(this.vuex_token, '000000000')
  186. if (this.vuex_token != '') {
  187. uni.navigateTo({
  188. url: 'creat_news'
  189. })
  190. } else {
  191. uni.reLaunch({
  192. url: '../login/index'
  193. })
  194. }
  195. },
  196. //修改密码
  197. changePwd() {
  198. if (this.vuex_token != '') {
  199. uni.navigateTo({
  200. url: 'change_pwd'
  201. })
  202. } else {
  203. uni.reLaunch({
  204. url: '../login/index'
  205. })
  206. }
  207. },
  208. //联系我们
  209. contact() {
  210. uni.makePhoneCall({
  211. phoneNumber: this.phone
  212. })
  213. }
  214. }
  215. }
  216. </script>
  217. <style lang="scss" scoped>
  218. page {
  219. background-color: #F9F9FB;
  220. }
  221. .tel {
  222. position: fixed;
  223. bottom: 80px;
  224. right: 20px;
  225. width: 50px;
  226. height: 50px;
  227. line-height: 20px;
  228. padding: 5px;
  229. z-index: 2;
  230. background-color: rgba($color: #84705E, $alpha: 0.8);
  231. color: #fff;
  232. border-radius: 50%;
  233. text-align: center;
  234. }
  235. .mine {
  236. // height: 100vh;
  237. // background: url(../../static/images/bg.png) no-repeat;
  238. // background-position: center;
  239. .top {
  240. // margin-top: 35px;
  241. padding: 35px 32px 0;
  242. display: flex;
  243. .img {
  244. flex-shrink: 0;
  245. width: 85px;
  246. height: 85px;
  247. overflow: hidden;
  248. border-radius: 50%;
  249. margin-right: 20px;
  250. image {
  251. width: 85px;
  252. height: 85px;
  253. }
  254. }
  255. .info {
  256. .name {
  257. font-size: 22px;
  258. font-family: PingFang HK;
  259. font-weight: 500;
  260. line-height: 30px;
  261. color: #282828;
  262. margin-bottom: 4px;
  263. image {
  264. width: 16px;
  265. height: 16px;
  266. margin-left: 10px;
  267. display: inline-block;
  268. vertical-align: middle;
  269. }
  270. }
  271. .grade {
  272. // height: 42px;
  273. font-size: 14px;
  274. font-family: PingFang HK;
  275. font-weight: 400;
  276. line-height: 21px;
  277. color: #6F6F6F;
  278. margin-bottom: 2px;
  279. overflow: hidden;
  280. -webkit-line-clamp: 2;
  281. text-overflow: ellipsis;
  282. display: -webkit-box;
  283. -webkit-box-orient: vertical;
  284. }
  285. .local {
  286. font-size: 12px;
  287. font-family: PingFang HK;
  288. font-weight: 400;
  289. line-height: 20px;
  290. color: #6F6F6F;
  291. overflow: hidden;
  292. -webkit-line-clamp: 2;
  293. text-overflow: ellipsis;
  294. display: -webkit-box;
  295. -webkit-box-orient: vertical;
  296. image {
  297. width: 9px;
  298. height: 12px;
  299. margin-right: 5px;
  300. }
  301. }
  302. .edit {
  303. // padding: 0 20px;
  304. text-align: right;
  305. color: #84705E;
  306. }
  307. }
  308. }
  309. .center {
  310. background-color: #fff;
  311. box-shadow: 0px 8px 12px rgba(12, 20, 61, 0.06);
  312. padding: 0 33px;
  313. margin-top: 40px;
  314. .item {
  315. height: 74px;
  316. display: flex;
  317. align-items: center;
  318. justify-content: space-between;
  319. .left {
  320. display: flex;
  321. align-items: center;
  322. .img {
  323. width: 32px;
  324. height: 32px;
  325. overflow: hidden;
  326. margin-right: 20px;
  327. image {
  328. width: 32px;
  329. height: 32px;
  330. }
  331. }
  332. text {
  333. font-size: 17px;
  334. font-family: Graphit;
  335. font-weight: 400;
  336. color: #282828;
  337. }
  338. }
  339. .right {
  340. width: 8px;
  341. height: 12px;
  342. // overflow: hidden;
  343. image {
  344. width: 8px;
  345. height: 12px;
  346. }
  347. }
  348. border-bottom: 1px solid #9DA7C0;
  349. border-color: rgba($color: #9DA7C0, $alpha: 0.24);
  350. &:last-child {
  351. border: none;
  352. }
  353. }
  354. }
  355. .bottom {
  356. background-color: #fff;
  357. height: 74px;
  358. display: flex;
  359. align-items: center;
  360. justify-content: center;
  361. // justify-content: space-between;
  362. margin-top: 36px;
  363. // padding: 0 33px;
  364. box-shadow: 0px 8px 12px rgba(12, 20, 61, 0.06);
  365. font-size: 18px;
  366. font-weight: bold;
  367. margin-bottom: 20px;
  368. // .left {
  369. // display: flex;
  370. // align-items: center;
  371. // .img {
  372. // width: 32px;
  373. // height: 32px;
  374. // overflow: hidden;
  375. // margin-right: 20px;
  376. // image {
  377. // width: 32px;
  378. // height: 32px;
  379. // }
  380. // }
  381. // text {
  382. // font-size: 17px;
  383. // font-family: Graphit;
  384. // font-weight: 400;
  385. // color: #282828;
  386. // }
  387. // }
  388. // .right {
  389. // width: 8px;
  390. // height: 12px;
  391. // // overflow: hidden;
  392. // image {
  393. // width: 8px;
  394. // height: 12px;
  395. // }
  396. // }
  397. }
  398. .banben {
  399. text-align: center;
  400. color: #b5b5b5;
  401. }
  402. }
  403. </style>