请求401处理
This commit is contained in:
parent
5b045fe90b
commit
009da9d985
@ -390,9 +390,10 @@
|
||||
this.nowteaminfos = this.aboutObj.teamlist[index];
|
||||
},
|
||||
async getAbouts(){
|
||||
let res = await axios.get(baseUrl+'api/index/about');
|
||||
if (res.data.code === 1) {
|
||||
this.aboutObj = res.data.data;
|
||||
let res = await publikRequesFunction('api/index/about','get',{});
|
||||
console.log(res,'nowRequest');
|
||||
if (res.code === 1) {
|
||||
this.aboutObj = res.data;
|
||||
this.nowteaminfos = this.aboutObj.teamlist[0];
|
||||
}
|
||||
}
|
||||
|
@ -330,21 +330,15 @@
|
||||
// 返回格式化后的日期字符串
|
||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
},
|
||||
getallorderList(){
|
||||
async getallorderList(){
|
||||
this.tableLoading = true;
|
||||
let _that = this;
|
||||
$.ajax({
|
||||
url: `${baseUrl}api/project/getorderlist`,
|
||||
type: "get",
|
||||
data: {
|
||||
const params = {
|
||||
..._that.orderSearchObj,
|
||||
trade: _that.timeFilter,
|
||||
state: _that.activeTab
|
||||
},
|
||||
headers: {
|
||||
token: _that.userInfoObj.token
|
||||
},
|
||||
success(res){
|
||||
};
|
||||
let res = await publikRequesFunction('api/project/getorderlist','get',params);
|
||||
if (res.code === 1) {
|
||||
_that.orderListObj = res.data;
|
||||
_that.tableLoading = false;
|
||||
@ -352,11 +346,6 @@
|
||||
_that.$message.error(res.msg)
|
||||
}
|
||||
},
|
||||
error(error) {
|
||||
_that.$message.error(error)
|
||||
}
|
||||
})
|
||||
},
|
||||
changeTab(tab) {
|
||||
this.activeTab = tab;
|
||||
this.orderSearchObj.page = 1;
|
||||
@ -448,7 +437,7 @@
|
||||
this.orderLoading.close();
|
||||
}
|
||||
},
|
||||
submitOrderHash(id,tx){
|
||||
async submitOrderHash(id,tx){
|
||||
//求购卖出支付结果api/project/wtbrevpayres
|
||||
//买入支付结果api/common/payresult
|
||||
let api = "";
|
||||
@ -462,14 +451,7 @@
|
||||
obj = { wtbid: id,tx }
|
||||
}
|
||||
try {
|
||||
$.ajax({
|
||||
url: `${baseUrl + api}`,
|
||||
type: "post",
|
||||
data: {...obj},
|
||||
headers: {
|
||||
token: _that.userInfoObj.token
|
||||
},
|
||||
success(res){
|
||||
let res = await publikRequesFunction(api,'post',obj);
|
||||
if (res.code === 1) {
|
||||
_that.$message.success('success');
|
||||
_that.orderLoading.close();
|
||||
@ -479,11 +461,6 @@
|
||||
} else {
|
||||
_that.$message.error(res.msg)
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
_that.$message.error(err)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
_that.$message.error(error)
|
||||
}
|
||||
|
18
contact.html
18
contact.html
@ -293,7 +293,7 @@
|
||||
});
|
||||
},
|
||||
methods:{
|
||||
sendContact(){
|
||||
async sendContact(){
|
||||
let _that = this;
|
||||
let tipMessage = this.currentLanguage == 'zh' ? '請輸入完整信息' : "Please enter complete information";
|
||||
if(!this.firstName || !this.secondName || !this.contactObj.email || !this.contactObj.contact){
|
||||
@ -301,16 +301,7 @@
|
||||
return
|
||||
}
|
||||
this.contactObj.name = this.firstName + this.secondName;
|
||||
$.ajax({
|
||||
url:`${baseUrl}api/common/contactus`,
|
||||
data:{
|
||||
..._that.contactObj
|
||||
},
|
||||
headers:{
|
||||
token: this.userToken
|
||||
},
|
||||
type:"post",
|
||||
success(res){
|
||||
let res = await publikRequesFunction('api/common/contactus','post',{..._that.contactObj});
|
||||
if(res.code === 1){
|
||||
_that.firstName = "";
|
||||
_that.secondName = "";
|
||||
@ -320,11 +311,6 @@
|
||||
_that.$message.error("failed");
|
||||
}
|
||||
},
|
||||
error(err){
|
||||
_that.$message.error("failed");
|
||||
}
|
||||
});
|
||||
},
|
||||
// <-- -------------------------錢包登錄開始 --------------------------->
|
||||
copyText(txt){
|
||||
let message = this.currentLanguage == 'zh' ? '複製成功!' : 'Copy successful!';
|
||||
|
@ -271,7 +271,6 @@
|
||||
if (user) {
|
||||
this.userIsLogin = true;
|
||||
}
|
||||
this.getgamesInfo();
|
||||
// 钱包登录开始
|
||||
const provider = window.web3?.currentProvider;
|
||||
let accounts1 = [];
|
||||
@ -404,9 +403,9 @@
|
||||
this.currentLanguage = mobileLang()
|
||||
},
|
||||
async getgamesInfo(){
|
||||
let res = await axios.get(baseUrl+"api/index/gameinfo");
|
||||
if(res.data.code == 1){
|
||||
this.gamesinfomation = res.data.data;
|
||||
let res = await publikRequesFunction('api/index/gameinfo','get',{});
|
||||
if(res.code == 1){
|
||||
this.gamesinfomation = res.data;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
127
index.html
127
index.html
@ -573,7 +573,6 @@
|
||||
downloadObj: {},
|
||||
pageIngomation: [],
|
||||
videoList: [],
|
||||
categoriesTabList: [],
|
||||
outlookList: [],
|
||||
saleList: [],//限時商品列表
|
||||
times: {
|
||||
@ -609,7 +608,6 @@
|
||||
}
|
||||
this.getDownload();
|
||||
this.getgamesVideo();
|
||||
this.getCategoriestable();
|
||||
this.getOutlook();
|
||||
this.loadCloseAuth()
|
||||
this.loadSaleList();
|
||||
@ -764,22 +762,12 @@
|
||||
mobileLang() {
|
||||
this.currentLanguage = mobileLang()
|
||||
},
|
||||
getRoleList() {
|
||||
let _that = this;
|
||||
$.ajax({
|
||||
url: baseUrl+"api/index/getrole",
|
||||
type: 'get',
|
||||
dataType: "json",
|
||||
success(res) {
|
||||
async getRoleList() {
|
||||
let res = await publikRequesFunction('api/index/getrole','get',{});
|
||||
if (res.code === 1) {
|
||||
_that.roleList = res.data;
|
||||
this.roleList = res.data;
|
||||
}
|
||||
},
|
||||
error(rej) {
|
||||
console.log("failed");
|
||||
}
|
||||
})
|
||||
},
|
||||
//新聞詳情
|
||||
toNewDetail() {
|
||||
window.location.href = "news-detail.html?id=" + this.nowhotnews.id
|
||||
@ -826,13 +814,8 @@
|
||||
// this.$message.success('success');
|
||||
},
|
||||
async orderPayResult(id, tx) {
|
||||
let res = await axios.post(baseUrl+'api/common/payresult', { id, tx }, { headers: { 'token': this.token, 'Content-Type': 'application/json' } });
|
||||
if (res.data.code === 1) {
|
||||
// if (this.orderList[this.orderList.length - 1].id == id) {
|
||||
// this.orderLoading.close();
|
||||
// }
|
||||
} else {
|
||||
// this.orderLoading.close();
|
||||
let res = await publikRequesFunction('api/common/payresult','post',{id, tx});
|
||||
if (res.code != 1) {
|
||||
this.$message.error('error');
|
||||
}
|
||||
},
|
||||
@ -845,28 +828,21 @@
|
||||
}
|
||||
this.buy.fromaddress = this.userMoneyAdressAll;
|
||||
let tipMessage = this.currentLanguage == 'zh' ? '交易中,請勿刷新頁面...' : 'During the transaction, please do not refresh the page';
|
||||
// this.orderLoading = this.$loading({ lock: true, text: tipMessage, spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' });
|
||||
let res = await axios.post(baseUrl+'api/project/createpurchaseorder', { ...this.buy }, {
|
||||
headers: {
|
||||
'token': this.token, // 使用 Bearer 認證方式攜帶 Token
|
||||
'Content-Type': 'application/json' // 確保發送 JSON 格式的數據
|
||||
}
|
||||
})
|
||||
let res = await publikRequesFunction('api/project/createpurchaseorder','post',{...this.buy});
|
||||
console.log(res, '订单');
|
||||
if (res.data.code === 1) {
|
||||
this.orderList = res.data.data;
|
||||
if (res.code === 1) {
|
||||
this.orderList = res.data;
|
||||
this.buyButtonVisible = false;
|
||||
this.websentMoney();
|
||||
} else {
|
||||
this.$message.error(res.data.msg);
|
||||
// this.orderLoading.close();
|
||||
this.$message.error(res.msg);
|
||||
}
|
||||
},
|
||||
//獲取限時折購商品
|
||||
async loadSaleList() {
|
||||
let res = await axios.get(`${baseUrl}api/index/getpurchase`);
|
||||
if (res.data.code === 1) {
|
||||
this.saleList = res.data.data;
|
||||
let res = await publikRequesFunction('api/index/getpurchase','get',{});
|
||||
if (res.code === 1) {
|
||||
this.saleList = res.data;
|
||||
this.isShowSale = this.saleList.length > 0
|
||||
setInterval(() => {
|
||||
if (this.currentSaleIndex === this.saleList.length - 1) {
|
||||
@ -885,58 +861,40 @@
|
||||
window.location.href = 'login.html'
|
||||
},
|
||||
async getOutlook() {
|
||||
let res = await axios.get(`${baseUrl}api/index/getlist?
|
||||
cateid=4&
|
||||
keywordsen=&
|
||||
keywordscn=&
|
||||
page=1&
|
||||
listrow=5&
|
||||
`);
|
||||
if (res.data.code === 1) {
|
||||
this.outlookList = res.data.data.data;
|
||||
}
|
||||
},
|
||||
async getCategoriestable() {
|
||||
let res = await axios.get(`${baseUrl}api/index/getlist?
|
||||
cateid=1&
|
||||
keywordsen=&
|
||||
keywordscn=&
|
||||
page=1&
|
||||
listrow=4&
|
||||
`);
|
||||
if (res.data.code === 1) {
|
||||
this.categoriesTabList = res.data.data.data;
|
||||
let res = await publikRequesFunction('api/index/getlist','get',{
|
||||
cateid:4,
|
||||
keywordsen:"",
|
||||
keywordscn:"",
|
||||
page:1,
|
||||
listrow:5,
|
||||
});
|
||||
if (res.code === 1) {
|
||||
this.outlookList = res.data.data;
|
||||
}
|
||||
},
|
||||
async getgamesVideo() {
|
||||
let res = await axios.get(baseUrl+'api/index/getmedia?page=1&listrow=8');
|
||||
if (res.data.code === 1) {
|
||||
this.videoList = res.data.data.data;
|
||||
console.log(this.videoList,'ssxxx');
|
||||
|
||||
let res = await publikRequesFunction('api/index/getmedia','get',{page:1,listrow:8});
|
||||
if (res.code === 1) {
|
||||
this.videoList = res.data.data;
|
||||
}
|
||||
},
|
||||
async getDownload() {
|
||||
let res = await axios.get(baseUrl+'api/');
|
||||
if (res.data.code === 1) {
|
||||
this.downloadObj = res.data.data;
|
||||
let res = await publikRequesFunction('api/','get',{});
|
||||
if (res.code === 1) {
|
||||
this.downloadObj = res.data;
|
||||
}
|
||||
},
|
||||
async getInfomation() {
|
||||
let res = await axios.get(`${baseUrl}api/index/getlist?
|
||||
cateid=3&
|
||||
keywordsen=&
|
||||
keywordscn=&
|
||||
page=1&
|
||||
listrow=4&
|
||||
`);
|
||||
if (res.data.code === 1) {
|
||||
this.pageIngomation = res.data.data.data;
|
||||
let res = await publikRequesFunction('api/index/getlist','get',{
|
||||
cateid:3,
|
||||
keywordsen:"",
|
||||
keywordscn:"",
|
||||
page:1,
|
||||
listrow:4,
|
||||
});
|
||||
if (res.code === 1) {
|
||||
this.pageIngomation = res.data.data;
|
||||
this.hotnewsindex(0)
|
||||
// setTimeout(()=>{
|
||||
// const container = this.$refs.container;
|
||||
// container.clientHeight > 188 && this.$refs.newsLeft.classList.add('ellipsis');
|
||||
// },500)
|
||||
}
|
||||
},
|
||||
optionsTemp(timestamp) {
|
||||
@ -947,16 +905,15 @@
|
||||
return Y + M + D;
|
||||
},
|
||||
//请求获取显示抢购弹框关闭按钮权限
|
||||
loadCloseAuth() {
|
||||
axios.get(baseUrl+'api/index/getcloseauth').then(res => {
|
||||
if (res.data.code === 1) {
|
||||
console.log(res.data.data, 6666)
|
||||
this.isShowClose = Boolean(res.data.data.closeauth)
|
||||
async loadCloseAuth() {
|
||||
let res = await publikRequesFunction('api/index/getcloseauth','get',{});
|
||||
if (res.code === 1) {
|
||||
console.log(res.data, 6666)
|
||||
this.isShowClose = Boolean(res.data.closeauth)
|
||||
this.interval = setInterval(() => {
|
||||
this.updateCountdown(res.data.data.purastarttime)
|
||||
this.updateCountdown(res.data.purastarttime)
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 更新倒計時的函數
|
||||
|
@ -384,9 +384,9 @@
|
||||
this.page = val;
|
||||
},
|
||||
async getonrules() {
|
||||
let res = await axios.get(baseUrl+'api/user/getrewardrule');
|
||||
if (res.data.code == 1) {
|
||||
this.rewardRules = res.data.data;
|
||||
let res = await publikRequesFunction('api/user/getrewardrule','get',{});
|
||||
if (res.code == 1) {
|
||||
this.rewardRules = res.data;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -247,7 +247,6 @@
|
||||
}
|
||||
});
|
||||
this.getReadDetail();
|
||||
|
||||
},
|
||||
methods: {
|
||||
// <-- -------------------------钱包登录开始 --------------------------->
|
||||
@ -358,12 +357,9 @@
|
||||
return Y + M + D;
|
||||
},
|
||||
async getReadDetail() {
|
||||
let res = await axios.get(`
|
||||
${baseUrl}api/index/getdetail?
|
||||
id=${this.readId}
|
||||
`);
|
||||
if (res.data.code === 1) {
|
||||
let news = JSON.stringify(res.data.data);
|
||||
let res = await publikRequesFunction('api/index/getdetail','get',{id:this.readId});
|
||||
if (res.code === 1) {
|
||||
let news = JSON.stringify(res.data);
|
||||
news = news.replaceAll('samsar Dao','Samsara Dao').replaceAll('Samsar Dao','Samsara Dao')
|
||||
this.readeDetalObj = JSON.parse(news)
|
||||
}
|
||||
|
20
news.html
20
news.html
@ -416,16 +416,16 @@
|
||||
return Y + M + D;
|
||||
},
|
||||
async getCategoriestable() {
|
||||
let res = await axios.get(`${baseUrl}api/index/getlist?
|
||||
cateid=3&
|
||||
keywordsen=&
|
||||
keywordscn=&
|
||||
page=${this.page}&
|
||||
listrow=${this.listrow}&
|
||||
`);
|
||||
if (res.data.code === 1) {
|
||||
this.categoriesTabList = res.data.data
|
||||
this.categoriesTabList.data = res.data.data.data.map(item=>{
|
||||
let res = await publikRequesFunction('api/index/getlist','get',{
|
||||
cateid:3,
|
||||
keywordsen:"",
|
||||
keywordscn:"",
|
||||
page:this.page,
|
||||
listrow:this.listrow
|
||||
});
|
||||
if (res.code === 1) {
|
||||
this.categoriesTabList = res.data
|
||||
this.categoriesTabList.data = res.data.data.map(item=>{
|
||||
item.sub_en = item.sub_en.replaceAll('samsar Dao','Samsara Dao').replaceAll('Samsar Dao','Samsara Dao')
|
||||
item.title_en = item.title_en.replaceAll('samsar Dao','Samsara Dao').replaceAll('Samsar Dao','Samsara Dao')
|
||||
item.text_en = item.text_en.replaceAll('samsar Dao','Samsara Dao').replaceAll('Samsar Dao','Samsara Dao')
|
||||
|
116
nft.html
116
nft.html
@ -706,22 +706,15 @@
|
||||
_that.$message("Failed");
|
||||
});
|
||||
},
|
||||
creatRenewalOrder(){
|
||||
async creatRenewalOrder(){
|
||||
let _that = this;
|
||||
let tip = this.currentLanguage == 'zh' ? '提示' : 'tips';
|
||||
let confirm = this.currentLanguage == 'zh' ? '確定' : 'confirm';
|
||||
let cancel = this.currentLanguage == 'zh' ? '取消' : 'cancel';
|
||||
$.ajax({
|
||||
url: `${baseUrl}api/project/leasenft`,
|
||||
type: "post",
|
||||
data: {
|
||||
let res = await publikRequesFunction('api/project/leasenft','post',{
|
||||
id: _that.nftrenewalInfos.id,
|
||||
fromaddress:_that.userMoneyAdressAll
|
||||
},
|
||||
headers:{
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res) {
|
||||
});
|
||||
if (res.code === 1) {
|
||||
let tipmessage = _that.currentLanguage == 'zh' ? `請前往支付<span style="color:red;">續租費${res.data.bnb} BNB(包含GAS費:${res.data.gasfee} BNB)</span>` : `Please go to pay the <span style="color:red;">renewal fee ${res.data.bnb} BNB (including GAS fee: ${res.data.gasfee} BNB)</span>`;
|
||||
_that.$confirm(tipmessage, tip, {
|
||||
@ -739,11 +732,6 @@
|
||||
_that.$message.error(res.msg)
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
_that.$message.error(err)
|
||||
}
|
||||
});
|
||||
},
|
||||
submitNft() {
|
||||
let _that = this;
|
||||
let message = _that.currentLanguage == 'zh' ? '請輸入完整資訊' : 'Please enter complete information';
|
||||
@ -763,7 +751,7 @@
|
||||
_that.creatOrder()
|
||||
},
|
||||
//創建交易訂單
|
||||
creatOrder(){
|
||||
async creatOrder(){
|
||||
let tip = this.currentLanguage == 'zh' ? '提示' : 'tips';
|
||||
let confirm = this.currentLanguage == 'zh' ? '確定' : 'confirm';
|
||||
let cancel = this.currentLanguage == 'zh' ? '取消' : 'cancel';
|
||||
@ -787,14 +775,7 @@
|
||||
}
|
||||
apiUrl = "api/project/sale"
|
||||
}
|
||||
$.ajax({
|
||||
url: baseUrl + apiUrl,
|
||||
type: "post",
|
||||
data: params,
|
||||
headers: {
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res) {
|
||||
let res = await publikRequesFunction(apiUrl,'post',params);
|
||||
if (res.code === 1) {
|
||||
let tipmessage = _that.currentLanguage == 'zh' ? `請前往支付<span style="color:red;">版權費(${res.data.salefee} BNB)</span><br>和墊付<span style="color:red;">GAS費(${res.data.gasfee} BNB)</span>` : `Please go to pay the <span style="color:red;">copyright fee (${res.data.salefee} BNB)</span><br> and advance the <span style="color:red;">GAS fee (${res.data.gasfee} BNB)</span>`;
|
||||
_that.$confirm(tipmessage, tip, {
|
||||
@ -813,11 +794,6 @@
|
||||
_that.$message.error(res.msg)
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
_that.$message.error(err)
|
||||
}
|
||||
});
|
||||
},
|
||||
//發起版權費+GAS費支付
|
||||
async websentMoney(item,renewalTxt) {
|
||||
let _that = this;
|
||||
@ -859,19 +835,12 @@
|
||||
}
|
||||
},
|
||||
//支付完成提交hash
|
||||
submitHash(id,tx,renewalTxt){
|
||||
async submitHash(id,tx,renewalTxt){
|
||||
let _that = this;
|
||||
let apiURL = "";
|
||||
renewalTxt == 'renewal' ? apiURL = 'api/common/payresult' : _that.isLease ? apiURL = "api/project/payedleaseorder" : apiURL = "api/project/payedsaleorder"
|
||||
try {
|
||||
$.ajax({
|
||||
url: baseUrl + apiURL,
|
||||
type: "post",
|
||||
data: {id,tx},
|
||||
headers: {
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res){
|
||||
let res = await publikRequesFunction(apiURL,'post',{id,tx});
|
||||
if (res.code === 1) {
|
||||
_that.$message.success('success');
|
||||
_that.orderLoading.close();
|
||||
@ -882,11 +851,6 @@
|
||||
_that.$message.error(err)
|
||||
_that.orderLoading.close();
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
_that.$message.error(err)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
_that.$message.error(error)
|
||||
_that.orderLoading.close();
|
||||
@ -1015,45 +979,38 @@
|
||||
maskString(str) {
|
||||
return str.replace(/^(.{3})(.*)(.{3})$/, function (match, p1, p2, p3) { return p1 + '*'.repeat(p2.length / 2) + p3; });
|
||||
},
|
||||
loadTopType() {
|
||||
axios.get(baseUrl + '/api/project/gettype', {
|
||||
headers: {
|
||||
token: this.userInfos.token,
|
||||
},
|
||||
}).then(res => {
|
||||
this.nfttypeList = res.data.data;
|
||||
async loadTopType() {
|
||||
let res = await publikRequesFunction('api/project/gettype','get',{});
|
||||
if(res.code === 1){
|
||||
this.nfttypeList = res.data;
|
||||
this.typeactive = this.nfttypeList[0].id
|
||||
this.getnfttypeList()
|
||||
})
|
||||
}
|
||||
},
|
||||
// 獲取分類
|
||||
getnfttypeList() {
|
||||
async getnfttypeList() {
|
||||
let _that = this;
|
||||
this.attrCurrent = []
|
||||
axios.get(baseUrl + '/api/project/gettpllist?typeid=' + this.typeactive + '&showown=1&listrow=500', {
|
||||
headers: {
|
||||
token: this.userInfos.token,
|
||||
},
|
||||
}).then(res => {
|
||||
this.attributeList = res.data.data.data
|
||||
|
||||
if (this.attributeList.filter(item => { return item.own > 0 }).length > 0) {
|
||||
this.loadData()
|
||||
let res = await publikRequesFunction('api/project/gettpllist','get',{
|
||||
typeid:this.typeactive,showown:1,listrow:500
|
||||
});
|
||||
if(res.code === 1){
|
||||
this.attributeList = res.data.data
|
||||
if (_that.attributeList.filter(item => { return item.own > 0 }).length > 0) {
|
||||
_that.loadData()
|
||||
} else {
|
||||
this.attrCurrent = []
|
||||
this.nftList = []
|
||||
this.total = 0
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
// console.log(err);
|
||||
})
|
||||
}
|
||||
},
|
||||
cheangetypeact(tplid) {
|
||||
if (tplid == this.typeactive) { return }
|
||||
this.typeactive = tplid
|
||||
this.getnfttypeList()
|
||||
},
|
||||
loadData() {
|
||||
async loadData() {
|
||||
this.showGoodClass = false
|
||||
const loading = this.$loading({
|
||||
lock: true,
|
||||
@ -1067,13 +1024,7 @@
|
||||
params.tplid = this.attrCurrent.length > 1 ? this.attrCurrent.join(',') : this.attrCurrent[0]
|
||||
params.typeid = 0
|
||||
}
|
||||
axios.get(baseUrl + '/api/user/mynftlist', {
|
||||
params,
|
||||
headers: {
|
||||
token: token,
|
||||
},
|
||||
})
|
||||
.then(({ data: res }) => {
|
||||
let res = await publikRequesFunction('api/user/mynftlist','get',params);
|
||||
loading.close()
|
||||
if (res.code == 1) {
|
||||
this.total = res.data.total
|
||||
@ -1081,11 +1032,6 @@
|
||||
} else {
|
||||
this.$message(res.msg)
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
loading.close()
|
||||
this.$message(err.response.data.msg)
|
||||
})
|
||||
},
|
||||
//分頁
|
||||
handlePageChange(page) {
|
||||
@ -1139,24 +1085,14 @@
|
||||
confirmButtonText: confirm,
|
||||
cancelButtonText: cancel,
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
$.ajax({
|
||||
url: baseUrl + apiSelect,
|
||||
type: 'post',
|
||||
data: {id},
|
||||
headers:{token: _that.userInfos.token},
|
||||
success(res){
|
||||
}).then(async () => {
|
||||
let res = await publikRequesFunction(apiSelect,'post',{id});
|
||||
if(res.code === 1){
|
||||
_that.$message.success("success");
|
||||
setTimeout(()=>{
|
||||
_that.loadData()
|
||||
},1000)
|
||||
}
|
||||
},
|
||||
error(error){
|
||||
_that.$message.error("error");
|
||||
}
|
||||
});
|
||||
}).catch(() => {
|
||||
_that.$message("Failed");
|
||||
});
|
||||
|
12
profile.html
12
profile.html
@ -690,9 +690,9 @@
|
||||
},
|
||||
async getuserInfos(){
|
||||
if(!this.userInfos?.token){return}
|
||||
let res = await axios.post(baseUrl+'api/user/index',{},{headers:{token:this.userInfos?.token}});
|
||||
if(res.data.code == 1){
|
||||
this.userInfos = res.data.data.userinfo;
|
||||
let res = await publikRequesFunction('api/user/index','post',{});
|
||||
if(res.code == 1){
|
||||
this.userInfos = res.data.userinfo;
|
||||
this.getonrules();
|
||||
}
|
||||
},
|
||||
@ -704,9 +704,9 @@
|
||||
spinner: 'el-icon-loading',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
});
|
||||
let res = await axios.get(baseUrl+'api/user/getlogs?type='+this.ifications+'&page='+this.page,{ headers:{token:this.userInfos.token}});
|
||||
if(res.data.code == 1){
|
||||
this.rewardRules = res.data.data;
|
||||
let res = await publikRequesFunction('api/user/getlogs','get',{type:this.ifications,page:this.page});
|
||||
if(res.code == 1){
|
||||
this.rewardRules = res.data;
|
||||
}
|
||||
loading.close()
|
||||
},
|
||||
|
@ -17,7 +17,10 @@ if (userInfo) {
|
||||
document.getElementById('isshouother').style.display = 'none';
|
||||
}
|
||||
|
||||
if(!userInfo && window.location.pathname != '/login.html' && window.location.pathname != '/signup.html'){
|
||||
let nowPath = window.location.pathname;
|
||||
console.log(nowPath,'当前路径');
|
||||
|
||||
if(!userInfo && !nowPath.includes('login.html') && !nowPath.includes('signup.html')){
|
||||
let language = window.localStorage.getItem("languageNow");
|
||||
let message = language == 'zh' ? '請先登入或註冊' : 'Please log in or register first';
|
||||
const html ="<div id='customizeBox' class='customize-message-box'><p>" + message + "</p></div>"
|
||||
@ -34,6 +37,40 @@ baseUrl = "https://demo.samsaradao.com/"
|
||||
if(window.location.host === 'www.samsaradao.com'){
|
||||
baseUrl = "https://www.samsaradao.com/"
|
||||
}
|
||||
|
||||
|
||||
function publikRequesFunction(api,type,params){
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
url:baseUrl + api,
|
||||
type: type,
|
||||
dataType: "json",
|
||||
headers:{
|
||||
token: JSON.parse(window.localStorage.getItem("userInfo")).token,
|
||||
},
|
||||
data: params,
|
||||
success(res) {
|
||||
resolve(res)
|
||||
if(res.code === 401){
|
||||
window.localStorage.clear();
|
||||
window.location.href = 'login.html'
|
||||
}else{
|
||||
resolve(res)
|
||||
}
|
||||
},
|
||||
error(rej){
|
||||
console.log(rej,'错误请求');
|
||||
if(rej.status === 401){
|
||||
window.localStorage.clear();
|
||||
window.location.href = 'login.html'
|
||||
}else{
|
||||
reject("failed")
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function signOutPage(){
|
||||
$.ajax({
|
||||
url:baseUrl+"api/user/logout",
|
||||
|
@ -833,17 +833,10 @@
|
||||
window.location.href = "all-order.html";
|
||||
}
|
||||
},
|
||||
submitPurchFeeHash(wtbid,tx){
|
||||
async submitPurchFeeHash(wtbid,tx){
|
||||
let _that = this;
|
||||
try {
|
||||
$.ajax({
|
||||
url: `${baseUrl}api/project/wtbrevpayres`,
|
||||
type: "post",
|
||||
data: {wtbid,tx},
|
||||
headers: {
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res){
|
||||
let res = await publikRequesFunction('api/project/wtbrevpayres','post',{wtbid,tx});
|
||||
if (res.code === 1) {
|
||||
_that.orderLoading.close();
|
||||
let resultMsg = _that.currentLanguage == 'zh' ? '交易成功' : 'Successful transaction';
|
||||
@ -856,12 +849,6 @@
|
||||
_that.orderLoading.close();
|
||||
window.location.href = "all-order.html";
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
_that.$message.error(err)
|
||||
window.location.href = "all-order.html";
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
_that.$message.error(error)
|
||||
_that.orderLoading.close();
|
||||
@ -870,25 +857,16 @@
|
||||
//判断是否有相应的NFT
|
||||
isHaveNft(){
|
||||
let _that = this;
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
url:`${baseUrl}api/project/wtbsend`,
|
||||
headers:{token: _that.userInfos.token},
|
||||
data:{
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let res = await publikRequesFunction('api/project/wtbsend','post',{
|
||||
wtbid: _that.nowPurchOrderObj.id,
|
||||
saleaddress: _that.receivAdress
|
||||
},
|
||||
success(res){
|
||||
});
|
||||
if(res.code === 1){
|
||||
resolve(res.data)
|
||||
}else{
|
||||
resolve(res.msg)
|
||||
}
|
||||
},
|
||||
error(xhr,status,error){
|
||||
reject(error)
|
||||
}
|
||||
});
|
||||
})
|
||||
},
|
||||
expirationTimeOp(timestamp){
|
||||
@ -907,30 +885,19 @@
|
||||
this.purchSearchObj.page = val;
|
||||
this.getPurchasList();
|
||||
},
|
||||
getPurchasList(){
|
||||
async getPurchasList(){
|
||||
let _that = this;
|
||||
_that.orderLoading = _that.$loading({ lock: true, text: 'loading', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' });
|
||||
$.ajax({
|
||||
url: `${baseUrl}api/project/getwtblist`,
|
||||
headers:{
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
data:{
|
||||
let res = await publikRequesFunction('api/project/getwtblist','get',{
|
||||
tid: _that.buySelectEqObj.id,
|
||||
..._that.purchSearchObj
|
||||
},
|
||||
success(res){
|
||||
});
|
||||
if(res.code === 1){
|
||||
_that.purchTableData = res.data;
|
||||
_that.orderLoading.close();
|
||||
}
|
||||
},
|
||||
error(err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
purchaseRequest(){
|
||||
async purchaseRequest(){
|
||||
let _that = this;
|
||||
if(!_that.purchPrice || !_that.setimeCycle){
|
||||
let inputVality = _that.currentLanguage == 'zh' ? '請輸入完整訊息' : 'Please enter complete information';
|
||||
@ -948,17 +915,11 @@
|
||||
},1000)
|
||||
return
|
||||
}
|
||||
$.ajax({
|
||||
url: `${baseUrl}api/project/wtbuy`,
|
||||
headers:{
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
data:{
|
||||
let res = await publikRequesFunction('api/project/wtbuy','post',{
|
||||
tid: _that.buySelectEqObj.id,
|
||||
bnb: _that.purchPrice,
|
||||
vaildtime: _that.setimeCycle
|
||||
},
|
||||
success(res){
|
||||
});
|
||||
if(res.code === 1){
|
||||
let tipmessage = _that.currentLanguage == 'zh' ? `請前往支付求購費(${res.data.bnb} BNB)和GAS費(${res.data.gas} BNB)` : `Please go to pay the purchase fee ${res.data.bnb} and the GAS fee ${res.data.gas} BNB`;
|
||||
_that.$confirm(tipmessage, tip, {
|
||||
@ -977,11 +938,6 @@
|
||||
_that.$message.error('fail')
|
||||
}
|
||||
},
|
||||
error(err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
async payPurchPrice(item){
|
||||
let _that = this;
|
||||
const provider = window.web3?.currentProvider;
|
||||
@ -1023,18 +979,11 @@
|
||||
this.orderLoading.close();
|
||||
}
|
||||
},
|
||||
submitPurchHash(id,tx,fromaddress){
|
||||
async submitPurchHash(id,tx,fromaddress){
|
||||
console.log('交易ID:',id,'交易hash:',tx);
|
||||
let _that = this;
|
||||
try {
|
||||
$.ajax({
|
||||
url: `${baseUrl}api/project/wtbres`,
|
||||
type: "post",
|
||||
data: {id,tx,fromaddress},
|
||||
headers: {
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res){
|
||||
let res = await publikRequesFunction('api/project/wtbres','post',{id,tx,fromaddress});
|
||||
if (res.code === 1) {
|
||||
_that.orderLoading.close();
|
||||
let resultMsg = _that.currentLanguage == 'zh' ? '發布求購成功' : 'Published purchase successfully';
|
||||
@ -1047,11 +996,6 @@
|
||||
_that.$message.error(err)
|
||||
_that.orderLoading.close();
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
_that.$message.error(err)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
_that.$message.error(error)
|
||||
_that.orderLoading.close();
|
||||
@ -1063,7 +1007,7 @@
|
||||
this.buySelectEqObj = {...item};
|
||||
this.getPurchasList();
|
||||
},
|
||||
getNftList(){
|
||||
async getNftList(){
|
||||
let _that = this;
|
||||
let sort = "";
|
||||
let desc = "";
|
||||
@ -1073,10 +1017,7 @@
|
||||
let keywords_cn = "";
|
||||
let keywords_en = "";
|
||||
this.currentLanguage == 'zh' ? keywords_cn = this.searchNft : keywords_en = this.searchNft
|
||||
$.ajax({
|
||||
url:`${baseUrl}api/project/getenbuynftlist`,
|
||||
type:'get',
|
||||
data:{
|
||||
let res = await publikRequesFunction('api/project/getenbuynftlist','get',{
|
||||
keywords_cn,
|
||||
keywords_en,
|
||||
typeid: _that.nownftId,//分類ID
|
||||
@ -1085,32 +1026,20 @@
|
||||
tplid: _that.selectEqType,
|
||||
sort,//排序:發佈時間time 價格fee
|
||||
desc//true倒序 false正序
|
||||
},
|
||||
headers:{
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res){
|
||||
});
|
||||
if(res.code === 1){
|
||||
_that.topnftInfos = res.data.baseinfo;
|
||||
_that.transactionList = res.data.list;
|
||||
_that.orderLoading.close();
|
||||
}
|
||||
},
|
||||
error(err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
getLeaseNftList(){
|
||||
async getLeaseNftList(){
|
||||
let _that = this;
|
||||
this.orderLoading = _that.$loading({ lock: true, text: 'loading', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' });
|
||||
let keywords_cn = "";
|
||||
let keywords_en = "";
|
||||
this.currentLanguage == 'zh' ? keywords_cn = this.searchNft : keywords_en = this.searchNft
|
||||
$.ajax({
|
||||
url:`${baseUrl}api/project/getenleasenftlist`,
|
||||
type:'get',
|
||||
data:{
|
||||
let res = await publikRequesFunction('api/project/getenleasenftlist','get',{
|
||||
keywords_cn,
|
||||
keywords_en,
|
||||
typeid: _that.nownftId,
|
||||
@ -1119,21 +1048,12 @@
|
||||
tplid: _that.selectEqType,
|
||||
sort:"",
|
||||
desc: true
|
||||
},
|
||||
headers:{
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res){
|
||||
});
|
||||
if(res.code === 1){
|
||||
_that.leaseNftData = res.data.list;
|
||||
_that.orderLoading.close();
|
||||
}
|
||||
},
|
||||
error(err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
searchEqListLease(id){
|
||||
this.selectEqType = id;
|
||||
this.getLeaseNftList();
|
||||
@ -1142,26 +1062,19 @@
|
||||
this.selectEqType = id;
|
||||
this.getNftList();
|
||||
},
|
||||
getnftTypeList(){
|
||||
async getnftTypeList(){
|
||||
let _that = this;
|
||||
$.ajax({
|
||||
url:`${baseUrl}api/project/gettpllist?typeid=${this.nownftId}&showown=&listrow=9999`,
|
||||
type:'get',
|
||||
headers:{
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res){
|
||||
let res = await publikRequesFunction('api/project/gettpllist','get',{
|
||||
typeid:this.nownftId,
|
||||
showown:1,
|
||||
listrow:9999
|
||||
});
|
||||
if(res.code === 1){
|
||||
_that.equipmentType = res.data.data;
|
||||
_that.buySelectEqType = _that.equipmentType[0].id;
|
||||
_that.buySelectEqObj = _that.equipmentType[0];
|
||||
}
|
||||
},
|
||||
error(err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
toNftDetail(){
|
||||
window.location.href = "nft-detail.html";
|
||||
},
|
||||
@ -1180,21 +1093,14 @@
|
||||
}
|
||||
this.creatOrder();
|
||||
},
|
||||
creatOrder(){
|
||||
async creatOrder(){
|
||||
let _that = this;
|
||||
let apiString = "";
|
||||
_that.activeName == 'first' ? apiString = 'api/project/buynft' : apiString = 'api/project/leasenft'
|
||||
$.ajax({
|
||||
url: baseUrl + apiString,
|
||||
type: "post",
|
||||
data: {
|
||||
let res = await publikRequesFunction(apiString,'post',{
|
||||
id: _that.paynftObj.id,
|
||||
fromaddress:_that.userMoneyAdressAll
|
||||
},
|
||||
headers:{
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res) {
|
||||
});
|
||||
if (res.code === 1) {
|
||||
_that.payNFTDialog = false;
|
||||
let tipMessage = _that.currentLanguage == 'zh' ? '交易中,請勿刷新頁面...' : 'During the transaction, please do not refresh the page';
|
||||
@ -1204,11 +1110,6 @@
|
||||
_that.$message.error(res.msg)
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
_that.$message.error(err)
|
||||
}
|
||||
});
|
||||
},
|
||||
async websentMoney(item) {
|
||||
let _that = this;
|
||||
const provider = window.web3?.currentProvider;
|
||||
@ -1250,20 +1151,11 @@
|
||||
this.orderLoading.close();
|
||||
}
|
||||
},
|
||||
submitHash(id,tx){
|
||||
async submitHash(id,tx){
|
||||
let _that = this;
|
||||
let apiString = "";
|
||||
// _that.activeName == 'first' ? apiString = 'api/common/payresult' : ''
|
||||
try {
|
||||
$.ajax({
|
||||
// url: baseUrl + apiString,
|
||||
url:`${baseUrl}api/common/payresult`,
|
||||
type: "post",
|
||||
data: {id,tx},
|
||||
headers: {
|
||||
token: _that.userInfos.token
|
||||
},
|
||||
success(res){
|
||||
let res = await publikRequesFunction('api/common/payresult','post',{id,tx});
|
||||
if (res.code === 1) {
|
||||
_that.$message.success('success');
|
||||
_that.orderLoading.close();
|
||||
@ -1274,11 +1166,6 @@
|
||||
_that.$message.error(err)
|
||||
_that.orderLoading.close();
|
||||
}
|
||||
},
|
||||
error(err) {
|
||||
_that.$message.error(err)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
_that.$message.error(error)
|
||||
_that.orderLoading.close();
|
||||
|
29
trading.html
29
trading.html
@ -302,31 +302,21 @@
|
||||
this.getRecentNftList();
|
||||
},
|
||||
methods: {
|
||||
getRecentNftList(){
|
||||
async getRecentNftList(){
|
||||
let _that = this;
|
||||
$.ajax({
|
||||
url:`${baseUrl}api/project/getnftlist`,
|
||||
type:"get",
|
||||
data:{page:1,listrow:5},
|
||||
headers:{token:_that.userInfoObj.token},
|
||||
success(res){
|
||||
let res = await publikRequesFunction('api/project/getnftlist','get',{page:1,listrow:5});
|
||||
if(res.code === 1){
|
||||
_that.recentNftData = res.data.data;
|
||||
}else{
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
error(err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
searchTimeOption(n){
|
||||
const currentTimestamp = Date.now();
|
||||
const timestampAgo = currentTimestamp - n * 24 * 60 * 60 * 1000;
|
||||
return timestampAgo
|
||||
},
|
||||
getNfttype(){
|
||||
async getNfttype(){
|
||||
let starttime = "";
|
||||
let endtime = "";
|
||||
if(this.popularRadio != 'all'){
|
||||
@ -338,25 +328,16 @@
|
||||
}
|
||||
this.orderLoading = this.$loading({ lock: true, text: 'loading...', spinner: 'el-icon-loading', background: 'rgba(0, 0, 0, 0.7)' });
|
||||
let _that = this;
|
||||
$.ajax({
|
||||
url:`${baseUrl}api/project/gettype`,
|
||||
type:"get",
|
||||
data:{
|
||||
let res = await publikRequesFunction('api/project/gettype','get',{
|
||||
showown:"",
|
||||
starttime,
|
||||
endtime,
|
||||
},
|
||||
success(res){
|
||||
});
|
||||
if(res.code === 1){
|
||||
_that.tableData = res.data;
|
||||
_that.orderLoading.close();
|
||||
}
|
||||
},
|
||||
error(err){
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
toNftDetail(id,typeId){
|
||||
window.location.href = `trading-detail.html?id=${id}&typeId=${typeId}`;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user