Commit 85e38785 by jscat

nyx weapp: 需求调整

1. 去除fair/comunity
parent 7d0e5e2d
{ {
"pages": [ "pages": [
"pages/activity/activity", "pages/activity/activity",
"pages/community/community",
"pages/fair/fair",
"pages/share/share", "pages/share/share",
"pages/live/live", "pages/live/live",
"pages/live/live-info/live-info", "pages/live/live-info/live-info",
......
// pages/activity/activity.js
const app = getApp()
var config = wx.getStorageSync("config");
var util = require('./../../utils/util.js')
var event = require('./../../utils/event.js')
//const { globalData: { defaultCity, defaultCounty } } = app
Page({
/**
* 页面的初始数据
*/
data: {
/* 用户信息及商家信息 */
nyxCode : "",
authStatus : "", // 授权状态: 00-未授权, 01-已授权
userInfo : {},
members : "", // 商家信息
member : {},
city: "",
county: "",
category: [ // 导航栏内容数据
{ name: '点赞', order : 'like' },
{ name: '价格', order : 'price' },
{ name: '最新', order : 'nearest' },
],
curIndex: 0, // 给选中的tab加粗
activities: [],
// {
// note_image: [ "https://1.jpg", "https://2.jpg"],
// title: "一天",
// like: 10,
// writer_name: "无敌花木兰",
// writer_image: "../../icon/icon_avatar3.png"
// },
//分页加载部分
isHideLoadMore: false,
pageIndex: 1, //分页搜索的page index
//页面格式
deviceRatio: 1,
navHeight: 0,
searchHeight: 0,
noteTop: 0,
noteHeight: 0,
//搜索模块
inputShowed: false, //初始文本框不显示内容
strSearch : "", //搜索的title字串
strAddress : "思南公馆", //搜索的address字串
inputVal : "", //输入字符串,主要用于页面显示
//二维码信息
qRCodeMsg: "",
//园区
activityType: "02-园区",
entities: [], //包括fair和community
/*
集市/园区所在的信息
fair_name, community_name, num_activity, num_like
*/
entityInfos: {},
curEntity: 0,
},
switchCategory(e) {
var _this = this;
var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
this.setData({
curIndex: curIndex,
})
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
// 搜索点击事件
entrySearch(e) {
wx.navigateTo({
url: '../index/searchbar/searchbar',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var _this = this;
//入口页面,先确定nyxCode
/*step1 先确定用户信息 -- global page 需求 */
var nyxCode = wx.getStorageSync('nyxCode');
//step2 确定城市信息 -- local page 需求
var LatestCityList = wx.getStorageSync('LatestCityList') || []
if( LatestCityList.length > 0 )
{
var city = LatestCityList[0]["city"]
app.globalData.defaultCity = city
_this.setData({ city })
}
else
{
var city = app.globalData.defaultCity
_this.setData({ city })
}
//不存在
if (!nyxCode)
{
//注册新用户
console.log("===onLoad_regUser")
wx.clearStorageSync('nyxCode');
var nyxCode = "uid_" + util.wxuuid()
wx.setStorageSync('nyxCode', nyxCode);
app.globalData.nyxCode = nyxCode;
app.regUser(nyxCode); // nyxCode, userInfo, authStatus: storage, globalData
}
else //存在
{
//初始化数据
_this.setData({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
members : wx.getStorageSync('members'),
})
//更新用户信息
var strUrl = config.userinfo_query_url + "?userid=" + nyxCode
wx.setStorageSync('nyxCode', nyxCode);
app.globalData.nyxCode = nyxCode;
config.debug == 1 ? console.log("===getLatestUserInfo strUrl_" + strUrl) : 1
getData(strUrl, "").then(res => {
console.log(res.data)
if(res.data.length==0) //数据库不存在该用户(误删除或者测试数据已删除)
{
//以该id注册新用户
console.log("===onLoad_Update User Info")
app.regUser(nyxCode);
}
else
{
var list = res.data[0]
app.globalData.nyxCode = nyxCode;
wx.setStorageSync('nyxCode', nyxCode);
app.globalData.userInfo = list
wx.setStorageSync('userInfo', list)
console.log("==onLoad_userInfo success")
}
})
}
// step3 确定member信息, 写入 data.members
let promise_member = new Promise(function (resolve, reject) {
app.getMembers(0, 1, 20, resolve, reject);
})
promise_member.then(
function (value){
var members = wx.getStorageSync('members')
var member = wx.getStorageSync('member')
_this.setData({ member, members})
console.log("===enter promise_member then_passed_" + value)
},
function (value){
console.log("===enter promise_member then_failed_" + value)
},
);
// step4 数据载入页面, 初始化 - global page
// 初始载入'我已收藏'的清单, 存入storage
wx.setStorageSync('likeDictStorage', {})
let promise_like = new Promise(function (resolve, reject) {
app.getCollectsStorage(0, 1, 100, resolve, reject);
})
promise_like.then(
function (value){
console.log("===enter promise_like then_passed_" + value)
},
function (value){
console.log("===enter promise_like then_failed_" + value)
}
)
// step5 new add jscat 20201008 载入园区列表 - local page
var strCity = app.globalData.defaultCity
var activityType = _this.__data__.activityType
let promise_entity = new Promise(function (resolve, reject) {
_this.getEntities(strCity, activityType, resolve, reject);
})
// step6 初始载入四个推荐的活动 - local page
promise_entity.then(
function (value){
console.log("===enter promise_entity then_passed_" + value)
_this.onGetActivities()
},
function (value){
console.log("===enter promise_entity then_failed_" + value)
}
)
// step7 event 订阅, 主要接受activity-info.js里 emit 发送的消息 local page
event.on('LikeChanged', this, function(data) {
var activity_id = data['activity_id']
var num_like = data['num_like']
var activities = _this.__data__.activities;
for(var i=0; i< activities.length; i++)
{
if(activity_id == activities[i]['activity_id'])
{
activities[i]['num_like'] = num_like
}
}
_this.setData({
activities: activities,
})
})
// step8 窗口初始化
var device = wx.getSystemInfoSync()
//self.device = app.globalData.myDevice
// jscat miniprogram default width is 750rpx
var deviceRatio = device.windowWidth / 750
var winWidth = device.windowWidth * deviceRatio
var noteHeight = device.windowHeight - (40 - 60)
_this.setData({
searchHeight: 40,
navHeight: 40,
noteTop : (40+40),
noteHeight: noteHeight,
deviceRatio: deviceRatio,
})
wx.setNavigationBarTitle({
title: '园区活动',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
var _this = this;
const { globalData: { defaultCity, defaultCounty } } = app
this.setData({
city: defaultCity,
county: defaultCounty
})
if(app.globalData.citySwitched == 1)
{
var strCity = app.globalData.defaultCity
var activityType = _this.__data__.activityType
let promise_entity = new Promise(function (resolve, reject) {
_this.getEntities(strCity, activityType, resolve, reject);
})
// step6 初始载入四个推荐的活动 - local page
promise_entity.then(
function (value){
console.log("===enter promise_entity then_passed_" + value)
_this.onGetActivities()
},
function (value){
console.log("===enter promise_entity then_failed_" + value)
}
)
app.globalData.citySwitched = 0
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
event.remove('LikeChanged', this);
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log('页面上拉触底')
var _this = this;
var curIndex = _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
var isHideLoadMore = _this.__data__.isHideLoadMore;
var pageIndex = _this.__data__.pageIndex;
//控制逻辑, 下拉更新操作
//判断是否已经全部加载完毕
//没有则加载更多
if (!isHideLoadMore) {
console.log('加载更多')
setTimeout(() => {
_this.getActivities(1, pageIndex, 4, strAddress, strEntity, strCategory, strSearch);
}, 1000)
}
else {
console.log('没有更多')
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
/**
* 用户自定义函数
*
*/
// 获取Activities数据
// scrollType: 是否是翻页
/*
搜索逻辑:
1. 搜索框, tag=strSearch + title=strSearch
2. tab, tag=strSearch
3. 新增的search tab, '搜索'tab的时候,需要转换为搜索的关键词(_this.__data__.strSearch)
4. jscat 20201008 新增按照entity搜索(fair/community)
*/
getActivities: function (scrollType, pageNum, pageCount, strAddress, strEntity, strCategory, strSearch) {
var _this = this;
var activityType = _this.__data__.activityType
// 如果是"推荐"和"搜索",需要单独处理
// '搜索'tab的时候, 需要转换为搜索的关键词(_this.__data__.strSearch)
var query_url = '&title=' + strSearch + '&orderType=' + strCategory + '&city=' + strAddress
+ '&activityType=' + activityType + '&entityName=' + strEntity
var strUrl = config.activity_query_url + "?pageCount=" + pageCount
+ "&pageNum=" + pageNum + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if (res.data.resultCode == 200) {
//表示HTTP请求成功
console.log(res.data);
var list = []
var bisHideLoadMoreType = false;
if (res.data.data.length < pageCount) {
bisHideLoadMoreType = true;
}
for (var i = 0; i < res.data.data.length; i++) {
var index_id = i + _this.__data__.activities.length
var result = {}
result["activity_id"] = res.data.data[i].activityId
result["member_name"] = res.data.data[i].memberName
result["member_slogan"] = res.data.data[i].memberSlogan
result["member_id"] = res.data.data[i].memberId
result["member_status"] = res.data.data[i].memberStatus
result["member_logo"] = res.data.data[i].memberLogo
result["tag"] = res.data.data[i].tag
result["title"] = res.data.data[i].title
result["num_like"] = res.data.data[i].numLike
result["content"] = res.data.data[i].content
result["quiz"] = res.data.data[i].quiz
result["point"] = res.data.data[i].point
result["address_name"] = res.data.data[i].addressName
result["product_desc"] = res.data.data[i].productDesc
result["unit_price"] = res.data.data[i].unitPrice.toFixed(2)
result["note_image"] = res.data.data[i].noteImage.split("::")
var start_datetime = res.data.data[i].startDatetime
var end_datetime = res.data.data[i].endDatetime
result["start_datetime"] = start_datetime
result["end_datetime"] = end_datetime
var url_quiz = "../activity/quiz-info/quiz-info?"
+"activity_id="+result["activity_id"]
+"&index_id="+index_id
+"&note_image="+res.data.data[i].noteImage //传递原始string数据, List不正确
+"&title="+result["title"]
+"&content="+result["content"]
+"&quiz="+result["quiz"]
+"&point="+result["point"]
+"&member_id="+result["member_id"]
+"&member_name="+result["member_name"]
+"&member_slogan="+result["member_slogan"]
+"&member_logo="+result["member_logo"]
var url_activity = "../activity/activity-info/activity-info?"
+"activity_id="+result["activity_id"]
+"&index_id="+index_id
+"&note_image="+res.data.data[i].noteImage //传递原始string数据, List不正确
+"&title="+result["title"]
+"&content="+result["content"]
+"&address_name="+result["address_name"]
+"&unit_price="+result["unit_price"]
+"&product_desc="+result["product_desc"]
+"&member_id="+result["member_id"]
+"&member_name="+result["member_name"]
+"&member_slogan="+result["member_slogan"]
+"&member_logo="+result["member_logo"]
+"&start_datetime="+result["start_datetime"]
+"&end_datetime="+result["end_datetime"]
result["url"] = result["tag"]=='竞答'? url_quiz : url_activity
list.push(result)
}
//进行翻页设置(加载更多)
if (scrollType == 1) {
var activitiesList = _this.__data__.activities;
list = activitiesList.concat(list)
}
_this.setData({
activities: list,
pageIndex: pageNum + 1,
isHideLoadMore: bisHideLoadMoreType,
})
}
}
})
},
/* 搜索模块 */
// 使文本框进入可编辑状态
showInput: function () {
this.setData({
inputShowed: true //设置文本框可以输入内容
});
},
// 取消搜索
hideInput: function () {
var _this = this;
var curIndex = _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = ""
this.setData({
strSearch: strSearch,
inputShowed: false,
});
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
// * 删除输入字符串
clearInput: function(){
this.setData({
inputVal: "",
});
},
// 开始搜索
startSearch: function (e) {
var _this = this;
var strSearch = e.detail.value
var curIndex = _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
_this.setData({
strSearch: strSearch,
inputVal: strSearch,
})
},
/*
二维码信息:
1. 二维码生成: https://cli.im/
2. 二维码返回值:
charSet: "UTF-8"
errMsg: "scanCode:ok"
rawData: "b2hsa3cgaXMgYSBwaWc="
result: "ohlkw is a pig"
scanType: "QR_CODE"
二维码流程:
1. 生成流程:
1) user答完一个quiz,会生成一条记录tbl_match,
记录了如下参数:
- match_id: matchid_123
- member_id: memid_001
- user_id: uid_456
- 积分使用状态match_status(可用|不可用): 1|0
- 积分值match_point: 4.5
- 答题结果match_result: 9/10
- 答题时间create_datetime: 2020/07/30 12:00:00
- 更新时间update_datetime: 2020/07/30 12:00:00
- 积分时效状态(有效|无效)(暂不实现)
2. 扫码流程; javaapp只负责获取数据; weapp负责解析数据
1) 扫码获取记录id,发给服务器后台,
msg:
- "成功", 如果 存在 && 未使用,则置为 "已使用", match_id && match_status='01'
{
"resultCode": "200",
"totalCount": 1,
"resultMsg": "OK",
"data": [
{
"matchId": "mid_002",
"matchStatus": "01",
}
]
}
- "失败, 已使用二维码", 如果 存在 && 已使用, match_id && match_status='00'
{
"resultCode": "200",
"totalCount": 1,
"resultMsg": "OK",
"data": [
{
"matchId": "mid_001",
"matchStatus": "00",
}
]
}
- "失败, 无效二维码", 未查询到 !match_id
{
"resultCode": "200",
"totalCount": 0,
"resultMsg": "OK",
"data": []
}
*/
getQRCode: function(){
var _this = this;
wx.scanCode({ //扫描API
success: function(res){
console.log(res); //输出回调信息
_this.checkQRCode(res.result)
}
})
},
checkQRCode(qrcode_string){
var _this = this;
var strUrl = config.match_query_then_update_url + "?matchId="+qrcode_string
config.debug == 1?console.log("===checkQRCode strUrl "+strUrl):""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if ( res.data.resultCode == 200 ) {
//表示query成功
console.log("qrcode查询完成");
console.log(res)
//得到matchId
var matchList = res.data.data;
var title = ""
if(matchList.length == 0)
{
title = "失败, 无效"
}
else if( matchList[0].matchStatus == '00' )
{
title = "失败,已使用"
}
else if( matchList[0].matchStatus == '01' )
{
title = "扫码成功"
}
console.log("title="+title)
wx.showToast({
title: title,
duration: 3000
})
}
},
fail : function(res)
{
console.log("failed")
}
})
},
// 刷新页面数据
// used by switchcity.js
onUpdateData: function(){
var _this = this;
var curIndex = _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
/*
* 更换某一个memberInfo的地址信息
*/
onEntityPicker: function (e) {
var _this = this;
var curEntity = e.detail.value
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = ""
this.setData({
curIndex, curEntity, strSearch
});
app.globalData.switchId = ""
console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
// 获取entities数据 limit 10 by cityName && activityType
getEntities: function (cityName, activityType, resolve, reject) {
var _this = this;
var query_url = '?activityType=' + activityType + '&cityName=' + cityName
var strUrl = config.activity_stat_query_url + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if (res.data.resultCode == 200) {
//表示HTTP请求成功
console.log(res.data);
var list = []
var entities = []
for (var i = 0; i < res.data.data.length; i++) {
var result = {}
result["activity_type"] = res.data.data[i].activityType
result["city_name"] = res.data.data[i].cityName
result["fair_name"] = res.data.data[i].fairName
result["community_name"] = res.data.data[i].communityName
result["num_entity"] = res.data.data[i].numEntity
result["num_activity"] = res.data.data[i].numActivity
result["num_like"] = res.data.data[i].numLike
if(_this.data.activityType == "01-集市")
{
entities.push(res.data.data[i].fairName)
}
else if(_this.data.activityType == "02-园区")
{
entities.push(res.data.data[i].communityName)
}
list.push(result)
}
_this.setData({
entities: entities,
entityInfos: list,
curEntity: 0,
})
resolve("===getEntities success")
}
},
fail: function (err) {
console.log("fail to getEntities", err.errMsg)
reject(new Error('failed to getEntities'));
},
})
},
// getActivities入口函数
onGetActivities: function(){
var _this = this;
// 如果强制更新, 则不考虑_this.data.activities length是否为0
if( _this.__data__.entities.length > 0 )
{
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
this.setData({ curIndex });
app.globalData.switchId = ""
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
}
},
})
//通过Promise方式为wx.request添加同步操作
const getData = (url, param) => {
return new Promise((resolve, reject) => {
wx.request({
url: url,
method: 'GET',
data: param,
success(res) {
resolve(res.data)
},
fail(err) {
reject(err)
}
})
})
}
{
"usingComponents": {}
}
\ No newline at end of file
<wxs module="tutil" src="./../../utils/date.wxs"></wxs>
<view class="page">
<!-- 搜索框 -->
<!--refer https://blog.csdn.net/weixin_44022446/article/details/86438015 -->
<!-- 2020/07/17 jscat 微信小程序城市选择及搜索功能的方法-->
<!-- refer https://www.jb51.net/article/158292.htm -->
<!-- refer https://github.com/cinoliu/-selectCity -->
<view class="weui-search-bar">
<picker mode="selector" range="{{entities}}" value="{{curEntity}}" bindchange="onEntityPicker" class='address_member'>
<text>{{tutil.formatSubString(entities[curEntity],7)}}</text>
<image src='../../icon/down.png' style='width: 40rpx;height: 40rpx;' class='selecrtImg'></image>
</picker>
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="16"></icon>
<input type="text" class="weui-search-bar__input" placeholder="发现{{entities[curEntity]}}" value="{{inputVal}}" focus="{{inputShowed}}" bindconfirm="startSearch" />
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="16"></icon>
</view>
</view>
<label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="16"></icon>
<view class="weui-search-bar__text">发现{{tutil.formatSubString(entities[curEntity],7)}}·感兴趣的活动</view>
</label>
</view>
<view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消
</view>
</view>
<view class="workbench">
<view class="list">
<!-- jscat todo 0828 以用户为主, 扫一扫暂时也不实现 -->
<!-- <view class="items">
<view bindtap="getQRCode">
<image src="../../icon/activity/scan.png"></image>
</view>
<text>扫一扫</text>
</view> -->
<!-- todo 0820 以活动为主, 积分暂时也不实现 -->
<!-- <view class="items">
<navigator url="/pages/my/my-points/my-points">
<image src="../../icon/activity/points.png"></image>
</navigator>
<text>积分</text>
</view> -->
<!-- todo 0728 热销暂时也不实现 -->
<!-- jscat20200816 添加活动日历 for convinience -->
<block>
<view class="items">
<navigator url="/pages/activity/activity-list/activity-list?entityName={{entities[curEntity]}}&activityType={{activityType}}">
<image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">本周活动: {{entityInfos[curEntity].num_activity}}场</text>
</navigator>
</view>
</block>
<block wx:if="{{entityInfos[curEntity].num_entity > 1}}">
<view class="items">
<image src="../../icon/community/community.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">园区: {{entityInfos[curEntity].num_entity}}个</text>
</view>
</block>
<view class="items">
<image src="../../icon/activity/like.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">热度: {{entityInfos[curEntity].num_like}}点</text>
</view>
</view>
</view>
<!-- 导航栏 -->
<view class="navBar" >
<scroll-view class="navBar-box" scroll-x="true" style="white-space: nowrap; display:flex ">
<view class="cate-list {{curIndex==index?'on':''}}" wx:for="{{category}}"
wx:key="{{item.id}}" data-id="{{item.id}}" data-index="{{index}}"
bindtap="switchCategory">{{item.name}}</view>
</scroll-view>
</view>
<!-- 文章列表 -->
<!--
title
unit_price
date
like
member_name 进店 >
-->
<!-- Content: refer to 有品·优惠券 + 点评(可使用) -->
<view class="coupon-list" wx:for="{{activities}}" wx:for-item="item" wx:key="{{index}}">
<view class="item stamp stamp01" style="192rpx;">
<!-- 商品信息 -->
<view class="note-row">
<navigator url='{{item.url}}&num_like={{item.num_like}}' >
<image class="writer-image" src="{{item.note_image[0]}}"/>
</navigator>
<view class="note-column">
<navigator url='{{item.url}}&num_like={{item.num_like}}' >
<!-- 商家信息 -->
<text>{{item.title}}</text>
<!-- 商品价格 -->
<span>
<view class="price-row">
<view class="sub-price">¥{{item.unit_price}}</view>
</view>
</span>
<!-- 活动日期 -->
<span class="desc">
{{tutil.formatDate_mdw_interval(item.start_datetime, item.end_datetime)}}
</span>
</navigator>
<!-- 活动点赞 -->
<!-- <span>{{tutil.formatNumberLike(item.num_like)}}</span> -->
<!-- 商家名称 -->
<view class="note-row align">
<view class="desc-member-left">{{item.member_name}}</view>
<!-- todo 店铺功能尚未实现 -->
<!-- <view class="desc-member-right">进店 ></view> -->
</view>
</view>
</view>
</view>
</view>
<!-- 加载更多 -->
<view class="weui-loadmore" hidden="{{isHideLoadMore}}">
<view class="weui-loading"></view>
<view class="weui-loadmore__tips">正在加载</view>
</view>
<view class="weui-loadmore" hidden="{{!isHideLoadMore}}">
<view class="weui-loadmore__tips">没有更多啦 {{'>'}}_{{'<'}} </view>
</view>
</view>
/*
height: 100vh; 相对于视口(Layout Viewport)的高度; 视口被均分为100单位的vh
border-radius: 30px; 设置元素的外边框圆角
position: relative; 相对位置
em: 默认文字大小是16px, font-size: 16px; em是一个相对的大小; 1em=1*16=16px
结构: position -> margin -> ( border -> padding -> input )
position: 定位原则:子绝父相; absolute,绝对;relative,相对;fixed,固定,比如搜索框
display: inline 行内元素 不带空格 block 块级元素 带空格
margin: 上右下左 top right bottom :left
*/
.page{
/*height:100vh; 相对于视口(Layout Viewport)的高度; 视口被均分为100单位的vh */
background-color:#f5f8fa;
}
/* start of navbar navBar -> navBar-box -> cate-list -> cate-list.on */
.navBar{
height: 60rpx;
background: #fff;
border-top: 1px solid #fafafa;
}
.navBar-box{
width: 100%;
height: 60rpx;
}
.cate-list{
display: inline;
margin: 15rpx 22rpx;
text-align: center;
font-size: 32rpx;
color: #9d9d9d;
margin-left: 30rpx;
}
.navBar-box .cate-list.on {
color: #000000;
font-weight: bold;
}
/* end of navbar */
.placeholder{
margin: 0px;
text-align: center;
vertical-align: middle;
line-height: 2.3em;
color: rgba(0,0,0);
}
/* justify-content: center;(水平居中) align-items: center;(垂直居中) */
.justify{
justify-content: center;
}
.align{
align-items: center;
}
.border{
border: 3rpx solid #ccc;
border-radius: 0rpx;
padding: 10rpx;
}
.text{
font-size: 34rpx;
}
.selected{
color: #ff0000;
}
/* coupon css */
.coupon-list{width: 100%; margin: 0 auto}
.coupon-list .item{width: 100%; height: 300rpx;}
.coupon-list .item .float-li{width: 100%; height: 100%; border-right: 2rpx dashed rgba(255,255,255,.3)}
.coupon-list .item .float-li-right{width: 220rpx; padding-right: 20rpx; height:100%; color: #fff}
.coupon-left{position: relative}
.coupon-left .t{position: absolute; color: #fff}
.coupon-left .t1{width: 710rpx; display: flex; margin-left: 20rpx; margin-top: 20rpx; height: 160rpx; color: #fff}
.coupon-left .t1-left{width: 160rpx; font-size: 70rpx; font-weight: bold}
.coupon-left .t1-right{width: 520rpx; font-size: 50rpx; }
/* .coupon-left .t2{left: 20rpx; top:160rpx} */
.coupon-left .t2{width: 710rpx; display: flex; margin-left: 20rpx; margin-top: 0rpx; height: 50rpx; color: #fff}
.coupon-left .t2-left{width: 520rpx; }
.coupon-left .t2-right{width: 160rpx;}
.coupon-left .t3{width: 710rpx; display: flex; margin-left: 20rpx; margin-top: 0rpx; height: 50rpx; color: #fff}
.coupon-left .t3-left{width: 520rpx; }
.coupon-left .t3-right{width: 160rpx;}
.coupon-left .t3-right image{
width: 40rpx;
height: 40rpx;
font-size: 0;
}
.coupon-left .t4{width: 710rpx; display: flex; margin-left: 20rpx; margin-top: 0rpx; height: 50rpx; color: #fff}
.coupon-left .t4-left{width: 520rpx; }
.coupon-left .t4-right{width: 160rpx;}
.coupon-left .t4-right image{
width: 40rpx;
height: 40rpx;
font-size: 0;
}
.coupon-right .t{text-align: center}
.coupon-right .t1{font-size: 40rpx; padding: 30rpx 0 10rpx 0;}
.coupon-right .t3{padding-top:20rpx}
.coupon-right .t3 text{background: #fff; color: #333; border-radius: 7rpx; padding: 10rpx 40rpx}
.note{background: #faeab7}
.stamp{position:relative;overflow:hidden}
.stamp i{position: absolute;left: 20%;top: 90rpx;height: 500rpx;width: 700rpx;background-color: rgba(255,255,255,.15);transform: rotate(-30deg);
}
.stamp01{background:radial-gradient(rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 30rpx, #F39B00 30rpx);background-size:10rpx 10rpx;background-position:9rpx 3rpx; background: #FFFFFF}
/* 失效样式 */
.stamp06{background:radial-gradient(rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 30rpx, #e2e2e2 30rpx);background-size:10rpx 10rpx;background-position:9rpx 3rpx; background: #acacac
}
/* start - 小程序自定义弹框css */
/* 遮罩层 */
.mask{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
z-index: 9000;
opacity: 0.5;
}
/* 弹出层 */
.modalDlg{
width: 80%;
height: 540rpx;
position: fixed;
top: 240rpx;
left: 0;
right: 0;
z-index: 9999;
margin: 0 auto;
background-color: #fff;
border-radius:5px;
display: flex;
flex-direction: column;
align-items: center;
}
/* 弹出层里面的图片 */
/* 弹出层里面的文字 */
.title{
display: flex;
font-size: 38rpx;
color: #cccccc;
width: 80%;
height: 80rpx;
padding: 20rpx;
align-items: center;
justify-content: center;
}
.title-right{
display: flex;
height: 80rpx;
position: absolute;
align-items: center;
text-align: right;
font-size: 38rpx;
color: #cccccc;
padding: 20rpx;
right: 20rpx;
}
.title-right image{
width: 50rpx;
height: 50rpx;
font-size: 0;
}
/* 图片+文字 */
.weui-width{
width: 80%;
}
.placeholder-modal{
margin: 0px;
text-align: center;
vertical-align: middle;
line-height: 2.3em;
background-color: #fff;
}
/* 好友助力积分列表 */
.list-point{
width: 100%;
height: 2rpx;
background: #ccc;
font-size: 32rpx;
display: flex;
flex-direction: column;
/* align-items: center; */
left: 40rpx;
}
.list-point .text{
margin-left: 160rpx;
}
.title-right image{
width: 50rpx;
height: 50rpx;
font-size: 0;
}
/* barcode券码查看 */
.list-barcode{
width: 100%;
height: 2rpx;
background: #ccc;
font-size: 32rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.list-barcode .text{
align-items: center;
margin-left: 20rpx;
}
.list-barcode image{
overflow: visible;
width: 300rpx;
height: 300rpx;
}
/* 弹出层里面的按钮 */
.ok{
width: 100%;
height: 2rpx;
background: #ccc;
text-align: center;
font-size: 38rpx;
color: #666666;
}
/* end - 小程序自定义弹框css */
/* start 加载更多 */
.weui-loading {
margin: 0 5px;
width: 20px;
height: 20px;
display: inline-block;
vertical-align: middle;
-webkit-animation: weuiLoading 1s steps(12, end) infinite;
animation: weuiLoading 1s steps(12, end) infinite;
background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;
background-size: 100%;
}
.weui-loadmore {
width: 65%;
margin: 1.5em auto;
line-height: 1.6em;
font-size: 14px;
text-align: center;
}
.weui-loadmore__tips {
display: inline-block;
vertical-align: middle;
}
/* end 加载更多*/
.note-info{
width: 100%;
/* position: fixed; */
border-radius: 5rpx;
float: left;
margin-top: 20rpx;
margin-bottom: 20rpx;
}
.note-member{
display: flex;
font-size: 32rpx;
margin-left: 5%;
margin-right: 5%;
margin-top: 0;
text-align:justify;
vertical-align: center;
}
.note-member .member-left{width: 520rpx; flex:1}
.note-member .member-right{width: 160rpx;justify-content: flex-end;display: flex;}
.note-member .member-right image{
width: 60rpx;
height: 60rpx;
font-size: 0;
}
.note-price{
color: #FF6600;
font-size: 16px;
margin-left: 5%;
margin-right: 5%;
margin-top: 0;
text-align:justify;
}
.note-content{
font-size: 16px;
/* 后期用于 '展开' 功能 */
/* overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical; */
margin-left: 5%;
margin-right: 4%;
margin-top: 20rpx;
text-align:justify;
}
.note-row{
width: 100%;
display: flex;
flex-direction: row;
}
.note-column{
display: flex;
flex-direction: column;
margin-left: 30rpx;
margin-right: 30rpx;
width: 55%;
}
.note-column text{
/* 多行溢出省略 */
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp:2;
overflow: hidden;
text-overflow:ellipsis;
}
.writer-image{
width: 240rpx;
height: 240rpx;
margin-left: 30rpx;
margin-top: 10rpx;
}
.price-row{
display: flex;
flex-direction: row;
}
.sub-price{
color: #FF6600;
font-size: 34rpx;
margin-right: 5%;
margin-top: 0;
text-align:justify;
flex: 1;
font-weight: bold;
}
.sub-quantity{
display: flex;
font-size: 16px;
justify-content: flex-end;
}
/* refer to jd */
.desc {
font-size: 30rpx;
color: #a7a7a7;
}
.desc-member-left {
font-size: 30rpx;
color: #a7a7a7;
margin-right: 20rpx;
}
.desc-member-right {
font-size: 30rpx;
}
/* start of workbench*/
.workbench{
font-size: 32rpx;
background: #fff;
padding-bottom: 10rpx;
margin-bottom:10rpx;
padding-top: 5rpx;
margin-top:5rpx;
color: #333;
}
.workbench .title{
font-size: 32rpx;
padding: 20rpx 20rpx;
margin-bottom: 40rpx;
display: block;
}
.workbench .items{
width: 100rpx;
flex:1;
text-align: center;
}
.workbench .items image{
width: 60rpx;
height: 60rpx;
}
.workbench .items image.service-icon{
width: 50rpx;
height: 50rpx;
}
.workbench .items text{
display: block;
text-align: center;
margin-top: 0rpx;
margin-bottom: 0rpx;
}
.workbench .items text.top{
display: block;
text-align: center;
margin-bottom: 0rpx;
}
.workbench .items text.bottom{
display: block;
text-align: center;
margin-top: 0rpx;
}
.workbench .list{
display: flex;
flex-direction: row;
flex:1;
}
/* end of workbench*/
// pages/activity/activity.js
const app = getApp()
var config = wx.getStorageSync("config");
var util = require('./../../utils/util.js')
var event = require('./../../utils/event.js')
//const { globalData: { defaultCity, defaultCounty } } = app
Page({
/**
* 页面的初始数据
*/
data: {
/* 用户信息及商家信息 */
nyxCode : "",
authStatus : "", // 授权状态: 00-未授权, 01-已授权
userInfo : {},
members : "", // 商家信息
member : {},
city: "",
county: "",
category: [ // 导航栏内容数据
{ name: '点赞', order : 'like' },
{ name: '价格', order : 'price' },
{ name: '最新', order : 'nearest' },
],
curIndex: 0, // 给选中的tab加粗
activities: [],
// {
// note_image: [ "https://1.jpg", "https://2.jpg"],
// title: "一天",
// like: 10,
// writer_name: "无敌花木兰",
// writer_image: "../../icon/icon_avatar3.png"
// },
//分页加载部分
isHideLoadMore: false,
pageIndex: 1, //分页搜索的page index
//页面格式
deviceRatio: 1,
navHeight: 0,
searchHeight: 0,
noteTop: 0,
noteHeight: 0,
//搜索模块
inputShowed: false, //初始文本框不显示内容
strSearch : "", //搜索的title字串
strAddress : "思南公馆", //搜索的address字串
inputVal : "", //输入字符串,主要用于页面显示
//二维码信息
qRCodeMsg: "",
//园区
activityType: "01-集市",
entities: [], //包括fair和community
/*
集市/园区所在的信息
fair_name, community_name, num_activity, num_like
*/
entityInfos: {},
curEntity: 0,
},
switchCategory(e) {
var _this = this;
var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
this.setData({
curIndex: curIndex,
})
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
// 搜索点击事件
entrySearch(e) {
wx.navigateTo({
url: '../index/searchbar/searchbar',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var _this = this;
//入口页面,先确定nyxCode
/*step1 先确定用户信息 -- global page 需求 */
var nyxCode = wx.getStorageSync('nyxCode');
//step2 确定城市信息 -- local page 需求
var LatestCityList = wx.getStorageSync('LatestCityList') || []
if( LatestCityList.length > 0 )
{
var city = LatestCityList[0]["city"]
app.globalData.defaultCity = city
_this.setData({ city })
}
else
{
var city = app.globalData.defaultCity
_this.setData({ city })
}
//不存在
if (!nyxCode)
{
//注册新用户
console.log("===onLoad_regUser")
wx.clearStorageSync('nyxCode');
var nyxCode = "uid_" + util.wxuuid()
wx.setStorageSync('nyxCode', nyxCode);
app.globalData.nyxCode = nyxCode;
app.regUser(nyxCode); // nyxCode, userInfo, authStatus: storage, globalData
}
else //存在
{
//初始化数据
_this.setData({
nyxCode: wx.getStorageSync('nyxCode'),
userInfo: wx.getStorageSync('userInfo'),
authStatus: wx.getStorageSync('authStatus'),
members : wx.getStorageSync('members'),
})
//更新用户信息
var strUrl = config.userinfo_query_url + "?userid=" + nyxCode
wx.setStorageSync('nyxCode', nyxCode);
app.globalData.nyxCode = nyxCode;
config.debug == 1 ? console.log("===getLatestUserInfo strUrl_" + strUrl) : 1
getData(strUrl, "").then(res => {
console.log(res.data)
if(res.data.length==0) //数据库不存在该用户(误删除或者测试数据已删除)
{
//以该id注册新用户
console.log("===onLoad_Update User Info")
app.regUser(nyxCode);
}
else
{
var list = res.data[0]
app.globalData.nyxCode = nyxCode;
wx.setStorageSync('nyxCode', nyxCode);
app.globalData.userInfo = list
wx.setStorageSync('userInfo', list)
console.log("==onLoad_userInfo success")
}
})
}
// step3 确定member信息, 写入 data.members
let promise_member = new Promise(function (resolve, reject) {
app.getMembers(0, 1, 20, resolve, reject);
})
promise_member.then(
function (value){
var members = wx.getStorageSync('members')
var member = wx.getStorageSync('member')
_this.setData({ member, members})
console.log("===enter promise_member then_passed_" + value)
},
function (value){
console.log("===enter promise_member then_failed_" + value)
},
);
// step4 数据载入页面, 初始化 - global page
// 初始载入'我已收藏'的清单, 存入storage
wx.setStorageSync('likeDictStorage', {})
let promise_like = new Promise(function (resolve, reject) {
app.getCollectsStorage(0, 1, 100, resolve, reject);
})
promise_like.then(
function (value){
console.log("===enter promise_like then_passed_" + value)
},
function (value){
console.log("===enter promise_like then_failed_" + value)
}
)
// step5 new add jscat 20201008 载入园区列表 - local page
var strCity = app.globalData.defaultCity
var activityType = _this.__data__.activityType
let promise_entity = new Promise(function (resolve, reject) {
_this.getEntities(strCity, activityType, resolve, reject);
})
// step6 初始载入四个推荐的活动 - local page
promise_entity.then(
function (value){
console.log("===enter promise_entity then_passed_" + value)
_this.onGetActivities()
},
function (value){
console.log("===enter promise_entity then_failed_" + value)
}
)
// step7 event 订阅, 主要接受activity-info.js里 emit 发送的消息 local page
event.on('LikeChanged', this, function(data) {
var activity_id = data['activity_id']
var num_like = data['num_like']
var activities = _this.__data__.activities;
for(var i=0; i< activities.length; i++)
{
if(activity_id == activities[i]['activity_id'])
{
activities[i]['num_like'] = num_like
}
}
_this.setData({
activities: activities,
})
})
// step8 窗口初始化
var device = wx.getSystemInfoSync()
//self.device = app.globalData.myDevice
// jscat miniprogram default width is 750rpx
var deviceRatio = device.windowWidth / 750
var winWidth = device.windowWidth * deviceRatio
var noteHeight = device.windowHeight - (40 - 60)
_this.setData({
searchHeight: 40,
navHeight: 40,
noteTop : (40+40),
noteHeight: noteHeight,
deviceRatio: deviceRatio,
})
wx.setNavigationBarTitle({
title: '集市活动',
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
var _this = this;
const { globalData: { defaultCity, defaultCounty } } = app
this.setData({
city: defaultCity,
county: defaultCounty
})
if(app.globalData.citySwitched == 1)
{
var strCity = app.globalData.defaultCity
var activityType = _this.__data__.activityType
let promise_entity = new Promise(function (resolve, reject) {
_this.getEntities(strCity, activityType, resolve, reject);
})
// step6 初始载入四个推荐的活动 - local page
promise_entity.then(
function (value){
console.log("===enter promise_entity then_passed_" + value)
_this.onGetActivities()
},
function (value){
console.log("===enter promise_entity then_failed_" + value)
}
)
app.globalData.citySwitched = 0
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
event.remove('LikeChanged', this);
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
console.log('页面上拉触底')
var _this = this;
var curIndex = _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
var isHideLoadMore = _this.__data__.isHideLoadMore;
var pageIndex = _this.__data__.pageIndex;
//控制逻辑, 下拉更新操作
//判断是否已经全部加载完毕
//没有则加载更多
if (!isHideLoadMore) {
console.log('加载更多')
setTimeout(() => {
_this.getActivities(1, pageIndex, 4, strAddress, strEntity, strCategory, strSearch);
}, 1000)
}
else {
console.log('没有更多')
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
/**
* 用户自定义函数
*
*/
// 获取Activities数据
// scrollType: 是否是翻页
/*
搜索逻辑:
1. 搜索框, tag=strSearch + title=strSearch
2. tab, tag=strSearch
3. 新增的search tab, '搜索'tab的时候,需要转换为搜索的关键词(_this.__data__.strSearch)
4. jscat 20201008 新增按照entity搜索(fair/community)
*/
getActivities: function (scrollType, pageNum, pageCount, strAddress, strEntity, strCategory, strSearch) {
var _this = this;
var activityType = _this.__data__.activityType
// 如果是"推荐"和"搜索",需要单独处理
// '搜索'tab的时候, 需要转换为搜索的关键词(_this.__data__.strSearch)
var query_url = '&title=' + strSearch + '&orderType=' + strCategory + '&city=' + strAddress
+ '&activityType=' + activityType + '&entityName=' + strEntity
var strUrl = config.activity_query_url + "?pageCount=" + pageCount
+ "&pageNum=" + pageNum + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if (res.data.resultCode == 200) {
//表示HTTP请求成功
console.log(res.data);
var list = []
var bisHideLoadMoreType = false;
if (res.data.data.length < pageCount) {
bisHideLoadMoreType = true;
}
for (var i = 0; i < res.data.data.length; i++) {
var index_id = i + _this.__data__.activities.length
var result = {}
result["activity_id"] = res.data.data[i].activityId
result["member_name"] = res.data.data[i].memberName
result["member_slogan"] = res.data.data[i].memberSlogan
result["member_id"] = res.data.data[i].memberId
result["member_status"] = res.data.data[i].memberStatus
result["member_logo"] = res.data.data[i].memberLogo
result["tag"] = res.data.data[i].tag
result["title"] = res.data.data[i].title
result["num_like"] = res.data.data[i].numLike
result["content"] = res.data.data[i].content
result["quiz"] = res.data.data[i].quiz
result["point"] = res.data.data[i].point
result["address_name"] = res.data.data[i].addressName
result["product_desc"] = res.data.data[i].productDesc
result["unit_price"] = res.data.data[i].unitPrice.toFixed(2)
result["note_image"] = res.data.data[i].noteImage.split("::")
var start_datetime = res.data.data[i].startDatetime
var end_datetime = res.data.data[i].endDatetime
result["start_datetime"] = start_datetime
result["end_datetime"] = end_datetime
var url_quiz = "../activity/quiz-info/quiz-info?"
+"activity_id="+result["activity_id"]
+"&index_id="+index_id
+"&note_image="+res.data.data[i].noteImage //传递原始string数据, List不正确
+"&title="+result["title"]
+"&content="+result["content"]
+"&quiz="+result["quiz"]
+"&point="+result["point"]
+"&member_id="+result["member_id"]
+"&member_name="+result["member_name"]
+"&member_slogan="+result["member_slogan"]
+"&member_logo="+result["member_logo"]
var url_activity = "../activity/activity-info/activity-info?"
+"activity_id="+result["activity_id"]
+"&index_id="+index_id
+"&note_image="+res.data.data[i].noteImage //传递原始string数据, List不正确
+"&title="+result["title"]
+"&content="+result["content"]
+"&address_name="+result["address_name"]
+"&unit_price="+result["unit_price"]
+"&product_desc="+result["product_desc"]
+"&member_id="+result["member_id"]
+"&member_name="+result["member_name"]
+"&member_slogan="+result["member_slogan"]
+"&member_logo="+result["member_logo"]
+"&start_datetime="+result["start_datetime"]
+"&end_datetime="+result["end_datetime"]
result["url"] = result["tag"]=='竞答'? url_quiz : url_activity
list.push(result)
}
//进行翻页设置(加载更多)
if (scrollType == 1) {
var activitiesList = _this.__data__.activities;
list = activitiesList.concat(list)
}
_this.setData({
activities: list,
pageIndex: pageNum + 1,
isHideLoadMore: bisHideLoadMoreType,
})
}
}
})
},
/* 搜索模块 */
// 使文本框进入可编辑状态
showInput: function () {
this.setData({
inputShowed: true //设置文本框可以输入内容
});
},
// 取消搜索
hideInput: function () {
var _this = this;
var curIndex = _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = ""
this.setData({
strSearch: strSearch,
inputShowed: false,
});
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
// * 删除输入字符串
clearInput: function(){
this.setData({
inputVal: "",
});
},
// 开始搜索
startSearch: function (e) {
var _this = this;
var strSearch = e.detail.value
var curIndex = _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
_this.setData({
strSearch: strSearch,
inputVal: strSearch,
})
},
/*
二维码信息:
1. 二维码生成: https://cli.im/
2. 二维码返回值:
charSet: "UTF-8"
errMsg: "scanCode:ok"
rawData: "b2hsa3cgaXMgYSBwaWc="
result: "ohlkw is a pig"
scanType: "QR_CODE"
二维码流程:
1. 生成流程:
1) user答完一个quiz,会生成一条记录tbl_match,
记录了如下参数:
- match_id: matchid_123
- member_id: memid_001
- user_id: uid_456
- 积分使用状态match_status(可用|不可用): 1|0
- 积分值match_point: 4.5
- 答题结果match_result: 9/10
- 答题时间create_datetime: 2020/07/30 12:00:00
- 更新时间update_datetime: 2020/07/30 12:00:00
- 积分时效状态(有效|无效)(暂不实现)
2. 扫码流程; javaapp只负责获取数据; weapp负责解析数据
1) 扫码获取记录id,发给服务器后台,
msg:
- "成功", 如果 存在 && 未使用,则置为 "已使用", match_id && match_status='01'
{
"resultCode": "200",
"totalCount": 1,
"resultMsg": "OK",
"data": [
{
"matchId": "mid_002",
"matchStatus": "01",
}
]
}
- "失败, 已使用二维码", 如果 存在 && 已使用, match_id && match_status='00'
{
"resultCode": "200",
"totalCount": 1,
"resultMsg": "OK",
"data": [
{
"matchId": "mid_001",
"matchStatus": "00",
}
]
}
- "失败, 无效二维码", 未查询到 !match_id
{
"resultCode": "200",
"totalCount": 0,
"resultMsg": "OK",
"data": []
}
*/
getQRCode: function(){
var _this = this;
wx.scanCode({ //扫描API
success: function(res){
console.log(res); //输出回调信息
_this.checkQRCode(res.result)
}
})
},
checkQRCode(qrcode_string){
var _this = this;
var strUrl = config.match_query_then_update_url + "?matchId="+qrcode_string
config.debug == 1?console.log("===checkQRCode strUrl "+strUrl):""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if ( res.data.resultCode == 200 ) {
//表示query成功
console.log("qrcode查询完成");
console.log(res)
//得到matchId
var matchList = res.data.data;
var title = ""
if(matchList.length == 0)
{
title = "失败, 无效"
}
else if( matchList[0].matchStatus == '00' )
{
title = "失败,已使用"
}
else if( matchList[0].matchStatus == '01' )
{
title = "扫码成功"
}
console.log("title="+title)
wx.showToast({
title: title,
duration: 3000
})
}
},
fail : function(res)
{
console.log("failed")
}
})
},
// 刷新页面数据
// used by switchcity.js
onUpdateData: function(){
var _this = this;
var curIndex = _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
/*
* 更换某一个memberInfo的地址信息
*/
onEntityPicker: function (e) {
var _this = this;
var curEntity = e.detail.value
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = ""
this.setData({
curIndex, curEntity, strSearch
});
app.globalData.switchId = ""
console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
},
// 获取entities数据 limit 10 by cityName && activityType
getEntities: function (cityName, activityType, resolve, reject) {
var _this = this;
var query_url = '?activityType=' + activityType + '&cityName=' + cityName
var strUrl = config.activity_stat_query_url + query_url
config.debug == 1 ? console.log("===strUrl is: \"" + strUrl + "\"") : ""
wx.request({
url: strUrl,
method: 'GET',
header: {
'Cookie': wx.getStorageSync('cookieKey'),
},
success: function (res) {
if (res.data.resultCode == 200) {
//表示HTTP请求成功
console.log(res.data);
var list = []
var entities = []
for (var i = 0; i < res.data.data.length; i++) {
var result = {}
result["activity_type"] = res.data.data[i].activityType
result["city_name"] = res.data.data[i].cityName
result["fair_name"] = res.data.data[i].fairName
result["community_name"] = res.data.data[i].communityName
result["num_entity"] = res.data.data[i].numEntity
result["num_activity"] = res.data.data[i].numActivity
result["num_like"] = res.data.data[i].numLike
if(_this.data.activityType == "01-集市")
{
entities.push(res.data.data[i].fairName)
}
else if(_this.data.activityType == "02-园区")
{
entities.push(res.data.data[i].communityName)
}
list.push(result)
}
_this.setData({
entities: entities,
entityInfos: list,
curEntity: 0,
})
resolve("===getEntities success")
}
},
fail: function (err) {
console.log("fail to getEntities", err.errMsg)
reject(new Error('failed to getEntities'));
},
})
},
// getActivities入口函数
onGetActivities: function(){
var _this = this;
// 如果强制更新, 则不考虑_this.data.activities length是否为0
if( _this.__data__.entities.length > 0 )
{
var switchId = app.globalData.switchId
var curIndex = switchId != ""? switchId : _this.__data__.curIndex
var curEntity = _this.__data__.curEntity
var strAddress = app.globalData.defaultCity
var strEntity = _this.__data__.entities[curEntity]
var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch
this.setData({ curIndex });
app.globalData.switchId = ""
_this.getActivities(0, 1, 4, strAddress, strEntity, strCategory, strSearch);
}
},
})
//通过Promise方式为wx.request添加同步操作
const getData = (url, param) => {
return new Promise((resolve, reject) => {
wx.request({
url: url,
method: 'GET',
data: param,
success(res) {
resolve(res.data)
},
fail(err) {
reject(err)
}
})
})
}
{
"usingComponents": {}
}
\ No newline at end of file
<wxs module="tutil" src="./../../utils/date.wxs"></wxs>
<view class="page">
<!-- 搜索框 -->
<!--refer https://blog.csdn.net/weixin_44022446/article/details/86438015 -->
<!-- 2020/07/17 jscat 微信小程序城市选择及搜索功能的方法-->
<!-- refer https://www.jb51.net/article/158292.htm -->
<!-- refer https://github.com/cinoliu/-selectCity -->
<view class="weui-search-bar">
<picker mode="selector" range="{{entities}}" value="{{curEntity}}" bindchange="onEntityPicker" class='address_member'>
<text>{{tutil.formatSubString(entities[curEntity],7)}}</text>
<image src='../../icon/down.png' style='width: 40rpx;height: 40rpx;' class='selecrtImg'></image>
</picker>
<view class="weui-search-bar__form">
<view class="weui-search-bar__box">
<icon class="weui-icon-search_in-box" type="search" size="16"></icon>
<input type="text" class="weui-search-bar__input" placeholder="发现{{tutil.formatSubString(entities[curEntity],7)}}" value="{{inputVal}}" focus="{{inputShowed}}" bindconfirm="startSearch" />
<view class="weui-icon-clear" wx:if="{{inputVal.length > 0}}" bindtap="clearInput">
<icon type="clear" size="16"></icon>
</view>
</view>
<label class="weui-search-bar__label" hidden="{{inputShowed}}" bindtap="showInput">
<icon class="weui-icon-search" type="search" size="16"></icon>
<view class="weui-search-bar__text">发现{{tutil.formatSubString(entities[curEntity],7)}}·感兴趣的活动</view>
</label>
</view>
<view class="weui-search-bar__cancel-btn" hidden="{{!inputShowed}}" bindtap="hideInput">取消
</view>
</view>
<view class="workbench">
<view class="list">
<!-- jscat todo 0828 以用户为主, 扫一扫暂时也不实现 -->
<!-- <view class="items">
<view bindtap="getQRCode">
<image src="../../icon/activity/scan.png"></image>
</view>
<text>扫一扫</text>
</view> -->
<!-- todo 0820 以活动为主, 积分暂时也不实现 -->
<!-- <view class="items">
<navigator url="/pages/my/my-points/my-points">
<image src="../../icon/activity/points.png"></image>
</navigator>
<text>积分</text>
</view> -->
<!-- todo 0728 热销暂时也不实现 -->
<!-- jscat20200816 添加活动日历 for convinience -->
<block>
<view class="items">
<navigator url="/pages/activity/activity-list/activity-list?entityName={{entities[curEntity]}}&activityType={{activityType}}">
<image src="../../icon/member/schedule.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">本周活动: {{entityInfos[curEntity].num_activity}}场</text>
</navigator>
</view>
</block>
<block wx:if="{{entityInfos[curEntity].num_entity > 1}}">
<view class="items">
<image src="../../icon/fair/fair.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">集市: {{entityInfos[curEntity].num_entity}}个</text>
</view>
</block>
<view class="items">
<image src="../../icon/activity/like.png" style="margin-top:10rpx; margin-bottom:-10rpx"></image>
<text style="font-size:28rpx;">热度: {{entityInfos[curEntity].num_like}}点</text>
</view>
</view>
</view>
<!-- 导航栏 -->
<view class="navBar" >
<scroll-view class="navBar-box" scroll-x="true" style="white-space: nowrap; display:flex ">
<view class="cate-list {{curIndex==index?'on':''}}" wx:for="{{category}}"
wx:key="{{item.id}}" data-id="{{item.id}}" data-index="{{index}}"
bindtap="switchCategory">{{item.name}}</view>
</scroll-view>
</view>
<!-- 文章列表 -->
<!--
title
unit_price
date
like
member_name 进店 >
-->
<!-- Content: refer to 有品·优惠券 + 点评(可使用) -->
<view class="coupon-list" wx:for="{{activities}}" wx:for-item="item" wx:key="{{index}}">
<view class="item stamp stamp01" style="192rpx;">
<!-- 商品信息 -->
<view class="note-row">
<navigator url='{{item.url}}&num_like={{item.num_like}}' >
<image class="writer-image" src="{{item.note_image[0]}}"/>
</navigator>
<view class="note-column">
<navigator url='{{item.url}}&num_like={{item.num_like}}' >
<!-- 商家信息 -->
<text>{{item.title}}</text>
<!-- 商品价格 -->
<span>
<view class="price-row">
<view class="sub-price">¥{{item.unit_price}}</view>
</view>
</span>
<!-- 活动日期 -->
<span class="desc">
{{tutil.formatDate_mdw_interval(item.start_datetime, item.end_datetime)}}
</span>
</navigator>
<!-- 活动点赞 -->
<!-- <span>{{tutil.formatNumberLike(item.num_like)}}</span> -->
<!-- 商家名称 -->
<view class="note-row align">
<view class="desc-member-left">{{item.member_name}}</view>
<!-- todo 店铺功能尚未实现 -->
<!-- <view class="desc-member-right">进店 ></view> -->
</view>
</view>
</view>
</view>
</view>
<!-- 加载更多 -->
<view class="weui-loadmore" hidden="{{isHideLoadMore}}">
<view class="weui-loading"></view>
<view class="weui-loadmore__tips">正在加载</view>
</view>
<view class="weui-loadmore" hidden="{{!isHideLoadMore}}">
<view class="weui-loadmore__tips">没有更多啦 {{'>'}}_{{'<'}} </view>
</view>
</view>
/*
height: 100vh; 相对于视口(Layout Viewport)的高度; 视口被均分为100单位的vh
border-radius: 30px; 设置元素的外边框圆角
position: relative; 相对位置
em: 默认文字大小是16px, font-size: 16px; em是一个相对的大小; 1em=1*16=16px
结构: position -> margin -> ( border -> padding -> input )
position: 定位原则:子绝父相; absolute,绝对;relative,相对;fixed,固定,比如搜索框
display: inline 行内元素 不带空格 block 块级元素 带空格
margin: 上右下左 top right bottom :left
*/
.page{
/*height:100vh; 相对于视口(Layout Viewport)的高度; 视口被均分为100单位的vh */
background-color:#f5f8fa;
}
/* start of navbar navBar -> navBar-box -> cate-list -> cate-list.on */
.navBar{
height: 60rpx;
background: #fff;
border-top: 1px solid #fafafa;
}
.navBar-box{
width: 100%;
height: 60rpx;
}
.cate-list{
display: inline;
margin: 15rpx 22rpx;
text-align: center;
font-size: 32rpx;
color: #9d9d9d;
margin-left: 30rpx;
}
.navBar-box .cate-list.on {
color: #000000;
font-weight: bold;
}
/* end of navbar */
.placeholder{
margin: 0px;
text-align: center;
vertical-align: middle;
line-height: 2.3em;
color: rgba(0,0,0);
}
/* justify-content: center;(水平居中) align-items: center;(垂直居中) */
.justify{
justify-content: center;
}
.align{
align-items: center;
}
.border{
border: 3rpx solid #ccc;
border-radius: 0rpx;
padding: 10rpx;
}
.text{
font-size: 34rpx;
}
.selected{
color: #ff0000;
}
/* coupon css */
.coupon-list{width: 100%; margin: 0 auto}
.coupon-list .item{width: 100%; height: 300rpx;}
.coupon-list .item .float-li{width: 100%; height: 100%; border-right: 2rpx dashed rgba(255,255,255,.3)}
.coupon-list .item .float-li-right{width: 220rpx; padding-right: 20rpx; height:100%; color: #fff}
.coupon-left{position: relative}
.coupon-left .t{position: absolute; color: #fff}
.coupon-left .t1{width: 710rpx; display: flex; margin-left: 20rpx; margin-top: 20rpx; height: 160rpx; color: #fff}
.coupon-left .t1-left{width: 160rpx; font-size: 70rpx; font-weight: bold}
.coupon-left .t1-right{width: 520rpx; font-size: 50rpx; }
/* .coupon-left .t2{left: 20rpx; top:160rpx} */
.coupon-left .t2{width: 710rpx; display: flex; margin-left: 20rpx; margin-top: 0rpx; height: 50rpx; color: #fff}
.coupon-left .t2-left{width: 520rpx; }
.coupon-left .t2-right{width: 160rpx;}
.coupon-left .t3{width: 710rpx; display: flex; margin-left: 20rpx; margin-top: 0rpx; height: 50rpx; color: #fff}
.coupon-left .t3-left{width: 520rpx; }
.coupon-left .t3-right{width: 160rpx;}
.coupon-left .t3-right image{
width: 40rpx;
height: 40rpx;
font-size: 0;
}
.coupon-left .t4{width: 710rpx; display: flex; margin-left: 20rpx; margin-top: 0rpx; height: 50rpx; color: #fff}
.coupon-left .t4-left{width: 520rpx; }
.coupon-left .t4-right{width: 160rpx;}
.coupon-left .t4-right image{
width: 40rpx;
height: 40rpx;
font-size: 0;
}
.coupon-right .t{text-align: center}
.coupon-right .t1{font-size: 40rpx; padding: 30rpx 0 10rpx 0;}
.coupon-right .t3{padding-top:20rpx}
.coupon-right .t3 text{background: #fff; color: #333; border-radius: 7rpx; padding: 10rpx 40rpx}
.note{background: #faeab7}
.stamp{position:relative;overflow:hidden}
.stamp i{position: absolute;left: 20%;top: 90rpx;height: 500rpx;width: 700rpx;background-color: rgba(255,255,255,.15);transform: rotate(-30deg);
}
.stamp01{background:radial-gradient(rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 30rpx, #F39B00 30rpx);background-size:10rpx 10rpx;background-position:9rpx 3rpx; background: #FFFFFF}
/* 失效样式 */
.stamp06{background:radial-gradient(rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 30rpx, #e2e2e2 30rpx);background-size:10rpx 10rpx;background-position:9rpx 3rpx; background: #acacac
}
/* start - 小程序自定义弹框css */
/* 遮罩层 */
.mask{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background: #000;
z-index: 9000;
opacity: 0.5;
}
/* 弹出层 */
.modalDlg{
width: 80%;
height: 540rpx;
position: fixed;
top: 240rpx;
left: 0;
right: 0;
z-index: 9999;
margin: 0 auto;
background-color: #fff;
border-radius:5px;
display: flex;
flex-direction: column;
align-items: center;
}
/* 弹出层里面的图片 */
/* 弹出层里面的文字 */
.title{
display: flex;
font-size: 38rpx;
color: #cccccc;
width: 80%;
height: 80rpx;
padding: 20rpx;
align-items: center;
justify-content: center;
}
.title-right{
display: flex;
height: 80rpx;
position: absolute;
align-items: center;
text-align: right;
font-size: 38rpx;
color: #cccccc;
padding: 20rpx;
right: 20rpx;
}
.title-right image{
width: 50rpx;
height: 50rpx;
font-size: 0;
}
/* 图片+文字 */
.weui-width{
width: 80%;
}
.placeholder-modal{
margin: 0px;
text-align: center;
vertical-align: middle;
line-height: 2.3em;
background-color: #fff;
}
/* 好友助力积分列表 */
.list-point{
width: 100%;
height: 2rpx;
background: #ccc;
font-size: 32rpx;
display: flex;
flex-direction: column;
/* align-items: center; */
left: 40rpx;
}
.list-point .text{
margin-left: 160rpx;
}
.title-right image{
width: 50rpx;
height: 50rpx;
font-size: 0;
}
/* barcode券码查看 */
.list-barcode{
width: 100%;
height: 2rpx;
background: #ccc;
font-size: 32rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.list-barcode .text{
align-items: center;
margin-left: 20rpx;
}
.list-barcode image{
overflow: visible;
width: 300rpx;
height: 300rpx;
}
/* 弹出层里面的按钮 */
.ok{
width: 100%;
height: 2rpx;
background: #ccc;
text-align: center;
font-size: 38rpx;
color: #666666;
}
/* end - 小程序自定义弹框css */
/* start 加载更多 */
.weui-loading {
margin: 0 5px;
width: 20px;
height: 20px;
display: inline-block;
vertical-align: middle;
-webkit-animation: weuiLoading 1s steps(12, end) infinite;
animation: weuiLoading 1s steps(12, end) infinite;
background: transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;
background-size: 100%;
}
.weui-loadmore {
width: 65%;
margin: 1.5em auto;
line-height: 1.6em;
font-size: 14px;
text-align: center;
}
.weui-loadmore__tips {
display: inline-block;
vertical-align: middle;
}
/* end 加载更多*/
.note-info{
width: 100%;
/* position: fixed; */
border-radius: 5rpx;
float: left;
margin-top: 20rpx;
margin-bottom: 20rpx;
}
.note-member{
display: flex;
font-size: 32rpx;
margin-left: 5%;
margin-right: 5%;
margin-top: 0;
text-align:justify;
vertical-align: center;
}
.note-member .member-left{width: 520rpx; flex:1}
.note-member .member-right{width: 160rpx;justify-content: flex-end;display: flex;}
.note-member .member-right image{
width: 60rpx;
height: 60rpx;
font-size: 0;
}
.note-price{
color: #FF6600;
font-size: 16px;
margin-left: 5%;
margin-right: 5%;
margin-top: 0;
text-align:justify;
}
.note-content{
font-size: 16px;
/* 后期用于 '展开' 功能 */
/* overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 4;
-webkit-box-orient: vertical; */
margin-left: 5%;
margin-right: 4%;
margin-top: 20rpx;
text-align:justify;
}
.note-row{
width: 100%;
display: flex;
flex-direction: row;
}
.note-column{
display: flex;
flex-direction: column;
margin-left: 30rpx;
margin-right: 30rpx;
width: 55%;
}
.note-column text{
/* 多行溢出省略 */
display: -webkit-box;
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp:2;
overflow: hidden;
text-overflow:ellipsis;
}
.writer-image{
width: 240rpx;
height: 240rpx;
margin-left: 30rpx;
margin-top: 10rpx;
}
.price-row{
display: flex;
flex-direction: row;
}
.sub-price{
color: #FF6600;
font-size: 34rpx;
margin-right: 5%;
margin-top: 0;
text-align:justify;
flex: 1;
font-weight: bold;
}
.sub-quantity{
display: flex;
font-size: 16px;
justify-content: flex-end;
}
/* refer to jd */
.desc {
font-size: 30rpx;
color: #a7a7a7;
}
.desc-member-left {
font-size: 30rpx;
color: #a7a7a7;
margin-right: 20rpx;
}
.desc-member-right {
font-size: 30rpx;
}
/* start of workbench*/
.workbench{
font-size: 32rpx;
background: #fff;
padding-bottom: 10rpx;
margin-bottom:10rpx;
padding-top: 5rpx;
margin-top:5rpx;
color: #333;
}
.workbench .title{
font-size: 32rpx;
padding: 20rpx 20rpx;
margin-bottom: 40rpx;
display: block;
}
.workbench .items{
width: 100rpx;
flex:1;
text-align: center;
}
.workbench .items image{
width: 60rpx;
height: 60rpx;
}
.workbench .items image.service-icon{
width: 50rpx;
height: 50rpx;
}
.workbench .items text{
display: block;
text-align: center;
margin-top: 0rpx;
margin-bottom: 0rpx;
}
.workbench .items text.top{
display: block;
text-align: center;
margin-bottom: 0rpx;
}
.workbench .items text.bottom{
display: block;
text-align: center;
margin-top: 0rpx;
}
.workbench .list{
display: flex;
flex-direction: row;
flex:1;
}
/* end of workbench*/
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论