mine.vue 9.9 KB

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