mine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  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>
  82. <view class="optionsItemBox">
  83. <view class="optionItem" @click="gotoFeedback">
  84. <view class="option_left">
  85. <span class="option_icon">
  86. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/help.png"
  87. mode="aspectFill">
  88. </image>
  89. </span>
  90. <text class="option_text fwb-font">反馈帮助</text>
  91. </view>
  92. <view class="option_right">
  93. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
  94. mode="aspectFill">
  95. </image>
  96. </view>
  97. </view>
  98. <view class="optionItem" @click="gotoMineEdit">
  99. <view class="option_left">
  100. <span class="option_icon">
  101. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/setting.png"
  102. mode="aspectFill">
  103. </image>
  104. </span>
  105. <text class="option_text fwb-font">我的设置</text>
  106. </view>
  107. <view class="option_right">
  108. <image src="https://teacherapi.cocorobo.cn/teaching-file/static//mine/arrow-right.png"
  109. mode="aspectFill">
  110. </image>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </template>
  118. <script>
  119. export default {
  120. data() {
  121. return {
  122. navBarData: {
  123. title: '我的',
  124. btn: 0
  125. },
  126. msgn: 0,
  127. // 用户名
  128. username: '',
  129. // 头像
  130. userAvatar: 'https://teacherapi.cocorobo.cn/teaching-file/static/mine/Avatar.png',
  131. // 学校
  132. signature: '',
  133. };
  134. },
  135. onShareTimeline() {
  136. uni.share({
  137. provider: "weixin",
  138. scene: "WXSceneTimeline",
  139. type: 0,
  140. href: "http://uniapp.dcloud.io/",
  141. title: "uni-app分享",
  142. summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
  143. imageUrl: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/uni@2x.png",
  144. success: function(res) {
  145. console.log("success:" + JSON.stringify(res));
  146. },
  147. fail: function(err) {
  148. console.log("fail:" + JSON.stringify(err));
  149. }
  150. });
  151. },
  152. // 分享
  153. onShareAppMessage() {
  154. uni.share({
  155. provider: "weixin",
  156. scene: "WXSceneSession",
  157. type: 1,
  158. summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
  159. success: function(res) {
  160. console.log("success:" + JSON.stringify(res));
  161. },
  162. fail: function(err) {
  163. console.log("fail:" + JSON.stringify(err));
  164. }
  165. });
  166. },
  167. methods: {
  168. gotoFeedback() {
  169. const value = this.$store.state.user.openid;
  170. if (!value) {
  171. uni.showToast({
  172. title: '未登录,请登录',
  173. icon: 'none'
  174. })
  175. setTimeout(this.goLog, 1000)
  176. return
  177. }
  178. uni.navigateTo({
  179. // url: '/pages/mineCollect/mineCollect'
  180. url: '/pages/feedback/feedback'
  181. })
  182. },
  183. // 我的收藏
  184. gotoMineCollect() {
  185. const value = this.$store.state.user.openid;
  186. if (!value) {
  187. uni.showToast({
  188. title: '未登录,请登录',
  189. icon: 'none'
  190. })
  191. setTimeout(this.goLog, 1000)
  192. return
  193. }
  194. uni.navigateTo({
  195. // url: '/pages/mineCollect/mineCollect'
  196. url: '/pages/mineCollNew/mineCollNew'
  197. })
  198. },
  199. // 我的设置
  200. gotoMineEdit() {
  201. const value = this.$store.state.user.openid;
  202. if (!value) {
  203. uni.showToast({
  204. title: '未登录,请登录',
  205. icon: 'none'
  206. })
  207. setTimeout(this.goLog, 1000)
  208. return
  209. }
  210. uni.navigateTo({
  211. url: '/pages/mineEdit/mineEdit'
  212. })
  213. },
  214. // 我的活动
  215. gotoMineActive() {
  216. const value = this.$store.state.user.openid;
  217. if (!value) {
  218. uni.showToast({
  219. title: '未登录,请登录',
  220. icon: 'none'
  221. })
  222. setTimeout(this.goLog, 1000)
  223. return
  224. }
  225. uni.navigateTo({
  226. url: '/pages/mineActive/mineActive'
  227. })
  228. },
  229. // 信息
  230. goMsg() {
  231. const value = this.$store.state.user.openid;
  232. if (!value) {
  233. uni.showToast({
  234. title: '未登录,请登录',
  235. icon: 'none'
  236. })
  237. setTimeout(this.goLog, 1000)
  238. return
  239. }
  240. uni.navigateTo({
  241. url: '/pages/msg/msg'
  242. })
  243. },
  244. // 获取未读信息
  245. getMag() {
  246. this.$request('/selectAllMessage', "POST", {
  247. oid: this.$store.state.user.openid
  248. }).then(res => {
  249. console.log('获取未读信息', res[0][0].msg);
  250. let num = res[0][0].msg
  251. this.msgn = num
  252. if (num == 0) {
  253. uni.hideTabBarRedDot({
  254. index: 4
  255. })
  256. } else {
  257. uni.setTabBarBadge({
  258. index: 4,
  259. text: num.toString()
  260. })
  261. }
  262. })
  263. },
  264. goLog() {
  265. uni.navigateTo({
  266. url: "/pages/login_Wechat/login_Wechat",
  267. });
  268. },
  269. },
  270. // // 分享
  271. // onShareAppMessage() {
  272. // uni.share({
  273. // provider: "weixin",
  274. // scene: "WXSceneSession",
  275. // type: 1,
  276. // summary: "我正在使用丽湖双创小程序,赶紧跟我一起来体验!",
  277. // success: function(res) {
  278. // console.log("success:" + JSON.stringify(res));
  279. // },
  280. // fail: function(err) {
  281. // console.log("fail:" + JSON.stringify(err));
  282. // }
  283. // });
  284. // },
  285. onShow() {
  286. // if (!this.$store.state.user.openid) {
  287. this.getMag() // 调用app.js中的方法
  288. // }
  289. // this.getAllMessage() // 调用app.js中的方法
  290. // console.log(this.$store.state);
  291. this.userAvatar = this.$store.state.user.avatar;
  292. this.username = this.$store.state.user.username;
  293. // 学校
  294. this.signature = this.$store.state.user.stuName == null ? '' : this.$store.state.user.stuName;
  295. // this.isManage = this.$store.state.user.openid;
  296. // console.log(this.isManage == "");
  297. }
  298. };
  299. </script>
  300. <style lang="scss" scoped>
  301. .mineBox {
  302. width: 100%;
  303. // 头像信息
  304. .userInformation {
  305. width: 100%;
  306. height: 100px;
  307. padding: 0 18px;
  308. background-color: white;
  309. display: flex;
  310. justify-content: flex-start;
  311. align-items: center;
  312. .userAvatar {
  313. flex: 1;
  314. // height: 80%;
  315. display: flex;
  316. align-items: center;
  317. image {
  318. width: 128rpx;
  319. height: 128rpx;
  320. border-radius: 50%;
  321. }
  322. }
  323. .userInfo {
  324. margin-left: 10px;
  325. flex: 4;
  326. height: 80%;
  327. display: flex;
  328. flex-direction: column;
  329. justify-content: space-evenly;
  330. .infoTextone {
  331. display: flex;
  332. align-items: center;
  333. span {
  334. &:first-child {
  335. color: #000;
  336. // font-size: 40rpx;
  337. font-weight: 600;
  338. }
  339. &.manage {
  340. border: 1px #ffa338 solid;
  341. // font-size: 11px;
  342. display: flex;
  343. white-space: nowrap;
  344. justify-content: center;
  345. align-items: center;
  346. padding: 2px 4px;
  347. border-radius: 3px;
  348. margin-right: 10rpx;
  349. color: #ffa338;
  350. margin-left: 5px;
  351. }
  352. }
  353. }
  354. .infoTexttwo {
  355. span {
  356. color: rgb(153, 153, 153);
  357. // font-size: 26rpx;
  358. }
  359. }
  360. }
  361. .msgInfo {
  362. width: 70rpx;
  363. position: relative;
  364. height: 80%;
  365. .msgImg {
  366. position: absolute;
  367. top: 0;
  368. right: 0;
  369. width: 64rpx;
  370. height: 64rpx;
  371. }
  372. }
  373. }
  374. // 个人资料选项
  375. .userOptionsBox {
  376. width: 100%;
  377. margin-top: 10px;
  378. .optionsItemBox {
  379. background-color: #fff;
  380. width: 100%;
  381. margin-bottom: 10px;
  382. padding: 5px 23px;
  383. .optionItem {
  384. display: flex;
  385. justify-content: space-between;
  386. align-items: center;
  387. height: 81rpx;
  388. // font-size: 28rpx;
  389. .option_left {
  390. display: flex;
  391. align-items: center;
  392. height: 40rpx;
  393. .option_icon {
  394. height: 100%;
  395. width: 40rpx;
  396. image {
  397. width: 100%;
  398. height: 100%;
  399. }
  400. }
  401. .option_text {
  402. margin-left: 10px;
  403. color: rgba(0, 0, 0, 0.8);
  404. }
  405. }
  406. .option_right {
  407. height: 40rpx;
  408. display: flex;
  409. align-items: center;
  410. .msgq {
  411. width: 36rpx;
  412. height: 36rpx;
  413. background-color: rgba(213, 73, 65, 1);
  414. border-radius: 50rpx;
  415. color: #fff;
  416. font-size: 20rpx;
  417. display: flex;
  418. justify-content: center;
  419. align-items: center;
  420. }
  421. image {
  422. height: 34rpx;
  423. width: 30rpx;
  424. margin-left: 20rpx;
  425. }
  426. }
  427. }
  428. }
  429. }
  430. }
  431. </style>