mine.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <view>
  3. <statusBar :item="navBarData"></statusBar>
  4. <!-- 消息提示 -->
  5. <msgPop></msgPop>
  6. <view class="mineBox">
  7. <view class="userInformation">
  8. <view class="userAvatar" @click="gotoMineEdit">
  9. <image
  10. :src="userAvatar!=='' ? userAvatar : 'https://teacherapi.cocorobo.cn/teaching-file/static//mine/Avatar_default.png'"
  11. mode="aspectFill"></image>
  12. </view>
  13. <view class="userInfo" @click="gotoMineEdit">
  14. <view class="infoTextone">
  15. <text class="twoZ-font">{{ !username ? '未登录' : username }}</text>
  16. <!-- <span v-if="isManage!==''" class="manage bq-font">管理员</span> -->
  17. </view>
  18. <view class="infoTexttwo">
  19. <text style="font-size: 26rpx;font-weight: 400;line-height: 42rpx;color: #999999;">
  20. {{signature!=='' ? signature : '个性签名' }}
  21. </text>
  22. <!-- <text style="font-size: 26rpx;font-weight: 400;line-height: 42rpx;color: #999999;"></text> -->
  23. </view>
  24. </view>
  25. <!-- <view class="msgInfo">
  26. <view class="msgImg" @click="goMsg">
  27. 消息
  28. </view>
  29. </view> -->
  30. </view>
  31. <view class="userOptionsBox">
  32. <view class="optionsItemBox">
  33. <view class="optionItem" @click="goMsg">
  34. <view class="option_left">
  35. <view class="option_icon" style="display: flex;justify-content: center;">
  36. <image style="width: 80%;height: 80%;" src="../../static/Vectorldang.png"
  37. mode="aspectFill">
  38. </image>
  39. </view>
  40. <text class="option_text fwb-font">我的消息</text>
  41. </view>
  42. <view class="option_right">
  43. <view class="msgq" v-if="msgn>0">
  44. {{msgn}}
  45. </view>
  46. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
  47. mode="aspectFill">
  48. </image>
  49. </view>
  50. </view>
  51. <view class="optionItem" @click="gotoMineCollect">
  52. <view class="option_left">
  53. <span class="option_icon">
  54. <image src="https://teacherapi.cocorobo.cn/teaching-file/static/mine/Collect.png"
  55. mode="aspectFill">
  56. </image>
  57. </span>
  58. <text class="option_text fwb-font">我的收藏</text>
  59. </view>
  60. <view class="option_right">
  61. <image src="https://teacherapi.cocorobo.cn/teaching-file/static/mine/arrow-right.png"
  62. mode="aspectFill">
  63. </image>
  64. </view>
  65. </view>
  66. <view class="optionItem" @click="gotoMineActive">
  67. <view class="option_left">
  68. <span class="option_icon">
  69. <image src="https://teacherapi.cocorobo.cn/teaching-file/static/mine/active.png"
  70. mode="aspectFill">
  71. </image>
  72. </span>
  73. <text class="option_text fwb-font">我的活动</text>
  74. </view>
  75. <view class="option_right">
  76. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
  77. mode="aspectFill">
  78. </image>
  79. </view>
  80. </view>
  81. <!-- <view class="optionItem" @click="gotoMineClass">
  82. <view class="option_left">
  83. <span class="option_icon">
  84. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/myClass.png" mode="aspectFill">
  85. </image>
  86. </span>
  87. <text class="option_text fwb-font">我的教研室</text>
  88. </view>
  89. <view class="option_right">
  90. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png" mode="aspectFill">
  91. </image>
  92. </view>
  93. </view> -->
  94. <!-- <view class="optionItem" @click="gotomyRelease">
  95. <view class="option_left">
  96. <span class="option_icon">
  97. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//fabu.png" mode="aspectFill">
  98. </image>
  99. </span>
  100. <text class="option_text fwb-font">我的发布</text>
  101. </view>
  102. <view class="option_right">
  103. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png" mode="aspectFill">
  104. </image>
  105. </view>
  106. </view> -->
  107. </view>
  108. <view class="optionsItemBox">
  109. <view class="optionItem">
  110. <view class="option_left">
  111. <span class="option_icon">
  112. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/help.png"
  113. mode="aspectFill">
  114. </image>
  115. </span>
  116. <text class="option_text fwb-font">反馈帮助</text>
  117. </view>
  118. <view class="option_right">
  119. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
  120. mode="aspectFill">
  121. </image>
  122. </view>
  123. </view>
  124. <view class="optionItem" @click="gotoMineEdit">
  125. <view class="option_left">
  126. <span class="option_icon">
  127. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/setting.png"
  128. mode="aspectFill">
  129. </image>
  130. </span>
  131. <text class="option_text fwb-font">我的设置</text>
  132. </view>
  133. <view class="option_right">
  134. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
  135. mode="aspectFill">
  136. </image>
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </template>
  144. <script>
  145. export default {
  146. data() {
  147. return {
  148. navBarData: {
  149. title: '我的',
  150. btn: 0
  151. },
  152. msgn: 0,
  153. // 用户名
  154. username: '',
  155. // 头像
  156. userAvatar: 'https://teacherapi.cocorobo.cn/teaching-file/static/mine/Avatar.png',
  157. // 学校
  158. signature: '',
  159. };
  160. },
  161. methods: {
  162. // 我的收藏
  163. gotoMineCollect() {
  164. const value = this.$store.state.user.openid;
  165. if (!value) {
  166. uni.showToast({
  167. title: '未登录,请登录',
  168. icon: 'none'
  169. })
  170. setTimeout(this.goLog, 1000)
  171. return
  172. }
  173. uni.navigateTo({
  174. // url: '/pages/mineCollect/mineCollect'
  175. url: '/pages/mineCollNew/mineCollNew'
  176. })
  177. },
  178. // 我的设置
  179. gotoMineEdit() {
  180. const value = this.$store.state.user.openid;
  181. if (!value) {
  182. uni.showToast({
  183. title: '未登录,请登录',
  184. icon: 'none'
  185. })
  186. setTimeout(this.goLog, 1000)
  187. return
  188. }
  189. uni.navigateTo({
  190. url: '/pages/mineEdit/mineEdit'
  191. })
  192. },
  193. // 我的活动
  194. gotoMineActive() {
  195. const value = this.$store.state.user.openid;
  196. if (!value) {
  197. uni.showToast({
  198. title: '未登录,请登录',
  199. icon: 'none'
  200. })
  201. setTimeout(this.goLog, 1000)
  202. return
  203. }
  204. uni.navigateTo({
  205. url: '/pages/mineActive/mineActive'
  206. })
  207. },
  208. // 信息
  209. goMsg() {
  210. const value = this.$store.state.user.openid;
  211. if (!value) {
  212. uni.showToast({
  213. title: '未登录,请登录',
  214. icon: 'none'
  215. })
  216. setTimeout(this.goLog, 1000)
  217. return
  218. }
  219. uni.navigateTo({
  220. url: '/pages/msg/msg'
  221. })
  222. },
  223. // 获取未读信息
  224. getMag() {
  225. this.$request('/selectAllMessage', "POST", {
  226. oid: this.$store.state.user.openid
  227. }).then(res => {
  228. console.log('获取未读信息', res[0][0].msg);
  229. let num = res[0][0].msg
  230. this.msgn = num
  231. if (num == 0) {
  232. uni.hideTabBarRedDot({
  233. index: 3
  234. })
  235. } else {
  236. uni.setTabBarBadge({
  237. index: 3,
  238. text: num.toString()
  239. })
  240. }
  241. })
  242. },
  243. goLog() {
  244. uni.navigateTo({
  245. url: "/pages/login_Wechat/login_Wechat",
  246. });
  247. },
  248. },
  249. onShow() {
  250. // if (!this.$store.state.user.openid) {
  251. this.getMag() // 调用app.js中的方法
  252. // }
  253. // console.log(this.$store.state);
  254. this.userAvatar = this.$store.state.user.avatar;
  255. this.username = this.$store.state.user.username;
  256. // 学校
  257. this.signature = this.$store.state.user.stuName == null ? '' : this.$store.state.user.stuName;
  258. // this.isManage = this.$store.state.user.openid;
  259. // console.log(this.isManage == "");
  260. }
  261. };
  262. </script>
  263. <style lang="scss" scoped>
  264. .mineBox {
  265. width: 100%;
  266. // 头像信息
  267. .userInformation {
  268. width: 100%;
  269. height: 100px;
  270. padding: 0 18px;
  271. background-color: white;
  272. display: flex;
  273. justify-content: flex-start;
  274. align-items: center;
  275. .userAvatar {
  276. flex: 1;
  277. // height: 80%;
  278. display: flex;
  279. align-items: center;
  280. image {
  281. width: 128rpx;
  282. height: 128rpx;
  283. border-radius: 50%;
  284. }
  285. }
  286. .userInfo {
  287. margin-left: 10px;
  288. flex: 4;
  289. height: 80%;
  290. display: flex;
  291. flex-direction: column;
  292. justify-content: space-evenly;
  293. .infoTextone {
  294. display: flex;
  295. align-items: center;
  296. span {
  297. &:first-child {
  298. color: #000;
  299. // font-size: 40rpx;
  300. font-weight: 600;
  301. }
  302. &.manage {
  303. border: 1px #ffa338 solid;
  304. // font-size: 11px;
  305. display: flex;
  306. white-space: nowrap;
  307. justify-content: center;
  308. align-items: center;
  309. padding: 2px 4px;
  310. border-radius: 3px;
  311. margin-right: 10rpx;
  312. color: #ffa338;
  313. margin-left: 5px;
  314. }
  315. }
  316. }
  317. .infoTexttwo {
  318. span {
  319. color: rgb(153, 153, 153);
  320. // font-size: 26rpx;
  321. }
  322. }
  323. }
  324. .msgInfo {
  325. width: 70rpx;
  326. position: relative;
  327. height: 80%;
  328. .msgImg {
  329. position: absolute;
  330. top: 0;
  331. right: 0;
  332. width: 64rpx;
  333. height: 64rpx;
  334. }
  335. }
  336. }
  337. // 个人资料选项
  338. .userOptionsBox {
  339. width: 100%;
  340. margin-top: 10px;
  341. .optionsItemBox {
  342. background-color: #fff;
  343. width: 100%;
  344. margin-bottom: 10px;
  345. padding: 5px 23px;
  346. .optionItem {
  347. display: flex;
  348. justify-content: space-between;
  349. align-items: center;
  350. height: 81rpx;
  351. // font-size: 28rpx;
  352. .option_left {
  353. display: flex;
  354. align-items: center;
  355. height: 40rpx;
  356. .option_icon {
  357. height: 100%;
  358. width: 40rpx;
  359. image {
  360. width: 100%;
  361. height: 100%;
  362. }
  363. }
  364. .option_text {
  365. margin-left: 10px;
  366. color: rgba(0, 0, 0, 0.8);
  367. }
  368. }
  369. .option_right {
  370. height: 40rpx;
  371. display: flex;
  372. align-items: center;
  373. .msgq {
  374. width: 32rpx;
  375. height: 32rpx;
  376. background-color: rgba(213, 73, 65, 1);
  377. border-radius: 50rpx;
  378. color: #fff;
  379. font-size: 20rpx;
  380. display: flex;
  381. justify-content: center;
  382. align-items: center;
  383. }
  384. image {
  385. height: 34rpx;
  386. width: 30rpx;
  387. margin-left: 20rpx;
  388. }
  389. }
  390. }
  391. }
  392. }
  393. }
  394. </style>