import { fetchData, baseUrl, submitData, isDev } from "./fetch"
import Vue from "vue"
//å
¬å¸ç®ä»
export const getCompanyProfile = fetchData('companyProfile')
//é¡¹ç®æ¡ä¾
export const getCaseList = fetchData('allCaseClassifyDetails')
//èç³»æä»¬
export const getContactUs = fetchData('contactUs')
//åä½ä¼ä¼´
export const cooperativePartner = fetchData('cooperativePartner')
//åä½ä¼ä¼´ GET /portal/
export const homeData = fetchData('homeData')
export const honor = fetchData('honor')
export const legalStatement = fetchData('legalStatement')
export const menuList = fetchData('menuList')
export const organizational = fetchData('organizational')
export const productDetails = fetchData('productDetails/{id}')
export const schemeDetails = fetchData('schemeDetails/{id}')
export const technicalSupport = fetchData('technicalSupport')
export const saveOnlineMsg = fetchData('saveOnlineMsg', { method: 'post' })
//æè
export const getJoinInfoList = fetchData('jobInfoList')
export const jobApply = submitData('jobApply')
//æ°é» /portal/addBrowseCount/{newsId}
export const getNewsTypeList = fetchData('getNewsTypeList')
export const getNewsList = fetchData('getNewsList')
export const addBrowseCount = fetchData('addBrowseCount/{id}')
//åæ
龿¥
export const getLinksList = fetchData('getLinksList')
//çè¨ç±»å«
export const getMsgTypeList = fetchData('getMsgTypeList')
export const getIndexBanner = fetchData('indexBanner')
export const getNewsDetail = fetchData('getNewsDetail/{id}')
let isBGY = window.location.host.indexOf('bgysmartcity') > -1
const getImg = (imgName) => {
let host = isBGY ? 'http://www.bgysmartcity.com/' : 'http://120.77.220.34',
src = imgName
if(!/static/.test(imgName)) {
src = `${host}//file/${imgName}`
}
return src
}
const getCode = (str) => {
return `${baseUrl}/portal/captcha.jpg?code=${str}`
}
Vue.prototype.$api = {
technicalSupport, getNewsTypeList, getNewsList, addBrowseCount, getLinksList,
schemeDetails, getMsgTypeList, getIndexBanner, getNewsDetail, getCode,
productDetails,
organizational,
menuList,
legalStatement,
honor,
homeData,
cooperativePartner,
getContactUs,
getCaseList,
getCompanyProfile,
getImg,
getJoinInfoList,
jobApply,
saveOnlineMsg
}
const fetch = require('node-fetch');
const { URLSearchParams } = require('url');
const Message = require('./Message.js');
const Reply = require('./Reply.js');
class User{
#client;
constructor(client, data){
this.#client = client;
if(data.email){
this.private = {};
this.private.email = data.email;
this.private.dob = data.dob;
}
this.uuid = data.uuid;
this.username = data.username;
this.displayname = data.displayname;
this.followers = data.followers;
this.pfp = data.pfp;
this.banner = data.banner;
this.coins = data.coins;
this.rank = data.rank;
this.eventr = data.eventr;
this.patreon = data.patreon;
this.booster = data.booster;
this.bio = data.bio;
this.nsfw = data.nsfw;
this.pronoun = data.pronoun;
this.created_at = data.created_at;
if(data.posts && data.posts.posts !== null){
this.posts = [];
data.posts.forEach(post => {
post.pfp = this.pfp;
this.posts.push(new Message(this.#client, post));
});
}else{
this.posts = null;
}
if(data.replies && data.replies.replies !== null){
this.replies = [];
data.replies.forEach(reply => {
this.replies.push(new Reply(this.#client, reply));
});
}else{
this.replies = null;
}
}
async update(){
if(this.private){
if(!this.#client.token) throw Error("Bubblez.js error: Not logged in yet");
let params = new URLSearchParams();
params.append('token', this.#client.token);
if(this.#client.verbose == true) console.log(`[Bubblez.js] Sending api request to ${this.#client.apiurl}user/check`);
let fetchdata = await fetch(`${this.#client.apiurl}user/check`, {
method: 'POST',
body: params,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(r => r.json());
if(fetchdata.error != undefined){
throw Error(`Bubblez.js error: ${fetchdata.error}`);
}
this.private = {};
this.private.email = fetchdata.email;
this.private.dob = fetchdata.dob;
this.uuid = fetchdata.uuid;
this.username = fetchdata.username;
this.displayname = fetchdata.displayname;
this.pfp = fetchdata.pfp;
this.banner = fetchdata.banner;
this.coins = fetchdata.coins;
this.rank = fetchdata.rank;
this.eventr = fetchdata.eventr;
this.patreon = fetchdata.patreon;
this.booster = fetchdata.booster;
this.bio = fetchdata.bio;
this.nsfw = fetchdata.nsfw;
this.pronoun = fetchdata.pronoun;
this.ban = null;
this.created_at = fetchdata.created_at;
this.last_posted = null;
if(fetchdata.posts && fetchdata.posts.posts !== null){
this.posts = [];
fetchdata.posts.forEach(post => {
this.posts.push(new Message(this.#client, post));
});
}else{
this.posts = null;
}
if(fetchdata.replies && fetchdata.replies.replies !== null){
this.replies = [];
fetchdata.replies.forEach(reply => {
this.replies.push(new Reply(this.#client, reply));
});
}else{
this.replies = null;
}
return this;
}else{
if(!this.#client.token) throw Error("Bubblez.js error: Not logged in yet");
let params = new URLSearchParams();
params.append('username', this.#client.user.username);
params.append('token', this.#client.token);
if(this.#client.verbose == true) console.log(`[Bubblez.js] Sending api request to ${this.#client.apiurl}user/get`);
let fetchdata = await fetch(`${this.#client.apiurl}user/get`, {
method: 'POST',
body: params,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
}).then(r => r.json());
if(fetchdata.error != undefined){
throw Error(`Bubblez.js error: ${fetchdata.error}`);
}
this.uuid = fetchdata.uuid;
this.username = fetchdata.username;
this.displayname = fetchdata.displayname;
this.followers = fetchdata.followers;
this.pfp = fetchdata.pfp;
this.banner = fetchdata.banner;
this.coins = fetchdata.coins;
this.rank = fetchdata.rank;
this.eventr = fetchdata.eventr;
this.patreon = fetchdata.patreon;
this.booster = fetchdata.booster;
this.bio = fetchdata.bio;
this.nsfw = fetchdata.nsfw;
this.pronoun = fetchdata.pronoun;
this.ban = fetchdata.ban;
this.created_at = fetchdata.created_at;
this.last_posted = fetchdata.last_posted;
if(fetchdata.posts && fetchdata.posts.posts !== null){
this.posts = [];
fetchdata.posts.forEach(post => {
this.posts.push(new Message(this.#client, post));
});
}else{
this.posts = null;
}
return this;
}
}
}
module.exports = User;
import React from "react";
import ListItem from "../ListItem";
import "./navbar.css";
const Navbar = ({ dispatch, fetchdata }) => {
return (
<ul id="navBar">
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={1} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={2} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={3} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={4} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={5} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={6} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={6} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={7} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={8} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={9} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={10} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={11} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={12} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={13} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={14} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={15} />
<ListItem dispatch={dispatch} fetchdata={fetchdata} weekNumber={16} />
</ul>
);
};
export default Navbar;