Просмотр исходного кода

修改文件--获取服务器时间--修改图标大小

plg 2 недель назад
Родитель
Сommit
ebb5b6204b
6 измененных файлов с 42 добавлено и 9 удалено
  1. 1 1
      package.json
  2. 13 0
      src/api/plan.ts
  3. 3 0
      src/utils/http.ts
  4. 11 6
      src/views/Scale.vue
  5. 10 2
      src/views/shapeIntuition_random.vue
  6. 4 0
      vite.config.ts

+ 1 - 1
package.json

@@ -4,7 +4,7 @@
   "private": true,
   "type": "module",
   "scripts": {
-    "dev": "vite",
+    "dev": "vite --host 0.0.0.0",
     "build": "run-p type-check \"build-only {@}\" --",
     "preview": "vite preview",
     "build-only": "vite build",

+ 13 - 0
src/api/plan.ts

@@ -24,6 +24,9 @@ const queryMsgUrl = '/comment/findAllByPage'
 const queryScaleDetailUrl = '/subject/findByFlag'
 //查询认知任务详情
 const queryCognizeDetailUrl = '/cognitive/findByFlag'
+
+
+const getCurrentTimeUrl = '/system/getSystemTime  '
 //首页API
 export const homeApi = (val: any) => {
     return http<any>(
@@ -142,3 +145,13 @@ export const queryCognizeDetailApi = (val: string) => {
 }
 
 
+//根据flag查询 认知任务详细信息
+export const getCurrentTimeApi = () => {
+    return http<any>({
+        method: 'get',
+        url: `${getCurrentTimeUrl}`
+    })
+}
+
+
+

+ 3 - 0
src/utils/http.ts

@@ -18,6 +18,9 @@ const menuStatus = menuStatusStore()
 //创建axios实例
 
 //创建基础访问路径
+//少锋本地wifi
+// const base_url = 'http://172.28.50.2:8089'
+//少锋本地
 // const base_url = 'http://10.113.248.4:8089/'
 //30
 const base_url = 'http://43.143.198.30:8089/'

+ 11 - 6
src/views/Scale.vue

@@ -11,7 +11,7 @@ import { Check } from '@element-plus/icons-vue'
 import { number } from 'echarts';
 import { ElMessage } from 'element-plus';
 import { useRouter, useRoute } from 'vue-router';
-import { getScaleApi, queryScaleDetailApi, saveScaleApi } from '@/api/plan';
+import { getCurrentTimeApi, getScaleApi, queryScaleDetailApi, saveScaleApi } from '@/api/plan';
 import { userInfoStore } from '@/stores'
 //调用子组件的ref
 // 加一个锁表示不能重复点击
@@ -192,8 +192,9 @@ const subScaleData = async (data: any, flag: string) => {
 
     //开始处理数据
     // productData()
+    let time = '' + startTime.value
     let params = {
-        beginTime: startTime.value,
+        beginTime: time,
         orgName: userInfo.userInfo.orgName,
         orgNo: userInfo.userInfo.orgNo,
         planId: planId.value,
@@ -211,7 +212,7 @@ const subScaleData = async (data: any, flag: string) => {
     //2.接下来查看需要看总共几个需要做的附加题---将未完成的题目---合并到一块---到时候
     //3.判断做完的有且有多少个题目-----未做完的量表有多少个题目    
 
-
+    getStartTime()
     isLock.value = false
 
     //判断当前 flag 是可选的三个吗
@@ -430,9 +431,11 @@ onMounted(() => {
 
 })
 //获取当前时间
-const getStartTime = () => {
-    let date = new Date()
-    startTime.value = format(date, "yyyy-MM-dd HH:mm:ss");
+const getStartTime = async () => {
+    let res: any = await getCurrentTimeApi();
+    // let date = new Date()
+    startTime.value = res.data;
+    // startTime.value = format(date, "yyyy-MM-dd HH:mm:ss");
 }
 
 //根据flag 获取当前的题目
@@ -626,6 +629,8 @@ onUnmounted(() => {
 
             .xlts_img {
                 margin-right: 60px;
+                width: 40px;
+                height: 30px;
                 // width: 100px;
             }
 

+ 10 - 2
src/views/shapeIntuition_random.vue

@@ -60,6 +60,7 @@ import { saveEggRecordApi } from '@/api/record'
 import { format as myFormat } from 'date-fns';
 import { userPlanDetailApi } from '@/api/home';
 import CpdmMessage from '@/components/CpdmMessageV2.vue';
+import { getCurrentTimeApi } from '@/api/plan';
 const userInfo = userInfoStore()
 
 export default {
@@ -108,6 +109,7 @@ export default {
       flagName: '',
       formalTest: '',
       beginTime: '',
+      getCurrentTimeApi: getCurrentTimeApi,
       userPlanDetailApi: userPlanDetailApi,
       correctTxt: '正确',
       showCorrectTxt: false,
@@ -130,8 +132,8 @@ export default {
     this.flagName = this.$route.params.flagName;
     //
     this.formalTest = this.$route.params.formalTest;
-
-    this.beginTime = myFormat(new Date().getTime(), "yyyy-MM-dd HH:mm:ss")
+    this.getStartTime()
+    // this.beginTime = myFormat(new Date().getTime(), "yyyy-MM-dd HH:mm:ss")
 
     //拿到是练习测试还是正式测试
     this.init(this.formalTest);
@@ -142,6 +144,12 @@ export default {
     clearTimeout(this.timeTwo);
   },
   methods: {
+    async getStartTime() {
+      let res = await getCurrentTimeApi();
+      // let date = new Date()
+      this.beginTime = res.data;
+      // startTime.value = format(date, "yyyy-MM-dd HH:mm:ss");
+    },
     // messageFun() {
     //   this.$refs.cpdmMe.open()
     // },

+ 4 - 0
vite.config.ts

@@ -18,6 +18,10 @@ export default defineConfig({
     vue(),
     vueJsx(),
   ],
+  server: {				// ← ← ← ← ← ←
+    host: '0.0.0.0',	// ← 新增内容 ←
+    // port: 8991,
+  },
   resolve: {
     alias: {
       '@': fileURLToPath(new URL('./src', import.meta.url))