浏览代码

Merge branch 'dev-1.2.0' into jyb_20250506_dev

jiayubo 3 月之前
父节点
当前提交
43ad336dfb

+ 0 - 3
api/file.js

@@ -1,7 +1,4 @@
 import request from '../utils/request'
-import { getToken } from '@/utils/auth'
-import config from '@/config'
-const baseUrl = config.baseUrl
 
 //文件上传
 export function uploadFile(data) {

+ 53 - 0
api/version.js

@@ -0,0 +1,53 @@
+import { toast, showConfirm, tansParams } from '@/utils/common'
+import { RequestConfig, ResponseData } from '@/types/request'
+import errorCode from '@/utils/errorCode'
+import config from '@/config'
+const baseUrl = config.baseUrl
+export function getVersion(version) {
+    return new Promise((resolve, reject) => {
+      if(uni.getAccountInfoSync().miniProgram.envVersion === 'develop'){
+        resolve({
+          data:{
+            serviceUrl: baseUrl
+          }
+        })
+      }
+        uni.request({
+          method: 'GET',
+          timeout: 600000,
+          url: baseUrl + `/system/config/serviceUrl/${version}`,
+          data: {},
+          header: {},
+          dataType: 'json'
+        }).then(response => {
+          const res = response
+          const data = res.data
+          const code = data.code || 200
+          // @ts-ignore
+          const msg = errorCode[code] || data.msg || errorCode['default']
+          if (code === 401) {          
+            reject('500')
+          } else if (code === 500) {
+            toast(msg)
+            reject('500')
+          } else if (code !== 200) {
+            toast(msg)
+            reject(code)
+          }
+          resolve(data)
+        })
+          .catch(error => {
+            let message = error?.message || '未知错误'
+            uni.hideLoading()
+            if (message === 'Network Error') {
+              message = '后端接口连接异常'
+            } else if (message.includes('timeout')) {
+              message = '系统接口请求超时'
+            } else if (message.includes('Request failed with status code')) {
+              message = '系统接口' + message.substr(message.length - 3) + '异常'
+            }
+            toast(message)
+            reject(error)
+          })
+      })
+}

+ 3 - 1
config.js

@@ -1,5 +1,6 @@
 const base_url = {
   // develop:'http://192.168.100.128:9527',//开发版 
+  // develop: 'https://yongc.top/prod-api',//开发版
   // develop: 'http://192.168.100.139:9527', //嵘哥
   develop: 'https://yongc.top/prod-api',//体验版
   // develop: 'https://goldshulin.com/prod-api',//体验版
@@ -22,7 +23,7 @@ const config = {
   // 应用信息
   appInfo: {
     // 应用名称
-    name: 'ruoyi-app-vue3',
+    name: '金邻助家',
     // 应用版本
     version: '1.2.0',
     // 应用logo
@@ -41,6 +42,7 @@ const config = {
       },
     ],
   },
+  base_url,
 }
 
 export default config

+ 0 - 2
main.js

@@ -3,7 +3,6 @@ import plugins from './plugins'
 import uviewPlus from 'uview-plus'
 import store from './store/index.ts'
 import shareMixin from '@/utils/shareMixin'
-import soketMixin from '@/utils/soketMixin'
 
 import { createSSRApp } from 'vue'
 export function createApp() {
@@ -12,7 +11,6 @@ export function createApp() {
   app.use(plugins)
   app.use(store)
   app.mixin(shareMixin)
-  // app.mixin(soketMixin)
 
   return {
     app

+ 26 - 16
pages.json

@@ -11,7 +11,6 @@
 		}
 	},
 	"pages": [
-		
 		{
 			"path": "pages/index",
 			"style": {
@@ -149,12 +148,12 @@
 						"navigationBarTitleText": "资质管理"
 					}
 				},
-        {
-          "path": "pages/search/index",
-          "style": {
-            "navigationBarTitleText": "搜索服务"
-          }
-        }
+				{
+					"path": "pages/search/index",
+					"style": {
+						"navigationBarTitleText": "搜索服务"
+					}
+				}
 			]
 		},
 		{
@@ -252,12 +251,24 @@
 						"navigationBarTitleText": "个人信息"
 					}
 				},
