shouye.vue 8.2 KB

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