Browse Source

对接接口

master
岳鹏龙 11 months ago
parent
commit
f5998f8dc5
  1. 2
      .env.development
  2. 4
      .env.production
  3. 67
      src/api/index.ts
  4. 62
      src/api/learningCenter.ts
  5. 30
      src/api/login.ts
  6. 19
      src/api/mine.ts
  7. 41
      src/api/user.ts
  8. 7
      src/manifest.json
  9. 126
      src/pages.json
  10. 263
      src/pages/index/ChatDialog.vue
  11. 78
      src/pages/index/index.vue
  12. 352
      src/pages/index/specialSubject.vue
  13. 47
      src/pages/index/ztdetail.vue
  14. 58
      src/pages/learningCenter/detail.vue
  15. 179
      src/pages/learningCenter/index.vue
  16. 31
      src/pages/learningCenter/useTimeDiff.js
  17. 27
      src/pages/login/login.vue
  18. 160
      src/pages/memberCenter/index.vue
  19. 93
      src/pages/mine/associatedDetail.vue
  20. 76
      src/pages/mine/associatedEnterprise.vue
  21. 279
      src/pages/mine/completeInformation.vue
  22. 67
      src/pages/mine/index.vue
  23. 187
      src/pages/mine/myApplication.vue
  24. 103
      src/pages/mine/myCourses.vue
  25. 217
      src/pages/mine/porsonalinfo.vue
  26. BIN
      src/static/img/aiicon.png
  27. BIN
      src/static/img/daan.png
  28. BIN
      src/static/img/timeicon.png
  29. BIN
      src/static/img/yyzz.png
  30. 43
      src/store/user.ts
  31. 9
      src/utils/http.ts

2
.env.development

@ -1,5 +1,5 @@
ENV='development'
# base api
VITE_APP_BASE_URL = 'https://evote.truescloud.com'
VITE_APP_BASE_URL = 'https://hqt.truescloud.com'
VITE_APP_BASE_PRE = '/dev-api'
VITE_APP_BASE_NAME = 'POS'

4
.env.production

@ -1,6 +1,6 @@
ENV='production'
# base api
VITE_APP_BASE_URL = 'http://pos-api.lingji.vip'
VITE_APP_BASE_PRE = 'http://pos-api.lingji.vip'
VITE_APP_BASE_URL = 'https://hqt.truescloud.com'
VITE_APP_BASE_PRE = 'https://hqt.truescloud.com'
VITE_APP_BASE_NAME = 'POS'

67
src/api/index.ts

@ -0,0 +1,67 @@
import { request } from '@/utils/http'
//首页专题
export function homeSpecial() {
return request.http({
url: '/api/huiqitong/home_special',
method: 'GET'
})
}
//banner列表
export function bannerList() {
return request.http({
url: '/api/huiqitong/banner_list',
method: 'GET'
})
}
//banner详情
export function bannerInfo(id:string) {
return request.http({
url: '/api/huiqitong/banner_info/'+id,
method: 'GET'
})
}
//活动列表
export function activityList(page: string,limit: string) {
return request.http({
url: '/api/huiqitong/activity_list?page='+page+'&limit='+limit,
method: 'GET'
})
}
//专题详情
export function specialInfo(id: string) {
return request.http({
url: '/api/huiqitong/special_info?special_id='+id,
method: 'GET'
})
}
//专题内容列表
export function specialList(id: string) {
return request.http({
url: '/api/huiqitong/special_list?special_id=1&page=1&limit=10',
method: 'GET'
})
}
//专题内容详情
export function specialListInfo(id: string) {
return request.http({
url: '/api/huiqitong/special_list_info/'+id,
method: 'GET'
})
}
//ai客服
export function ai(data: any) {
return request.http({
url: '/api/huiqitong/ai',
method: 'POST',
data
})
}

62
src/api/learningCenter.ts

@ -0,0 +1,62 @@
import { request } from '@/utils/http'
//我的学习清单
export function myStudy() {
return request.http({
url: '/api/huiqitong/my_study',
method: 'GET'
})
}
//学习中心列表
export function studyCenter(recommend:string,title:string,type:string,page:string,limit:string) {
return request.http({
url: '/api/huiqitong/study_center?recommend='+recommend+'&title='+title+'&s_type='+type+'&page='+page+'&limit='+limit,
method: 'GET'
})
}
//学习中心详情
export function studyCenterDetail(id:string) {
return request.http({
url: '/api/huiqitong/study_center/'+id,
method: 'GET'
})
}
//收藏学习
export function collect(data:{item_id:string}) {
return request.http({
url: '/api/huiqitong/collect',
method: 'POST',
data
})
}
//取消收藏
export function removeCollect(data:{item_id:string}) {
return request.http({
url: '/api/huiqitong/remove_collect',
method: 'POST',
data
})
}
//增加观看次数
export function watchCount(data:{id:string}) {
return request.http({
url: '/api/huiqitong/watch_count',
method: 'POST',
data
})
}
//观看进度记录
export function studyRecord(data:any) {
return request.http({
url: '/api/huiqitong/study_record',
method: 'POST',
data
})
}

30
src/api/login.ts

