From 5ee8b8a5ecb44804f4a7e56a44d782e21ef1e07a Mon Sep 17 00:00:00 2001
From: XiaoXinPro 14 IAH5R <568170040@qq.com>
Date: Thu, 16 Feb 2023 17:42:54 +0800
Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E4=B8=8E=E9=80=89=E6=8B=A9?=
=?UTF-8?q?=E5=B9=BF=E5=9C=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app.js | 84 +++++++++++++-------------
index/index.js | 117 +++++++++++++++++++++++------------
index/index.ttml | 144 +++++---------------------------------------
index/index.ttss | 42 ++++++++-----
index/indexOld.txt | 120 ++++++++++++++++++++++++++++++++++++
utils/HttpBasics.js | 45 +++++++++++---
6 files changed, 321 insertions(+), 231 deletions(-)
create mode 100644 index/indexOld.txt
diff --git a/app.js b/app.js
index dd97840..6645b5f 100644
--- a/app.js
+++ b/app.js
@@ -1,44 +1,44 @@
const Http = require("./utils/HttpBasics.js")
const config = require("./config/config.js");
App({
- data:{},
- globalData:{
+ data: {},
+ globalData: {
token: null,
imgHttps: 'https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/',
- platform:null,//手机型号
- systemInfo:"",
- curHtml:"",
- marketName:"",
- mouldType:1,
- appId:config.weapp.AppId,
- selected:0,
- goHomeUrl:"/index/index",
- type:"",//存放跳转标记
+ platform: null, //手机型号
+ systemInfo: "",
+ curHtml: "",
+ marketName: "",
+ mouldType: 1,
+ appId: config.weapp.AppId,
+ selected: 0,
+ goHomeUrl: "/index/index",
+ type: "", //存放跳转标记
previewFlag: false, //解决图片预览调用noshow
- skipUrl:"",//存放授权跳转地址
- skip:"",
- avatarUrl:"",//用户头像
- nickName:"",//用户姓名
- templateId:[],//订阅消息模板id
- ifshowtab:false,
+ skipUrl: "", //存放授权跳转地址
+ skip: "",
+ avatarUrl: "", //用户头像
+ nickName: "", //用户姓名
+ templateId: [], //订阅消息模板id
+ ifshowtab: false,
},
onLaunch: function () {
let that = this
-
+
try {
var res = tt.getSystemInfoSync();
that.statusBarHeight = res.statusBarHeight
- console.log(`手机型号为`,that.statusBarHeight);
+ console.log(`手机型号为`, that.statusBarHeight);
this.globalData.platform = res.platform
} catch (error) {
console.log(`获取系统信息失败`);
}
- that.logn();
+ that.login();
tt.getSystemInfo({
success(res) {
- console.log(res,"**");
+ console.log(res, "**");
that.globalData.systemInfo = res
-
+
},
fail(res) {
console.log(`getSystemInfo 调用失败`);
@@ -46,7 +46,7 @@ App({
});
},
-
+
statusBarHeight: 0,
getTemplateId(that) {
// console.log("隐藏")
@@ -72,41 +72,43 @@ App({
}
})
},
- logn(){
+ login() {
let that = this;
tt.login({
- success:(res=>{
- let {code} = res
- console.log(code,"code");
+ success: (res => {
+ let {
+ code
+ } = res
+ console.log(code, "code");
Http.post({
- url:config.api.login,
- data:{
- code:code,
- appId:that.globalData.appId,
- systemInfo:JSON.stringify(this.globalData.systemInfo)
+ url: config.api.login,
+ data: {
+ code: code,
+ appId: that.globalData.appId,
+ systemInfo: JSON.stringify(this.globalData.systemInfo)
}
- }).then(res=>{
+ }).then(res => {
tt.setStorageSync("openId", res.data.openId);
- if (res.data.mall){
+ if (res.data.mall) {
that.globalData.marketName = res.data.mall.name ? res.data.mall.name : ""
}
- that.globalData.mouldType = res.data.mouldType ? res.data.mouldType:0;
+ that.globalData.mouldType = res.data.mouldType ? res.data.mouldType : 0;
if (res.data.subMalls) {
const squareList = JSON.parse(res.data.subMalls)
tt.setStorageSync("squareList", squareList)
- if (res.data.mall){
+ if (res.data.mall) {
tt.setStorageSync("selectedMall", res.data.mall.tenantId)
}
-
+
}
Http.setToken(res.data.token);
that.globalData.token = res.data.token
- that.getTemplateId(that);//获取订阅消息模板id
+ that.getTemplateId(that); //获取订阅消息模板id
if (that.tokenCallback) {
that.tokenCallback(res.data.token);
}
-
- }).catch(err=>{
+
+ }).catch(err => {
console.log(err);
tt.showModal({
title: '提示',
@@ -129,4 +131,4 @@ App({
});
}
-})
+})
\ No newline at end of file
diff --git a/index/index.js b/index/index.js
index d8793c6..de99a0c 100644
--- a/index/index.js
+++ b/index/index.js
@@ -114,6 +114,10 @@ Page({
squareName: "", //当前广场
isShowSqare: false,
moduleList: [], //按钮列表
+ currentMall: '富茂广场',
+ shopList: [],
+ mallTenantId: tt.getStorageSync('mallTenantId') || '',
+ index: tt.getStorageSync('mallIndex') || 0
},
getCongig() { //获取小程序是否开通授权手机号
@@ -129,6 +133,37 @@ Page({
})
},
+ getsubMallList() {
+ Http.get({
+ url: '/mall/subMall?isAll=1',
+ }).then(res => {
+ this.setData({
+ shopList: res.data,
+ mallTenantId: res.data[0].tenantId
+ });
+ const index = this.data.index
+ const mallTenantId = this.data.shopList[index].tenantId
+ tt.setStorageSync('mallTenantId', mallTenantId)
+ tt.setStorageSync('mallIndex', index)
+ Http.setMallTenantId(mallTenantId);
+ }).catch(err => {
+ console.log(err, 'err');
+ })
+ },
+
+ bindPickerChange(e) {
+ const index = e.detail.value
+ const mallTenantId = this.data.shopList[index].tenantId
+ tt.setStorageSync('mallTenantId', mallTenantId)
+ tt.setStorageSync('mallIndex', index)
+ this.setData({
+ index: index,
+ mallTenantId: mallTenantId,
+ allow_load: true
+ });
+ Http.setMallTenantId(mallTenantId);
+ },
+
getBusineData(e) {
this.setData({
businePageNum: 1,
@@ -514,6 +549,7 @@ Page({
}
})
},
+
/**
* 生命周期函数--监听页面初次渲染完成
*/
@@ -543,6 +579,9 @@ Page({
// util.barcode("barcode", optionss.quancode, 510, 100);
// console.log(Http.headers.token, "?")
this.getLocation()
+ setTimeout(() => {
+ this.getsubMallList()
+ }, 1000)
},
/**
* 获得经纬度
@@ -569,8 +608,12 @@ Page({
},
fail: error => {
console.log(error);
+ },
+ complete: finish => {
+
}
})
+
},
@@ -752,19 +795,19 @@ Page({
that.getmemberId(app.globalData.token);
that.getBannerlist();
- if (that.data.mouldType == 0) { //富茂原版
- that.topicShow();
- that.getxsList();
- } else if (that.data.mouldType == 1) { //欢乐城模板
- that.getShowList()
- that.topicShowall(2);
- that.topicShowall(3);
- that.topicShowall(4);
- that.topicShowall(5);
- that.topicShowall(6);
- that.getBusinessList();
- that.getCouponChannelList(0)
- }
+ // if (that.data.mouldType == 0) { //富茂原版
+ // that.topicShow();
+ // that.getxsList();
+ // } else if (that.data.mouldType == 1) { //欢乐城模板
+ // }
+ that.getShowList()
+ that.topicShowall(2);
+ that.topicShowall(3);
+ that.topicShowall(4);
+ that.topicShowall(5);
+ that.topicShowall(6);
+ that.getBusinessList();
+ that.getCouponChannelList(0)
that.getType()
@@ -826,19 +869,19 @@ Page({
// that.getModule()
that.getmemberId(app.globalData.token);
that.getBannerlist();
- if (that.data.mouldType == 0) { //富茂原版
- that.topicShow();
- that.getxsList();
- } else if (that.data.mouldType == 1) { //欢乐城模板
- that.getShowList()
- that.topicShowall(2);
- that.topicShowall(3);
- that.topicShowall(4);
- that.topicShowall(5);
- that.topicShowall(6);
- that.getBusinessList();
- that.getCouponChannelList(0)
- }
+ // if (that.data.mouldType == 0) { //富茂原版
+ // that.topicShow();
+ // that.getxsList();
+ // } else if (that.data.mouldType == 1) { //欢乐城模板
+ // }
+ that.getShowList()
+ that.topicShowall(2);
+ that.topicShowall(3);
+ that.topicShowall(4);
+ that.topicShowall(5);
+ that.topicShowall(6);
+ that.getBusinessList();
+ that.getCouponChannelList(0)
that.getType()
that.uesrInfo()
// that.getLocation();
@@ -1314,17 +1357,17 @@ Page({
});
console.log("加载更多页数" + that.data.page, );
console.log("加载更多key" + that.data.code);
- if (that.data.mouldType == 0) { //富茂源模板
- //父组件获得子组件的方法
- //如果code == 0
- if (that.data.code == 0 || that.data.code == undefined) {
- that.selectComponent("#lists").getList(0, that.data.page);
- } else {
- that.selectComponent("#lists").getList(that.data.code, that.data.page);
- }
- } else if (that.data.mouldType == 1) {
- this.getCouponChannelList(that.data.busineKye)
- }
+ // if (that.data.mouldType == 0) { //富茂源模板
+ // //父组件获得子组件的方法
+ // //如果code == 0
+ // if (that.data.code == 0 || that.data.code == undefined) {
+ // that.selectComponent("#lists").getList(0, that.data.page);
+ // } else {
+ // that.selectComponent("#lists").getList(that.data.code, that.data.page);
+ // }
+ // } else if (that.data.mouldType == 1) {
+ // }
+ this.getCouponChannelList(that.data.busineKye)
},
// 用户点击右上角分享
diff --git a/index/index.ttml b/index/index.ttml
index d72704a..dac2020 100644
--- a/index/index.ttml
+++ b/index/index.ttml
@@ -1,126 +1,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
- {{squareName}} ↓
-
-
-
-
-
-
-
-
-
-
-
-
- {{levelName}}
-
-
-
-
- 还需{{upgradeScore}}成长值可升级
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{item.name}}
-
-
-
-
-
-
- 砍价
-
-
-
- 拼团
-
-
-
- 限时抢购
-
-
-
-
-
-
- 限时专区
- 限时惊爆价 轻松拎回家
-
-
-
-
-
- {{xslist[index].title}}
-
-
-
-
-
- 更多...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 您今日签到成功,获得{{fistLogin}}成长值
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -135,13 +14,19 @@
-
-->
-
-
-
+
+
+
+
+ 当前广场:{{ shopList[index].name }} ↓
+
+
+
+
@@ -185,8 +70,9 @@
-
+
+
@@ -214,4 +100,4 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/index/index.ttss b/index/index.ttss
index 70f142c..a453295 100644
--- a/index/index.ttss
+++ b/index/index.ttss
@@ -3,11 +3,13 @@
page {
background: #f4f5f9;
}
-.temp{
+
+.temp {
width: 100rpx;
height: 100rpx;
background-color: darkcyan
}
+
.xia {
width: 24rpx;
height: 14rpx;
@@ -18,7 +20,7 @@ page {
left: 0;
right: 0;
bottom: 0;
-
+
/* margin: auto; */
}
@@ -26,9 +28,10 @@ page {
display: flex;
justify-content: space-around;
}
+
.goSqunar1 {
display: flex;
- justify-content: center;
+ justify-content: center;
background-image: url('https://formall.oss-accelerate.aliyuncs.com/douyin_ifomall/imgData/topback_1.png');
background-size: 100% 100%;
background-repeat: no-repeat;
@@ -36,7 +39,7 @@ page {
height: 190rpx;
}
-.squareLogo{
+.squareLogo {
width: 94rpx;
height: 40rpx;
position: absolute;
@@ -48,11 +51,11 @@ page {
font-size: 32rpx;
font-family: OPPOSans;
font-weight: bold;
-
+
}
.title1 {
- max-width:320rpx;
+ max-width: 320rpx;
color: #402e1e;
font-family: "PingFangSC-Medium";
font-size: 28rpx;
@@ -66,9 +69,9 @@ page {
width: 24rpx;
/* height: 15rpx; */
}
-.marketName{
-}
+.marketName {}
+
.f {
float: left;
}
@@ -108,10 +111,17 @@ page {
}
.color_box {
- /* padding-top: 20rpx; *//* background-image: linear-gradient(#DC143C, #F4F5F9); */
+ /* padding-top: 20rpx; */
+ /* background-image: linear-gradient(#DC143C, #F4F5F9); */
background-color: #f4f5f9;
}
+.pickerMall {
+ height: auto;
+ margin: 10rpx 0 15rpx 10rpx;
+}
+
+
.underlingImg {
width: 30rpx;
height: 60rpx;
@@ -222,18 +232,20 @@ page {
padding: 0 38rpx;
}
-.section >view, .sellsection>view {
+.section>view,
+.sellsection>view {
width: 25%;
display: inline-block;
position: relative;
}
-.section >view image, .sellsection>view image {
+.section>view image,
+.sellsection>view image {
display: block;
margin: 0 auto;
}
-.section >view image {
+.section>view image {
width: 55rpx;
height: 55rpx;
margin-top: 20rpx;
@@ -604,9 +616,11 @@ page {
text-overflow: ellipsis;
white-space: nowrap;
}
-.remainchengzhangzhi p{
+
+.remainchengzhangzhi p {
display: inline;
}
+
progress {
width: 200rpx;
border-radius: 60rpx;
@@ -838,4 +852,4 @@ i-tabs i-tabs-scroll {
right: 20rpx;
position: fixed;
z-index: 1000000;
-}
+}
\ No newline at end of file
diff --git a/index/indexOld.txt b/index/indexOld.txt
new file mode 100644
index 0000000..592769a
--- /dev/null
+++ b/index/indexOld.txt
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{squareName}} ↓
+
+
+
+
+
+
+
+
+
+
+
+
+ {{levelName}}
+
+
+
+
+ 还需{{upgradeScore}}成长值可升级
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+ 砍价
+
+
+
+ 拼团
+
+
+
+ 限时抢购
+
+
+
+
+
+
+ 限时专区
+ 限时惊爆价 轻松拎回家
+
+
+
+
+
+ {{xslist[index].title}}
+
+
+
+
+
+ 更多...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 您今日签到成功,获得{{fistLogin}}成长值
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/utils/HttpBasics.js b/utils/HttpBasics.js
index 055d944..0516240 100644
--- a/utils/HttpBasics.js
+++ b/utils/HttpBasics.js
@@ -21,21 +21,39 @@ class HttpBasics {
headers = {
"Content-Type": "application/json;charset=UTF-8",
token: "",
+ mallTenantId: ""
// token:"3ab2afa2-f704-4086-b6e5-ad0715c7e2a1:1027:tt-cuser"
};
+
/**
- * 设置token
+ * @description 设置token
* @param {*} token
*/
setToken(token) {
this.headers.token = token;
}
+
+ /**
+ * @description 设置mallTenantId
+ * @param {*} mallTenantId
+ */
+ setMallTenantId(mallTenantId) {
+ this.headers.mallTenantId = mallTenantId;
+ }
+
/**
* 获取数据
* @param {url,data,headers} param0
*/
- get({ url, data, headers }) {
- headers = { ...this.headers, ...headers };
+ get({
+ url,
+ data,
+ headers
+ }) {
+ headers = {
+ ...this.headers,
+ ...headers
+ };
url = `${this.address}${url}`;
return new Promise((resolve, reject) => {
tt.request({
@@ -45,16 +63,16 @@ class HttpBasics {
method: "get",
success: res => {
this.responseMap(res, resolve, reject);
- },
+ },
fail: err => {
console.log(err)
if (err.errMsg == 'request:fail timeout') {
err.errMsg = '请求超时,请检查您的网络设置!'
- } else if (err.errMsg == 'request:fail'){
+ } else if (err.errMsg == 'request:fail') {
err.errMsg = '未检查到您的网络,请检查您的网络设置!'
} else if (err.errMsg == 'request:fail request connect error') {
err.errMsg = '连接失败'
- }
+ }
reject(err);
}
});
@@ -64,8 +82,15 @@ class HttpBasics {
* 提交数据
* @param {url,data,headers} param0
*/
- post({ url, data, headers }) {
- headers = { ...this.headers, ...headers };
+ post({
+ url,
+ data,
+ headers
+ }) {
+ headers = {
+ ...this.headers,
+ ...headers
+ };
url = `${this.address}${url}`;
return new Promise((resolve, reject) => {
tt.request({
@@ -83,7 +108,7 @@ class HttpBasics {
err.errMsg = '未检查到您的网络,请检查您的网络设置!'
} else if (err.errMsg == 'request:fail request connect error') {
err.errMsg = '连接失败'
- }
+ }
reject(err);
},
complete: res => {}
@@ -117,4 +142,4 @@ class HttpBasics {
/** 日志 */
log(url, body, headers) {}
}
-module.exports = new HttpBasics();
+module.exports = new HttpBasics();
\ No newline at end of file