shouye.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="admin-shouye-page">
  3. <view class="shouye-head-box">{{indexInfoData.jzName}}</view>
  4. <view class="index-banner-default" v-if="!swiperInfo.length>0"></view>
  5. <uni-swiper-dot v-else class="shouye-swiper-box" :info="swiperInfo" :current="current" field="content" mode="dot" :dots-styles="dotStyle">
  6. <swiper class="swiper-box" @change="change" autoplay circular interval="5000">
  7. <!-- autoplay circular interval="3000" -->
  8. <swiper-item v-for="(item ,index) in swiperInfo" :key="index">
  9. <img class="index-banner-img" :src="item.pic" @click="gotoKc(item)"/>
  10. </swiper-item>
  11. </swiper>
  12. </uni-swiper-dot>
  13. <view class="tj-btn-box">
  14. <text :class="{active: tjBtn == 1}" @click="tjBtnClick(1)">本周</text>
  15. <text :class="{active: tjBtn == 2}" @click="tjBtnClick(2)">本月</text>
  16. <text :class="{active: tjBtn == 0}" @click="tjBtnClick(0)">全部</text>
  17. </view>
  18. <view class="index-tj-row">
  19. <view class="index-tj-box">
  20. <view class="tj-num-box">{{indexInfoData.bzCount}}/{{indexInfoData.jzCount}}</view>
  21. <view class="tj-tip-box">考证人员/家政人员</view>
  22. </view>
  23. <view class="index-kc-box" @click="goToPage('sykc')">
  24. <view class="tj-num-box">{{indexInfoData.kechengCount}}/{{indexInfoData. kechengUsed}}</view>
  25. <view class="tj-tip-box">剩余课程/已售课程</view>
  26. <icon class="sjkc-jt-icon"></icon>
  27. </view>
  28. </view>
  29. <view class="index-tongzhi-box" @click="goToPage('tz')">
  30. <text class="tongzhi-num">{{tzNum}}</text>
  31. <rich-text :nodes="tzContent" class="tongzhi-content"></rich-text>
  32. <icon></icon>
  33. </view>
  34. <view class="card-list-box">
  35. <view class="card-list-title">管理家政人员</view>
  36. <view @click="goToPage('jz')" class="card-item-box">
  37. <icon class="index-icon jz-icon"></icon>
  38. <text>家政人员</text>
  39. </view>
  40. <!-- 添加子账号权限只有主账号拥有,其他子账号无法查看 -->
  41. <view @click="goToPage('zzh')" class="card-item-box" v-if="auth.type == 2">
  42. <icon class="index-icon zzh-icon"></icon>
  43. <text>创建子账号</text>
  44. </view>
  45. </view>
  46. <view class="card-list-box">
  47. <view class="card-list-title">管理考证人员</view>
  48. <view @click="goToPage('bz')" class="card-item-box">
  49. <icon class="index-icon kz-icon"></icon>
  50. <text>办证管理</text>
  51. </view>
  52. <view @click="goToPage('ks')" class="card-item-box">
  53. <icon class="index-icon ks-icon"></icon>
  54. <text>考试管理</text>
  55. </view>
  56. <view @click="goToPage('cj')" class="card-item-box">
  57. <icon class="index-icon cj-icon"></icon>
  58. <text>成绩管理</text>
  59. </view>
  60. <view @click="goToPage('lc')" class="card-item-box">
  61. <icon class="index-icon lx-icon"></icon>
  62. <text>练习管理</text>
  63. </view>
  64. <view @click="goToPage('kc')" class="card-item-box">
  65. <icon class="index-icon kc-icon"></icon>
  66. <text>课程管理</text>
  67. </view>
  68. </view>
  69. <!-- 页面底端 -->
  70. <customTabbarAdminVue :current-tab="0"></customTabbarAdminVue>
  71. <tip-dialog ref="tipDialogRef" :title="tipTitle" :content="tipContent"></tip-dialog>
  72. </view>
  73. </template>
  74. <script setup>
  75. import cacheManager from "@/utils/cacheManager.js";
  76. import {onLoad,onShow} from '@dcloudio/uni-app';
  77. import {reactive,ref} from "vue";
  78. import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  79. import {getAppNoticeList,getAppNoticeWait,getGlIndexInfo,getIndexKechengList} from '@/api/shouye.js'
  80. import tipDialog from '@/components/dialog/tipDialog.vue';
  81. import config from '../../../config.js'
  82. import * as httpApi from "@/api/login.js"
  83. const version = config.appInfo.version;
  84. const tipDialogRef = ref(null);
  85. const tipTitle = '升级提醒';
  86. const tipContent = '您的APP不是最新版本,部分功能不能使用,请升级至最新版本!';
  87. const auth = cacheManager.get('auth');
  88. const tjBtn = ref(1);
  89. const tzNum = ref(0);
  90. const tzContent = ref('');
  91. const searchType = ref('');
  92. const current = ref(0);
  93. let indexInfoData = reactive({
  94. searchType:1,
  95. bzCount: 0,
  96. jzCount: 0,
  97. jzName: '',
  98. kechengCount: 0,//剩余课程数量
  99. kechengUsed: 0,//售出课程数量
  100. });
  101. const swiperInfo = ref([]);
  102. const dotStyle = reactive({
  103. width:'8',
  104. height:'8',
  105. bottom:'-12',
  106. backgroundColor: 'rgba(226,230,236)',
  107. border: '1px rgb(226,230,236) solid',
  108. selectedBackgroundColor: 'rgb(92, 192, 147)',
  109. selectedBorder: '1px rgb(92, 192, 147) solid'
  110. });
  111. function change(e) {
  112. current.value = e.detail.current
  113. }
  114. function gotoKc(item){
  115. uni.navigateTo({
  116. url: `/pages/admin/Kecheng/study?kcId=${item.kcId}&from=shouye`
  117. })
  118. }
  119. onLoad((options) => {
  120. initPage();
  121. })
  122. function initPage() {
  123. getKcTg();
  124. getTzNum();
  125. getTzlist();
  126. getIndexInfo();
  127. }
  128. function getKcTg(){
  129. getIndexKechengList({}).then(res => {
  130. swiperInfo.value = res.data.data;
  131. })
  132. }
  133. function getTzNum(){
  134. getAppNoticeWait({}).then(res => {
  135. tzNum.value = res.data;
  136. })
  137. }
  138. function getIndexInfo(){
  139. getGlIndexInfo({searchType:indexInfoData.searchType}).then(res => {
  140. indexInfoData.bzCount = res.data.bzCount;
  141. indexInfoData.jzCount = res.data.jzCount;
  142. indexInfoData.jzName = res.data.jzName;
  143. indexInfoData.kechengCount = res.data.kechengCount;
  144. indexInfoData.kechengUsed = res.data.kechengUsed;
  145. })
  146. }
  147. function getTzlist(){
  148. const opt = {
  149. page: 1,
  150. size: 10, // 固定查询10条
  151. }
  152. getAppNoticeList(opt).then(res => {
  153. tzContent.value = res.data.data[0].name;
  154. })
  155. }
  156. // 按钮切换
  157. function tjBtnClick(data){
  158. tjBtn.value = data;
  159. indexInfoData.searchType = data;
  160. getIndexInfo();
  161. }
  162. // 获取用户头像
  163. function goToPage(data){
  164. switch (data) {
  165. case 'jz':
  166. uni.redirectTo({
  167. url:'/pages/admin/Jiazheng/index'
  168. })
  169. break;
  170. case 'zzh':
  171. uni.redirectTo({
  172. url:'/pages/admin/zizhanghao/list'
  173. })
  174. break;
  175. case 'sykc':
  176. uni.redirectTo({
  177. url:'/pages/admin/yishou/yishou'
  178. })
  179. break;
  180. case 'bz':
  181. uni.redirectTo({
  182. url:'/pages/admin/banzheng/list'
  183. })
  184. break;
  185. case 'ks':
  186. uni.redirectTo({
  187. url:'/pages/admin/Kaoshi/list'
  188. })
  189. break;
  190. case 'cj':
  191. uni.redirectTo({
  192. url:'/pages/admin/Chengji/list'
  193. })
  194. break;
  195. case 'kc':
  196. uni.redirectTo({
  197. url:'/pages/admin/Kecheng/list'
  198. })
  199. break;
  200. case 'tz':
  201. uni.redirectTo({
  202. url:'/pages/admin/tongzhi/list'
  203. })
  204. break;
  205. case 'lc':
  206. uni.redirectTo({
  207. url:'/pages/admin/Lianxi/list'
  208. })
  209. break;
  210. }
  211. }
  212. function getLoginInit(){
  213. httpApi.getVersion({}).then(res => {
  214. if(version!=res.data.version){
  215. tipDialogRef.value.handleShow();
  216. }
  217. })
  218. }
  219. onShow(() => {
  220. getLoginInit()
  221. })
  222. </script>