Browse Source

市民云

dev
396316021 5 months ago
parent
commit
ae72286ad7
  1. 5
      api/user.js
  2. 1
      components/AdvisorPage/index.vue
  3. 3
      config/host.js
  4. 2
      index.html
  5. 2
      main.js
  6. 2
      pages/Login/index.vue
  7. 5
      uni_modules/m-view/index.js
  8. 60
      uni_modules/m-view/lib/cloud-lib.js

5
api/user.js

@ -1,5 +1,6 @@
import request from "@/utils/request.js";
import {host,cloud_host} from "@/config/host.js";
import {test_host} from "../config/host";
/**
* 登录
@ -8,7 +9,7 @@ import {host,cloud_host} from "@/config/host.js";
export function testLogin(data) {
return request({
url: `${host}/common/fake-login`,
url: `${test_host}/common/fake-login`,
method: "get",
data
});
@ -23,7 +24,7 @@ export function appletLogin(data) {
}
export function cloudLogin(data) {
return request({
url: `${host}/tfsmy/auth`,
url: `${test_host}/tfsmy/auth`,
method: "get",
data
});

1
components/AdvisorPage/index.vue

@ -597,6 +597,7 @@ export default {
sizeType: ['original', 'compressed'], //
sourceType: ['album'], //
success: function (res) {
console.log('res',res)
that.uploadAvatar({detail: {avatarUrl: res.tempFilePaths}});
}
});

3
config/host.js

@ -1,6 +1,7 @@
// const host='http://192.168.2.92:9505/api'
const host='https://nxr.fanyiguanjia.com/api'
// const host='https://nxr.test.fanyiguanjia.com/api'
const test_host='https://nxr.test.fanyiguanjia.com/api'
const h5_host='https://nxr.smy.fanyiguanjia.com/'
const cloud_host='https://cdpre.tfsmy.com/api'
@ -10,4 +11,4 @@ const imghost='https://nxr.fanyiguanjia.com/icon/static/image'
const title = '暖新人'
// const codehost='http://code.baomingle.cn'
const oss = 'https://fanyi-guanjia-1.'+'oss-cn-chengdu.aliyuncs.com'
export {host,imghost,title,oss,h5_host,cloud_host}
export {host,imghost,title,oss,h5_host,cloud_host,test_host}

2
index.html

@ -15,7 +15,7 @@
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
<script src="https://cdpre.tfsmy.com/api/js/eshiminJS-1.0.0.js"></script>
<script type="module" src="/main.js"></script>
</body>
</html>

2
main.js

@ -25,6 +25,8 @@ export function createApp() {
app.use(mView)
app.use(store)
uni.$u.config.unit = 'rpx'
return {
app
}

2
pages/Login/index.vue

@ -188,7 +188,7 @@ export default {
},
login(){
testLogin({
user_id:1
user_id:55
}).then((res) => {
uni.setStorageSync('token',res.data.token);
userDetail().then((res) => {

5
uni_modules/m-view/index.js

@ -1,12 +1,15 @@
import api from './lib/functions.js'
import tools from './lib/tools.js'
import cloud from './lib/cloud-lib.js'
import service from "@/uni_modules/m-view/lib/request";
const $m = {
...api,
...tools,
service
}
// #ifdef H5
cloud.build();
// #endif
// $m挂载到uni对象上
uni.$m = $m

60
uni_modules/m-view/lib/cloud-lib.js

@ -0,0 +1,60 @@
function dataURLToBlob(cropperData) {
let arr = cropperData.split(",");
console.log('arr',arr)
let mime = arr[0].match(/:(.*?);/)[1];
let blobStr = atob(arr[1]);
let n = blobStr.length;
let u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = blobStr.charCodeAt(n);
}
return URL.createObjectURL(new Blob([u8arr], { type: mime }))
}
export default {
build() {
uni.chooseImage = (params) => {
try {
if('compile' in params)params.compile();
eshimin.getLocalPicture({
onResponse:function (res) {
if('success' in params)params.success([dataURLToBlob(res.img)]);
}
});
}catch (e){
console.log(e)
if('fail' in params)params.fail(e);
}
}
uni.getLocation = (params) => {
try {
console.log('getLocation', params)
if('compile' in params)params.compile();
eshimin.getLocation({
onResponse:function (res) {
if('success' in params)params.success(res);
}
});
}catch (e){
console.log(e)
if('fail' in params)params.fail(e);
}
}
uni.makePhoneCall = (params) => {
try {
console.log('makePhoneCall', params)
if('compile' in params)params.compile();
eshimin.getLocation({
phoneNum:params.phoneNumber,
onResponse:function (res) {
if('success' in params)params.success(res);
}
});
}catch (e){
console.log(e)
if('fail' in params)params.fail(e);
}
}
},
};
Loading…
Cancel
Save