@ -2,38 +2,14 @@ import { request } from '@/utils/http'
export function getOpenid(data: { code: string }) {
return request.http({
url: '/api/openid',
url: '/api/huiqitong/get_openid',
data
})
}
export function getMobile(data: { code: string; openid: string }) {
export function mobileAuth(data: { code: string; openid: string }) {
return request.http({
url: '/api/mobile',
data
})
}
export function getAdminPhone() {
return request.http({
url: '/api/admin_mobile',
method: 'GET'
})
}
//用户签到
export function getSign(data: { meetId: string; openid: string }) {
return request.http({
url: '/api/sign',
method: 'GET',
data
})
}
//扫码时手机号获取用户信息
export function getmemberMobileGet(data: { meetId: string; openid: string; mobile: string }) {
return request.http({
url: '/api/member_mobile_get',
method: 'GET',
url: '/api/huiqitong/mobile_auth',
data
})
}

19
src/api/mine.ts

@ -0,0 +1,19 @@
import { request } from '@/utils/http'
//修改用户信息(单项)
export function modifyField(field:string,value:string) {
return request.http({
url: '/api/huiqitong/modify/'+ field +'?value=' + value,
method: 'PUT'
})
}
//图片上传
export function updataImage(data:any) {
return request.http({
url: '/api/file/image',
method: 'POST',
data
})
}

41
src/api/user.ts

@ -14,48 +14,17 @@ export interface dateListtype extends listType {
id: number
}
export function infoForOpenid(data: { openid: string; mobile: string ; meetId: string }) {
export function infoForOpenid() {
return request.http({
url: '/api/member_mobile_get',
url: '/api/huiqitong/member/info',
method: 'GET',
data
})
}
// 手机号获取用户信息
export function getMember_mobile(data: any) {
export function logout() {
return request.http({
url: '/api/member_mobile',
method: 'GET',
data
url: '/api/huiqitong/logout',
method: 'PUT',
})
}
export function list(data: { name: string, meetId: string }) {
return request.http({
url: '/api/member_name',
method: 'GET',
data
})
}
export function update(data: { [n: string]: string }, openid: string) {
return request.http({
url: '/api/member_update',
data: Object.assign(data, { openid })
})
}
export function bind(data: { id: number; openid: string }) {
return request.http({
url: '/api/name_sub',
data
})
}
export function add(data: listType) {
return request.http({
url: '/api/member_add',
data
})
}

7
src/manifest.json

@ -113,7 +113,12 @@
"postcss" : false,
"minified" : true
},
"usingComponents" : true
"usingComponents" : true,
"permission" : {
"scope.userLocation" : {
"desc" : "定位"
}
}
},
"mp-alipay" : {
"usingComponents" : true

126
src/pages.json

@ -6,12 +6,11 @@
"^u-(.*)": "uview-plus/components/u-$1/u-$1.vue"
}
},
"pages": [
{
"pages": [{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"enablePullDownRefresh": true,
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
@ -47,100 +46,130 @@
}
},
{
"path" : "pages/index/specialSubject",
"style" :
{
"navigationBarTitleText" : "专题",
"path": "pages/index/specialSubject",
"style": {
"navigationBarTitleText": "专题",
"navigationStyle": "custom"
}
},
{
"path" : "pages/index/ztdetail",
"style" :
{
"navigationBarTitleText" : "专题详情页",
"path": "pages/index/ztdetail",
"style": {
"navigationBarTitleText": "专题详情页",
"navigationStyle": "custom"
}
},
{
"path" : "pages/index/shoppage/shopHelp",
"style" :
{
"navigationBarTitleText" : "小店帮",
"path": "pages/index/shoppage/shopHelp",
"style": {
"navigationBarTitleText": "小店帮",
"navigationStyle": "custom"
}
},
{
"path" : "pages/index/shoppage/shophelpDetail",
"style" :
{
"navigationBarTitleText" : "小店帮详情",
"path": "pages/index/shoppage/shophelpDetail",
"style": {
"navigationBarTitleText": "小店帮详情",
"navigationStyle": "custom"
}
},
{
"path" : "pages/index/shoppage/interactiveZone",
"style" :
{
"navigationBarTitleText" : "互动专区",
"path": "pages/index/shoppage/interactiveZone",
"style": {
"navigationBarTitleText": "互动专区",
"navigationStyle": "custom"
}
},
{
"path" : "pages/index/shoppage/financialAssistance",
"style" :
{
"navigationBarTitleText" : "金融帮",
"path": "pages/index/shoppage/financialAssistance",
"style": {
"navigationBarTitleText": "金融帮",
"navigationStyle": "custom"
}
},
{
"path" : "pages/index/shoppage/jrbDetail",
"style" :
"path": "pages/index/shoppage/jrbDetail",
"style": {
"navigationBarTitleText": "金融帮详情",
"navigationStyle": "custom"
}
},
{
"navigationBarTitleText" : "金融帮详情",
"path": "pages/index/shoppage/mediaHelp",
"style": {
"navigationBarTitleText": "媒体帮",
"navigationStyle": "custom"
}
},
{
"path" : "pages/index/shoppage/mediaHelp",
"style" :
"path": "pages/index/shoppage/mediaDetail",
"style": {
"navigationBarTitleText": "媒体帮详情",
"navigationStyle": "custom"
}
},
{
"navigationBarTitleText" : "媒体帮",
"path": "pages/index/shoppage/mtbmakeMessage",
"style": {
"navigationBarTitleText": "媒体帮发布信息",
"navigationStyle": "custom"
}
},
//
{
"path" : "pages/index/shoppage/mediaDetail",
"style" :
"path": "pages/learningCenter/detail",
"style": {
"navigationBarTitleText": ""
}
},
{
"navigationBarTitleText" : "媒体帮详情",
"navigationStyle": "custom"
"path": "pages/mine/porsonalinfo",
"style": {
"navigationBarTitleText": "个人信息"
}
},
{
"path" : "pages/index/shoppage/mtbmakeMessage",
"style" :
"path": "pages/mine/myCourses",
"style": {
"navigationBarTitleText": "我的课程"
}
},
{
"navigationBarTitleText" : "媒体帮发布信息",
"navigationStyle": "custom"
"path": "pages/mine/myApplication",
"style": {
"navigationBarTitleText": "我的申请"
}
},
//
{
"path" : "pages/learningCenter/detail",
"style" :
"path": "pages/mine/associatedEnterprise",
"style": {
"navigationBarTitleText": "关联企业"
}
},
{
"navigationBarTitleText" : ""
"path": "pages/mine/associatedDetail",
"style": {
"navigationBarTitleText": "关联企业详情"
}
},
{
"path" : "pages/mine/porsonalinfo",
"path" : "pages/mine/completeInformation",
"style" :
{
"navigationBarTitleText" : "个人信息"
"navigationBarTitleText" : "信息完善"
}
}
],
"permission": {
"scope.userLocation": {
"desc": "获取位置"
}
},
"requiredPrivateInfos": [
"getLocation",
"onLocationChange",
"startLocationUpdateBackground",
"chooseAddress"
],
"globalStyle": {
"navigationBarTextStyle": "black",
@ -152,8 +181,7 @@
"selectedColor": "#007FFF",
"borderStyle": "white",
"backgroundColor": "#FFFFFF",
"list": [
{
"list": [{
"pagePath": "pages/index/index",
"iconPath": "static/tabbar/index.png",
"selectedIconPath": "static/tabbar/index_select.png",

263
src/pages/index/ChatDialog.vue

@ -0,0 +1,263 @@
<template>
<view class="dialog-container" v-if="visible">
<view class="dialog-mask" @click="close">×</view>
<view class="dialog-content">
<scroll-view class="message-box" scroll-y>
<view class="akstart" v-if="showfirst">
<view v-for="(msg,index) in messages" :key="index" :class="['message', msg.role]">
<image class="aicon" src="@/static/img/aiicon.png" mode=""></image>
<view class="bubble">
<text>{{ msg.content }}</text>
</view>
</view>
<view v-if="loading" class="loading">AI思考中...</view>
</view>
<view class="cnxw" v-else>
<view class="message assistant">
<image class="aicon" src="@/static/img/aiicon.png" mode=""></image>
<view class="bubble">
<text class="cwtitle">猜你想问</text>
<u-line color="#99CCFF" margin="20rpx 0"></u-line>
<text class="cwtxt" @click="askClcik('小微企业优惠政策')">小微企业优惠政策</text>
<text class="cwtxt" @click="askClcik('2025年最新小微企业优惠政策')">2025年最新小微企业优惠政策</text>
</view>
</view>
</view>
</scroll-view>
<view class="input-box" v-if="showfirst">
<input v-model="inputText" placeholder="请输入问题" @confirm="send" />
<button @click="send" :disabled="loading">发送</button>
</view>
<view class="inputbox" @click="showfirst = true" v-else>
<image style="width: 28rpx;height: 26rpx;margin-right: 8rpx;" src="@/static/img/daan.png" mode="">
</image>
找不到答案点此提问
</view>
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import {
ai
} from '@/api/index'
const showfirst = ref(false)
const props = defineProps({
visible: Boolean,
})
const emit = defineEmits(['close'])
const messages = ref([])
const inputText = ref('')
const loading = ref(false)
const close = () => emit('close')
const send = async () => {
if (!inputText.value.trim()) return
//
messages.value.push({
role: 'user',
content: inputText.value
})
const question = inputText.value
inputText.value = ''
loading.value = true
try {
const {
data
} = await ai({
"messages": question
})
// AI
messages.value.push({
role: 'assistant',
content: data.content
})
} catch (e) {
messages.value.push({
role: 'system',
content: '服务异常,请稍后重试'
})
} finally {
loading.value = false
}
}
const askClcik = (val) => {
showfirst.value = true
inputText.value = val
}
</script>
<style scoped lang="scss">
.dialog-container {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 999;
}
.dialog-mask {
position: absolute;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
}
.dialog-content {
position: absolute;
width: 100%;
height: 686rpx;
bottom: 0;
background: #E7F3FF;
box-sizing: border-box;
border: 2rpx solid #FFFFFF;
box-shadow: 0rpx -30rpx 20rpx 0rpx rgba(0, 0, 0, 0.2);
border-radius: 96rpx 0rpx 0rpx 0rpx;
display: flex;
flex-direction: column;
}
.message-box {
height: 85%;
padding: 30rpx 30rpx 10rpx 30rpx;
box-sizing: border-box;
}
.message {
margin-bottom: 30rpx;
display: flex;
}
.message.user {
justify-content: flex-end;
}
.message.assistant {
justify-content: flex-start;
}
.bubble {
max-width: 75%;
padding: 20rpx 30rpx;
border-radius: 10rpx;
background-color: aliceblue;
}
.user {
.bubble {
background: #95ec69;
}
.aicon {
width: 0;
height: 0;
}
}
.assistant {
.aicon {
width: 74rpx;
height: 64rpx;
}
.bubble {
background: #FFFFFF;
margin-left: 20rpx;
text {
font-family: Source Han Sans;
font-size: 24rpx;
font-weight: 300;
line-height: 48rpx;
text-align: justify;
/* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #000000;
}
}
}
.input-box {
height: 15%;
display: flex;
align-items: center;
padding: 20rpx;
border-radius: 40rpx 40rpx 0rpx 0rpx;
background: #FFFFFF;
box-shadow: 0rpx -2rpx 12rpx 0rpx rgba(0, 0, 0, 0.05);
}
input {
flex: 1;
padding: 16rpx 24rpx;
border: 2rpx solid #ddd;
border-radius: 8rpx;
}
button {
margin-left: 20rpx;
padding: 0 30rpx;
background: #007aff;
color: white;
height: 70rpx;
display: flex;
align-items: center;
}
.loading {
text-align: center;
color: #999;
}
.cwtitle {
color: #007FFF !important;
}
.cwtxt {
font-family: Source Han Sans;
font-size: 24rpx;
font-weight: 300;
line-height: 48rpx;
text-align: justify;
/* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #666666;
}
.inputbox {
height: 15%;
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx;
border-radius: 40rpx 40rpx 0rpx 0rpx;
background: #FFFFFF;
box-shadow: 0rpx -2rpx 12rpx 0rpx rgba(0, 0, 0, 0.05);
font-family: Source Han Sans;
font-size: 24rpx;
font-weight: 300;
line-height: 48rpx;
text-align: justify;
/* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #007FFF;
}
</style>

78
src/pages/index/index.vue

@ -3,7 +3,7 @@
@leftClick="leftClick">
</u-navbar>
<view class="container">
<u-swiper :list="list5" @change="change" radius="0" height="180">
<u-swiper :list="list5" @change="change" :autoplay="false" radius="0" height="180" keyName="pic_path" @click="swiperClick" :displayMultipleItems="0">
<template #indicator>
<view class="indicator">
<view class="indicator__dot" v-for="(item, index) in list5" :key="index"
@ -13,8 +13,7 @@
</template>
</u-swiper>
<view class="box">
<image class="zuanti" src="@/static/logo.png" mode="scaleToFill" @click="goZT(1)"></image>
<image class="zuanti" :src="url + '/' + ztdata.home_img" mode="scaleToFill" @click="goZT(ztdata.id)"></image>
<view class="titlebox">
<view class="left">
<image style="width: 40rpx;height: 40rpx;" src="@/static/img/yaohuodong.png" mode=""></image>
@ -27,16 +26,16 @@
<scroll-view class="scroll-view_H" scroll-x="true">
<view class="hdCard" v-for="(item,index) in hdList" :key="index">
<image class="img" :src="item.pic" mode=""></image>
<image class="img" :src="url + '/' + item.index_pic" mode=""></image>
<view class="message">
<view class="title">
{{item.title}}
</view>
<view class="time">
{{item.time}}
{{item.activity_time}}
</view>
<view class="splace">
{{item.splace}}
{{item.address}}
</view>
</view>
</view>
@ -114,7 +113,8 @@
</view>
</view>
</view>
<image class="xzs" src="@/static/img/xzs.png" mode=""></image>
<image class="xzs" src="@/static/img/xzs.png" mode="" @click="showChat = true"></image>
<chatdialog :visible="showChat" @close="showChat = false"/>
</template>
<script setup>
@ -123,18 +123,28 @@
watch
} from 'vue'
import tabsComm from '../index/tabsComm.vue'
import { homeSpecial, bannerList, activityList } from '@/api/index'
import chatdialog from '@/pages/index/ChatDialog.vue'
import useUserStore from '@/store/user'
const userStore = useUserStore()
const url = ref(import.meta.env.VITE_APP_BASE_URL)
const current = ref(0)
const ztdata = ref({})
const list5 = reactive([
'https://img.shetu66.com/2023/07/04/1688453333865029.png',
'https://img.shetu66.com/2023/07/04/1688453333865029.png',
'https://tse3-mm.cn.bing.net/th/id/OIP-C.dg5f16itonvLphu4hOxtPgHaEK?rs=1&pid=ImgDetMain',
]);
const list5 = ref([]);
const showChat = ref(false)
const change = (val) => {
current.value = val.current
}
const swiperClick = (item) => {
uni.navigateTo({
url: '/pages/index/ztdetail?id='+list5.value[item].id+'&type='+'index'
})
}
const hdList = ref([{
pic: '/static/logo.png',
@ -261,9 +271,49 @@
})
}
onShow(async() => {
const res = await homeSpecial()
if(res.code === 1) {
ztdata.value = res.data
}
const res1 = await bannerList()
if(res.code === 1) {
list5.value = res1.data
list5.value.forEach((ele)=> {
ele.pic_path = url.value + '/' + ele.pic_path
})
}
const res2 = await activityList(1,5)
if(res.code === 1) {
hdList.value = res2.data.data
}
})
onShow(() => {
onLoad(()=> {
// wx.getSetting({
// success(res) {
// if (!res.authSetting['scope.userLocation']) {
// wx.authorize({
// scope: 'scope.userLocation',
// success() {
// //
// getLocation();
// },
// fail() {
// //
// wx.openSetting({
// success(res) {
// console.log(res.authSetting)
// }
// })
// }
// })
// } else {
// //
// getLocation();
// }
// }
// })
})
</script>

352
src/pages/index/specialSubject.vue

File diff suppressed because one or more lines are too long

47
src/pages/index/ztdetail.vue

@ -1,15 +1,15 @@
<template>
<u-navbar :title="'“'+titletxt+'”'+'专题'" placeholder="true" bgColor="#F1F3F9" :autoBack="true">
<u-navbar :title="titleData.special_id_name?'“'+ titleData.special_id_name +'”'+'专题':''" placeholder="true" bgColor="#F1F3F9" :autoBack="true">
</u-navbar>
<view class="container">
<view class="titlepart">
<image style="width: 8rpx;height: 38rpx;" src="@/static/img/Fill1.png" mode=""></image>
<image style="width: 8rpx;height: 38rpx;margin-left: 6rpx;" src="@/static/img/Fill2.png" mode=""></image>
<text class="title">这是详情标题标题标题</text>
<image style="width: 8rpx;height: 1em;" src="@/static/img/Fill1.png" mode=""></image>
<image style="width: 8rpx;height: 1em;margin-left: 6rpx;" src="@/static/img/Fill2.png" mode=""></image>
<text class="title">{{titleData.title}}</text>
</view>
<image style="width: 100%;height: 436rpx;margin-top: 48rpx;" src="@/static/img/Bitmap.png" mode=""></image>
<view class="text">农业农村部农产品质量安全中心发布公告公示2024年第二批全国名特优新农产品名录辽宁省36个产品入选其中大连6个分别是大连油桃旅顺大樱桃长海香螺长海鲍鱼瓦房店闫店地瓜庄河蓝莓 农业农村部农产品质量安全中心发布公告公示2024年第二批全国名特优新农产品名录辽宁省36个产品入选其中大连6个分别是大连油桃旅顺大樱桃长海香螺长海鲍鱼瓦房店闫店地瓜庄河蓝莓 </view>
<view class="fbtime">1小时前</view>
<!-- <image style="width: 100%;height: 436rpx;margin-top: 48rpx;" src="@/static/img/Bitmap.png" mode=""></image> -->
<rich-text :nodes="titleData.content"></rich-text>
<view class="fbtime">{{titleData.create_time}}</view>
</view>
</template>
@ -20,12 +20,27 @@
import {
ref
} from 'vue';
import {
specialListInfo,
bannerInfo
} from '@/api/index'
const titletxt = ref('名特优新')
const titleData = ref([])
onLoad((param) => {
console.log(param);
onLoad(async(param) => {
if(param.type === 'zt') {
const res = await specialListInfo(param.id)
if(res.code === 1) {
titleData.value = res.data
}
} else {
const res = await bannerInfo(param.id)
if(res.code === 1) {
console.log(res);
titleData.value = res.data
}
}
})
</script>
@ -38,15 +53,12 @@
box-sizing: border-box;
.titlepart {
display: flex;
align-items: center;
align-items: baseline;
margin-bottom: 40rpx;
.title {
font-family: Source Han Sans;
font-weight: 550;
font-size: 36rpx;
font-weight: normal;
line-height: 56rpx;
display: flex;
align-items: center;
letter-spacing: normal;
color: #0C092A;
margin-left: 20rpx;
}
@ -61,11 +73,10 @@
color: #3D3D3D;
}
.fbtime {
margin-top: 32rpx;
font-family: Roboto;
font-size: 28rpx;
font-weight: normal;
line-height: 42rpx;
line-height: 142rpx;
letter-spacing: normal;
/* 外部/SCMP Grey/nobel */
/* 样式描述:06 Small Grey txt */

58
src/pages/learningCenter/detail.vue

@ -1,50 +1,51 @@
<template>
<view class="pagebox">
<view class="vidoepart">
<video class="myVideo" src="https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4"
<view class="vidoepart" v-if="detailData.s_type === 1">
<video class="myVideo" :src="baseurl + detailData.video_path"
@error="videoErrorCallback"></video>
</view>
<view class="main">
<text class="title">小白投资避坑指南</text>
<text class="title" v-if="detailData.s_type === 2">{{detailData.title}}</text>
<view class="peopnum">
<view class="left">
<image style="width: 26rpx;height: 28rpx;" src="@/static/img/gkrs.png" mode=""></image>
<text class="txt">观看人数</text>
<text class="num">200</text>
<text class="num">{{detailData.watch_count}}</text>
</view>
<view class="left">
<image style="width: 28rpx;height: 28rpx;" src="@/static/img/scrs.png" mode=""></image>
<text class="txt">观看人数</text>
<text class="num">200</text>
<text class="txt">收藏人数</text>
<text class="num">{{detailData.collect_count}}</text>
</view>
</view>
<text class="title">小白投资避坑指南</text>
<text class="message">小白必看新手如何炒股票不被割韭菜/书单推荐/股票基金避坑/理财课靠谱吗 视频文字版本的介绍内容视频文字版本的介绍内容视频文字版本的介绍内容视频文字版本的介绍内容视频文字版本的介绍内容视频文字版本</text>
<view class="shqy">
<view class="head">
<image style="width: 12rpx;height: 32rpx;" src="@/static/img/shqy.png" mode=""></image>
<text class="text">适合企业</text>
</view>
<view class="cards">
<view class="card">
<text class="lcxb">理财小白</text>
<text class="bz">不知道从何入手</text>
</view>
<view class="card">
<text class="lcxb">理财小白</text>
<text class="bz">不知道从何入手</text>
</view>
<view class="card">
<text class="lcxb">理财小白</text>
<text class="bz">不知道从何入手</text>
<view class="card" v-for="(item,index) in JSON.parse(detailData.suitable)" :key="index">
<text class="lcxb">{{item.title}}</text>
<text class="bz">{{item.describe}}</text>
</view>
</view>
</view>
<text class="title" v-if="detailData.s_type === 1">{{detailData.title}}</text>
<text class="message">{{detailData.introduction}}</text>
</view>
</view>
</template>
<script setup>
import {
studyCenterDetail,
watchCount,
studyRecord
} from '@/api/learningCenter'
const baseurl = import.meta.env.VITE_APP_BASE_URL + '/'
const detailData = ref({})
const videoErrorCallback = (e) => {
uni.showModal({
@ -52,8 +53,18 @@
showCancel: false
})
}
onLoad((param) => {
console.log(param);
onLoad(async(param) => {
await watchCount({'id':param.id})
await studyCenterDetail(param.id).then(async(res) => {
if(res.code === 1) {
detailData.value = res.data
if(res.data.s_type === 1) {
} else {
await studyRecord({'id': param.id,'progress': '100'})
}
}
})
})
</script>
@ -73,6 +84,7 @@
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 40rpx;
.left {
display: flex;
align-items: center;
@ -157,11 +169,12 @@
font-family: Source Han Sans;
font-size: 36rpx;
font-weight: 350;
line-height: 100rpx;
line-height: 80rpx;
letter-spacing: normal;
color: #0C092A;
}
.message {
margin-top: 40rpx;
font-family: Source Han Sans;
font-size: 30rpx;
font-weight: 300;
@ -170,6 +183,7 @@
align-items: center;
letter-spacing: normal;
color: #3D3D3D;
line-height: 60rpx;
}
}
}

179
src/pages/learningCenter/index.vue

@ -7,36 +7,40 @@
<view class="main">
<view class="text">
距离上次学习已经
<text class="hongzi"> 6</text>
<text class="hongzi"> 20</text>
<text class="hongzi"> 38</text>
<text class="hongzi"> {{learntime.days}}</text>
<text class="hongzi"> {{learntime.hours}}</text>
<text class="hongzi"> {{learntime.minutes}}</text>
</view>
<view class="xxls">
<view class="xxone" v-for="(item,index) in xxList" :key="index" @click="xxClick(item)">
<image style="width: 100%;height: 238rpx;border-radius: 16rpx;" :src="item.img" mode=""></image>
<view class="xxls" v-if="xxList.length !== 0">
<view class="xxone" v-for="(item,index) in xxList.slice(0,3)" :key="index" @click="kcClick(item)">
<image style="width: 100%;height: 238rpx;border-radius: 16rpx;"
:src="baseurl + '/' +item.study_center_index_pic" mode=""></image>
<view class="xxjd">
已学{{item.xxjd}}%
已学{{item.progress}}%
</view>
</view>
</view>
<view class="xxls" v-else>
无学习历史记录
</view>
</view>
</view>
<u-tabs :list="tabList" :lineWidth="34" :lineHeight="4" lineColor="#007FFF"
:activeStyle="{color: '#0C092A',fontWeight: '600',fontSize: '34rpx'}"
:inactiveStyle="{color: '#858494',fontWeight: '350',fontSize: '30rpx'}" @click="tabClick"></u-tabs>
<u-search @search="search" @clickIcon="clickIcon" shape="square" placeholder="请输入搜索内容"
<u-search @search="search" @clickIcon="clickIcon" @clear="clear" shape="square" placeholder="请输入搜索内容"
placeholderColor="#088cff" v-model="keyword" searchIcon="/static/img/search.png" searchIconSize="14"
:showAction="false" height="40" margin="40rpx 24rpx 24rpx 24rpx"></u-search>
<view class="KClist">
<view class="kcone" v-for="(item,index) in kcList" :key="index" @click="kcClick(item)">
<image class="img" :src="item.img" mode=""></image>
<image class="img" :src="baseurl + item.index_pic" mode=""></image>
<view class="right">
<text class="title">{{item.title}}</text>
<text class="txt">{{item.txt}}</text>
<text class="txt">{{item.introduction}}</text>
<view class="bottompart">
<text class="gtsy">{{item.gtsy}}</text>
<text class="data">{{item.data}}</text>
<text class="gtsy">{{item.publisher}}</text>
<text class="data">{{ item.create_time.slice(0,10)}}</text>
</view>
</view>
</view>
@ -49,24 +53,23 @@
ref,
watch
} from 'vue'
import {
myStudy,
studyCenter
} from '@/api/learningCenter'
const xxList = ref([{
id: 0,
img: '/static/img/sl4.png',
xxjd: 50
},
{
id: 1,
img: '/static/img/sl4.png',
xxjd: 30
},
{
id: 1,
img: '/static/img/sl4.png',
xxjd: 30
}
])
const baseurl = import.meta.env.VITE_APP_BASE_URL + '/'
const learntime = ref({
days: 0,
hours: 0,
minutes: 0
})
const xxList = ref([])
const keyword = ref('')
const tabIndex = ref('')
const tabList = ref([{
name: '推荐'
},
@ -78,60 +81,107 @@
}
])
const kcList = ref([{
img: '/static/img/sl5.png',
title: '课程标题标题标题',
txt: '小白必看!新手如何炒股票不被割韭菜?/书单推荐/股票基金避坑理财课靠谱吗?',
gtsy: '个体私营协会',
data: '2025-04-17',
type: 'video'
},
{
img: '/static/img/sl5.png',
title: '课程标题标题标题',
txt: '小白必看!新手如何炒股票不被割韭菜?/书单推荐/股票基金避坑理财课靠谱吗?',
gtsy: '个体私营协会',
data: '2025-04-17',
type: 'imgtxt'
},
{
img: '/static/img/sl5.png',
title: '课程标题标题标题',
txt: '小白必看!新手如何炒股票不被割韭菜?/书单推荐/股票基金避坑理财课靠谱吗?',
gtsy: '个体私营协会',
data: '2025-04-17',
type: 'imgtxt'
}
])
const kcList = ref([])
const xxClick = (item) => {
console.log(item);
}
const tabClick = (item) => {
console.log(item);
keyword.value = ''
if(item.index === 0) {
tabIndex.value = ''
getcenterList(1, keyword.value, tabIndex.value, 1, 10)
} else {
tabIndex.value = item.index
getcenterList('', keyword.value, tabIndex.value, 1, 10)
}
}
const search = (val) => {
console.log(val);
zhscrollRel.value.searchleMenuTap(keyword.value)
if(tabIndex.value !== '') {
getcenterList('', keyword.value, tabIndex.value, 1, 10)
} else {
getcenterList(1, keyword.value, tabIndex.value, 1, 10)
}
}
const clickIcon = () => {
console.log(keyword.value);
zhscrollRel.value.searchleMenuTap(keyword.value)
if(tabIndex.value !== '') {
getcenterList('', keyword.value, tabIndex.value, 1, 10)
} else {
getcenterList(1, keyword.value, tabIndex.value, 1, 10)
}
}
const clear = () => {
keyword.value = ''
if(tabIndex.value !== '') {
getcenterList('', keyword.value, tabIndex.value, 1, 10)
} else {
getcenterList(1, keyword.value, tabIndex.value, 1, 10)
}
}
const kcClick = (item) => {
console.log(item);
uni.navigateTo({
url: '/pages/learningCenter/detail?id=' + item.type
url: '/pages/learningCenter/detail?id=' + item.id
})
}
const useTimeDiff = (targetDateStr) => {
const days = ref(0);
const hours = ref(0);
const minutes = ref(0);
const targetDate = new Date(targetDateStr.replace(/-/g, '/'));
const now = new Date();
const diffMs = now - targetDate;
days.value = Math.max(0, Math.floor(diffMs / 86400000));
hours.value = Math.max(0, Math.floor((diffMs % 86400000) / 3600000));
minutes.value = Math.max(0, Math.floor((diffMs % 3600000) / 60000));
return {
days,
hours,
minutes
}
}
const getcenterList = async (recommend, title, type, page, limit) => {
await studyCenter(recommend, title, type, page, limit).then((res) => {
if (res.code === 1) {
kcList.value = res.data.data
}
})
}
const spliceval = (val,f,l) => {
return val.splice(f,l)
}
onShow(() => {
onShow(async () => {
const res = await myStudy()
if (res.code === 1) {
xxList.value = res.data
if (res.data.length !== 0) {
const {
days,
hours,
minutes
} = useTimeDiff(res.data[0]?.update_time);
learntime.value.days = days.value
learntime.value.hours = hours.value
learntime.value.minutes = minutes.value
}
}
if(tabIndex.value !== '') {
getcenterList('', keyword.value, tabIndex.value, 1, 10)
} else {
getcenterList(1, keyword.value, tabIndex.value, 1, 10)
}
})
</script>
@ -141,6 +191,7 @@
background: linear-gradient(0deg, #F1F3F9 72%, rgba(241, 243, 249, 0.2) 88%);
height: 100vh;
box-sizing: border-box;
overflow-y: auto;
}
.xxqd {

31
src/pages/learningCenter/useTimeDiff.js

@ -0,0 +1,31 @@
import { ref, onMounted, onUnmounted } from 'vue';
export default function useTimeDiff(targetDateStr) {
const days = ref(0);
const hours = ref(0);
const minutes = ref(0);
const calculateDiff = () => {
const targetDate = new Date(targetDateStr.replace(/-/g, '/'));
const now = new Date();
const diffMs = now - targetDate;
days.value = Math.max(0, Math.floor(diffMs / 86400000));
hours.value = Math.max(0, Math.floor((diffMs % 86400000) / 3600000));
minutes.value = Math.max(0, Math.floor((diffMs % 3600000) / 60000));
};
let timer;
onMounted(() => {
calculateDiff();
timer = setInterval(calculateDiff, 60000);
});
onUnmounted(() => {
clearInterval(timer);
});
return { days, hours, minutes };
}

27
src/pages/login/login.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import { debounce } from 'feng-uniapp-exploit/utils/index'
import { getMobile, getSign} from '@/api/login'
import { mobileAuth } from '@/api/login'
import useUserStore from '@/store/user'
const userStore = useUserStore()
@ -29,24 +29,20 @@
uni.showToast({ title: '用户拒绝授权', icon: 'none' })
return
}
try {
if (!loginCode.value) {
await getLoginCode()
}
if (!userStore.openId) {
await userStore.getopenid({ code: loginCode.value })
}
getMobile({ openid: userStore.openId, code: e.detail.code })
.then((res) => {
const { data: phone } = res as { data : string }
userStore.mobile = phone
mobileAuth({ openid: userStore.openId, code: e.detail.code })
.then((res : any) => {
const { data: moblie } = res as { data : string }
userStore.mobile = moblie
uni.setStorageSync('access_token', res.data.token)
userStore.getUserInfo()
onLoginSuccess()
})
.catch(() => {
@ -64,8 +60,9 @@
success: () => {
setTimeout(() => {
userStore.showtoast = false
// uni.reLaunch({ url: '/pages/votingElection/index?meetId=' + userStore.meetId })
uni.switchTab({
url: '/pages/index/index'
})
}, 1000)
}
})
@ -83,10 +80,10 @@
</script>
<template>
<view class="login">
<image class="logo-img" src="@/static/logo.png" mode="widthFix" />
<!-- <image class="logo-img" src="@/static/logo.png" mode="widthFix" /> -->
<text>惠企通欢迎您</text>
<view class="btn_box">
<u-button @getphonenumber="onGetPhoneNumber" text="请签到后进行投票" icon-color="#fff" open-type="getPhoneNumber"
<u-button @getphonenumber="onGetPhoneNumber" text="手机号登录" icon-color="#fff" open-type="getPhoneNumber"
color="linear-gradient(270deg, rgba(232, 123, 7, 1) 0%, rgba(247, 205, 77, 1) 100%)" shape="circle" />
</view>
</view>

160
src/pages/memberCenter/index.vue

@ -1,13 +1,163 @@
<script setup lang="ts">
</script>
<template>
<view class="electionList">
<view class="container">
<u-search @search="search" @clickIcon="clickIcon" shape="square" placeholder="请输入搜索内容"
placeholderColor="#2a98ff" v-model="keyword" searchIcon="/static/img/search.png" searchIconSize="14"
:showAction="false" height="40" margin="40rpx 24rpx 24rpx 24rpx" bgColor="#FFFFFF"></u-search>
<view class="main">
<view class="ztone" v-for="(item,index) in ztList" :key="index" @click="godetail(item.id)">
<image style="width: 150rpx;height: 150rpx;border-radius: 28rpx;flex: 1;" :src="item.img" mode="">
</image>
<view class="rightpart">
<view class="splace">
{{item.splace}}
</view>
<view class="titlepart">
<text class="title">{{item.title}}</text>
<image style="width: 32rpx;height: 44rpx;" src="@/static/img/Icon.png" mode="aspectFill">
</image>
</view>
<view class="ms">
{{item.ms}}
</view>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue';
//
const keyword = ref('');
const search = (val) => {
console.log(val);
}
const clickIcon = () => {
console.log(keyword.value);
}
const ztList = ref([{
id: 0,
img: '/static/img/image.png',
title: '这是一个标题',
time: '2025-04-16',
splace: '内蒙古数心科技',
ms: '描述描述描述描述描述描述'
},
{
id: 1,
img: '/static/img/image.png',
title: '这是一个标题',
time: '2025-04-16',
splace: '内蒙古数心科技',
ms: '描述描述描述描述描述描述'
}
])
const godetail = (id) => {
uni.navigateTo({
url: '/pages/index/shoppage/jrbDetail?id=' + id
})
}
onMounted(() => {
})
</script>
<style scoped lang="scss">
.container {
background: linear-gradient(0deg, #F1F3F9 72%, rgba(129, 179, 222, 0.5) 88%);
height: 100vh;
width: 100%;
overflow-y: auto;
.main {
margin-top: 10rpx;
width: 100%;
height: 100%;
padding: 0 24rpx;
box-sizing: border-box;
max-height: 79vh;
overflow-y: auto;
.ztone {
display: flex;
align-items: center;
width: 100%;
height: 210rpx;
margin-top: 30rpx;
padding: 30rpx;
border-radius: 20rpx;
background: #FFFFFF;
box-sizing: border-box;
border: 2rpx solid rgba(0, 127, 255, 0.12);
.rightpart {
width: 100%;
margin-left: 40rpx;
flex: 3;
display: grid;
.titlepart {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.title {
font-family: Poppins;
font-size: 24rpx;
font-weight: 600;
line-height: 34rpx;
letter-spacing: normal;
/* 外部/Colors/Dark/Base 1 */
color: #161719;
margin-top: 13rpx;
}
}
.splace {
font-family: Poppins;
font-size: 24rpx;
font-weight: normal;
line-height: 34rpx;
letter-spacing: normal;
/* 外部/Colors/Dark/Base 1 */
color: #161719;
}
.ms {
margin-top: 13rpx;
font-family: Poppins;
font-size: 20rpx;
font-weight: normal;
line-height: 28rpx;
letter-spacing: normal;
/* 外部/Colors/Light/Base 3 */
color: #91919F;
}
}
}
}
}
.hdzq {
width: 182rpx;
height: 80rpx;
position: fixed;
right: 0;
top: 70%;
margin-right: -14rpx;
}
</style>

93
src/pages/mine/associatedDetail.vue

@ -0,0 +1,93 @@
<template>
<view class="container">
<text class="texttitle">内蒙古数心科技有限公司</text>
<view class="titlepart">
<view class="icon"></view>
<text class="title">公司简介</text>
</view>
<image style="width: 100%;height: 400rpx;margin-top: 40rpx;" src="@/static/img/Bitmap.png" mode=""></image>
<text class="message">说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明</text>
</view>
</template>
<script setup>
import {
onLoad
} from '@dcloudio/uni-app';
import {
ref
} from 'vue';
onLoad(() => {
})
</script>
<style scoped lang="scss">
.container {
background-color: #FFFFFF;
height: calc(100vh - 182rpx);
width: 100%;
padding: 40rpx 40rpx 0 40rpx;
box-sizing: border-box;
.titlepart {
margin-top: 40rpx;
display: flex;
align-items: center;
.icon{
width: 12rpx;
height: 32rpx;
border-radius: 0rpx 32rpx 32rpx 0rpx;
/* 蓝色渐变 */
background: linear-gradient(0deg, #007FFF 0%, #99CCFF 100%);
}
.title {
margin-left: 18rpx;
font-family: Source Han Sans;
font-size: 30rpx;
font-weight: 350;
line-height: 32rpx;
text-align: justify; /* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #0072FF;
}
}
.texttitle {
font-family: Source Han Sans;
font-size: 36rpx;
font-weight: normal;
letter-spacing: normal;
color: #0C092A;
}
.message {
margin-top: 36rpx;
font-family: Source Han Sans;
font-size: 30rpx;
font-weight: 300;
line-height: 60rpx;
text-align: justify; /* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #3D3D3D;
}
.people {
margin-top: 28rpx;
display: flex;
.text {
font-family: Source Han Sans;
font-size: 32rpx;
font-weight: 300;
line-height: 60rpx;
text-align: justify; /* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #3D3D3D;
}
}
}
</style>

76
src/pages/mine/associatedEnterprise.vue

@ -0,0 +1,76 @@
<template>
<view class="classbox">
<view class="classone" v-for="(item,index) in classList" :key="index" @click="goDetail(item.id)">
<text class="title">{{item.title}}</text>
<text class="text">关联时间{{item.time}}</text>
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue';
const classList = ref([{
id: 1,
title: '内蒙古数心科技有限公司',
time: '2025-04-17'
},
{
id: 2,
title: '内蒙古数心科技有限公司',
time: '2025-04-17'
},
])
const goDetail = (id) => {
uni.navigateTo({
url: '/pages/mine/associatedDetail?id='+id
})
}
</script>
<style scoped lang="scss">
.classbox {
height: 100vh;
background: linear-gradient(0deg, #F1F3F9 72%, rgb(202 202 204 / 20%) 88%);
padding: 6rpx 24rpx 40rpx 24rpx;
box-sizing: border-box;
overflow-y: auto;
.classone {
width: 100%;
height: 144rpx;
border-radius: 20rpx;
background: #FFFFFF;
display: grid;
align-items: center;
padding: 32rpx 28rpx;
margin-top: 30rpx;
.title {
font-family: Source Han Sans;
font-size: 28rpx;
font-weight: 350;
text-align: justify;
/* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #0C092A;
}
.text {
margin-top: 24rpx;
font-family: Source Han Sans;
font-size: 20rpx;
font-weight: 350;
display: flex;
align-items: center;
letter-spacing: normal;
color: #858494;
}
}
}
</style>

279
src/pages/mine/completeInformation.vue

@ -0,0 +1,279 @@
<template>
<view class="container">
<view class="cardbox">
<view v-for="(group, index) in inputGroups" :key="index" class="input-group">
<view class="inputs" @click="beforeRead(index)">
公司性质
<input class="inputclass" placeholder-class="inputplacla" :value="group.type==1 ? '其他(自由职业者等)' : (group.type===2 ? '个体工商户' : (group.type===3 ? '民营企业' : '') )"
placeholder="民营企业、个体工商户、其它(自由职业者等)" @click="qyshow = true" />
<u-action-sheet :actions="qylist" title="请选择关联企业类型" :show="qyshow" @select="qyClick"
@close="qyshow = false"></u-action-sheet>
公司名称
<input class="inputclass" placeholder-class="inputplacla" v-model="group.title"
placeholder="请输入真实公司名称" />
营业执照
<u-upload class="uploadbox" @afterRead="afterRead" :maxCount="1"
:imageMode="'heightFix'" :width="auto" :height="144">
<view class="yyzz" v-if="group.license === ''">
<image style="width: 40rpx;height: 40rpx;" src="@/static/img/yyzz.png" mode=""></image>
上传营业执照
</view>
<image v-else @click="beforeRead(index)" style="width: 100%;height: 288rpx;margin-top: 12rpx;" :src="baseurl+ '/' + group.license" mode="scaleToFill"></image>
</u-upload>
</view>
<view v-if="index > 0" class="remove-btn">-</view>
</view>
<button @click="addGroup" class="add-btn">+ 添加一组</button>
</view>
</view>
<view class="buts">
<view class="but" @click="submit">
确认提交
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue'
import {
modifyField,
} from '@/api/mine'
const baseurl = ref(import.meta.env.VITE_APP_BASE_URL)
const inputGroups = ref([{
type: '',
title: '',
license: ''
}])
const addGroup = () => {
inputGroups.value.push({
type: '',
title: '',
license: ''
})
}
const qyshow = ref(false)
const qylist = ref([{
id: 1,
name: '其他(自由职业者等)',
},
{
id: 2,
name: '个体工商户',
},
{
id: 3,
name: '民营企业',
}
]);
const qyClick = async (val) => {
inputGroups.value[upclickindex.value].type = val.id
}
const removeGroup = (index) => {
inputGroups.value.splice(index, 1)
}
const upclickindex = ref(0)
const beforeRead = (index) =>{
upclickindex.value = index
}
const afterRead = async (e) => {
console.log(e);
uni.uploadFile({
url: import.meta.env.VITE_APP_BASE_URL + '/api/file/image',
filePath: e.file.url,
name: 'file',
header: {
'token': uni.getStorageSync('access_token')
},
success: async (val) => {
inputGroups.value[upclickindex.value].license = ''
console.log(val);
console.log(JSON.parse(val.data).data.url);
if (JSON.parse(val.data).data.url) {
console.log(upclickindex.value);
inputGroups.value[upclickindex.value].license = JSON.parse(val.data).data.url
}
},
fail: (res) => {
console.log('失败', res);
}
})
}
const submit = async () => {
let data = []
inputGroups.value.forEach((obj) => {
if(obj.type == ''||obj.title == ''||obj.license == '') {
}else {
data.push(obj)
}
})
await modifyField('enterprise',data.toString()).then((res) => {
if (res.code === 1) {
setTimeout(() => {
uni.showToast({
title: '提交成功!',
icon: 'success'
})
}, 500)
} else {
uni.showToast({
title: '提交失败!',
icon: 'fail'
})
}
})
}
</script>
<style scoped lang="scss">
.container {
height: calc(100vh - 168rpx);
width: 100%;
background: #F1F3F9;
overflow-y: auto;
.cardbox {
box-sizing: border-box;
}
.input-group {
padding: 40rpx;
margin-top: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
background-color: #e2e2e2;
}
.inputs {
flex: 9;
}
input {
flex: 1;
height: 80rpx;
border: 2rpx solid #ddd;
padding: 0 20rpx;
margin-right: 10rpx;
}
.remove-btn,
.add-btn {
width: 80rpx;
height: 80rpx;
display: flex;
justify-content: center;
align-items: center;
background: #f0f0f0;
border-radius: 8rpx;
}
.remove-btn {
margin-left: 20rpx;
border-radius: 50%;
width: 40rpx;
height: 40rpx;
color: #ff0000;
border: 2rpx solid #ff0000;
display: flex;
align-items: flex-end;
justify-content: center;
}
.add-btn {
width: auto;
padding: 0 30rpx;
background: #4CAF50;
color: white;
margin-bottom: 60rpx;
}
}
.buts {
height: 168rpx;
position: fixed;
bottom: 0;
width: 100%;
background: #FFFFFF;
/* 标签栏投影 */
box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0, 0, 0, 0.3);
display: flex;
align-items: center;
justify-content: center;
.but {
width: 574rpx;
height: 96rpx;
border-radius: 248rpx;
background: linear-gradient(90deg, #007FFF 0%, #99CCFF 100%);
display: flex;
align-items: center;
justify-content: center;
font-family: Source Han Sans;
font-size: 36rpx;
font-weight: 350;
line-height: 32rpx;
text-align: justify;
/* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #FFFFFF;
}
}
.inputclass {
margin-top: 12rpx;
margin-bottom: 36rpx;
margin-right: 0 !important;
height: 100rpx !important;
border-radius: 10rpx;
background: #FFFFFF;
}
:deep(.inputplacla) {
font-family: Source Han Sans;
font-size: 24rpx;
font-weight: 350;
line-height: 32.76rpx;
letter-spacing: normal;
color: #D3D3D3;
}
.yyzz {
margin-top: 12rpx;
width: 100%;
height: 288rpx;
border-radius: 16rpx;
background: #FFFFFF;
display: grid;
align-content: center;
justify-items: center;
font-family: Source Han Sans;
font-size: 30rpx;
font-weight: 350;
line-height: 70rpx;
letter-spacing: normal;
color: #CCCCCC;
}
:deep(.u-upload) {
.u-upload__wrap {
view {
width: 100%;
}
}
}
</style>

67
src/pages/mine/index.vue

@ -2,29 +2,33 @@
<view class="container">
<image style="width: 100%;" src="@/static/img/ztback.png" mode="widthFix"></image>
<view class="main">
<view class="head">
<view class="head" v-if="userStore.userInfo.moblie">
<view class="left">
<u-avatar :src="'https://lingjing-online.cdn.bcebos.com/v1/lingjing-online/appavatar/2024-01-23/665e6368-eafd-4e0b-a58c-4a848cafa238.png?x-bce-process=image/resize,m_fill,w_360,h_360'" :size="72"></u-avatar>
<text class="name">褚冰枫</text>
<u-avatar
:src="url + '/' + userStore.userInfo.head_pic"
:size="72"></u-avatar>
<text class="name">{{userStore.userInfo.name||'无名称'}}</text>
</view>
<image style="width: 48rpx;height: 48rpx;" src="@/static/img/setting.png" mode="" @click="goeditinfo"></image>
<image style="width: 48rpx;height: 48rpx;" src="@/static/img/setting.png" mode=""
@click="goeditinfo('')"></image>
</view>
<text v-else>请登录</text>
<view class="editlist">
<view class="editone">
<view class="editone" @click="goeditinfo('关联企业')">
<view class="left">
<image style="width: 74rpx;height: 74rpx;" src="@/static/img/glqy.png" mode=""></image>
<text class="txt">关联企业</text>
</view>
<image style="width: 14.14rpx;height: 14.14rpx;" src="@/static/img/Group13.png" mode=""></image>
</view>
<view class="editone">
<view class="editone" @click="goeditinfo('我的申请')">
<view class="left">
<image style="width: 74rpx;height: 74rpx;" src="@/static/img/wdsq.png" mode=""></image>
<text class="txt">我的申请</text>
</view>
<image style="width: 14.14rpx;height: 14.14rpx;" src="@/static/img/Group13.png" mode=""></image>
</view>
<view class="editone">
<view class="editone" @click="goeditinfo('我的课程')">
<view class="left">
<image style="width: 74rpx;height: 74rpx;" src="@/static/img/wdkc.png" mode=""></image>
<text class="txt">我的课程</text>
@ -33,8 +37,8 @@
</view>
</view>
<view class="buts">
<view class="but">
退出登录
<view class="but" @click="outLogin">
{{userStore.userInfo.moblie?'退出登录':'登录'}}
</view>
</view>
</view>
@ -48,13 +52,43 @@
import {
ref
} from 'vue';
import useUserStore from '@/store/user'
const userStore = useUserStore()
const goeditinfo = () => {
const url = ref(import.meta.env.VITE_APP_BASE_URL)
const goeditinfo = (val) => {
if (val === '关联企业') {
uni.navigateTo({
url: '/pages/mine/associatedEnterprise'
})
} else if (val === '我的申请') {
uni.navigateTo({
url: '/pages/mine/myApplication'
})
} else if (val === '我的课程') {
uni.navigateTo({
url: '/pages/mine/myCourses'
})
} else {
uni.navigateTo({
url: '/pages/mine/porsonalinfo'
})
}
}
const outLogin = () => {
userStore.logOut()
}
onShow(() => {
// if (uni.getStorageSync('access_token') === '') {
// uni.navigateTo({
// url: '/pages/login/login'
// })
// } else {
userStore.getUserInfo()
// }
})
</script>
<style scoped lang="scss">
@ -63,6 +97,7 @@
height: 100vh;
width: 100%;
display: grid;
.main {
border-radius: 60rpx 60rpx 0rpx 0rpx;
background: #FFFFFF;
@ -70,14 +105,17 @@
height: calc(100vh - 350rpx);
padding: 0 40rpx;
box-sizing: border-box;
.head {
display: flex;
align-items: center;
justify-content: space-between;
.left {
display: flex;
align-items: center;
margin-top: -50rpx;
.name {
margin-top: 50rpx;
font-family: Source Han Sans;
@ -91,8 +129,10 @@
}
}
}
.editlist {
margin-top: 24rpx;
.editone {
width: 100%;
height: 120rpx;
@ -101,9 +141,11 @@
display: flex;
align-items: center;
justify-content: space-between;
.left {
display: flex;
align-items: center;
.txt {
margin-left: 36rpx;
font-family: Source Han Sans;
@ -116,10 +158,12 @@
}
}
}
.buts {
width: 100%;
display: flex;
justify-content: center;
.but {
margin-top: 160rpx;
width: 574rpx;
@ -132,7 +176,8 @@
font-family: Source Han Sans;
font-size: 36rpx;
font-weight: 500;
text-align: justify; /* 浏览器可能不支持 */
text-align: justify;
/* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;

187
src/pages/mine/myApplication.vue

@ -0,0 +1,187 @@
<template>
<view class="classbox">
<view class="pass">
<view class="head">
申请通过
</view>
<view class="main">
<view class="classone" v-for="(item,index) in passList" :key="index">
<text class="title">{{item.title}}</text>
<view class="jindu">
<image style="width: 32rpx;height: 32rpx;" src="@/static/img/timeicon.png" mode=""></image>
<text class="time">{{item.time}}</text>
</view>
</view>
</view>
</view>
<view class="reject">
<view class="head">
申请驳回
</view>
<view class="main">
<view class="classone" v-for="(item,index) in rejectList" :key="index">
<text class="title">{{item.title}}</text>
<view class="jindu">
<image style="width: 32rpx;height: 32rpx;" src="@/static/img/timeicon.png" mode=""></image>
<text class="time">{{item.time}}</text>
</view>
<text class="result">{{item.result}}</text>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref
} from 'vue';
const passList = ref([{
id: 1,
title: '金融帮信息发布',
time: '07/04/2025 12:45'
},
{
id: 2,
title: '金融帮信息发布',
time: '07/04/2025 12:45'
},
])
const rejectList = ref([
{
id: 1,
title: '金融帮信息发布',
time: '07/04/2025 12:45',
result: '企业信息查询有误'
},
{
id: 2,
title: '金融帮信息发布',
time: '07/04/2025 12:45',
result: '企业信息查询有误'
},
])
</script>
<style scoped lang="scss">
.classbox {
height: 100vh;
background: #FFFFFF;
padding: 40rpx 34rpx;
box-sizing: border-box;
overflow-y: auto;
.pass {
width: 100%;
.head {
width: 100%;
height: 72rpx;
display: flex;
align-items: center;
background: #007FFF;
font-family: Lato;
font-size: 32rpx;
font-weight: normal;
display: flex;
align-items: center;
letter-spacing: 0.76rpx;
/* System Background Primary Light */
color: #FFFFFF;
padding-left: 32rpx;
box-sizing: border-box;
}
.main {
background: #F1F3F9;
padding: 5rpx 16rpx 24rpx 16rpx;
box-sizing: border-box;
border-radius: 0rpx 0rpx 24rpx 24rpx;
}
}
.reject {
margin-top: 40rpx;
width: 100%;
.head {
width: 100%;
height: 72rpx;
display: flex;
align-items: center;
background: #FFC36F;
font-family: Lato;
font-size: 32rpx;
font-weight: normal;
display: flex;
align-items: center;
letter-spacing: 0.76rpx;
/* System Background Primary Light */
color: #FFFFFF;
padding-left: 32rpx;
box-sizing: border-box;
}
.main {
background: #F1F3F9;
padding: 5rpx 16rpx 24rpx 16rpx;
box-sizing: border-box;
border-radius: 0rpx 0rpx 24rpx 24rpx;
}
}
}
.classone {
width: 100%;
border-radius: 16rpx;
background: #FFFFFF;
display: grid;
align-items: center;
padding: 16rpx 32rpx;
margin-top: 20rpx;
box-sizing: border-box;
.title {
font-family: Source Han Sans;
font-size: 28rpx;
font-weight: 300;
display: flex;
align-items: center;
letter-spacing: 0.76rpx;
color: #0C092A;
}
.jindu {
margin-top: 16rpx;
width: 100%;
display: flex;
align-items: center;
.time {
font-family: Lato;
font-size: 20rpx;
font-weight: normal;
display: flex;
align-items: center;
letter-spacing: normal;
color: #858494;
margin-left: 16rpx;
}
}
.result {
margin-top: 12rpx;
font-family: Source Han Sans;
font-size: 28rpx;
font-weight: 300;
display: flex;
align-items: center;
letter-spacing: 0.76rpx;
color: #FE0000;
}
}
</style>

103
src/pages/mine/myCourses.vue

@ -0,0 +1,103 @@
<template>
<view class="classbox">
<view class="classone" v-for="(item,index) in classList" :key="index">
<text class="title">{{item.title}}</text>
<text class="text">{{item.text}}</text>
<view class="jindu">
<text class="learn">已学{{item.learn}}%</text>
<text class="time">{{item.time}}</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref } from 'vue';
const classList = ref([
{
id: 1,
title: '内蒙古数心科技有限公司',
text: '小白必看!新手如何炒股票不被割韭菜?/书单推荐/股票基金避坑理财课靠谱吗?',
learn: 70,
time: '2025-04-17'
},
{
id: 2,
title: '内蒙古数心科技有限公司',
text: '小白必看!新手如何炒股票不被割韭菜?/书单推荐/股票基金避坑理财课靠谱吗?',
learn: 70,
time: '2025-04-17'
},
])
</script>
<style scoped lang="scss">
.classbox {
height: 100vh;
background: linear-gradient(0deg, #F1F3F9 72%, rgb(202 202 204 / 20%) 88%);
padding: 6rpx 24rpx 40rpx 24rpx;
box-sizing: border-box;
overflow-y: auto;
.classone {
width: 100%;
border-radius: 20rpx;
background: #FFFFFF;
display: grid;
align-items: center;
padding: 30rpx 28rpx;
margin-top: 30rpx;
.title {
font-family: Source Han Sans;
font-size: 28rpx;
font-weight: 350;
text-align: justify; /* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #0C092A;
}
.text {
margin-top: 16rpx;
font-family: Source Han Sans;
font-size: 20rpx;
font-weight: 350;
display: flex;
align-items: center;
letter-spacing: normal;
color: #858494;
}
.jindu {
margin-top: 32rpx;
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
.learn {
font-family: Source Han Sans;
font-size: 20rpx;
font-weight: 500;
text-align: justify; /* 浏览器可能不支持 */
display: flex;
align-items: center;
letter-spacing: normal;
color: #007FFF;
display: flex;
align-items: center;
}
.time {
font-family: Source Han Sans;
font-size: 20rpx;
font-weight: 350;
text-align: right;
display: flex;
align-items: center;
letter-spacing: normal;
color: #858494;
}
}
}
}
</style>

217
src/pages/mine/porsonalinfo.vue

@ -7,10 +7,9 @@
<text class="txt">头像</text>
</view>
<view class="right">
<u-upload :fileList="form.fileList" @afterRead="afterRead" :maxCount="1">
<image
src='https://lingjing-online.cdn.bcebos.com/v1/lingjing-online/appavatar/2024-01-23/665e6368-eafd-4e0b-a58c-4a848cafa238.png?x-bce-process=image/resize,m_fill,w_360,h_360'
mode="" style="width: 80rpx;height: 80rpx;border-radius: 50%;"></image>
<u-upload :fileList="form.fileList" @afterRead="afterRead" :maxCount="1" :accept="'file'">
<image :src='url + `/` + userStore.userInfo.head_pic' mode=""
style="width: 80rpx;height: 80rpx;border-radius: 50%;"></image>
</u-upload>
<!-- <image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png"
mode=""></image> -->
@ -24,21 +23,21 @@
<view class="right">
<u-popup :show="usershow" @close="usershow = false">
<view class="popupbox">
<text class="title">请填写用户名</text>
<u-input type="text" v-model="form.username" />
<text class="title">{{popupTitle}}</text>
<u-input type="text" v-model="userValue" />
<view class="buts">
<view class="jujue" @click="usershow = false">
取消
</view>
<view class="yunxu" @click="sureClick('用户名')">
<view class="yunxu" @click="sureClick(typeValue)">
确认
</view>
</view>
</view>
</u-popup>
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png"
mode="" @click="usershow = true"></image>
<text class="value">{{userStore.userInfo.nickname}}</text>
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png" mode=""
@click="openpopup('用户名')"></image>
</view>
</view>
<view class="editone">
@ -47,10 +46,11 @@
<text class="txt">性别</text>
</view>
<view class="right">
<text class="value">{{form.sex}}</text>
<u-action-sheet :actions="sexlist" title="请选择性别" :show="sexshow" @select="selectClick" @close="sexshow = false" ></u-action-sheet>
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png"
mode="" @click="sexshow = true"></image>
<text class="value">{{userStore.userInfo.sex_name}}</text>
<u-action-sheet :actions="sexlist" title="请选择性别" :show="sexshow" @select="selectClick"
@close="sexshow = false"></u-action-sheet>
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png" mode=""
@click="sexshow = true"></image>
</view>
</view>
<view class="editone">
@ -59,9 +59,9 @@
<text class="txt">绑定手机号</text>
</view>
<view class="right">
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png"
mode=""></image>
<text class="value">{{userStore.userInfo.moblie}}</text>
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png" mode=""
@click="openpopup('手机号')"></image>
</view>
</view>
<view class="editone">
@ -70,20 +70,22 @@
<text class="txt">真实姓名</text>
</view>
<view class="right">
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png"
mode=""></image>
<text class="value">{{userStore.userInfo.name}}</text>
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png" mode=""
@click="openpopup('姓名')"></image>
</view>
</view>
<view class="editone">
<view class="left">
<image style="width: 32rpx;height: 32rpx;" src="@/static/img/szqy.png" mode=""></image>
<text class="txt">所在企业</text>
<text class="txt">关联企业</text>
</view>
<view class="right">
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png"
mode=""></image>
<text class="value">{{userStore.userInfo.identity_name}}</text>
<u-action-sheet :actions="qylist" title="请选择关联企业类型" :show="qyshow" @select="qyClick"
@close="qyshow = false"></u-action-sheet>
<image style="width: 18rpx;height: 18rpx;margin-left: 16rpx;" src="@/static/img/Group13.png" mode=""
@click="qyshow = true"></image>
</view>
</view>
</view>
@ -94,22 +96,90 @@
import {
ref
} from 'vue';
import {
modifyField
} from '@/api/mine'
import useUserStore from '@/store/user'
const userStore = useUserStore()
const url = ref(import.meta.env.VITE_APP_BASE_URL)
const sexshow = ref(false)
const sexlist = ref([
{
const sexlist = ref([{
name: '男',
},
{
name: '女',
},
]);
const selectClick = (val) => {
form.value.sex = val.name
sexshow.value = false
const selectClick = async (val) => {
await modifyField('sex', val.name === '男' ? 1 : 2).then((res) => {
if (res.code === 1) {
usershow.value = false
setTimeout(() => {
userStore.getUserInfo()
uni.showToast({
title: '修改成功!',
icon: 'success'
})
}, 500)
} else {
uni.showToast({
title: '修改失败!',
icon: 'fail'
})
}
})
}
const qyshow = ref(false)
const qylist = ref([{
id: 1,
name: '其他(自由职业者等)',
},
{
id: 2,
name: '个体工商户',
},
{
id: 3,
name: '民营企业',
}
]);
const qyClick = async (val) => {
await modifyField('identity', val.id).then((res) => {
if (res.code === 1) {
qyshow.value = false
setTimeout(() => {
userStore.getUserInfo()
uni.showToast({
title: '修改成功!',
icon: 'success'
})
if(val.id === 2||val.id === 3) {
uni.navigateTo({
url: '/pages/mine/completeInformation'
})
}
}, 500)
} else {
uni.showToast({
title: '修改失败!',
icon: 'fail'
})
}
})
}
const usershow = ref(false)
const popupTitle = ref('')
const userValue = ref('')
const typeValue = ref('')
const form = ref({
fileList: [],
@ -120,12 +190,78 @@
company: ''
})
const sureClick = (type) => {
console.log(type);
const openpopup = (type) => {
userValue.value = ''
usershow.value = true
typeValue.value = type
if (type === '用户名') {
popupTitle.value = '请输入用户名'
} else if (type === '手机号') {
popupTitle.value = '请输入手机号'
} else if (type === '姓名') {
popupTitle.value = '请输入真实姓名'
}
}
const sureClick = async (type) => {
let res = {}
if (type === '用户名') {
res = await modifyField('nickname', userValue.value)
} else if (type === '手机号') {
res = await modifyField('moblie', userValue.value)
} else if (type === '姓名') {
res = await modifyField('name', userValue.value)
}
if (res.code === 1) {
usershow.value = false
setTimeout(() => {
userStore.getUserInfo()
uni.showToast({
title: '修改成功!',
icon: 'success'
})
}, 500)
} else {
uni.showToast({
title: '修改失败!',
icon: 'fail'
})
}
}
const afterRead = (e) => {
console.log(e);
const afterRead = async (e) => {
uni.uploadFile({
url: import.meta.env.VITE_APP_BASE_URL+'/api/file/image',
filePath: e.file.url,
name: 'file',
header: {
'token': uni.getStorageSync('access_token')
},
success: async(val) => {
await modifyField('head_pic',JSON.parse(val.data).data.url).then((res) => {
if (res.code === 1) {
qyshow.value = false
setTimeout(() => {
userStore.getUserInfo()
uni.showToast({
title: '修改成功!',
icon: 'success'
})
}, 500)
} else {
uni.showToast({
title: '修改失败!',
icon: 'fail'
})
}
})
},
fail: (res) => {
console.log('失败',res);
}
})
}
</script>
@ -167,9 +303,10 @@
.right {
display: flex;
align-items: center;
.value {
font-family: Source Han Sans;
font-size: 14px;
font-size: 28rpx;
font-weight: 300;
text-align: right;
letter-spacing: normal;
@ -179,25 +316,31 @@
}
}
}
.popupbox {
display: grid;
align-items: center;
justify-items: center;
.title {
font-family: Source Han Sans;
font-size: 14px;
font-size: 28rpx;
font-weight: 300;
line-height: 17px;
line-height: 34rpx;
text-align: right;
letter-spacing: normal;
color: #273847;
padding: 30rpx 0;
}
.buts {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 30rpx;
.yunxu {
margin-left: 20px;
margin-left: 40rpx;
width: 180rpx;
height: 70rpx;
border-radius: 10rpx;

BIN
src/static/img/aiicon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

BIN
src/static/img/daan.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

BIN
src/static/img/timeicon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 732 B

BIN
src/static/img/yyzz.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

43
src/store/user.ts

@ -2,28 +2,24 @@
import { defineStore } from 'pinia'
import { getPrefixName } from '@/config'
import { getOpenid } from '@/api/login'
import { infoForOpenid, bind as bindApi } from '@/api/user'
import { infoForOpenid, logout } from '@/api/user'
interface userInfoStoreInt {
[n: string]: any
[n : string] : any
}
export default defineStore(
getPrefixName('user'),
() => {
const openId = ref('')
const mobile = ref('')
const meetId = ref('')
const showtoast = ref(false)
const userInfo = ref<userInfoStoreInt>({})
function getopenid(params: { code: string }) {
function getopenid(params : { code : string }) {
return new Promise<any>((resolve, reject) => {
getOpenid(params)
.then((res) => {
const { data } = res as { data: string }
openId.value = data
.then((res : any) => {
openId.value = res.data.openid
resolve({ code: 1, message: '登录成功~' })
})
.catch((err) => {
@ -33,10 +29,10 @@ export default defineStore(
}
function getUserInfo() {
return new Promise<any>( (resolve, reject) => {
infoForOpenid({ openid: openId.value, mobile: mobile.value, meetId: meetId.value})
.then((res) => {
const { data } = res as { data: userInfoStoreInt }
return new Promise<any>((resolve, reject) => {
infoForOpenid()
.then((res : any) => {
const { data } = res as { data : userInfoStoreInt }
userInfo.value = data || {}
resolve({ code: 1, data, message: 'SUCCESS' })
})
@ -47,21 +43,17 @@ export default defineStore(
})
}
function bindUser(id: number) {
return new Promise<any>((resolve, reject) => {
bindApi({ id, openid: openId.value })
.then(() => {
resolve({ code: 1, message: 'SUCCESS' })
})
.catch((err) => {
reject(err)
})
})
}
function logOut() {
if(uni.getStorageSync('access_token') === '') {
uni.navigateTo({
url: '/pages/login/login'
})
} else {
userInfo.value = {}
uni.clearStorageSync()
const res = logout()
console.log(res,uni.getStorageSync('access_token'));
uni.showToast({
icon: 'none',
@ -72,15 +64,14 @@ export default defineStore(
}
})
}
}
return {
openId,
mobile,
meetId,
showtoast,
userInfo,
getopenid,
bindUser,
getUserInfo,
logOut
}

9
src/utils/http.ts

@ -28,7 +28,10 @@ export const request = {
url = import.meta.env.VITE_APP_BASE_URL + url
// #endif
const header = Object.assign({ 'content-type': 'application/json', Authorization: '' }, headers)
const header = Object.assign({ 'content-type': 'application/json',
Authorization: '',
'token': uni.getStorageSync('access_token') || '',
}, headers)
uni.request({
url,
@ -42,6 +45,10 @@ export const request = {
case 1:
resolve(res.data)
break
case 401:
uni.showToast({ title: data.msg, icon: 'none', mask: true })
uni.removeStorageSync('access_token')
break
default:
uni.showToast({ title: data.msg, icon: 'none', mask: true })
reject(res.data)

Loading…
Cancel
Save