shouye.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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. jzHtId:null,
  144. });
  145. const swiperInfo = ref([]);
  146. const dotStyle = reactive({
  147. width: '8',
  148. height: '8',
  149. bottom: '-12',
  150. backgroundColor: 'rgba(226,230,236)',
  151. border: '1px rgb(226,230,236) solid',
  152. selectedBackgroundColor: 'rgb(92, 192, 147)',
  153. selectedBorder: '1px rgb(92, 192, 147) solid'
  154. });
  155. function change(e) {
  156. current.value = e.detail.current
  157. }
  158. function gotoKc(item) {
  159. uni.navigateTo({
  160. url: `/pages/admin/Kecheng/study?kcId=${item.kcId}&from=shouye`
  161. })
  162. }
  163. onLoad((options) => {
  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. indexInfoData.jzHtId =res.data.jzHtId;
  192. })
  193. }
  194. function getTzlist() {
  195. const opt = {
  196. page: 1,
  197. size: 10, // 固定查询10条
  198. }
  199. getAppNoticeList(opt).then(res => {
  200. tzContent.value = res.data.data[0].name;
  201. })
  202. }
  203. // 按钮切换
  204. function tjBtnClick(data) {
  205. tjBtn.value = data;
  206. indexInfoData.searchType = data;
  207. getIndexInfo();
  208. }
  209. // 获取用户头像
  210. function goToPage(data) {
  211. switch (data) {
  212. case 'jz':
  213. uni.redirectTo({
  214. url: '/pages/admin/Jiazheng/index'
  215. })
  216. break;
  217. case 'zzh':
  218. uni.redirectTo({
  219. url: '/pages/admin/zizhanghao/list'
  220. })
  221. break;
  222. case 'sykc':
  223. uni.redirectTo({
  224. url: '/pages/admin/yishou/yishou'
  225. })
  226. break;
  227. case 'bz':
  228. uni.redirectTo({
  229. url: '/pages/admin/banzheng/list'
  230. })
  231. break;
  232. case 'ks':
  233. uni.redirectTo({
  234. url: '/pages/admin/Kaoshi/list'
  235. })
  236. break;
  237. case 'cj':
  238. uni.redirectTo({
  239. url: '/pages/admin/Chengji/list'
  240. })
  241. break;
  242. case 'kc':
  243. uni.redirectTo({
  244. url: '/pages/admin/Kecheng/list'
  245. })
  246. break;
  247. case 'tz':
  248. uni.redirectTo({
  249. url: '/pages/admin/tongzhi/list'
  250. })
  251. break;
  252. case 'lc':
  253. uni.redirectTo({
  254. url: '/pages/admin/Lianxi/list'
  255. })
  256. break;
  257. case 'zjz':
  258. uni.redirectTo({
  259. url: '/pages/admin/zijiazheng/index'
  260. })
  261. break;
  262. // 家政合同
  263. case 'jzht':
  264. if(indexInfoData.tixingFlag){
  265. uni.navigateTo({
  266. url: '/pages/admin/Hetong/Hetong'
  267. })
  268. uni.navigateTo({
  269. url: `/pages/admin/Hetong/Hetong?id=${indexInfoData.jzHtId}`
  270. })
  271. }else{
  272. uni.redirectTo({
  273. url: '/pages/admin/Hetong/HetongList'
  274. })
  275. }
  276. break;
  277. case 'demo':
  278. uni.redirectTo({
  279. url: '/pages/demo/demo2'
  280. })
  281. break;
  282. }
  283. }
  284. function BanbenConfirmBtn() {
  285. const systemInfo = uni.getSystemInfoSync();
  286. if (systemInfo.platform == 'ios') {
  287. const appStoreUrl = 'itms-apps://itunes.apple.com/app/6754060756'
  288. plus.runtime.openURL(appStoreUrl)
  289. } else {
  290. initDownload(updateUrl.value)
  291. }
  292. }
  293. function getLoginInit() {
  294. httpApi.getVersion({}).then(res => {
  295. if (version != res.data.version) {
  296. updateUrl.value = res.data.updateUrl
  297. // test 版本相同唤起弹窗
  298. // tipDialogRef2.value.handleShow();
  299. const systemInfo = uni.getSystemInfoSync();
  300. if (systemInfo.platform == 'ios') {
  301. } else {
  302. tipDialogRef2.value.handleShow();
  303. }
  304. }
  305. })
  306. }
  307. onShow(() => {
  308. initPage();
  309. getLoginInit()
  310. })
  311. </script>