获取时区
This commit is contained in:
		
							parent
							
								
									97a5090e0f
								
							
						
					
					
						commit
						49edb01a3f
					
				| @ -16,6 +16,7 @@ import { provideI18n } from "@/utils/i18n" | |||||||
| import i18ninit from "@/i18n/init" | import i18ninit from "@/i18n/init" | ||||||
| import enUS from 'ant-design-vue/es/locale/en_US'; | import enUS from 'ant-design-vue/es/locale/en_US'; | ||||||
| import zhCN from 'ant-design-vue/es/locale/zh_CN'; | import zhCN from 'ant-design-vue/es/locale/zh_CN'; | ||||||
|  | import dayjs from 'dayjs'; | ||||||
| 
 | 
 | ||||||
| export default defineComponent({ | export default defineComponent({ | ||||||
|   setup(){ |   setup(){ | ||||||
| @ -34,6 +35,14 @@ export default defineComponent({ | |||||||
|     } |     } | ||||||
|     const zh = zhCN |     const zh = zhCN | ||||||
|     const en = enUS |     const en = enUS | ||||||
|  |     /* eslint-disable */ | ||||||
|  |     const utc = require('dayjs/plugin/utc') // dependent on utc plugin | ||||||
|  |     /* eslint-disable */ | ||||||
|  |     const timezone = require('dayjs/plugin/timezone') | ||||||
|  |     const days: any = dayjs; | ||||||
|  |     dayjs.extend(utc) | ||||||
|  |     dayjs.extend(timezone) | ||||||
|  |     console.log(days.tz.guess()) | ||||||
|     return{ |     return{ | ||||||
|       zh, |       zh, | ||||||
|       en, |       en, | ||||||
|  | |||||||
| @ -3,6 +3,7 @@ import store from '@/store'; | |||||||
| import { LiveList, LivelistInfo, LoginData, UserInfo } from '@/types'; | import { LiveList, LivelistInfo, LoginData, UserInfo } from '@/types'; | ||||||
| import { getValue, saveValue } from '@/utils/common'; | import { getValue, saveValue } from '@/utils/common'; | ||||||
| import { message } from 'ant-design-vue'; | import { message } from 'ant-design-vue'; | ||||||
|  | import dayjs from 'dayjs'; | ||||||
| import { del, get, post, put, setToken } from './base' | import { del, get, post, put, setToken } from './base' | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -885,6 +886,14 @@ export async function checksmscode(phone: string, smscode: string){ | |||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| export async function register(data: any){ | export async function register(data: any){ | ||||||
|  |     /* eslint-disable */ | ||||||
|  |     const utc = require('dayjs/plugin/utc') // dependent on utc plugin
 | ||||||
|  |     /* eslint-disable */ | ||||||
|  |     const timezone = require('dayjs/plugin/timezone') | ||||||
|  |     const days: any = dayjs; | ||||||
|  |     dayjs.extend(utc) | ||||||
|  |     dayjs.extend(timezone) | ||||||
|  | 
 | ||||||
|     const res = await post<any>("register",{ |     const res = await post<any>("register",{ | ||||||
|         mobile: data.phone, |         mobile: data.phone, | ||||||
|         code: data.quhao, |         code: data.quhao, | ||||||
| @ -894,7 +903,9 @@ export async function register(data: any){ | |||||||
|         email: data.emil, |         email: data.emil, | ||||||
|         mtongue: data.muyu, |         mtongue: data.muyu, | ||||||
|         tlanguage: data.jiaoshou, |         tlanguage: data.jiaoshou, | ||||||
|         language: getValue("Lanvuage") || 'zh'  |         language: getValue("Lanvuage") || 'zh', | ||||||
|  |         zoneid: days.tz.guess() | ||||||
|  | 
 | ||||||
|     }) |     }) | ||||||
|     if(res.code == 0){ |     if(res.code == 0){ | ||||||
|         message.success(res.msg) |         message.success(res.msg) | ||||||
|  | |||||||
| @ -1,4 +1,5 @@ | |||||||
| { | { | ||||||
|  |   "defaultSeverity": "error", | ||||||
|   "compilerOptions": { |   "compilerOptions": { | ||||||
|     "target": "esnext", |     "target": "esnext", | ||||||
|     "module": "esnext", |     "module": "esnext", | ||||||
| @ -35,6 +36,10 @@ | |||||||
|     "tests/**/*.tsx" |     "tests/**/*.tsx" | ||||||
|   ], |   ], | ||||||
|   "exclude": [ |   "exclude": [ | ||||||
|     "node_modules" |     "node_modules", | ||||||
|   ] |     "tslint:recommended" | ||||||
|  |   ], | ||||||
|  |   "rules": { | ||||||
|  |     "no-var-requires": false | ||||||
|  |   } | ||||||
| } | } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user