index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <view class="mine-container" >
  3. <!--顶部个人信息栏-->
  4. <view class="home_top">
  5. <uni-nav-bar title="我的" :background-color="backgroundColor" :border="navborder" statusBar='true' fixed="true">
  6. <!-- checkPermi(['system:notice:list']) -->
  7. <!-- <block slot="left" >
  8. <view class="min_top" @click="getMessage">
  9. <image :src="noticimg"></image>
  10. <view class="circ"></view>
  11. </view>
  12. </block> -->
  13. </uni-nav-bar>
  14. </view>
  15. <image :src="abg" class="abg"></image>
  16. <view style="margin-top: -487rpx;position: relative;padding:0 34rpx 20rpx;">
  17. <view class="header_top flexc mb6" @click="handleToinfo">
  18. <image v-if="avatar" @click.stop="handleToAvatar" :src="avatar" class="flex0 limg" mode="aspectFill"></image>
  19. <image v-else @click.stop="handleToAvatar" :src="avatarimg" class="flex0 limg" mode="aspectFill"></image>
  20. <view class="flex1 hcen">
  21. <view class="f17 fw c16 mb8 flexc">{{name}}
  22. <text v-if="choseroles=='teacher'">老师</text>
  23. <text v-if="choseroles=='school'">学校管理员</text>
  24. <text v-if="choseroles=='parents'">家长</text>
  25. </view>
  26. <view class="f15 co6" v-if="choseroles=='teacher'">{{schoolName}}/{{discipline}}</view>
  27. <view class="f15 co6" v-else-if="choseroles!='parents'" >{{schoolName}}</view>
  28. </view>
  29. <image :src="rimg" class="flex0 rimg"></image>
  30. </view>
  31. <view class="mnbox">
  32. <view class="mn_tit">账号设置</view>
  33. <view class="mn_list">
  34. <view class="mlist flexc" @click="handleUpassword">
  35. <view class="mlistl"><image :src="miconj" class="imgh"></image></view>
  36. <view class="mlistc">修改密码</view>
  37. </view>
  38. <view class="mlist flexc" @click="handlePrivacy">
  39. <view class="mlistl"><image :src="miconf" class="imgd"></image></view>
  40. <view class="mlistc">用户协议</view>
  41. </view>
  42. <view class="mlist flexc" @click="handleLogout">
  43. <view class="mlistl"><image :src="miconl" class="imgc"></image></view>
  44. <view class="mlistc">退出登录</view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <footers v-if="isfootflag" :footlist="footlist" :footerindex="footerindex" :color_checked="color_checked" :color_nochecked="color_nochecked" :isHomeIndex="true"></footers>
  50. </view>
  51. </template>
  52. <script>
  53. import footers from '@/components/footer/footer.vue'
  54. import config from '@/config'
  55. const baseUrl = config.baseUrl
  56. import storage from '@/utils/storage'
  57. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  58. import {getInfo } from '@/api/login'
  59. export default {
  60. components:{footers},
  61. data() {
  62. return {
  63. footlist:[
  64. {module:'home',title:'首页',icon_checked:require('@/static/images/tabbar/home_.png'),icon_nochecked:require('@/static/images/tabbar/home.png')},
  65. {module:'mine',title:'我的',icon_checked:require('@/static/images/tabbar/mine_.png'),icon_nochecked:require('@/static/images/tabbar/mine.png')},
  66. ],
  67. footerindex:'mine',
  68. isfootflag:true,
  69. color_checked :'161616',
  70. color_nochecked :'666666',
  71. abg:require('@/static/images/mine/habg.png'),
  72. noticimg:require('@/static/images/mine/mnotic.png'),
  73. rimg:require('@/static/images/mine/rimg.png'),
  74. wrimg:require('@/static/images/mine/wrimg.png'),
  75. miconf:require('@/static/images/mine/miconf.png'),
  76. miconj:require('@/static/images/mine/miconj.png'),
  77. miconl:require('@/static/images/mine/miconl.png'),
  78. type:0,
  79. confdat:{tit:'系统提示',txt:"确定注销并退出系统吗?",closetxt:'取消',suretxt:'确认'},
  80. backgroundColor:"transparent",
  81. navborder:false,
  82. timetit:'',
  83. timelist:[],
  84. timetype:'',
  85. discipline:'',
  86. schoolName:'',
  87. schoolId:'',
  88. classId:'',
  89. teacherClass:[],
  90. roles:'',
  91. baseUrl:'',
  92. name: this.$store.state.user.name,
  93. avatarimg:require("@/static/images/mine/profile.png"),
  94. // version: getApp().globalData.config.appInfo.version
  95. }
  96. },
  97. computed: {
  98. avatar() {
  99. return this.$store.state.user.avatar
  100. },
  101. choseroles() {
  102. return this.$store.state.user.choseroles
  103. },
  104. windowHeight() {
  105. return uni.getSystemInfoSync().windowHeight - 50
  106. }
  107. },
  108. onUnload(){
  109. uni.$off('refreshdatalis')
  110. },
  111. onPullDownRefresh:function(){
  112. this.init();
  113. this.getClassFn();
  114. setTimeout(function () {
  115. uni.stopPullDownRefresh();
  116. }, 1000);
  117. },
  118. onShow() {
  119. var choseroles=this.$store.state.user.choseroles;
  120. if(this.roles&&choseroles&&this.roles!=choseroles){
  121. this.roles=choseroles;
  122. this.schoolName=this.$store.state.user.deptName
  123. // 当前人的角色
  124. if(uni.getStorageSync('checkclass')&&choseroles=='teacher'){
  125. var newobj=JSON.parse(JSON.stringify(uni.getStorageSync('checkclass')))
  126. this.discipline=newobj.discipline;
  127. this.schoolName=newobj.schoolName;
  128. this.schoolId=newobj.schoolId;
  129. this.classId=newobj.classId;
  130. }
  131. }
  132. },
  133. onLoad() {
  134. this.baseUrl=baseUrl;
  135. // var choseroles=this.$store.state.user.choseroles;
  136. // this.roles=choseroles;
  137. // this.schoolName=this.$store.state.user.deptName
  138. // // 当前人的角色
  139. // if(uni.getStorageSync('checkclass')&&choseroles=='teacher'){
  140. // var newobj=JSON.parse(JSON.stringify(uni.getStorageSync('checkclass')))
  141. // this.discipline=newobj.discipline;
  142. // this.schoolName=newobj.schoolName;
  143. // this.schoolId=newobj.schoolId;
  144. // this.classId=newobj.classId;
  145. // }
  146. // uni.$on('refreshdatalis',(e) => {
  147. // this.getClassFn();
  148. // })
  149. // this.getClassFn()
  150. },
  151. onPageScroll(e) {
  152. var scrollTop=Number(e.scrollTop);
  153. if(scrollTop>0){
  154. this.backgroundColor='#c4defb'
  155. }else{
  156. this.backgroundColor='transparent'
  157. }
  158. },
  159. methods: {
  160. checkPermi, checkRole,
  161. handleLogout() {
  162. this.type=1
  163. // this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  164. // this.$store.dispatch('LogOut').then(() => {
  165. // this.$tab.reLaunch('/pages/index/index')
  166. // })
  167. // })
  168. },
  169. getConfirm(){
  170. this.$store.dispatch('LogOut').then(() => {
  171. this.$tab.reLaunch('/pages/index/index')
  172. })
  173. },
  174. getClassFn(){
  175. var that=this;
  176. var choseroles=this.$store.state.user.choseroles||'';
  177. if(choseroles=='school'){
  178. that.classId='';
  179. that.schoolId=that.$store.state.user.deptId;
  180. that.getclassListFn()
  181. }else{
  182. // this.$store.dispatch('GetInforoles').then(resd => {
  183. // if(resd.code==200){
  184. // var roles=that.$store.state.user.choseroles;
  185. // that.roles=roles;
  186. // var res=resd.data;
  187. // if(roles=='teacher'){
  188. // if(res.user&&res.user.teacherClass&&res.user.teacherClass.length){
  189. // var newArr=res.user.teacherClass;
  190. // that.teacherClass = newArr.map(v => {
  191. // return {
  192. // dictLabel: v.className,
  193. // dictValue: v.classId
  194. // }
  195. // })
  196. // }
  197. // }else if(roles=='parents'){
  198. // }else{
  199. // // 学校
  200. // that.classId='';
  201. // that.schoolId=that.$store.state.user.deptId;
  202. // that.getclassListFn()
  203. // }
  204. // }
  205. // })
  206. }
  207. // getInfo().then(res=>{
  208. // if(res.code==200){
  209. // if(res.user&&res.user.teacherClass&&res.user.teacherClass.length){
  210. // var newArr=res.user.teacherClass;
  211. // that.teacherClass = newArr.map(v => {
  212. // return {
  213. // dictLabel: v.className,
  214. // dictValue: v.classId
  215. // }
  216. // })
  217. // }
  218. // }
  219. // })
  220. },
  221. // 班级
  222. getclassListFn(){
  223. getDeptList(this.schoolId).then(res=>{
  224. if(res.code==200){
  225. this.teacherClass = res.data.map(v => {
  226. return {
  227. dictLabel: v.deptName,
  228. dictValue:v.deptId
  229. }
  230. })
  231. }else{
  232. this.$toast(res.msg)
  233. }
  234. })
  235. },
  236. handleAuth(){
  237. var roles=this.$store.state.user.roles;
  238. if(roles.length>0){
  239. this.$tab.navigateTo('/mine/pages/mine/auth')
  240. }else{
  241. //当前只有一种身份
  242. this.$toast("您当前只有一种身份")
  243. // this.$tab.reLaunch('/pages/index/index')
  244. }
  245. },
  246. handleaddAuth(){
  247. this.$tab.navigateTo('/mine/pages/mine/auth?type=add')
  248. },
  249. handleCollect(){
  250. this.$tab.navigateTo('/mine/pages/trends/mycollect')
  251. },
  252. handleToinfo(){
  253. this.$tab.navigateTo('/mine/pages/mine/exit')
  254. },
  255. handlePrivacy(){
  256. this.$tab.navigateTo(`/pages/agreement`)
  257. },
  258. handleUpassword(){
  259. this.$tab.navigateTo(`/pages/mine/pwd/index`)
  260. },
  261. handleSchool(){
  262. var id=this.$store.state.user.deptId
  263. this.$tab.navigateTo('/mine/pages/mine/applyregister?type=update&id='+id)
  264. // this.$tab.navigateTo('/mine/pages/mine/applyteacher')
  265. },
  266. handleWord(){
  267. this.$tab.navigateTo('/mine/pages/mine/word')
  268. },
  269. handleQuery(){
  270. this.$tab.navigateTo('/mine/pages/login/query?from=mine')
  271. },
  272. handleClass(){
  273. this.$tab.navigateTo('/mine/pages/mine/addclass')
  274. },
  275. handlelimit(){
  276. this.$tab.navigateTo('/mine/pages/mine/limit')
  277. },
  278. handleClassSet(){
  279. this.$tab.navigateTo('/mine/pages/mine/setclass')
  280. },
  281. handleaddStu(){
  282. this.$tab.navigateTo('/mine/pages/mine/setstuent')
  283. },
  284. handleTime(e){
  285. this.type=5;
  286. this.timetype=e;
  287. },
  288. getKeyNext(data){
  289. this.type=3;
  290. this.classId=data;
  291. this.getConfigKey(data)
  292. },
  293. handleZhaccount(){
  294. this.$tab.navigateTo('/work/pages/examine/zhaccount')
  295. },
  296. handleTkcourse(){
  297. this.$tab.navigateTo('/work/pages/examine/tkcourse')
  298. },
  299. handleToAvatar() {
  300. this.$tab.navigateTo('/pages/mine/avatar/index')
  301. },
  302. getKeyFn(data){
  303. var params={
  304. 'configKey':this.classId,
  305. 'configValue':data,
  306. "configType":this.timetype
  307. }
  308. getupdConfigKey(params).then(res=>{
  309. if(res.code==200){
  310. this.$toast('修改成功')
  311. this.type=0;
  312. }else{
  313. this.$toast(res.msg)
  314. }
  315. })
  316. },
  317. getClose(){
  318. this.type=0
  319. },
  320. getConfigKey(e){
  321. var params={
  322. configType:this.timetype,
  323. configKey:e
  324. }
  325. //班级id
  326. // configType "1:准备下课 2:延迟下课",
  327. getConfigKey(params).then(res=>{
  328. if(res.code==200){
  329. this.type=3
  330. this.timetit=res.msg||5;
  331. }else{
  332. this.$toast(res.msg)
  333. }
  334. })
  335. },
  336. handleToInfo() {
  337. this.$tab.navigateTo('/pages/mine/info/index')
  338. },
  339. handleToEditInfo() {
  340. this.$tab.navigateTo('/pages/mine/info/edit')
  341. },
  342. handleToSetting() {
  343. this.$tab.navigateTo('/pages/mine/setting/index')
  344. },
  345. handleToLogin() {
  346. this.$tab.reLaunch('/pages/login')
  347. },
  348. handleLogout() {
  349. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  350. this.$store.dispatch('LogOut').then(() => {
  351. this.$tab.reLaunch('/pages/index/index')
  352. })
  353. })
  354. },
  355. handleHelp() {
  356. this.$tab.navigateTo('/pages/mine/help/index')
  357. },
  358. handleAbout() {
  359. this.$tab.navigateTo('/pages/mine/about/index')
  360. },
  361. handleJiaoLiuQun() {
  362. this.$modal.showToast('QQ群:133713780')
  363. },
  364. handleBuilding() {
  365. this.$modal.showToast('模块建设中~')
  366. }
  367. }
  368. }
  369. </script>
  370. <style lang="scss">
  371. page {
  372. background-color: #f5f6f7;
  373. }
  374. .home_top /deep/ .uni-navbar__placeholder{height: 0 !important;}
  375. .abg{width: 100%;height: 622rpx;}
  376. .min_top{position: relative;width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;
  377. image{width: 32rpx;height: 32rpx;}
  378. .circ{width: 12rpx;height: 12rpx;background: #EB5663;border-radius: 50%;position: absolute;right: 4rpx;top: 4rpx;}
  379. }
  380. .header_top{padding: 34rpx 26rpx;
  381. .limg{width: 120rpx;height: 120rpx;border-radius: 50%;margin-right: 26rpx;}
  382. .rimg{width: 14rpx;height: 24rpx;margin-left: 26rpx;}
  383. .hcen{
  384. text{height: 34rpx;background: #89A8F6;border-radius: 16rpx;line-height: 34rpx;font-weight: normal;font-size: 24rpx;color: #ffffff;display: inline-block;min-width: 78rpx;padding: 0 10rpx;box-sizing: border-box;margin-left: 24rpx;}
  385. }
  386. }
  387. .bgf{
  388. .mlist{padding:30rpx 34rpx;
  389. .mlistl{width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;margin-right: 16rpx;
  390. .imga{width: 38rpx;height: 38rpx;}
  391. .imgb{width: 32rpx;height: 32rpx;}
  392. .imgc{width: 30rpx;height: 30rpx;}
  393. .imgd{width: 32rpx;height: 34rpx;}
  394. .imge{width: 32rpx;height: 26rpx;}
  395. .imgf{width: 32rpx;height: 30rpx;}
  396. .imgg{width: 34rpx;height: 34rpx;}
  397. .imgi{width: 34rpx;height: 34rpx;}
  398. .imgk{width: 32rpx;height: 30rpx;}
  399. }
  400. .mlistc{flex: 1;font-size: 32rpx;font-weight: 500;
  401. color: #161616;}
  402. .mlistr{width: 14rpx;height: 24rpx;marign-left:16rpx}
  403. }
  404. }
  405. .mnbox{
  406. background: #FFFFFF;border-radius: 18rpx;margin-bottom: 24rpx;padding: 40rpx 0 16rpx;
  407. .mn_tit{font-size: 32rpx;font-weight: bold;
  408. color: #161616;padding-left: 68rpx;position: relative;margin-bottom: 12rpx;
  409. &::before{width: 6rpx;background: $com-cd3;border-radius: 4rpx;position: absolute;left: 36rpx;top: 4rpx;content: '';bottom: 4rpx;}
  410. }
  411. .mn_list{display: flex;flex-wrap: wrap;
  412. .mlist{width: 25%;box-sizing: border-box;display: flex;flex-direction: column;align-items: center;padding: 26rpx 0;
  413. .mlistl{width: 50rpx;height: 50rpx;display: flex;align-items: center;justify-content: center;margin-bottom: 16rpx;
  414. .imga{width: 42rpx;height: 44rpx;}
  415. .imgb{width: 44rpx;height: 44rpx;}
  416. .imgc{width: 44rpx;height: 42rpx;}
  417. .imgd{width: 42rpx;height: 44rpx;}
  418. .imge{width: 44rpx;height: 42rpx;}
  419. .imgf{width: 32rpx;height: 30rpx;}
  420. .imgg{width: 44rpx;height: 44rpx;}
  421. .imgh{width: 40rpx;height: 44rpx;}
  422. .imgk{width: 40rpx;height: 42rpx;}
  423. }
  424. .mlistc{flex: 1;font-size: 30rpx;font-weight: 500;color: #666666;}
  425. }
  426. }
  427. }
  428. .mine-container {
  429. width: 100%;
  430. height: 100%;
  431. .header-section {
  432. padding: 15px 15px 45px 15px;
  433. color: white;
  434. .login-tip {
  435. font-size: 18px;
  436. margin-left: 10px;
  437. }
  438. .cu-avatar {
  439. border: 2px solid #eaeaea;
  440. .icon {
  441. font-size: 40px;
  442. }
  443. }
  444. .user-info {
  445. margin-left: 15px;
  446. .u_title {
  447. font-size: 18px;
  448. line-height: 30px;
  449. }
  450. }
  451. }
  452. .content-section {
  453. position: relative;
  454. top: -50px;
  455. .mine-actions {
  456. margin: 15px 15px;
  457. padding: 20px 0px;
  458. border-radius: 8px;
  459. background-color: white;
  460. .action-item {
  461. .icon {
  462. font-size: 28px;
  463. }
  464. .text {
  465. display: block;
  466. font-size: 13px;
  467. margin: 8px 0px;
  468. }
  469. }
  470. }
  471. }
  472. }
  473. </style>