shouye.vue 6.9 KB

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