index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <script setup>
  2. import user from '~/store/user';
  3. import { child, setChild } from '~/store/child';
  4. import img_bg from '~/assets/home/bg.png';
  5. import img_banner1 from '~/assets/home/banner1.png';
  6. import img_banner2 from '~/assets/home/banner2.jpg';
  7. import img_banner3 from '~/assets/home/banner3.png';
  8. import img_djzl from '~/assets/home/djzl.png';
  9. import img_qzzx from '~/assets/home/qzzx.png';
  10. import img_xskt from '~/assets/home/xskt.png';
  11. import img_stxk from '~/assets/home/stxk.png';
  12. import img_jscz from '~/assets/home/jscz.png';
  13. import img_yshd from '~/assets/home/yshd.png';
  14. import img_xzxx from '~/assets/home/xzxx.png';
  15. import img_qbyy from '~/assets/home/qbyy.png';
  16. import request from '~/utils/request';
  17. import router from '../../router';
  18. import { showToast } from 'vant';
  19. const images = [
  20. // img_banner1,
  21. img_banner2,
  22. ];
  23. let itemRoute = $ref('');
  24. function gridHandle(item) {
  25. console.log(item);
  26. if (
  27. item.text == '线上课堂' ||
  28. item.text == '云尚活动' ||
  29. item.text == '校长信箱') {
  30. showToast('该模块正在开发中~');
  31. };
  32. if (item.text == '社团选课') {
  33. if (user._role == 'others') {
  34. window.open('https://nmlm.bozedu.net/login.html?redirect=/stxk', '_self')
  35. } else {
  36. switch (user._role) {
  37. case 'jz':
  38. if(!child){
  39. return showToast('家长需绑定孩子方可进入')
  40. }
  41. // window.open('https://nmlm.bozedu.net/#/stxk/jz', '_self')
  42. router.push('/stxk/jz')
  43. return
  44. // return itemRoute = '/stxk/jz'
  45. case 'js':
  46. // window.open('https://nmlm.bozedu.net/#/stxk_teacher', '_self')
  47. router.push('/stxk_teacher')
  48. return
  49. // return itemRoute = '/stxk_teacher'
  50. case 'xz':
  51. // window.open('https://nmlm.bozedu.net/#/stxkjsd', '_self')
  52. router.push('/stxkjsd')
  53. return
  54. // return itemRoute = '/stxkjsd'
  55. }
  56. }
  57. }
  58. }
  59. const gridList = [
  60. { icon: img_djzl, text: '党建专栏', to: () => '/djzl' },
  61. { icon: img_qzzx, text: '求真在线', to: () => '/qzzx' },
  62. { icon: img_xskt, text: '线上课堂', to: () => '' },
  63. { icon: img_stxk, text: '社团选课', to: () => '' },
  64. { icon: img_jscz, text: '教师成长', to: () => '/jscz', permission: ['js', 'xz'].includes(user._role) },
  65. { icon: img_yshd, text: '云尚活动', to: () => '' },
  66. { icon: img_xzxx, text: '校长信箱', to: () => '' },
  67. { icon: img_qbyy, text: '全部应用', to: () => '' },
  68. ]
  69. let searchText = $ref('')
  70. let cateData = $ref([])
  71. let cateLoading = $ref(true)
  72. let nic_id;
  73. request({
  74. url: '/news/info_cate/api_tree',
  75. data: {
  76. token: user._role === 'jz' ? (child ? child.token : "") : user.token
  77. }
  78. }).then(res => {
  79. cateData = res.data;
  80. nic_id = res.data[0]?.nic_id;
  81. cateLoading = false;
  82. })
  83. let notice = $ref({});
  84. request({
  85. url: '/news/info/index',
  86. data: {
  87. nic_id: nic_id,
  88. urltype: 1,
  89. token: user._role === 'jz' ? (child ? child.token : "") : user.token
  90. }
  91. }).then(res => {
  92. notice = res.data.page_data[0];
  93. })
  94. function handleClickCard(row) {
  95. // router.push(`/qzzx/qzzxxq/${row.id}`)
  96. if (row.ni_type == '1') {
  97. window.open(row.brief)
  98. } else {
  99. router.push(`/qzzx/qzzxxq/${row.id}`)
  100. }
  101. }
  102. let childrenList = $ref([]);
  103. function initData() {
  104. request({
  105. baseURL: window.GLOBAL_CONFIG.uc,
  106. timeout: 10 * 1000,
  107. url: "/index.php?mod=user&action=main&do=my_child",
  108. data: {}
  109. }).then((res) => {
  110. if (res.code == "1") {
  111. childrenList = res.data.info;
  112. localStorage.setItem("children", JSON.stringify(res.data.info));
  113. // setChild(res.data.info[0]);
  114. }
  115. });
  116. }
  117. initData();
  118. function register() {
  119. if (user.token) {
  120. router.push('/xszc')
  121. } else {
  122. router.push('/zcdl');
  123. }
  124. }
  125. function routerLink() {
  126. if (notice.ni_type == '1') {
  127. window.open(notice.brief)
  128. } else {
  129. router.push(`/qzzx/qzzxxq/${notice.id}`)
  130. }
  131. }
  132. </script>
  133. <template>
  134. <div class="flex flex-col justify-center p-4 relative bg-no-repeat bg-contain"
  135. :style="{ backgroundImage: `url(${img_bg})` }">
  136. <!-- <van-config-provider :theme-vars="{ 'search-padding': 0 }">
  137. <van-search v-model="searchText" placeholder="" />
  138. </van-config-provider> -->
  139. <van-swipe :autoplay="3000" lazy-render class="rounded-md shadow-md mt-4 min-w-270px">
  140. <van-swipe-item v-for="image in images" :key="image">
  141. <img :src="image" class="w-full" />
  142. </van-swipe-item>
  143. <van-swipe-item>
  144. <img @click="register()" src="../../assets/home/banner3.png" style="height:100%" class="w-full" alt="">
  145. </van-swipe-item>
  146. </van-swipe>
  147. </div>
  148. <van-grid :gutter="0" class="" icon-size="65px">
  149. <template v-for="item in gridList" :key="item.text">
  150. <van-grid-item v-if="item.permission || item.permission === undefined" :icon="item.icon" :text="item.text"
  151. :to="item.to()" @click="gridHandle(item)" />
  152. </template>
  153. </van-grid>
  154. <div class="px-4 flex w-full notice">
  155. <div class="w-40 h-full">
  156. <img class="w-19 mt-5.4" src="../../assets/images/-s-6.png" alt="">
  157. </div>
  158. <div class="text truncate cursor-pointer" @click="routerLink">
  159. {{ notice.name }}
  160. </div>
  161. </div>
  162. <van-tabs sticky swipeable>
  163. <van-tab v-for="cate in cateData" :title="cate.nic_name">
  164. <remote-list url="/news/info/index"
  165. :d="{ nic_id: cate.nic_id, urltype: 1, token: user._role === 'jz' ? (child ? child.token : '') : user.token }"
  166. class="mt-2">
  167. <template #default="{ row: item }">
  168. <van-card :title="item.name" :thumb="item.img" @click="handleClickCard(item)">
  169. <template #price>
  170. <van-tag plain type="primary">{{ item.nic_name }}</van-tag>
  171. </template>
  172. <template #num>
  173. {{ item.datetime }}
  174. </template>
  175. </van-card>
  176. </template>
  177. </remote-list>
  178. </van-tab>
  179. </van-tabs>
  180. <van-tabbar route placeholder>
  181. <van-tabbar-item replace icon="home-o" to="/home">首页</van-tabbar-item>
  182. <van-tabbar-item replace icon="chat-o" to="/chat">消息</van-tabbar-item>
  183. <van-tabbar-item replace icon="user-o" to="/user">我的</van-tabbar-item>
  184. </van-tabbar>
  185. </template>
  186. <style>
  187. .my-swipe .van-swipe-item {
  188. color: #fff;
  189. font-size: 20px;
  190. line-height: 150px;
  191. text-align: center;
  192. background-color: #39a9ed;
  193. }
  194. </style>
  195. <style lang="scss" scoped>
  196. .van-grid {
  197. width: 100%;
  198. }
  199. .van-grid-item {
  200. width: 100px;
  201. }
  202. .van-tabs {
  203. padding: 0 10px !important;
  204. background-color: #fff;
  205. }
  206. .van-card {
  207. background-color: #fff;
  208. }
  209. .notice {
  210. width: 100%;
  211. align-items: center;
  212. justify-content: space-between;
  213. height: 60px;
  214. line-height: 60px;
  215. background-color: #fff;
  216. border-top: 1.19px solid #D8E2F0;
  217. border-bottom: 1.19px solid #D8E2F0;
  218. img {
  219. line-height: 60px;
  220. }
  221. .text {
  222. height: 60px;
  223. line-height: 65px;
  224. }
  225. }
  226. .tz {
  227. width: 40%;
  228. vertical-align: middle;
  229. font-size: 26px;
  230. font-family: Regular;
  231. text-align: center;
  232. color: #747474;
  233. letter-spacing: 0px;
  234. }
  235. .gg {
  236. vertical-align: text-top;
  237. display: inline-block;
  238. width: 30%;
  239. height: 23px;
  240. line-height: 23px;
  241. text-align: center;
  242. background: #ff8700;
  243. border-radius: 4px;
  244. font-size: 3vw;
  245. color: #fff;
  246. }
  247. </style>