shouye.vue 7.1 KB

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