Commit d2bfb2ee authored by 杨硕's avatar 杨硕

对接接口

parent 09ce0d2f
......@@ -3,5 +3,6 @@ export default {
// baseApi: 'http://linjiashop.microapp.store/prod-api' //调用演示环境
// baseApi:'/prod-api'//web生产
// baseApi: 'https://qf.91isoft.com/cshop'//本地测试
baseApi: 'http://192.168.1.29:8081'//本地测试
// baseApi: 'http://192.168.10.9:8099'//本地测试
baseApi: 'http://127.0.0.1:8099'
}
......@@ -40,6 +40,7 @@ const install = (Vue, vm) => {
}
// 响应拦截,判断状态码是否通过
Vue.prototype.$u.http.interceptor.response = (res) => {
console.log("请求数据",res);
// 如果把originalData设置为了true,这里得到将会是服务器返回的所有的原始数据
// 判断可能变成了res.statueCode,或者res.data.code之类的,请打印查看结果
if (res.code == 200) {
......@@ -47,8 +48,8 @@ const install = (Vue, vm) => {
return res.data;
} else {
//todo 统一处理错误信息
if(res.msg){
Vue.prototype.$u.toast(res.msg);
if(res.message){
Vue.prototype.$u.toast(res.message);
return false;
}
return false;
......@@ -57,12 +58,11 @@ const install = (Vue, vm) => {
//异常统一处理
Vue.prototype.$u.http.interceptor.error = (res) => {
console.log('error',res);
if(res.statusCode == 401){
if(res.code == 401){
//跳转至登录页面
Vue.prototype.$u.route('/login/login/passwordLogin');
return true;
}else{
if(res.data.message){
Vue.prototype.$u.toast(res.data.message);
return false;
......
......@@ -103,7 +103,12 @@
})
}).catch(res => {
console.log("err", res)
this.$u.toast(res.message)
if(res.code === 401) {
this.$u.toast("账号或密码错误")
} else {
this.$u.toast(res.message)
}
})
},
getCode(){
......
......@@ -4,6 +4,21 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@vant/popperjs": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/@vant/popperjs/-/popperjs-1.3.0.tgz",
"integrity": "sha512-hB+czUG+aHtjhaEmCJDuXOep0YTZjdlRR+4MSmIFnkCQIxJaXLQdSsR90XWvAI2yvKUI7TCGqR8pQg2RtvkMHw=="
},
"@vant/use": {
"version": "1.6.0",
"resolved": "https://registry.npmmirror.com/@vant/use/-/use-1.6.0.tgz",
"integrity": "sha512-PHHxeAASgiOpSmMjceweIrv2AxDZIkWXyaczksMoWvKV2YAYEhoizRuk/xFnKF+emUIi46TsQ+rvlm/t2BBCfA=="
},
"@vue/shared": {
"version": "3.4.29",
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.4.29.tgz",
"integrity": "sha512-hQ2gAQcBO/CDpC82DCrinJNgOHI2v+FA7BDW4lMSPeBpQ7sRe2OLHWe5cph1s7D8DUQAwRt18dBDfJJ220APEA=="
},
"call-bind": {
"version": "1.0.7",
"resolved": "https://registry.npmmirror.com/call-bind/-/call-bind-1.0.7.tgz",
......@@ -137,6 +152,16 @@
"object-inspect": "^1.13.1"
}
},
"vant": {
"version": "4.9.1",
"resolved": "https://registry.npmmirror.com/vant/-/vant-4.9.1.tgz",
"integrity": "sha512-p7iAKJyACYVwrmrkf3COmbuvzjHrFJ+FAmlyOWbxTS2ovkRs+tNKYjX2iibAl4XnHXBQD+qpX0ogUqE3jE7Isg==",
"requires": {
"@vant/popperjs": "^1.3.0",
"@vant/use": "^1.6.0",
"@vue/shared": "^3.4.27"
}
},
"vue-i18n": {
"version": "8.20.0",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.20.0.tgz",
......
......@@ -21,6 +21,7 @@
"crypto-js": "^4.2.0",
"jsencrypt": "^3.3.2",
"qs": "^6.12.1",
"vant": "^4.9.1",
"vue-i18n": "^8.20.0",
"wxmp-rsa": "^2.1.0"
}
......
......@@ -44,7 +44,19 @@
"style": {
"navigationBarTitleText": "订单"
}
}, {
},
{
"path": "pages/myArticle/index",
"style": {
"navigationBarTitleText": "我的文章"
}
},{
"path": "pages/myVedio/index",
"style": {
"navigationBarTitleText": "我的视频"
}
},
{
"path": "pages/order/detail",
"style": {
"navigationBarTitleText": "订单详情"
......
......@@ -11,7 +11,7 @@
:scroll-into-view="itemId">
<view v-for="(item,index) in tabbar" :key="index" class="u-tab-item" :class="[current == index ? 'u-tab-item-active' : '']"
@tap.stop="swichMenu(index)">
<text class="u-line-1">{{item}}</text>
<text class="u-line-1">{{item.name}}</text>
</view>
</scroll-view>
<scroll-view :scroll-top="scrollRightTop" scroll-y scroll-with-animation class="right-box" @scroll="rightScroll">
......@@ -22,8 +22,8 @@
</view>
<view class="item-container">
<view class="thumb-box" v-for="(item1, index1) in item.children" :key="index1" @click="toCategory(item1)">
<image class="item-menu-image" :src="pic2" mode=""></image>
<view class="item-menu-name">{{item1.name}}</view>
<image class="item-menu-image" :src="item1.path" mode=""></image>
<view class="item-menu-name">{{item1.title || item1.videoTitle}}</view>
</view>
</view>
</view>
......@@ -45,7 +45,7 @@
menuHeight: 0, // 左边菜单的高度
menuItemHeight: 0, // 左边菜单item的高度
itemId: '', // 栏目右边scroll-view用于滚动的id
tabbar: ['文章','视频'],
tabbar: [],
menuItemPos: [],
arr: [],
scrollRightTop: 0, // 右边栏目scroll-view的滚动条高度
......@@ -55,17 +55,43 @@
}
},
onLoad() {
},
onShow() {
this.init()
},
methods: {
init() {
console.log("vuex_unit",this.vuex_unit)
const unitList = this.vuex_unit
this.$u.get('cmsvideo/miniProgram/listByClassification?page=1&rows=10&unitId='+unitList[0].businessId).then(res => {
// this.tabbar = temp
})
this.getMenuItemTop()
const token = this.vuex_token
if (token==='' || token === null){
this.$u.route({
url: '/login/login/passwordLogin'
})
} else {
const unitList = this.vuex_unit
console.log("vuex_unit",this.vuex_unit)
this.tabbar = []
//视频
this.$u.get('cmsvideo/miniProgram/listByClassification?page=1&rows=10&unitId='+unitList[0].businessId).then(res => {
const videoChild = res.records
const video = {
'name': '视频',
"children": videoChild
}
this.tabbar.push(video)
})
//文章
this.$u.get('cmsnews/miniProgram/listByClassification?page=1&rows=10&unitId='+unitList[0].businessId).then(res => {
const videoChild = res.records
const video = {
'name': '文章',
"children": videoChild
}
this.tabbar.push(video)
})
this.getMenuItemTop()
}
},
toSearch() {
this.$u.route({
......@@ -302,6 +328,11 @@
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #333333;
overflow: hidden;
-webkit-line-clamp: 2;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.item-container {
......
<template>
<view>
<view class="wrap">
<view class="u-tabs-box">
<!-- <view class="u-tabs-box">
<u-tabs-swiper activeColor="#f29100" ref="tabs" :list="list" :current="current" @change="change" :is-scroll="false"
swiperWidth="750"></u-tabs-swiper>
</view>
</view> -->
<swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
......
......@@ -9,10 +9,10 @@
<view class="u-flex user-box">
<view class="u-m-r-10">
<!-- <u-avatar v-if="vuex_user.nickName == '未登录'" size="140"></u-avatar> -->
<image v-if="vuex_user.nickName == '未登录'" src="../../static/img/image/wode_logo_default@2x.png"
<image src="../../static/img/image/wode_logo_default@2x.png"
class="avaterimage"></image>
<!-- <u-avatar v-if="vuex_user.nickName !== '未登录'" :src="vuex_avatar" size="140"></u-avatar> -->
<image v-if="vuex_user.nickName !== '未登录'" :src="vuex_avatar" class="avaterimage"></image>
<!-- <image v-if="vuex_user.nickName !== '未登录'" :src="vuex_avatar" class="avaterimage"></image> -->
</view>
<view class="toptitlelist">
<view class="toptitlelist1">{{vuex_user.name}}</view>
......@@ -30,14 +30,14 @@
<!-- <u-cell-group>
<u-cell-item icon="list" title="我的订单" @click="openPage('/pages/order/list')"></u-cell-item>
</u-cell-group> -->
<view class="card" @click="openPage('/pages/order/list')">
<view class="card" @click="openPage('/pages/myArticle/index')">
<image src="../../static/img/image/wode_icon_dingdan@2x.png" class="leftimage"></image>
<view class="cardtitle">
<span>我的文章</span>
</view>
<image src="../../static/img/image/wode_icon_jiantou@2x.png" class="rightimage"></image>
</view>
<view class="card" @click="openPage('/pages/order/list')">
<view class="card" @click="openPage('pages/myVedio/index')">
<image src="../../static/img/image/wode_icon_dingdan@2x.png" class="leftimage"></image>
<view class="cardtitle">
<span>我的视频</span>
......
<template>
<view class="wrap">
<view class="card1" @click="openPage('/setting/setting/updateAvatar')">
<!-- <view class="card1" @click="openPage('/setting/setting/updateAvatar')">
<image src="../../static/image/shezhi_icon_touxiang@2x.png" class="settingimage"></image>
<view class="settingtitle">头像</view>
<image class="settingimage1" :src="vuex_avatar"></image>
<image class="settingrightimage" src="../../static/img/image/wode_icon_jiantou@2x.png"></image>
</view>
</view> -->
<view class="card2" @click="updateNickName">
<image src="../../static/image/shezhi_icon_xingming@2x.png" class="settingimage"></image>
<view class="settingtitle">姓名</view>
<view class="righttitle1">{{user.nickName}}</view>
<view class="righttitle1">{{user.name}}</view>
<image class="settingrightimage" src="../../static/img/image/wode_icon_jiantou@2x.png"></image>
</view>
<view class="card3" @click="updateGender">
<view class="card1" @click="updateGender">
<image src="../../static/image/shezhi_icon_xingbie@2x.png" class="settingimage"></image>
<view class="settingtitle">性别</view>
<view class="righttitle1">{{user.genderStr}}</view>
<image class="settingrightimage" src="../../static/img/image/wode_icon_jiantou@2x.png"></image>
</view>
<view class="card">
<view class="card3" @click="updateUnit">
<image src="../../static/image/shezhi_icon_genghuanshouji@2x.png" class="settingimage"></image>
<view class="settingtitle">商家</view>
<view class="unitTitle">{{unitName}}</view>
<image class="settingrightimage" src="../../static/img/image/wode_icon_jiantou@2x.png"></image>
</view>
<view class="card1" @click="openPage('/setting/setting/updatePwd')">
<image src="../../static/image/shezhi_icon_xiugaimima@2x.png" class="settingimage"></image>
<view class="settingtitle">修改密码</view>
<image class="settingrightimage" src="../../static/img/image/wode_icon_jiantou@2x.png"></image>
</view>
<view class="card3" @click="todo('/setting/setting/updateMobile')">
<image src="../../static/image/shezhi_icon_genghuanshouji@2x.png" class="settingimage"></image>
<view class="settingtitle">更换手机</view>
<view class="righttitle1">{{user.mobile}}</view>
<image class="settingrightimage" src="../../static/img/image/wode_icon_jiantou@2x.png"></image>
</view>
</view>
......@@ -51,6 +51,8 @@
<u-action-sheet :list="gender.list" v-model="gender.show" :cancel-btn="false" @click="submitGender">
</u-action-sheet>
<u-action-sheet :list="unit.list" v-model="unit.show" :cancel-btn="false" @click="submitUnit">
</u-action-sheet>
</view>
......@@ -65,6 +67,7 @@
user: {
genderIcon: 'man',
},
unitName: '',
gender: {
show: false,
list: [{
......@@ -75,6 +78,11 @@
value: 'female'
}]
},
unit: {
show: false,
list: []
},
unitList: [],
nickName: {
show: false,
value: ''
......@@ -83,17 +91,18 @@
},
onLoad() {
this.init();
this.unitName = this.vuex_unit[0].unitName
},
methods: {
init() {
const user = this.vuex_user;
if (user.nickName !== '未登录') {
if (user.gender == 'female') {
if (user.gender == 1) {
user.genderStr = '女';
user.genderIcon = 'woman';
}
if (user.gender == 'male') {
if (user.sex == 0) {
user.genderStr = '男';
user.genderIcon = 'man';
......@@ -133,6 +142,23 @@
updateGender() {
this.gender.show = true;
},
updateUnit() {
this.unit.show = true
//获取用户所在商家信息
this.$u.get('/sysunit/getUnitInfo').then(ref=>{
console.log("ref",ref)
// this.$u.vuex('vuex_unit',ref)
this.unit.list = []
this.unitList = ref
ref.forEach(item=>{
const unitList = {
text: item.unitName,
value: item.businessId
}
this.unit.list.push(unitList)
})
})
},
submitGender(index) {
let selData = this.gender.list[index];
this.$u.post('user/updateGender/' + selData.value).then(res => {
......@@ -153,15 +179,28 @@
this.$u.toast('修改成功');
});
},
submitUnit(index){
const unit = this.unit.list[index]
console.log("unit",unit)
this.unitName = unit.text
const unitListChoose = this.unitList.find(item => item.businessId === unit.value)
console.log("unitListChoose",unitListChoose);
const unitListChooseList = []
unitListChooseList.push(unitListChoose)
this.$u.vuex('vuex_unit',unitListChooseList)
// this.$u.vuex("vuex_unit",unitListChooseList)
},
logout() {
// uni.clearStorage()
this.$u.vuex('vuex_token', '')
this.$u.vuex('vuex_avatar', '')
this.$u.vuex('vuex_user', {
nickName: '未登录'
});
this.$u.vuex('vuex_unit',[])
this.$u.route({
url: '/login/login/passwordLogin',
url: 'pages/user/profile',
params: {}
})
},
......@@ -188,10 +227,10 @@
}
.card1 {
height: 128rpx;
margin: 30rpx 30rpx 0 30rpx;
margin: 0 30rpx;
display: flex;
align-items: center;
border-radius: 12px 12px 0px 0px;
border-radius: 0px 0px 12px 12px;
background: #FFFFFF;
padding: 0 30rpx;
position: relative;
......@@ -200,21 +239,36 @@
.card2 {
height: 128rpx;
margin-bottom: 0px;
margin: 0rpx 30rpx;
margin: 30rpx 30rpx 0rpx 30rpx;
display: flex;
align-items: center;
border-radius: 0px 0px 0px 0px;
border-radius: 12px 12px 0px 0px;
background: #FFFFFF;
padding: 0 30rpx;
position: relative;
}
.unitTitle{
max-width: 55%;
position: absolute;
right: 82rpx;
font-size: 16px;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #666666;
overflow: hidden;
-webkit-line-clamp: 1;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
// text-align: right;
}
.card3 {
height: 128rpx;
margin: 0rpx 30rpx;
margin: 30rpx 30rpx 0 30rpx;
display: flex;
align-items: center;
border-radius: 0px 0px 12px 12px;
border-radius: 12px 12px 0px 0px;
background: #FFFFFF;
padding: 0 30rpx;
position: relative;
......
<template>
<view class="wrap">
<view class="content">
<u-field v-model="oldPassword" type="password" label="旧密码" placeholder="请填写旧密码">
</u-field>
<u-field v-model="password" type="password" label="新密码" placeholder="请填写新密码">
</u-field>
<u-field v-model="rePassword" type="password" label="重复密码" placeholder="请重复填写新密码">
<u-field v-model="rePassword" type="password" label="确认密码" placeholder="请填写确认密码">
</u-field>
<u-field v-model="smsCode" label="验证码" placeholder="请填写验证码">
<!-- <u-field v-model="smsCode" label="验证码" placeholder="请填写验证码">
<u-button size="mini" slot="right" type="success" :disabled="smsCodeDisabled" @click="getSmsCode">{{codeText}}</u-button>
</u-field>
</u-field> -->
</view>
<view class="u-m-t-20 u-p-20">
......@@ -21,6 +23,7 @@
export default {
data() {
return {
oldPassword: '',
tel: '',
password: '',
rePassword: '',
......@@ -48,10 +51,17 @@
this.$u.toast('前后密码不一致');
return;
}
this.$u.post('user/updatePassword_v2/' + this.password + '/' + this.smsCode).then(res => {
this.$u.put('/system/user/updatePwd?oldPassword=' + this.oldPassword + '&newPassword=' + this.password).then(res => {
this.$u.vuex('vuex_token', '')
this.$u.vuex('vuex_avatar', '')
this.$u.vuex('vuex_user', {
nickName: '未登录'
});
this.$u.vuex('vuex_unit',[])
this.$u.route({
type: 'switchTab',
url: '/pages/user/profile'
url: '/login/login/passwordLogin',
params: {}
})
}).catch(res => {
console.log("err", res);
......
......@@ -43,7 +43,7 @@ const store = new Vuex.Store({
vuex_version: '1.0.1',
vuex_demo: '绛紫',
vuex_avatar: lifeData.vuex_avatar ? lifeData.vuex_avatar : '/static/img/nav/user.png',
vuex_unit: [],
vuex_unit: lifeData.vuex_unit ? lifeData.vuex_unit : [],
// 自定义tabbar数据
vuex_tabbar: [{
iconPath: "/static/uview/example/component.png",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment