|
|
@@ -4,24 +4,14 @@
|
|
|
<!--vuetop-->
|
|
|
<div class="morebox1 response">
|
|
|
<div class="flex2 response flex justify-end">
|
|
|
- <div class="text3" @click="$router.push( { name: 'addcityDangerReport', params: { openId: search.createdBy }})">
|
|
|
+ <div class="text3" @click="$router.push({ name: 'addcityDangerReport', params: { openId: search.createdBy } })">
|
|
|
新增 <van-icon name="add" />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <van-list
|
|
|
- v-model="isUpLoading"
|
|
|
- :finished="upFinished"
|
|
|
- :immediate-check="false"
|
|
|
- :offset="10"
|
|
|
- finished-text="加载完成"
|
|
|
- @load="onLoadList"
|
|
|
- >
|
|
|
- <div
|
|
|
- class="morebox4 response"
|
|
|
- v-for="item in reportList"
|
|
|
- @click="toDetail(item.id)"
|
|
|
- >
|
|
|
+ <van-list v-model="isUpLoading" :finished="upFinished" :immediate-check="false" :offset="10" finished-text="加载完成"
|
|
|
+ @load="onLoadList">
|
|
|
+ <div class="morebox4 response" v-for="item in reportList" @click="toDetail(item.id)">
|
|
|
<div class="text5">
|
|
|
{{ item.hiddenTroubleDescription }}
|
|
|
</div>
|
|
|
@@ -41,128 +31,129 @@ import { listForAppTrouble } from '@/service/api_company.js'
|
|
|
import { Toast } from 'vant'
|
|
|
import { getInitialCode, getUserInfo, fetchUserAccessToken } from '@/common/js/api_lingxi'
|
|
|
export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- isUpLoading: false,
|
|
|
- isDownLoading: false,
|
|
|
- upFinished: false,
|
|
|
- reportList: [],
|
|
|
- search: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: '10',
|
|
|
- createdBy: '10008611'
|
|
|
- },
|
|
|
- appId: 'B1334087658781568',
|
|
|
- requestCode: '',
|
|
|
- userAccessToken: ''
|
|
|
- }
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- // console.log('this.$route.params', this.$route.params, this.$route.params.openId)
|
|
|
- // this.search.createdBy = this.$route.params.openId
|
|
|
- // this.getList()
|
|
|
- // alert('开始获取灵锡用户id')
|
|
|
- this.getInitCode()
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ isUpLoading: false,
|
|
|
+ isDownLoading: false,
|
|
|
+ upFinished: false,
|
|
|
+ reportList: [],
|
|
|
+ search: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: '10',
|
|
|
+ createdBy: '10008611'
|
|
|
+ },
|
|
|
+ appId: 'B1334087658781568',
|
|
|
+ requestCode: '',
|
|
|
+ userAccessToken: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ // console.log('this.$route.params', this.$route.params, this.$route.params.openId)
|
|
|
+ // this.search.createdBy = this.$route.params.openId
|
|
|
+ // this.getList()
|
|
|
+ // alert('开始获取灵锡用户id')
|
|
|
+ this.getList()
|
|
|
+ // this.getInitCode()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async getInitCode() {
|
|
|
+ getInitialCode([]).then((res) => {
|
|
|
+ // alert('getInitialCode==>' + JSON.stringify(res))
|
|
|
+ this.initCode = res.data.initCode
|
|
|
+ // alert('initCode==>' + this.initCode)
|
|
|
+ this.handleAuthorization()
|
|
|
+ })
|
|
|
},
|
|
|
- methods: {
|
|
|
- async getInitCode() {
|
|
|
- getInitialCode().then((res) => {
|
|
|
- // alert('getInitialCode==>' + JSON.stringify(res))
|
|
|
- this.initCode = res.data.initCode
|
|
|
- // alert('initCode==>' + this.initCode)
|
|
|
- this.handleAuthorization()
|
|
|
- })
|
|
|
- },
|
|
|
- handleAuthorization() {
|
|
|
- let _this= this
|
|
|
- // fetchUserAccessToken(_this.search).then(res => {
|
|
|
+ handleAuthorization() {
|
|
|
+ let _this = this
|
|
|
+ // fetchUserAccessToken(_this.search).then(res => {
|
|
|
+ // alert('获取用户访问令牌——:' + res)
|
|
|
+ this.getList()
|
|
|
+ // })
|
|
|
+ try {
|
|
|
+ // alert(this.initCode)
|
|
|
+ const _this = this
|
|
|
+ ls.ready(function () {
|
|
|
+ ls.userAuth({
|
|
|
+ appId: _this.appId // 从开放平台申请到的 appId
|
|
|
+ }, function (res) {
|
|
|
+ // alert('res:' + JSON.stringify(res))
|
|
|
+ if (res.code === 200) {
|
|
|
+ // // alert('requestCode:' + res.data.requestCode)
|
|
|
+ const reqData = {
|
|
|
+ requestCode: res.data.requestCode
|
|
|
+ }
|
|
|
+ fetchUserAccessToken(reqData).then(res => {
|
|
|
// alert('获取用户访问令牌——:' + res)
|
|
|
- this.getList()
|
|
|
- // })
|
|
|
- try {
|
|
|
- // alert(this.initCode)
|
|
|
- const _this = this
|
|
|
- ls.ready(function() {
|
|
|
- ls.userAuth({
|
|
|
- appId: _this.appId // 从开放平台申请到的 appId
|
|
|
- }, function(res) {
|
|
|
- // alert('res:' + JSON.stringify(res))
|
|
|
- if (res.code === 200) {
|
|
|
- // // alert('requestCode:' + res.data.requestCode)
|
|
|
- const reqData = {
|
|
|
- requestCode: res.data.requestCode
|
|
|
- }
|
|
|
- fetchUserAccessToken(reqData).then(res => {
|
|
|
- // alert('获取用户访问令牌——:' + res)
|
|
|
- getUserInfo({ userAccessToken: res }).then((res) => {
|
|
|
- // alert('用户信息——:' + JSON.stringify(res))
|
|
|
- // alert('用户信息1——:' + res.openId)
|
|
|
- // eslint-disable-next-line standard/object-curly-even-spacing
|
|
|
- // _this.$router.push({ name: urlname, params: { openId: res.openId, realName: res.realName }})
|
|
|
- // Toast('登录成功')
|
|
|
+ getUserInfo({ userAccessToken: res }).then((res) => {
|
|
|
+ // alert('用户信息——:' + JSON.stringify(res))
|
|
|
+ // alert('用户信息1——:' + res.openId)
|
|
|
+ // eslint-disable-next-line standard/object-curly-even-spacing
|
|
|
+ // _this.$router.push({ name: urlname, params: { openId: res.openId, realName: res.realName }})
|
|
|
+ // Toast('登录成功')
|
|
|
|
|
|
- _this.search.createdBy = res.openId
|
|
|
- // 执行下一步
|
|
|
- _this.getList()
|
|
|
- }).catch(e => {
|
|
|
- Toast(e)
|
|
|
- })
|
|
|
- })
|
|
|
- } else if (res.code === 9005) {
|
|
|
- // 认证失败或登录失败
|
|
|
- // console.log('认证失败或登录失败')
|
|
|
- // alert('认证失败或登录失败')
|
|
|
- // 如果在此处调用ls.close()关闭页面,需要延迟0.5秒执行,否则ls.close()会无效。
|
|
|
- } else {
|
|
|
- // 其余情况
|
|
|
- // alert('userAuth error')
|
|
|
- // 如果在此处调用ls.close()关闭页面,需要延迟0.5秒执行,否则ls.close()会无效。
|
|
|
- }
|
|
|
- })
|
|
|
+ _this.search.createdBy = res.openId
|
|
|
+ // 执行下一步
|
|
|
+ _this.getList()
|
|
|
+ }).catch(e => {
|
|
|
+ Toast(e)
|
|
|
})
|
|
|
+ })
|
|
|
+ } else if (res.code === 9005) {
|
|
|
+ // 认证失败或登录失败
|
|
|
+ // console.log('认证失败或登录失败')
|
|
|
+ // alert('认证失败或登录失败')
|
|
|
+ // 如果在此处调用ls.close()关闭页面,需要延迟0.5秒执行,否则ls.close()会无效。
|
|
|
+ } else {
|
|
|
+ // 其余情况
|
|
|
+ // alert('userAuth error')
|
|
|
+ // 如果在此处调用ls.close()关闭页面,需要延迟0.5秒执行,否则ls.close()会无效。
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
|
|
|
- // 失败回调
|
|
|
- ls.error(function(res) {
|
|
|
- // 错误处理
|
|
|
- // alert('失败回调')
|
|
|
- })
|
|
|
+ // 失败回调
|
|
|
+ ls.error(function (res) {
|
|
|
+ // 错误处理
|
|
|
+ // alert('失败回调')
|
|
|
+ })
|
|
|
|
|
|
- ls.config({
|
|
|
- debug: false, // 开发时建议把调试模式开启
|
|
|
- appId: this.appId, // 从开放平台申请到的 appId
|
|
|
- initCode: this.initCode // 从业务方自己后台请求到 initCode
|
|
|
- })
|
|
|
- } catch (e) {
|
|
|
- console.log(e)
|
|
|
- }
|
|
|
- },
|
|
|
- // ===上面是灵锡用的===========================================================================
|
|
|
- toDetail(id) {
|
|
|
- this.$router.push('/addcityDangerReport?id=' + id)
|
|
|
- },
|
|
|
- async getList() {
|
|
|
- listForAppTrouble(this.search).then((res) => {
|
|
|
- if (res.data.rows.length) {
|
|
|
- this.isDownLoading = false
|
|
|
- this.reportList.push(...res.data.rows)
|
|
|
- this.isUpLoading = false
|
|
|
- if (this.reportList.length >= res.data.total) {
|
|
|
- this.upFinished = true
|
|
|
- }
|
|
|
- } else {
|
|
|
- this.reportList = []
|
|
|
- this.isDownLoading = false
|
|
|
- this.isUpLoading = false
|
|
|
- this.upFinished = true
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- onLoadList() {
|
|
|
- this.search.pageNum++
|
|
|
- this.isDownLoading = false
|
|
|
- this.getList()
|
|
|
+ ls.config({
|
|
|
+ debug: false, // 开发时建议把调试模式开启
|
|
|
+ appId: this.appId, // 从开放平台申请到的 appId
|
|
|
+ initCode: this.initCode // 从业务方自己后台请求到 initCode
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // ===上面是灵锡用的===========================================================================
|
|
|
+ toDetail(id) {
|
|
|
+ this.$router.push('/addcityDangerReport?id=' + id)
|
|
|
+ },
|
|
|
+ async getList() {
|
|
|
+ listForAppTrouble(this.search).then((res) => {
|
|
|
+ if (res.data.rows.length) {
|
|
|
+ this.isDownLoading = false
|
|
|
+ this.reportList.push(...res.data.rows)
|
|
|
+ this.isUpLoading = false
|
|
|
+ if (this.reportList.length >= res.data.total) {
|
|
|
+ this.upFinished = true
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.reportList = []
|
|
|
+ this.isDownLoading = false
|
|
|
+ this.isUpLoading = false
|
|
|
+ this.upFinished = true
|
|
|
}
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onLoadList() {
|
|
|
+ this.search.pageNum++
|
|
|
+ this.isDownLoading = false
|
|
|
+ this.getList()
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
c
|
|
|
@@ -178,6 +169,7 @@ c
|
|
|
.justify-end {
|
|
|
justify-content: end;
|
|
|
}
|
|
|
+
|
|
|
.morebox1 {
|
|
|
width: 100%;
|
|
|
background-color: rgba(255, 255, 255, 1);
|
|
|
@@ -194,8 +186,8 @@ c
|
|
|
color: rgba(13, 47, 118, 1);
|
|
|
padding-right: 40px;
|
|
|
font-size: 36px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
}
|
|
|
|
|
|
.morebox4 {
|