提交 e11c0c1f 作者: wk

新闻头条调整处理

父级 46a95b0c
......@@ -18,12 +18,13 @@ const http = (params) => {
if (result.code == 0) {
resolve(result)
} else if (result.code == 10201) { //token失效
getApp().globalData.isLoginAgain = true
uni.navigateTo({
url: "/pages/wxLogin/wxLogin"
})
} else if (result.code == 33199) {
resolve(result)
} else {
reject(result)
}
},
fail(err) {
......
......@@ -39,9 +39,7 @@
<uni-grid column="4" class="grid-container">
<uni-grid-item class="grid-item" v-for="(model,modelIndex) in item.data" :key="modelIndex">
<view class="item" @click="toIndex(model)">
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+model.logo+'.png'"
class="image" />
<image :src="model.ydt_logo" class="image" />
<view class="single-text" style="color: #666666;font-size: 28rpx;margin-top: 10rpx;">
{{nameLengthDeal(model.app_name)}}
</view>
......@@ -88,12 +86,18 @@
app_sort: 1
},
orgName: "",
mostUsed: {}
mostUsed: {},
role: "PM"
}
},
onLoad() {
const info = uni.getSystemInfoSync()
this.statusBarHeight = info.statusBarHeight
this.role = getApp().globalData.userInfo.identity.code
if (this.role == 'WORKER') {
this.orgName = getApp().globalData.userInfo.currentProject.projectName
uni.setStorageSync("org_no", getApp().globalData.userInfo.user.org_no)
}
this.getAppGroup()
this.getMostUsed()
},
......@@ -123,7 +127,6 @@
}
}).then((result) => {
console.log("组织树", result);
console.log("------", uni.getStorageSync("org_name"));
if (result.code == 0) {
this.trees = result.data.list[0].children_list
this.orgName = uni.getStorageSync("org_name") || result.data.list[0].name
......@@ -131,6 +134,9 @@
})
},
toChangeOrg() {
if (this.role != 'PM') {
return
}
uni.navigateTo({
url: "/pages/mine/changeOrg/changeOrg"
})
......
......@@ -80,27 +80,26 @@
<image src="../../static/right-arrow.png" @click="toLinkScore"></image>
</view>
<view class="score-count">剩余:{{scoreDetail.integral||0}}积分</view>
<view class="list-content">
<view class="left-content">
<view class="item-content" v-for="(item,index) in leftList()" :key="index">
<image class="image"
src="https://img.alicdn.com/imgextra/i1/27493396/O1CN013NYTVu1axPeymS1yi_!!0-saturn_solar.jpg_468x468q75.jpg_.webp">
<image class="image" :src="item.goods_img">
</image>
<view class="count">500积分可兑换</view>
<view class="count">{{item.goods_integral}}积分可兑换</view>
<view class="name-content">
<view class="name">XXX牌雨伞XXX牌雨伞XXX牌雨伞XXX牌雨伞</view>
<view class="name">{{item.goods_name}}</view>
<image src="../../static/exchange.png" class="image" @click="exchange(item)"></image>
</view>
</view>
</view>
<view class="right-content">
<view class="item-content" v-for="(item,index) in rightList()" :key="index">
<image class="image"
src="https://bkimg.cdn.bcebos.com/pic/8718367adab44aedf44fb8c1b11c8701a18bfb96?x-bce-process=image/watermark,image_d2F0ZXIvYmFpa2U4MA==,g_7,xp_5,yp_5">
<image class="image" :src="item.goods_img">
</image>
<view class="count">500积分可兑换</view>
<view class="count">{{item.goods_integral}}积分可兑换</view>
<view class="name-content">
<view class="name">XXX牌雨伞XXX牌雨伞XXX牌雨伞XXX牌雨伞</view>
<view class="name">{{item.goods_name}}</view>
<image src="../../static/exchange.png" class="image" @click="exchange(item)"></image>
</view>
</view>
......@@ -139,14 +138,15 @@
}],
scoreDetail: {},
city: "杭州市",
address: "浙江省杭州市西湖区",
address: "浙江省杭州市",
weather: {},
userInfo: {},
pageTemplateComponent: [],
isWeatherShow: true,
role: "VISITOR",
nowTime: "",
project: {}
project: {},
project_id: ""
}
},
onLoad() {
......@@ -172,6 +172,24 @@
},
methods: {
dealImage(url) {
var newPath = ""
if (url) {
let array = url.split("://")
if (array[0] === "http") {
array[0] = "https"
newPath = array[0] + "://" + array[1]
} else {
newPath = url
}
}
console.log("图片", newPath);
if (newPath.indexOf(',') != -1) {
var urls = newPath.split(",")
return urls[0]
}
return url
},
loginState() {
let that = this
uni.getStorage({
......@@ -179,7 +197,6 @@
success(res) {
//获取用户信息
that.getUserInfo()
that.getNews()
that.getSetting()
that.getHomeComp()
that.getWeather()
......@@ -197,12 +214,16 @@
})
},
loadProject: function() {
let orgNo = uni.getStorageSync("org_no")
if (orgNo == '001') {
orgNo = ""
}
let that = this
this.$http.get({
url: "/api/v1/project/project_list",
data: {
is_all: 1,
// org_no: uni.getStorageSync("org_no")
org_no: orgNo
},
header: {
"access_token": this.getToken()
......@@ -213,14 +234,13 @@
if (result.code === 0) {
if (result.data.list.length > 0) {
this.project = result.data.list[0]
if (!uni.getStorageSync("project_id")) {
this.project_id = this.project.project_id
uni.setStorageSync("org_no", this.project.org_no)
uni.setStorageSync("org_name", this.project.project_name)
uni.setStorageSync("org_id", this.project.id)
uni.setStorageSync("project_id", this.project.project_id)
}
}
}
if (this.role == 'WORKER') {
this.getGoodsList()
this.getMyScore()
......@@ -231,7 +251,7 @@
Api.getGoodsList({
data: {
is_page: 0,
project_id: this.project.project_id
project_id: this.userInfo.worker.projectId
}
}).then(res => {
if (res.code === 0) {
......@@ -259,7 +279,7 @@
},
clickItem() {
uni.navigateTo({
url: `/pages/index/siteNewList/siteNewList?clientId=1`
url: `/pages/index/siteNewList/siteNewList?clientId=1&projectId=` + this.project_id
})
},
toLinkOther() {
......@@ -309,6 +329,7 @@
pageNum: 1,
pageSize: 20,
clientId: 1,
projectId: this.project_id,
}
}).then((result) => {
if (result.code == 0) {
......@@ -324,6 +345,7 @@
pageNum: 1,
pageSize: 20,
clientId: 2,
projectId: this.project_id,
}
}).then((result) => {
if (result.code == 0) {
......@@ -359,14 +381,16 @@
},
toLinkNew() {
uni.navigateTo({
url: `/pages/index/siteNewList/siteNewList?clientId=2`
url: `/pages/index/siteNewList/siteNewList?clientId=2&projectId=` + this.project_id
})
},
getMyScore() {
var date = new Date()
Api.getUserScore({
data: {
project_id: this.project.project_id,
worker_id: this.userInfo.worker.workerId
project_id: this.userInfo.worker.projectId,
worker_id: this.userInfo.worker.workerId,
time: date.getFullYear() + "-" + date.getMonth() + 1 + "-" + date.getDate()
}
}).then(res => {
console.log("用户积分", res);
......@@ -420,9 +444,19 @@
this.userInfo = result.data
// this.title = "欢迎" + this.userInfo.user.user_name + "访问一点通"
this.role = this.userInfo.identity.code
if (!uni.getStorageSync("org_no")) {
console.log("当前组织", uni.getStorageSync("org_no"));
this.project_id = uni.getStorageSync("project_id")
if (!this.project_id) {
this.loadProject()
} else {
if (this.role == 'WORKER') {
this.project_id = this.userInfo.worker.projectId
this.getGoodsList()
this.getMyScore()
}
}
this.getNews()
this.getBanners()
} else {
this.$toast.showToast(result.msg)
}
......
<template>
<view class="content">
<titleBar title="工地头条详情"></titleBar>
<titleBar title="新闻详情"></titleBar>
<view class="new-content">
<view class="title-content">
<text class="text">{{dealTitle(newDetail.title) }}</text>
......@@ -9,9 +9,9 @@
<text class="text">{{newDetail.updateUserName}}</text>
<text class="text" style="margin-left: 30rpx;">{{newDetail.articleTime}}</text>
</view>
<image src="https://img.redocn.com/sheying/20150804/gongdi_4770950.jpg" class="image"></image>
<image :src="newDetail.articleImg" class="image"></image>
<view class="text-content">
<text class="text">{{newDetail.content}}</text>
<rich-text :nodes="newDetail.content"></rich-text>
</view>
</view>
<view class="other-content">
......@@ -19,10 +19,10 @@
<view class="list-content">
<view v-for="(item,index) in list" :key="index" class="list-item" @click="toLinkDetail(item)">
<view class="new-content">
<view class="title">关于食堂发放免费午餐的消息通知息通知</view>
<view class="user">张三 2022/12/14 16:52:56</view>
<view class="title">{{item.title}}</view>
<view class="user">{{item.updateUserName}} {{item.articleTime}}</view>
</view>
<image class="image" src="../../../static/banner.png"></image>
<image class="image" :src="dealImage(item.coverImg)"></image>
</view>
</view>
</view>
......@@ -41,13 +41,41 @@
articleTime: "2022/12/14 16:52:56",
content: "由于工人数量大、居住集中等原因,工地防疫一度是各地面对的难题。此前,不同地区都要求进工地的建筑工人或一天一检,或两天一检,比一般社会面更严格。工地上中老年人多。 在某东部省会工作的基层干部周楠曾负责协调、 监督一些工地与医院对接做核酸。 她注意到, 工地上有一些“ 50 后” 的农民工, 他们没有智能手机, 做核酸时无法扫码, 只能出示身份证。 "
},
id: ""
id: "",
text: ""
}
},
onLoad(options) {
this.id = options.id
this.getNewDetail()
},
methods: {
toLinkDetail(item) {
uni.navigateTo({
url: "/pages/index/newDetail/newDetail?id=" + item.articleLibraryId
})
},
onEditorReady(content) {
//富文本宽度100%
this.text = content.replace(/\<img/g, "<img style='width: 100%;'")
},
dealImage(url) {
var newPath = ""
if (url) {
let array = url.split("://")
if (array[0] === "http") {
array[0] = "https"
newPath = array[0] + "://" + array[1]
} else {
newPath = url
}
}
if (newPath.indexOf(',') != -1) {
var urls = newPath.split(",")
return urls[0]
}
return url
},
dealTitle(text) {
if (text.length > 15) {
return text.substr(0, 13) + "..."
......@@ -64,7 +92,7 @@
this.list = []
let data = result.data
data.forEach(item => {
if (item.articleLibraryId == id) {
if (item.articleLibraryId == this.id) {
this.newDetail = item
} else {
this.list.push(item)
......@@ -80,6 +108,12 @@
</script>
<style lang="scss">
#editor {
width: 100%;
height: 300px;
background-color: #fff;
}
.content {
display: flex;
flex-direction: column;
......
<template>
<view class="content">
<titleBar title="工地头条"></titleBar>
<titleBar :title="title"></titleBar>
<view class="search-content">
<image src="../../../static/ic-search.png" class="image"></image>
<input placeholder="搜索" placeholder-class="placeholderStyle" @input="search" class="inputStyle" />
......@@ -11,7 +11,7 @@
<view class="title">{{item.title}}</view>
<view class="user">{{item.updateUserName}} {{item.articleTime}}</view>
</view>
<image class="image" src="../../../static/banner.png"></image>
<image class="image" :src="dealImage(item.coverImg)"></image>
</view>
</view>
</view>
......@@ -31,12 +31,20 @@
pageSize: 20,
isHasMore: true,
clientId: 2,
key: ""
key: "",
projectId: "",
title: "工地头条"
}
},
onLoad(option) {
this.clientId = option.clientId
this.projectId = option.projectId
this.getNews()
if (this.clientId == 1) {
this.title = "banner新闻"
} else {
this.title = "工地头条"
}
},
onPullDownRefresh() {
this.page = 1
......@@ -49,9 +57,27 @@
}
},
methods: {
dealImage(url) {
var newPath = ""
if (url) {
let array = url.split("://")
if (array[0] === "http") {
array[0] = "https"
newPath = array[0] + "://" + array[1]
} else {
newPath = url
}
}
console.log("图片", newPath);
if (newPath.indexOf(',') != -1) {
var urls = newPath.split(",")
return urls[0]
}
return url
},
toLinkDetail(item) {
uni.navigateTo({
url: "/pages/index/newDetail/newDetail"
url: "/pages/index/newDetail/newDetail?id=" + item.articleLibraryId
})
},
search(e) {
......@@ -65,7 +91,8 @@
pageNum: this.page,
pageSize: this.pageSize,
clientId: this.clientId,
title: this.key
title: this.key,
projectId: this.projectId
}
}).then((result) => {
uni.stopPullDownRefresh()
......
......@@ -99,6 +99,8 @@
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
showMadel: function() {
......@@ -143,6 +145,8 @@
url: "/pages/index/index"
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
sendCode() {
......@@ -180,6 +184,8 @@
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
timeDown(num) {
......@@ -263,6 +269,8 @@
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
toAuthLogin() {
......@@ -297,6 +305,8 @@
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
directLogin: function() {
......@@ -324,6 +334,8 @@
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
},
toLogin() {
......@@ -365,6 +377,8 @@
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
} else {
Api.login({
......@@ -400,6 +414,8 @@
icon: 'none'
})
}
}, (err) => {
this.$toast.showToast(err.msg)
})
}
......
......@@ -70,7 +70,7 @@
},
scoreDetail: {},
userInfo: {},
project: {}
project_id: ""
}
},
onLoad(option) {
......@@ -85,14 +85,17 @@
this.requestParam.time = year + '-' + month + '-' + day
this.requestParam.worker_id = this.userInfo.worker_id || ''
this.requestParam.project_id = this.project.project_id || ''
this.loadProject()
this.getGoodsList()
this.getScoreDetail()
},
methods: {
getScoreDetail() {
var date = new Date()
Api.getUserScore({
data: {
project_id: this.project.project_id,
worker_id: getApp().globalData.userInfo.worker.workerId
project_id: getApp().globalData.userInfo.worker.projectId,
worker_id: getApp().globalData.userInfo.worker.workerId,
time: date.getFullYear() + "-" + date.getMonth() + 1 + "-" + date.getDate()
}
}).then(res => {
if (res.code === 0) {
......@@ -100,32 +103,11 @@
}
})
},
loadProject: function() {
let that = this
this.$http.get({
url: "/api/v1/project/project_list",
data: {
is_all: 1,
org_no: uni.getStorageSync("org_no")
},
header: {
"access_token": this.getToken()
}
}).then(res => {
let result = res.data
console.log("项目列表:", result);
if (result.code === 0) {
this.project = result.data.list[0]
}
this.getGoodsList()
this.getScoreDetail()
})
},
getGoodsList() {
Api.getGoodsList({
data: {
is_page: 0,
project_id: this.project.project_id
project_id: getApp().globalData.userInfo.worker.projectId
}
}).then(res => {
if (res.code === 0) {
......
......@@ -71,19 +71,26 @@
project: {},
showModal: false,
qrcodeSrc: "",
curTitle: ""
curTitle: "",
role: "PM",
projectId: ""
}
},
onLoad() {
this.role = getApp().globalData.userInfo.identity.code
if (this.role == 'WORKER') {
this.projectId = getApp().globalData.userInfo.worker.projectId
} else {
this.projectId = uni.getStorageSync("project_id")
}
this.getProjectInfo()
},
methods: {
getProjectInfo() {
let projectId = uni.getStorageSync("project_id")
if (projectId) {
if (this.projectId) {
Api.getProjectInfo({
data: {
project_id: uni.getStorageSync("project_id")
project_id: this.projectId
}
}).then((result) => {
console.log("项目信息", result);
......@@ -110,8 +117,9 @@
}).then((result) => {
console.log("项目列表:", result);
if (result.code === 0) {
this.projectList = result.data.list
this.project = this.projectList[0]
var projectList = result.data.list
this.projectId = projectList[0].project_id
this.getProjectInfo()
} else {
this.$toast.showToast(result.msg)
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment