diff --git a/src/App.vue b/src/App.vue index d574b12..f2e6b6c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -17,6 +17,7 @@ import i18ninit from "@/i18n/init" import enUS from 'ant-design-vue/es/locale/en_US'; import zhCN from 'ant-design-vue/es/locale/zh_CN'; import dayjs from 'dayjs'; +import { getaddr } from './api'; export default defineComponent({ setup(){ @@ -24,6 +25,7 @@ export default defineComponent({ const len = provideI18n(i18ninit); // len.locale.value = !getValue("Lanvuage") ? 'zh' : getValue("Lanvuage"); if(getValue('token')){ + console.log("token") store.commit("login", true) store.dispatch("setUserInfo"); }else{ diff --git a/src/api/index.ts b/src/api/index.ts index 1348f6e..3a577cc 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -783,6 +783,7 @@ export async function putmember(data: any): Promise{ } console.log(newdata) const res = await put(`member/${store.state.userinfo.memberid}`, newdata) + store.dispatch("setUserInfo"); return res; } @@ -1038,28 +1039,63 @@ export async function luzhi(roomid: string){ console.log(res) } -export async function getaddr() { - const res = await get('ip'); - const gj = res.data.address.split("|")[0]; - const lan = getValue("Lanvuage"); - const qh = await get('countryCode', { - longitude: res.data.content.point.x, - latitude: res.data.content.point.y - }); - console.log(qh) - if(lan != null && lan){ - if(gj == "CN"){ - return {hb: '人民币¥', qh}; - }else { - return {hb: '美元$'} +export function getaddr() { + return new Promise((r)=>{ + console.log("开始定位") + const lan = getValue("Lanvuage"); + if ("geolocation" in navigator) { + /* 地理位置服务可用 */ + navigator.geolocation.getCurrentPosition(async (res) => { + console.log(res, 'res') + const qh = await get('countryCode', { + longitude: res.coords.longitude, + latitude: res.coords.latitude + }); + console.log(qh) + if(lan != null && lan){ + if(qh.data.ename == "China"){ + r({hb: '人民币¥', qh}); + }else { + r({hb: '美元$'}) + } + }else{ + if(qh.data.ename == "China"){ + r({yy: "zh", yyx: "中文", hb: '人民币¥', qh}); + }else { + r({yy: 'en', yyx: 'English', hb: '美元$', qh}) + } + } + },(err) => { + message.error(err.message) + console.log(err, 'err') + }) + } else { + /* 地理位置服务不可用 */ + console.log("无法定位") } - }else{ - if(gj == "CN"){ - return {yy: "zh", yyx: "中文", hb: '人民币¥', qh}; - }else { - return {yy: 'en', yyx: 'English', hb: '美元$', qh} - } - } + }) + + // const res = await get('ip'); + // const gj = res.data.address.split("|")[0]; + // const lan = getValue("Lanvuage"); + // const qh = await get('countryCode', { + // longitude: res.data.content.point.x, + // latitude: res.data.content.point.y + // }); + // console.log(qh) + // if(lan != null && lan){ + // if(gj == "CN"){ + // return {hb: '人民币¥', qh}; + // }else { + // return {hb: '美元$'} + // } + // }else{ + // if(gj == "CN"){ + // return {yy: "zh", yyx: "中文", hb: '人民币¥', qh}; + // }else { + // return {yy: 'en', yyx: 'English', hb: '美元$', qh} + // } + // } } @@ -1080,10 +1116,20 @@ export async function getset() { export async function setheadimg(src: string){ const res = await put(`member/${store.state.userinfo.memberid}`,{img: src}); + if(res.code == 0){ + message.success(res.msg) + }else{ + message.error(res.msg); + } console.log(res) } export async function setusername(src: string){ const res = await put(`member/${store.state.userinfo.memberid}`,{name: src}); + if(res.code == 0){ + message.success(res.msg) + }else{ + message.error(res.msg); + } console.log(res) } diff --git a/src/components/LiveItem.vue b/src/components/LiveItem.vue index ebe09ef..1763edf 100644 --- a/src/components/LiveItem.vue +++ b/src/components/LiveItem.vue @@ -4,7 +4,7 @@
{{title}}
- {{score}} {{lan.$t('fen')}} + {{score}}
diff --git a/src/components/ReviewItem.vue b/src/components/ReviewItem.vue index fd3e17c..fbdc521 100644 --- a/src/components/ReviewItem.vue +++ b/src/components/ReviewItem.vue @@ -11,7 +11,7 @@
-
{{(score+'').split('.')[1]?score:score+'.0'}} {{lan.$t('fen')}}
+
{{(score+'').split('.')[1]?score:score+'.0'}}
{{lan.$t('suoyouhuifu')}} diff --git a/src/i18n/en.ts b/src/i18n/en.ts index a1d3fcc..3131299 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -1,29 +1,29 @@ export default { - zhiboguanli: "Live broadcast management", - shipinguanli: "Video management", - dingyuezheguanli: "Subscriber management", - gerenzhongxin: "Personal Center", + zhiboguanli: "Live", + shipinguanli: "Vide", + dingyuezheguanli: "Followers", + gerenzhongxin: "Profile", rili: "calendar", - quanbuzhibo: "All live", - weikaishi: "Not started", - yijieshu: "Finished", + quanbuzhibo: "All", + weikaishi: "Planning", + yijieshu: "Completed", zhibosousuo: "Please enter the live title you want to search", haiweikaishi: "Not yet", jinruzhibo: "Enter live", - chakanhuifang: "View playback", - quanbushipin: "All videos", - shenhezhong: "Under review", + chakanhuifang: "Replay", + quanbushipin: "All", + shenhezhong: "Reviewing", weitongguo: "Failed", yifabu: "Published", shipinsousuo: "Please enter the live title you want to search", wodedingyuezhe: "My subscribers", xingming: "name", - suozaiguojia: "Country of residence", + suozaiguojia: "Country", nianling: "Age", - xueshengmuyu: "Students' mother tongue", - xingqudian: "Points of interest", + xueshengmuyu: "Speak", + xingqudian: "Learn", yuyandengji: "Language level", - canyupingtaishichang: "Total duration of live broadcast on the platform", + canyupingtaishichang: "Attended course", sousuoxuesheng: "Please enter the name of the student you want to search", huanying: "Hello, welcome", beelink: "Beelink", @@ -173,7 +173,7 @@ export default { querenjujue: "Confirm rejection", zhiboyemian: "Live page", querenguanbi: "Are you sure you want to close the live broadcast", - dingyuezhe: "My subscribers", + dingyuezhe: "My Followers", sousuodingyue: "Please enter the name of the student you want to search", wodeqianbao: "My wallet", lijitixian: "Immediate withdrawal", @@ -303,7 +303,7 @@ export default { cshipinyaoqiu1: "The video should be no longer than 10 minutes", cshipinyaoqiu2: "Video size cannot exceed 500M", shangchuanwancheng: "Please wait for the file to be uploaded", - zhanghaocunzai: "account already exists", + zhanghaocunzai: "This number is already registered as a student", shouruguize: "Description of revenue rules", shouru1: "Live Revenue=Actual attendess x Actual duration x unit price", shouru2: "1 on 1, 20€/hour; 1 on N, 10€/hour/person, (1{ en.tixianzhu = `Note: ${res.sxf} service fee will be charged for each withdrawal, with a minimum of ${ res.symbol + res.minmoney }` zh.zuiditixian = "最低提现金额" + res.symbol + res.minwithdraw en.zuiditixian = "Minimum withdrawal amount " + res.symbol + res.minwithdraw - zh.zhibotishi = `恭喜您在beelink有直播课资格。直播资格按照每周浏览量排名,前${res.views}名基本直播资格。` - en.zhibotishi = `Congratulations on your qualification for beelink live streaming course. The top ${res.views} basic live streaming qualifications are ranked according to the number of views per week` + zh.zhibotishi = `直播资格按照每周浏览量排名,前${res.views}名基本直播资格。` + en.zhibotishi = `The top ${res.views} basic live streaming qualifications are ranked according to the number of views per week` const i18n = geti18n(); const loc = i18n.locale.value; i18n.locale.value = ''; diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts index 3cdef6e..d70d87b 100644 --- a/src/i18n/zh.ts +++ b/src/i18n/zh.ts @@ -303,7 +303,7 @@ export default { cshipinyaoqiu1: "视频长度不能超过10分钟", cshipinyaoqiu2: "视频大小不能超过500m", shangchuanwancheng: "请等待文件上传完成", - zhanghaocunzai: "帐号已存在", + zhanghaocunzai: "该手机已注册学生端账号", shuoruguize: "收入规则说明", shouru1: "直播收入=实际参加学生数x参加时长x单价", shouru2: "单价:1对1,20欧/小时;1对N,10欧/小时/人(1 size){ - message.error("最大2MB") + message.error(lan.$t('zuida') + "2MB") return false; } let istype = false @@ -93,13 +95,13 @@ export function provenvideo(file: any, isvideo?: boolean): boolean{ if(isvideo){ const size = 500 * 1024 * 1024; if(file.size > size){ - message.error("最大500MB") + message.error(lan.$t('zuida') + "500MB") return false; } }else{ const size = 100 * 1024 * 1024; if(file.size > size){ - message.error("最大100MB") + message.error(lan.$t('zuida') + "100MB") return false; } } @@ -108,5 +110,6 @@ export function provenvideo(file: any, isvideo?: boolean): boolean{ return true; } } + message.error(lan.$t("leixingcuowu")) return false; } \ No newline at end of file diff --git a/src/utils/date.ts b/src/utils/date.ts index fdad371..2e43f61 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -15,11 +15,16 @@ interface GetDate{ end: string; } -export function getdate(yue?: number): GetDate{ - let now = dayjs() - if(yue != undefined){ - now = now.month(now.month() + yue); - } +export function getdate(yue: number,id: string): GetDate{ + /* eslint-disable */ + const utc = require('dayjs/plugin/utc') // dependent on utc plugin + /* eslint-disable */ + const timezone = require('dayjs/plugin/timezone') + dayjs.extend(utc) + dayjs.extend(timezone) + const days: any = dayjs; + let now = days().tz(id) + now = now.month(now.month() + yue); yue = now.month() + 1; const day = now.date() // 当前天 const zhou = now.day(); // 当前周 diff --git a/src/views/login/Sign.vue b/src/views/login/Sign.vue index 78d71f0..a9a5b39 100644 --- a/src/views/login/Sign.vue +++ b/src/views/login/Sign.vue @@ -294,7 +294,7 @@ export default defineComponent({ } const iszc = await checkuser({phone: phone.value.phone}) if(iszc.data){ - message.error(lan.$t('zhanghaocunzai')) + message.error(iszc.msg) return ; } lock = true; diff --git a/src/views/mine/Archives.vue b/src/views/mine/Archives.vue index 2134965..cbab9d8 100644 --- a/src/views/mine/Archives.vue +++ b/src/views/mine/Archives.vue @@ -507,7 +507,11 @@
-

{{lan.$t('huobitishi')}}

+
+ +

{{lan.$t('huobitishi')}}

+
+
@@ -960,7 +964,8 @@ export default defineComponent({ issum = false; const res = await uploadflie(file.file, (info: any) => { console.log(info); - const jindu = info.percent.toFixed(2) * 100 + let jindu: number = info.percent.toFixed(2) * 100; + jindu = parseInt(jindu + ""); uploadprogress.value = jindu > 0 ? jindu : 1; }); userinfo.value.video = res.video.url; @@ -1107,6 +1112,7 @@ export default defineComponent({