mine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  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" @click="gotoFeedback">
  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. gotoFeedback(){
  163. const value = this.$store.state.user.openid;
  164. if (!value) {
  165. uni.showToast({
  166. title: '未登录,请登录',
  167. icon: 'none'
  168. })
  169. setTimeout(this.goLog, 1000)
  170. return
  171. }
  172. uni.navigateTo({
  173. // url: '/pages/mineCollect/mineCollect'
  174. url: '/pages/feedback/feedback'
  175. })
  176. },
  177. // 我的收藏
  178. gotoMineCollect() {
  179. const value = this.$store.state.user.openid;
  180. if (!value) {
  181. uni.showToast({
  182. title: '未登录,请登录',
  183. icon: 'none'
  184. })
  185. setTimeout(this.goLog, 1000)
  186. return
  187. }
  188. uni.navigateTo({
  189. // url: '/pages/mineCollect/mineCollect'
  190. url: '/pages/mineCollNew/mineCollNew'
  191. })
  192. },
  193. // 我的设置
  194. gotoMineEdit() {
  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/mineEdit/mineEdit'
  206. })
  207. },
  208. // 我的活动
  209. gotoMineActive() {
  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/mineActive/mineActive'
  221. })
  222. },
  223. // 信息
  224. goMsg() {
  225. const value = this.$store.state.user.openid;
  226. if (!value) {
  227. uni.showToast({
  228. title: '未登录,请登录',
  229. icon: 'none'
  230. })
  231. setTimeout(this.goLog, 1000)
  232. return
  233. }
  234. uni.navigateTo({
  235. url: '/pages/msg/msg'
  236. })
  237. },
  238. // 获取未读信息
  239. getMag() {
  240. this.$request('/selectAllMessage', "POST", {
  241. oid: this.$store.state.user.openid
  242. }).then(res => {
  243. console.log('获取未读信息', res[0][0].msg);
  244. let num = res[0][0].msg
  245. this.msgn = num
  246. if (num == 0) {
  247. uni.hideTabBarRedDot({
  248. index: 4
  249. })
  250. } else {
  251. uni.setTabBarBadge({
  252. index: 4,
  253. text: num.toString()
  254. })
  255. }
  256. })
  257. },
  258. goLog() {
  259. uni.navigateTo({
  260. url: "/pages/login_Wechat/login_Wechat",
  261. });
  262. },
  263. },
  264. // 分享
  265. onShareAppMessage() {
  266. uni.share({
  267. provider: "weixin",
  268. scene: "WXSceneSession",
  269. type: 1,
  270. summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
  271. success: function(res) {
  272. console.log("success:" + JSON.stringify(res));
  273. },
  274. fail: function(err) {
  275. console.log("fail:" + JSON.stringify(err));
  276. }
  277. });
  278. },
  279. onShow() {
  280. // if (!this.$store.state.user.openid) {
  281. this.getMag() // 调用app.js中的方法
  282. // }
  283. // this.getAllMessage() // 调用app.js中的方法
  284. // console.log(this.$store.state);
  285. this.userAvatar = this.$store.state.user.avatar;
  286. this.username = this.$store.state.user.username;
  287. // 学校
  288. this.signature = this.$store.state.user.stuName == null ? '' : this.$store.state.user.stuName;
  289. // this.isManage = this.$store.state.user.openid;
  290. // console.log(this.isManage == "");
  291. }
  292. };
  293. </script>
  294. <style lang="scss" scoped>
  295. .mineBox {
  296. width: 100%;
  297. // 头像信息
  298. .userInformation {
  299. width: 100%;
  300. height: 100px;
  301. padding: 0 18px;
  302. background-color: white;
  303. display: flex;
  304. justify-content: flex-start;
  305. align-items: center;
  306. .userAvatar {
  307. flex: 1;
  308. // height: 80%;
  309. display: flex;
  310. align-items: center;
  311. image {
  312. width: 128rpx;
  313. height: 128rpx;
  314. border-radius: 50%;
  315. }
  316. }
  317. .userInfo {
  318. margin-left: 10px;
  319. flex: 4;
  320. height: 80%;
  321. display: flex;
  322. flex-direction: column;
  323. justify-content: space-evenly;
  324. .infoTextone {
  325. display: flex;
  326. align-items: center;
  327. span {
  328. &:first-child {
  329. color: #000;
  330. // font-size: 40rpx;
  331. font-weight: 600;
  332. }
  333. &.manage {
  334. border: 1px #ffa338 solid;
  335. // font-size: 11px;
  336. display: flex;
  337. white-space: nowrap;
  338. justify-content: center;
  339. align-items: center;
  340. padding: 2px 4px;
  341. border-radius: 3px;
  342. margin-right: 10rpx;
  343. color: #ffa338;
  344. margin-left: 5px;
  345. }
  346. }
  347. }
  348. .infoTexttwo {
  349. span {
  350. color: rgb(153, 153, 153);
  351. // font-size: 26rpx;
  352. }
  353. }
  354. }
  355. .msgInfo {
  356. width: 70rpx;
  357. position: relative;
  358. height: 80%;
  359. .msgImg {
  360. position: absolute;
  361. top: 0;
  362. right: 0;
  363. width: 64rpx;
  364. height: 64rpx;
  365. }
  366. }
  367. }
  368. // 个人资料选项
  369. .userOptionsBox {
  370. width: 100%;
  371. margin-top: 10px;
  372. .optionsItemBox {
  373. background-color: #fff;
  374. width: 100%;
  375. margin-bottom: 10px;
  376. padding: 5px 23px;
  377. .optionItem {
  378. display: flex;
  379. justify-content: space-between;
  380. align-items: center;
  381. height: 81rpx;
  382. // font-size: 28rpx;
  383. .option_left {
  384. display: flex;
  385. align-items: center;
  386. height: 40rpx;
  387. .option_icon {
  388. height: 100%;
  389. width: 40rpx;
  390. image {
  391. width: 100%;
  392. height: 100%;
  393. }
  394. }
  395. .option_text {
  396. margin-left: 10px;
  397. color: rgba(0, 0, 0, 0.8);
  398. }
  399. }
  400. .option_right {
  401. height: 40rpx;
  402. display: flex;
  403. align-items: center;
  404. .msgq {
  405. width: 32rpx;
  406. height: 32rpx;
  407. background-color: rgba(213, 73, 65, 1);
  408. border-radius: 50rpx;
  409. color: #fff;
  410. font-size: 20rpx;
  411. display: flex;
  412. justify-content: center;
  413. align-items: center;
  414. }
  415. image {
  416. height: 34rpx;
  417. width: 30rpx;
  418. margin-left: 20rpx;
  419. }
  420. }
  421. }
  422. }
  423. }
  424. }
  425. </style>