mine.vue 9.0 KB

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