user.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="avater">
  5. <image :src="userInfo.avatar" class="avater-img" mode=""></image>
  6. </view>
  7. <view class="name-box">
  8. <view class="name-top">
  9. {{userInfo.nickname}}
  10. </view>
  11. <!-- <view class="name-bottom" v-if="userInfo.is_jh">
  12. <view class="nameInfo">
  13. 救在身边 志愿者
  14. </view>
  15. </view> -->
  16. </view>
  17. </view>
  18. <view class="tt">
  19. <view class="tt-box " @click="tohelp" style="background-color:#FEFAF2;">
  20. <image src="../../static/icon/icon-04.png" class="tt-icon1" mode="" style="width: 52rpx; height: 62rpx;"></image>
  21. <view class="tt-txt">
  22. 求救记录
  23. </view>
  24. </view>
  25. <view class="tt-box " @click="torreco" style="background-color:#FDF4F4;">
  26. <image src="../../static/icon/icon-05.png" class="tt-icon1" mode=""></image>
  27. <view class="tt-txt">
  28. 救援记录
  29. </view>
  30. </view>
  31. <view class="tt-box " @click="commonaddress" style="background-color:#F2F6FE;margin-right: 0">
  32. <image src="../../static/icon/icon-06.png" class="tt-icon1" mode=""></image>
  33. <view class="tt-txt">
  34. 常用地址
  35. </view>
  36. </view>
  37. <!-- pages/form/certificates -->
  38. <view class="tt-box" @click="tocertificates" style="background-color:#EEFFFC;">
  39. <image src="../../static/icon/icon-07.png" class="tt-icon1" mode=""></image>
  40. <view class="tt-txt">
  41. 我的证书
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. mapState,
  50. mapMutations
  51. } from 'vuex';
  52. import {
  53. saveUrl,
  54. interceptor
  55. } from '@/utils/loginUtils.js';
  56. import { detail_training } from '@/api/train.js';
  57. import {
  58. userinfo
  59. } from '@/api/user.js';
  60. // #ifdef H5
  61. import {
  62. weixindata
  63. } from '@/utils/wxAuthorized';
  64. // #endif
  65. export default {
  66. data() {
  67. return {
  68. common_address:'',
  69. name:'',
  70. signDate:'',
  71. id:0,
  72. is_over:0
  73. }
  74. },
  75. onShow() {
  76. console.log(this);
  77. // 判断是否已经登录
  78. if (this.hasLogin) {
  79. this.loadBaseData();
  80. } else {
  81. saveUrl();
  82. uni.showModal({
  83. title: '登录',
  84. content: '您未登录,是否马上登陆?',
  85. success: e => {
  86. if (e.confirm) {
  87. interceptor();
  88. }
  89. },
  90. fail: e => {
  91. console.log(e);
  92. }
  93. });
  94. }
  95. this.type = this.userInfo.type;
  96. this.common_address = this.userInfo.common_address
  97. console.log('点前保存的地址',this.common_address)
  98. // 保存当前页面
  99. },
  100. onReady() {
  101. console.log(99999)
  102. detail_training({
  103. id:this.id,
  104. }).then(({data}) => {
  105. console.log(999,data)
  106. this.name = data.name
  107. this.signDate = data.add_time
  108. this.is_over = data.is_over
  109. })
  110. },
  111. computed: {
  112. ...mapState('user', ['hasLogin', 'userInfo'])
  113. },
  114. methods: {
  115. ...mapMutations('user', ['setUserInfo']),
  116. loadBaseData() {
  117. userinfo({}).then(({
  118. data
  119. }) => {
  120. this.setUserInfo(data);
  121. });
  122. // #ifdef H5
  123. weixindata();
  124. // #endif
  125. detail_training({
  126. id:this.id,
  127. }).then(({data}) => {
  128. console.log(9,data)
  129. this.name = data.name
  130. this.signDate = data.add_time
  131. this.is_over = data.is_over
  132. })
  133. },
  134. torreco() {
  135. uni.navigateTo({
  136. url: '/pages/applic/rescuerecords'
  137. })
  138. },
  139. tohelp() {
  140. uni.navigateTo({
  141. url: '/pages/applic/helprecords'
  142. })
  143. },
  144. commonaddress() {
  145. uni.navigateTo({
  146. url: '/pages/applic/commonaddress?add=' + this.common_address
  147. })
  148. },
  149. tocertificates() {
  150. uni.navigateTo({
  151. // pages/form/certificatesList
  152. // url: '/pages/form/certificates?name=' + this.name + '&signDate=' + this.signDate
  153. url: '/pages/form/certificatesList'
  154. })
  155. }
  156. }
  157. }
  158. </script>
  159. <style lang="scss">
  160. .content {
  161. line-height: 1;
  162. background-color: #fff;
  163. .top {
  164. width: 750rpx;
  165. height: 370rpx;
  166. // background-color: #CB131B;
  167. // background: url(../../static/images/bgi2.png)no-repeat top left;
  168. background-size: 750rpx 370rpx;
  169. display: flex;
  170. flex-direction: column;
  171. align-items: center;
  172. padding-left: 55rpx;
  173. align-items: center;
  174. justify-content: center;
  175. .avater {
  176. width: 150rpx;
  177. height: 150rpx;
  178. margin-right: 28rpx;
  179. .avater-img {
  180. width: 100%;
  181. height: 100%;
  182. border-radius: 50%;
  183. }
  184. }
  185. .name-box {
  186. // flex: 1;
  187. padding-top: 25rpx;
  188. .name-top {
  189. font-size: 42rpx;
  190. font-weight: 400;
  191. // color: #FFFFFF;
  192. margin-bottom: 15rpx;
  193. }
  194. .name-bottom{
  195. margin-top: 16rpx;
  196. display: flex;
  197. align-items: center;
  198. // justify-content: center;
  199. .nameInfo{
  200. color: #FFFFFF;
  201. padding: 6rpx 16rpx;
  202. border: 1rpx solid #FFFFFF;
  203. border-radius: 12rpx;
  204. // background-color: pink;
  205. }
  206. }
  207. .name-footbox {
  208. .name-foot {
  209. text-align: center;
  210. font-size: 22rpx;
  211. font-weight: 400;
  212. color: #FFFFFF;
  213. background: rgba(255, 255, 255, 0.2);
  214. border: 1px solid #FFFFFF;
  215. border-radius: 20rpx;
  216. padding: 3rpx 13rpx;
  217. }
  218. }
  219. }
  220. }
  221. .center-box {
  222. width: 687rpx;
  223. // height: 235px;
  224. background: #FFE8E8;
  225. border-radius: 16rpx;
  226. margin: -90rpx auto 0;
  227. .center-top {
  228. width: 687rpx;
  229. height: 80rpx;
  230. background: #FFFFFF;
  231. border-radius: 16rpx 16rpx 0 0;
  232. display: flex;
  233. align-items: center;
  234. padding-left: 30rpx;
  235. .top-left {
  236. width: 126rpx;
  237. line-height: 32rpx;
  238. text-align: center;
  239. background: linear-gradient(0deg, #C90F1B, #F14D33);
  240. font-size: 22rpx;
  241. font-weight: 400;
  242. color: #FFFFFF;
  243. border-radius: 20rpx;
  244. margin-right: 10rpx;
  245. }
  246. .top-right {
  247. font-size: 22rpx;
  248. font-weight: 400;
  249. color: #CB151D;
  250. }
  251. }
  252. .center-foot {
  253. height: 155rpx;
  254. display: flex;
  255. .foot-list {
  256. flex: 1;
  257. text-align: center;
  258. padding-top: 20rpx;
  259. .list-top {
  260. font-size: 39rpx;
  261. font-weight: 400;
  262. color: #CB141D;
  263. line-height: 58rpx;
  264. }
  265. .list-foot {
  266. font-size: 39rpx;
  267. font-weight: 400;
  268. color: #666666;
  269. line-height: 58rpx;
  270. }
  271. }
  272. }
  273. }
  274. .tt {
  275. display: flex;
  276. flex-wrap: wrap;
  277. padding-left:32rpx;
  278. .tt-box {
  279. width: 206rpx;
  280. height: 206rpx;
  281. border-radius: 10rpx;
  282. display: flex;
  283. flex-direction: column;
  284. align-items: center;
  285. justify-content: center;
  286. margin-right: 35rpx;
  287. margin-bottom: 30rpx;
  288. image {
  289. width: 64rpx;
  290. height: 64rpx;
  291. }
  292. .tt-txt {
  293. font-size: 24rpx;
  294. font-family: PingFang SC;
  295. font-weight: bold;
  296. color: #5A5A74;
  297. padding-top: 35rpx;
  298. }
  299. }
  300. }
  301. }
  302. </style>