-        {
-          "path": "pages/integral/index",
-          "style": {
-            "navigationBarTitleText": "查看积分"
-          }
-        }
+				{
+					"path": "pages/authentication/index",
+					"style": {
+						"navigationBarTitleText": "实名认证"
+					}
+				},
+				{
+					"path": "pages/mp_ecard_sdk/index/index",
+					"style": {
+						"navigationBarTitleText": "腾讯云E证通授权"
+					}
+				},
+				{
+					"path": "pages/integral/index",
+					"style": {
+						"navigationBarTitleText": "查看积分"
+					}
+				}
 			]
 		},
 		{
@@ -407,10 +418,9 @@
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarBackgroundColor": "#FFFFFF",
-		"enableShareAppMessage":true
-	},
-	"plugins": {
+		"enableShareAppMessage": true
 	},
+	"plugins": {},
 	"permission": {
 		"scope.userFuzzyLocation": {
 			"desc": "你的位置信息将用于小程序定位"

+ 6 - 5
pages/chat.vue

@@ -294,13 +294,14 @@ onMounted(() =>{
             height: 84rpx;
             border-radius: 84rpx;
             margin-right: 26rpx;
+            margin-top: 16rpx;
         }
 
         .chat-box {
             flex: 1;
             border-bottom: 1rpx solid rgba(216, 216, 216, 0.8);
             height: 100%;
-            padding-bottom: 30rpx;
+            padding: 30rpx 0 16rpx;
             padding-right: 53rpx;
 
             .chat-top {
@@ -368,9 +369,9 @@ onMounted(() =>{
 
 
         }
-        .chat-box:last-child {
-            border-bottom:none; 
-        }
+        // .chat-box:last-child {
+        //     border-bottom:none; 
+        // }
 
     }
 }
@@ -405,7 +406,7 @@ onMounted(() =>{
 
 
 .chat-sys-box {
-    padding: 24rpx 32rpx 46rpx;
+    padding: 24rpx 32rpx 10rpx;
     display: flex;
     gap: 32rpx;
 

+ 29 - 13
pages/mine/index.vue

@@ -190,6 +190,15 @@ const priceList = computed(() => {
 const userType = uni.getStorageSync('userType') //读取本地存储
 
 const adminList = [
+// {
+//     name: '实名认证',
+//     img: '/static/serverImg/mine/adress.png',
+//     key: 'map',
+//     text: '前往实名认证',
+//     operate: () => {
+//       hanldeAuthentication()
+//     },
+//   },
   {
     name: '我的地址',
     img: '/static/serverImg/mine/adress.png',
@@ -235,10 +244,10 @@ const adminList = [
     },
   },
   {
-    name: '切换为用户',
+    name: '志愿者',
     img: '/static/serverImg/mine/sf.png',
     key: 'map',
-    text: '切换身份',
+    text: '切换为用户',
     operate: () => {
       switchUserType(1)
     },
@@ -246,6 +255,15 @@ const adminList = [
 
 ]
 const userList = [
+  // {
+  //   name: '实名认证',
+  //   img: '/static/serverImg/mine/adress.png',
+  //   key: 'map',
+  //   text: '前往实名认证',
+  //   operate: () => {
+  //     hanldeAuthentication()
+  //   },
+  // },
   {
     name: '我的地址',
     img: '/static/serverImg/mine/adress.png',
@@ -273,20 +291,12 @@ const userList = [
       show.value = true
     },
   },
-  // {
-  //     name: '修改个人信息',
-  //     img: '/static/serverImg/mine/xg.png',
-  //     key: 'map',
-  //     text: '去实名认证',
-  //     operate: () => {
-  //         handLsetTing();
-  //     },
-  // },
+
   {
-    name: '切换为志愿者',
+    name: '用户',
     img: '/static/serverImg/mine/sf.png',
     key: 'map',
-    text: '切换身份',
+    text: '切换为志愿者',
     operate: () => {
       switchUserType(2)
     },
@@ -294,6 +304,12 @@ const userList = [
 ]
 
 
+// 实名认证
+const hanldeAuthentication = () => {
+  uni.navigateTo({
+        url: `/pages_mine/pages/authentication/index`
+ })
+}
 const switchUserType = (userType) => {
   uni.setStorageSync('userType', userType)
   store.dispatch('GetInfo').then((res) => {

+ 79 - 0
pages_mine/pages/authentication/index.vue

@@ -0,0 +1,79 @@
+<template>
+  <view class="token-input">
+
+    <view class="title">
+      请输入EID token
+    </view>
+
+    <view style="margin-bottom: 60rpx">
+      <input @input="bindTokenInput" placeholder="请输入token" :value="token" />
+    </view>
+
+    <view>
+      <button @click='onConfirm'>跳转到eID小程序</button>
+    </view>
+
+  </view>
+</template>
+
+<script>
+import { startEid, initEid } from '../mp_ecard_sdk/main'
+export default {
+  data() {
+    return {
+      token: '',
+    }
+  },
+  onLaunch: function () {
+    //初始化
+    initEid();
+  },
+  methods: {
+    bindTokenInput(e) {
+      console.log('dd', e)
+      this.token = e.detail.value;
+    },
+    onConfirm() {
+      console.log('startEid', startEid)
+      const param = {
+        data: {
+          token: this.token,
+        },
+        verifyDoneCallback(res) {
+          console.log('收到核身完成的res', res);
+        },
+      };
+      this.token && startEid(param);
+    },
+  }
+}
+</script>
+
+
+<style>
+.token-input {
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  /* justify-content: center; */
+}
+
+input {
+  margin-bottom: 40rpx;
+  border: 1px solid #ccc;
+  width: 600rpx;
+  height: 80rpx;
+}
+
+button {
+  width: 622rpx !important;
+  height: 96rpx !important;
+  background-color: #198eea;
+  color: #FFFFFF;
+  border: 2rpx solid #DDDDDD;
+  font-size: 32rpx;
+  font-weight: normal !important;
+  line-height: 96rpx !important;
+}
+</style>

+ 0 - 1
pages_mine/pages/income/index.vue

@@ -77,7 +77,6 @@ const {
     jlzj_volunteer_source_type,
     is_pay
 } = useDict('jlzj_money_change_type', 'jlzj_client_source_type','jlzj_volunteer_source_type','is_pay');
-const baseUrl = config.baseUrl
 const userType = uni.getStorageSync('userType') //读取本地存储
 const data = ref({
     totalEarning: 0,

文件差异内容过多而无法显示
+ 1 - 0
pages_mine/pages/mp_ecard_sdk/constants/log.js


+ 1 - 0
pages_mine/pages/mp_ecard_sdk/globalConfig.js

@@ -0,0 +1 @@
+export default{normalPath:"/pages_mine/pages"};

文件差异内容过多而无法显示
+ 1 - 0
pages_mine/pages/mp_ecard_sdk/index.css


+ 1 - 0
pages_mine/pages/mp_ecard_sdk/index/index.js

@@ -0,0 +1 @@
+import Log from"../constants/log.js";import{navigateToEid,reportStat}from"../utils/index";export default{data(){return{token:""}},onLoad(t){var{token:t,needJumpPage:e}=t;this.token=t,uni.reportLogToEid({token:t,event:Log.getIntoIndexPage,errMsg:`进入配置首页,token:${t},needJumpPage:`+e}),reportStat({module:"StartIndex",action:"enter"})},onUnload(){reportStat({module:"StartIndex",action:"leave"})},methods:{handleStart(){navigateToEid(this.token)}}};

+ 24 - 0
pages_mine/pages/mp_ecard_sdk/index/index.vue

@@ -0,0 +1,24 @@
+<template>
+	<view class="auth">
+		<view class="auth-logo">
+			<image src="https://faceid-h5-1254418846.file.myqcloud.com/mp_verify_sdk/images/ecard/logo.png" />
+		</view>
+		<view class="title">
+			即将进入"eID数字身份"小程序
+		</view>
+		<view class="button-area">
+			<button @click='handleStart' >
+				确认进入
+			</button>
+		</view>
+	</view>
+</template>
+
+<script>
+import index from "./index";
+export default index;
+</script>
+
+<style>
+@import url('../index.css');
+</style>

文件差异内容过多而无法显示
+ 1 - 0
pages_mine/pages/mp_ecard_sdk/main.js


文件差异内容过多而无法显示
+ 1 - 0
pages_mine/pages/mp_ecard_sdk/utils/http.js


文件差异内容过多而无法显示
+ 1 - 0
pages_mine/pages/mp_ecard_sdk/utils/index.js


+ 1 - 0
pages_mine/pages/mp_ecard_sdk/utils/validate.js

@@ -0,0 +1 @@
+function isValidateToken(e){return/^[a-zA-Z0-9-]{36}$/.test(e)}export default{isValidateToken:isValidateToken};

文件差异内容过多而无法显示
+ 76 - 55
pages_orderuser/pages/talk/pages/index/index.vue


+ 1 - 5
store/modules/user.ts

@@ -1,11 +1,9 @@
-import config from '@/config'
 import storage from '@/utils/storage'
 import constant from '@/utils/constant'
 import { login, logout, getInfo } from '@/api/login'
 import { getToken, setToken, removeToken } from '@/utils/auth'
 import { UserState, UserForm } from '@/types/store'
 import { Module } from 'vuex'
-const baseUrl = config.baseUrl
 
 const user: Module<UserState, UserState> = {
   state: {
@@ -130,9 +128,7 @@ const user: Module<UserState, UserState> = {
           commit('SET_AVATAR', avatar)
           commit('SET_NICKNAME', res.user.nickName)
           commit('SET_USERID', res.user.userId)
-
-          uni.setStorageSync('userType', res.user.userId)
-
+          
           uni.$u.connectSoket(res.user.userId);
 
 

+ 18 - 13
utils/request.ts

@@ -1,14 +1,16 @@
 import store from '@/store'
 import config from '@/config'
-import { getToken,removeToken } from '@/utils/auth'
+import { getToken, removeToken } from '@/utils/auth'
 import errorCode from '@/utils/errorCode'
 import { toast, showConfirm, tansParams } from '@/utils/common'
 import { RequestConfig, ResponseData } from '@/types/request'
-
+import { getVersion } from '@/api/version'
 let timeout = 600000
-const baseUrl = config.baseUrl
+const baseConfig = config
+
 
-const request = <T>(config:RequestConfig):Promise<ResponseData<T>> => {
+let base_url = null;
+const request = <T>(config: RequestConfig): Promise<ResponseData<T>> => {
   // 是否需要设置 token
   const isToken = (config.headers || {}).isToken === false
   config.header = config.header || {}
@@ -21,11 +23,16 @@ const request = <T>(config:RequestConfig):Promise<ResponseData<T>> => {
     url = url.slice(0, -1)
     config.url = url
   }
-  return new Promise((resolve, reject) => {
+  return new Promise(async (resolve, reject) => {
+    if (!base_url) {
+      const ver_res = await getVersion(baseConfig.appInfo.version)
+      base_url = ver_res.data.serviceUrl;
+      console.log("TCL: ver_res", ver_res)
+    }
     uni.request({
       method: config.method || 'GET',
       timeout: config.timeout || timeout,
-      url: config.baseUrl || baseUrl + config.url,
+      url: config.baseUrl || base_url + config.url,
       data: config.data,
       header: config.header,
       dataType: 'json'
@@ -37,13 +44,13 @@ const request = <T>(config:RequestConfig):Promise<ResponseData<T>> => {
          return
        } */
       const res = response
-      const data:ResponseData<T> = res.data as ResponseData<T>
+      const data: ResponseData<T> = res.data as ResponseData<T>
       const code = data.code || 200
       // @ts-ignore
-      const msg:string = errorCode[code] || data.msg || errorCode['default']
+      const msg: string = errorCode[code] || data.msg || errorCode['default']
       if (code === 401) {
         uni.$u.debounce(startConfirm, 500)
-      
+
         reject('无效的会话,或者会话已过期,请重新登录。')
       } else if (code === 500) {
         toast(msg)
@@ -70,11 +77,9 @@ const request = <T>(config:RequestConfig):Promise<ResponseData<T>> => {
   })
 }
 
-const startConfirm = ()=>{
-  console.log('________________________>>>>');
-  // return
+const startConfirm = () => {
   store.dispatch('ClearUserInfo');
-  showConfirm(getToken()?'您的登陆已过期,请重新登陆!':'您还未登陆系统,是否前往登陆?').then(res => {
+  showConfirm(getToken() ? '您的登陆已过期,请重新登陆!' : '您还未登陆系统,是否前往登陆?').then(res => {
     if (res.confirm) {
       store.dispatch('LogOut').then(res => {
         uni.navigateTo({ url: '/pages/login' })

+ 5 - 5
utils/shareMixin.js

@@ -1,18 +1,18 @@
 import { onLaunch, onShow, onHide, onShareAppMessage, onShareTimeline } from "@dcloudio/uni-app";
+import { getToken } from '@/utils/auth'
 export default {
   data() {
     return {
       // 可全局覆盖的默认参数
       shareConfig: {
         title: '金邻助家-着力打造全国居家服务行业标准和建立综合信用评价体系',
-        // path: `/pages/login?scene=${uni.getStorageSync('userType')}:${uni.getStorageSync('userId')}`,
-        path:'/pages/index',
+        path: `/pages/login?scene=${uni.getStorageSync('userType')}:${uni.getStorageSync('userId')}`,
+        // path:'/pages/index',
         // imageUrl: '/static/serverImg/mine/user.png',
         imageUrl:''
       }
     }
   },
- 
   onLaunch:function () { 
     uni.showShareMenu({
       withShareTicket: true,
@@ -29,8 +29,8 @@ export default {
   onShareTimeline() {
     return {
       title: this.shareConfig.title,
-      // query: `scene=${uni.getStorageSync('userType')}:${uni.getStorageSync('userId')}`,
-      query:``,
+      query: `scene=${uni.getStorageSync('userType')}:${uni.getStorageSync('userId')}`,
+      // query:``,
       imageUrl: this.shareConfig.imageUrl
     }
   }

+ 10 - 4
utils/upload.ts

@@ -4,9 +4,10 @@ import { getToken } from '@/utils/auth'
 import errorCode from '@/utils/errorCode'
 import { toast, showConfirm, tansParams } from '@/utils/common'
 import { ResponseData, RequestUploadConfig } from '@/types/request'
-
+import { getVersion } from '@/api/version'
+let base_url = null;
+const baseConfig = config
 let timeout = 10000
-const baseUrl = config.baseUrl
 
 const upload = <T>(config:RequestUploadConfig):Promise<ResponseData<T>> => {
   // 是否需要设置 token
@@ -21,10 +22,15 @@ const upload = <T>(config:RequestUploadConfig):Promise<ResponseData<T>> => {
     url = url.slice(0, -1)
     config.url = url
   }
-  return new Promise((resolve, reject) => {
+  return new Promise(async(resolve, reject) => {
+    if (!base_url) {
+          const ver_res = await getVersion(baseConfig.appInfo.version)
+          base_url = ver_res.data.serviceUrl;
+          console.log("TCL: ver_res", ver_res)
+        }
       uni.uploadFile({
         timeout: config.timeout || timeout,
-        url: baseUrl + config.url,
+        url: base_url + config.url,
         filePath: config.filePath,
         name: config.name || 'file',
         header: config.header,

+ 10 - 4
utils/wxRequest.js

@@ -1,7 +1,8 @@
 import { getToken } from '@/utils/auth'
+import { getVersion } from '@/api/version'
 import config from '@/config'
-const baseUrl = config.baseUrl
-
+let base_url = null;
+const baseConfig = config
 //上传文件还是选择相册图片
 const getWxFile = (type,fileNum) => {
     return new Promise((resolve, reject) => {
@@ -47,10 +48,15 @@ const getWxFile = (type,fileNum) => {
     })
 }
 const getUploadPromise = (file) => {
-    return new Promise((resolve, reject) => {
+    return new Promise(async(resolve, reject) => {
         const path = file.path
+         if (!base_url) {
+              const ver_res = await getVersion(baseConfig.appInfo.version)
+              base_url = ver_res.data.serviceUrl;
+              console.log("TCL: ver_res", ver_res)
+            }
         wx.uploadFile({
-            url: baseUrl + '/common/upload',  // 服务器接口地址 
+            url: base_url + '/common/upload',  // 服务器接口地址 
             filePath: path,        // 本地文件路径(通过 wx.chooseImage  获取)
             name: 'file',                      // 文件对应的 key(服务器接收字段名)
             formData: {                        // 额外表单数据