shouye.vue 6.4 KB

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