shouye.vue 8.6 KB

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