shouye.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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. <view class="card-list-box">
  79. <view class="card-list-title">管理合同</view>
  80. <view @click="goToPage('jzht')" class="card-item-box">
  81. <icon class="index-icon ht-a-icon" v-if="indexInfoData.tixingFlag"></icon>
  82. <icon class="index-icon ht-icon" v-else></icon>
  83. <text>家政合同</text>
  84. </view>
  85. </view>
  86. <!-- 页面底端 -->
  87. <customTabbarAdminVue :current-tab="0"></customTabbarAdminVue>
  88. <tip-dialog ref="tipDialogRef" :title="tipTitle" :content="tipContent"></tip-dialog>
  89. <!-- 安卓强制升级 -->
  90. <shengJiDialog ref="tipDialogRef2" :closeFlag='false' :title="tipTitle" @confirm-btn="BanbenConfirmBtn"
  91. :showTip="true" :notClose="true" :content="tipContentAndroid">
  92. </shengJiDialog>
  93. </view>
  94. </template>
  95. <script setup>
  96. import cacheManager from "@/utils/cacheManager.js";
  97. import {
  98. onLoad,
  99. onShow
  100. } from '@dcloudio/uni-app';
  101. import {
  102. reactive,
  103. ref
  104. } from "vue";
  105. import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  106. import {
  107. getAppNoticeList,
  108. getAppNoticeWait,
  109. getGlIndexInfo,
  110. getIndexKechengList
  111. } from '@/api/shouye.js'
  112. import tipDialog from '@/components/dialog/tipDialog.vue';
  113. import config from '../../../config.js'
  114. import * as httpApi from "@/api/login.js"
  115. import shengJiDialog from '@/components/dialog/shengJiDialog.vue';
  116. import {
  117. useVersionUpdate
  118. } from "@/utils/versionUpdate.js";
  119. const version = config.appInfo.version;
  120. const tipDialogRef = ref(null);
  121. const tipTitle = '升级提醒';
  122. const tipContent = '您的APP不是最新版本,部分功能不能使用,请升级至最新版本!';
  123. const auth = cacheManager.get('auth');
  124. const tjBtn = ref(1);
  125. const tzNum = ref(0);
  126. const tzContent = ref('');
  127. const searchType = ref('');
  128. const current = ref(0);
  129. const tipContentAndroid = '您的APP不是最新版本,部分功能不能使用,请升级至最新版本!'
  130. const tipDialogRef2 = ref(null)
  131. const updateUrl = ref(null)
  132. const {
  133. initDownload
  134. } = useVersionUpdate()
  135. let indexInfoData = reactive({
  136. searchType: 1,
  137. bzCount: 0,
  138. jzCount: 0,
  139. jzName: '',
  140. kechengCount: 0, //剩余课程数量
  141. kechengUsed: 0, //售出课程数量
  142. tixingFlag:false,
  143. });
  144. const swiperInfo = ref([]);
  145. const dotStyle = reactive({
  146. width: '8',
  147. height: '8',
  148. bottom: '-12',
  149. backgroundColor: 'rgba(226,230,236)',
  150. border: '1px rgb(226,230,236) solid',
  151. selectedBackgroundColor: 'rgb(92, 192, 147)',
  152. selectedBorder: '1px rgb(92, 192, 147) solid'
  153. });
  154. function change(e) {
  155. current.value = e.detail.current
  156. }
  157. function gotoKc(item) {
  158. uni.navigateTo({
  159. url: `/pages/admin/Kecheng/study?kcId=${item.kcId}&from=shouye`
  160. })
  161. }
  162. onLoad((options) => {
  163. initPage();
  164. })
  165. function initPage() {
  166. getKcTg();
  167. getTzNum();
  168. getTzlist();
  169. getIndexInfo();
  170. }
  171. function getKcTg() {
  172. getIndexKechengList({}).then(res => {
  173. swiperInfo.value = res.data.data;
  174. })
  175. }
  176. function getTzNum() {
  177. getAppNoticeWait({}).then(res => {
  178. tzNum.value = res.data;
  179. })
  180. }
  181. function getIndexInfo() {
  182. getGlIndexInfo({
  183. searchType: indexInfoData.searchType
  184. }).then(res => {
  185. indexInfoData.bzCount = res.data.bzCount;
  186. indexInfoData.jzCount = res.data.jzCount;
  187. indexInfoData.jzName = res.data.jzName;
  188. indexInfoData.kechengCount = res.data.kechengCount;
  189. indexInfoData.kechengUsed = res.data.kechengUsed;
  190. indexInfoData.tixingFlag =res.data.tixingFlag;
  191. })
  192. }
  193. function getTzlist() {
  194. const opt = {
  195. page: 1,
  196. size: 10, // 固定查询10条
  197. }
  198. getAppNoticeList(opt).then(res => {
  199. tzContent.value = res.data.data[0].name;
  200. })
  201. }
  202. // 按钮切换
  203. function tjBtnClick(data) {
  204. tjBtn.value = data;
  205. indexInfoData.searchType = data;
  206. getIndexInfo();
  207. }
  208. // 获取用户头像
  209. function goToPage(data) {
  210. switch (data) {
  211. case 'jz':
  212. uni.redirectTo({
  213. url: '/pages/admin/Jiazheng/index'
  214. })
  215. break;
  216. case 'zzh':
  217. uni.redirectTo({
  218. url: '/pages/admin/zizhanghao/list'
  219. })
  220. break;
  221. case 'sykc':
  222. uni.redirectTo({
  223. url: '/pages/admin/yishou/yishou'
  224. })
  225. break;
  226. case 'bz':
  227. uni.redirectTo({
  228. url: '/pages/admin/banzheng/list'
  229. })
  230. break;
  231. case 'ks':
  232. uni.redirectTo({
  233. url: '/pages/admin/Kaoshi/list'
  234. })
  235. break;
  236. case 'cj':
  237. uni.redirectTo({
  238. url: '/pages/admin/Chengji/list'
  239. })
  240. break;
  241. case 'kc':
  242. uni.redirectTo({
  243. url: '/pages/admin/Kecheng/list'
  244. })
  245. break;
  246. case 'tz':
  247. uni.redirectTo({
  248. url: '/pages/admin/tongzhi/list'
  249. })
  250. break;
  251. case 'lc':
  252. uni.redirectTo({
  253. url: '/pages/admin/Lianxi/list'
  254. })
  255. break;
  256. case 'zjz':
  257. uni.redirectTo({
  258. url: '/pages/admin/zijiazheng/index'
  259. })
  260. break;
  261. // 家政合同
  262. case 'jzht':
  263. if(indexInfoData.tixingFlag){
  264. uni.navigateTo({
  265. url: '/pages/admin/Hetong/Hetong'
  266. })
  267. }else{
  268. uni.redirectTo({
  269. url: '/pages/admin/Hetong/HetongList'
  270. })
  271. }
  272. break;
  273. case 'demo':
  274. uni.redirectTo({
  275. url: '/pages/demo/demo2'
  276. })
  277. break;
  278. }
  279. }
  280. function BanbenConfirmBtn() {
  281. const systemInfo = uni.getSystemInfoSync();
  282. if (systemInfo.platform == 'ios') {
  283. const appStoreUrl = 'itms-apps://itunes.apple.com/app/6754060756'
  284. plus.runtime.openURL(appStoreUrl)
  285. } else {
  286. initDownload(updateUrl.value)
  287. }
  288. }
  289. function getLoginInit() {
  290. httpApi.getVersion({}).then(res => {
  291. if (version != res.data.version) {
  292. updateUrl.value = res.data.updateUrl
  293. // test 版本相同唤起弹窗
  294. // tipDialogRef2.value.handleShow();
  295. const systemInfo = uni.getSystemInfoSync();
  296. if (systemInfo.platform == 'ios') {
  297. } else {
  298. tipDialogRef2.value.handleShow();
  299. }
  300. }
  301. })
  302. }
  303. onShow(() => {
  304. getLoginInit()
  305. })
  306. </script>