person.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <!-- -->
  2. <template>
  3. <div class="person_box" :style="'height:' + fullHeight + 'px'">
  4. <!-- 头部 -->
  5. <div class="person_headrBox">
  6. <div class="person_divBox">
  7. <div class="person_headrBox-tlt">我的</div>
  8. </div>
  9. </div>
  10. <!-- main -->
  11. <div class="person_box-main">
  12. <!-- 信息列表 -->
  13. <ul class="person_box-ul">
  14. <!-- 个人 -->
  15. <li class="person_box-list">
  16. <div class="person_box-list-box1">
  17. <img
  18. preview="1"
  19. v-lazy="'http://192.168.1.8:8002/' + redata.user_photo"
  20. alt=""
  21. class="person_box-list-box1-img"
  22. />
  23. <div class="person_box-list-box1-div">
  24. <div class="person_box-list-box1-divName">
  25. {{ redata.user_remark == null || redata.user_remark == '' ? redata.username : redata.user_remark }}
  26. </div>
  27. <div class="person_box-list-box1Num">
  28. 个人积分<span style="color: #000; margin: 0 0 0 0.15rem">{{
  29. redata.integral
  30. }}</span>
  31. </div>
  32. </div>
  33. </div>
  34. <div
  35. class="person_box-list-box2"
  36. @click="noSignIn()"
  37. v-if="redata.sign == 0"
  38. >
  39. <i class="el-icon-date"></i>
  40. 未签到
  41. </div>
  42. <div
  43. v-else
  44. class="person_box-list-box2"
  45. @click="signIn()"
  46. style="background: rgb(177, 175, 175)"
  47. >
  48. <i class="el-icon-date"></i>
  49. 已签到
  50. </div>
  51. </li>
  52. <!-- 我的主页 -->
  53. <li class="person_box-liHome" @click="myHomepage(redata.user_photo)">
  54. <div class="person_box-liHome-box">
  55. <img
  56. src="../../assets/image/new/22.png"
  57. alt=""
  58. class="person_box-liHome-box-img"
  59. />
  60. <div class="person_box-liHome-box-name">我的主页</div>
  61. </div>
  62. <img
  63. src="../../assets/image/right.png"
  64. alt=""
  65. class="person_box-liHome-imgRight"
  66. />
  67. </li>
  68. <!-- 积分 -->
  69. <li class="person_box-liIntegral">
  70. <ul class="person_box-liHome-ul">
  71. <li
  72. class="person_box-liHome-list"
  73. style="border: 0"
  74. @click="myIntegral(redata.integral, redata.username)"
  75. >
  76. <div class="person_box-liHome-box">
  77. <img
  78. src="../../assets/image/new/17.png"
  79. alt=""
  80. class="person_box-liHome-box-img"
  81. />
  82. <div class="person_box-liHome-box-name">我的积分</div>
  83. </div>
  84. <img
  85. src="../../assets/image/right.png"
  86. alt=""
  87. class="person_box-liHome-imgRight"
  88. />
  89. </li>
  90. <!-- <li class="person_box-liHome-list" style="border: 0">
  91. <div class="person_box-liHome-box">
  92. <img
  93. src="../../assets/image/new/18.png"
  94. alt=""
  95. class="person_box-liHome-box-img"
  96. />
  97. <div class="person_box-liHome-box-name">积分讲解</div>
  98. </div>
  99. <img
  100. src="../../assets/image/right.png"
  101. alt=""
  102. class="person_box-liHome-imgRight"
  103. />
  104. </li> -->
  105. </ul>
  106. </li>
  107. <!-- 收藏、跟帖、识别记录 -->
  108. <li class="person_box-liIntegral" style="margin: 0.25rem 0 0 0">
  109. <ul class="person_box-liHome-ul">
  110. <li class="person_box-liHome-list" @click="enshrine()">
  111. <div class="person_box-liHome-box">
  112. <img
  113. src="../../assets/image/new/21.png"
  114. alt=""
  115. class="person_box-liHome-box-img"
  116. />
  117. <div class="person_box-liHome-box-name">我的收藏</div>
  118. </div>
  119. <img
  120. src="../../assets/image/right.png"
  121. alt=""
  122. class="person_box-liHome-imgRight"
  123. />
  124. </li>
  125. <li class="person_box-liHome-list" @click="followUp()">
  126. <div class="person_box-liHome-box">
  127. <img
  128. src="../../assets/image/new/15.png"
  129. alt=""
  130. class="person_box-liHome-box-img"
  131. />
  132. <div class="person_box-liHome-box-name">我的跟帖</div>
  133. </div>
  134. <img
  135. src="../../assets/image/right.png"
  136. alt=""
  137. class="person_box-liHome-imgRight"
  138. />
  139. </li>
  140. <li
  141. class="person_box-liHome-list"
  142. style="border: 0"
  143. @click="recognition()"
  144. >
  145. <div class="person_box-liHome-box">
  146. <img
  147. src="../../assets/image/new/19.png"
  148. alt=""
  149. class="person_box-liHome-box-img"
  150. />
  151. <div class="person_box-liHome-box-name">识别记录</div>
  152. </div>
  153. <img
  154. src="../../assets/image/right.png"
  155. alt=""
  156. class="person_box-liHome-imgRight"
  157. />
  158. </li>
  159. </ul>
  160. </li>
  161. <!-- 系统设置 -->
  162. <li class="person_box-liIntegral" style="margin: 0.25rem 0 0 0">
  163. <ul class="person_box-liHome-ul">
  164. <li class="person_box-liHome-list" @click="aboutUs()">
  165. <div class="person_box-liHome-box">
  166. <img
  167. src="../../assets/image/new/16.png"
  168. alt=""
  169. class="person_box-liHome-box-img"
  170. />
  171. <div class="person_box-liHome-box-name">关于我们</div>
  172. </div>
  173. <img
  174. src="../../assets/image/right.png"
  175. alt=""
  176. class="person_box-liHome-imgRight"
  177. />
  178. </li>
  179. <li
  180. class="person_box-liHome-list"
  181. style="border: 0"
  182. @click="setting()"
  183. >
  184. <div class="person_box-liHome-box">
  185. <img
  186. src="../../assets/image/new/20.png"
  187. alt=""
  188. class="person_box-liHome-box-img"
  189. />
  190. <div class="person_box-liHome-box-name">设置</div>
  191. </div>
  192. <img
  193. src="../../assets/image/right.png"
  194. alt=""
  195. class="person_box-liHome-imgRight"
  196. />
  197. </li>
  198. </ul>
  199. </li>
  200. </ul>
  201. </div>
  202. <!-- 底部导航 -->
  203. <bottomNav v-show="botNav"></bottomNav>
  204. </div>
  205. </template>
  206. <script>
  207. import bottomNav from "../bottomNav/bottomNav"; //底部导航栏
  208. export default {
  209. //import引入的组件需要注入到对象中才能使用
  210. components: {
  211. bottomNav, //底部导航
  212. },
  213. data() {
  214. //这里存放数据
  215. return {
  216. fullHeight: document.documentElement.clientHeight,
  217. botNav: true, //底部导航
  218. redata: {}, //用户个人信息
  219. isClick: true, //签到开关
  220. };
  221. },
  222. //监听属性 类似于data概念
  223. computed: {},
  224. //监控data中的数据变化
  225. watch: {
  226. fullHeight(val) {
  227. //监控浏览器高度变化
  228. if (!this.timer) {
  229. this.fullHeight = val;
  230. this.timer = true;
  231. let that = this;
  232. setTimeout(function () {
  233. //防止过度调用监测事件,导致卡顿
  234. that.timer = false;
  235. }, 400);
  236. }
  237. },
  238. },
  239. //方法集合
  240. methods: {
  241. //动态获取浏览器高度
  242. get_boderHeight() {
  243. const that = this;
  244. window.onresize = () => {
  245. return (() => {
  246. window.fullHeight = document.documentElement.clientHeight;
  247. that.fullHeight = window.fullHeight;
  248. })();
  249. };
  250. },
  251. // 获取当前页面的用户个人信息数据
  252. userData() {
  253. var that = this;
  254. that
  255. .$axios({
  256. method: "get",
  257. url: "http://192.168.1.8:8002/see_user",
  258. })
  259. .then((res) => {
  260. if (res.data) {
  261. that.redata = res.data;
  262. } else {
  263. console.log("没有");
  264. }
  265. })
  266. .catch((err) => {
  267. console.log(err);
  268. });
  269. },
  270. // 进入我的积分界面
  271. myIntegral(num, name) {
  272. var that = this;
  273. that.$router.push({
  274. name: 'share',
  275. query: {
  276. num: num,
  277. name: name,
  278. ret: 'myList'
  279. }
  280. })
  281. },
  282. //进入我的主页界面
  283. myHomepage(img) {
  284. var that = this;
  285. that.$router.push("/help");
  286. that.$router.push({
  287. name: "help",
  288. query: {
  289. img: img,
  290. },
  291. });
  292. },
  293. //进入我的跟帖界面
  294. followUp() {
  295. var that = this;
  296. that.$router.push("/followUp");
  297. },
  298. // 进入关于我们界面
  299. aboutUs() {
  300. var that = this;
  301. that.$router.push("/aboutUs");
  302. },
  303. // 进入识别记录界面
  304. recognition() {
  305. var that = this;
  306. that.$router.push("/memory");
  307. },
  308. // 进入我的收藏界面
  309. enshrine() {
  310. var that = this;
  311. that.$router.push("/collect");
  312. },
  313. // 进入设置界面
  314. setting() {
  315. var that = this;
  316. that.$router.push("/setting");
  317. },
  318. // 未签到
  319. noSignIn() {
  320. var that = this;
  321. var isClick = that.isClick;
  322. if (isClick === true) {
  323. that
  324. .$axios({
  325. method: "post",
  326. url: "http://192.168.1.8:8002/itegral_sign",
  327. })
  328. .then((res) => {
  329. if (res.data.code == "200") {
  330. that.$message({
  331. type: "success",
  332. message: "签到成功!",
  333. duration: 1500,
  334. });
  335. that.userData();
  336. } else {
  337. this.$notify.error({
  338. title: "错误",
  339. message: "签到失败",
  340. duration: 1500,
  341. });
  342. }
  343. console.log(res.data);
  344. })
  345. .catch((err) => {
  346. console.log(err);
  347. this.$notify.error({
  348. title: "错误",
  349. message: "签到失败",
  350. duration: 1500,
  351. });
  352. });
  353. setTimeout(function () {
  354. that.isClick = true;
  355. }, 1500);
  356. }
  357. },
  358. // 已签到
  359. signIn() {
  360. var that = this;
  361. var isClick = that.isClick;
  362. if (isClick === true) {
  363. that.isClick = false;
  364. this.$notify.error({
  365. title: "错误",
  366. message: "您已签过到,不可重复",
  367. duration: 1500,
  368. });
  369. setTimeout(function () {
  370. that.isClick = true;
  371. }, 1500);
  372. }
  373. },
  374. },
  375. //生命周期 - 创建完成(可以访问当前this实例)
  376. created() {},
  377. //生命周期 - 挂载完成(可以访问DOM元素)
  378. mounted() {
  379. this.get_boderHeight();
  380. this.userData(); //用户个人信息
  381. },
  382. beforeCreate() {}, //生命周期 - 创建之前
  383. beforeMount() {}, //生命周期 - 挂载之前
  384. beforeUpdate() {}, //生命周期 - 更新之前
  385. updated() {}, //生命周期 - 更新之后
  386. beforeDestroy() {}, //生命周期 - 销毁之前
  387. destroyed() {}, //生命周期 - 销毁完成
  388. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  389. };
  390. </script>
  391. <style lang='scss'>
  392. @import "../../assets/scss/person.scss";
  393. </style>